From 062175c7c625ef7763b694dd5dfba8bc7e5e76cd Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 14 六月 2023 15:38:04 +0800
Subject: [PATCH] 1.角色清单、安灯设置引入分车间概念

---
 src/views/basicSettings/userList.vue |  156 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 121 insertions(+), 35 deletions(-)

diff --git a/src/views/basicSettings/userList.vue b/src/views/basicSettings/userList.vue
index 1f9fc34..acb3481 100644
--- a/src/views/basicSettings/userList.vue
+++ b/src/views/basicSettings/userList.vue
@@ -34,8 +34,9 @@
                 popper-class="elCascader"
                 :options="StuOrgArr"
                 :props="defaultProps"
+                @change="cascaderChange"
               />
-              <!--              @change="cascaderChange"-->
+
               <!--              @focus="getUserOrganization"-->
 
             </el-form-item>
@@ -134,10 +135,27 @@
             <template slot-scope="{row}">
               <div v-if="row[item.prop]==='1'&&row.wagetype">璁℃椂鍒�</div>
               <div v-else-if="row[item.prop]==='2'&&row.wagetype">璁′欢鍒�</div>
-              <div v-else-if="row[item.prop]==='Y'&& item.prop==='enable'"><i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />鍦ㄨ亴</div>
-              <div v-else-if="row[item.prop]==='N'&& item.prop==='enable'"><i class="el-icon-info" style="margin-right: 2px" />绂昏亴</div>
-              <div v-else-if="row[item.prop]==='Y'&& item.prop==='is_role'"><i class="el-icon-share" :style="{color:$store.state.settings.theme}" @click="roleClick({row})" /></div>
-              <div v-else-if="row[item.prop]==='N'&& item.prop==='is_role'"><i class="el-icon-share" style="color: rgb(180 ,181, 185)" @click="roleClick({row})" /></div>
+              <div v-else-if="row[item.prop]==='Y'&& item.prop==='enable'"><i
+                class="el-icon-success"
+                :style="{color:$store.state.settings.theme}"
+                style="margin-right: 2px"
+              />鍦ㄨ亴
+              </div>
+              <div v-else-if="row[item.prop]==='N'&& item.prop==='enable'"><i
+                class="el-icon-info"
+                style="margin-right: 2px"
+              />绂昏亴
+              </div>
+              <div v-else-if="row[item.prop]==='Y'&& item.prop==='is_role'"><i
+                class="el-icon-share"
+                :style="{color:$store.state.settings.theme}"
+                @click="roleClick({row})"
+              /></div>
+              <div v-else-if="row[item.prop]==='N'&& item.prop==='is_role'"><i
+                class="el-icon-share"
+                style="color: rgb(180 ,181, 185)"
+                @click="roleClick({row})"
+              /></div>
               <div v-else-if="!row[item.prop]">/</div>
               <div v-else>{{ row[item.prop] }}</div>
             </template>
@@ -318,7 +336,7 @@
         :page.sync="form.page"
         :limit.sync="form.rows"
         align="right"
-        layout="total ,prev, pager, next,sizes"
+        layout="total ,prev, pager, next,sizes,jumper"
         popper-class="select_bottom"
         @pagination="getUserSearch"
       />
@@ -561,18 +579,11 @@
         <el-table-column
           v-if="$store.state.settings.orgType!=='W'"
           prop="stu_torgcode"
-          label="杞﹂棿鍚嶇О"
-
+          label="鎵�灞炵粍缁�"
           sortable="custom"
           show-tooltip-when-overflow
         >
           <template slot-scope="{row}">
-            <!--            <el-input-->
-            <!--              v-if="row.isVisible===1"-->
-            <!--              v-model="row.group_code"-->
-            <!--              oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')"-->
-            <!--              placeholder="璇疯緭鍏�"-->
-            <!--            />-->
             <el-cascader
               v-if="row.isVisible===1"
               ref="dialogCascader"
@@ -738,6 +749,7 @@
         UserCode: '', // 鐢ㄦ埛缂栫爜
         UserName: '', // 鐢ㄦ埛鍚嶇О
         StuOrg: getCookie('stu_torgcode'), // 鎵�灞炵粍缁�
+        description: getCookie('description'), // 缁勭粐绫诲瀷
         wagetype: '', // 宸ヨ祫绫诲瀷
         Enable: '', // 鍦ㄨ亴鐘舵��
         prop: 'lm_date', // 鎺掑簭瀛楁
@@ -784,13 +796,76 @@
           fixed: false,
           sortable: true
         },
-        { minWidth: 110, width: false, prop: 'password', label: '鐢ㄦ埛瀵嗙爜', id: 5, show: true, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'stu_torgcode', label: '缁勭粐缂栫爜', id: 6, show: false, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'org_name', label: '鎵�灞炵粍缁�', id: 7, show: true, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'group_code', label: '鐝粍缂栫爜', id: 8, show: false, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'group_name', label: '鐢熶骇鐝粍', id: 9, show: true, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'wagetype', label: '宸ヨ祫绫诲瀷', id: 10, show: true, fixed: false, sortable: 'custom' },
-        { minWidth: 110, width: false, prop: 'mobile', label: '鑱旂郴鏂瑰紡', id: 11, show: true, fixed: false, sortable: 'custom' },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'password',
+          label: '鐢ㄦ埛瀵嗙爜',
+          id: 5,
+          show: true,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'stu_torgcode',
+          label: '缁勭粐缂栫爜',
+          id: 6,
+          show: false,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'org_name',
+          label: '鎵�灞炵粍缁�',
+          id: 7,
+          show: true,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'group_code',
+          label: '鐝粍缂栫爜',
+          id: 8,
+          show: false,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'group_name',
+          label: '鐢熶骇鐝粍',
+          id: 9,
+          show: true,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'wagetype',
+          label: '宸ヨ祫绫诲瀷',
+          id: 10,
+          show: true,
+          fixed: false,
+          sortable: 'custom'
+        },
+        {
+          minWidth: 110,
+          width: false,
+          prop: 'mobile',
+          label: '鑱旂郴鏂瑰紡',
+          id: 11,
+          show: true,
+          fixed: false,
+          sortable: 'custom'
+        },
         {
           minWidth: 110,
           width: false,
@@ -897,6 +972,7 @@
       },
       dialogVisibleRoles: false,
       dialogFormRoles: {
+        stu_torgcode: '', // 鎵�灞炵粍缁�
         username: '', // 鐢ㄦ埛鍚嶇О
         usercode: '', // 鐢ㄦ埛缂栫爜
         rolesArr: [], // 瑙掕壊绫诲瀷闆嗗悎
@@ -1005,26 +1081,29 @@
       this.form.UserName = ''
       this.form.Enable = ''
       this.form.wagetype = ''
-      this.form.StuOrg = getCookie('stu_torgcode')
-      this.$refs.cascader.checkedValue = ''// 绾ц仈閫夋嫨鍣ㄧ殑娓呯┖
+      this.form.description = getCookie('description') === '' ? '' : getCookie('description')
+      this.form.StuOrg = getCookie('stu_torgcode') === '' ? '' : getCookie('stu_torgcode')
+      // console.log(getCookie('stu_torgcode') === '')
+
+      // if (this.$store.state.settings.orgType === '') {
+      //   this.$refs.cascader.checkedValue = ''
+      // }
+
       this.getUserSearch()
     },
     // 绾ц仈閫夋嫨鍣ㄦ敼鍙樹簨浠�
     cascaderChange(val) {
-      console.log(val)
-      this.form.StuOrg = val[val.length - 1]
-      // this.$refs.cascader.checkValue
+      this.form.description = this.StuOrgArr.find(i => i.code === val) ? 'D' : 'W'
     },
     dialogCascaderChange(val) {
-      console.log(val)
       this.dialogForm.groupcode = ''
-      this.getStorgGroupSelect(val)
+      this.getStorgGroupSelect(val, this.StuOrgArr2.find(i => i.code === val) ? 'D' : 'W')
     },
     // 鑾峰彇涓嬫媺鐢熶骇鐝粍
-    async getStorgGroupSelect(stu_torgcode) {
+    async getStorgGroupSelect(stu_torgcode, description) {
       const data = {
         stu_torgcode,
-        description: this.StuOrgArr2.find(i => i.code === stu_torgcode) ? 'D' : 'W'
+        description
       }
       const { data: res } = await StorgGroupSelect(data)
       this.usergroupArr = res
@@ -1062,7 +1141,7 @@
         this.dialogForm.Email = row.email
         this.dialogForm.wagetype = row.wagetype
       })
-      this.getStorgGroupSelect()
+      this.getStorgGroupSelect(row.stu_torgcode, this.StuOrgArr.find(i => i.code === row.stu_torgcode) ? 'D' : 'W')
       this.getUserOrganization2()
     },
     // 鍒犻櫎鎸夐挳
@@ -1168,7 +1247,8 @@
 
       this.dialogFormRoles.username = row.username
       this.dialogFormRoles.usercode = row.usercode
-      UserAssociationRole({ usercode: row.usercode }).then(res => {
+      this.dialogFormRoles.stu_torgcode = row.stu_torgcode
+      UserAssociationRole({ usercode: row.usercode, stu_torgcode: row.stu_torgcode, description: row.description }).then(res => {
         if (res.code === '200') {
           setTimeout(() => {
             loading.close()
@@ -1231,7 +1311,7 @@
     // 鐢ㄦ埛鍏宠仈瀵硅瘽妗嗙‘璁や簨浠�
     async rolesDialogVisibleConfirm() {
       this.$store.state.app.buttonIsDisabled = true
-      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode)
+      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode, this.dialogFormRoles.stu_torgcode)
       if (res.code === '200') {
         this.dialogVisibleRoles = false
         this.$message.success('淇濆瓨鎴愬姛锛�')
@@ -1474,7 +1554,6 @@
           this.workingTableData.splice(index, 1)
         }
       })
-      // this.getStorgGroupSelect()
     },
     // 鐢熶骇鐝粍鎺掑簭
     sortChangeOfWorking({ column, prop, order }) {
@@ -1506,7 +1585,14 @@
 
       let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
       number = number === 0 ? (10 + Math.random()) : number
-      const data = { storg_code: getCookie('stu_torgcode'), group_code: '', group_name: '', description: '', isVisible: 1, number: number }
+      const data = {
+        storg_code: getCookie('stu_torgcode'),
+        group_code: '',
+        group_name: '',
+        description: '',
+        isVisible: 1,
+        number: number
+      }
       this.workingTableData.unshift(data)
     },
     // 鍒犻櫎

--
Gitblit v1.9.3