From 3d73201f0830320c703cfb3d36b47976eb3d94e7 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 11 五月 2023 17:34:21 +0800
Subject: [PATCH] 1.生产进度报表提交

---
 src/views/basicSettings/roleList.vue |  287 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 170 insertions(+), 117 deletions(-)

diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue
index baf80a1..f43c7dc 100644
--- a/src/views/basicSettings/roleList.vue
+++ b/src/views/basicSettings/roleList.vue
@@ -63,8 +63,13 @@
       </div>
 
       <div class="elTableDiv">
+        <TableColumnSettings
+          :list1="tableColumnSettingsArray"
+          @tableColumnUpdate="tableColumnUpdate"
+        />
         <el-table
           ref="tableDataRef"
+          :key="tableTimeStampKey"
           :data="tableData"
           class="tableFixed"
           border
@@ -77,111 +82,50 @@
           @sort-change="sortChange"
         >
 
-          <!--          <el-table-column-->
-          <!--            type="selection"-->
-          <!--            width="50"-->
-          <!--          />-->
           <el-table-column
-            prop="RowNum"
-            width="50"
-            label="搴忓彿"
-            fixed
-          />
-          <el-table-column
-            prop="role_code"
-            label="瑙掕壊缂栫爜"
-            sortable="custom"
+            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
-            min-width="110"
-          />
-          <el-table-column
-            prop="role_name"
-            label="瑙掕壊鍚嶇О"
-            sortable="custom"
-            show-tooltip-when-overflow
-            min-width="110"
-          />
-          <el-table-column
-            prop="roletype_name"
-            label="瑙掕壊绫诲瀷"
-            sortable="custom"
-            show-tooltip-when-overflow
-            min-width="110"
-          />
-          <el-table-column
-            prop="description"
-            min-width="160"
-            label="瑙掕壊鎻忚堪"
-            sortable="custom"
-            show-tooltip-when-overflow
+            :fixed="item.fixed?(item.fixed==='left'?'left':'right'):false"
           >
             <template slot-scope="{row}">
-              <div v-if="row.description">{{ row.description }}</div>
-              <div v-else>/</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="lm_user"
-            label="鍒涘缓浜哄憳"
-            sortable="custom"
-            width="110"
-            show-tooltip-when-overflow
-          >
-            <template slot-scope="{row}">
-              <div v-if="row.lm_user===null">/</div>
-              <div v-else>{{ row.lm_user }}</div>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
-            show-tooltip-when-overflow
-            width="160"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="is_user"
-            label="鍏宠仈鐢ㄦ埛"
-            show-tooltip-when-overflow
-            width="120"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <i
-                v-if="row.is_user==='Y'"
-                class="el-icon-user-solid"
-                style=" cursor: pointer"
-                :style="{color:styleObject}"
-                @click="userClick(row)"
-              />
-              <i
-                v-if="row.is_user==='N'"
-                class="el-icon-user-solid"
-                style="color: rgb(180 ,181, 185);cursor: pointer"
-                @click="userClick(row)"
-              />
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="is_right"
-            label="鍒嗛厤鏉冮檺"
-            sortable="custom"
-            show-tooltip-when-overflow
-            width="120"
-          >
-            <template slot-scope="{row}">
-              <i
-                v-if="row.is_right==='Y'"
-                :style="{color:styleObject}"
-                class="el-icon-share"
-                @click="rightClick(row)"
-              />
-              <i
-                v-if="row.is_right==='N'"
-                class="el-icon-share"
-                style="color: rgb(180 ,181, 185)"
-                @click="rightClick(row)"
-              />
+              <div v-if="!row[item.prop]">/</div>
+              <div v-else-if="item.prop==='is_user'">
+                <i
+                  v-if="row[item.prop]==='Y'"
+                  class="el-icon-user-solid"
+                  style=" cursor: pointer"
+                  :style="{color:styleObject}"
+                  @click="userClick(row)"
+                />
+                <i
+                  v-if="row[item.prop]==='N'"
+                  class="el-icon-user-solid"
+                  style="color: rgb(180 ,181, 185);cursor: pointer"
+                  @click="userClick(row)"
+                />
+              </div>
+              <div v-else-if="item.prop==='is_right'">
+                <i
+                  v-if="row[item.prop]==='Y'"
+                  :style="{color:styleObject}"
+                  class="el-icon-share"
+                  @click="rightClick(row)"
+                />
+                <i
+                  v-if="row[item.prop]==='N'"
+                  class="el-icon-share"
+                  style="color: rgb(180 ,181, 185)"
+                  @click="rightClick(row)"
+                />
+              </div>
+              <div v-else>{{ row[item.prop] }}</div>
             </template>
           </el-table-column>
           <el-table-column
@@ -452,7 +396,7 @@
         </el-button>
       </div>
       <el-table
-        ref="multipleTable"
+        ref="multipleTableRef"
         :data="dialogFormUserTable"
         border
         :row-class-name="tableRowClassName"
@@ -668,11 +612,12 @@
 import clearAllChildren, { validateCode } from '@/utils/global'
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
+import TableColumnSettings from '@/components/TableColumnSettings'
 
 export default {
   name: 'JSQD',
   components: {
-    Pagination, ImportPicker
+    Pagination, ImportPicker, TableColumnSettings
   },
   directives: { elDragDialog, waves },
   data() {
@@ -701,6 +646,103 @@
         order: 'desc'
       },
       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: 'role_code',
+          label: '瑙掕壊缂栫爜',
+          id: 3,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'role_name',
+          label: '瑙掕壊鍚嶇О',
+          id: 4,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'roletype_code',
+          label: '瑙掕壊绫诲瀷缂栫爜',
+          id: 5,
+          show: false,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'roletype_name',
+          label: '瑙掕壊绫诲瀷',
+          id: 6,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 330,
+          width: false,
+          prop: 'description',
+          label: '瑙掕壊鎻忚堪',
+          id: 7,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'is_user',
+          label: '鍏宠仈鐢ㄦ埛',
+          id: 8,
+          show: true,
+          fixed: false,
+          sortable: true
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'is_right',
+          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
+        }
+      ],
+      tableTimeStampKey: new Date().getTime(), // 琛ㄦ牸key
+
       dialogVisible: false,
       dialogForm: {
         RoleId: '',
@@ -800,6 +842,15 @@
     this.getHeight()
   },
   methods: {
+    tableColumnUpdate(val, isCopyTrue) {
+      if (isCopyTrue) {
+        this.tableColumnSettingsArray = val
+      }
+
+      this.tableTimeStampKey = new Date().getTime()
+
+      this.$refs.tableDataRef.doLayout()
+    },
     handleRequest() {
       this.getRoleSearch().then(res => {
         if (res.code === '200') {
@@ -1056,7 +1107,7 @@
     },
 
     /* 鍏宠仈鐢ㄦ埛妯″潡*/
-    async userClick(row) {
+    userClick(row) {
       if (row.role_code === 'S001') {
         return this.$message.info('姝よ鑹叉棤娉曟搷浣滐紒')
       }
@@ -1070,29 +1121,31 @@
 
       this.userForm.roleName = row.role_name
       this.dialogFormUser.rolecode = row.role_code
-      const res = await this.getRoleAssociationUser()
 
-      if (res.code === '200') {
-        setTimeout(() => {
-          loading.close()
-          this.userDialogVisible = true
-          this.$nextTick(() => {
-            this.$refs.multipleTable.doLayout()
+      this.getRoleAssociationUser().then(res => {
+        if (res.code === '200') {
+          setTimeout(() => {
+            loading.close()
+
+            this.$nextTick(() => {
+              this.$refs.multipleTableRef.doLayout()
+            })
           })
-        }, 1000)
-      } else {
-        loading.close()
-      }
+        } else {
+          loading.close()
+        }
+      })
     },
     // 鑾峰彇瑙掕壊娓呭崟鍏宠仈鐢ㄦ埛
     async getRoleAssociationUser() {
       const res = await RoleAssociationUser(this.dialogFormUser)
       this.dialogFormUserTable = res.data
       this.dialogFormUserTableLength = res.count
+      this.userDialogVisible = true
       this.$nextTick(() => {
         this.dialogFormUserTable.forEach((item, index) => {
           if (item.flag === 'Y') {
-            this.$refs.multipleTable.toggleRowSelection(this.dialogFormUserTable[index], true)
+            this.$refs.multipleTableRef.toggleRowSelection(this.dialogFormUserTable[index], true)
           }
         })
       })
@@ -1139,7 +1192,7 @@
       this.dialogFormUser.orgcode = ''
       this.dialogFormUser.isrole = ''
       this.$refs.dialogCascaderUser.checkedValue = ''
-      this.$refs.multipleTable.clearSelection()
+      this.$refs.multipleTableRef.clearSelection()
     },
     // 鍏宠仈鐢ㄦ埛瀵硅瘽妗嗗叧闂�
     userDialogVisibleCancel() {

--
Gitblit v1.9.3