提供流程与角色一对多情况下的角色删除功能(放入回收站)
This commit is contained in:
parent
c8e8aabfe8
commit
5bef97af96
@ -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} = {};// 以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
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user