From 5bef97af961b7578a539a9125af681c3ae71b347 Mon Sep 17 00:00:00 2001
From: "446052889@qq.com" <446052889@qq.com>
Date: Fri, 25 Apr 2025 18:06:01 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E6=B5=81=E7=A8=8B=E4=B8=8E?=
=?UTF-8?q?=E8=A7=92=E8=89=B2=E4=B8=80=E5=AF=B9=E5=A4=9A=E6=83=85=E5=86=B5?=
=?UTF-8?q?=E4=B8=8B=E7=9A=84=E8=A7=92=E8=89=B2=E5=88=A0=E9=99=A4=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=EF=BC=88=E6=94=BE=E5=85=A5=E5=9B=9E=E6=94=B6=E7=AB=99?=
=?UTF-8?q?=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/role-error-change.vue | 133 +++++++++++++-----
1 file changed, 97 insertions(+), 36 deletions(-)
diff --git a/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue b/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue
index e7e34f5..88a0b43 100644
--- a/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue
+++ b/com.actionsoft.apps.coe.pal.datamigration/src/components/role-error-change.vue
@@ -197,7 +197,7 @@
检测角色数据
-
+
进行数据修正
{{roleMultiError.desc}}
@@ -206,7 +206,12 @@
:data="roleMultiError.list"
height="650"
:row-style="getRowStyle"
+ @selection-change="handleSelectionChange"
style="width: 100%">
+
+
{
+ multipleSelection.value = val;
+ console.log(multipleSelection.value)
+ };
let roleVersionIdError = reactive({
list: [],
desc: '',
@@ -832,40 +842,89 @@ export default defineComponent({
})
}
const updateErrorMultiModel = () => {// 修正角色版本号错误
- // const that = $this;
- // if (that.roleMultiError.list.length == 0) {
- // that.$message({message: '当前没有需要修正的数据', type: 'warning'});
- // return;
- // }
- // that.roleMultiError.updateStatus = true;
- // that.$confirm('建议使用平台人数比较少时进行修正, 是否继续?', '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning'
- // }).then(() => {
- // const param = {
- // url: './jd',
- // data: {
- // cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_multi_error_update',
- // sid: settingParam.sessionId
- // }
- // }
- // that.awsuiaxios.post(param)
- // .then((ro: any) => {
- // if (ro.result === 'ok') {
- // that.roleMultiError.updateStatus = false;
- // that.$message({message: ro.msg, type: 'success'});
- // that.roleMultiError.list = [];
- // that.roleMultiError.desc = '';
- // } else {
- // that.$message.error(ro.msg);
- // }
- // })
- // .catch((err: any) => {
- // })
- // }).catch(() => {
- // that.roleMultiError.updateStatus = false;
- // });
+ const that = $this;
+ if (that.roleMultiError.list.length == 0) {
+ that.$message({message: '当前没有需要修正的数据', type: 'warning'});
+ return;
+ }
+ if (that.multipleSelection.length == 0) {
+ that.$message({message: '没有选择需要删除的角色模型', type: 'warning'});
+ return;
+ }
+
+ // 已选中的角色数据整理
+ let delRoleData: any[] = [];// 待删除的角色ID
+ let checkedData = that.multipleSelection;// 已选中的数据
+ let checkedDataObj : {[key: string]: number} = {};// 以processId为key,记录选择的对应的角色个数
+ for (let i = 0; i < checkedData.length; i++) {
+ let item = checkedData[i];
+ if (!Object.prototype.hasOwnProperty.call(checkedDataObj, item.processId)) {
+ checkedDataObj[item.processId] = 0;
+ }
+ checkedDataObj[item.processId] = checkedDataObj[item.processId] + 1;
+ delRoleData.push(item.roleId);
+ }
+
+ // 表格所有数据整理
+ let errDataObj: {[key: string]: number} = {};// 以processId为key,记录对应的角色个数
+ let errDataObj2: {[key: string]: string} = {};
+ for (let i = 0; i < that.roleMultiError.list.length; i++) {
+ let item = that.roleMultiError.list[i];
+ if (!Object.prototype.hasOwnProperty.call(errDataObj, item.processId)) {
+ errDataObj[item.processId] = 0;
+ }
+ errDataObj[item.processId] = errDataObj[item.processId] + 1;
+ errDataObj2[item.processId] = item;
+ }
+
+ // 若删除流程下的角色模型数量大于等于该流程下角色个数,则不允许删除,即至少保留一条数据
+ for (let key in checkedDataObj) {
+ if (checkedDataObj[key] >= errDataObj[key]) {
+ let item = errDataObj2[key];
+ that.$message({message: '流程:' + item.processName + '下对应的角色至少保留一个', type: 'warning'});
+ return;
+ }
+ }
+
+ // 开始删除
+ that.roleMultiError.updateStatus = true;
+ that.$confirm('建议使用平台人数比较少时进行删除, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ const param = {
+ url: './jd',
+ data: {
+ cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_multi_error_update',
+ sid: settingParam.sessionId,
+ delRoleData: JSON.stringify(delRoleData)
+ }
+ }
+ that.awsuiaxios.post(param)
+ .then((ro: any) => {
+ if (ro.result === 'ok') {
+ that.roleMultiError.updateStatus = false;
+ that.$message({
+ message: ro.msg, //提示的信息
+ type:'success', //类型是成功
+ duration:1000, //显示时间, 毫秒。设为 0 则不会自动关闭
+ onClose:()=>{
+ that.roleMultiError.list = [];
+ that.roleMultiError.desc = '';
+ that.$message({message: '请重新查询错误数据',type:'success' });
+ }
+ });
+
+ } else {
+ that.$message.error(ro.msg);
+ }
+ })
+ .catch((err: any) => {
+ })
+ }).catch(() => {
+ that.roleMultiError.updateStatus = false;
+ });
}
const handleTabClick = (tab, event) => {
const that = $this;
@@ -925,7 +984,9 @@ export default defineComponent({
checkErrorMultiModel,
updateErrorMultiModel,
getRowStyle,
- getTextColor
+ getTextColor,
+ multipleSelection,
+ handleSelectionChange
}
}
})