695593266@qq.com 10 месяцев назад
Родитель
Сommit
dcd81ac1bb

+ 18 - 11
src/views/inspectionWork/components/baseInfo.vue

@@ -140,14 +140,6 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="质检时间:" prop="qualityTime">
-            <!-- <el-date-picker
-              class="w100"
-              v-model="form.qualityTime"
-              type="date"
-              value-format="yyyy-MM-dd"
-              :disabled="btnType == 'detail'"
-              placeholder="请选择"
-            ></el-date-picker> -->
             <el-date-picker
               v-model="form.qualityTime"
               class="w100"
@@ -483,9 +475,9 @@
           // qualityId: [
           //   { required: true, message: '请选择质检人', trigger: 'change' }
           // ],
-          qualityIdList: [
-            { required: true, message: '请选择质检人', trigger: 'change' }
-          ],
+          // qualityIdList: [
+          //   { required: true, message: '请选择质检人', trigger: 'blur' }
+          // ],
           qualityResults: [
             { required: true, message: '请选择质检结果', trigger: 'change' }
           ],
@@ -541,6 +533,21 @@
         this.form.noQualificationRate = failureRate + '%';
         return true;
       },
+      deepCopy(obj, hash = new WeakMap()) {
+        if (obj === null) return null;
+        if (obj instanceof Date) return new Date(obj);
+        if (obj instanceof RegExp) return new RegExp(obj);
+        if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
+        if (hash.has(obj)) return hash.get(obj); // 处理循环引用
+
+        const result = Array.isArray(obj) ? [] : {};
+        hash.set(obj, result); // 存储原始对象和其副本的映射关系
+
+        return Object.keys(obj).reduce((acc, key) => {
+          acc[key] = this.deepCopy(obj[key], hash);
+          return acc;
+        }, result);
+      },
 
       toggleExpand() {
         this.isExpanded = !this.isExpanded;

+ 33 - 13
src/views/inspectionWork/components/sampleListDialog.vue

@@ -430,21 +430,41 @@
       },
 
       handleInput(item, value) {
-        console.log(item, value, 'item item item');
-        if (item.defaultValue) {
-          const number = Number(item.defaultValue);
-
-          if (isNaN(number)) return;
-
-          const valueNumber = Number(value);
-
-          if (isNaN(valueNumber)) return;
+        if (value) {
+          if (item.textType == '1') {
+            if (!item.symbol) {
+              if (item.qualityResultContent != item.defaultValue) {
+                this.$set(item, 'qualityResults', 2);
+              } else {
+                this.$set(item, 'qualityResults', 1);
+              }
+              this.qualityResultsListChange();
+              return;
+            }
+            let key = this.mathematicalJudgment(item);
+            this.$set(item, 'qualityResults', key);
+            this.qualityResultsListChange();
+          }
 
-          if (valueNumber > number) {
-            item.qualityResults = 2;
-          } else {
-            item.qualityResults = 1;
+          if (item.textType == '3') {
+            let num = Number(item.qualityResultContent);
+            if (num == NaN) {
+              this.$set(item, 'qualityResults', 2);
+              this.qualityResultsListChange();
+              return;
+            }
+            console.log(num, 'num');
+            if (num >= Number(item.minValue) && num <= Number(item.maxValue)) {
+              this.$set(item, 'qualityResults', 1);
+              this.qualityResultsListChange();
+            } else {
+              this.$set(item, 'qualityResults', 2);
+              this.qualityResultsListChange();
+            }
           }
+        } else {
+          this.$set(item, 'qualityResults', 1);
+          this.qualityResultsListChange();
         }
       },
 

+ 12 - 0
src/views/inspectionWork/edit.vue

@@ -1129,6 +1129,12 @@
         // let flag = this.$refs.baseInfoRefs.quantityCalculation();
         // if (!flag) return;
         // ***
+
+        if (this.form.qualityIdList.length == 0) {
+          this.$message.error('请选择质检人');
+          return;
+        }
+
         this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
           if (!valid) {
             return false;
@@ -1138,6 +1144,7 @@
             this.type == 'add' ? save : this.type == 'edit' ? update : '';
 
           this.form.qualityTimeStart = this.qualityTimeStart;
+          this.form.qualityId = this.form.qualityIdList.join(',');
 
           delete this.form['qualityTimeEnd'];
 
@@ -1238,6 +1245,11 @@
       },
       // 报工
       handleReporting(index, row) {
+        if (this.form.qualityIdList.length == 0) {
+          this.$message.error('请选择质检人');
+          return;
+        }
+
         if (this.form.qualityMode == 2 && !this.form.qualityResults) {
           this.$refs.baseInfoRefs.toggleExpand2();
           this.$message.error('请选择质检结果');

+ 2 - 1
vue.config.js

@@ -34,10 +34,11 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.107:18086',
         // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.144:18086',
+        // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.30:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://124.71.68.31:50001',
+        target: 'http://192.168.1.251:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''