Ver código fonte

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-qms into dengfei

695593266@qq.com 10 meses atrás
pai
commit
d410a90b41

+ 1 - 1
src/views/inspectionClassify/index.vue

@@ -6,7 +6,7 @@
           <div class="ele-border-lighter sys-organization-list">
             <el-input placeholder="输入关键字进行过滤" v-model="filterText">
             </el-input>
-            <AssetTree @handleNodeClick="handleNodeClick" @setRootId="setRootId" :treeIds="[12]" ref="treeList" />
+            <AssetTree :defaultExpandAll="false" @handleNodeClick="handleNodeClick" @setRootId="setRootId" :treeIds="[12]" ref="treeList" />
           </div>
         </div>
         <template v-slot:content>

+ 1 - 1
src/views/inspectionPlan/components/baseInfo.vue

@@ -764,7 +764,7 @@
 
       //   根据来源得到产品
       handleChoose(val) {
-        console.log(val, '根据来源得到产品');
+        console.log(val, '根据来源得到产品 3');
         if (!val) return;
         this.form.planSourceCode = val.receiveNo;
         // *** 之前未对生产检验进行判断 当类型是生产检验的时候 productId 是 undefined

+ 5 - 4
src/views/inspectionPlan/components/new-baseInfo.vue

@@ -675,19 +675,20 @@
 
       //主数据根据来源得到产品
       handleMainChoose(val) {
-        console.log(val, '主数据根据来源得到产品');
+        console.log(val, '主数据根据来源得到产品 1');
         if (!val) return;
 
         this.form.productName = val.name; //名称
         this.form.productCode = val.code; //编码
         this.form.specification = val.specification; //规格
         this.form.modelType = val.modelType; //型号
-        this.form.brandNo = val.brandNum; //牌号
+        this.form.brandNo = val.brandNum; //牌号 brandNum
         this.form.totalWeight = val.totalWeight; //总重量
         this.form.inspectionStandards = val.inspectionStandards; //检验标准
         this.form.isConsumable = val.isConsumable; //0 单件 1 批量
         this.form.productId = val.id;
         this.form.netWeight = val.netWeight; //净重
+        console.log(this.form,'00000000000000000')
         // console.log(this.form.type)
         console.log('----------------->>>>');
         this.getProductDetails(this.form.productId);
@@ -736,7 +737,7 @@
 
       //   根据来源得到产品
       handleChoose(val) {
-        console.log(val, '根据来源得到产品');
+        console.log(val, '根据来源得到产品 9');
         if (!val) return;
         this.form.planSourceCode = val.receiveNo;
         // *** 之前未对生产检验进行判断 当类型是生产检验的时候 productId 是 undefined
@@ -759,7 +760,7 @@
         this.form.batchNo = val.batchNo;
         this.form.specification = val.specification;
         this.form.modelType = val.modelType;
-        this.form.brandNo = val.brandNo;
+        this.form.brandNo = val.productBrand;
         this.form.productNumber = val.totalCount;
         this.form.qualifiedNumber = val.qualifiedNumber;
         this.form.unqualifiedNumber = val.unqualifiedNumber;

+ 47 - 34
src/views/inspectionPlan/components/new-edit.vue

@@ -640,11 +640,11 @@
         handler(newVal) {
           // 计算重量跟数量
           this.calculate(newVal);
-          newVal.map(async(el)=>{
-            if(!el.sampleCode){
-               el.sampleCode = await this.getSampleCode();
+          newVal.map(async (el) => {
+            if (!el.sampleCode) {
+              el.sampleCode = await this.getSampleCode();
             }
-          })
+          });
         },
         deep: true,
         immediate: true
@@ -2148,12 +2148,14 @@
             : item['measureQuantity'], // 剩余可取样数量
           maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
         }));
-
+        console.log(items, 'items items items');
+        console.log(sampleQuantity, 'sampleQuantity sampleQuantity [[[]]]');
         const result = [];
         let remainingCount = sampleCount;
-
+        console.log(remainingCount, 'remainingCount ========');
         // 尽可能均匀地从各条目取样
         while (remainingCount > 0) {
+          
           // 按剩余可取样比例排序
           items.sort(
             (a, b) =>
@@ -2164,6 +2166,9 @@
           let distributed = false;
 
           for (const item of items) {
+            let values = remainingCount > 1 ? 1 : remainingCount;
+            // sampleQuantity = remainingCount > 1 ? 1 : remainingCount;
+            console.log(sampleQuantity, 'sampleQuantity ----');
             if (
               (!isUnitMismatch && remainingCount > 0) ||
               (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
@@ -2175,12 +2180,14 @@
                 this.conditionType == 1 &&
                 this.baseForm.inspectionStandards == 1
               ) {
-                result.push({ ...item, measureQuantity: 1, sampleCode });
+                console.log('进来1')
+                result.push({ ...item, measureQuantity: values, sampleCode });
               } else if (
                 this.conditionType == 2 &&
                 (this.baseForm.inspectionStandards == 1 ||
                   this.baseForm.inspectionStandards == 2)
               ) {
+                console.log('进来2')
                 let weight = (item.weight / item.maxPossible).toFixed(2);
                 result.push({
                   ...item,
@@ -2695,6 +2702,8 @@
           this.baseForm.sampleMeasureUnit = this.formData.sampleUnit;
           this.sampleList = [];
           const sampleCount = Number(this.formData.portion);
+          console.log(sampleCount, 'sampleCount sampleCount == p');
+          console.log(this.formData, 'this.formData 000');
           const measureQ = this.formData.number || 1;
           const unit = this.formData.sampleUnit;
           let specifications = this.packingSpecificationOption.find(
@@ -2716,16 +2725,19 @@
               }
               // ***
               //抽检计量整样小样或者抽检计重小样
-              if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
-                return;
+              // if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
+              //   return;
               if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
                 return; // 若计量单位为重量,还需验证总重量是否足够
               console.log('getNewFullSampleList');
               if (this.conditionType == '1' && this.baseForm.type == '3') {
+                console.log(1111111111111111111);
                 await this.handleWeightFullSample(sampleCount, specifications);
               } else {
+                console.log('2222222222222 --', Math.ceil(sampleCount));
                 await this.getNewFullSampleList(
-                  Math.ceil(sampleCount),
+                  // Math.ceil(sampleCount),
+                  sampleCount,
                   measureQ,
                   unit,
                   specifications
@@ -2791,31 +2803,32 @@
       },
 
       validateMeasureQuantity(measureQ, unit, sampleCount) {
-        if (this.conditionType == 2 && measureQ <= 0) {
-          this.$message.info('取样计量数量必须大于0');
-          return false;
-        }
-
-        const totalQuantity = this.selectedList.reduce(
-          (sum, item) => sum + item.measureQuantity,
-          0
-        );
-        if (
-          (this.selectedList[0].measureUnit === unit ||
-            this.conditionType == 1) &&
-          measureQ * sampleCount > totalQuantity
-        ) {
-          this.$message.info('取样计量数量不能大于总计量数量');
-          return false;
-        }
+        // if (this.conditionType == 2 && measureQ <= 0) {
+        //   this.$message.info('取样计量数量必须大于0');
+        //   return false;
+        // }
 
-        const invalidItem = this.selectedList.find(
-          (item) => item.measureQuantity < measureQ
-        );
-        if (invalidItem) {
-          this.$message.info('条目计量数量小于取样计量数量');
-          return false;
-        }
+        // const totalQuantity = this.selectedList.reduce(
+        //   (sum, item) => sum + item.measureQuantity,
+        //   0
+        // );
+        // if (
+        //   (this.selectedList[0].measureUnit === unit ||
+        //     this.conditionType == 1) &&
+        //   measureQ * sampleCount > totalQuantity
+        // ) {
+        //   this.$message.info('取样计量数量不能大于总计量数量');
+        //   return false;
+        // }
+        // console.log(this.selectedList,'33333333333')
+        // console.log(measureQ,'measureQ 0000')
+        // const invalidItem = this.selectedList.find(
+        //   (item) => item.measureQuantity < measureQ
+        // );
+        // if (invalidItem) {
+        //   this.$message.info('条目计量数量小于取样计量数量');
+        //   return false;
+        // }
 
         return true;
       },

+ 1 - 0
src/views/inspectionPlan/components/warehousing.vue

@@ -213,6 +213,7 @@
 
         //   return item;
         // });
+        console.log(this.current,'------------------')
         this.$emit('choose', this.current);
         this.handleClose();
       },

+ 29 - 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,33 @@
       this.getListFn();
     },
     methods: {
+      defaultInput(value) {
+        console.log(this.form.symbol,'0000 symbol')
+        if(this.form.textType !== '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) => {

+ 1 - 0
src/views/inspectionTemplate/AddorUpdate.vue

@@ -223,6 +223,7 @@
       ref="equipmentRefs"
       @choose="confirmChoose"
       :typeS="['1']"
+      type="1"
       :disabledCode="templateCategoryList.map((item) => item.code)"
     >
     </EquipmentDialog>

+ 1 - 0
src/views/inspectionTemplate/inspectionClassify/index.vue

@@ -23,6 +23,7 @@
                 @setRootId="setRootId"
                 :treeIds="[12]"
                 ref="treeList"
+                :defaultExpandAll="false"
               />
             </div>
           </div>

+ 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;

+ 13 - 10
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;
       },
@@ -1452,6 +1454,7 @@
           let distributed = false;
 
           for (const item of items) {
+            let values = remainingCount > 1 ? 1 : remainingCount;
             if (
               !isUnitMismatch ||
               (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
@@ -1476,7 +1479,7 @@
               ) {
                 result.push({
                   ...item,
-                  measureQuantity: 1,
+                  measureQuantity: values,
                   sampleCode,
                   qualitySampleTemplateList
                 });

+ 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',