28477bee by lihua

筛选实现

1 parent 28435152
......@@ -159,8 +159,8 @@ export const getExecSensitiveFieldTable = (params) => request({
})
/** 获取当前数据表下的执行字段 */
export const getExecSensitiveFieldLabel = (params) => request({
url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/get-exec-sensitive-label`,
export const getExecSensitiveFieldColumnListByCondition = (params) => request({
url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/column-list-by-condition`,
method: 'post',
data: params
})
......
......@@ -50,9 +50,9 @@ const dataProps = computed(() => {
const initAttr = () => {
const data = props.popoverInfo.data ?? []
const check = props.popoverInfo.checked ?? []
checkedVal.value = check
checkAll.value = data.length > 0 && data.length == check.length;
isIndeterminate.value = check.length > 0 && data.length > check.length
checkedVal.value = check;
checkAll.value = data.length > 0 && data.length == check?.filter(c => data.some(d => d.guid == c))?.length;
isIndeterminate.value = !checkAll.value && (check.length > 0 && data.length > check.length)
authorities.value = data
}
......@@ -70,9 +70,9 @@ const handleCheckAllChange = (val) => {
isIndeterminate.value = false;
};
const handleCheckedCitiesChange = (val) => {
const checkedCount = val.length;
checkAll.value = checkedCount === authorities.value.length;
isIndeterminate.value = checkedCount > 0 && checkedCount < authorities.value.length;
const checkedCount = val?.filter(c => authorities.value.some(d => d.guid == c))?.length;
checkAll.value = checkedCount > 0 && checkedCount === authorities.value.length;
isIndeterminate.value = !checkAll.value && (checkedCount > 0 && checkedCount < authorities.value.length);
};
const showPopver = () => {
inputValue.value = '';
......@@ -116,7 +116,7 @@ watch(() => props.popoverInfo, async (val) => {
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">
全选
</el-checkbox>
<span>已选<span style="color: #4fa1a4; margin: 0 2px;">{{ checkedVal.length }}</span></span>
<span>已选<span style="color: #4fa1a4; margin: 0 2px;">{{ checkedVal?.filter(c => authorities.some(d => d.guid == c))?.length }}</span></span>
</div>
<el-button size="small" type="primary" @click="btnClick" v-preReClick>确定</el-button>
</div>
......
......@@ -6,7 +6,7 @@
import {
getExecSensitiveTable,
getExecSensitiveFieldTable,
getExecSensitiveFieldLabel,
getExecSensitiveFieldColumnListByCondition,
getDataLabelList,
getStatisticsNum,
getParamsList,
......@@ -56,7 +56,7 @@ const nodeClick = (data, node) => {
let exec = () => {
pageInfo.value.labelGuids = [];
pageInfo.value.labelTypeCodes = [];
pageInfo.value.confirmStatus = '';
pageInfo.value.confirmStatus = [];
treeInfo.value.currentNodeKey = data.value;
treeInfo.value.currentObj = data;
if (data.parent) {
......@@ -213,6 +213,9 @@ const labelList = ref([]);
/** 标签类型的字典列表 */
const labelTypeList: any = ref([]);
/** 查询数据的标签类型列表 */
const labelTypeDataList: any = ref([]);
/** 分页设置 */
const pageInfo = ref({
...commonPageConfig,
......@@ -222,7 +225,7 @@ const pageInfo = ref({
rows: 0,
labelGuids: [], //列头筛选
labelTypeCodes: [],
confirmStatus: ''
confirmStatus: []
});
/** 敏感数据 */
......@@ -232,7 +235,7 @@ const sensitiveTableDataLoading = ref(false);
const getSensitiveTableFieldData = () => {
sensitiveTableDataLoading.value = true;
let confirmStatus: any = [];
let confirmStatus = pageInfo.value.confirmStatus || [];
getExecSensitiveFieldTable({
pageIndex: pageInfo.value.curr,
pageSize: pageInfo.value.limit,
......@@ -260,18 +263,46 @@ const getSensitiveTableFieldData = () => {
}
/** 获取当前选中的左侧库表下对应的数据标签数组,做列头筛选时使用。 */
const getSensitiveFieldLabelData = () => {
getExecSensitiveFieldLabel({
const getSensitiveFieldLabelData = (info?: {
filterLabel?: Boolean,
filterType?: Boolean,
filterStatus?: Boolean,
setLable?: Boolean,
setType?: Boolean,
setStatus?: Boolean
}) => {
getExecSensitiveFieldColumnListByCondition({
pageSize: -1,
taskExecGuid: pageInfo.value.taskExecGuid,
databaseName: pageInfo.value.databaseName,
tableName: pageInfo.value.tableName
tableName: pageInfo.value.tableName,
labelGuids: !info?.filterLabel ? [] : pageInfo.value.labelGuids,
labelTypeCodes: !info?.filterType ? [] : pageInfo.value.labelTypeCodes,
confirmStatus: !info?.filterStatus ? [] : pageInfo.value.confirmStatus
}).then((res: any) => {
if (res?.code == proxy.$passCode) {
labelList.value = res.data?.map(d => {
let data = res.data || {};
(info?.setLable !== false || !pageInfo.value.labelGuids?.length) && (labelList.value = data['标签']?.map(d => {
d.guid = d.labelGuid;
if (!d.labelGuid && !d.labelName) {
d.guid = `${d.labelGuid}`;
d.labelName = '--';
}
return d;
}) || [];
}) || []);
(info?.setType !== false || !pageInfo.value.labelTypeCodes?.length) && (labelTypeDataList.value = data['标签类型']?.map(d => {
d.guid = d.labelTypeCode;
if (!d.labelTypeCode) {
d.guid = `${d.labelTypeCode}`;
d.labelTypeName = '--';
}
return d;
}) || [])
(info?.setStatus !== false || !pageInfo.value.confirmStatus?.length) && (confirmStatusList.value = data['确认状态']?.map(d => {
d.guid = d.confirmStatus;
d.label = d.confirmStatus == 'Y' ? '已确认' : '未确认';
return d;
}) || [])
} else {
proxy.$ElMessage({
type: 'error',
......@@ -315,18 +346,34 @@ const handleLabelPopoverClick = (scope) => {
pageInfo.value.labelGuids = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: false,
setStatus: true,
setType: true
});
})
} else {
pageInfo.value.labelGuids = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: false,
setStatus: true,
setType: true
});
}
}
const popoverLabelTypeListInfo = computed(() => {
return {
type: 'checkbox-list-btns',
data: labelTypeList.value,
data: labelTypeDataList.value,
placeholder: '请输入关键字搜索',
scope: {
row: {}
......@@ -334,7 +381,7 @@ const popoverLabelTypeListInfo = computed(() => {
placement: 'right-start',
props: {
value: 'guid',
label: 'label'
label: 'labelTypeName'
},
checked: pageInfo.value.labelTypeCodes,
btn: {
......@@ -357,18 +404,36 @@ const handleLabelTypePopoverClick = (scope) => {
pageInfo.value.labelTypeCodes = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: true,
setStatus: true,
setType: false
});
})
} else {
pageInfo.value.labelTypeCodes = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: true,
setStatus: true,
setType: false
});
}
}
const confirmStatusList: any = ref([]);
const popoverStatusListInfo = computed(() => {
return {
type: 'checkbox-list-btns',
data: [{
data: confirmStatusList.value || [{
guid: 'N',
label: '待确认'
}, {
......@@ -405,11 +470,27 @@ const handleStatusPopoverClick = (scope) => {
pageInfo.value.confirmStatus = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: true,
setStatus: false,
setType: true
});
})
} else {
pageInfo.value.confirmStatus = scope.row.selectedData || [];
pageInfo.value.curr = 1;
getSensitiveTableFieldData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true,
setLable: true,
setStatus: false,
setType: true
});
}
}
......@@ -464,7 +545,11 @@ const handleFieldClickSave = (scope) => {
sensitiveTableDataLoading.value = false;
if (res?.code == proxy.$passCode) {
getSensitiveTableFieldData();
getSensitiveFieldLabelData();
getSensitiveFieldLabelData({
filterLabel: true,
filterStatus: true,
filterType: true
});
getCntSumInfo();
proxy.$ElMessage.success('字段的标签修改成功');
} else {
......@@ -589,7 +674,7 @@ const cntLabelMap = ref({
<span>{{ scope.row.fieldChName || '--' }}</span>
</template>
</el-table-column>
<el-table-column label="字段英文名" prop="fieldName" width="140" align="left" show-overflow-tooltip>
<el-table-column label="字段英文名" prop="fieldName" width="150" align="left" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row.fieldName || '--' }}</span>
</template>
......@@ -598,7 +683,7 @@ const cntLabelMap = ref({
show-overflow-tooltip>
<template #header>
<span>标签</span>
<BtnPopover v-if="labelList.length" :popoverInfo="popoverLabelListInfo"
<BtnPopover v-show="labelList.length" :popoverInfo="popoverLabelListInfo"
@popverBtnClick="handleLabelPopoverClick" />
</template>
<template #default="scope">
......@@ -617,7 +702,7 @@ const cntLabelMap = ref({
show-overflow-tooltip>
<template #header>
<span>标签类型</span>
<BtnPopover v-if="labelTypeList.length" :popoverInfo="popoverLabelTypeListInfo"
<BtnPopover v-show="labelTypeDataList.length" :popoverInfo="popoverLabelTypeListInfo"
@popverBtnClick="handleLabelTypePopoverClick" />
</template>
<template #default="scope">
......@@ -626,13 +711,15 @@ const cntLabelMap = ref({
</el-table-column>
<el-table-column label="所属表名" prop="tableChName" width="140" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column v-if="dataSource == 1" label="所属表英文名" prop="tableName" width="140" align="left" show-overflow-tooltip>
<el-table-column v-if="dataSource == 1" label="所属表英文名" prop="tableName" width="140" align="left"
show-overflow-tooltip>
</el-table-column>
<el-table-column label="确认状态" prop="confirmStatus" class-name="filter-cell" width="120" align="center"
show-overflow-tooltip>
<template #header>
<span>确认状态</span>
<BtnPopover :popoverInfo="popoverStatusListInfo" @popverBtnClick="handleStatusPopoverClick" />
<BtnPopover v-show="confirmStatusList.length" :popoverInfo="popoverStatusListInfo"
@popverBtnClick="handleStatusPopoverClick" />
</template>
<template #default="scope">
<el-tag v-if="scope.row.confirmStatus != null"
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!