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

fix:调整在角色设置和用户管理里设置角色时候更新ibps_party_employee的JOB_信息

liujiayin 2 лет назад
Родитель
Сommit
10e449f55a

+ 1 - 0
src/business/platform/data/components/search-form/index.vue

@@ -372,6 +372,7 @@ export default {
                     parameters: []
                 }
             }
+            console.log('375 params', params)
             Object.keys(params).forEach(v => {
                 if (v && v.indexOf(datePrefix) === -1) {
                     const val = format[v] ? format[v](params[v], v) : params[v]

+ 2 - 0
src/business/platform/data/templaterender/templates/list.vue

@@ -1504,6 +1504,7 @@ export default {
             // 控件类型
             const fieldType = field['field_type']
             const fieldOptions = field['field_options']
+            console.log('1507 fieldType', fieldType)
             if (fieldType === 'hidden') {
                 searchColumn = Object.assign(searchColumn, {
                     prop: `Q^${field.name}^${querySuffix}`,
@@ -1552,6 +1553,7 @@ export default {
                     fieldType: dateDealFmt.dateType + 'range',
                     field_options: fieldOptions
                 })
+                console.log('1556 searchColumn', searchColumn)
             } else if (fieldType === 'dictionary') {
                 const prop = `Q^${field.name}^SL`
                 searchColumn = Object.assign(searchColumn, {

+ 19 - 0
src/views/platform/org/employee/edit/index.vue

@@ -295,7 +295,26 @@ export default {
                     list.push(item.id)
                 })
                 vo.user.job = list.join(',')
+            } else {
+                vo.user.job = ''
             }
+            // 更新该表的job_字段
+            const updateParams = {
+                tableName: 'ibps_party_employee',
+                updList: [
+                    {
+                        where: {
+                            id_: vo.user.id
+                        },
+                        param: {
+                            job_: vo.user.job
+                        }
+                    }
+                ]
+            }
+            this.$common.request('update', updateParams).then(() => {
+                console.log('更新数据成功')
+            })
 
             if (this.formId) {
                 update(vo).then(response => {

+ 53 - 1
src/views/platform/org/role/user-list.vue

@@ -211,14 +211,16 @@ export default {
         },
         handleConfirm (data) {
             this.selectorVisible = false
+            const userIdArr = data.map((d) => { return d.id })
             addRoleUser({
                 roleId: this.id,
-                userIds: data.map((d) => { return d.id }).join(',')
+                userIds: userIdArr.join(',')
             }).then(response => {
                 this.selectorVisible = false
                 ActionUtils.success('加入人员成功!')
                 this.search()
             })
+            this.handleUpemployee('add', userIdArr.join(','))
         },
         /**
          * 处理删除
@@ -241,6 +243,56 @@ export default {
                 ActionUtils.removeSuccessMessage()
                 this.search()
             }).catch(() => {})
+            this.handleUpemployee('remove', ids)
+        },
+        /**
+         * 根据所选择的人员信息,修改对应人员的job_信息
+         */
+        handleUpemployee (type, ids) {
+            const tableName = 'ibps_party_employee'
+            // 更新ibps_party_employee里job_信息
+            const sql = `select *from ${tableName} where find_in_set(id_,'${ids}')`
+            this.$common.request('sql', sql).then((res) => {
+                const resDatas = res.variables.data
+                const updListDatas = []
+                for (const i of resDatas) {
+                    const updListData = {
+                        where: {
+                            id_: i.ID_
+                        },
+                        param: {
+                            JOB_: this.fixAddJob(type, i.JOB_, this.id)
+                        }
+                    }
+
+                    updListDatas.push(updListData)
+                }
+                const updateParams = {
+                    tableName,
+                    updList: updListDatas
+                }
+                this.$common.request('update', updateParams).then(() => {
+                    console.log('更新数据成功')
+                })
+            })
+        },
+        /**
+         * 在oldIds里剔除fixId,或者增加fixId
+         */
+        fixAddJob (type, oldIds, fixId) {
+            const oldIdsArr = oldIds.split(',')
+            if (type === 'remove') {
+                oldIdsArr.splice(oldIdsArr.indexOf(fixId), 1)
+                oldIds = oldIdsArr.join(',')
+            } else {
+                if (oldIds && oldIds.indexOf(fixId) < 0) {
+                    oldIdsArr.push(fixId)
+                    oldIds = oldIdsArr.join(',')
+                } else if (!oldIds) {
+                    oldIds = fixId
+                }
+            }
+            return oldIds
         }
     }
 }