From 06c8aa18a41393b564f48b42fe49db9fa761336c Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期日, 23 四月 2023 13:19:21 +0800
Subject: [PATCH] 1.MES产品对接云平台

---
 src/views/makeModel/materialList.vue |  391 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 285 insertions(+), 106 deletions(-)

diff --git a/src/views/makeModel/materialList.vue b/src/views/makeModel/materialList.vue
index a611bd4..4fa42f3 100644
--- a/src/views/makeModel/materialList.vue
+++ b/src/views/makeModel/materialList.vue
@@ -64,7 +64,10 @@
               </el-select>
             </el-form-item>
           </div>
-          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
+          <div
+            class="bodySearchReset"
+            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+          >
             <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
             <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
           </div>
@@ -89,8 +92,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'"
@@ -102,110 +110,146 @@
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
         >
+
           <el-table-column
-            prop="RowNum"
-            width="50"
-            fixed
-            label="搴忓彿"
-          />
-          <el-table-column
-            prop="partcode"
-            label="姣嶄欢缂栫爜"
-            min-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
-            sortable="custom"
-          />
-          <el-table-column
-            prop="partname"
-            label="姣嶄欢鍚嶇О"
-            min-width="160"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="partspec"
-            label="姣嶄欢瑙勬牸"
-            min-width="160"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="stocktype_name"
-            label="瀛樿揣绫诲瀷"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="uom_name"
-            label="璁¢噺鍗曚綅"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="quantity"
-            label="鍩虹鏁伴噺"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="status"
-            width="110"
-            show-tooltip-when-overflow
-            label="鍚敤鐘舵��"
-            sortable="custom"
+            :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
           >
             <template slot-scope="{row}">
-              <div v-if="row.status==='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==='startdate'">{{ row.startdate.substring(0,11) }}</div>
+              <div v-else-if="item.prop==='status'">
+                <div v-if="row[item.prop]==='Y'">
+                  <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
+                  鏄�
+                </div>
+                <div v-if="row[item.prop]==='N'">
+                  <i class="el-icon-info" style="margin-right: 2px" />
+                  鍚�
+                </div>
               </div>
-              <div v-if="row.status==='N'">
-                <i class="el-icon-info" style="margin-right: 2px" />
-                鍚�
-              </div>
+              <div v-else>{{ row[item.prop] }}</div>
             </template>
           </el-table-column>
-          <el-table-column
-            prop="startdate"
-            label="鍚敤鏃ユ湡"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.startdate">{{ row.startdate.substring(0, 11) }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="version"
-            label="鐗堟湰鍙�"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="username"
-            label="鍒涘缓浜哄憳"
-            width="110"
-            show-tooltip-when-overflow
-            sortable="custom"
-          />
-          <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
-            show-tooltip-when-overflow
-            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="RowNum"-->
+          <!--            width="50"-->
+          <!--            fixed-->
+          <!--            label="搴忓彿"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="partcode"-->
+          <!--            label="姣嶄欢缂栫爜"-->
+          <!--            min-width="160"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="partname"-->
+          <!--            label="姣嶄欢鍚嶇О"-->
+          <!--            min-width="160"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="partspec"-->
+          <!--            label="姣嶄欢瑙勬牸"-->
+          <!--            min-width="160"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.partspec">{{ row.partspec }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="stocktype_name"-->
+          <!--            label="瀛樿揣绫诲瀷"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="uom_name"-->
+          <!--            label="璁¢噺鍗曚綅"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="quantity"-->
+          <!--            label="鍩虹鏁伴噺"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="status"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            label="鍚敤鐘舵��"-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.status==='Y'">-->
+          <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
+          <!--                鏄�-->
+          <!--              </div>-->
+          <!--              <div v-if="row.status==='N'">-->
+          <!--                <i class="el-icon-info" style="margin-right: 2px" />-->
+          <!--                鍚�-->
+          <!--              </div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="startdate"-->
+          <!--            label="鍚敤鏃ユ湡"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          >-->
+          <!--            <template slot-scope="{row}">-->
+          <!--              <div v-if="row.startdate">{{ row.startdate.substring(0, 11) }}</div>-->
+          <!--              <div v-else>/</div>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
+          <!--          <el-table-column-->
+          <!--            prop="version"-->
+          <!--            label="鐗堟湰鍙�"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="username"-->
+          <!--            label="鍒涘缓浜哄憳"-->
+          <!--            width="110"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <!--          <el-table-column-->
+          <!--            prop="lm_date"-->
+          <!--            label="鍒涘缓鏃堕棿"-->
+          <!--            show-tooltip-when-overflow-->
+          <!--            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
             label="鎿嶄綔"
             width="120"
@@ -222,7 +266,11 @@
                   />
                 </el-tooltip>
                 <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
-                  <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" />
+                  <i
+                    :style="{color:$store.state.settings.theme}"
+                    class="el-icon-edit-outline"
+                    @click="edit('edit',row)"
+                  />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
                   <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
@@ -450,7 +498,12 @@
           label="瀛愪欢瑙勬牸"
           width="110"
           show-tooltip-when-overflow
-        />
+        >
+          <template slot-scope="{row}">
+            <div v-if="row.SMATERIRL_SPEC">{{ row.SMATERIRL_SPEC }}</div>
+            <div v-else>/</div>
+          </template>
+        </el-table-column>
         <el-table-column
           prop="uomname"
           label="璁¢噺鍗曚綅"
@@ -578,14 +631,15 @@
   DeleteBoIventory, MaterielDetailedVsion,
   PartSelect,
   StockTypeSelect
-} from '@/api/zzmx'
+} from '@/api/makeModel'
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
+import TableColumnSettings from '@/components/TableColumnSettings'
 
 export default {
   name: 'Zzjg',
   components: {
-    Pagination, ImportPicker
+    Pagination, ImportPicker, TableColumnSettings
   },
   directives: { elDragDialog, waves },
   data() {
@@ -616,6 +670,121 @@
 
       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: 'partcode',
+          label: '姣嶄欢缂栫爜',
+          id: 3,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'partname',
+          label: '姣嶄欢鍚嶇О',
+          id: 4,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'partspec',
+          label: '姣嶄欢瑙勬牸',
+          id: 5,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'stocktype_name',
+          label: '瀛樿揣绫诲瀷',
+          id: 6,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'uom_name',
+          label: '璁¢噺鍗曚綅',
+          id: 7,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'quantity',
+          label: '鍩虹鏁伴噺',
+          id: 8,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 110,
+          prop: 'status',
+          label: '鍚姩鐘舵��',
+          id: 9,
+          show: true,
+          fixed: false,
+          sortable: true
+        }, {
+          minWidth: false,
+          width: 110,
+          prop: 'startdate',
+          label: '鍚敤鏃ユ湡',
+          id: 10,
+          show: true,
+          fixed: false,
+          sortable: true
+        }, {
+          minWidth: false,
+          width: 110,
+          prop: 'version',
+          label: '鐗堟湰鍙�',
+          id: 11,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 110,
+          prop: 'username',
+          label: '鍒涘缓浜哄憳',
+          id: 12,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: false,
+          width: 160,
+          prop: 'lm_date',
+          label: '鍒涘缓鏃堕棿',
+          id: 13,
+          show: true,
+          fixed: false,
+          sortable: true
+        }
+      ],
+      tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key
+
       dialogVisible: false,
       dialogForm: {
         bomid: '',
@@ -684,6 +853,13 @@
     this.getHeight()
   },
   methods: {
+    tableColumnUpdate(val, isCopyTrue) {
+      if (isCopyTrue) {
+        this.tableColumnSettingsArray = val
+      }
+      this.tableTimeStampKey = new Date().getTime()
+      this.$refs.tableDataRef.doLayout()
+    },
     handleRequest() {
       this.getBoIventorySelect().then(res => {
         if (res.code === '200') {
@@ -1151,16 +1327,19 @@
   }
 }
 
-::v-deep .el-range__icon{
+::v-deep .el-range__icon {
   line-height: 28px !important;
 }
-::v-deep .el-range-separator{
+
+::v-deep .el-range-separator {
   line-height: 28px !important;
 }
-::v-deep .el-range-input{
+
+::v-deep .el-range-input {
   font-size: 14px;
 }
-::v-deep .el-range-separator{
+
+::v-deep .el-range-separator {
   display: flex;
   justify-content: center;
   align-items: center;

--
Gitblit v1.9.3