From fa0076bc0341be225b115c578f9e0b6191ee4ef6 Mon Sep 17 00:00:00 2001 From: yuejiayang <146344614+YangLei105@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:58:45 +0800 Subject: [PATCH] =?UTF-8?q?2024.8.28=20=E5=AE=A1=E6=89=B9=E8=A7=84?= =?UTF-8?q?=E5=88=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth/auth.js | 8 + src/views/modules/auth/authRule.vue | 710 +++++++++++++++++++++++++++- 2 files changed, 715 insertions(+), 3 deletions(-) diff --git a/src/api/auth/auth.js b/src/api/auth/auth.js index d8d0807..63a00a2 100644 --- a/src/api/auth/auth.js +++ b/src/api/auth/auth.js @@ -25,3 +25,11 @@ export const authRuleSave = data => createAPI(`auth/authRuleSave`,'post',data) export const authRuleDelete = data => createAPI(`auth/authRuleDelete`,'post',data) export const authRuleEdit = data => createAPI(`auth/authRuleEdit`,'post',data) + +export const authRuleStepSearch = data => createAPI(`auth/authRuleStepSearch`,'post',data) + +export const authRuleStepSave = data => createAPI(`auth/authRuleStepSave`,'post',data) + +export const authRuleStepDelete = data => createAPI(`auth/authRuleStepDelete`,'post',data) + +export const authRuleStepEdit = data => createAPI(`auth/authRuleStepEdit`,'post',data) diff --git a/src/views/modules/auth/authRule.vue b/src/views/modules/auth/authRule.vue index f96a7f2..3405465 100644 --- a/src/views/modules/auth/authRule.vue +++ b/src/views/modules/auth/authRule.vue @@ -37,7 +37,7 @@ + + + 新增 + + + + + + + + + @@ -197,6 +235,73 @@ 关闭 + + + + + + + + + + + + + + + + + + + + + + + 首步骤 + + + + + + + 审批人 + + + 审批人 + + + + + + + + + 末步骤 + + + + + + + 审批组编码 + + + 审批组编码 + + + + + + + + + 保存 + 关闭 + + + + + @@ -206,10 +311,19 @@ import { authRuleSearch, // 审批规则信息列表查询 authRuleSave, // 审批规则信息新增 authRuleEdit, // 审批规则信息编辑 - authRuleDelete // 审批规则信息删除 + authRuleDelete, // 审批规则信息删除 + authRuleStepSearch, // 审批规则步骤信息列表查询 + authRuleStepSave, // 审批规则步骤信息新增 + authRuleStepEdit, // 审批规则步骤信息编辑 + authRuleStepDelete, // 审批规则步骤信息删除 } from '@/api/auth/auth' +import Chooselist from '@/views/modules/common/Chooselist_eam' +import {authBusinessSearch, authGroupSearch} from "../../../api/auth/auth"; export default { + components: { + Chooselist + }, data() { return { // 导出 @@ -271,8 +385,33 @@ export default { createDate: '', updateDate: '' }, + ruleStepModalData: { + flag: '', + title: '', + bu: '', + site: this.$store.state.user.site, + userName: this.$store.state.user.name, + buNo: '', + authStepId: '', + authRuleId: '', + ruleNo: '', + ruleDesc: '', + stepNo: 0, + authTypeDb: '', + authUserNo: '', + userDisplay: '', + authGroupNo: '', + groupDesc: '', + firstStepFlag: '', + lastStepFlag: '', + createBy: '', + updateBy: '', + createDate: '', + updateDate: '' + }, // ======== 数据列表 ======== dataList: [], + ruleStepDataList: [], // 展示列集 columnList: [ { @@ -509,6 +648,224 @@ export default { columnWidth: 100 }, ], + ruleStepColumnList: [ + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2StepNo', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'stepNo', + headerAlign: "center", + align: "center", + columnLabel: '步骤号', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 60 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2AuthTypeDb', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'authTypeDb', + headerAlign: "center", + align: "center", + columnLabel: '类型', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 90 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2AuthUserNo', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'authUserNo', + headerAlign: "center", + align: "left", + columnLabel: '审批人', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2UserDisplay', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'userDisplay', + headerAlign: "center", + align: "left", + columnLabel: '审批人姓名', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2AuthGroupNo', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'authGroupNo', + headerAlign: "center", + align: "center", + columnLabel: '审批组编码', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2GroupDesc', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'groupDesc', + headerAlign: "center", + align: "left", + columnLabel: '审批组名称', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 120 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2FirstStepFlag', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'firstStepFlag', + headerAlign: "center", + align: "center", + columnLabel: '首步骤', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2LastStepFlag', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'lastStepFlag', + headerAlign: "center", + align: "center", + columnLabel: '末步骤', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 50 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2CreateDate', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'createDate', + headerAlign: "center", + align: "center", + columnLabel: '创建时间', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 170 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2CreateBy', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'createBy', + headerAlign: "center", + align: "left", + columnLabel: '创建人', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2UpdateDate', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'updateDate', + headerAlign: "center", + align: "center", + columnLabel: '更新时间', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 170 + }, + { + userId: this.$store.state.user.name, + functionId: 601005, + serialNumber: '601005Table2UpdateBy', + tableId: "601005Table2", + tableName: "审批规则步骤表", + columnProp: 'updateBy', + headerAlign: "center", + align: "left", + columnLabel: '更新人', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: '', + columnWidth: 100 + }, + ], rules: { bu: [ { @@ -551,7 +908,49 @@ export default { message: ' ', trigger: 'change' } - ] + ], + stepNo:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], + authTypeDb:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], + authUserNo:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], + userDisplay:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], + authGroupNo:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], + groupDesc:[ + { + required: true, + message: ' ', + trigger: 'change' + } + ], }, // ======== 模态框开关控制 ======== authSearch: false, @@ -559,7 +958,9 @@ export default { authUpdate: false, authDelete: false, modalFlag: false, + ruleStepModalFlag: false, modalDisableFlag: false, + ruleStepModalDisableFlag: false, menuId: this.$route.meta.menuId, }; }, @@ -576,6 +977,12 @@ export default { this.modalData.ruleNo = this.modalData.ruleNo.toUpperCase() } }, + ruleStepModalData: { + deep: true, + handler: function (newV, oldV) { + this.ruleStepModalData.authGroupNo = this.ruleStepModalData.authGroupNo.toUpperCase() + } + } }, mounted () { this.$nextTick(() => { @@ -613,6 +1020,36 @@ export default { this.getDataList() }, + // 获取基础数据列表S + getBaseList (val,type) { + this.tagNo = val + this.$nextTick(() => { + let strVal = '' + let conSql = '' + if (val === 2003 ) { + strVal = this.ruleStepModalData.authUserNo + conSql = " and br.site = '" + this.$store.state.user.site + "'" + this.$refs.baseList.init(val, strVal, conSql) + } + if (val === 218 ) { + strVal = this.ruleStepModalData.authGroupNo + this.$refs.baseList.init(val, strVal) + } + }) + }, + + /* 列表方法的回调 */ + getBaseData (val) { + if (this.tagNo === 2003) { + this.ruleStepModalData.authUserNo = val.username + this.ruleStepModalData.userDisplay = val.user_display + } + if (this.tagNo === 218) { + this.ruleStepModalData.authGroupNo = val.group_no + this.ruleStepModalData.groupDesc = val.group_desc + } + }, + // 获取数据列表 getDataList () { if (this.searchData.bu != null && this.searchData.bu !== '') { @@ -646,6 +1083,24 @@ export default { }) }, + // 获取数据列表 + getRuleStepDataList () { + authRuleStepSearch(this.ruleCurrentRow).then(({data}) => { + if (data && data.code === 0) { + this.ruleStepDataList = data.list + // 设置选中行 + this.$refs.ruleStepTable.setCurrentRow(this.ruleStepDataList[0]) + for (let i = 0; i < this.ruleStepDataList.length; i++) { + if (this.ruleStepDataList[i].authTypeDb === 'U') { + this.ruleStepDataList[i].authTypeDb = '审批人' + } else { + this.ruleStepDataList[i].authTypeDb = '审批组' + } + } + } + }) + }, + addModal () { this.modalData = { flag: '1', @@ -665,6 +1120,37 @@ export default { this.modalFlag = true }, + ruleStepAddModal () { + this.ruleStepModalData = { + flag: '1', + title: '审批规则步骤新增', + bu: this.userBuList[0].buNo, + buNo: '', + authRuleId: this.ruleCurrentRow.authRuleId, + ruleNo: this.ruleCurrentRow.ruleNo, + ruleDesc: this.ruleCurrentRow.ruleDesc, + stepNo: 10, + authTypeDb: 'U', + authUserNo: '', + userDisplay: '', + authGroupNo: '', + groupDesc: '', + firstStepFlag: 'N', + lastStepFlag: 'N', + createBy: this.$store.state.user.name, + } + // 遍历数据列表,判断步骤号,每次新增步骤号+10 + let stepNoList = [] + for (let i = 0; i < this.ruleStepDataList.length; i++) { + stepNoList.push(this.ruleStepDataList[i].stepNo) + } + if (stepNoList.length > 0) { + this.ruleStepModalData.stepNo = Math.max.apply(null, stepNoList) + 10 + } + this.ruleStepModalDisableFlag = false + this.ruleStepModalFlag = true + }, + /** * 审批规则信息编辑模态框 * @param row @@ -703,6 +1189,36 @@ export default { this.modalFlag = true }, + /** + * 审批规则步骤信息编辑模态框 + * @param row + */ + ruleStepUpdateModal (row) { + this.ruleStepModalData = { + flag: '2', + title: '审批规则步骤编辑', + site: row.site, + authStepId: row.authStepId, + authRuleId: row.authRuleId, + ruleNo: row.ruleNo, + ruleDesc: row.ruleDesc, + stepNo: row.stepNo, + authTypeDb: row.authTypeDb, + authUserNo: row.authUserNo, + userDisplay: row.userDisplay, + authGroupNo: row.authGroupNo, + groupDesc: row.groupDesc, + firstStepFlag: row.firstStepFlag, + lastStepFlag: row.lastStepFlag, + createBy: row.createBy, + createDate: row.createDate, + updateBy: this.$store.state.user.name, + updateDate: '' + } + this.ruleStepModalDisableFlag = true + this.ruleStepModalFlag = true + }, + // ======== 新增/编辑/删除方法 ======== /** * 审批规则信息新增/编辑 @@ -779,6 +1295,118 @@ export default { } }, + /** + * 审批规则步骤信息新增/编辑 + */ + ruleStepSaveData () { + if (this.ruleStepModalData.stepNo === '' || this.ruleStepModalData.stepNo == null) { + this.$message.warning('请填写步骤号!') + return + } + if (this.ruleStepModalData.authTypeDb === '' || this.ruleStepModalData.authTypeDb == null) { + this.$message.warning('请选择类型!') + return + } + if (this.ruleStepModalData.authTypeDb === 'U' || this.ruleStepModalData.authTypeDb === '审批人') { + if (this.ruleStepModalData.authUserNo === '' || this.ruleStepModalData.authUserNo == null) { + this.$message.warning('请填写审批人!') + return + } + if (this.ruleStepModalData.userDisplay === '' || this.ruleStepModalData.userDisplay == null) { + this.$alert('该审批人不存在,请重新输入审批人用户名!', '提示', { + confirmButtonText: '确定', + type: 'warning' + }) + return; + } + } else { + if (this.ruleStepModalData.authGroupNo === '' || this.ruleStepModalData.authGroupNo == null) { + this.$message.warning('请填写审批组编码!') + return + } + if (this.ruleStepModalData.groupDesc === '' || this.ruleStepModalData.groupDesc == null) { + this.$alert('该审批组不存在,请重新输入审批组编码!', '提示', { + confirmButtonText: '确定', + type: 'warning' + }) + return; + } + } + // 判断步骤号是否为整十的倍数 + if (this.ruleStepModalData.stepNo % 10 !== 0) { + this.$alert('步骤号必须为整十的倍数(如10、20、30)!', '提示', { + confirmButtonText: '确定' + }) + return + } + if (this.ruleStepDataList != null && this.ruleStepDataList.length > 0) { + for (let i = 0; i < this.ruleStepDataList.length; i++) { + if(this.ruleStepModalData.firstStepFlag === 'Y' && this.ruleStepDataList[i].firstStepFlag === 'Y') { + this.$alert('该审批步骤下已存在首步骤!', '提示', { + confirmButtonText: '确定' + }) + return + } + if(this.ruleStepModalData.lastStepFlag === 'Y' && this.ruleStepDataList[i].lastStepFlag === 'Y') { + this.$alert('该审批步骤下已存在末步骤!', '提示', { + confirmButtonText: '确定' + }) + return + } + } + } + if (this.ruleStepModalData.firstStepFlag === 'Y') { + this.ruleStepModalData.lastStepFlag = 'N' + } else if (this.ruleStepModalData.lastStepFlag === 'Y') { + this.ruleStepModalData.firstStepFlag = 'N' + } else { + this.ruleStepModalData.firstStepFlag = 'N' + this.ruleStepModalData.lastStepFlag = 'N' + } + if (this.ruleStepModalData.flag === '1') { + this.ruleStepModalData.buNo = this.ruleStepModalData.bu.split('_')[1] + this.ruleStepModalData.site = this.$store.state.user.site + authRuleStepSave(this.ruleStepModalData).then(({data}) => { + if (data && data.code === 0) { + this.getRuleStepDataList() + this.ruleStepModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + } else { + if (this.ruleStepModalData.authTypeDb === '审批人') { + this.ruleStepModalData.authTypeDb = 'U' + } else { + this.ruleStepModalData.authTypeDb = 'G' + } + authRuleStepEdit(this.ruleStepModalData).then(({data}) => { + if (data && data.code === 0) { + this.getRuleStepDataList() + this.ruleStepModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + } + }, + /** * 审批规则信息删除 */ @@ -808,6 +1436,79 @@ export default { }) }, + /** + * 审批规则步骤信息删除 + */ + ruleStepDelModal (row) { + this.$confirm(`是否删除这条审批规则步骤信息?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + authRuleStepDelete(row).then(({data}) => { + if (data && data.code === 0) { + this.getRuleStepDataList() + this.partSelections = [] + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }).catch(() => { + }) + }, + + clearRuleStepModalData () { + this.ruleStepModalData.authUserNo = '' + this.ruleStepModalData.userDisplay = '' + this.ruleStepModalData.authGroupNo = '' + this.ruleStepModalData.groupDesc = '' + }, + + authUserNoBlur () { + let params = { + username: this.ruleStepModalData.authUserNo, + site: this.$store.state.user.site, + limit: 1, + page: 1 + } + authBusinessSearch(params).then(({data}) => { + if (data.code === 0) { + this.ruleStepModalData.userDisplay = data.page.list[0].userDisplay + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + + authGroupNoBlur () { + let params = { + site: this.$store.state.user.site, + groupNo: this.ruleStepModalData.authGroupNo, + active: 'Y', + limit: 1, + page: 1 + } + authGroupSearch(params).then(({data}) => { + if (data.code === 0) { + this.ruleStepModalData.groupDesc = data.page.list[0].groupDesc + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, + // ======== 列表操作方法 ======== /** * 单机选中审批规则信息 @@ -833,6 +1534,9 @@ export default { }, refreshCurrentTabTable () { + if (this.activeTable == 'auth_rule_step') { + this.getRuleStepDataList() + } }, } }