提供流程与角色一对多情况下的角色删除功能(放入回收站)

This commit is contained in:
446052889@qq.com 2025-04-25 18:06:01 +08:00
parent c8e8aabfe8
commit 5bef97af96

View File

@ -197,7 +197,7 @@
</div>
<div class="middle-box">
<awsui-button style="cursor: pointer" type="primary" @click="checkErrorMultiModel">检测角色数据</awsui-button>
<!-- <awsui-button style="cursor: pointer" type="primary" :disabled="roleMultiError.updateStatus" @click="updateErrorMultiModel">进行数据修正</awsui-button>-->
<awsui-button style="cursor: pointer" type="primary" :disabled="roleMultiError.updateStatus" @click="updateErrorMultiModel">进行数据修正</awsui-button>
<span style="color: red;"><b>{{roleMultiError.desc}}</b></span>
</div>
<div class="bottom-box">
@ -206,7 +206,12 @@
:data="roleMultiError.list"
height="650"
:row-style="getRowStyle"
@selection-change="handleSelectionChange"
style="width: 100%">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="no"
label="序号"
@ -387,6 +392,11 @@ export default defineComponent({
let tabs = reactive({
activeName: 'first'
})
const multipleSelection = ref([])
const handleSelectionChange = (val) => {
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} = {};// processIdkey
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} = {};// processIdkey
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
}
}
})