Przeglądaj źródła

部门选择器删除回显id修复,所有岗位改为部门

cyy 2 lat temu
rodzic
commit
d7cb0bce75

+ 1 - 1
src/business/platform/org/selector/constants/index.js

@@ -5,7 +5,7 @@ export const typeOptions = [
   },
   {
     value: 'position',
-    label: '岗位'
+    label: '部门'
   },
   {
     value: 'role',

+ 4 - 5
src/business/platform/org/selector/index.vue

@@ -34,7 +34,9 @@
         {{ label }}<van-icon v-if="desc && descPosition==='lableIcon'" name="warning" class="ibps-dialog-icon" @click="$action.descDialog({ title:label, message:desc })" />
       </template>
       <template #input>
-        <template v-if="$utils.isEmpty(selectedData)">
+        <!-- {{selectedData}} -->
+        <!-- <div style="display:none">{{ $utils.isEmpty(selectedData) }}</div> -->
+        <template v-if="selectedData==[]">
           <template v-if="editable">
             <!-- <van-icon
               slot="left-icon"
@@ -426,7 +428,6 @@ export default {
     },
     getStoreValue(value) {
       const res = []
-      console.log(this.valueKey, value, this.store, this.storeSeparator)
       if (this.store === 'json') { // json
         if (this.$utils.isEmpty(value)) {
           return ''
@@ -520,14 +521,12 @@ export default {
     },
     removeData(index) {
       this.selectedData.splice(index, 1)
-      console.log(this.selectedData, this.selectedValue, index, '11212121212')
       const mid = []
       this.selectedData.forEach((it, i) => {
         mid.push(it.id)
       })
-      this.selectedValue.length = 0
+      this.selectedValue.splice(0)
       this.selectedValue = mid
-      console.log(this.getStoreValue(this.selectedData))
       this.$emit('input', this.getStoreValue(this.selectedData))
     },
 

+ 1 - 2
src/business/platform/org/selector/popup-tree/index.vue

@@ -73,7 +73,7 @@ export default {
             text: '组织',
             value: 'org'
           }, {
-            text: '岗位',
+            text: '部门',
             value: 'position'
           }, {
             text: '角色',
@@ -115,7 +115,6 @@ export default {
         isLeaf: 'leaf'
       },
       partyType: 'position',
-
       partyOptions: this.partyTypeOptions,
       lazyTree: true,
       defaultExpandedKeys: ['0'],

+ 13 - 1
src/business/platform/org/selector/popup-tree/mixins/otherTreeEven.js

@@ -289,9 +289,15 @@ export default {
         getPositionTreeData(params).then(res => {
           this.loadingTree = false
           const arr = JSON.parse(JSON.stringify(res.data))
+          arr.forEach((item) => {
+            if (item.name === '岗位树') {
+              item.name = '部门树'
+              item.title = '部门树'
+            }
+          })
           let arrList
           const frist = this.$store.getters.level.first || ''
-          if ((type === '1' || type === '2') && this.filtrate && frist) {
+          if ((type === '1' || type === '2') && frist) {
             const showBoo = arr.some((item) => item.id === frist)
             if (showBoo) {
               arrList = arr.filter((item) => item.id === frist)
@@ -325,6 +331,12 @@ export default {
         getPositionTreeData(params).then(res => {
           this.loadingTree = false
           const arr = JSON.parse(JSON.stringify(res.data))
+          arr.forEach((item) => {
+            if (item.name === '岗位树') {
+              item.name = '部门树'
+              item.title = '部门树'
+            }
+          })
           let arrList = []
           const second = this.$store.getters.level.second || ''
           if ((type === '1' || type === '2') && this.filtrate && second) {

+ 1 - 1
src/business/platform/org/selector/position.vue

@@ -125,7 +125,7 @@ export default {
         this.parentId = '0'
         this.pathData = [{
           id: '',
-          name: '岗位'
+          name: '部门'
         }]
         this.initPageData()
         this.cacheData = []

+ 1 - 1
src/business/platform/org/selector/selector.vue

@@ -60,7 +60,7 @@
                 :disabled="data[valueKey] === '0'"
                 :name="data[valueKey]"
               >
-                {{ data[labelKey] }}
+                {{ data[labelKey] === '岗位树'?'部门树':data[labelKey] }}
                 <template v-if="!multiple" #icon="props">
                   <div v-if="props.checked" class="ibps-radio-icon">
                     <div class="ibps-radio-icon_inside" />

+ 76 - 78
src/store/modules/ibps/modules/user.js

@@ -1,5 +1,5 @@
-import { getUserInfo } from "@/api/oauth2/user";
-import common from "@/utils/common";
+import { getUserInfo } from '@/api/oauth2/user'
+import common from '@/utils/common'
 
 export default {
   namespaced: true,
@@ -7,9 +7,9 @@ export default {
     // 用户信息
     info: {},
     // 帐号
-    account: "",
+    account: '',
     // 切换的账号
-    switchAccount: "",
+    switchAccount: '',
     // 是否开启注册
     regOpen: false
   },
@@ -22,21 +22,21 @@ export default {
     set({ state, dispatch }, info) {
       return new Promise(async resolve => {
         // store 赋值
-        state.info = info;
+        state.info = info
         // 持久化
         await dispatch(
-          "ibps/db/set",
+          'ibps/db/set',
           {
-            dbName: "sys",
-            path: "user.info",
+            dbName: 'sys',
+            path: 'user.info',
             value: info,
             user: true
           },
           { root: true }
-        );
+        )
         // end
-        resolve();
-      });
+        resolve()
+      })
     },
     /**
      * @description 从数据库取用户数据
@@ -46,71 +46,70 @@ export default {
       return new Promise(async resolve => {
         // store 赋值
         state.info = await dispatch(
-          "ibps/db/get",
+          'ibps/db/get',
           {
-            dbName: "sys",
-            path: "user.info",
+            dbName: 'sys',
+            path: 'user.info',
             defaultValue: {},
             user: true
           },
           { root: true }
-        );
+        )
         // end
-        resolve();
-      });
+        resolve()
+      })
     },
     /**
      * @description 从数据库取用户数据
      * @param {Object} context
      */
     load({ state, dispatch }) {
-      return new Promise(async (resolve, reject) => {
-        await dispatch("getAccount");
+      return new Promise(async(resolve, reject) => {
+        await dispatch('getAccount')
         getUserInfo(state.account)
           .then(async response => {
             if (!response) {
-              reject(response);
+              reject(response)
             }
-            const info = response.data;
+            const info = response.data
             // 设置当前
-            await dispatch("set", info);
-            let level = {};
+            await dispatch('set', info)
+            let level = {}
             if (info.positions && info.positions.length) {
               // 当存在第二级为空时,说明具备最高级权限
               const hasFirst = info.positions.some(
-                obj => obj.path.split(".")[1] === ""
-              );
+                obj => obj.path.split('.')[1] === ''
+              )
               level = {
                 first: [
-                  ...new Set(info.positions.map(obj => obj.path.split(".")[0]))
-                ].join(","),
+                  ...new Set(info.positions.map(obj => obj.path.split('.')[0]))
+                ].join(','),
                 second: hasFirst
-                  ? ""
+                  ? ''
                   : [
-                      ...new Set(
-                        info.positions.map(obj => obj.path.split(".")[1])
-                      )
-                    ].join(",")
-              };
-              await dispatch("ibps/param/setLevel", level, {
+                    ...new Set(
+                      info.positions.map(obj => obj.path.split('.')[1])
+                    )
+                  ].join(',')
+              }
+              await dispatch('ibps/param/setLevel', level, {
                 root: true
-              });
+              })
             }
-            console.log(level, "infoinfo");
             // 获取所有用户信息
-            await dispatch("getUserList", level);
+            await dispatch('getUserList', level)
             // 获取所有部门信息
-            await dispatch("getDeptList", level);
+            await dispatch('getDeptList', level)
             // // 获取当前子系统
             // await dispatch('ibps/system/loadSystem', null, {
             //   root: true
             // })
-            resolve(info);
+            resolve(info)
           })
           .catch(error => {
-            reject(error);
-          });
-      });
+            reject(error)
+          })
+      })
     },
     /**
      * 获取用户名
@@ -120,37 +119,37 @@ export default {
       return new Promise(async resolve => {
         // store 赋值
         state.account = await dispatch(
-          "ibps/db/get",
+          'ibps/db/get',
           {
-            dbName: "sys",
-            path: "account",
-            defaultValue: "",
+            dbName: 'sys',
+            path: 'account',
+            defaultValue: '',
             user: true
           },
           { root: true }
-        );
+        )
         // end
-        resolve();
-      });
+        resolve()
+      })
     },
     setAccount({ state, dispatch }, account) {
       return new Promise(async resolve => {
         // store 赋值
-        state.account = account;
+        state.account = account
         // 持久化
         await dispatch(
-          "ibps/db/set",
+          'ibps/db/set',
           {
-            dbName: "sys",
-            path: "account",
+            dbName: 'sys',
+            path: 'account',
             value: account,
             user: true
           },
           { root: true }
-        );
+        )
         // end
-        resolve();
-      });
+        resolve()
+      })
     },
     /**
      * 获取所有系统用户账号
@@ -159,21 +158,21 @@ export default {
       const params = second
         ? `'%${second}%' or entity.id_ = '${first}'`
         : first
-        ? `'%${first}%'`
-        : "%%";
-      const sql = `select users.id_ as userId, users.name_ as userName, ifnull(users.mobile_, '') as phone, ifnull(group_concat(distinct positions.id_ order by positions.id_ separator ','), '') as positionId, ifnull(group_concat(distinct positions.name_ order by positions.id_ separator ','), '') as positions, ifnull(group_concat(distinct roles.id_ order by roles.role_note_ asc separator ','), '') as roleId, ifnull(group_concat(distinct roles.name_ order by roles.role_note_ asc separator ','), '') as roles, (select ifnull(people.qian_zi_tu_wen_, '') from t_ryjbqk as people where people.parent_id_ = users.id_) as signatureId, (select ifnull(files.file_name_, '') from ibps_file_attachment as files where files.id_ = signatureId) as signatureName from ibps_party_employee as users left join (select ur.user_id_, r.role_note_, group_concat(distinct r.id_ order by r.id_ separator ',') as id_, group_concat(distinct r.name_ order by r.id_ separator ',') as name_ from ibps_party_user_role as ur join ibps_party_role as r on ur.role_id_ = r.id_ group by ur.user_id_) as roles on users.id_ = roles.user_id_ left join ibps_party_entity as positions on find_in_set(positions.id_, users.positions_) where exists (select 1 from ibps_party_entity as entity where find_in_set(entity.id_, users.positions_) and (entity.path_ like ${params})) group by users.id_`;
+          ? `'%${first}%'`
+          : '%%'
+      const sql = `select users.id_ as userId, users.name_ as userName, ifnull(users.mobile_, '') as phone, ifnull(group_concat(distinct positions.id_ order by positions.id_ separator ','), '') as positionId, ifnull(group_concat(distinct positions.name_ order by positions.id_ separator ','), '') as positions, ifnull(group_concat(distinct roles.id_ order by roles.role_note_ asc separator ','), '') as roleId, ifnull(group_concat(distinct roles.name_ order by roles.role_note_ asc separator ','), '') as roles, (select ifnull(people.qian_zi_tu_wen_, '') from t_ryjbqk as people where people.parent_id_ = users.id_) as signatureId, (select ifnull(files.file_name_, '') from ibps_file_attachment as files where files.id_ = signatureId) as signatureName from ibps_party_employee as users left join (select ur.user_id_, r.role_note_, group_concat(distinct r.id_ order by r.id_ separator ',') as id_, group_concat(distinct r.name_ order by r.id_ separator ',') as name_ from ibps_party_user_role as ur join ibps_party_role as r on ur.role_id_ = r.id_ group by ur.user_id_) as roles on users.id_ = roles.user_id_ left join ibps_party_entity as positions on find_in_set(positions.id_, users.positions_) where exists (select 1 from ibps_party_entity as entity where find_in_set(entity.id_, users.positions_) and (entity.path_ like ${params})) group by users.id_`
       common
-        .request("sql", sql)
+        .request('sql', sql)
         .then(res => {
-          const { data = [] } = res.variables || {};
-          dispatch("ibps/param/setUserList", data, {
+          const { data = [] } = res.variables || {}
+          dispatch('ibps/param/setUserList', data, {
             root: true
-          });
+          })
         })
         .catch(error => {
-          console.log(error);
-          alert("获取所有用户信息失败!");
-        });
+          console.log(error)
+          alert('获取所有用户信息失败!')
+        })
     },
     /**
      * 获取所有系统部门信息
@@ -182,23 +181,22 @@ export default {
       const params = second
         ? ` and (pe.path_ like '%${second}%' or pe.id_ = '${first}')`
         : first
-        ? ` and pe.path_ like '%${first}%'`
-        : "";
+          ? ` and pe.path_ like '%${first}%'`
+          : ''
       // const sql = `select id_ as positionId, name_ as positionName, path_ as path, depth_ as depth, sn_ as sn from ibps_party_entity where party_type_ = 'position'${params} order by depth_ asc, sn_ asc`
-      const sql = `select pe.id_ as positionId, pe.name_ as positionName, pe.path_ as path, pe.depth_ as depth, pe.sn_ as sn, ifnull(r.name_, '') as manager, ifnull(r.id_, '') as managerId from ibps_party_entity as pe left join (select em.id_, em.positions_, em.name_ from ibps_party_employee as em left join ibps_party_user_role as ur on em.id_ = ur.user_id_ left join ibps_party_role as pr on pr.id_ = ur.role_id_ where role_alias_ in ('zhsfzr', 'syszr', 'zhglzzc')) as r on find_in_set(pe.id_, r.positions_) > 0 where pe.party_type_ = 'position'${params} group by pe.id_ order by pe.depth_ asc, pe.sn_ asc,pe.id_ asc`;
+      const sql = `select pe.id_ as positionId, pe.name_ as positionName, pe.path_ as path, pe.depth_ as depth, pe.sn_ as sn, ifnull(r.name_, '') as manager, ifnull(r.id_, '') as managerId from ibps_party_entity as pe left join (select em.id_, em.positions_, em.name_ from ibps_party_employee as em left join ibps_party_user_role as ur on em.id_ = ur.user_id_ left join ibps_party_role as pr on pr.id_ = ur.role_id_ where role_alias_ in ('zhsfzr', 'syszr', 'zhglzzc')) as r on find_in_set(pe.id_, r.positions_) > 0 where pe.party_type_ = 'position'${params} group by pe.id_ order by pe.depth_ asc, pe.sn_ asc,pe.id_ asc`
       common
-        .request("sql", sql)
+        .request('sql', sql)
         .then(res => {
-          console.log(res, "sqlsqlsql");
-          const { data = [] } = res.variables || {};
-          dispatch("ibps/param/setDeptList", data, {
+          const { data = [] } = res.variables || {}
+          dispatch('ibps/param/setDeptList', data, {
             root: true
-          });
+          })
         })
         .catch(error => {
-          console.log(error);
-          alert("获取所有部门信息失败!");
-        });
+          console.log(error)
+          alert('获取所有部门信息失败!')
+        })
     }
   }
-};
+}

+ 2 - 3
src/views/platform/my/index.vue

@@ -81,10 +81,10 @@ export default {
   mixins: [navbar],
   data() {
     const { first = '', second = '' } = this.$store.getters.level
-    const { userId, userList = [], deptList = [], menus, userInfo } = this.$store.getters
+    const { deptList = [] } = this.$store.getters
+    // const { userId, userList = [], deptList = [], menus, userInfo } = this.$store.getters
     const t1 = deptList.find(i => i.positionId === first) || {}
     const t2 = deptList.find(i => i.positionId === second) || {}
-    console.log(first, second, deptList)
     const locationName = second ? t1.positionName + t2.positionName : t1.positionName
     return {
       defaultImage: defaultImage,
@@ -111,7 +111,6 @@ export default {
       return this.info && this.info.user ? this.info.user.fullname : ''
     },
     org() {
-      console.log(this.locationName, 'this.locationNamethis.locationName')
       return this.locationName
     },
     position() {