Sfoglia il codice sorgente

update: 主部门功能调整

cfort 2 anni fa
parent
commit
7f28baae1a

+ 57 - 108
src/layout/header-aside/components/header-user/index.vue

@@ -2,6 +2,8 @@
     <div class="ibps-layout-header-user">
         <el-dropdown
             size="small"
+            trigger="click"
+            :hide-on-click="false"
             @command="command => handleControlItemClick(command)"
             @visible-change="visible =>dropdownVisible=visible"
         >
@@ -63,18 +65,31 @@
                     </div>
                     <!-- <div class="item">{{ locationName }}</div> -->
                     <el-tag class="item512" type="success">{{ locationName }}</el-tag>
-                    <template v-if="deptName.length">
+                    <template v-if="positions.length">
                         <div class="title512">
                             <i class="el-icon-office-building" />部门
-                            <el-button type="text" icon="el-icon-edit" size="mini" circle @click="bpmnVisible = true" />
+                            <el-tooltip
+                                effect="light"
+                                content="双击下方部门可切换主部门"
+                                placement="top"
+                                :enterable="true"
+                            >
+                                <ibps-icon name="help" style="color: #dd5b44;" />
+                            </el-tooltip>
+                            <!-- <el-button type="text" icon="el-icon-edit" size="mini" circle @click="changeMainposiVisible = true" /> -->
+                        </div>
+                        <div
+                            v-for="item in positions"
+                            :key="item.id"
+                            class="div512"
+                            @dblclick="handleMainChange(item)"
+                        >
+                            <el-tag
+                                class="item512"
+                                :type="item.isMainPost === 'Y' ? 'primary' : 'info'"
+                                size="small"
+                            >{{ item.name }}</el-tag>
                         </div>
-                        <el-tag
-                            v-for="(item, index) in value"
-                            :key="Date.now() + Math.random() + index"
-                            class="item512"
-                            type="info"
-                            size="small"
-                        >{{ item }}</el-tag>
                     </template>
                     <template v-if="roleName.length">
                         <div class="title512">
@@ -106,28 +121,6 @@
             readonly
             @close="visible => userInfoVisible = visible"
         />
-        <el-dialog
-            title="更换部门"
-            :visible.sync="bpmnVisible"
-            width="50%"
-        >
-            <el-transfer
-                ref="xuanzexiang"
-                v-model="value"
-                filterable
-                :filter-method="filterMethod"
-                filter-placeholder="请输入关键字"
-                :titles="['所在部门', '主部门']"
-                :data="data1"
-                @left-check-change="leftcheckchange"
-                @change="handleChange"
-            >
-                <span slot="footer" class="dialog-footer">
-                    <!-- <el-button @click="bpmnVisible = false">取 消</el-button> -->
-                    <el-button type="primary" @click="bpmnVisible = false">关 闭</el-button>
-                </span>
-            </el-transfer>
-        </el-dialog>
     </div>
 </template>
 
@@ -145,41 +138,17 @@ export default {
     },
     data () {
         const { first = '', second = '' } = this.$store.getters.level
-        const { userList = [], deptList = [], userId = '', pitchDept = [], mainPosition = {}} = this.$store.getters
+        const { userList = [], deptList = [], userId = '', mainPosition = {}, userInfo } = this.$store.getters || {}
         const t1 = deptList.find(i => i.positionId === first) || {}
         const t2 = deptList.find(i => i.positionId === second) || {}
         const locationName = second ? t1.positionName + t2.positionName : t1.positionName
         const t3 = userList.find(i => i.userId === userId) || {}
-        const deptName = t3.positions ? deptList.filter(i => t3.positions.includes(i.positionName)).map(i => i.positionName) : []
         const roleName = t3.roles ? t3.roles.split(',') : []
-        const userIds = userId
-        const generateData = _ => {
-            const data = []
-            const bm = deptName
-            bm.forEach((b, index) => {
-                data.push({
-                    label: b,
-                    key: b,
-                    pinyin: b
-                })
-            })
-            return data
-        }
-        const pitchData = _ => {
-            const data = []
-            const getPitch = JSON.parse(localStorage.getItem('pitchDept'))
-            const bm = getPitch && getPitch.data.length > 0 && getPitch.id === userId ? getPitch.data : mainPosition && Object.keys(mainPosition).length > 0 ? [mainPosition.name] : deptName
-            bm.forEach((b, index) => {
-                data.push(b)
-            })
-            return data
-        }
         return {
             userList,
             locationName,
-            deptName,
             roleName,
-            userIds,
+            positions: userInfo.positions || [],
             mainPosition,
             tenants: this.$store.getters.tenants,
             tenantid: this.$store.getters.tenantid,
@@ -187,13 +156,7 @@ export default {
             changePasswordVisible: false,
             userInfoVisible: false,
             formType: 'part',
-            bpmnVisible: false,
-            pitchBM: [],
-            data1: generateData(),
-            value: pitchData(),
-            filterMethod (query, item) {
-                return item.pinyin.indexOf(query) > -1
-            }
+            changeMainposiVisible: false
         }
     },
     computed: {
@@ -224,29 +187,6 @@ export default {
             return this.$store.getters.regOpen
         }
     },
-    watch: {
-        value: {
-            handler: function (val, oldVal) {
-                const getPitch = JSON.parse(localStorage.getItem('pitchDept'))
-                this.$store.dispatch('ibps/param/setpitchDept', val)
-                const a = { id: this.userIds, data: val }
-                if (getPitch && a.id !== getPitch.id) {
-                    localStorage.setItem('pitchDept', JSON.stringify(a))
-                } else if (getPitch && a.id !== getPitch.id) {
-                    localStorage.setItem('pitchDept', JSON.stringify(getPitch))
-                } else {
-                    localStorage.setItem('pitchDept', JSON.stringify(a))
-                }
-            },
-            immediate: true
-        }
-    },
-    created () {
-        const getPitch = JSON.parse(localStorage.getItem('pitchDept'))
-        if (getPitch && getPitch.data.length > 0 && getPitch.id !== this.userIds) {
-            this.$store.dispatch('ibps/param/setpitchDept', getPitch)
-        }
-    },
     methods: {
         ...mapMutations({
             pageKeepAliveClean: 'ibps/page/keepAliveClean'
@@ -315,30 +255,35 @@ export default {
             this.$store.dispatch('ibps/menu/menusSet', null, { root: true })
             this.$router.replace('/tenantSelect')
         },
-        leftcheckchange (value, direction, movedKeys) {
-            if (value.length > 1) {
-                value.splice(0, 1)
+        handleMainChange (item) {
+            if (this.mainPosition && this.mainPosition.id === item.id) {
+                return
             }
-            // let arrChild = this.$refs.xuanzexiang.$children[0].$children[2].$children
-            // console.log(arrChild)
-            // if(value.length>0){
-            //     let ind = arrChild.findIndex(i=>i.label==value[0])
-            //     console.log(ind)
-            //     arrChild.forEach((item,i)=>{
-            //         if(i!=ind){
-            //             item
-            //         }
-            //     })
-            // }
+            this.setMainPosition(this.mainPosition.id, item.id)
         },
-        handleChange (value, direction, movedKeys) {
-            this.value.value = value
-            if (this.value.value.length > 1) {
-                this.value.value.shift()
+        setMainPosition (oldId, newId) {
+            const { userId } = this.$store.getters || {}
+            const updateParams = {
+                tableName: 'ibps_party_rel',
+                updList: [
+                    {
+                        where: {
+                            biz_: 'mainPost',
+                            main_type_: 'position',
+                            sub_type_: 'employee',
+                            main_pid_: oldId,
+                            sub_pid_: userId
+                        },
+                        param: {
+                            main_pid_: newId
+                        }
+                    }
+                ]
             }
-            // 监听右侧列表元素变化情况,一旦原有状态发生变化,就将提交按钮至于可用状态
-            // 以此避免在没有配置任何职务信息及原有职务信息无变化的情况下提交表单
-            // butDisabled.value = false;
+            this.$common.request('update', updateParams).then(() => {
+                this.$message.success('切换成功!')
+                location.reload()
+            })
         }
     }
 }
@@ -380,6 +325,10 @@ export default {
             font-weight: 400;
             color: #606266;
         }
+        .div512 {
+            display: inline-block;
+            margin-right: 8px;
+        }
         .item512 {
             font-size: 12px;
             height: 20px;

+ 0 - 1
src/store/getters.js

@@ -32,7 +32,6 @@ export default {
     // =========== 子系统
     system: state => state.ibps.system.system, // 子系统
     systemid: state => state.ibps.system.system ? state.ibps.system.system.id : '', // 子系统id
-    pitchDept: state => state.ibps.param && state.ibps.param.pitchDept ? state.ibps.param.pitchDept : [], // 首页自选主部门
     permissions: state => state.ibps.menu.permissions, //  拥有的权限
     myform: state => state.ibps.myform ? state.ibps.myform : '',
     // 获取所有用户信息

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

@@ -7,7 +7,6 @@ export default {
         userList: [],
         // 所有部门信息
         deptList: [],
-        pitchDept: [],
         // 当前用户层级
         level: {
             first: '',
@@ -24,9 +23,6 @@ export default {
         deptList (state, data) {
             state.deptList = data.length ? data : []
         },
-        pitchDept (state, data) {
-            state.pitchDept = data.length ? data : []
-        },
         level (state, data) {
             state.level = data || { first: '', second: '' }
         }
@@ -38,9 +34,6 @@ export default {
         setDeptList ({ commit }, data) {
             commit('deptList', data)
         },
-        setpitchDept ({ commit }, data) {
-            commit('pitchDept', data)
-        },
         setLevel ({ commit }, data) {
             console.log(data)
             commit('level', data)

+ 6 - 6
src/views/platform/org/employee/list.vue

@@ -278,9 +278,9 @@ export default {
                                 if (this.$store.getters.userId === rowData.id) {
                                     return true
                                 }
-                                if (!this.$store.getters.isSuper) {
-                                    return true
-                                }
+                                // if (!this.$store.getters.isSuper) {
+                                //     return true
+                                // }
                             }
                         },
                         {
@@ -296,9 +296,9 @@ export default {
                                 if (this.$store.getters.userId === rowData.id) {
                                     return true
                                 }
-                                if (!this.$store.getters.isSuper) {
-                                    return true
-                                }
+                                // if (!this.$store.getters.isSuper) {
+                                //     return true
+                                // }
                             }
                         },
                         {