Просмотр исходного кода

部门设置中的归属组织跟扩展属性调整,限制为仅系统管理员可见

linweizeng 2 лет назад
Родитель
Сommit
b8cbbbf6ae

+ 34 - 10
src/views/platform/org/employee/edit/index.vue

@@ -12,6 +12,7 @@
         @close="closeDialog"
     >
         <el-tabs
+            v-if="dialogVisible"
             v-model="activeName"
             v-loading="dialogLoading"
             :element-loading-text="$t('common.loading')"
@@ -26,7 +27,7 @@
                     @input="data => employee = data"
                 />
             </el-tab-pane>
-            <el-tab-pane label="扩展属性" name="ext-attr">
+            <el-tab-pane v-if="isSuper" label="扩展属性" name="ext-attr">
                 <ext-attr
                     ref="attrInfo"
                     :readonly="readonly"
@@ -136,7 +137,9 @@ export default {
         span: [Number, String]
     },
     data () {
+        const isSuper = this.$store.getters.isSuper
         return {
+            isSuper,
             info: [],
             orgId: '',
             dialogLoading: false,
@@ -257,7 +260,7 @@ export default {
             })
         },
         saveData () {
-            const attrValidator = this.$refs['attrInfo'] ? this.$refs['attrInfo'].callback() : null
+            const attrValidator = this.$refs['attrInfo'] && this.isSuper ? this.$refs['attrInfo'].callback() : null
             const vo = this.formatSubmitData()
             if (!this.$utils.isEmpty(this.formId) && !this.ceroParams) {
                 delete vo.partyEmployeePo.password
@@ -267,7 +270,7 @@ export default {
                 return
             }
             this.dialogLoading = true
-            if (!attrValidator) {
+            if (!attrValidator && this.isSuper) {
                 ActionUtils.warning('请检查扩展属性是否填写正确')
                 this.dialogLoading = false
                 return
@@ -322,7 +325,9 @@ export default {
                             this.closeDialog()
                         } else {
                             this.init()
-                            this.$refs.attrInfo.clearData()
+                            if (this.isSuper) {
+                                this.$refs.attrInfo.clearData()
+                            }
                         }
                     }
                     )
@@ -333,6 +338,7 @@ export default {
         },
         // 关闭当前窗口
         closeDialog () {
+            this.dialogVisible = false
             this.$emit('close', false)
         },
         // 初始化页面,出现之前的数据
@@ -356,9 +362,12 @@ export default {
             })
             if (this.$utils.isEmpty(this.formId)) {
                 // 清空拓展属性数据
-                this.$nextTick(() => {
-                    this.$refs.attrInfo.clearData()
-                })
+                if (this.isSuper) {
+                    this.$nextTick(() => {
+                        this.$refs.attrInfo.clearData()
+                    })
+                }
+
                 return
             }
             this.dialogLoading = true
@@ -371,9 +380,24 @@ export default {
                 this.employee.posItemList = response.variables.partyPositions || []
                 this.employee.roleItemList = response.variables.partyRoles || []
                 this.employee.userGroupItemList = response.variables.partyGroups || []
-                this.$nextTick(() => {
-                    this.$refs.attrInfo.loadAttrData()
-                })
+                if (this.isSuper) {
+                    this.$nextTick(() => {
+                        this.$refs.attrInfo.loadAttrData()
+                    })
+                } else {
+                    const list = []
+                    response.variables.partyAttrs.forEach(item => {
+                        if (item.values.length > 0) {
+                            const obj = {
+                                attrId: item.values[0].attrID,
+                                value: item.values[0].value
+                            }
+                            list.push(obj)
+                        }
+                    })
+                    this.employee.attrItemList = list
+                }
+
                 // 添加更新 t_wxyh 用于扫码签到
                 // if()
                 this.getWxyh(this.employee)

+ 4 - 2
src/views/platform/org/position/detail/index.vue

@@ -7,13 +7,13 @@
             <el-tab-pane label="部门明细" name="detail">
                 <detail :id="id" :readonly="readonly" />
             </el-tab-pane>
-            <el-tab-pane label="归属组织" name="positionOrg">
+            <el-tab-pane v-if="isSuper" label="归属组织" name="positionOrg">
                 <position-org :id="id" :height="height" :visible="activeName==='positionOrg'" />
             </el-tab-pane>
             <el-tab-pane label="部门人员" name="positionEmployee">
                 <position-employee :id="id" seeting-search-party-type="position" :height="height" :depth="depth" :visible="activeName==='positionEmployee'" />
             </el-tab-pane>
-            <el-tab-pane label="扩展属性" name="extraAttr">
+            <el-tab-pane v-if="isSuper" label="扩展属性" name="extraAttr">
                 <ext-attr :id="id" ref="attrForm" :height="height" :visible="activeName==='extraAttr'" party-type="position" />
             </el-tab-pane>
             <!-- <el-tab-pane label="已分配角色" name="positionRole">
@@ -51,7 +51,9 @@ export default {
         }
     },
     data () {
+        const isSuper = this.$store.getters.isSuper
         return {
+            isSuper,
             activeName: 'detail',
             height: 500
         }