Explorar o código

修改质检工单的bug

695593266@qq.com hai 1 ano
pai
achega
5cff2c237b
Modificáronse 2 ficheiros con 837 adicións e 668 borrados
  1. 291 269
      src/views/inspectionWork/components/baseInfo.vue
  2. 546 399
      src/views/inspectionWork/edit.vue

+ 291 - 269
src/views/inspectionWork/components/baseInfo.vue

@@ -3,7 +3,12 @@
     <el-row>
       <el-col :span="6">
         <el-form-item label="编码:">
-          <el-input :maxlength="20" v-model="form.code" disabled placeholder="请输入" />
+          <el-input
+            :maxlength="20"
+            v-model="form.code"
+            disabled
+            placeholder="请输入"
+          />
         </el-form-item>
       </el-col>
       <!-- <el-col :span="6">
@@ -65,15 +70,18 @@
       </el-col>
       <el-col :span="6">
         <el-form-item label="总数量:" prop="total">
-          <el-input type="number" v-model="form.total" @input="inputTotal" disabled />
+          <el-input
+            type="number"
+            v-model="form.total"
+            @input="inputTotal"
+            disabled
+          />
         </el-form-item>
       </el-col>
     </el-row>
-    <div style="text-align: right;margin-bottom: 22px;">
+    <div style="text-align: right; margin-bottom: 22px">
       <div @click="toggleExpand">
-        <div v-if="isExpanded">
-          <i class="el-icon-arrow-up"></i>收起
-        </div>
+        <div v-if="isExpanded"> <i class="el-icon-arrow-up"></i>收起 </div>
         <div v-if="!isExpanded">
           <i class="el-icon-arrow-down"></i>展开更多
         </div>
@@ -123,7 +131,10 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="工时(h):" prop="hours">
-            <el-input v-model="form.hours" :disabled="btnType == 'detail'"></el-input>
+            <el-input
+              v-model="form.hours"
+              :disabled="btnType == 'detail'"
+            ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -168,7 +179,11 @@
       <el-row>
         <el-col :span="6">
           <el-form-item label="总重量:" prop="totalWeight">
-            <el-input type="number" :disabled="btnType == 'detail'" v-model="form.totalWeight" />
+            <el-input
+              type="number"
+              :disabled="btnType == 'detail'"
+              v-model="form.totalWeight"
+            />
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -178,7 +193,9 @@
               style="width: 100%"
               v-model="form.inspectionStandards"
               placeholder="请选择"
-              :disabled="parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3"
+              :disabled="
+                parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3
+              "
             >
               <el-option
                 v-for="item in inspectionStandardsList"
@@ -196,7 +213,9 @@
               style="width: 100%"
               v-model="form.qualityMode"
               placeholder="请选择"
-              :disabled="parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3"
+              :disabled="
+                parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3
+              "
             >
               <el-option
                 v-for="item in qualityModeList"
@@ -290,14 +309,14 @@
           </el-form-item>
         </el-col> -->
         <el-col :span="6">
-        <el-form-item label="质检类型:" prop="qualityType">
-          <DictSelection
-            dictName="质检计划类型"
-            v-model="form.qualityType"
-            disabled
-          ></DictSelection>
-        </el-form-item>
-      </el-col>
+          <el-form-item label="质检类型:" prop="qualityType">
+            <DictSelection
+              dictName="质检计划类型"
+              v-model="form.qualityType"
+              disabled
+            ></DictSelection>
+          </el-form-item>
+        </el-col>
         <el-col :span="6">
           <!-- <el-form-item label="质检结果:" prop="qualityResults" v-if="form.qualityMode == 2"> -->
           <el-form-item label="质检结果:" prop="qualityResults">
@@ -324,7 +343,10 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="附件:" prop="accessory">
-            <fileUpload v-model="form.accessory" :type="btnType == 'detail' ? 'view' : ''" />
+            <fileUpload
+              v-model="form.accessory"
+              :type="btnType == 'detail' ? 'view' : ''"
+            />
           </el-form-item>
         </el-col>
       </el-row>
@@ -334,272 +356,272 @@
   </el-form>
 </template>
 <script>
-import deptSelect from '@/components/CommomSelect/dept-select.vue';
-import fileUpload from '@/components/addDoc/index.vue';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import fileUpload from '@/components/addDoc/index.vue';
 
-import ProductionVersion from './ProductionVersion.vue';
-import EquipmentDialog from './EquipmentDialog.vue';
-//接口
-import { getUserPage } from '@/api/system/organization';
+  import ProductionVersion from './ProductionVersion.vue';
+  import EquipmentDialog from './EquipmentDialog.vue';
+  //接口
+  import { getUserPage } from '@/api/system/organization';
 
-import { getProduceTaskList } from '@/api/aps';
-import { getByCode } from '@/api/system/dictionary-data';
+  import { getProduceTaskList } from '@/api/aps';
+  import { getByCode } from '@/api/system/dictionary-data';
 
-export default {
-  components: {
-    EquipmentDialog,
-    ProductionVersion,
-    deptSelect,
-    fileUpload
-  },
-  props: {
-    form: {
-      type: Object,
-      default: () => {}
-    },
-    btnType: {
-      type: String,
-      default: ''
+  export default {
+    components: {
+      EquipmentDialog,
+      ProductionVersion,
+      deptSelect,
+      fileUpload
     },
-    qualityType1: {
-      type: String,
-      default: ''
-    },
-    sampleList: {
-      type: Array,
-      default: () => []
-    }
-  },
-  watch: {
-    'form.qualityMode': {
-      handler(newVal) {
-        if (newVal) {
-          this.$emit('changeModel', newVal);
-        } else {
-          console.log('清空样品清单');
-          // this.$emit('table2');
-        }
+    props: {
+      form: {
+        type: Object,
+        default: () => {}
       },
-      immediate: false
-    },
-    'form.inspectionStandards': {
-      handler(newVal) {
-        if (newVal && this.qualityType1 == 2) {
-          this.$emit('changeInspectionStandardsModel', newVal);
-        } else {
-          console.log('清空样品清单');
-          // this.$emit('table2');
-        }
-      },
-      immediate: false
-    },
-    // 新增 *** 监听合格率更改 质检结果
-    'form.qualificationRate': {
-      handler(newVal) {
-        if (newVal == '100.00%' || newVal == '100%' || newVal == '100.0%') {
-          this.$set(this.form, 'qualityResults', 1);
-        } else {
-          this.$set(this.form, 'qualityResults', 2);
-          // this.$emit('table2');
-        }
+      btnType: {
+        type: String,
+        default: ''
       },
-      immediate: false,
-      deep: true
-    }
-  },
-  data() {
-    return {
-      executorList: [],
-      sourceList: [],
-      rules: {
-        productName: [
-          { required: true, message: '请选择产品', trigger: 'change' }
-        ],
-        qualifiedNumber: [
-          { required: true, message: '请输入合格数', trigger: 'blur' }
-        ],
-        noQualifiedNumber: [
-          { required: true, message: '请输入不合格数', trigger: 'blur' }
-        ],
-        qualityTime: [
-          { required: true, message: '请选择质检时间', trigger: 'blur' }
-        ],
-        groupId: [
-          { required: true, message: '请选择质检部门', trigger: 'change' }
-        ],
-        qualityId: [
-          { required: true, message: '请选择质检人', trigger: 'change' }
-        ],
-        qualityResults: [
-          { required: true, message: '请选择质检结果', trigger: 'change' }
-        ],
-        inspectionStandards: [
-          { required: true, message: '请选择检验标准', trigger: 'change' }
-        ]
+      qualityType1: {
+        type: String,
+        default: ''
       },
-      produceTaskList: [],
-      inspectionStandardsList: [],
-      qualityModeList: [],
-      isExpanded: false
-    };
-  },
-  created() {
-    this.getDictListIqoCode('iqo_code');
-    this.getQualityModeList('quality_method_code');
-  },
-  methods: {
-    // *** 只能输入大于0的数字
-    limitation(val) {
-      this.form[val] =
-        this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
-    },
-    // *** 计算合格数 不合格数
-    quantityCalculation() {
-      let qualifiedNumber = this.form.qualifiedNumber - 0;
-      let noQualifiedNumber = this.form.noQualifiedNumber - 0;
-      let total = qualifiedNumber + noQualifiedNumber;
-      let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
-      let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
-      this.form.qualificationRate = passRate + '%';
-      this.form.noQualificationRate = failureRate + '%';
-      if (total != this.form.total) {
-        this.$message.warning('合格数加上不合格数需要等于总数量');
-        return false;
-      }
-      return true;
-    },
-
-    toggleExpand() {
-      this.isExpanded = !this.isExpanded;
-    },
-    toggleExpand2() {
-      this.isExpanded = true;
-      this.$nextTick(() => {
-        this.$refs.form1.validateField('qualityResults');
-      });
-    },
-    async getDictListIqoCode(code) {
-      let { data: res } = await getByCode(code);
-      this.inspectionStandardsList = res.map((item) => {
-        let values = Object.keys(item);
-        return {
-          value: Number(values[0]),
-          label: item[values[0]]
-        };
-      });
-    },
-    async getQualityModeList(code) {
-      let { data: res } = await getByCode(code);
-      this.qualityModeList = res.map((item) => {
-        let values = Object.keys(item);
-        return {
-          value: Number(values[0]),
-          label: item[values[0]]
-        };
-      });
-    },
-    // 打开工艺路线弹窗
-    openVersion() {
-      this.$refs.versionRefs.open();
-    },
-    //工艺路线回调
-    changeProduct(data) {
-      this.form.produceRoutingId = data.id;
-      this.form.produceRoutingName = data.name;
-      this.form.produceTaskId = '';
-      this.form.produceTaskName = '';
-      this.getTaskList();
-    },
-    // 获取工序数据
-    async getTaskList() {
-      if (!this.form.produceRoutingId) {
-        return;
+      sampleList: {
+        type: Array,
+        default: () => []
       }
-      const res = await getProduceTaskList({
-        isDetail: true,
-        pageNum: 1,
-        routingId: this.form.produceRoutingId,
-        size: -1
-      });
-      this.produceTaskList = res?.list;
     },
-    // 选择工序
-    produceTaskChange() {
-      if (!this.form.produceTaskId) {
-        return;
+    watch: {
+      'form.qualityMode': {
+        handler(newVal) {
+          if (newVal) {
+            this.$emit('changeModel', newVal);
+          } else {
+            console.log('清空样品清单');
+            // this.$emit('table2');
+          }
+        },
+        immediate: false
+      },
+      'form.inspectionStandards': {
+        handler(newVal) {
+          if (newVal && this.qualityType1 == 2) {
+            this.$emit('changeInspectionStandardsModel', newVal);
+          } else {
+            console.log('清空样品清单');
+            // this.$emit('table2');
+          }
+        },
+        immediate: false
+      },
+      // 新增 *** 监听合格率更改 质检结果
+      'form.qualificationRate': {
+        handler(newVal) {
+          // if (newVal == '100.00%' || newVal == '100%' || newVal == '100.0%') {
+          //   this.$set(this.form, 'qualityResults', 1);
+          // } else {
+          //   this.$set(this.form, 'qualityResults', 2);
+          //   // this.$emit('table2');
+          // }
+        },
+        immediate: false,
+        deep: true
       }
-      this.form.produceTaskName = this.produceTaskList.find(
-        (item) => item.id == this.form.produceTaskId
-      ).name;
     },
-    // 产品名称
-    addProduct() {
-      this.$refs.equipmentRefs.open();
+    data() {
+      return {
+        executorList: [],
+        sourceList: [],
+        rules: {
+          productName: [
+            { required: true, message: '请选择产品', trigger: 'change' }
+          ],
+          qualifiedNumber: [
+            { required: true, message: '请输入合格数', trigger: 'blur' }
+          ],
+          noQualifiedNumber: [
+            { required: true, message: '请输入不合格数', trigger: 'blur' }
+          ],
+          qualityTime: [
+            { required: true, message: '请选择质检时间', trigger: 'blur' }
+          ],
+          groupId: [
+            { required: true, message: '请选择质检部门', trigger: 'change' }
+          ],
+          qualityId: [
+            { required: true, message: '请选择质检人', trigger: 'change' }
+          ],
+          qualityResults: [
+            { required: true, message: '请选择质检结果', trigger: 'change' }
+          ],
+          inspectionStandards: [
+            { required: true, message: '请选择检验标准', trigger: 'change' }
+          ]
+        },
+        produceTaskList: [],
+        inspectionStandardsList: [],
+        qualityModeList: [],
+        isExpanded: false
+      };
     },
-    choose(data) {
-      this.form.productCode = data[0].code;
-      this.form.productName = data[0].name;
-      this.form.specification = data[0].specification;
-      this.form.modelType = data[0].modelType;
-      this.form.brandNo = data[0].brandNum;
+    created() {
+      this.getDictListIqoCode('iqo_code');
+      this.getQualityModeList('quality_method_code');
     },
+    methods: {
+      // *** 只能输入大于0的数字
+      limitation(val) {
+        this.form[val] =
+          this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
+      },
+      // *** 计算合格数 不合格数
+      quantityCalculation() {
+        let qualifiedNumber = this.form.qualifiedNumber - 0;
+        let noQualifiedNumber = this.form.noQualifiedNumber - 0;
+        let total = qualifiedNumber + noQualifiedNumber;
+        let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
+        let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
+        this.form.qualificationRate = passRate + '%';
+        this.form.noQualificationRate = failureRate + '%';
+        if (total != this.form.total) {
+          this.$message.warning('合格数加上不合格数需要等于总数量');
+          return false;
+        }
+        return true;
+      },
 
-    //选择部门(搜索)
-    searchDeptNodeClick(info, row) {
-      if (info) {
-        const params = { groupId: info };
-        this.getUserList(params);
-        this.form.groupName = row.name;
-      } else {
-        this.form.executeGroupId = null;
-      }
-    },
-    // 获取人员
-    async getUserList(params) {
-      try {
-        let data = { pageNum: 1, size: -1 };
-        // 如果传了参数就是获取巡点检人员数据
-        if (params) {
-          data = Object.assign(data, params);
+      toggleExpand() {
+        this.isExpanded = !this.isExpanded;
+      },
+      toggleExpand2() {
+        this.isExpanded = true;
+        this.$nextTick(() => {
+          this.$refs.form1.validateField('qualityResults');
+        });
+      },
+      async getDictListIqoCode(code) {
+        let { data: res } = await getByCode(code);
+        this.inspectionStandardsList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+      async getQualityModeList(code) {
+        let { data: res } = await getByCode(code);
+        this.qualityModeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+      // 打开工艺路线弹窗
+      openVersion() {
+        this.$refs.versionRefs.open();
+      },
+      //工艺路线回调
+      changeProduct(data) {
+        this.form.produceRoutingId = data.id;
+        this.form.produceRoutingName = data.name;
+        this.form.produceTaskId = '';
+        this.form.produceTaskName = '';
+        this.getTaskList();
+      },
+      // 获取工序数据
+      async getTaskList() {
+        if (!this.form.produceRoutingId) {
+          return;
         }
-        const res = await getUserPage(data);
-        this.executorList = res.list;
-      } catch (error) {}
-    },
-    // 人员选择
-    changeExecutor(val) {
-      if (val) {
-        this.form.executeId = val;
-        this.form.executeName = this.executorList.filter(
-          (item) => item.id === val
-        )[0].name;
-      }
-    },
-    inputTotal(val) {
-      if (val) {
-        this.form.total = val;
-        this.form.qualifiedNumber = val;
-      }
-    },
-    handleChangeNumber(val) {
-      this.form.sampleNumber = val;
-      console.log(val);
-      this.$emit('changeNumber', val);
-    },
+        const res = await getProduceTaskList({
+          isDetail: true,
+          pageNum: 1,
+          routingId: this.form.produceRoutingId,
+          size: -1
+        });
+        this.produceTaskList = res?.list;
+      },
+      // 选择工序
+      produceTaskChange() {
+        if (!this.form.produceTaskId) {
+          return;
+        }
+        this.form.produceTaskName = this.produceTaskList.find(
+          (item) => item.id == this.form.produceTaskId
+        ).name;
+      },
+      // 产品名称
+      addProduct() {
+        this.$refs.equipmentRefs.open();
+      },
+      choose(data) {
+        this.form.productCode = data[0].code;
+        this.form.productName = data[0].name;
+        this.form.specification = data[0].specification;
+        this.form.modelType = data[0].modelType;
+        this.form.brandNo = data[0].brandNum;
+      },
 
-    //更新合格率
-    updateQualificationRate(
-      qualifiedNumber,
-      noQualifiedNumber,
-      qualificationRate,
-      noQualificationRate
-    ) {
-      this.form.qualifiedNumber = qualifiedNumber;
-      this.form.noQualifiedNumber = noQualifiedNumber;
-      this.form.qualificationRate = qualificationRate + '%';
-      this.form.noQualificationRate = noQualificationRate + '%';
+      //选择部门(搜索)
+      searchDeptNodeClick(info, row) {
+        if (info) {
+          const params = { groupId: info };
+          this.getUserList(params);
+          this.form.groupName = row.name;
+        } else {
+          this.form.executeGroupId = null;
+        }
+      },
+      // 获取人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          this.executorList = res.list;
+        } catch (error) {}
+      },
+      // 人员选择
+      changeExecutor(val) {
+        if (val) {
+          this.form.executeId = val;
+          this.form.executeName = this.executorList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+      },
+      inputTotal(val) {
+        if (val) {
+          this.form.total = val;
+          this.form.qualifiedNumber = val;
+        }
+      },
+      handleChangeNumber(val) {
+        this.form.sampleNumber = val;
+        console.log(val);
+        this.$emit('changeNumber', val);
+      },
+
+      //更新合格率
+      updateQualificationRate(
+        qualifiedNumber,
+        noQualifiedNumber,
+        qualificationRate,
+        noQualificationRate
+      ) {
+        this.form.qualifiedNumber = qualifiedNumber;
+        this.form.noQualifiedNumber = noQualifiedNumber;
+        this.form.qualificationRate = qualificationRate + '%';
+        this.form.noQualificationRate = noQualificationRate + '%';
+      }
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped></style>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 546 - 399
src/views/inspectionWork/edit.vue


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio