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/purchasesManager/purchasesList.vue |  399 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 281 insertions(+), 118 deletions(-)

diff --git a/src/views/purchasesManager/purchasesList.vue b/src/views/purchasesManager/purchasesList.vue
index 28989c4..8973697 100644
--- a/src/views/purchasesManager/purchasesList.vue
+++ b/src/views/purchasesManager/purchasesList.vue
@@ -134,8 +134,13 @@
       </div>
 
       <div class="elTableDiv">
+        <TableColumnSettings
+          :list1="tableColumnSettingsArray"
+          @tableColumnUpdate="tableColumnUpdate"
+        />
         <el-table
           ref="tableDataRef"
+          :key="tableTimeStampKey"
           class="tableFixed"
           :data="tableData"
           :height="isExpandForm?(tableHeight+40):(tableHeight+80)+'px'"
@@ -160,126 +165,157 @@
               />
             </template>
           </el-table-column>
+
           <el-table-column
-            prop="RowNum"
-            width="50"
-            fixed
-            label="搴忓彿"
-          />
-          <el-table-column
-            prop="status"
-            label="璁㈠崟鐘舵��"
-            width="110"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div>{{ mesorderstusArr.find(i=>i.value===row.status).label }}</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="orderdate"
-            label="鍗曟嵁鏃ユ湡"
-            sortable="custom"
-            width="110"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.orderdate">{{ row.orderdate.substring(0, 11) }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="ordercode"
-            label="璁㈠崟缂栧彿"
-            sortable="custom"
-            width="160"
+            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
-          />
-          <el-table-column
-            prop="deptname"
-            label="閮ㄩ棬鍚嶇О"
-            width="130"
-            show-tooltip-when-overflow
-            sortable="custom"
+            :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
           >
             <template slot-scope="{row}">
-              <div v-if="row.deptname">{{ row.deptname }}</div>
-              <div v-else>/</div>
+              <div v-if="!row[item.prop]">/</div>
+              <div v-else-if="item.prop==='status'">
+                {{ mesorderstusArr.find(i => i.value === row[item.prop]).label }}
+              </div>
+              <div v-else-if="item.prop==='acceptdate'">
+                {{ row.acceptdate ? row.acceptdate.substring(0, 11) : '/' }}
+              </div>
+              <div v-else-if="item.prop==='orderdate'">
+                {{ row.orderdate ? row.orderdate.substring(0, 11) : '/' }}
+              </div>
+              <div v-else-if="item.prop==='lm_date'">
+                {{ row.lm_date ? row.lm_date.substring(0, 11) : '/' }}
+              </div>
+              <div v-else>{{ row[item.prop] }}</div>
             </template>
           </el-table-column>
-          <el-table-column
-            prop="customername"
-            label="閲囪喘渚涙柟"
-            sortable="custom"
-            min-width="180"
-            show-tooltip-when-overflow
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.customername">{{ row.customername }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="saleorderCode"
-            label="婧愬崟鍗曞彿"
-            sortable="custom"
-            width="160"
-            show-tooltip-when-overflow
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.saleorderCode">{{ row.saleorderCode }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="acceptdate"
-            label="棰勮鍒拌揣鏃ユ湡"
-            width="130"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.acceptdate">{{ row.acceptdate.substring(0, 11) }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="lm_user"
-            label="鍒涘缓浜哄憳"
-            sortable="custom"
-            width="110"
-          />
-          <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
-            width="110"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="auditoruser"
-            label="瀹℃牳浜�"
-            width="110"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.auditoruser">{{ row.auditoruser }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="auditordate"
-            label="瀹℃牳鏃堕棿"
-            width="110"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.auditordate">{{ row.auditordate.substring(0, 11) }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
+
+          <!--          <el-table-column-->
+          <!--            prop="RowNum"-->
+          <!--            width="50"-->
+          <!--            fixed-->
+          <!--            label="搴忓彿"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="status"-->
+          <!--            label="璁㈠崟鐘舵��"-->
+          <!--            width="110"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div>{{ mesorderstusArr.find(i=>i.value===row.status).label }}</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="orderdate"-->
+          <!--            label="鍗曟嵁鏃ユ湡"-->
+          <!--            sortable="custom"-->
+          <!--            width="110"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.orderdate">{{ row.orderdate.substring(0, 11) }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="ordercode"-->
+          <!--            label="璁㈠崟缂栧彿"-->
+          <!--            sortable="custom"-->
+          <!--            width="160"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="deptname"-->
+          <!--            label="閮ㄩ棬鍚嶇О"-->
+          <!--            width="130"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.deptname">{{ row.deptname }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="customername"-->
+          <!--            label="閲囪喘渚涙柟"-->
+          <!--            sortable="custom"-->
+          <!--            min-width="180"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.customername">{{ row.customername }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="saleorderCode"-->
+          <!--            label="婧愬崟鍗曞彿"-->
+          <!--            sortable="custom"-->
+          <!--            width="160"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.saleorderCode">{{ row.saleorderCode }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="acceptdate"-->
+          <!--            label="棰勮鍒拌揣鏃ユ湡"-->
+          <!--            width="130"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.acceptdate">{{ row.acceptdate.substring(0, 11) }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="lm_user"-->
+          <!--            label="鍒涘缓浜哄憳"-->
+          <!--            sortable="custom"-->
+          <!--            width="110"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="lm_date"-->
+          <!--            label="鍒涘缓鏃堕棿"-->
+          <!--            width="110"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.lm_date">{{ row.lm_date.substring(0, 11) }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="auditoruser"-->
+          <!--            label="瀹℃牳浜�"-->
+          <!--            width="110"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.auditoruser">{{ row.auditoruser }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="auditordate"-->
+          <!--            label="瀹℃牳鏃堕棿"-->
+          <!--            width="110"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.auditordate">{{ row.auditordate.substring(0, 11) }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
           <el-table-column
             label="鎿嶄綔"
             width="120"
@@ -460,13 +496,19 @@
 import { handleDatetime } from '@/utils/global'
 import waves from '@/directive/waves'
 import { SeaveSearchErpPurchaseOrder } from '@/api/ErpSyncMes'
-import { ClosedPurchaseOrder, DeletePurchaseOrder, PurchaseOrderSearch, PurchaseOrderSubSearch } from '@/api/purchasesManager'
+import {
+  ClosedPurchaseOrder,
+  DeletePurchaseOrder,
+  PurchaseOrderSearch,
+  PurchaseOrderSubSearch
+} from '@/api/purchasesManager'
 import { DepartMentSelect, PurchSupplierSelect } from '@/api/basicInfo'
+import TableColumnSettings from '@/components/TableColumnSettings'
 
 export default {
   name: 'Zzjg',
   components: {
-    Pagination
+    Pagination, TableColumnSettings
   },
   directives: { waves },
   data() {
@@ -502,7 +544,121 @@
       radioSelected: '',
       deptcodeArr: [], // 閮ㄩ棬淇℃伅鏁扮粍
       customercodeArr: [], // 閲囪喘渚涙柟鏁扮粍
-      tableDataDetail: []
+      tableDataDetail: [],
+      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: false,
+          width: 110,
+          prop: 'status',
+          label: '璁㈠崟鐘舵��',
+          id: 3,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'orderdate',
+          label: '鍗曟嵁鏃ユ湡',
+          id: 4,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 130,
+          width: false,
+          prop: 'ordercode',
+          label: '璁㈠崟缂栧彿',
+          id: 5,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'deptname',
+          label: '閮ㄩ棬鍚嶇О',
+          id: 6,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 220,
+          width: false,
+          prop: 'customername',
+          label: '閲囪喘渚涙柟',
+          id: 7,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'saleorderCode',
+          label: '婧愬崟鍗曞彿',
+          id: 8,
+          show: true,
+          fixed: false,
+          sortable: true
+        }, {
+          minWidth: 130,
+          width: false,
+          prop: 'acceptdate',
+          label: '棰勮鍒拌揣鏃ユ湡',
+          id: 9,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'lm_user',
+          label: '鍒涘缓浜哄憳',
+          id: 10,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'lm_date',
+          label: '鍒涘缓鏃堕棿',
+          id: 11,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'auditoruser',
+          label: '瀹℃牳浜�',
+          id: 12,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'auditordate',
+          label: '瀹℃牳鏃堕棿',
+          id: 13,
+          show: true,
+          fixed: false,
+          sortable: true
+        }
+      ],
+      tableTimeStampKey: new Date().getTime() // 琛ㄦ牸key
 
     }
   },
@@ -515,6 +671,13 @@
     this.getHeight()
   },
   methods: {
+    tableColumnUpdate(val, isCopyTrue) {
+      if (isCopyTrue) {
+        this.tableColumnSettingsArray = val
+      }
+      this.tableTimeStampKey = new Date().getTime()
+      this.$refs.tableDataRef.doLayout()
+    },
     handleRequest() {
       this.getPurchaseOrderSearch().then(res => {
         if (res.code === '200') {
@@ -564,7 +727,7 @@
       this.deptcodeArr = res
     },
     // 閲囪喘渚涙柟淇℃伅鏌ヨ
-    async   getPurchSupplierSelect() {
+    async getPurchSupplierSelect() {
       const { data: res } = await PurchSupplierSelect()
       this.customercodeArr = res
     },

--
Gitblit v1.9.3