Browse Source

feat: 新增获取全部部门store

johnsen 8 tháng trước cách đây
mục cha
commit
d2f35f1803

+ 4 - 0
src/store/getters.js

@@ -82,6 +82,10 @@ export default {
     state.ibps.param && state.ibps.param.deptList
     state.ibps.param && state.ibps.param.deptList
       ? state.ibps.param.deptList
       ? state.ibps.param.deptList
       : [],
       : [],
+  deptListAll: (state) =>
+    state.ibps.param && state.ibps.param.deptListAll
+      ? state.ibps.param.deptListAll
+      : [],
   // 获取用户最高层级
   // 获取用户最高层级
   level: (state) =>
   level: (state) =>
     state.ibps.param && state.ibps.param.level ? state.ibps.param.level : [],
     state.ibps.param && state.ibps.param.level ? state.ibps.param.level : [],

+ 7 - 0
src/store/modules/ibps/modules/param.js

@@ -7,6 +7,7 @@ export default {
     userList: [],
     userList: [],
     // 所有部门信息
     // 所有部门信息
     deptList: [],
     deptList: [],
+    deptListAll: [],
     // 当前用户层级
     // 当前用户层级
     level: {
     level: {
       first: '',
       first: '',
@@ -25,6 +26,9 @@ export default {
     deptList(state, data) {
     deptList(state, data) {
       state.deptList = data.length ? data : []
       state.deptList = data.length ? data : []
     },
     },
+    deptListAll(state, data) {
+      state.deptListAll = data.length ? data : []
+    },
     level(state, data) {
     level(state, data) {
       state.level = data || { first: '', second: '' }
       state.level = data || { first: '', second: '' }
     },
     },
@@ -39,6 +43,9 @@ export default {
     setDeptList({ commit }, data) {
     setDeptList({ commit }, data) {
       commit('deptList', data)
       commit('deptList', data)
     },
     },
+    getDeptListAll({ commit }, data) {
+      commit('deptListAll', data)
+    },
     setSetting({ commit }, data) {
     setSetting({ commit }, data) {
       commit('setting', data)
       commit('setting', data)
     },
     },

+ 19 - 4
src/store/modules/ibps/modules/user.js

@@ -123,10 +123,10 @@ export default {
                     second: hasFirst
                     second: hasFirst
                       ? ''
                       ? ''
                       : [
                       : [
-                          ...new Set(
-                            info.positions.map((obj) => obj.path.split('.')[1])
-                          )
-                        ].join(',')
+                        ...new Set(
+                          info.positions.map((obj) => obj.path.split('.')[1])
+                        )
+                      ].join(',')
                   }
                   }
                   await dispatch('ibps/param/setLevel', level, {
                   await dispatch('ibps/param/setLevel', level, {
                     root: true
                     root: true
@@ -297,6 +297,21 @@ export default {
           console.log(error)
           console.log(error)
           alert('获取所有部门信息失败!')
           alert('获取所有部门信息失败!')
         })
         })
+      common
+        .request('query', {
+          key: 'getDeptListAll',
+          params: [first]
+        })
+        .then((res) => {
+          const { data = [] } = res.variables || {}
+          dispatch('ibps/param/getDeptListAll', data, {
+            root: true
+          })
+        })
+        .catch((error) => {
+          console.log(error)
+          alert('获取所有部门信息失败!')
+        })
     },
     },
     /**
     /**
      * 获取切换用户账号
      * 获取切换用户账号

+ 19 - 14
src/views/system/jbdScan/goods/neishenzhuangtai.vue

@@ -19,7 +19,10 @@
                 <div class="line">
                 <div class="line">
                   <span
                   <span
                     class="plan"
                     class="plan"
-                    :style="`width:${activeIndex * (100 / (stepList.length - 1)) - 100 / (stepList.length - 1) / 2}%`"
+                    :style="`width:${
+                      activeIndex * (100 / (stepList.length - 1)) -
+                      100 / (stepList.length - 1) / 2
+                    }%`"
                   />
                   />
                 </div>
                 </div>
                 <!-- 每步部分底部文字描述 -->
                 <!-- 每步部分底部文字描述 -->
@@ -31,8 +34,8 @@
                     i.stepIndex < activeIndex || activeIndex == 100
                     i.stepIndex < activeIndex || activeIndex == 100
                       ? 'step-active'
                       ? 'step-active'
                       : i.stepIndex == activeIndex
                       : i.stepIndex == activeIndex
-                        ? 'current-active'
-                        : ''
+                      ? 'current-active'
+                      : ''
                   "
                   "
                 >
                 >
                   <span class="step-num">
                   <span class="step-num">
@@ -326,6 +329,7 @@ export default {
       return matchedItems.map((item) => item.NAME_).join(',')
       return matchedItems.map((item) => item.NAME_).join(',')
     },
     },
     partFilter: function (value, arr) {
     partFilter: function (value, arr) {
+      console.log(value, arr)
       if (!value.includes('1')) return value
       if (!value.includes('1')) return value
 
 
       const ids = value.split(',')
       const ids = value.split(',')
@@ -347,7 +351,8 @@ export default {
     }
     }
   },
   },
   data() {
   data() {
-    const { deptList } = this.$store.getters || {}
+    const { deptListAll } = this.$store.getters || {}
+    console.log('deptList====>', this.$store.getters)
     return {
     return {
       value: '',
       value: '',
       id: '',
       id: '',
@@ -410,7 +415,7 @@ export default {
       cnasPieData: [], // cnas饼图
       cnasPieData: [], // cnas饼图
       cmaPieData: [], // cma饼图
       cmaPieData: [], // cma饼图
       employeeList: [],
       employeeList: [],
-      partList: deptList,
+      partList: deptListAll,
       loading: true,
       loading: true,
       settime: '',
       settime: '',
       setCheckTime: '',
       setCheckTime: '',
@@ -651,10 +656,10 @@ export default {
       let fh = this.$refs.tableecharts1.clientHeight
       let fh = this.$refs.tableecharts1.clientHeight
       let width, height
       let width, height
       if (window.innerWidth > 1600) {
       if (window.innerWidth > 1600) {
-        width = (fw/2).toFixed(2)
+        width = (fw / 2).toFixed(2)
         height = fh
         height = fh
       } else {
       } else {
-        width = (fw/2).toFixed(2)
+        width = (fw / 2).toFixed(2)
         height = fh
         height = fh
       }
       }
       const setEchartWH = {
       const setEchartWH = {
@@ -758,7 +763,7 @@ export default {
       let fh = this.$refs.tableecharts2.clientHeight
       let fh = this.$refs.tableecharts2.clientHeight
       const setEchartWH = {
       const setEchartWH = {
         // 设置控制图表大小变量
         // 设置控制图表大小变量
-        width: (fw/2).toFixed(2),
+        width: (fw / 2).toFixed(2),
         height: fh
         height: fh
       }
       }
 
 
@@ -824,13 +829,13 @@ export default {
       if (window.innerWidth > 1600) {
       if (window.innerWidth > 1600) {
         center = ['60%', '50%']
         center = ['60%', '50%']
         radius = '55%'
         radius = '55%'
-        width = (fw/2).toFixed(2)
-        height =fh
+        width = (fw / 2).toFixed(2)
+        height = fh
         padding = [16, 0, 0, 0]
         padding = [16, 0, 0, 0]
       } else {
       } else {
         center = ['53%', '50%']
         center = ['53%', '50%']
         radius = '42%'
         radius = '42%'
-        width = (fw/2).toFixed(2)
+        width = (fw / 2).toFixed(2)
         height = fh
         height = fh
         padding = [16, 0, 0, 0]
         padding = [16, 0, 0, 0]
       }
       }
@@ -890,7 +895,7 @@ export default {
       let fh = this.$refs.tableecharts2.clientHeight
       let fh = this.$refs.tableecharts2.clientHeight
       const setEchartWH = {
       const setEchartWH = {
         // 设置控制图表大小变量
         // 设置控制图表大小变量
-        width: (fw/2).toFixed(2),
+        width: (fw / 2).toFixed(2),
         height: fh
         height: fh
       }
       }
 
 
@@ -961,9 +966,9 @@ export default {
       let secondArr = []
       let secondArr = []
       arr.forEach((it) => {
       arr.forEach((it) => {
         if (it.tiao_kuan_bian_ha.includes('CL02-A001')) {
         if (it.tiao_kuan_bian_ha.includes('CL02-A001')) {
-          if(it.tiao_kuan_bian_ha.split('\n')[1]){
+          if (it.tiao_kuan_bian_ha.split('\n')[1]) {
             it.tiao_kuan_bian_ha = it.tiao_kuan_bian_ha.split('\n')[1]
             it.tiao_kuan_bian_ha = it.tiao_kuan_bian_ha.split('\n')[1]
-          }else if(it.tiao_kuan_bian_ha.split('CL02-A001')[1]){
+          } else if (it.tiao_kuan_bian_ha.split('CL02-A001')[1]) {
             it.tiao_kuan_bian_ha = it.tiao_kuan_bian_ha.split('CL02-A001')[1]
             it.tiao_kuan_bian_ha = it.tiao_kuan_bian_ha.split('CL02-A001')[1]
           }
           }
           console.log('it.tiao_kuan_bian_ha', it.tiao_kuan_bian_ha)
           console.log('it.tiao_kuan_bian_ha', it.tiao_kuan_bian_ha)