From c02a3ebf5b4338710c4f9ae231d72cf591dfb97f Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期一, 02 十二月 2024 11:28:04 +0800
Subject: [PATCH] 1.修改  批量派发 没绑定工艺路线的单子,显示在最前面

---
 src/views/basicSettings/userList.vue |  188 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 144 insertions(+), 44 deletions(-)

diff --git a/src/views/basicSettings/userList.vue b/src/views/basicSettings/userList.vue
index 1f9fc34..7767e9f 100644
--- a/src/views/basicSettings/userList.vue
+++ b/src/views/basicSettings/userList.vue
@@ -6,7 +6,7 @@
         <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
 
         <div style="display: flex">
-          <el-button v-waves icon="el-icon-menu" @click="workingTramClick">鐢熶骇鐝粍</el-button>
+          <!--          <el-button v-waves icon="el-icon-menu" @click="workingTramClick">鐢熶骇鐝粍</el-button>-->
           <el-button v-waves icon="el-icon-download" @click="upload">瀵煎叆</el-button>
         </div>
       </div>
@@ -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>
@@ -305,7 +323,7 @@
                   />
                 </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.id)" />
+                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                 </el-tooltip>
               </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"
@@ -693,7 +704,7 @@
 import { StorgGroupSelect } from '@/api/basicInfo'
 
 export default {
-  name: 'YYQD',
+  name: 'UserList',
   components: {
     Pagination, ImportPicker, TableColumnSettings
   },
@@ -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,8 @@
       },
       dialogVisibleRoles: false,
       dialogFormRoles: {
+        stu_torgcode: '', // 鎵�灞炵粍缁�
+        description: '', // 鎵�灞炵粍缁囩被鍨�
         username: '', // 鐢ㄦ埛鍚嶇О
         usercode: '', // 鐢ㄦ埛缂栫爜
         rolesArr: [], // 瑙掕壊绫诲瀷闆嗗悎
@@ -1005,42 +1082,45 @@
       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
     },
     // 鏂板鎸夐挳
-    add(operation) {
+    async add(operation) {
       this.operation = operation
       this.dialogVisible = true
 
       // this.dialogForm.StuOrg = getCookie('stu_torgcode')
       // this.$refs.dialogCascader.checkedValue = [getCookie('stu_torgcode')]
 
-      this.getUserOrganization2()
+      await this.getUserOrganization2()
 
       if (this.$store.state.settings.orgType !== '') {
-        this.getStorgGroupSelect(getCookie('stu_torgcode'), this.StuOrgArr2.find(i => i.code === getCookie('stu_torgcode')) ? 'D' : 'W')
+        await this.getStorgGroupSelect(getCookie('stu_torgcode'), this.StuOrgArr2.find(i => i.code === getCookie('stu_torgcode')) ? 'D' : 'W')
       }
     },
     // 淇敼鎸夐挳
@@ -1062,17 +1142,20 @@
         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()
     },
     // 鍒犻櫎鎸夐挳
-    async del(id) {
+    async del(row) {
+      if (getCookie('admin') === row.usercode) {
+        return this.$message.info('鏃犳硶鍒犻櫎鐢ㄦ埛鏈韩锛�')
+      }
       this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteUser({ Userid: id }).then(res => {
+        DeleteUser({ Userid: row.id }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             if (this.form.page > 1 && this.tableData.length === 1) {
@@ -1164,11 +1247,14 @@
 
       this.dialogFormRoles.rolesArrSelectedArr = []
       this.dialogFormRoles.rolesArr = []
+      this.dialogFormRoles.roleTree = []
       this.dialogFormRoles.roleTreeSelectedArr = []
 
       this.dialogFormRoles.username = row.username
       this.dialogFormRoles.usercode = row.usercode
-      UserAssociationRole({ usercode: row.usercode }).then(res => {
+      this.dialogFormRoles.stu_torgcode = row.stu_torgcode
+      this.dialogFormRoles.description = row.description
+      UserAssociationRole({ usercode: row.usercode, stu_torgcode: row.stu_torgcode, description: row.description }).then(res => {
         if (res.code === '200') {
           setTimeout(() => {
             loading.close()
@@ -1231,7 +1317,10 @@
     // 鐢ㄦ埛鍏宠仈瀵硅瘽妗嗙‘璁や簨浠�
     async rolesDialogVisibleConfirm() {
       this.$store.state.app.buttonIsDisabled = true
-      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode)
+      this.dialogFormRoles.roleTreeSelectedArr.forEach(i => {
+        i.Data = [...new Set(i.Data)]
+      })
+      const res = await SaveUserAssoctRole(this.dialogFormRoles.roleTreeSelectedArr, this.dialogFormRoles.usercode, this.dialogFormRoles.stu_torgcode, this.dialogFormRoles.description)
       if (res.code === '200') {
         this.dialogVisibleRoles = false
         this.$message.success('淇濆瓨鎴愬姛锛�')
@@ -1295,12 +1384,17 @@
               } else {
                 this.dialogFormRoles.roleTreeSelectedArr.forEach((i, ind) => { // 褰撻�夊瓙code鏃舵墽琛�
                   if (i.Code === checkedFatherCode) {
+                    let flag = true
                     this.dialogFormRoles.roleTreeSelectedArr[ind].Data.forEach((i1, ind2) => {
                       if (i1 === a[0]) {
                         // this.dialogFormRoles.roleTreeSelectedArr[ind].Data.splice(ind2, 1)// 褰撳瓙code涓庣幇鍦ㄧ殑code鐩稿悓鏃舵墽琛�
                         this.dialogFormRoles.roleTreeSelectedArr[ind].Data = this.dialogFormRoles.roleTreeSelectedArr[ind].Data.filter(i2 => i2 !== a[0])
+                        flag = false
                       } else {
-                        this.dialogFormRoles.roleTreeSelectedArr[ind].Data.push(a[0])// //褰撳瓙code涓庣幇鍦ㄧ殑code涓嶇浉鍚屾椂鎵ц
+                        if (flag) {
+                          console.log('鎵ц浜�')
+                          this.dialogFormRoles.roleTreeSelectedArr[ind].Data.push(a[0])// //褰撳瓙code涓庣幇鍦ㄧ殑code涓嶇浉鍚屾椂鎵ц
+                        }
                       }
                     })
                     // this.dialogFormRoles.roleTreeSelectedArr[ind].Data.filter((i1, ind2) => i1 !== a[0])// 杩囨护鎺夐�変腑鐩稿悓鐨�
@@ -1474,7 +1568,6 @@
           this.workingTableData.splice(index, 1)
         }
       })
-      // this.getStorgGroupSelect()
     },
     // 鐢熶骇鐝粍鎺掑簭
     sortChangeOfWorking({ column, prop, order }) {
@@ -1506,7 +1599,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