Parcourir la source

fix(productionPlan): 齐套性检查属性类型筛选修复及样式优化

- 属性类型下拉框始终显示,补自制件选项
- 属性类型按选择精确过滤,结果过滤统一
- 表格 row-key 改为 _rowKey 消除 duplicate key 警告
- 日期选择器固定宽度避免被压扁
- 项目信息表单改为一行5个、统一 readonly 禁用样式
- 表格工具栏对齐、间距调整
lihaiting il y a 2 jours
Parent
commit
5916a8a28c
1 fichiers modifiés avec 57 ajouts et 36 suppressions
  1. 57 36
      src/views/productionPlan/components/homogeneityInspectDialog.vue

+ 57 - 36
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -34,6 +34,7 @@
             end-placeholder="结束日期"
             :clearable="false"
             :picker-options="pickerOptions"
+            style="width: 240px"
           >
           </el-date-picker>
         </el-form-item>
@@ -43,45 +44,43 @@
       </el-form>
       <div v-loading="loading">
         <el-form label-width="107px" :model="planInfo" class="plan_form">
-          <el-row :gutter="20" type="flex" style="flex-wrap: wrap">
-            <el-col :span="6">
+          <el-row class="info-row" :gutter="12">
+            <el-col class="info-col">
               <el-form-item label="名称:">
                 <el-input readonly v-model="planInfo.productName"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="计划编号:">
                 <el-input readonly v-model="planInfo.code"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="规格:">
                 <el-input readonly v-model="planInfo.specification"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="型号:">
                 <el-input readonly v-model="planInfo.model"></el-input>
               </el-form-item>
             </el-col>
-          </el-row>
-          <el-row>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="编码:">
                 <el-input readonly v-model="planInfo.productCode"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="牌号:">
                 <el-input readonly v-model="planInfo.brandNo"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="计划数量:">
                 <el-input readonly v-model="planInfo.productNum"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType != 2">
+            <el-col class="info-col" v-if="produceType != 2">
               <el-form-item label="未发总数:">
                 <el-input
                   readonly
@@ -89,8 +88,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="库存数量:">
                 <el-input
                   readonly
@@ -98,7 +96,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType != 2">
+            <el-col class="info-col" v-if="produceType != 2">
               <el-form-item label="在制总数:">
                 <el-input
                   readonly
@@ -106,7 +104,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6" v-if="produceType != 2">
+            <el-col class="info-col" v-if="produceType != 2">
               <el-form-item label="最终缺料数量:">
                 <el-input
                   readonly
@@ -114,7 +112,7 @@
                 ></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <el-col class="info-col">
               <el-form-item label="最终状态:">
                 <el-input
                   :class="
@@ -153,7 +151,7 @@
                 :columns="columns"
                 :init-load="false"
                 :datasource="datasourceList"
-                row-key="code"
+                row-key="_rowKey"
                 :cache-key="`aps-productionPlan-homogeneityInspectDialog`"
                 border
                 height="40vh"
@@ -242,7 +240,7 @@
                             </el-option>
                           </el-select>
                         </el-form-item>
-                        <el-form-item label="属性类型" v-if="produceType == 2">
+                        <el-form-item label="属性类型">
                           <el-select
                             size="medium"
                             v-model="formInline.attributeType"
@@ -739,6 +737,10 @@
             value: 'all',
             label: '全部'
           },
+          {
+            value: 1,
+            label: '自制件'
+          },
           {
             value: 2,
             label: '采购件'
@@ -967,7 +969,7 @@
       },
       // 切换属性
       async attributeChange(e) {
-        if (e == 'all') {
+        if (e == 'all' && this.produceType == 2) {
           this.dataMerging();
           return;
         }
@@ -982,21 +984,13 @@
       },
       // 获取物料数据信息
       async getMaterialData(data, attributeType) {
-        if (attributeType == 'all') {
+        if (attributeType == 'all' && this.produceType == 2) {
           this.dataMerging();
           return;
         }
         let kitting = this.quota_calculation == 1 ? false : true;
         let produceType =
-          this.produceType == 1
-            ? 1
-            : this.produceType == 4
-            ? 4
-            : attributeType == 2
-            ? 2
-            : attributeType == 3
-            ? 3
-            : '';
+          attributeType == 'all' ? this.produceType : attributeType;
         let { startTime, endTime } = this.getTimeData();
         let params = {
           planId: this.planId,
@@ -1022,6 +1016,12 @@
       // 结果数据处理
       resultProcess(result) {
         this.datasourceList = [];
+        const attributeType = this.formInline.attributeType;
+        if (attributeType !== 'all') {
+          result = (result || []).filter(
+            (item) => item.componentAttribute == attributeType
+          );
+        }
         if (!result || result.length == 0) {
           this.baseCount = '';
           this.baseUnit = '';
@@ -1030,7 +1030,8 @@
         let first = result[0];
         this.baseCount = first.baseCount;
         this.baseUnit = first.measuringUnit;
-        result.forEach((item) => {
+        result.forEach((item, index) => {
+          item._rowKey = `${item.code || 'material'}-${index}`;
           item.batchNo = this.planInfo.batchNo;
           item.salesCode = this.planInfo.salesCode;
           item.finalState =
@@ -1059,7 +1060,7 @@
         );
         if (datasourceList.length) {
           this.$refs.table.setSelectedRowKeys(
-            datasourceList.map((el) => el.code)
+            datasourceList.map((el) => el._rowKey)
           );
         }
       },
@@ -1094,6 +1095,7 @@
       async open(dataList, produceType, parType) {
         this.initTime();
         this.produceType = produceType;
+        this.formInline.attributeType = produceType == 2 ? 2 : 'all';
         this.parType = parType || '';
         this.formInline.inventoryType =
           Number(parType) === 1 ? '4' : Number(parType) === 7 ? '3' : '';
@@ -1354,14 +1356,32 @@
 
   .form-wrapper {
     display: flex;
+    margin-top: 16px;
   }
   .planInfo {
     // display: flex;
     font-size: 16px;
   }
   .plan_form {
-    .el-col {
-      margin-bottom: 16px;
+    .info-row {
+      display: flex;
+      flex-wrap: wrap;
+      row-gap: 16px;
+    }
+    .info-col {
+      flex: 0 0 20%;
+      max-width: 20%;
+      padding: 0 6px;
+    }
+    .el-input {
+      width: 100%;
+    }
+    :deep(.el-input.is-readonly .el-input__inner),
+    :deep(.el-input__inner[readonly]) {
+      background-color: #f5f7fa;
+      border-color: #dcdfe6;
+      color: #606266;
+      cursor: not-allowed;
     }
   }
 
@@ -1377,8 +1397,9 @@
     display: flex;
     align-items: center;
     justify-content: space-between;
-    padding: 5px 10px;
-    border-left: 1px solid #ededed;
-    border-right: 1px solid #ededed;
+    padding: 8px 0;
+  }
+  .select-type {
+    width: 140px;
   }
 </style>