38320fa9 by lihua

敏感数据识别接口联调

1 parent e376cffc
......@@ -186,6 +186,12 @@ export const batchUpdateSensitiveDataTaskFieldStatus = (params) => request({
data: params
})
/** 修改任务状态 */
export const confirmTaskStatus = (guid) => request({
url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/confirm-task?execGuid=${guid}`,
method: 'get'
})
/** 获取敏感数据识别任务执行日志 */
export const getSensitiveDataTaskExecLog = (params) => request({
url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/get-exec-sensitive-exec-log`,
......
......@@ -100,7 +100,7 @@ const routes: RouteRecordRaw[] = [
},
beforeEnter: (to, from) => {
if (to.query.taskName) {
to.meta.title = `敏感数据识别查看-${to.query.taskName}`;
to.meta.title = `敏感数据${to.query.isLook == '1' ? '日志查看' : '查看'}-${to.query.taskName}`;
}
}
},
......
......@@ -496,7 +496,7 @@ export const tagType = (row, type): any => {
} else {
state = 'info';
}
} else if (type == 'sensitiveIdentifyTaskStatus') {
} else if (type == 'sensitiveIdentifyTaskStatus') { //敏感数据识别任务执行状态
if (row[type] == 'Y') {
state = 'success'
} else if (row[type] == 'N') {
......@@ -506,6 +506,12 @@ export const tagType = (row, type): any => {
} else if (row[type] == 'R') {
state = 'warning';
}
} else if (type == 'sensitiveIdentifyConfirmStatus') { //敏感数据识别任务确认状态
if (row[type] == 'Y') {
state = 'success';
} else {
state = 'warning';
}
} else if (type == 'state' || type == 'documentState') {
switch (row[type]) {
case 'N':
......@@ -829,6 +835,12 @@ export const tagMethod = (row, type) => {
}else if (row[type] == 'R') { //部分通过
tag = '执行中';
}
} else if (type == 'sensitiveIdentifyConfirmStatus') {
if (row[type] == 'Y') {
tag = '已确认'
} else {
tag = '待确认'
}
} else if (type == 'execState') {
if (row[type] == 0 || row[type] == null) {
tag = '未执行'
......
......@@ -200,6 +200,7 @@ const newCreateTaskFormItems = ref([{
type: 'input',
placeholder: '请选择',
field: 'taskName',
maxlength: 15,
default: '',
required: true,
filterable: true,
......
......@@ -12,16 +12,23 @@ import {
getParamsList,
updateSensitiveDataTaskFieldLabel,
batchUpdateSensitiveDataTaskFieldStatus,
confirmTaskStatus,
} from '@/api/modules/dataAnonymization';
import PageNav from "@/components/PageNav/index.vue";
import { commonPageConfig } from '@/components/PageNav/index';
import { ElMessageBox } from 'element-plus';
import { changeNum } from "@/utils/common";
import BtnPopover from "@/components/Popover/index.vue";
import useUserStore from "@/store/modules/user";
const route = useRoute();
const router = useRouter();
const { proxy } = getCurrentInstance() as any;
const isLook = ref(!!route.query.isLook);
const userStore = useUserStore();
const fullPath = route.fullPath;
const isLook = ref(route.query.isLook == '1');
const fullScreenLoading = ref(false);
const treeInfo = ref({
id: "data-list-tree",
......@@ -65,7 +72,7 @@ const nodeClick = (data, node) => {
}
if (checkTableSave()) {
ElMessageBox.confirm(
'存在未保存的数据,切换后会丢失,是否确定切换',
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
......@@ -87,14 +94,35 @@ const batchConfirm = () => {
proxy.$ElMessage.error('请先勾选待确认的字段');
return;
}
batchUpdateSensitiveDataTaskFieldStatus(selectTableFieldRows.value.map(s => s.guid)).then((res: any) => {
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('批量确认字段成功');
getSensitiveTableFieldData();
} else {
proxy.$ElMessage.error(res.msg);
}
})
if (checkTableSave()) {
ElMessageBox.confirm(
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
batchUpdateSensitiveDataTaskFieldStatus(selectTableFieldRows.value.map(s => s.guid)).then((res: any) => {
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('批量确认字段成功');
getSensitiveTableFieldData();
} else {
proxy.$ElMessage.error(res.msg);
}
})
})
} else {
batchUpdateSensitiveDataTaskFieldStatus(selectTableFieldRows.value.map(s => s.guid)).then((res: any) => {
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('批量确认字段成功');
getSensitiveTableFieldData();
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
}
/** 数量统计信息 */
......@@ -120,7 +148,7 @@ const getExecSensitiveTableData = () => {
treeInfo.value.loading = false;
if (res?.code == proxy.$passCode) {
treeInfo.value.data = res.data?.map(d => {
d.value = d.databaseName;
d.value = `${d.databaseName}-ds`; //解决文件名称和文件的sheet名称一样的树形选中问题
d.label = d.databaseChName;
d.tableList = d.tableList?.map(t => {
t.value = t.tableName;
......@@ -270,7 +298,7 @@ const popoverLabelListInfo = computed(() => {
const handleLabelPopoverClick = (scope) => {
if (checkTableSave()) {
ElMessageBox.confirm(
'存在未保存的数据,切换后会丢失,是否确定切换',
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
......@@ -312,7 +340,7 @@ const popoverLabelTypeListInfo = computed(() => {
const handleLabelTypePopoverClick = (scope) => {
if (checkTableSave()) {
ElMessageBox.confirm(
'存在未保存的数据,切换后会丢失,是否确定切换',
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
......@@ -360,7 +388,7 @@ const popoverStatusListInfo = computed(() => {
const handleStatusPopoverClick = (scope) => {
if (checkTableSave()) {
ElMessageBox.confirm(
'存在未保存的数据,切换后会丢失,是否确定切换',
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
......@@ -380,12 +408,23 @@ const handleStatusPopoverClick = (scope) => {
}
/** 标签选择的值改变,标签类型跟着变化。 */
const handleSelectChange = (val) => {
const handleSelectChange = (val, scope) => {
//暂时不处理,因为未保存会出现清空的场景,需要先存下之前的值。
let label = allDataLabelList.value.find(label => label.guid == val);
if (label) {
scope.row.labelTypeCode = label.labelTypeCode;
scope.row.labelTypeName = label.labelTypeName;
scope.row.labelName = label.labelName;
} else {
scope.row.labelTypeCode = null;
scope.row.labelTypeName = null;
scope.row.labelName = null;
}
}
const sensitiveTableSelectable = (row, index) => {
return row.confirmStatus == 'N';
// return row.confirmStatus == 'N';
return true;
}
const selectTableFieldRows: any = ref([]);
......@@ -400,6 +439,10 @@ const handleFieldClickEdit = (scope) => {
}
const handleFieldClickSave = (scope) => {
if (!scope.row.labelGuid) {
proxy.$ElMessage.error('字段的标签不能为空');
return;
}
let labelName = '';
let labelTypeCode = '';
if (scope.row.labelGuid) {
......@@ -421,7 +464,7 @@ const handleFieldClickSave = (scope) => {
getSensitiveTableFieldData();
getSensitiveFieldLabelData();
getCntSumInfo();
proxy.$ElMessage.success('标签修改成功');
proxy.$ElMessage.success('字段的标签修改成功');
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -441,7 +484,7 @@ const pageChange = (info) => {
}
if (toChange) {
ElMessageBox.confirm(
'存在未保存的数据,切换后会丢失,是否确定切换',
'存在未保存的数据,确定放弃修改吗?',
'提示',
{
confirmButtonText: '确定',
......@@ -456,19 +499,53 @@ const pageChange = (info) => {
}
}
const cancel = () => {
if (checkTableSave()) {
proxy.$openMessageBox("当前页面存在未保存的数据,确定放弃修改吗?", () => {
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'sensitiveIdentify'
});
}, () => {
proxy.$ElMessage.info("已取消");
});
} else {
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'sensitiveIdentify'
});
}
}
const pageConfirm = () => {
fullScreenLoading.value = true;
confirmTaskStatus(route.query.execGuid).then((res: any) => {
fullScreenLoading.value = false;
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('确认成功');
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'sensitiveIdentify'
});
} else {
proxy.$ElMessage.error(res.msg);
}
})
}
</script>
<template>
<div class="container_wrap full flex">
<div class="aside_wrap">
<div class="container_wrap full flex" v-loading="fullScreenLoading">
<div class="aside_wrap" :style="{ height: isLook ? '100%' : 'calc(100% - 40px)' }">
<div class="aside_title">数据表列表</div>
<Tree ref="treeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" />
</div>
<div class="main_wrap">
<div class="main_wrap" :style="{ height: isLook ? '100%' : 'calc(100% - 40px)' }">
<div class="table_tool_wrap">
<div class="tools_btns">
<el-button v-if="!isLook" type="primary" @click="batchConfirm">批量确认</el-button>
<div class="cnt-desc">{{ '表总数:' + changeNum(cntSumInfo.tableNum || 0, 0) + '张 敏感表总数:' +
<div v-show="!sensitiveTableDataLoading" class="cnt-desc">{{ '表总数:' + changeNum(cntSumInfo.tableNum || 0, 0) + '张 敏感表总数:' +
changeNum(cntSumInfo.sensitiveTableNum || 0, 0) + '张 字段总数:'
+ changeNum(cntSumInfo.fieldNum || 0, 0) + '个 敏感字段总数:' + changeNum(cntSumInfo.sensitiveFieldNum || 0, 0) +
'个,其中直接标识:' +
......@@ -487,10 +564,11 @@ const pageChange = (info) => {
'max-height': 'calc(100% - 16px)',
display: 'inline-block',
}">
<el-table-column type="selection" v-if="!isLook" :selectable="sensitiveTableSelectable" :width="32" align="center" />
<el-table-column type="selection" v-if="!isLook" :selectable="sensitiveTableSelectable" :width="32"
align="center" />
<el-table-column label="序号" type="index" width="56px" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column label="字段中文名" prop="fieldChName" width="140" align="left" show-overflow-tooltip>
<el-table-column label="字段中文名" prop="fieldChName" width="160" align="left" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row.fieldChName || '--' }}</span>
</template>
......@@ -510,7 +588,7 @@ const pageChange = (info) => {
<template #default="scope">
<el-select-v2 v-if="scope.row['isEdit']" v-model="scope.row['labelGuid']" filterable
:options="allDataLabelList" placeholder="请选择" clearable :props="{ value: 'guid', label: 'labelName' }"
@change="handleSelectChange" />
@change="(val) => handleSelectChange(val, scope)" />
<span v-else>{{ scope.row["labelName"] || '--' }}</span>
</template>
</el-table-column>
......@@ -552,13 +630,20 @@ const pageChange = (info) => {
<PageNav :pageInfo="pageInfo" @pageChange="pageChange" />
</div>
</div>
<div class="bottom_tool_wrap">
<el-button @click="cancel" v-preReClick>取消</el-button>
<el-button type="primary" @click="pageConfirm" v-preReClick>确认</el-button>
</div>
</div>
</template>
<style lang="scss" scoped>
.container_wrap {
flex-wrap: wrap;
.aside_wrap {
width: 200px;
height: calc(100% - 40px);
}
.table_tool_wrap {
......@@ -568,6 +653,16 @@ const pageChange = (info) => {
.table_panel_wrap {
height: calc(100% - 70px);
}
.bottom_tool_wrap {
height: 40px;
width: 100%;
padding: 0 16px;
border-top: 1px solid #d9d9d9;
display: flex;
justify-content: center;
align-items: center;
}
}
.tree_panel {
......
......@@ -9,8 +9,9 @@ import Table from "@/components/Table/index.vue";
import { ElMessage } from "element-plus";
import { commonPageConfig } from '@/components/PageNav/index';
import {
getSensitiveDataTaskExecLog,
getSensitiveDataTaskExecLog,
} from '@/api/modules/dataAnonymization';
import { TableColumnWidth } from "@/utils/enum";
const { proxy } = getCurrentInstance() as any;
......@@ -28,17 +29,13 @@ const tableInfo = ref({
id: "word-log-table",
loading: false,
fields: [
{ label: "报告名称", field: "analysisReportName", width: 230 },
{
label: "方案类型", field: "analysisReportType", width: 100, getName: (scope) => {
let planType = scope.row.analysisReportType;
return planType == 1 ? '表' : (planType == 2 ? '数据库' : (planType == 4 ? '数据同步' : '分组'));
}
},
{ label: "报告对象", field: "qualityModelName", width: 180, },
{ label: "质量评分", field: "qualityScore", width: 100, align: "right" },
{ label: "最后执行时间", field: "execTime", width: 180, },
{ label: "执行状态", field: "execResult", type: "tag", width: 120, align: "center" },
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "执行人", field: "createUserName", width: TableColumnWidth.USERNAME },
{ label: "执行时间", field: "execTime", width: TableColumnWidth.DATETIME },
{ label: "执行状态", field: "sensitiveIdentifyTaskStatus", width: TableColumnWidth.STATE, align: 'center', type: "tag" },
{ label: "确认人", field: "confirmUserName", width: TableColumnWidth.USERNAME },
{ label: "确认时间", field: "confirmTime", width: TableColumnWidth.DATETIME },
{ label: "确认状态", field: "sensitiveIdentifyConfirmStatus", width: TableColumnWidth.STATE, align: 'center', type: "tag" },
],
data: [],
page: {
......@@ -52,7 +49,19 @@ const tableInfo = ref({
width: 100,
fixed: 'right',
btns: (scope) => {
return [{ label: "查看报告", value: "reportView", disabled: scope.row['execResult'] != 'Y' }];
return [{
label: "查看", value: "report", disabled: scope.row['status'] != 'Y', click: (scope) => {
router.push({
name: 'sensitiveIdentifyConfig',
query: {
guid: route.query.guid,
execGuid: scope.row.guid,
taskName: route.query.name,
isLook: '1',
}
});
}
}];
}
}
});
......@@ -63,7 +72,11 @@ const getTableData = () => {
tableInfo.value.loading = false;
if (res?.code == proxy.$passCode) {
const data = res.data || {}
tableInfo.value.data = data.records || []
tableInfo.value.data = data.records?.map(d => {
d.sensitiveIdentifyTaskStatus = d.status;
d.sensitiveIdentifyConfirmStatus = d.confirmStatus;
return d;
}) || []
tableInfo.value.page.limit = data.pageSize
tableInfo.value.page.curr = data.pageIndex
tableInfo.value.page.rows = data.totalRows
......@@ -88,7 +101,7 @@ const tableBtnClick = (scope, btn) => {
}
};
onBeforeMount(() => {
onActivated(() => {
getTableData();
});
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!