Jelajahi Sumber

嘉实表单

lucw 7 bulan lalu
induk
melakukan
9d492b4bb2

+ 3 - 1
src/views/batchRecord/components/editModal.vue

@@ -314,7 +314,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col v-if="reportWorkType == 2" :span="8">
               <el-form-item label="产出物">
                 <el-select
                   v-model="form.outputType"
@@ -1279,8 +1279,10 @@
       handleClose() {
         this.form = JSON.parse(JSON.stringify(this.formBaseData));
         this.produceTaskList = [];
+        this.rulesDetailListj = [];
         this.statisticsType = '1';
         this.details = null;
+        this.workOrderInfo = null;
         this.$nextTick(() => {
           this.$refs.formRef.clearValidate();
           this.visible = false;

+ 59 - 20
src/views/batchRecord/components/statistics.vue

@@ -79,20 +79,14 @@
       :needPage="false"
     >
       <template v-slot:toolkit>
-        <el-select
-          v-model="activeProductTaskName"
-          placeholder="请选择"
-          style="margin-right: 20px"
-        >
-          <el-option
-            v-for="item in productTaskNameList"
-            :key="item"
-            :label="item"
-            :value="item"
-          >
-          </el-option>
-        </el-select>
+        <div>
+          <el-input
+            v-model="keyword"
+            placeholder="请输入物料名称或编码"
+          ></el-input>
+        </div>
       </template>
+
       <template
         v-for="(item, index) in localDetails[1].statisticsValue[0]"
         v-slot:[`column_${index}`]="{ row }"
@@ -135,10 +129,26 @@
       "
       ref="table"
       :columns="typeThreeColumns"
-      :datasource="localDetails[2].statisticsValue"
+      :datasource="typeThreeDataSource"
       cacheKey="mes-statistics-type-3-2511051037"
       :needPage="false"
     >
+      <template v-slot:toolkit>
+        <el-select
+          v-model="activeProductTaskName"
+          placeholder="请选择"
+          style="margin-right: 20px"
+        >
+          <el-option
+            v-for="item in productTaskNameList"
+            :key="item"
+            :label="item"
+            :value="item"
+          >
+          </el-option>
+        </el-select>
+      </template>
+
       <template
         v-for="(item, index) in localDetails[2].statisticsValue[0]"
         v-slot:[`column_${index}`]="{ row }"
@@ -228,7 +238,6 @@
             val[0].statisticsValue &&
             val[0].statisticsValue.length > 0
           ) {
-            console.log('直接赋值');
             this.localDetails = JSON.parse(JSON.stringify(val));
           } else {
             this.buildDetials(val);
@@ -338,17 +347,28 @@
         }
       },
       typeTwoDataSource() {
-        if (this.activeProductTaskName === '全部') {
+        if (this.keyword.trim() === '') {
           return this.localDetails[1].statisticsValue;
         } else {
           return this.localDetails[1].statisticsValue.filter((rows) => {
             const nameItem = rows.find((i) => i.title === '物料名称');
+            const codeItem = rows.find((i) => i.title === '物料编码');
             return (
-              nameItem &&
-              nameItem.produceTaskName === this.activeProductTaskName
+              (nameItem && nameItem.value.includes(this.keyword)) ||
+              (codeItem && codeItem.value.includes(this.keyword))
             );
           });
         }
+      },
+      typeThreeDataSource() {
+        if (this.activeProductTaskName === '全部') {
+          return this.localDetails[2].statisticsValue;
+        } else {
+          return this.localDetails[2].statisticsValue.filter((rows) => {
+            const nameItem = rows.find((i) => i.title === '工序名称');
+            return nameItem && nameItem.value === this.activeProductTaskName;
+          });
+        }
       }
     },
     data() {
@@ -370,7 +390,8 @@
             statisticsValue: []
           }
         ],
-        activeProductTaskName: '全部'
+        activeProductTaskName: '全部',
+        keyword: ''
       };
     },
 
@@ -383,9 +404,27 @@
       // 构建统计数据
       async buildDetials(detials) {
         if (detials.length === 0) {
+          console.log('重置了');
+          this.localDetails = [
+            {
+              ruleId: this.ruleId,
+              statisticsType: 1,
+              statisticsValue: []
+            },
+            {
+              ruleId: this.ruleId,
+              statisticsType: 2,
+              statisticsValue: []
+            },
+            {
+              ruleId: this.ruleId,
+              statisticsType: 3,
+              statisticsValue: []
+            }
+          ];
           return;
         }
-        console.log('this.localDetails', this.localDetails);
+        console.log('this.localDetails -- 开始构建', this.localDetails);
 
         if (
           (this.localDetails[0].statisticsValue &&