开发一个角色图错误检测以及处理工具

This commit is contained in:
446052889@qq.com 2025-04-02 11:19:38 +08:00
parent 577965b89e
commit 91c08d3194
2 changed files with 870 additions and 1 deletions

View File

@ -0,0 +1,866 @@
<template>
<div class="data-migration">
<el-tabs v-model="tabs.activeName" @tab-click="handleTabClick">
<el-tab-pane label="角色VersionId数据错误" name="first">
<div class="top-box">
<div class="title-box">针对角色图错误数据版本进行合并1个流程的多个版本对应多个角色图修正角色图的versionId</div>
</div>
<div class="middle-box">
<awsui-button style="cursor: pointer" type="primary" @click="checkErrorModel">检测角色数据</awsui-button>
<awsui-button style="cursor: pointer" type="primary" :disabled="roleVersionIdError.updateStatus" @click="updateErrorModel">进行数据修正</awsui-button>
<span style="color: red;"><b>{{roleVersionIdError.desc}}</b></span>
</div>
<div class="bottom-box">
<el-table
v-loading="roleVersionIdError.loading"
:data="roleVersionIdError.list"
stripe
height="650"
style="width: 100%">
<el-table-column
prop="no"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="processName"
label="流程名称"
width="180">
</el-table-column>
<el-table-column
prop="processVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="processId"
label="流程ID">
</el-table-column>
<el-table-column
prop="processVersionId"
label="流程版本ID">
</el-table-column>
<el-table-column
prop="roleName"
label="角色名称"
width="180">
</el-table-column>
<el-table-column
prop="roleVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="roleId"
label="角色ID">
</el-table-column>
<el-table-column
prop="roleVersionId"
label="角色版本ID">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="角色使用状态错误" name="second">
<div class="top-box">
<div class="title-box">针对角色图与对应的流程的使用状态不一致的数据进行修正1个流程V3处于使用中但是对应角色图却是非使用中修正角色图的使用状态以流程图使用状态为准使角色图与流程图一致</div>
</div>
<div class="middle-box">
<awsui-button style="cursor: pointer" type="primary" @click="checkErrorUseModel">检测角色数据</awsui-button>
<awsui-button style="cursor: pointer" type="primary" :disabled="roleUseError.updateStatus" @click="updateErrorUseModel">进行数据修正</awsui-button>
<span style="color: red;"><b>{{roleUseError.desc}}</b></span>
</div>
<div class="bottom-box">
<el-table
v-loading="roleUseError.loading"
:data="roleUseError.list"
stripe
height="650"
style="width: 100%">
<el-table-column
prop="no"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="processName"
label="流程名称"
width="180">
</el-table-column>
<el-table-column
prop="processVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="processUse"
label="流程使用状态"
width="50">
</el-table-column>
<el-table-column
prop="processId"
label="流程ID">
</el-table-column>
<el-table-column
prop="processVersionId"
label="流程版本ID">
</el-table-column>
<el-table-column
prop="roleName"
label="角色名称"
width="180">
</el-table-column>
<el-table-column
prop="roleVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="roleUse"
label="角色使用状态"
width="50">
</el-table-column>
<el-table-column
prop="roleId"
label="角色ID">
</el-table-column>
<el-table-column
prop="roleVersionId"
label="角色版本ID">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="角色版本号错误" name="third">
<div class="top-box">
<div class="title-box">针对角色图与对应的流程的版本号不一致的数据进行修正1个流程V3对应角色图却是V2修正角色图的版本号以流程图使用状态为准使角色图与流程图一致</div>
</div>
<div class="middle-box">
<awsui-button style="cursor: pointer" type="primary" @click="checkErrorVerModel">检测角色数据</awsui-button>
<awsui-button style="cursor: pointer" type="primary" :disabled="roleVerError.updateStatus" @click="updateErrorVerModel">进行数据修正</awsui-button>
<span style="color: red;"><b>{{roleVerError.desc}}</b></span>
</div>
<div class="bottom-box">
<el-table
v-loading="roleVerError.loading"
:data="roleVerError.list"
stripe
height="650"
style="width: 100%">
<el-table-column
prop="no"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="processName"
label="流程名称"
width="180">
</el-table-column>
<el-table-column
prop="processVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="processId"
label="流程ID">
</el-table-column>
<el-table-column
prop="processVersionId"
label="流程版本ID">
</el-table-column>
<el-table-column
prop="roleName"
label="角色名称"
width="180">
</el-table-column>
<el-table-column
prop="roleVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="roleId"
label="角色ID">
</el-table-column>
<el-table-column
prop="roleVersionId"
label="角色版本ID">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="多余角色版本错误" name="fourth">
<div class="top-box">
<div class="title-box">针对角色图与对应的流程对应数量不一致的数据进行检测1个流程V3对应2个角色图V2和V3查询涉及到的流程图与相对应的角色图</div>
</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>-->
<span style="color: red;"><b>{{roleMultiError.desc}}</b></span>
</div>
<div class="bottom-box">
<el-table
v-loading="roleMultiError.loading"
:data="roleMultiError.list"
stripe
height="650"
style="width: 100%">
<el-table-column
prop="no"
label="序号"
width="50">
</el-table-column>
<el-table-column
prop="processName"
label="流程名称"
width="180">
</el-table-column>
<el-table-column
prop="processVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="processId"
label="流程ID">
</el-table-column>
<el-table-column
prop="processVersionId"
label="流程版本ID">
</el-table-column>
<el-table-column
prop="roleName"
label="角色名称"
width="180">
</el-table-column>
<el-table-column
prop="roleVersion"
label="版本号"
width="50">
</el-table-column>
<el-table-column
prop="roleId"
label="角色ID">
</el-table-column>
<el-table-column
prop="roleVersionId"
label="角色版本ID">
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script lang="ts">
import {defineComponent, getCurrentInstance, reactive, ref, nextTick} from 'vue';
import LogCodemirror from "./log-codemirror";
export default defineComponent({
name: "role-error-change",
components: {
LogCodemirror,
},
setup() {
const {proxy: $this} = getCurrentInstance();
const dataCodemirrorRef = ref();
let tabs = reactive({
activeName: 'first'
})
let roleVersionIdError = reactive({
list: [],
desc: '',
loading: false,
updateStatus: false
})
let roleUseError = reactive({
list: [],
desc: '',
loading: false,
updateStatus: false
})
let roleVerError = reactive({
list: [],
desc: '',
loading: false,
updateStatus: false
})
let roleMultiError = reactive({
list: [],
desc: '',
loading: false,
updateStatus: false
})
let info = reactive({
activeStep: 0,
steps: [{title: "上传"}, {title: "校验"}, {title: "结果"}],
fileList: [],
uploadAction: '',
repositoryName: 'versionNoExcel',
groupValue: 'upfile',
fileValue: '',
appId: 'com.actionsoft.apps.coe.pal.datamigration',
fileName: ''
});
let dlg = reactive({
visible: false
})
let logCodemirror = reactive({
height: '100%',
width: '100%',
logStr: ''
})
const result = reactive({
path: '',
logId : '',
totalCount : 0,
importingCount: 0,
resultStatus: 0,
interval: null, //
timer:0, //
})
const handleClose = (done: () => void) => {
done();
}
const handlePreview = () => {
}
const handleRemove = () => {
}
const beforeRemove = () => {
}
const handleExceed = () => {
}
const handleSuccess = (res: any, uploadFile: any, uploadFiles: any) => {
console.log(res, '---', uploadFile, '----', uploadFiles)
info.fileName = res.files.name
let tempFileObj = {id: uploadFile.uid, name: res.files.name, downloadUrl: res.data.data.attrs.downloadUrl}
info.fileList.push(tempFileObj)
console.info('fileList', info.fileList)
}
const dlgClose = () => {
if (result.resultStatus == 0) {
$this.$message({message: '导入正在进行中,关闭窗口不影响导入的执行', type: 'warning',})
}
clearResult();
logCodemirror.logStr = '';
}
const clearResult = () => {
if (result.interval != null) {
removeInterval();
}
result.path = '';
result.logId = '';
result.totalCount = 0;
result.importingCount = 0;
result.resultStatus = 0;
result.interval = null; //
result.timer = 0; //
}
const next = () => {
if (info.fileList.length === 0) {
$this.$message({type: 'warning', message: '请上传文件'});
return;
}
dlg.visible = true;
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_version_no_import',
sid: settingParam.sessionId,
wsId: settingParam.wsId ? settingParam.wsId : '1b19ab87-5727-4621-bc3f-117183b06e59',
groupValue: info.groupValue,
fileValue: info.fileValue,
fileName: info.fileName
}
}
$this.awsuiaxios.post(param)
.then((ro: any) => {
result.path = ro.data.path;
result.logId = ro.data.logId;
result.resultStatus = ro.data.resultStatus;
if (ro.result == 'ok') {
result.totalCount = ro.data.totalCount;
result.importingCount = ro.data.importingCount;
} else {
// $this.$message.error(ro.msg);
}
getImportInfoEvent();
})
.catch((err: any) => {
})
}
//
const getImportInfoEvent = () => {
result.interval = setInterval(queryLog, 1000);
}
const queryLog = () => {
const that = $this;
result.timer = new Date().getTime();
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_query',
sid: settingParam.sessionId,
logId: result.logId,
path: result.path,
timer: result.timer
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
if (ro.result === 'ok') {
if (parseInt(ro.data.timer) <= result.timer) {
logCodemirror.logStr = ro.data.content;
//
nextTick(()=> {
moveLogEnd();
});
result.resultStatus = ro.data.resultStatus;
if (result.resultStatus != 0) {
removeInterval();
result.importingCount = result.totalCount;// 100%
} else {
result.importingCount = ro.data.importingCount;
}
}
} else {
that.$message.error(ro.msg);
removeInterval();
}
})
.catch((err: any) => {
})
}
// log-codemirror
const moveLogEnd = () => {
dataCodemirrorRef.value.moveTextToEnd();
}
const removeInterval= () => {
clearInterval(result.interval);
}
const downloadLog = () => {
//
const that = $this;
if (result.path == '') {
that.$message({message: '获取日志失败', type: 'warning'});
return;
}
if (result.resultStatus == 0) {
that.$message({message: '正在导入,请稍等', type: 'warning'});
return;
}
const param = {
url:'./jd',
data:{
cmd : "com.actionsoft.apps.coe.pal.datamigration_version_no_import_log_download",
path: result.path,
logId: result.logId
}
};
that.awsuiaxios.post(param)
.then((ro: any) => {
if (ro.result === 'ok') {
window.open(ro.data.url);
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}
const removeFile = () => {
info.fileList = [];
}
const handleUploadBtn = () => {
debugger;
info.fileValue = 'versionNoExcel-' + transDate(new Date());
info.uploadAction = axiosBaseUrl + 'uf?sid=' + settingParam.sessionId + '&repositoryName=' + info.repositoryName + '&groupValue='
+ info.groupValue + '&fileValue=' + info.fileValue + '&appId=' + info.appId;
}
const transDate = (date: Date) => {
var ndate = new Date(date);
let type = 'yyyy-MM-dd-hhmmss';
const o = {
'M+': ndate.getMonth() + 1, //
'd+': ndate.getDate(), //
'h+': ndate.getHours(), //
'm+': ndate.getMinutes(), //
's+': ndate.getSeconds(), //
'q+': Math.floor((ndate.getMonth() + 3) / 3), //
'S': ndate.getMilliseconds() //
}
if (/(y+)/.test(type)) type = type.replace(RegExp.$1, (ndate.getFullYear() + '').substr(4 - RegExp.$1.length))
for (const k in o) {
if (new RegExp('(' + k + ')').test(type)) type = type.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
return type;
}
const checkErrorModel = () => {// versionId
const that = $this;
if (that.roleVersionIdError.loading) {
that.$message({message: '正在查询,请稍等', type: 'warning'});
return;
}
that.roleVersionIdError.loading = true;
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_query',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
that.roleVersionIdError.loading = false;
if (ro.result === 'ok') {
that.roleVersionIdError.list = ro.data.list;
that.roleVersionIdError.desc = ro.data.desc;
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}
const updateErrorModel = () => {// versionId
const that = $this;
if (that.roleVersionIdError.list.length == 0) {
that.$message({message: '当前没有需要修正的数据', type: 'warning'});
return;
}
that.roleVersionIdError.updateStatus = true;
that.$confirm('建议使用平台人数比较少时进行修正, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_update',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
if (ro.result === 'ok') {
that.roleVersionIdError.updateStatus = false;
that.$message({message: ro.msg, type: 'success'});
that.roleVersionIdError.list = [];
that.roleVersionIdError.desc = '';
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}).catch(() => {
that.roleVersionIdError.updateStatus = false;
});
}
const checkErrorUseModel = () => {// 使
const that = $this;
if (that.roleUseError.loading) {
that.$message({message: '正在查询,请稍等', type: 'warning'});
return;
}
that.roleUseError.loading = true;
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_use_error_query',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
that.roleUseError.loading = false;
if (ro.result === 'ok') {
that.roleUseError.list = ro.data.list;
that.roleUseError.desc = ro.data.desc;
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}
const updateErrorUseModel = () => {// 使
const that = $this;
if (that.roleUseError.list.length == 0) {
that.$message({message: '当前没有需要修正的数据', type: 'warning'});
return;
}
that.roleUseError.updateStatus = true;
that.$confirm('建议使用平台人数比较少时进行修正, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_use_error_update',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
if (ro.result === 'ok') {
that.roleUseError.updateStatus = false;
that.$message({message: ro.msg, type: 'success'});
that.roleUseError.list = [];
that.roleUseError.desc = '';
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}).catch(() => {
that.roleUseError.updateStatus = false;
});
}
const checkErrorVerModel = () => {//
const that = $this;
if (that.roleVerError.loading) {
that.$message({message: '正在查询,请稍等', type: 'warning'});
return;
}
that.roleVerError.loading = true;
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_ver_error_query',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
that.roleVerError.loading = false;
if (ro.result === 'ok') {
that.roleVerError.list = ro.data.list;
that.roleVerError.desc = ro.data.desc;
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}
const updateErrorVerModel = () => {//
const that = $this;
if (that.roleVerError.list.length == 0) {
that.$message({message: '当前没有需要修正的数据', type: 'warning'});
return;
}
that.roleVerError.updateStatus = true;
that.$confirm('建议使用平台人数比较少时进行修正, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_ver_error_update',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
if (ro.result === 'ok') {
that.roleVerError.updateStatus = false;
that.$message({message: ro.msg, type: 'success'});
that.roleVerError.list = [];
that.roleVerError.desc = '';
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}).catch(() => {
that.roleVerError.updateStatus = false;
});
}
const checkErrorMultiModel = () => {//
const that = $this;
if (that.roleMultiError.loading) {
that.$message({message: '正在查询,请稍等', type: 'warning'});
return;
}
that.roleMultiError.loading = true;
const param = {
url: './jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal.datamigration_role_multi_error_query',
sid: settingParam.sessionId
}
}
that.awsuiaxios.post(param)
.then((ro: any) => {
that.roleMultiError.loading = false;
if (ro.result === 'ok') {
that.roleMultiError.list = ro.data.list;
that.roleMultiError.desc = ro.data.desc;
} else {
that.$message.error(ro.msg);
}
})
.catch((err: any) => {
})
}
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 handleTabClick = (tab, event) => {
const that = $this;
that.roleVersionIdError.list = [];
that.roleVersionIdError.desc = '';
that.roleUseError.list = [];
that.roleUseError.desc = '';
that.roleVerError.list = [];
that.roleVerError.desc = '';
that.roleMultiError.list = '';
that.roleMultiError.desc = '';
}
return {
tabs,
roleVersionIdError,
roleUseError,
roleVerError,
roleMultiError,
dataCodemirrorRef,
info,
dlg,
logCodemirror,
result,
handlePreview,
handleRemove,
beforeRemove,
handleExceed,
handleUploadBtn,
handleSuccess,
next,
removeFile,
handleClose,
dlgClose,
downloadLog,
checkErrorModel,
updateErrorModel,
handleTabClick,
checkErrorUseModel,
updateErrorUseModel,
checkErrorVerModel,
updateErrorVerModel,
checkErrorMultiModel,
updateErrorMultiModel
}
}
})
</script>
<style lang="less" scoped>
.data-migration {
width: 100%;
height: 100%;
background-color: #F7F7FB;
.top-box {
height: 45px;
margin: 0 35px 0 35px;
display: flex;
justify-content: space-between;
.title-box {
line-height: 45px;
font-size: 18px;
}
.step-box {
width: 45%;
padding: 5px 0;
}
}
.middle-box {
height: 40px;
margin: 0 35px 0 35px;
}
.bottom-box {
height: 650px;
margin: 0 35px 0 35px;
background-color: rgb(255, 255, 255);
display: flex;
justify-content: space-around;
align-items: center;
flex-direction: column;
.empty-box {
width: 500px;
height: 500px;
.upload-box {
text-align: center;
}
}
.file-list-box {
width: 100%;
:deep(.el-scrollbar) {
padding: 0 25px;
}
.scrollbar-demo-item {
font-size: 16px;
height: 35px;
margin: 10px;
border-radius: 4px;
background: var(--el-color-primary-light-9);
color: var(--el-color-primary);
line-height: 35px;
}
}
}
}
</style>

View File

@ -51,6 +51,7 @@ import PositionImport from '@/components/position-import.vue';
import ProcessVersionImport from "@/components/process-version-import.vue";
import SystemTextImport from "@/components/system-text-import.vue";
import BatchImportAccessories from "@/components/batch-import-accessories.vue";
import RoleErrorChange from "@/components/role-error-change.vue";
export default defineComponent({
name: 'Home',
@ -66,7 +67,8 @@ export default defineComponent({
PositionImport,
ProcessVersionImport,
SystemTextImport,
BatchImportAccessories
BatchImportAccessories,
RoleErrorChange
},
setup(){
// const { proxy: $this } = getCurrentInstance();
@ -87,6 +89,7 @@ export default defineComponent({
{label:"版本批处理",name:"processVersionImport",icon:"&#xe730;"},// excel
{label:"制度正文导入",name:"systemTextImport",icon:"&#xe730;"},// xml
{label:"附件批量导入",name:"batchImportAccessories",icon:"&#xe730;"},//
{label:"角色图修正",name:"roleErrorChange",icon:"&#xe655;"},
],
flagBit: 1
});