Pārlūkot izejas kodu

样品清单 质检1

yijing 1 gadu atpakaļ
vecāks
revīzija
0f21428ea2

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

@@ -9,7 +9,7 @@
     <el-row style="margin-top: 24px">
       <header-title title="质检内容"></header-title>
       <el-tabs v-model="activeName" @tab-click="handleClick">
-        <el-tab-pane label="清单列表" name="1"></el-tab-pane>
+        <el-tab-pane label="来源清单" name="1"></el-tab-pane>
         <el-tab-pane label="样品清单" name="2"></el-tab-pane>
         <el-tab-pane label="质检方案" name="3"></el-tab-pane>
       </el-tabs>

+ 27 - 7
src/views/inspectionWork/components/sampleListDialog.vue

@@ -18,8 +18,8 @@
                             <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
                             <el-table-column label="工艺参数" prop="defaultValue" align="center">
                             </el-table-column>
-                            <el-table-column label="参数内容" prop="qualityResultContent" align="center" fixed="right"
-                                width="240">
+                            <el-table-column label="质检内容" prop="qualityResultContent" align="center" fixed="right"
+                                width="360">
                                 <template slot-scope="scope">
                                     <el-input v-model="scope.row.qualityResultContent" placeholder="请输入内容"
                                         :disabled="type == 'detail'"></el-input>
@@ -44,6 +44,13 @@
                     :show-overflow-tooltip="true" :width="column.width" :align="column.align">
                 </el-table-column>
             </template>
+            <el-table-column label="操作" align="center" width="80">
+                <template slot-scope="scope">
+                    <el-link :underline="false" type="primary">
+                        处置
+                    </el-link>
+                </template>
+            </el-table-column>
         </el-table>
         <template v-slot:footer v-if="type == 'report'">
             <el-button @click="handleClose">取消</el-button>
@@ -65,6 +72,7 @@ export default {
         return {
             title: '',
             visible: false,
+            rowIndex: 0,
             type: '',
             tableData: [],
             tableColumns: [
@@ -93,6 +101,7 @@ export default {
                 { label: '重量', prop: 'weight', align: 'center' },
                 { label: '重量单位', prop: 'weightUnit', align: 'center' },
                 { label: '仓库', prop: 'warehouseName', align: 'center', },
+                { label: '质检结果', prop: '', align: 'center', },
                 // { label: '货区', prop: 'areaName', align: 'center', },
                 // { label: '货架', prop: 'goodsShelfName', align: 'center', },
                 // { label: '货位', prop: 'goodsAllocationName', align: 'center', },
@@ -101,15 +110,15 @@ export default {
             ],
             qualityResultsList: [
                 {
-                    value: '1',
+                    value: 1,
                     label: '合格'
                 },
                 {
-                    value: '2',
+                    value: 2,
                     label: '不合格'
                 },
                 {
-                    value: '3',
+                    value: 3,
                     label: '让步接收'
                 },
             ]
@@ -120,9 +129,20 @@ export default {
 
     created() { },
     methods: {
-        async openDia(index, row, list, type) {
+        async openDia(index, row, type, list) {
+            this.rowIndex = index
             this.type = type;
+
+            for (let i = 0; i < list.length; i++) {
+
+                const arr = list[i].children
+                for (let j = 0; j < arr.length; j++) {
+                    arr[j].qualityResults = 1
+                }
+
+            }
             this.tableData = list;
+
             this.visible = true;
         },
         handleClose() {
@@ -136,7 +156,7 @@ export default {
         },
         handleConfirm() {
             this.visible = false;
-            this.$emit('handleConfirm', this.tableData);
+            this.$emit('handleConfirm', this.tableData, this.rowIndex);
         },
     }
 };

+ 76 - 70
src/views/inspectionWork/edit.vue

@@ -4,14 +4,15 @@
       <header-title title="基本信息">
         <el-button @click="cancel">返回</el-button>
         <el-button type="primary" @click="save" :loading="loading">保存</el-button>
+        <el-button type="primary" @click="handleReporting" :loading="loading">报工完成</el-button>
       </header-title>
       <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type"></base-info>
       <el-row>
         <header-title title="质检内容">
-          <el-button type="primary" @click="handleReporting" :loading="loading">报工保存</el-button>
+          <el-button type="primary" :loading="loading">批量报工</el-button>
         </header-title>
         <el-tabs v-model="activeName" @tab-click="handleClick">
-          <el-tab-pane label="清单列表" name="1"></el-tab-pane>
+          <el-tab-pane label="来源清单" name="1"></el-tab-pane>
           <el-tab-pane label="样品清单" name="2"></el-tab-pane>
           <el-tab-pane label="质检方案" name="3"></el-tab-pane>
         </el-tabs>
@@ -19,23 +20,20 @@
       <el-row style="margin-top: 24px">
         <el-table v-show="activeName === '1'" v-if="packingList.length > 0" ref="showPackingListTable"
           :data="paginatedPackingList" tooltip-effect="dark" :max-height="300" border row-key="id">
-          <!-- @selection-change="handleSelectionChange" -->
-          <!-- <el-table-column type="selection" width="55" align="center" :reserve-selection="true"
-            :selectable="checkSelectable"></el-table-column> -->
           <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
           <template v-for="column in tableColumns">
             <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
               :width="column.width" :align="column.align"></el-table-column>
           </template>
         </el-table>
-        <el-table v-show="activeName === '2' && sampleList" ref="showSampleListTable" :data="paginatedSampleList"
-          tooltip-effect="dark" :max-height="300" border row-key="id">
+        <!--  -->
+        <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
+          :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id"
+          @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center"></el-table-column>
           <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
 
           <template v-for="column in tableColumns">
-            <!-- <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
-              :width="column.width" :align="column.align">
-            </el-table-column> -->
             <el-table-column :key="column.prop" :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
               :width="column.width" :align="column.align">
               <template slot-scope="scope">
@@ -51,34 +49,34 @@
                   {{ scope.row[column.prop] }}
                 </template>
               </template>
-
             </el-table-column>
           </template>
-
           <el-table-column label="质检结果" prop="qualityResults" align="center" width="120">
             <template slot-scope="scope">
-              <template v-if="scope.row.qualityResults == '1'">
-                <el-link type="primary" :underline="false">合格</el-link>
-              </template>
-              <template v-if="scope.row.qualityResults == '2'">
-                <el-link type="danger" :underline="false">不合格</el-link>
-              </template>
+              <el-select v-model="scope.row.qualityResults" placeholder="请选择" style="width: 100%;"
+                :disabled="type == 'detail'" size="mini">
+                <el-option v-for="item in qualityResultsList" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+              </el-select>
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" width="80" fixed="right">
+          <el-table-column label="操作" align="center" width="120" fixed="right">
             <template slot-scope="scope">
-              <el-link :type="isValid ? 'primary' : 'danger'" :underline="false"
+              <el-link :type="scope.row.isValid ? 'primary' : 'danger'" :underline="false"
                 @click="handleDetail(scope.$index, scope.row, 'report')">
-                报工
+                质检
               </el-link>
+              <el-link type='primary' :underline="false"> 处置 </el-link>
             </template>
           </el-table-column>
         </el-table>
-        <el-pagination v-show="activeName === '2' && sampleList" @size-change="handleSampleSizeChange"
+        <el-pagination v-show="activeName === '2'" v-if="sampleList" @size-change="handleSampleSizeChange"
           @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
           :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
           layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
           style="margin-top: 10px"></el-pagination>
+
+        <!--  -->
         <el-table v-show="activeName === '3'" ref="showSchemeListTable" :data="paginatedSchemeList"
           tooltip-effect="dark" :max-height="300" border row-key="id">
           <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
@@ -90,7 +88,6 @@
           <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
           <el-table-column label="工艺参数" prop="defaultValue" align="center">
           </el-table-column>
-
         </el-table>
         <el-pagination v-show="activeName === '3'" @size-change="handleSchemeSizeChange"
           @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
@@ -99,10 +96,7 @@
           style="margin-top: 10px"></el-pagination>
       </el-row>
     </el-card>
-    <!-- <div class="save-button-container">
-      <el-button type="primary" :loading="loading">保存</el-button>
-      <el-button @click="restForm">取消</el-button>
-    </div> -->
+
     <sampleListDialog ref="detailRef" @handleConfirm="handleConfirm"></sampleListDialog>
   </div>
 </template>
@@ -171,8 +165,19 @@ export default {
       loading: false,
 
       tabTaskId: null,
-      activeName: '1',
-
+      activeName: '2',
+      qualityResultsList: [{
+        value: 1,
+        label: '合格'
+      },
+      {
+        value: 2,
+        label: '不合格'
+      },
+      {
+        value: 3,
+        label: '让步接收'
+      }],
       tableColumns: [
         {
           label: '编码',
@@ -204,6 +209,7 @@ export default {
         { label: '货位', prop: 'goodsAllocationName', align: 'center' },
         { label: '生产日期', prop: 'productionDate', align: 'center' },
         { label: '采购日期', prop: 'purchaseDate', align: 'center' },
+        { label: '报工状态', prop: '', align: 'center' },
       ],
 
       packingList: [],
@@ -226,7 +232,8 @@ export default {
         total: 0
       },
       isValid: true,
-      SampleListbyReportList: []
+      SampleListbyReportList: [],
+
     };
   },
   watch: {
@@ -270,11 +277,9 @@ export default {
     }
   },
   methods: {
-    checkSelectable(row, index) {
-
-    },
-    handleSelectionChange() {
 
+    handleSelectionChange(val) {
+      console.log(val, '选中数据')
     },
     async open(type) {
       this.type = this.$route.query.type;
@@ -316,9 +321,17 @@ export default {
     },
     async queryQualitySamplContent() {
       const res = await queryQualitySamplContent({ qualityWorkerId: this.$route.query.id })
-      console.log(res, '1111');
+
+      let addStatus = res.map((item) => {
+        item.isValid = true;
+        item.qualityResults = 1;
+        return {
+          ...item
+        }
+      })
+      console.log(addStatus, 'addStatus')
       //样品
-      this.sampleList = res;
+      this.sampleList = addStatus;
       this.samplePagination.currentPage = 1;
       this.samplePagination.total = this.sampleList.length;
     },
@@ -392,13 +405,17 @@ export default {
       this.$router.go(-1);
     },
     handleDetail(index, row, type) {
-      const mergeList = this.sampleList.map(item => {
-        item.children = this.schemeList;
-        return {
-          ...item
-        };
-      });
-      this.$refs.detailRef.openDia(index, row, mergeList, type)
+      if (!this.sampleList[index] || !this.schemeList) {
+        return;
+      }
+
+      const selectedData = this.sampleList[index];
+      const mergedData = [{
+        ...selectedData,
+        children: [...this.schemeList]
+      }];
+      console.log(index, row, type, mergedData, 'index, row, type, mergedData')
+      this.$refs.detailRef.openDia(index, row, type, mergedData);
     },
     // 报工
     handleReporting(index, row) {
@@ -413,7 +430,7 @@ export default {
           planTemplateList: this.SampleListbyReportList
         }
         console.log(params, 'params')
-        // return
+        return;
         exeReportWork(params)
           .then((msg) => {
             this.loading = false;
@@ -427,19 +444,16 @@ export default {
       })
     },
     //确认报工
-    handleConfirm(list) {
-      this.isValid = true;
+    handleConfirm(list, index) {
+      console.log(list)
 
       // 检查有效性
       for (const item of list) {
         for (const child of item.children) {
+
+          console.log(child, 'child')
           if (!child.qualityResultContent || !child.qualityResults) {
             this.$message.error('请完善报工内容!');
-            this.isValid = false;
-            this.sampleList = list.map(item => ({
-              ...item,
-              qualityResults: '',
-            }));
             return;
           }
         }
@@ -447,13 +461,13 @@ export default {
 
       // 处理数据
       const hasInvalidItem = list.some(item =>
-        item.children.some(child => child.qualityResults === '2')
+        item.children.some(child => child.qualityResults === 2)
       );
-      console.log('hasInvalidItem', hasInvalidItem)
+      console.log('是否有不合格数据', hasInvalidItem)
 
       for (const item of list) {
         const filteredData = item.children.filter((item) =>
-          item.qualityResults == '2'
+          item.qualityResults == 2
         );
         console.log(filteredData, '不合格数据')
         if (filteredData.length > -1) {
@@ -461,35 +475,27 @@ export default {
           this.form.qualifiedNumber = item.children.length - filteredData.length;
         }
       }
+      console.log(list, 'listlistlistlist')
 
       const processedList = list.map(item => {
-        item.qualityResults = hasInvalidItem ? '2' : '1';
+        item.qualityResults = hasInvalidItem ? 2 : 1;
         item.qualitySampleTemplateList = item.children;
+        item.isValid = !hasInvalidItem
         delete item.children;
         return {
           ...item,
         }
       });
 
-      this.sampleList = processedList;
+      this.$set(this.sampleList, index, processedList[0]);
+
+      console.log(this.sampleList, processedList, '222表')
+
       this.SampleListbyReportList = processedList;
-      this.isValid = !hasInvalidItem;
 
-      console.log(processedList, 'list')
     }
   }
 };
 </script>
 
-<style lang="scss" scoped>
-.ele-body {
-  position: relative;
-}
-
-.save-button-container {
-  position: fixed;
-  bottom: 20px;
-  left: 50%;
-  transform: translateX(-50%);
-}
-</style>
+<style lang="scss" scoped></style>