Procházet zdrojové kódy

事务代理(角色)

linweizeng před 2 roky
rodič
revize
b870777915

+ 200 - 0
src/views/platform/bpmn/bpmAgent/agentByRole/agent.js

@@ -0,0 +1,200 @@
+import { create, update, load, upEmployee } from '@/api/platform/org/employee'
+export default {
+    data () {
+        const { first = '', second = '' } = this.$store.getters.level
+        const level = second || first
+        return {
+            level,
+            checkList1: [],
+            weiTuoroleList: [],
+            checkList2: [],
+            weiTuoroleListYuan: [],
+            daiLiroleListYuan: [],
+            daiLiroleList: [],
+            dailiRenXinxin: null,
+            bpmAgent: {
+                biao_ti_: '',
+                wei_tuo_ren_: this.$store.getters.userId,
+                dai_li_ren_: '',
+                wei_tuo_ren_xing_: this.$store.getters.name,
+                dai_li_ren_xing_m: '',
+                shi_fou_qi_yong_: 'enabled',
+                sheng_xiao_shi_ji: '',
+                jie_shu_shi_jian_: '',
+                wei_tuo_jiao_se_i: '',
+                wei_tuo_jiao_se_m: '',
+                wei_tuo_yuan_shi_: '',
+                dai_li_yuan_shi_s: '',
+                bei_zhu_: '',
+                di_dian_: level
+            }
+        }
+    },
+    methods: {
+        // 提交保存数据
+        saveData (formId) {
+            const list1 = []
+            const listId = []
+            const list3 = []
+            const listName = []
+            this.checkList1.forEach(item => {
+                const itemData = this.weiTuoroleList.find(it => it.id === item)
+                if (itemData) {
+                    list1.push(itemData)
+                    listId.push(itemData.id)
+                    listName.push(itemData.name)
+                }
+            })
+            list1.forEach(item => {
+                const itemData = this.daiLiroleList.find(it => it.id === item.id)
+                if (!itemData) {
+                    // listId.push(item.id)
+                    list3.push(item)
+                    // listName.push(item.name)
+                }
+            })
+            this.weiTuoroleListYuan = list3
+
+            this.bpmAgent.wei_tuo_jiao_se_i = listId.join(',')
+            this.bpmAgent.wei_tuo_jiao_se_m = listName.join(',')
+            this.bpmAgent.dai_li_yuan_shi_s = JSON.stringify(this.daiLiroleListYuan)
+            this.bpmAgent.wei_tuo_yuan_shi_ = JSON.stringify(this.weiTuoroleListYuan)
+            if (!formId) {
+                this.addShiWuDaiLi()
+            } else {
+                this.updateShiWuDaiLi(formId)
+            }
+        },
+        updateShiWuDaiLi (id) {
+            const list = []
+            const obj = {
+                where: {
+                    id_: id
+                },
+                param: this.bpmAgent
+            }
+            delete this.bpmAgent.create_by_
+            delete this.bpmAgent.create_time_
+            list.push(obj)
+
+            const params1 = {
+                tableName: 't_swdl',
+                updList: list
+            }
+            this.$common.request('update', params1
+            ).then(response => {
+                this.getUpdate()
+                this.closeDialog()
+            })
+        },
+        getUpdate () {
+            const attrValueVoList = []
+            const partyAttrs = this.dailiRenXinxin.variables.partyAttrs
+            partyAttrs.forEach(item => {
+                if (item.values.length > 0) {
+                    const obj = {
+                        attrId: item.values[0].attrID
+                    }
+                    attrValueVoList.push(obj)
+                }
+            })
+
+            // 部门数据组装
+            const partyPositionsList = []
+            const partyPositions = this.dailiRenXinxin.variables.partyPositions
+            partyPositions.forEach(item => {
+                const obj = {
+                    id: item.id,
+                    name: item.name,
+                    isPrincipal: item.isPrincipal === 'Y',
+                    isMainPost: item.isMainPost === 'Y'
+                }
+                partyPositionsList.push(obj)
+            })
+
+            const roleVoList = []
+            this.daiLiroleListYuan.forEach(item => {
+                const obj = {
+                    id: item.id,
+                    name: item.name,
+                    subSystemName: item.subSystemName,
+                    source: item.source,
+                    canDelete: item.source === '自有'
+                }
+                roleVoList.push(obj)
+            })
+            if (this.bpmAgent.shi_fou_qi_yong_ === 'enabled') {
+                this.weiTuoroleListYuan.forEach(item => {
+                    const obj = {
+                        id: item.id,
+                        name: item.name,
+                        subSystemName: item.subSystemName,
+                        source: item.source,
+                        canDelete: item.source === '自有'
+                    }
+                    roleVoList.push(obj)
+                })
+            }
+
+            if (roleVoList.length > 0) {
+                const list = []
+                roleVoList.forEach(item => {
+                    list.push(item.id)
+                })
+                this.dailiRenXinxin.data.job = list.join(',')
+            }
+            const params = {
+                attrValueVoList: attrValueVoList,
+                partyEmployeePo: this.dailiRenXinxin.data,
+                positionVoList: partyPositionsList,
+                roleVoList: roleVoList,
+                user: this.dailiRenXinxin.data,
+                userGroupPoList: []
+            }
+
+            update(params).then(response => {
+            }).catch(() => {
+                this.dialogLoading = false
+            })
+        },
+        getWeiTuo (id, type = 1, formId = '') {
+            if (!id) return
+            return new Promise((resolve, reject) => {
+                load({ employeeId: id })
+                    .then((response) => {
+                        const data = response
+                        const partyRole = response.variables.partyRoles
+                        if (type === 1) {
+                            this.weiTuoroleListYuan = JSON.parse(JSON.stringify(partyRole))
+                            this.weiTuoroleList = partyRole || []
+                        }
+                        if (type === 2) {
+                            this.dailiRenXinxin = data
+                            // 新增选择代理人数据
+                            if (!formId) {
+                                this.daiLiroleListYuan = JSON.parse(JSON.stringify(partyRole))
+                            } else {
+                            // 修改选择代理人选择
+                                const parRoleList = []
+                                // 复原代理人 原来的角色
+                                partyRole.forEach(item => {
+                                    const dataIndex = this.checkList1.findIndex(it => it === item.id)
+                                    if (dataIndex < 0) {
+                                        parRoleList.push(item)
+                                    }
+                                })
+                                this.daiLiroleListYuan = JSON.parse(JSON.stringify(parRoleList))
+                            }
+                            partyRole.forEach(item => {
+                                item.disabled = true
+                            })
+                            this.daiLiroleList = partyRole || []
+                        }
+                        resolve(data)
+                    })
+                    .catch(() => {
+                    })
+            })
+        }
+    }
+}

+ 29 - 224
src/views/platform/bpmn/bpmAgent/agentByRole/edit.vue

@@ -83,14 +83,12 @@
                 </el-col>
             </el-row>
 
-
-
             <el-row>
-                <el-form-item label="权限分配:">
+                <el-form-item label="" label-position="top">
                     <el-col :span="12">
                         <div class="transferPanel">
                             <div class="header">
-                                <span>委托人</span>
+                                <span>委托人角色代理</span>
                             </div>
                             <div class="transferBody">
                                 <el-checkbox-group v-model="checkList1" class="radioBox">
@@ -100,9 +98,9 @@
                         </div>
                     </el-col>
                     <el-col :span="12">
-                        <div class="transferPanel">
+                        <div class="transferPanel" style="margin-left: 50px">
                             <div class="header">
-                                <span>代理人</span>
+                                <span>代理人角色代理</span>
                             </div>
                             <div class="transferBody">
                                 <el-checkbox-group v-model="checkList2" class="radioBox">
@@ -113,6 +111,20 @@
                     </el-col>
                 </el-form-item>
             </el-row>
+            <el-row>
+                <el-col :span="24">
+                    <el-form-item label="备注:" prop="bei_zhu_">
+                        <el-input
+                            v-if="!readonly"
+                            v-model="bpmAgent.bei_zhu_"
+                            type="textarea"
+                            :rows="2"
+                            placeholder="请输入备注"
+                        />
+                        <span v-else>{{ bpmAgent.bei_zhu_ }}</span>
+                    </el-form-item>
+                </el-col>
+            </el-row>
         </el-form>
         <div slot="footer" class="el-dialog--center">
             <ibps-toolbar :actions="toolbars" @action-event="handleActionEvent" />
@@ -130,6 +142,7 @@ import ibpsUserSelector from '@/business/platform/org/selector'
 import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
 import Condition from '../condition'
 import { create, update, load, upEmployee } from '@/api/platform/org/employee'
+import agent from './agent'
 
 export default {
     components: {
@@ -138,6 +151,7 @@ export default {
         Condition,
         ibpsUserSelector
     },
+    mixins: [agent],
     props: {
         visible: {
             type: Boolean,
@@ -151,10 +165,7 @@ export default {
         title: String
     },
     data () {
-        const { first = '', second = '' } = this.$store.getters.level
-        const level = second || first
         return {
-            level,
             formName: 'agentForm',
             formLabelWidth: '100px',
             dialogVisible: this.visible,
@@ -166,22 +177,6 @@ export default {
             defaultForm: {},
             multipleSelection: [],
             conditionSelection: [],
-            bpmAgent: {
-                biao_ti_: '',
-                wei_tuo_ren_: this.$store.getters.userId,
-                dai_li_ren_: '',
-                wei_tuo_ren_xing_: this.$store.getters.name,
-                dai_li_ren_xing_m: '',
-                shi_fou_qi_yong_: 'enabled',
-                sheng_xiao_shi_ji: '',
-                jie_shu_shi_jian_: '',
-                wei_tuo_jiao_se_i: '',
-                wei_tuo_jiao_se_m: '',
-                wei_tuo_yuan_shi_: '',
-                dai_li_yuan_shi_s: '',
-                bei_zhu_: '',
-                di_dian_: level
-            },
             rules: {
                 biao_ti_: [
                     { required: true, message: this.$t('validate.required') },
@@ -226,13 +221,6 @@ export default {
 
             transferValue: [],
             transferData: [],
-            checkList1: [],
-            checkList2: [],
-            weiTuoroleListYuan: [],
-            daiLiroleListYuan: [],
-            weiTuoroleList: [],
-            daiLiroleList: [],
-            dailiRenXinxin: null,
             options: {
                 // 时间不能大于当前时间
                 disabledDate: time => {
@@ -255,13 +243,13 @@ export default {
         },
         'bpmAgent.wei_tuo_ren_': {
             handler: function (val, oldVal) {
-                this.getWeiTuo(this.bpmAgent.wei_tuo_ren_, 1)
+                this.getWeiTuo(this.bpmAgent.wei_tuo_ren_, 1, this.formId)
             },
             immediate: true
         },
         'bpmAgent.dai_li_ren_': {
             handler: function (val, oldVal) {
-                this.getWeiTuo(this.bpmAgent.dai_li_ren_, 2)
+                this.getWeiTuo(this.bpmAgent.dai_li_ren_, 2, this.formId)
             },
             immediate: true
         }
@@ -283,26 +271,6 @@ export default {
         getInit () {
             this.filter[0].partyId = this.$store.getters.userInfo.employee.positions || ''
         },
-        handleEdit () {
-            this.rowLoading = true
-            setTimeout(() => {
-                this.rowLoading = false
-                // TODO:
-            })
-        },
-        handleRemove () {
-            this.rowLoading = true
-            setTimeout(() => {
-                this.rowLoading = false
-                // TODO:
-            })
-        },
-        handleSelectionChange (val) {
-            this.multipleSelection = val
-        },
-        handleConditionChange (val) {
-            this.conditionSelection = val
-        },
         handleActionEvent ({ key }) {
             switch (key) {
                 case 'save':
@@ -319,44 +287,15 @@ export default {
         handleSave () {
             this.$refs[this.formName].validate((valid) => {
                 if (valid) {
-                    this.saveData()
+                    if (this.bpmAgent.wei_tuo_ren_ === this.bpmAgent.dai_li_ren_) {
+                        return this.$message.warning('委托人与代理人同一个账号,请重新选择委托人或代理人')
+                    }
+                    this.saveData(this.formId)
                 } else {
                     ActionUtils.saveErrorMessage()
                 }
             })
         },
-        // 提交保存数据
-        saveData () {
-            const list1 = []
-            const listId = []
-            const list3 = []
-            const listName = []
-            this.checkList1.forEach(item => {
-                const itemData = this.weiTuoroleList.find(it => it.id === item)
-                if (itemData) {
-                    list1.push(itemData)
-                }
-            })
-            list1.forEach(item => {
-                const itemData = this.daiLiroleList.find(it => it.id === item.id)
-                if (!itemData) {
-                    listId.push(item.id)
-                    list3.push(item)
-                    listName.push(item.name)
-                }
-            })
-            this.weiTuoroleListYuan = list3
-
-            this.bpmAgent.wei_tuo_jiao_se_i = listId.join(',')
-            this.bpmAgent.wei_tuo_jiao_se_m = listName.join(',')
-            this.bpmAgent.dai_li_yuan_shi_s = JSON.stringify(this.daiLiroleListYuan)
-            this.bpmAgent.wei_tuo_yuan_shi_ = JSON.stringify(this.weiTuoroleListYuan)
-            if (!this.formId) {
-                this.addShiWuDaiLi()
-            } else {
-                this.updateShiWuDaiLi()
-            }
-        },
         addShiWuDaiLi () {
             const list = []
             list.push(this.bpmAgent)
@@ -371,101 +310,6 @@ export default {
                 this.closeDialog()
             })
         },
-        updateShiWuDaiLi () {
-            const list = []
-            const obj = {
-                where: {
-                    id_: this.formId
-                },
-                param: this.bpmAgent
-            }
-            delete this.bpmAgent.create_by_
-            delete this.bpmAgent.create_time_
-            list.push(obj)
-
-            const params1 = {
-                tableName: 't_swdl',
-                updList: list
-            }
-            this.$common.request('update', params1
-            ).then(response => {
-                this.getUpdate()
-                this.closeDialog()
-            })
-        },
-        getUpdate () {
-            const attrValueVoList = []
-            const partyAttrs = this.dailiRenXinxin.variables.partyAttrs
-            partyAttrs.forEach(item => {
-                if (item.values.length > 0) {
-                    const obj = {
-                        attrId: item.values[0].attrID
-                    }
-                    attrValueVoList.push(obj)
-                }
-            })
-
-            // 部门数据组装
-            const partyPositionsList = []
-            const partyPositions = this.dailiRenXinxin.variables.partyPositions
-            partyPositions.forEach(item => {
-                const obj = {
-                    id: item.id,
-                    name: item.name,
-                    isPrincipal: item.isPrincipal === 'Y',
-                    isMainPost: item.isMainPost === 'Y'
-                }
-                partyPositionsList.push(obj)
-            })
-
-            const roleVoList = []
-            this.daiLiroleListYuan.forEach(item => {
-                const obj = {
-                    id: item.id,
-                    name: item.name,
-                    subSystemName: item.subSystemName,
-                    source: item.source,
-                    canDelete: item.source === '自有'
-                }
-                roleVoList.push(obj)
-            })
-            if (this.bpmAgent.shi_fou_qi_yong_ === 'enabled') {
-                this.weiTuoroleListYuan.forEach(item => {
-                    const obj = {
-                        id: item.id,
-                        name: item.name,
-                        subSystemName: item.subSystemName,
-                        source: item.source,
-                        canDelete: item.source === '自有'
-                    }
-                    roleVoList.push(obj)
-                })
-            }
-
-            if (roleVoList.length > 0) {
-                const list = []
-                roleVoList.forEach(item => {
-                    list.push(item.id)
-                })
-                this.dailiRenXinxin.data.job = list.join(',')
-            }
-            console.log(this.dailiRenXinxin)
-            const params = {
-                attrValueVoList: attrValueVoList,
-                partyEmployeePo: this.dailiRenXinxin.data,
-                positionVoList: partyPositionsList,
-                roleVoList: roleVoList,
-                user: this.dailiRenXinxin.data,
-                userGroupPoList: []
-            }
-
-            console.log(params)
-            update(params).then(response => {
-
-            }).catch(() => {
-                this.dialogLoading = false
-            })
-        },
         // 关闭当前窗口
         closeDialog () {
             this.$emit('close', false)
@@ -484,11 +328,9 @@ export default {
          * 获取表单数据
          */
         getFormData () {
-            console.log(this.id)
             if (this.$utils.isEmpty(this.formId)) {
                 // 重置表单
                 this.bpmAgent = JSON.parse(JSON.stringify(this.defaultForm))
-                this.formValidate()
                 return
             }
             this.dialogLoading = true
@@ -501,51 +343,12 @@ export default {
                 this.dialogLoading = false
             })
         },
-        addDef () {
-            alert('打开流程选择器')
-        },
         callbackDelegatorrInfo (value, data, type) {
             this.bpmAgent.wei_tuo_ren_xing_ = data.name
         },
         callbackAgenterInfo (value, data, type) {
             this.bpmAgent.dai_li_ren_xing_m = data.name
         },
-        getWeiTuo (id, type = 1) {
-            if (!id) return
-            load({ employeeId: id })
-                .then((response) => {
-                    const data = response
-                    const partyRole = response.variables.partyRoles
-                    if (type === 1) {
-                        this.weiTuoroleListYuan = JSON.parse(JSON.stringify(partyRole))
-                        this.weiTuoroleList = partyRole || []
-                    }
-                    if (type === 2) {
-                        this.dailiRenXinxin = data
-                        // 新增选择代理人数据
-                        if (!this.formId) {
-                            this.daiLiroleListYuan = JSON.parse(JSON.stringify(partyRole))
-                        } else {
-                            // 修改选择代理人选择
-                            const parRoleList = []
-                            // 复原代理人 原来的角色
-                            partyRole.forEach(item => {
-                                const dataIndex = this.checkList1.findIndex(it => it === item.id)
-                                if (dataIndex < 0) {
-                                    parRoleList.push(item)
-                                }
-                            })
-                            this.daiLiroleListYuan = JSON.parse(JSON.stringify(parRoleList))
-                        }
-                        partyRole.forEach(item => {
-                            item.disabled = true
-                        })
-                        this.daiLiroleList = partyRole || []
-                    }
-                })
-                .catch(() => {
-                })
-        },
 
         getImage () {
             const sql = `select * from t_dlpz order by create_time_ desc LIMIT 1`
@@ -636,7 +439,9 @@ export default {
     }
 
     .transferBody {
-        height: 246px;
+        min-height: 246px;
+        max-height: 300px;
+        overflow-y:scroll;
     }
 }
 .radioBox {

+ 20 - 28
src/views/platform/bpmn/bpmAgent/agentByRole/list.vue

@@ -18,7 +18,6 @@
             @pagination-change="handlePaginationChange"
         >
             <template slot="delegatorId">
-                <!-- <ibps-employee-selector :value="searchDelegatorId" style="width: 200px" @input="getDelegatorId" /> -->
                 <ibps-user-selector
                     v-model="searchDelegatorId"
                     :type="type"
@@ -45,6 +44,8 @@ import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
 import { statusOptions, agentTypeOptions } from '../constants'
 import Edit from './edit'
+import { create, update, load, upEmployee } from '@/api/platform/org/employee'
+import agent from './agent'
 
 export default {
     components: {
@@ -52,7 +53,7 @@ export default {
         Edit,
         ibpsUserSelector
     },
-    mixins: [FixHeight],
+    mixins: [FixHeight, agent],
     data () {
         const { first = '', second = '' } = this.$store.getters.level
         const level = second || first
@@ -108,7 +109,9 @@ export default {
                     { prop: 'biao_ti_', label: '标题', width: 250 },
                     { prop: 'wei_tuo_ren_xing_', label: '委托人', width: 120 },
                     { prop: 'dai_li_ren_xing_m', label: '代理人', width: 120 },
-                    { prop: 'shi_fou_qi_yong_', label: '是否启用', tags: statusOptions }
+                    { prop: 'shi_fou_qi_yong_', label: '是否启用', tags: statusOptions, width: 120 },
+                    { prop: 'bei_zhu_', label: '备注' },
+                    { prop: 'name_', label: '创建人', width: 120 }
                     // { prop: 'sheng_xiao_shi_ji', label: '生效时间' },
                     // { prop: 'jie_shu_shi_jian_', label: '失效时间' }
                 ],
@@ -164,21 +167,17 @@ export default {
         getInit () {
             this.filter[0].partyId = this.$store.getters.userInfo.employee.positions || ''
         },
-        getDelegatorId (value) {
-            this.searchDelegatorId = value
-        },
         callbackAgenterInfo (value, data, type) {
             this.searchDelegatorId = value
         },
         // 加载数据
         loadData () {
             this.loading = true
-            console.log(this.pagination)
             const start = (this.pagination.page - 1) * this.pagination.limit
             const end = this.pagination.page * this.pagination.limit
             const searcFormData = this.getSearcFormData()
-            const sql1 = `select * from t_swdl where di_dian_ = '${this.level}' ${searcFormData} order by create_time_ desc limit ${start},${end}`
-            const sql2 = `select count(id_) as count from t_swdl where di_dian_ = '${this.level}' ${searcFormData}`
+            const sql1 = `select a.*,b.name_ from t_swdl a left join ibps_party_employee b on a.create_by_ = b.ID_  where a.di_dian_ = '${this.level}' ${searcFormData} order by a.create_time_ desc limit ${start},${end}`
+            const sql2 = `select count(a.id_) as count from t_swdl a where a.di_dian_ = '${this.level}' ${searcFormData}`
             Promise.all([this.$common.request('sql', sql1), this.$common.request('sql', sql2)]).then((res) => {
                 const list0 = res[0].variables.data
                 list0.forEach(item => {
@@ -210,7 +209,7 @@ export default {
             if (params) {
                 Object.keys(params).forEach(item => {
                     if (params[item]) {
-                        keyParams = `and ${item} like '%${params[item]}%'`
+                        keyParams = `and a.${item} like '%${params[item]}%'`
                     }
                 })
             }
@@ -241,7 +240,6 @@ export default {
          * 处理按钮事件
          */
         handleAction (command, position, selection, data) {
-            console.log(selection)
             switch (command) {
                 case 'search': // 查询
                     ActionUtils.setFirstPagination(this.pagination)
@@ -254,7 +252,6 @@ export default {
                 case 'edit': // 编辑
                     ActionUtils.selectedRecord(selection)
                         .then((id) => {
-                            console.log(selection, id)
                             this.handleEdit(id)
                             this.title = '编辑流程代理'
                         })
@@ -276,10 +273,10 @@ export default {
                         .catch(() => {})
                     break
                 case 'enabled': // 启用
-                    this.handleSetEnable(data.id, 'enabled')
+                    this.handleSetEnable(data, 'enabled')
                     break
                 case 'disabled': // 禁用
-                    this.handleSetEnable(data.id, 'disabled')
+                    this.handleSetEnable(data, 'disabled')
                     break
                 default:
                     break
@@ -297,12 +294,6 @@ export default {
          * 处理删除
          */
         handleRemove (ids) {
-            // remove({ ids: ids })
-            //     .then((response) => {
-            //         ActionUtils.removeSuccessMessage()
-            //         this.search()
-            //     })
-            //     .catch(() => {})
             const params = {
                 tableName: 't_swdl',
                 paramWhere: {
@@ -314,14 +305,15 @@ export default {
                 this.search()
             })
         },
-        handleSetEnable (id, status) {
-            const params = { id: id, isEnabled: status }
-            setEnable(params)
-                .then((response) => {
-                    ActionUtils.removeSuccessMessage(response.message)
-                    this.search()
-                })
-                .catch(() => {})
+        handleSetEnable (data, status = 'disabled') {
+            this.bpmAgent = JSON.parse(JSON.stringify(data))
+            this.bpmAgent.shi_fou_qi_yong_ = status === 'enabled' ? 'enabled' : 'disabled'
+            this.checkList1 = this.bpmAgent.wei_tuo_jiao_se_i.split(',')
+            delete this.bpmAgent.id
+            delete this.bpmAgent.name_
+            Promise.all([this.getWeiTuo(data.wei_tuo_ren_, 1, data.id_), this.getWeiTuo(data.dai_li_ren_, 2, data.id_)]).then(res => {
+                this.saveData(data.id_)
+            })
         },
         closeDialog (val) {
             this.dialogFormVisible = val

+ 1 - 0
src/views/platform/bpmn/bpmAgent/list.vue

@@ -181,6 +181,7 @@ export default {
             this.loading = true
             queryPageList(this.getSearcFormData())
                 .then((response) => {
+                    console.log(response.data)
                     ActionUtils.handleListData(this, response.data)
                     this.loading = false
                 })