提供流程与角色一对多情况下的角色删除功能(放入回收站)
This commit is contained in:
parent
c8e8aabfe8
commit
5bef97af96
@ -197,7 +197,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="middle-box">
|
<div class="middle-box">
|
||||||
<awsui-button style="cursor: pointer" type="primary" @click="checkErrorMultiModel">检测角色数据</awsui-button>
|
<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>
|
<span style="color: red;"><b>{{roleMultiError.desc}}</b></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-box">
|
<div class="bottom-box">
|
||||||
@ -206,7 +206,12 @@
|
|||||||
:data="roleMultiError.list"
|
:data="roleMultiError.list"
|
||||||
height="650"
|
height="650"
|
||||||
:row-style="getRowStyle"
|
:row-style="getRowStyle"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
width="55">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="no"
|
prop="no"
|
||||||
label="序号"
|
label="序号"
|
||||||
@ -387,6 +392,11 @@ export default defineComponent({
|
|||||||
let tabs = reactive({
|
let tabs = reactive({
|
||||||
activeName: 'first'
|
activeName: 'first'
|
||||||
})
|
})
|
||||||
|
const multipleSelection = ref([])
|
||||||
|
const handleSelectionChange = (val) => {
|
||||||
|
multipleSelection.value = val;
|
||||||
|
console.log(multipleSelection.value)
|
||||||
|
};
|
||||||
let roleVersionIdError = reactive({
|
let roleVersionIdError = reactive({
|
||||||
list: [],
|
list: [],
|
||||||
desc: '',
|
desc: '',
|
||||||
@ -832,40 +842,89 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const updateErrorMultiModel = () => {// 修正角色版本号错误
|
const updateErrorMultiModel = () => {// 修正角色版本号错误
|
||||||
// const that = $this;
|
const that = $this;
|
||||||
// if (that.roleMultiError.list.length == 0) {
|
if (that.roleMultiError.list.length == 0) {
|
||||||
// that.$message({message: '当前没有需要修正的数据', type: 'warning'});
|
that.$message({message: '当前没有需要修正的数据', type: 'warning'});
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// that.roleMultiError.updateStatus = true;
|
if (that.multipleSelection.length == 0) {
|
||||||
// that.$confirm('建议使用平台人数比较少时进行修正, 是否继续?', '提示', {
|
that.$message({message: '没有选择需要删除的角色模型', type: 'warning'});
|
||||||
// confirmButtonText: '确定',
|
return;
|
||||||
// cancelButtonText: '取消',
|
}
|
||||||
// type: 'warning'
|
|
||||||
// }).then(() => {
|
// 已选中的角色数据整理
|
||||||
// const param = {
|
let delRoleData: any[] = [];// 待删除的角色ID
|
||||||
// url: './jd',
|
let checkedData = that.multipleSelection;// 已选中的数据
|
||||||
// data: {
|
let checkedDataObj : {[key: string]: number} = {};// 以processId为key,记录选择的对应的角色个数
|
||||||
// cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_multi_error_update',
|
for (let i = 0; i < checkedData.length; i++) {
|
||||||
// sid: settingParam.sessionId
|
let item = checkedData[i];
|
||||||
// }
|
if (!Object.prototype.hasOwnProperty.call(checkedDataObj, item.processId)) {
|
||||||
// }
|
checkedDataObj[item.processId] = 0;
|
||||||
// that.awsuiaxios.post(param)
|
}
|
||||||
// .then((ro: any) => {
|
checkedDataObj[item.processId] = checkedDataObj[item.processId] + 1;
|
||||||
// if (ro.result === 'ok') {
|
delRoleData.push(item.roleId);
|
||||||
// that.roleMultiError.updateStatus = false;
|
}
|
||||||
// that.$message({message: ro.msg, type: 'success'});
|
|
||||||
// that.roleMultiError.list = [];
|
// 表格所有数据整理
|
||||||
// that.roleMultiError.desc = '';
|
let errDataObj: {[key: string]: number} = {};// 以processId为key,记录对应的角色个数
|
||||||
// } else {
|
let errDataObj2: {[key: string]: string} = {};
|
||||||
// that.$message.error(ro.msg);
|
for (let i = 0; i < that.roleMultiError.list.length; i++) {
|
||||||
// }
|
let item = that.roleMultiError.list[i];
|
||||||
// })
|
if (!Object.prototype.hasOwnProperty.call(errDataObj, item.processId)) {
|
||||||
// .catch((err: any) => {
|
errDataObj[item.processId] = 0;
|
||||||
// })
|
}
|
||||||
// }).catch(() => {
|
errDataObj[item.processId] = errDataObj[item.processId] + 1;
|
||||||
// that.roleMultiError.updateStatus = false;
|
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 handleTabClick = (tab, event) => {
|
||||||
const that = $this;
|
const that = $this;
|
||||||
@ -925,7 +984,9 @@ export default defineComponent({
|
|||||||
checkErrorMultiModel,
|
checkErrorMultiModel,
|
||||||
updateErrorMultiModel,
|
updateErrorMultiModel,
|
||||||
getRowStyle,
|
getRowStyle,
|
||||||
getTextColor
|
getTextColor,
|
||||||
|
multipleSelection,
|
||||||
|
handleSelectionChange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user