فهرست منبع

质检工单问题修改

jingshuyong 10 ماه پیش
والد
کامیت
29f278b3ec

+ 28 - 1
src/views/inspectionProject/components/user-edit.vue

@@ -91,8 +91,9 @@
             ></DictSelection>
             <el-input
               v-model="form.defaultValue"
-              placeholder="请输入"
+              :placeholder="form.textType == '1' ? '请输入数字' : '请输入'"
               style="width: calc(100% - 100px)"
+              @input="defaultInput"
             ></el-input>
           </el-form-item>
         </el-col>
@@ -446,6 +447,32 @@
       this.getListFn();
     },
     methods: {
+      defaultInput(value) {
+        if(this.form.symbol !== '1'){
+          return;
+        }
+        // 1. 过滤非法字符(只保留数字、负号和小数点)
+        let filteredValue = value.replace(/[^0-9.-]/g, '');
+        // 2. 处理负号规则
+        const minusIndex = filteredValue.indexOf('-');
+        if (minusIndex > 0) {
+          // 负号不在首位则删除所有负号
+          filteredValue = filteredValue.replace(/-/g, '');
+        } else if (minusIndex === 0) {
+          // 保留首位的负号并移除其他负号
+          filteredValue = '-' + filteredValue.substring(1).replace(/-/g, '');
+        }
+
+        // 3. 处理小数点规则
+        const dotIndex = filteredValue.indexOf('.');
+        if (dotIndex !== -1) {
+          // 只保留第一个小数点,移除后续小数点
+          const parts = filteredValue.split('.');
+          filteredValue = parts[0] + '.' + parts.slice(1).join('');
+        }
+        // 4. 更新绑定值
+        this.form.defaultValue = filteredValue;
+      },
       /* 保存编辑 */
       save() {
         this.$refs.form.validate((valid) => {

+ 9 - 9
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -392,7 +392,7 @@
             prop="inspectionName"
             align="center"
           ></el-table-column>
-          <el-table-column label="工艺参数" prop="defaultValue" align="center">
+          <el-table-column label="工艺参数" show-overflow-tooltip prop="defaultValue" align="center">
             <template slot-scope="scope">
               <div style="display: flex; justify-content: center">
                 <span>{{ scope.row.symbol }}</span>
@@ -434,7 +434,7 @@
             </template>
           </el-table-column>
         </el-table>
-        <el-pagination
+        <!-- <el-pagination
           @size-change="handleSchemeSizeChange"
           @current-change="handleSchemeCurrentChange"
           :current-page="schemePagination.currentPage"
@@ -442,7 +442,7 @@
           :page-size="schemePagination.pageSize"
           layout="total, sizes, prev, pager, next, jumper"
           :total="schemeList.length"
-        />
+        /> -->
       </el-tab-pane>
     </el-tabs>
   </el-row>
@@ -770,12 +770,12 @@
       },
       // 分页后的质检方案列表
       paginatedSchemeList() {
-        const { currentPage, pageSize } = this.schemePagination;
-        const start = (currentPage - 1) * pageSize;
-        const end = start + pageSize;
-
-        return this.templateList?.slice(start, end);
-        // return this.schemeList?.slice(start, end);
+        // const { currentPage, pageSize } = this.schemePagination;
+        // const start = (currentPage - 1) * pageSize;
+        // const end = start + pageSize;
+        // console.log(this.templateList,'全部数据')
+        // return this.templateList?.slice(start, end);
+        return this.templateList;
       }
     },
 

+ 96 - 20
src/views/inspectionWork/components/sampleListDialog.vue

@@ -74,12 +74,16 @@
                 label="工艺参数"
                 prop="defaultValue"
                 align="center"
+                show-overflow-tooltip
               >
                 <template slot-scope="scope">
                   <!-- <span :class="scope.row.qualityResults === 2 ? 'warn' : ''">
                     {{ scope.row.defaultValue }}
                   </span> -->
-                  <div style="display: flex; justify-content: center" :class="scope.row.qualityResults === 2 ? 'warn' : ''">
+                  <div
+                    style="display: flex; justify-content: center"
+                    :class="scope.row.qualityResults === 2 ? 'warn' : ''"
+                  >
                     <span>{{ scope.row.symbol }}</span>
                     <span v-if="scope.row.textType == 3">
                       {{ scope.row.minValue }}-{{ scope.row.maxValue }}
@@ -219,7 +223,8 @@
             label: '名称',
             prop: 'categoryName',
             width: '150',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
           { label: '批次号', prop: 'batchNo', align: 'center' },
           // { label: '发货条码', prop: 'barcodes', align: 'center' },
@@ -293,11 +298,12 @@
           }
         }
         // 默认合格
-        list.map((item)=>{
-          item.qualitySampleTemplateList && item.qualitySampleTemplateList.map((el)=>{
-            el.qualityResults = el.qualityResults ? el.qualityResults : 1
-          })
-        })
+        list.map((item) => {
+          item.qualitySampleTemplateList &&
+            item.qualitySampleTemplateList.map((el) => {
+              el.qualityResults = el.qualityResults ? el.qualityResults : 1;
+            });
+        });
         this.tableData = JSON.parse(JSON.stringify(list));
         console.log(this.tableData, '33333333333333333');
 
@@ -323,30 +329,100 @@
       },
       inputResultContent(e, row) {
         console.log(row, 'row row row');
-        console.log(e, 'eeeeeeeee');
         if (row.textType == '1') {
-          if (row.qualityResultContent != row.defaultValue) {
-            this.$set(row, 'qualityResults', 2);
-          } else {
-            this.$set(row, 'qualityResults', 1);
+          if (!row.symbol) {
+            if (row.qualityResultContent != row.defaultValue) {
+              this.$set(row, 'qualityResults', 2);
+            } else {
+              this.$set(row, 'qualityResults', 1);
+            }
+            return;
           }
+          let key = this.mathematicalJudgment(row);
+          this.$set(row, 'qualityResults', key);
           return;
         }
+
         if (row.textType == '3') {
-          let num = Number(row.qualityResultContent)
-          if(num == NaN){
-             this.$set(row, 'qualityResults', 2);
+          let num = Number(row.qualityResultContent);
+          if (num == NaN) {
+            this.$set(row, 'qualityResults', 2);
             return;
           }
-          console.log(num,'num')
-          if(num >= Number(row.minValue) && num <= Number(row.maxValue)){
+          console.log(num, 'num');
+          if (num >= Number(row.minValue) && num <= Number(row.maxValue)) {
             this.$set(row, 'qualityResults', 1);
-          }else{
-             this.$set(row, 'qualityResults', 2);
+          } else {
+            this.$set(row, 'qualityResults', 2);
+          }
+        }
+      },
+      // 数学判断
+      mathematicalJudgment(row) {
+        console.log('进来没有',row);
+        let symbol = row.symbol?.trim(); // 符号
+        let Ivalue = Number(row.qualityResultContent); // 输入的值
+        let Dvalue = Number(row.defaultValue); // 判断的值
+        if (Ivalue == NaN || Dvalue == NaN) {
+          return 2;
+        }
+        if (symbol == '±') {
+          if (Math.abs(Ivalue) != Math.abs(Dvalue)) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+
+        if (symbol == '≤' || symbol == '≦') {
+          if (Ivalue <= Dvalue) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+
+        if (symbol == '≥' || symbol == '≧') {
+          if (Ivalue >= Dvalue) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+
+        if (symbol == '≈' || symbol == '=') {
+          console.log('进来等于号')
+          if (Ivalue == Dvalue) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+
+        if (symbol == '≠') {
+          if (Ivalue != Dvalue) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+
+        if (symbol == '>') {
+          if (Ivalue > Dvalue) {
+            return 1;
+          } else {
+            return 2;
+          }
+        }
+        if (symbol == '<') {
+          if (Ivalue > Dvalue) {
+            return 1;
+          } else {
+            return 2;
           }
         }
 
-        console.log(row, 'row 11111111111');
+        return 2;
       },
       handleClose() {
         this.visible = false;

+ 11 - 9
src/views/inspectionWork/edit.vue

@@ -291,7 +291,7 @@
             sampleNoQualifiedNumber += el.measureQuantity - 0;
           }
         });
-        console.log(list,'list 3333')
+        console.log(list, 'list 3333');
         // 计算合格率和不合格率(百分比形式)
         let sampleQualificationRate = '';
         let sampleNoQualificationRate = '';
@@ -447,9 +447,9 @@
           this.$message.closeAll();
           this.$message('正在生成样品清单');
           const ProductSampleList = [];
-         
+
           for (const oldItem of list) {
-             console.log(oldItem,'oldItem 0000 进入循环')
+            console.log(oldItem, 'oldItem 0000 进入循环');
             const count = oldItem.measureQuantity ? oldItem.measureQuantity : 1;
             const newMeasureQuantity = oldItem.measureQuantity / count;
             const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
@@ -462,13 +462,13 @@
               delete item.id;
             });
             delete oldItem.id;
-            console.log('----------------------------------',oldItem)
+            console.log('----------------------------------', oldItem);
             if (
               oldItem.qualitySampleTemplateList == undefined ||
               oldItem.qualitySampleTemplateList == null ||
               oldItem.qualitySampleTemplateList.length == 0
             ) {
-              console.log('+++++++++++++++++++++++++')
+              console.log('+++++++++++++++++++++++++');
               oldItem.qualitySampleTemplateList = JSON.parse(
                 JSON.stringify(this.schemeList)
               );
@@ -483,14 +483,14 @@
                   )
                 });
               }
-              console.log(ProductSampleList,'ProductSampleList 123');
+              console.log(ProductSampleList, 'ProductSampleList 123');
               this.sampleList = ProductSampleList;
               const pNum = ProductSampleList.reduce((sum, item) => {
                 return sum + Number(item.weight || 0);
               }, 0);
               this.form.totalWeight = parseFloat(pNum.toFixed(2));
             } else {
-              console.log('没有质检方法')
+              console.log('没有质检方法');
               for (let i = 0; i < count; i++) {
                 ProductSampleList.push({
                   ...oldItem,
@@ -502,7 +502,7 @@
                   )
                 });
               }
-              console.log(ProductSampleList,'ProductSampleList 456');
+              console.log(ProductSampleList, 'ProductSampleList 456');
               this.sampleList = ProductSampleList;
               const pNum = ProductSampleList.reduce((sum, item) => {
                 return sum + Number(item.weight || 0);
@@ -1058,7 +1058,9 @@
       },
       async queryQualityTempleContent() {
         const res = await queryQualityTempleContent({
-          qualityWorkerId: this.$route.query.id
+          qualityWorkerId: this.$route.query.id,
+          page: 1,
+          size: 10000
         });
         this.schemeList = res.list;
       },

+ 14 - 2
src/views/inspectionWork/index.vue

@@ -224,11 +224,17 @@
             showOverflowTooltip: true
           },
           {
-            prop: 'qualityName',
+            prop: 'qualityName', 
             label: '质检人',
             align: 'center',
             width: 120,
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            formatter:(row)=>{
+              if(row.qualityName){
+                return row.qualityName;
+              }
+              return row.qualityNames || '';
+            }
           },
           {
             prop: 'qualityTime',
@@ -429,6 +435,12 @@
             type: 'input',
             placeholder: ''
           },
+          {
+            label: '质检人:',
+            value: 'qualityName',
+            type: 'input',
+            placeholder: ''
+          },
           {
             label: '状态:',
             value: 'status',