ysy 1 год назад
Родитель
Сommit
e2feed0adc
1 измененных файлов с 187 добавлено и 67 удалено
  1. 187 67
      src/views/produce/components/picking/pickingList.vue

+ 187 - 67
src/views/produce/components/picking/pickingList.vue

@@ -28,13 +28,47 @@
         <!-- 表格 -->
         <template v-slot:content>
           <ele-pro-table
+            :initLoad="false"
             ref="table"
             :columns="columns"
             :datasource="datasource"
+            :selection.sync="selection"
             row-key="id"
             height="calc(100vh - 350px)"
             class="dict-table"
+            :key="tableKey"
+            :cache-key="tableKey"
           >
+            <template v-slot:code="{ row }">
+              {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
+            </template>
+
+            <template v-slot:runStatus="{ row }">
+              {{ stateList[Number(row.runStatus)] }}
+            </template>
+
+            <template v-slot:vehicleLen="{ row }">
+              {{ row.extInfo.vehicleLen || '-' }}
+              {{ row.extInfo.wilde || '-' }} {{ row.extInfo.hight || '-' }}
+            </template>
+
+            <template v-slot:status="{ row }">
+              <span :style="{ color: row.status == 0 ? '#157A2C' : '#FFA929' }"
+                >状态{{
+                  row.status == 0 ? '空闲' : row.status == 1 ? '占用' : ''
+                }}</span>
+            </template>
+
+            <template v-slot:packingCountBase="{ row }">
+              {{ row.packingCountBase }} {{row.minUnit}}
+            </template>
+
+            <template v-slot:availableCountBase="{ row }">
+              {{ row.availableCountBase }} {{row.measuringUnit}}
+            </template>
+            
+
+
           </ele-pro-table>
         </template>
       </ele-split-layout>
@@ -58,96 +92,178 @@
       return {
         visible: false,
 
-        // 表格列配置
-        columns: [
+        treeIds: '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28',
+        categoryLevelId: null,
+        rootCategoryLevelId: null,
+        isCategory: true,
+
+        stateList: [
+          '启动',
+          '空闲',
+          '运行',
+          '故障',
+          '检修',
+          '停机',
+          '待料',
+          '占用'
+        ],
+
+        selection: []
+      };
+    },
+
+    computed: {
+      tableKey() {
+        return `table-${this.rootCategoryLevelId}`;
+      },
+
+      // 表格列配置
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
           {
             columnKey: 'index',
+            label: '序号',
             type: 'index',
-            width: 45,
+            width: 50,
             align: 'center',
             reserveSelection: true
           },
           {
             prop: 'code',
-            label: '编码'
+            label: '编码',
+            slot: 'code'
           },
           {
             prop: 'name',
             label: '名称',
             showOverflowTooltip: true
           },
-          {
-            prop: 'brandNum',
-            label: '牌号'
-          },
-
           {
             prop: 'modelType',
             label: '型号',
-            align: 'center',
             showOverflowTooltip: true
           },
           {
             prop: 'specification',
             label: '规格',
-            align: 'center',
             showOverflowTooltip: true
           },
-          {
-            prop: 'measuringUnit',
-            label: '计量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
 
-          {
-            prop: 'weightUnit',
-            label: '重量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
+          ...[
+            {
+              prop: 'brandNum',
+              label: '牌号',
+              showOverflowTooltip: true
+            }
+          ],
 
-          {
-            prop: 'roughWeight',
-            label: '毛重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
+          ...(this.rootCategoryLevelId == '4'
+            ? [
+                {
+                  prop: 'workstationName',
+                  label: '工位',
+                  showOverflowTooltip: true
+                },
 
-          {
-            prop: 'netWeight',
-            label: '净重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
+                {
+                  prop: 'runStatus',
+                  label: '状态',
+                  slot: 'runStatus',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
 
-          {
-            prop: 'packingUnit',
-            align: 'center',
-            label: '包装单位',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'categoryLevelPath',
-            label: '分类',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+          ...(this.rootCategoryLevelId == '5'
+            ? [
+                {
+                  prop: 'dieHoleNum',
+                  label: '模孔数量',
+                  showOverflowTooltip: true
+                },
+                {
+                  prop: 'mandrelDiameter',
+                  label: '芯棒直径',
+                  showOverflowTooltip: true
+                },
+                {
+                  prop: 'shrinkEffictive',
+                  label: '收缩系数',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
 
-          {
-            action: 'action',
-            slot: 'action',
-            align: 'center',
-            label: '选择'
-          }
-        ],
+          ...(this.rootCategoryLevelId == '7'
+            ? [
+                {
+                  prop: 'materialQuality',
+                  label: '材质',
+                  showOverflowTooltip: true
+                },
 
-        treeIds: '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28',
-        categoryLevelId: null,
-        isCategory: true
-      };
-    },
+                {
+                  prop: 'vehicleLen',
+                  label: '长宽高',
+                  slot: 'vehicleLen',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
+
+          ...(this.rootCategoryLevelId == '8'
+            ? [
+                {
+                  prop: 'extInfo.slotNum',
+                  label: '槽数',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
 
+          ...(this.rootCategoryLevelId == '11'
+            ? [
+                {
+                  prop: 'status',
+                  label: '状态',
+                  slot: 'status',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
+
+            ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
+            ? [
+                {
+                  prop: 'packingCountBase',
+                  label: '包装库存',
+                  slot: 'packingCountBase',
+                  showOverflowTooltip: true
+                }
+              ]
+            : []),
+
+
+            ...([1, 23].includes(Number(this.rootCategoryLevelId))
+            ? [
+                {
+                  prop: 'availableCountBase',
+                  label: '计量库存数量',
+                  slot: 'availableCountBase',
+                  showOverflowTooltip: true
+                }
+              ]
+            : [])
+
+        ];
+      }
+    },
     watch: {},
     methods: {
       /* 表格数据源 */
@@ -159,14 +275,14 @@
             ...where,
             pageNum: page,
             size: limit,
-            categoryLevelId: this.categoryLevelId || 9,
+            categoryLevelId: this.categoryLevelId,
             dimension: 1
           });
         } else {
           return URL({
             ...where,
             pageNum: page,
-            categoryLevelId: this.categoryLevelId || 9,
+            categoryLevelId: this.categoryLevelId,
             size: limit,
             dimension: 1
           });
@@ -175,17 +291,21 @@
       handleNodeClick(data) {
         this.isCategory = true;
         this.categoryLevelId = data.id;
-        this.$refs.table.reload({ pageNum: 1 });
+        this.rootCategoryLevelId = data.rootCategoryLevelId;
+        this.reload();
       },
       setRootId(data) {
         this.categoryLevelId = data.id;
-        // this.$refs.table.reload({ pageNum: 1 });
+        this.rootCategoryLevelId = data.rootCategoryLevelId;
+        this.reload();
       },
 
       /* 刷新表格 */
       reload(where) {
-        this.isCategory = false;
-        this.$refs.table.reload({ pageNum: 1, where: where });
+        this.$nextTick(() => {
+          this.isCategory = false;
+          this.$refs.table.reload({ pageNum: 1, where: where });
+        });
       },
       open(id, item) {
         if (item) {
@@ -198,9 +318,9 @@
       },
       selected() {
         if (!this.current) {
-          return this.$message.warning('请选择工作中心');
+          return this.$message.warning('请选择');
         }
-        this.$emit('changeProduct', this.title, this.current, this.idx);
+
         this.handleClose();
       }
     }