From b12f66d871593ec6f8e28aa63e45dbd92aab760b Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 11 四月 2023 15:54:36 +0800
Subject: [PATCH] 1.制造模型、采购管理模块下的动态列表完成

---
 src/views/makeModel/processDefine.vue |  247 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 151 insertions(+), 96 deletions(-)

diff --git a/src/views/makeModel/processDefine.vue b/src/views/makeModel/processDefine.vue
index a378721..9b9ddd3 100644
--- a/src/views/makeModel/processDefine.vue
+++ b/src/views/makeModel/processDefine.vue
@@ -83,8 +83,13 @@
       </div>
 
       <div class="elTableDiv">
+        <TableColumnSettings
+          :list1="tableColumnSettingsArray"
+          @tableColumnUpdate="tableColumnUpdate"
+        />
         <el-table
           ref="tableDataRef"
+          :key="tableTimeStampKey"
           class="tableFixed"
           :data="tableData"
           :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
@@ -96,96 +101,45 @@
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
         >
-          <!--          <el-table-column-->
-          <!--            type="selection"-->
-          <!--            width="50"-->
-          <!--          />-->
+
           <el-table-column
-            prop="RowNum"
-            width="50"
-            label="搴忓彿"
-            fixed
-          />
-          <el-table-column
-            prop="stepcode"
+            v-for="item in tableColumnSettingsArray"
+            v-if="item.show"
+            :key="item.id"
+            :sortable="item.sortable"
+            :prop="item.prop"
+            :min-width="item.minWidth"
+            :label="item.label"
+            :width="item.width"
             show-tooltip-when-overflow
-            label="宸ュ簭缂栫爜"
-            min-width="150"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="stepname"
-            min-width="150"
-            show-tooltip-when-overflow
-            label="宸ュ簭鍚嶇О"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="flwtype"
-            min-width="150"
-            show-tooltip-when-overflow
-            label="宸ュ簭绫诲瀷"
-            sortable="custom"
+            :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
           >
             <template slot-scope="{row}">
-              <div v-if="row.flwtype.indexOf(';')!==-1">鑷埗;澶栧崗</div>
-              <div v-if="row.flwtype==='W'">澶栧崗</div>
-              <div v-if="row.flwtype==='Z'">鑷埗</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="descr"
-            show-tooltip-when-overflow
-            label="宸ュ簭鎻忚堪"
-            min-width="180"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.descr">{{ row.descr }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="enable"
-            label="鍚敤鐘舵��"
-            show-tooltip-when-overflow
-            sortable="custom"
-            width="110"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.enable==='Y'">
-                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
-                鏄�
+              <div v-if="!row[item.prop]">/</div>
+              <div v-else-if="item.prop==='flwtype'">
+                {{ steptypeArr.find(i=>i.code===row[item.prop]).name }}
               </div>
-              <div v-if="row.enable==='N'">
-                <i class="el-icon-info" style="margin-right: 2px" />
-                鍚�
+              <div v-else-if="item.prop==='enable'">
+                <div v-if="row.enable==='Y'">
+                  <i
+                    class="el-icon-success"
+                    :style="{color:$store.state.settings.theme}"
+                    style="margin-right: 2px"
+                  />
+                  鏄�
+                </div>
+                <div v-if="row.enable==='N'">
+                  <i class="el-icon-info" style="margin-right: 2px" />
+                  鍚�
+                </div>
               </div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="lm_user"
-            label="鍒涘缓浜哄憳"
-            show-tooltip-when-overflow
-            width="110"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
-            show-tooltip-when-overflow
-            width="160"
-            sortable="custom"
-          />
-          <el-table-column
-            label="鍏宠仈宸ヤ綔绔�"
-            prop="is_eqp"
-            show-tooltip-when-overflow
-            width="110"
-          >
-            <template slot-scope="{row}">
-              <div class="operationClass">
-                <i v-if="row.is_eqp==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="workClick(row)" />
+              <div v-else-if="item.prop==='is_eqp'">
+                <i
+                  v-if="row.is_eqp==='Y'"
+                  :style="{color:$store.state.settings.theme}"
+                  class="el-icon-share"
+                  @click="workClick(row)"
+                />
                 <i
                   v-if="row.is_eqp==='N'"
                   class="el-icon-share"
@@ -193,17 +147,13 @@
                   @click="workClick(row)"
                 />
               </div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="鍏宠仈缂洪櫡"
-            prop="is_defect"
-            show-tooltip-when-overflow
-            width="110"
-          >
-            <template slot-scope="{row}">
-              <div class="operationClass">
-                <i v-if="row.is_defect==='Y'" :style="{color:$store.state.settings.theme}" class="el-icon-share" @click="defectClick(row)" />
+              <div v-else-if="item.prop==='is_defect'">
+                <i
+                  v-if="row.is_defect==='Y'"
+                  :style="{color:$store.state.settings.theme}"
+                  class="el-icon-share"
+                  @click="defectClick(row)"
+                />
                 <i
                   v-if="row.is_defect==='N'"
                   class="el-icon-share"
@@ -211,8 +161,10 @@
                   @click="defectClick(row)"
                 />
               </div>
+              <div v-else>{{ row[item.prop] }}</div>
             </template>
           </el-table-column>
+
           <el-table-column
             label="鎿嶄綔"
             fixed="right"
@@ -476,11 +428,12 @@
 import { validateCode } from '@/utils/global'
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
+import TableColumnSettings from '@/components/TableColumnSettings'
 
 export default {
   name: 'GXDY',
   components: {
-    Pagination
+    Pagination, TableColumnSettings
   },
   directives: { elDragDialog, waves },
   data() {
@@ -512,6 +465,101 @@
       ],
       total: 10,
       tableData: [],
+      tableColumnSettingsArray: [
+        { minWidth: 50, width: false, prop: 'id', label: 'id', id: 1, show: false, fixed: false, sortable: false }, // 闅愯棌鍒�  show: false闅愯棌锛宼rue鏄剧ず
+        { minWidth: 25, width: 50, prop: 'RowNum', label: '搴忓彿', id: 2, show: true, fixed: 'left', sortable: false }, // custom
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'stepcode',
+          label: '宸ュ簭缂栫爜',
+          id: 3,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'stepname',
+          label: '宸ュ簭鍚嶇О',
+          id: 4,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'flwtype',
+          label: '宸ュ簭绫诲瀷',
+          id: 5,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 330,
+          width: false,
+          prop: 'descr',
+          label: '宸ュ簭鎻忚堪',
+          id: 6,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'enable',
+          label: '鍚敤鐘舵��',
+          id: 7,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 110,
+          prop: 'lm_user',
+          label: '鍒涘缓浜哄憳',
+          id: 8,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 160,
+          prop: 'lm_date',
+          label: '鍒涘缓鏃堕棿',
+          id: 9,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 110,
+          prop: 'is_eqp',
+          label: '鍏宠仈宸ヤ綔绔�',
+          id: 10,
+          show: true,
+          fixed: false,
+          sortable: false
+        },
+        {
+          minWidth: false,
+          width: 110,
+          prop: 'is_defect',
+          label: '鍏宠仈缂洪櫡',
+          id: 11,
+          show: true,
+          fixed: false,
+          sortable: false
+        }
+      ],
+      tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key
       dialogVisible: false,
       dialogForm: {
         'id': '',
@@ -567,6 +615,13 @@
     this.getHeight()
   },
   methods: {
+    tableColumnUpdate(val, isCopyTrue) {
+      if (isCopyTrue) {
+        this.tableColumnSettingsArray = val
+      }
+      this.tableTimeStampKey = new Date().getTime()
+      this.$refs.tableDataRef.doLayout()
+    },
     tableRowClassName({ row, rowIndex }) {
       return 'custom-row'
     },

--
Gitblit v1.9.3