28477bee by lihua

筛选实现

1 parent 28435152
...@@ -159,8 +159,8 @@ export const getExecSensitiveFieldTable = (params) => request({ ...@@ -159,8 +159,8 @@ export const getExecSensitiveFieldTable = (params) => request({
159 }) 159 })
160 160
161 /** 获取当前数据表下的执行字段 */ 161 /** 获取当前数据表下的执行字段 */
162 export const getExecSensitiveFieldLabel = (params) => request({ 162 export const getExecSensitiveFieldColumnListByCondition = (params) => request({
163 url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/get-exec-sensitive-label`, 163 url: `${import.meta.env.VITE_APP_ANONYMIZATION_BASEURL}/sensitive-data-task/column-list-by-condition`,
164 method: 'post', 164 method: 'post',
165 data: params 165 data: params
166 }) 166 })
......
...@@ -50,9 +50,9 @@ const dataProps = computed(() => { ...@@ -50,9 +50,9 @@ const dataProps = computed(() => {
50 const initAttr = () => { 50 const initAttr = () => {
51 const data = props.popoverInfo.data ?? [] 51 const data = props.popoverInfo.data ?? []
52 const check = props.popoverInfo.checked ?? [] 52 const check = props.popoverInfo.checked ?? []
53 checkedVal.value = check 53 checkedVal.value = check;
54 checkAll.value = data.length > 0 && data.length == check.length; 54 checkAll.value = data.length > 0 && data.length == check?.filter(c => data.some(d => d.guid == c))?.length;
55 isIndeterminate.value = check.length > 0 && data.length > check.length 55 isIndeterminate.value = !checkAll.value && (check.length > 0 && data.length > check.length)
56 authorities.value = data 56 authorities.value = data
57 } 57 }
58 58
...@@ -70,9 +70,9 @@ const handleCheckAllChange = (val) => { ...@@ -70,9 +70,9 @@ const handleCheckAllChange = (val) => {
70 isIndeterminate.value = false; 70 isIndeterminate.value = false;
71 }; 71 };
72 const handleCheckedCitiesChange = (val) => { 72 const handleCheckedCitiesChange = (val) => {
73 const checkedCount = val.length; 73 const checkedCount = val?.filter(c => authorities.value.some(d => d.guid == c))?.length;
74 checkAll.value = checkedCount === authorities.value.length; 74 checkAll.value = checkedCount > 0 && checkedCount === authorities.value.length;
75 isIndeterminate.value = checkedCount > 0 && checkedCount < authorities.value.length; 75 isIndeterminate.value = !checkAll.value && (checkedCount > 0 && checkedCount < authorities.value.length);
76 }; 76 };
77 const showPopver = () => { 77 const showPopver = () => {
78 inputValue.value = ''; 78 inputValue.value = '';
...@@ -116,7 +116,7 @@ watch(() => props.popoverInfo, async (val) => { ...@@ -116,7 +116,7 @@ watch(() => props.popoverInfo, async (val) => {
116 <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange"> 116 <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">
117 全选 117 全选
118 </el-checkbox> 118 </el-checkbox>
119 <span>已选<span style="color: #4fa1a4; margin: 0 2px;">{{ checkedVal.length }}</span></span> 119 <span>已选<span style="color: #4fa1a4; margin: 0 2px;">{{ checkedVal?.filter(c => authorities.some(d => d.guid == c))?.length }}</span></span>
120 </div> 120 </div>
121 <el-button size="small" type="primary" @click="btnClick" v-preReClick>确定</el-button> 121 <el-button size="small" type="primary" @click="btnClick" v-preReClick>确定</el-button>
122 </div> 122 </div>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
6 import { 6 import {
7 getExecSensitiveTable, 7 getExecSensitiveTable,
8 getExecSensitiveFieldTable, 8 getExecSensitiveFieldTable,
9 getExecSensitiveFieldLabel, 9 getExecSensitiveFieldColumnListByCondition,
10 getDataLabelList, 10 getDataLabelList,
11 getStatisticsNum, 11 getStatisticsNum,
12 getParamsList, 12 getParamsList,
...@@ -56,7 +56,7 @@ const nodeClick = (data, node) => { ...@@ -56,7 +56,7 @@ const nodeClick = (data, node) => {
56 let exec = () => { 56 let exec = () => {
57 pageInfo.value.labelGuids = []; 57 pageInfo.value.labelGuids = [];
58 pageInfo.value.labelTypeCodes = []; 58 pageInfo.value.labelTypeCodes = [];
59 pageInfo.value.confirmStatus = ''; 59 pageInfo.value.confirmStatus = [];
60 treeInfo.value.currentNodeKey = data.value; 60 treeInfo.value.currentNodeKey = data.value;
61 treeInfo.value.currentObj = data; 61 treeInfo.value.currentObj = data;
62 if (data.parent) { 62 if (data.parent) {
...@@ -213,6 +213,9 @@ const labelList = ref([]); ...@@ -213,6 +213,9 @@ const labelList = ref([]);
213 /** 标签类型的字典列表 */ 213 /** 标签类型的字典列表 */
214 const labelTypeList: any = ref([]); 214 const labelTypeList: any = ref([]);
215 215
216 /** 查询数据的标签类型列表 */
217 const labelTypeDataList: any = ref([]);
218
216 /** 分页设置 */ 219 /** 分页设置 */
217 const pageInfo = ref({ 220 const pageInfo = ref({
218 ...commonPageConfig, 221 ...commonPageConfig,
...@@ -222,7 +225,7 @@ const pageInfo = ref({ ...@@ -222,7 +225,7 @@ const pageInfo = ref({
222 rows: 0, 225 rows: 0,
223 labelGuids: [], //列头筛选 226 labelGuids: [], //列头筛选
224 labelTypeCodes: [], 227 labelTypeCodes: [],
225 confirmStatus: '' 228 confirmStatus: []
226 }); 229 });
227 230
228 /** 敏感数据 */ 231 /** 敏感数据 */
...@@ -232,7 +235,7 @@ const sensitiveTableDataLoading = ref(false); ...@@ -232,7 +235,7 @@ const sensitiveTableDataLoading = ref(false);
232 235
233 const getSensitiveTableFieldData = () => { 236 const getSensitiveTableFieldData = () => {
234 sensitiveTableDataLoading.value = true; 237 sensitiveTableDataLoading.value = true;
235 let confirmStatus: any = []; 238 let confirmStatus = pageInfo.value.confirmStatus || [];
236 getExecSensitiveFieldTable({ 239 getExecSensitiveFieldTable({
237 pageIndex: pageInfo.value.curr, 240 pageIndex: pageInfo.value.curr,
238 pageSize: pageInfo.value.limit, 241 pageSize: pageInfo.value.limit,
...@@ -260,18 +263,46 @@ const getSensitiveTableFieldData = () => { ...@@ -260,18 +263,46 @@ const getSensitiveTableFieldData = () => {
260 } 263 }
261 264
262 /** 获取当前选中的左侧库表下对应的数据标签数组,做列头筛选时使用。 */ 265 /** 获取当前选中的左侧库表下对应的数据标签数组,做列头筛选时使用。 */
263 const getSensitiveFieldLabelData = () => { 266 const getSensitiveFieldLabelData = (info?: {
264 getExecSensitiveFieldLabel({ 267 filterLabel?: Boolean,
268 filterType?: Boolean,
269 filterStatus?: Boolean,
270 setLable?: Boolean,
271 setType?: Boolean,
272 setStatus?: Boolean
273 }) => {
274 getExecSensitiveFieldColumnListByCondition({
265 pageSize: -1, 275 pageSize: -1,
266 taskExecGuid: pageInfo.value.taskExecGuid, 276 taskExecGuid: pageInfo.value.taskExecGuid,
267 databaseName: pageInfo.value.databaseName, 277 databaseName: pageInfo.value.databaseName,
268 tableName: pageInfo.value.tableName 278 tableName: pageInfo.value.tableName,
279 labelGuids: !info?.filterLabel ? [] : pageInfo.value.labelGuids,
280 labelTypeCodes: !info?.filterType ? [] : pageInfo.value.labelTypeCodes,
281 confirmStatus: !info?.filterStatus ? [] : pageInfo.value.confirmStatus
269 }).then((res: any) => { 282 }).then((res: any) => {
270 if (res?.code == proxy.$passCode) { 283 if (res?.code == proxy.$passCode) {
271 labelList.value = res.data?.map(d => { 284 let data = res.data || {};
285 (info?.setLable !== false || !pageInfo.value.labelGuids?.length) && (labelList.value = data['标签']?.map(d => {
272 d.guid = d.labelGuid; 286 d.guid = d.labelGuid;
287 if (!d.labelGuid && !d.labelName) {
288 d.guid = `${d.labelGuid}`;
289 d.labelName = '--';
290 }
273 return d; 291 return d;
274 }) || []; 292 }) || []);
293 (info?.setType !== false || !pageInfo.value.labelTypeCodes?.length) && (labelTypeDataList.value = data['标签类型']?.map(d => {
294 d.guid = d.labelTypeCode;
295 if (!d.labelTypeCode) {
296 d.guid = `${d.labelTypeCode}`;
297 d.labelTypeName = '--';
298 }
299 return d;
300 }) || [])
301 (info?.setStatus !== false || !pageInfo.value.confirmStatus?.length) && (confirmStatusList.value = data['确认状态']?.map(d => {
302 d.guid = d.confirmStatus;
303 d.label = d.confirmStatus == 'Y' ? '已确认' : '未确认';
304 return d;
305 }) || [])
275 } else { 306 } else {
276 proxy.$ElMessage({ 307 proxy.$ElMessage({
277 type: 'error', 308 type: 'error',
...@@ -315,18 +346,34 @@ const handleLabelPopoverClick = (scope) => { ...@@ -315,18 +346,34 @@ const handleLabelPopoverClick = (scope) => {
315 pageInfo.value.labelGuids = scope.row.selectedData || []; 346 pageInfo.value.labelGuids = scope.row.selectedData || [];
316 pageInfo.value.curr = 1; 347 pageInfo.value.curr = 1;
317 getSensitiveTableFieldData(); 348 getSensitiveTableFieldData();
349 getSensitiveFieldLabelData({
350 filterLabel: true,
351 filterStatus: true,
352 filterType: true,
353 setLable: false,
354 setStatus: true,
355 setType: true
356 });
318 }) 357 })
319 } else { 358 } else {
320 pageInfo.value.labelGuids = scope.row.selectedData || []; 359 pageInfo.value.labelGuids = scope.row.selectedData || [];
321 pageInfo.value.curr = 1; 360 pageInfo.value.curr = 1;
322 getSensitiveTableFieldData(); 361 getSensitiveTableFieldData();
362 getSensitiveFieldLabelData({
363 filterLabel: true,
364 filterStatus: true,
365 filterType: true,
366 setLable: false,
367 setStatus: true,
368 setType: true
369 });
323 } 370 }
324 } 371 }
325 372
326 const popoverLabelTypeListInfo = computed(() => { 373 const popoverLabelTypeListInfo = computed(() => {
327 return { 374 return {
328 type: 'checkbox-list-btns', 375 type: 'checkbox-list-btns',
329 data: labelTypeList.value, 376 data: labelTypeDataList.value,
330 placeholder: '请输入关键字搜索', 377 placeholder: '请输入关键字搜索',
331 scope: { 378 scope: {
332 row: {} 379 row: {}
...@@ -334,7 +381,7 @@ const popoverLabelTypeListInfo = computed(() => { ...@@ -334,7 +381,7 @@ const popoverLabelTypeListInfo = computed(() => {
334 placement: 'right-start', 381 placement: 'right-start',
335 props: { 382 props: {
336 value: 'guid', 383 value: 'guid',
337 label: 'label' 384 label: 'labelTypeName'
338 }, 385 },
339 checked: pageInfo.value.labelTypeCodes, 386 checked: pageInfo.value.labelTypeCodes,
340 btn: { 387 btn: {
...@@ -357,18 +404,36 @@ const handleLabelTypePopoverClick = (scope) => { ...@@ -357,18 +404,36 @@ const handleLabelTypePopoverClick = (scope) => {
357 pageInfo.value.labelTypeCodes = scope.row.selectedData || []; 404 pageInfo.value.labelTypeCodes = scope.row.selectedData || [];
358 pageInfo.value.curr = 1; 405 pageInfo.value.curr = 1;
359 getSensitiveTableFieldData(); 406 getSensitiveTableFieldData();
407 getSensitiveFieldLabelData({
408 filterLabel: true,
409 filterStatus: true,
410 filterType: true,
411 setLable: true,
412 setStatus: true,
413 setType: false
414 });
360 }) 415 })
361 } else { 416 } else {
362 pageInfo.value.labelTypeCodes = scope.row.selectedData || []; 417 pageInfo.value.labelTypeCodes = scope.row.selectedData || [];
363 pageInfo.value.curr = 1; 418 pageInfo.value.curr = 1;
364 getSensitiveTableFieldData(); 419 getSensitiveTableFieldData();
420 getSensitiveFieldLabelData({
421 filterLabel: true,
422 filterStatus: true,
423 filterType: true,
424 setLable: true,
425 setStatus: true,
426 setType: false
427 });
365 } 428 }
366 } 429 }
367 430
431 const confirmStatusList: any = ref([]);
432
368 const popoverStatusListInfo = computed(() => { 433 const popoverStatusListInfo = computed(() => {
369 return { 434 return {
370 type: 'checkbox-list-btns', 435 type: 'checkbox-list-btns',
371 data: [{ 436 data: confirmStatusList.value || [{
372 guid: 'N', 437 guid: 'N',
373 label: '待确认' 438 label: '待确认'
374 }, { 439 }, {
...@@ -405,11 +470,27 @@ const handleStatusPopoverClick = (scope) => { ...@@ -405,11 +470,27 @@ const handleStatusPopoverClick = (scope) => {
405 pageInfo.value.confirmStatus = scope.row.selectedData || []; 470 pageInfo.value.confirmStatus = scope.row.selectedData || [];
406 pageInfo.value.curr = 1; 471 pageInfo.value.curr = 1;
407 getSensitiveTableFieldData(); 472 getSensitiveTableFieldData();
473 getSensitiveFieldLabelData({
474 filterLabel: true,
475 filterStatus: true,
476 filterType: true,
477 setLable: true,
478 setStatus: false,
479 setType: true
480 });
408 }) 481 })
409 } else { 482 } else {
410 pageInfo.value.confirmStatus = scope.row.selectedData || []; 483 pageInfo.value.confirmStatus = scope.row.selectedData || [];
411 pageInfo.value.curr = 1; 484 pageInfo.value.curr = 1;
412 getSensitiveTableFieldData(); 485 getSensitiveTableFieldData();
486 getSensitiveFieldLabelData({
487 filterLabel: true,
488 filterStatus: true,
489 filterType: true,
490 setLable: true,
491 setStatus: false,
492 setType: true
493 });
413 } 494 }
414 } 495 }
415 496
...@@ -464,7 +545,11 @@ const handleFieldClickSave = (scope) => { ...@@ -464,7 +545,11 @@ const handleFieldClickSave = (scope) => {
464 sensitiveTableDataLoading.value = false; 545 sensitiveTableDataLoading.value = false;
465 if (res?.code == proxy.$passCode) { 546 if (res?.code == proxy.$passCode) {
466 getSensitiveTableFieldData(); 547 getSensitiveTableFieldData();
467 getSensitiveFieldLabelData(); 548 getSensitiveFieldLabelData({
549 filterLabel: true,
550 filterStatus: true,
551 filterType: true
552 });
468 getCntSumInfo(); 553 getCntSumInfo();
469 proxy.$ElMessage.success('字段的标签修改成功'); 554 proxy.$ElMessage.success('字段的标签修改成功');
470 } else { 555 } else {
...@@ -589,7 +674,7 @@ const cntLabelMap = ref({ ...@@ -589,7 +674,7 @@ const cntLabelMap = ref({
589 <span>{{ scope.row.fieldChName || '--' }}</span> 674 <span>{{ scope.row.fieldChName || '--' }}</span>
590 </template> 675 </template>
591 </el-table-column> 676 </el-table-column>
592 <el-table-column label="字段英文名" prop="fieldName" width="140" align="left" show-overflow-tooltip> 677 <el-table-column label="字段英文名" prop="fieldName" width="150" align="left" show-overflow-tooltip>
593 <template #default="scope"> 678 <template #default="scope">
594 <span>{{ scope.row.fieldName || '--' }}</span> 679 <span>{{ scope.row.fieldName || '--' }}</span>
595 </template> 680 </template>
...@@ -598,7 +683,7 @@ const cntLabelMap = ref({ ...@@ -598,7 +683,7 @@ const cntLabelMap = ref({
598 show-overflow-tooltip> 683 show-overflow-tooltip>
599 <template #header> 684 <template #header>
600 <span>标签</span> 685 <span>标签</span>
601 <BtnPopover v-if="labelList.length" :popoverInfo="popoverLabelListInfo" 686 <BtnPopover v-show="labelList.length" :popoverInfo="popoverLabelListInfo"
602 @popverBtnClick="handleLabelPopoverClick" /> 687 @popverBtnClick="handleLabelPopoverClick" />
603 </template> 688 </template>
604 <template #default="scope"> 689 <template #default="scope">
...@@ -617,7 +702,7 @@ const cntLabelMap = ref({ ...@@ -617,7 +702,7 @@ const cntLabelMap = ref({
617 show-overflow-tooltip> 702 show-overflow-tooltip>
618 <template #header> 703 <template #header>
619 <span>标签类型</span> 704 <span>标签类型</span>
620 <BtnPopover v-if="labelTypeList.length" :popoverInfo="popoverLabelTypeListInfo" 705 <BtnPopover v-show="labelTypeDataList.length" :popoverInfo="popoverLabelTypeListInfo"
621 @popverBtnClick="handleLabelTypePopoverClick" /> 706 @popverBtnClick="handleLabelTypePopoverClick" />
622 </template> 707 </template>
623 <template #default="scope"> 708 <template #default="scope">
...@@ -626,13 +711,15 @@ const cntLabelMap = ref({ ...@@ -626,13 +711,15 @@ const cntLabelMap = ref({
626 </el-table-column> 711 </el-table-column>
627 <el-table-column label="所属表名" prop="tableChName" width="140" align="left" show-overflow-tooltip> 712 <el-table-column label="所属表名" prop="tableChName" width="140" align="left" show-overflow-tooltip>
628 </el-table-column> 713 </el-table-column>
629 <el-table-column v-if="dataSource == 1" label="所属表英文名" prop="tableName" width="140" align="left" show-overflow-tooltip> 714 <el-table-column v-if="dataSource == 1" label="所属表英文名" prop="tableName" width="140" align="left"
715 show-overflow-tooltip>
630 </el-table-column> 716 </el-table-column>
631 <el-table-column label="确认状态" prop="confirmStatus" class-name="filter-cell" width="120" align="center" 717 <el-table-column label="确认状态" prop="confirmStatus" class-name="filter-cell" width="120" align="center"
632 show-overflow-tooltip> 718 show-overflow-tooltip>
633 <template #header> 719 <template #header>
634 <span>确认状态</span> 720 <span>确认状态</span>
635 <BtnPopover :popoverInfo="popoverStatusListInfo" @popverBtnClick="handleStatusPopoverClick" /> 721 <BtnPopover v-show="confirmStatusList.length" :popoverInfo="popoverStatusListInfo"
722 @popverBtnClick="handleStatusPopoverClick" />
636 </template> 723 </template>
637 <template #default="scope"> 724 <template #default="scope">
638 <el-tag v-if="scope.row.confirmStatus != null" 725 <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!