Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2aa70cc4
authored
2025-09-05 17:04:56 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
匿名化处理接口联调2
1 parent
fd5bd230
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
8 deletions
src/store/modules/dataAnonymization.ts
src/views/data_anonymization/anonResultView.vue
src/views/data_anonymization/anonTaskCreate.vue
src/views/data_anonymization/anonTaskStepTwo.vue
src/views/data_anonymization/resultProcess.vue
src/store/modules/dataAnonymization.ts
View file @
2aa70cc
const
useDataAnonymizationStore
=
defineStore
(
// 资产目录guid
"isRefresh"
,
'isRefresh'
,
()
=>
{
const
isRefresh
=
ref
<
boolean
>
(
false
);
function
setIsRefresh
(
v
:
boolean
)
{
isRefresh
.
value
=
v
;
}
const
isAnonPageRefresh
=
ref
<
boolean
>
(
false
);
function
setIsAnonPageRefresh
(
v
:
boolean
)
{
isAnonPageRefresh
.
value
=
v
;
}
return
{
isRefresh
,
isAnonPageRefresh
,
setIsRefresh
,
setIsAnonPageRefresh
,
};
}
);
...
...
src/views/data_anonymization/anonResultView.vue
View file @
2aa70cc
...
...
@@ -38,6 +38,7 @@ const tableFields: any = ref([]);
const
pageInfo
:
any
=
ref
({
...
commonPageConfig
,
rows
:
0
,
})
const
getData
=
()
=>
{
...
...
@@ -61,6 +62,7 @@ const getData = () => {
});
tableData
.
value
.
push
(
obj
);
});
pageInfo
.
value
.
rows
=
res
.
data
?.
totalRows
??
0
;
}
else
{
ElMessage
.
error
(
res
.
msg
);
}
...
...
@@ -128,6 +130,7 @@ watch(() => props.execGuid, (val) => {
if
(
res
.
code
==
proxy
.
$passCode
)
{
let
column
=
res
.
data
?.
column
||
{};
tableFields
.
value
=
column
;
pageInfo
.
value
.
curr
=
1
;
getData
();
}
else
{
ElMessage
.
error
(
res
.
msg
);
...
...
@@ -210,7 +213,7 @@ const exportData = () => {
<el-button
v-show=
"props.isPage"
style=
"margin-bottom: 8px;"
type=
"primary"
@
click=
"exportData"
v-preReClick
>
导出数据
</el-button>
<el-table
ref=
"tableRef"
v-show=
"tableFields.length"
:data=
"tableData"
:highlight-current-row=
"true"
stripe
border
tooltip-effect=
"light"
height=
"100%"
row-key=
"guid"
:style=
"
{ width: '100%', height: 'calc(100% - 64px)' }">
tooltip-effect=
"light"
height=
"100%"
row-key=
"guid"
:style=
"
{ width: '100%', height:
!props.isPage ? 'calc(100% - 34px)' :
'calc(100% - 64px)' }">
<template
v-for=
"(item, index) in (tableFields || [])"
>
<el-table-column
:label=
"item.chName"
:width=
"item.dataType === 'datetime'
? TableColumnWidth.DATETIME
...
...
src/views/data_anonymization/anonTaskCreate.vue
View file @
2aa70cc
This diff is collapsed.
Click to expand it.
src/views/data_anonymization/anonTaskStepTwo.vue
View file @
2aa70cc
...
...
@@ -12,6 +12,7 @@ import {
validateAnonRule
,
}
from
'@/api/modules/dataAnonymization'
;
import
{
useValidator
}
from
'@/hooks/useValidator'
;
import
{
cloneDeep
}
from
'lodash-es'
;
const
props
=
defineProps
({
fieldTypeList
:
{
...
...
@@ -460,7 +461,7 @@ const drawerBtnClick = async (btn, info) => {
proxy
.
$ElMessage
.
error
(
'K匿名泛化与脱敏规则不能同时为空'
);
return
;
}
if
((
info
.
fieldTypeCode
==
'int'
||
info
.
fieldTypeCode
==
'decimal'
||
info
.
fieldTypeCode
==
'tinyint'
))
{
if
(
!
(
info
.
fieldTypeCode
==
'int'
||
info
.
fieldTypeCode
==
'decimal'
||
info
.
fieldTypeCode
==
'tinyint'
))
{
if
(
info
.
desensitiveRuleCode
==
'ROUNDING'
)
{
proxy
.
$ElMessage
.
error
(
'数值类型字段的脱敏规则不能设置取整'
);
return
;
...
...
@@ -1037,7 +1038,7 @@ const getStepTwoConfigInfo = async () => {
await
privacyFormRef
.
value
?.
ruleFormRef
?.
validate
();
// 验证通过
return
{
anonPrivacyMode
:
privacyFormRef
.
value
?.
formInline
,
anonPrivacyMode
:
cloneDeep
(
privacyFormRef
.
value
?.
formInline
)
,
anonTaskRules
:
ruleModelTableInfo
.
value
.
data
};
}
catch
(
error
)
{
...
...
@@ -1046,8 +1047,43 @@ const getStepTwoConfigInfo = async () => {
}
}
/** 字段改变,可能是切换了表,需要清空规则配置。判断 第一步到第二步时,如果字段列表中与字段脱敏规则中的字段不匹配,应清空,并同时清空T接近字段。 */
const
updateNextStepRules
=
()
=>
{
let
deleteFieldNames
:
string
[]
=
[];
ruleModelTableInfo
.
value
.
data
=
ruleModelTableInfo
.
value
.
data
.
filter
(
rule
=>
{
if
(
!
props
.
fieldNameList
?.
some
(
v
=>
v
.
enName
==
rule
.
fieldName
))
{
deleteFieldNames
.
push
(
rule
.
fieldName
);
return
false
;
}
return
true
;
});
if
(
deleteFieldNames
?.
length
)
{
let
optionsList
=
ruleModelTableInfo
.
value
.
data
?.
map
(
v
=>
{
return
{
fieldName
:
v
.
fieldName
,
fieldChName
:
v
.
fieldChName
}
})
||
[];
privacyFormItems
.
value
[
2
].
children
[
0
].
options
=
optionsList
;
privacyFormItems
.
value
[
3
].
children
[
0
].
options
=
optionsList
;
let
formInline
=
privacyFormRef
.
value
?.
formInline
;
privacyFormItems
.
value
.
forEach
((
item
,
index
)
=>
{
item
.
default
=
formInline
[
item
.
field
];
if
(
item
.
default
==
'Y'
)
{
item
.
children
?.
forEach
(
child
=>
{
child
.
default
=
formInline
[
child
.
field
];
if
((
child
.
field
==
'tcFieldName'
||
child
.
field
==
'ldFieldName'
)
&&
deleteFieldNames
.
includes
(
child
.
default
))
{
child
.
default
=
''
}
});
}
})
}
}
defineExpose
({
getStepTwoConfigInfo
getStepTwoConfigInfo
,
updateNextStepRules
})
</
script
>
...
...
src/views/data_anonymization/resultProcess.vue
View file @
2aa70cc
...
...
@@ -12,7 +12,9 @@ import {
deleteAnonTask
,
}
from
'@/api/modules/dataAnonymization'
;
import
{
useValidator
}
from
'@/hooks/useValidator'
;
import
useDataAnonymizationStore
from
"@/store/modules/dataAnonymization"
;
const
anonymizationStore
=
useDataAnonymizationStore
();
const
router
=
useRouter
()
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
{
required
}
=
useValidator
();
...
...
@@ -70,8 +72,8 @@ const tableInfo = ref({
width
:
180
,
fixed
:
'right'
,
btns
:
(
scope
)
=>
{
return
[
{
label
:
"编辑"
,
value
:
"edit"
,
disabled
:
scope
.
row
.
status
==
'R'
,
click
:
(
scope
)
=>
{
return
[{
label
:
"编辑"
,
value
:
"edit"
,
click
:
(
scope
)
=>
{
router
.
push
({
name
:
'anonTaskCreate'
,
query
:
{
...
...
@@ -92,11 +94,12 @@ const tableInfo = ref({
});
}
},
{
label
:
"删除"
,
value
:
"delete"
,
disabled
:
scope
.
row
.
status
==
'R'
,
click
:
(
scope
)
=>
{
label
:
"删除"
,
value
:
"delete"
,
click
:
(
scope
)
=>
{
proxy
.
$openMessageBox
(
"此操作将永久删除, 是否继续?"
,
()
=>
{
let
guids
=
[
scope
.
row
.
guid
];
deleteAnonTask
(
guids
).
then
((
res
:
any
)
=>
{
if
(
res
?.
code
==
proxy
.
$passCode
)
{
page
.
value
.
curr
=
1
;
getTableData
();
proxy
.
$ElMessage
({
type
:
"success"
,
...
...
@@ -169,8 +172,17 @@ const handleCreate = () => {
onBeforeMount
(()
=>
{
toSearch
({});
anonymizationStore
.
setIsAnonPageRefresh
(
false
);
})
onActivated
(()
=>
{
if
(
anonymizationStore
.
isAnonPageRefresh
)
{
//如果是首次加载,则不需要调用
page
.
value
.
curr
=
1
;
getTableData
();
anonymizationStore
.
setIsAnonPageRefresh
(
false
);
}
});
</
script
>
<
template
>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment