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
7a8fa58a
authored
2025-01-08 20:55:15 +0800
by
xukangle
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix
1 parent
52790e07
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
353 additions
and
118 deletions
src/api/modules/dataInventory.ts
src/components/Drawer/index.vue
src/views/data_inventory/classifyGradeCatalogue.vue
src/views/data_inventory/configureRules.vue
src/views/data_inventory/tableCreateExisting.vue
src/views/data_inventory/tableCreateFile.vue
src/api/modules/dataInventory.ts
View file @
7a8fa58
...
...
@@ -840,3 +840,14 @@ export const getFidldEnName = (data) => request({
method
:
'post'
,
data
})
/**
* 数据库目录-查询字段分类分级
* @param {Object}
* @path /db-dir/field/get-classify-and-grade
*/
export
const
getFieldClassifyAndGrade
=
(
data
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/field/get-classify-and-grade`
,
method
:
'post'
,
data
})
...
...
src/components/Drawer/index.vue
View file @
7a8fa58
...
...
@@ -99,10 +99,16 @@ const onClickOutside = (e: any) => {
};
const
getDrawerConRef
=
(
refName
)
=>
{
console
.
log
(
refName
,
'----------'
)
if
(
refName
==
'drawerTableRef'
)
{
const
dtf
=
drawerTableRef
.
value
[
0
]
||
drawerTableRef
.
value
return
dtf
?.
tableRef
}
// const drawerForm = drawerFormRef.value[0] || drawerFormRef.value;
if
(
refName
==
'drawerFormRef'
)
{
const
drawerForm
=
drawerFormRef
.
value
[
0
]
||
drawerFormRef
.
value
;
return
drawerForm
}
}
defineExpose
({
...
...
src/views/data_inventory/classifyGradeCatalogue.vue
View file @
7a8fa58
...
...
@@ -924,6 +924,7 @@ const classEditFormItems = ref<any>([{
type
:
'input'
,
placeholder
:
'请输入'
,
field
:
'startValue'
,
default
:
''
,
clearable
:
true
,
required
:
false
,
min
:
1
,
...
...
@@ -933,6 +934,7 @@ const classEditFormItems = ref<any>([{
type
:
'input'
,
placeholder
:
'请输入'
,
field
:
'endValue'
,
default
:
''
,
clearable
:
true
,
min
:
1
,
required
:
false
,
...
...
@@ -971,7 +973,7 @@ const classEditFormItems = ref<any>([{
{
label
:
'是否必填'
,
type
:
"select"
,
field
:
"
n
otNull"
,
field
:
"
isN
otNull"
,
disabled
:
false
,
default
:
''
,
options
:
[
...
...
@@ -1037,7 +1039,7 @@ const drawerBtnClick = async (btn, info) => {
}
else
{
btn
.
loading
=
true
;
console
.
log
(
'drawerBtnClick'
,
info
);
const
{
orderNumLength
,
orderNum
,
startNumber
,
endNumber
,
fieldValueRange
,
startValue
,
endValue
,
fieldPrecision
,
dictionaryGuid
,
isUnique
,
n
otNull
}
=
info
;
const
{
orderNumLength
,
orderNum
,
startNumber
,
endNumber
,
fieldValueRange
,
startValue
,
endValue
,
fieldPrecision
,
dictionaryGuid
,
isUnique
,
isN
otNull
}
=
info
;
// 判断长度orderNumLength,orderNum 要么都有值,要么都没有值,不能只有一个有值,一个没有值精确提醒
let
fieldLengthCondition
:
any
=
''
;
if
((
orderNumLength
===
'between'
&&
!
startNumber
)
||
(
orderNumLength
===
'between'
&&
!
endNumber
))
{
...
...
@@ -1075,10 +1077,10 @@ const drawerBtnClick = async (btn, info) => {
// 根据是否有 fieldValueRange 来决定如何构建参数对象
if
(
fieldValueRange
)
{
param
=
{
fieldPrecision
:
fieldPrecision
||
''
,
fieldPrecision
,
dictionaryGuid
,
isUnique
,
n
otNull
,
isN
otNull
,
fieldLengthCondition
,
fieldValueRange
,
fieldGuid
:
item
,
...
...
@@ -1086,10 +1088,10 @@ const drawerBtnClick = async (btn, info) => {
};
}
else
{
param
=
{
fieldPrecision
:
fieldPrecision
||
''
,
fieldPrecision
,
dictionaryGuid
,
isUnique
,
n
otNull
,
isN
otNull
,
fieldLengthCondition
,
fieldGuid
:
item
,
execGuid
:
execGuidInfo
.
value
.
execGuid
,
...
...
@@ -1136,8 +1138,9 @@ const isValidParam = (param) => {
return
Object
.
values
(
rest
).
some
(
value
=>
value
!==
null
&&
value
!==
undefined
&&
value
!==
''
);
}
const
drawerRef
=
ref
<
any
>
();
const
drawerSelectChange
=
(
val
,
row
,
info
)
=>
{
cons
ole
.
log
(
'drawerSelectChange'
,
val
,
row
,
info
)
;
cons
t
tempInfo
=
drawerRef
.
value
.
getDrawerConRef
(
'drawerFormRef'
).
formInline
;
if
(
val
===
'between'
)
{
classEditFormItems
.
value
.
forEach
(
item
=>
{
if
(
item
.
field
===
'orderNum'
)
{
...
...
@@ -1166,6 +1169,34 @@ const drawerSelectChange = (val, row, info) => {
});
}
}
classEditFormItems
.
value
.
forEach
(
item
=>
{
if
(
item
.
field
===
'orderNum'
)
{
item
.
default
=
tempInfo
.
orderNum
;
}
if
(
item
.
field
===
'dictionaryGuid'
)
{
item
.
default
=
tempInfo
.
dictionaryGuid
;
}
if
(
item
.
field
===
'isNotNull'
)
{
item
.
default
=
tempInfo
.
isNotNull
;
}
if
(
item
.
field
===
'isUnique'
)
{
item
.
default
=
tempInfo
.
isUnique
;
}
if
(
item
.
field
===
'fieldValueRange'
&&
item
.
children
)
{
item
.
children
.
forEach
(
item
=>
{
if
(
item
.
field
===
'startValue'
)
{
item
.
default
=
tempInfo
.
startValue
;
}
if
(
item
.
field
===
'endValue'
)
{
item
.
default
=
tempInfo
.
endValue
;
}
});
}
if
(
item
.
field
===
'fieldValueRange'
&&
!
item
.
children
)
{
item
.
default
=
tempInfo
.
fieldValueRange
;
}
});
}
// tab切换
...
...
@@ -1984,7 +2015,7 @@ watchEffect(() => {
<Table
:tableInfo=
"tableFieldsDataInfo"
@
tablePageChange=
"dataFieldTablePageChange"
/>
</div>
</div>
<Drawer
:drawerInfo=
"drawerInfo"
@
drawerBtnClick=
"drawerBtnClick"
class=
"v-drawer"
<Drawer
:drawerInfo=
"drawerInfo"
@
drawerBtnClick=
"drawerBtnClick"
class=
"v-drawer"
ref=
"drawerRef"
@
drawerSelectChange=
"drawerSelectChange"
/>
</div>
...
...
src/views/data_inventory/configureRules.vue
View file @
7a8fa58
...
...
@@ -167,18 +167,19 @@ const editRow = (row) => {
tempRowData
.
value
.
push
({
...
row
});
}
if
(
row
.
fieldLengthCondition
)
{
const
arr
=
row
.
fieldLengthCondition
.
split
(
'#'
)
// 遍历找到arr中是否存在等于between
arr
.
forEach
((
item
)
=>
{
if
(
item
===
'between'
)
{
row
.
lengthSymbol
=
'between'
row
.
numberRangeStart
=
arr
[
1
]
row
.
numberRangeEnd
=
arr
[
2
]
const
arr
=
row
.
fieldLengthCondition
.
split
(
'#'
);
// 按 '#' 分割
// 判断数组中是否包含 'between'
if
(
arr
.
includes
(
'between'
))
{
// 如果包含 'between',则将对应的 start 和 end 值赋给相应的字段
row
.
lengthSymbol
=
'between'
;
row
.
numberRangeStart
=
arr
[
1
];
// start value
row
.
numberRangeEnd
=
arr
[
2
];
// end value
}
else
{
row
.
lengthSymbol
=
arr
[
0
]
row
.
lengthValue
=
arr
[
1
]
// 否则处理其他符号条件,如 '>=', '<=', '>', '<', '=' 等
row
.
lengthSymbol
=
arr
[
0
];
// 符号(如 '>', '<=', 等)
row
.
lengthValue
=
arr
[
1
];
// 值(如 10,20 等)
}
})
}
if
(
row
.
fieldValueRange
&&
!
isSingleInput
(
row
.
fieldType
))
{
const
arr
=
row
.
fieldValueRange
.
split
(
'#'
)
...
...
@@ -191,6 +192,7 @@ const editRow = (row) => {
// 保存数据
const
saveRow
=
(
row
)
=>
{
console
.
log
(
'保存:'
,
row
);
if
(
row
.
lengthSymbol
===
'between'
)
{
// 校验不能为空,其中一个为空则提示
if
(
!
row
.
numberRangeStart
||
!
row
.
numberRangeStart
)
{
...
...
@@ -205,6 +207,7 @@ const saveRow = (row) => {
proxy
.
$ElMessage
.
error
(
'请输入完整的长度范围'
);
return
}
console
.
log
(
row
.
lengthSymbol
+
'#'
+
row
.
numberRangeStart
+
'#'
+
row
.
numberRangeEnd
)
row
.
fieldLengthCondition
=
row
.
lengthSymbol
+
'#'
+
row
.
numberRangeStart
+
'#'
+
row
.
numberRangeEnd
}
else
{
if
(
!
row
.
lengthValue
&&
row
.
lengthSymbol
)
{
...
...
@@ -215,8 +218,6 @@ const saveRow = (row) => {
proxy
.
$message
.
error
(
'请输入完整的长度范围'
);
return
;
}
}
if
(
!
row
.
lengthSymbol
&&
!
row
.
lengthValue
)
{
row
.
fieldLengthCondition
=
''
}
...
...
@@ -224,6 +225,9 @@ const saveRow = (row) => {
console
.
log
(
'row.lengthSymbol'
,
row
.
lengthSymbol
+
'#'
+
row
.
lengthValue
)
row
.
fieldLengthCondition
=
row
.
lengthSymbol
+
'#'
+
row
.
lengthValue
}
}
// 字段范围 双文本情况
if
(
!
isSingleInput
(
row
.
fieldType
))
{
...
...
@@ -232,76 +236,6 @@ const saveRow = (row) => {
}
row
.
isEdit
=
false
}
const
data
=
[
{
value
:
'1'
,
label
:
'Level one 1'
,
children
:
[
{
value
:
'1-1'
,
label
:
'Level two 1-1'
,
children
:
[
{
value
:
'1-1-1'
,
label
:
'Level three 1-1-1'
,
},
],
},
],
},
{
value
:
'2'
,
label
:
'Level one 2'
,
children
:
[
{
value
:
'2-1'
,
label
:
'Level two 2-1'
,
children
:
[
{
value
:
'2-1-1'
,
label
:
'Level three 2-1-1'
,
},
],
},
{
value
:
'2-2'
,
label
:
'Level two 2-2'
,
children
:
[
{
value
:
'2-2-1'
,
label
:
'Level three 2-2-1'
,
},
],
},
],
},
{
value
:
'3'
,
label
:
'Level one 3'
,
children
:
[
{
value
:
'3-1'
,
label
:
'Level two 3-1'
,
children
:
[
{
value
:
'3-1-1'
,
label
:
'Level three 3-1-1'
,
},
],
},
{
value
:
'3-2'
,
label
:
'Level two 3-2'
,
children
:
[
{
value
:
'3-2-1'
,
label
:
'Level three 3-2-1'
,
},
],
},
],
},
]
const
loading
=
ref
(
false
)
const
saveData
=
async
()
=>
{
...
...
@@ -357,7 +291,7 @@ const saveData = async () => {
if
(
allFieldsEmpty
)
{
inParams
=
[];
}
try
{
const
res
:
any
=
await
saveBizRuleConfig
(
inParams
)
if
(
res
.
code
===
proxy
.
$passCode
)
{
loading
.
value
=
false
...
...
@@ -370,6 +304,9 @@ const saveData = async () => {
loading
.
value
=
false
proxy
.
$message
.
error
(
res
.
msg
)
}
}
catch
(
error
)
{
loading
.
value
=
false
}
}
...
...
@@ -401,19 +338,25 @@ const isSingleInput = (fieldType: string) => {
return
singleInputTypes
.
includes
(
fieldType
)
||
!
fieldType
;
// 如果fieldType为空,默认为单文本框
};
// 验证是否为大于0的整数
const
validatePositiveInteger
=
(
row
:
any
,
field
:
string
)
=>
{
cons
t
value
=
row
[
field
];
le
t
value
=
row
[
field
];
// 将输入值转为整数并检查是否大于0
if
(
value
&&
!
/^
\d
+$/
.
test
(
value
))
{
// 如果不是整数或是负数,将值清空或者给出提示
// 如果输入值为0,则将其设置为1
if
(
value
===
'0'
)
{
row
[
field
]
=
'1'
;
return
;
}
// 判断输入是否符合正整数且在1到9999之间
if
(
value
&&
!
/^
\d{1,4}
$/
.
test
(
value
))
{
// 如果不是1到4位的正整数,清空输入值
row
[
field
]
=
''
;
}
else
if
(
value
&&
parseInt
(
value
)
<=
0
)
{
// 如果
小于或等于0,也清空
值
}
else
if
(
value
&&
(
parseInt
(
value
)
<
1
||
parseInt
(
value
)
>
9999
)
)
{
// 如果
数字小于1或大于9999,清空输入
值
row
[
field
]
=
''
;
}
};
function
parseFieldLengthCondition
(
condition
)
{
// 如果 condition 为 null 或 undefined,直接返回默认值
if
(
!
condition
)
{
...
...
@@ -421,7 +364,7 @@ function parseFieldLengthCondition(condition) {
}
if
(
condition
.
includes
(
'between'
))
{
const
parts
=
condition
.
split
(
'#'
).
filter
(
Boolean
);
// 按 '#' 分割并去掉空值
return
`
${
parts
[
1
]}
-
${
parts
[
2
]}
`
;
// 显示为 "10-20"
return
`
介于
${
parts
[
1
]}
-
${
parts
[
2
]}
`
;
// 显示为 "10-20"
}
let
symbol
=
''
;
let
value
=
''
;
...
...
@@ -513,7 +456,7 @@ function parseFieldLengthCondition(condition) {
</
template
>
</el-table-column>
<!-- 字段类型fieldType (不可编辑) -->
<el-table-column
prop=
"fieldType"
label=
"字段类型"
width=
"120"
align=
"center"
>
<el-table-column
prop=
"fieldType"
label=
"字段类型"
width=
"120"
align=
"center"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
{{
...
...
@@ -524,14 +467,14 @@ function parseFieldLengthCondition(condition) {
</el-table-column>
<!-- 长度列 fieldLengthCondition: '>#10',-->
<el-table-column
prop=
"fieldLengthCondition"
label=
"长度"
width=
"
340"
align=
"center"
>
<el-table-column
prop=
"fieldLengthCondition"
label=
"长度"
width=
"
270"
align=
"left"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
parseFieldLengthCondition
(
scope
.
row
.
fieldLengthCondition
)
||
'--'
}}
</span>
<div
v-else
>
<div
style=
"display: flex; align-items: center;"
>
<el-select
v-model=
"scope.row.lengthSymbol"
placeholder=
"请选择"
style=
"width:
5
0%;margin-right: 8px;"
<el-select
v-model=
"scope.row.lengthSymbol"
placeholder=
"请选择"
style=
"width:
7
0%;margin-right: 8px;"
clearable
>
<el-option
label=
"大于"
value=
">"
></el-option>
<el-option
label=
"等于"
value=
"="
></el-option>
...
...
@@ -545,15 +488,15 @@ function parseFieldLengthCondition(condition) {
<!-- 当选择"介于"时,显示两个输入框 -->
<div
v-if=
"scope.row.lengthSymbol === 'between'"
style=
"display: flex; gap: 5px; align-items: center;"
>
<el-input
v-model=
"scope.row.numberRangeStart"
placeholder=
"请输入"
style=
"width: 45%;"
type=
"number"
clearable
@
input=
"validatePositiveInteger(scope.row, '
r
angeStart')"
/>
clearable
@
input=
"validatePositiveInteger(scope.row, '
numberR
angeStart')"
/>
<span>
-
</span>
<el-input
v-model=
"scope.row.numberRangeEnd"
placeholder=
"请输入"
style=
"width: 45%;"
type=
"number"
clearable
@
input=
"validatePositiveInteger(scope.row, '
r
angeEnd')"
/>
clearable
@
input=
"validatePositiveInteger(scope.row, '
numberR
angeEnd')"
/>
</div>
<!-- 其他符号时显示一个输入框 -->
<div
v-else
>
<el-input
v-model=
"scope.row.lengthValue"
placeholder=
"请输入"
style=
"width:
9
0%;"
clearable
<el-input
v-model=
"scope.row.lengthValue"
placeholder=
"请输入"
style=
"width:
7
0%;"
clearable
@
input=
"validatePositiveInteger(scope.row, 'lengthValue')"
type=
"number"
/>
</div>
</div>
...
...
@@ -561,18 +504,18 @@ function parseFieldLengthCondition(condition) {
</
template
>
</el-table-column>
<el-table-column
prop=
"fieldPrecision"
label=
"精度"
width=
"120"
align=
"center"
>
<el-table-column
prop=
"fieldPrecision"
label=
"精度"
width=
"120"
align=
"center"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<!-- 判断是否是浮点型,并且当前行是否可编辑 -->
<span
v-if=
"!scope.row.isEdit || !editableFields.fieldPrecision || scope.row.fieldType !== 'float'"
>
{{
scope
.
row
.
fieldPrecision
?
scope
.
row
.
fieldPrecision
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.fieldPrecision"
placeholder=
"请输入精度"
clearable
/>
<el-input
v-else
v-model=
"scope.row.fieldPrecision"
placeholder=
"请输入精度"
clearable
maxlength=
"2"
/>
</
template
>
</el-table-column>
<!-- 关联字典(可编辑)el-tree-select 形式下拉形式 -->
<el-table-column
prop=
"dictionaryGuid"
label=
"关联字典"
width=
"150"
align=
"
center"
>
<el-table-column
prop=
"dictionaryGuid"
label=
"关联字典"
width=
"150"
align=
"
left"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
dictionaryGuid
?
dictionaryList
.
find
((
item
:
any
)
=>
item
.
guid
===
scope
.
row
.
dictionaryGuid
)?.
chName
:
'--'
}}
</span>
...
...
@@ -584,7 +527,7 @@ function parseFieldLengthCondition(condition) {
</el-table-column>
<!-- 数据是否唯一(可编辑) -->
<el-table-column
prop=
"isUnique"
label=
"数据是否唯一"
width=
"150"
align=
"
center"
>
<el-table-column
prop=
"isUnique"
label=
"数据是否唯一"
width=
"150"
align=
"
left"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.isUnique"
>
{{
scope
.
row
.
isUnique
?
(
scope
.
row
.
isUnique
===
'Y'
?
'是'
:
'否'
)
:
'--'
...
...
@@ -596,7 +539,7 @@ function parseFieldLengthCondition(condition) {
</
template
>
</el-table-column>
<!-- 是否必填(可编辑) -->
<el-table-column
prop=
"notNull"
label=
"是否必填"
width=
"120"
align=
"
center"
>
<el-table-column
prop=
"notNull"
label=
"是否必填"
width=
"120"
align=
"
left"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
notNull
?
(
scope
.
row
.
notNull
===
'Y'
?
'是'
:
'否'
)
:
'--'
}}
</span>
...
...
@@ -608,7 +551,7 @@ function parseFieldLengthCondition(condition) {
</el-table-column>
<!-- 字段取值范围 fieldValueRange(可编辑)-->
<el-table-column
prop=
"fieldValueRange"
label=
"字段取值范围"
width=
"260"
align=
"
center"
>
<el-table-column
prop=
"fieldValueRange"
label=
"字段取值范围"
width=
"260"
align=
"
left"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<!-- 非编辑模式,展示取值范围 -->
<span
v-if=
"!scope.row.isEdit"
>
...
...
@@ -620,20 +563,22 @@ function parseFieldLengthCondition(condition) {
<!-- 判断字段类型并渲染对应的输入框 -->
<template
v-if=
"isSingleInput(scope.row.fieldType)"
>
<!-- 单文本框:字符型、大字段型、单字符型、JSON类型、布尔类型 -->
<el-input
v-model=
"scope.row.fieldValueRange"
placeholder=
"请输入"
clearable
/>
<el-input
v-model=
"scope.row.fieldValueRange"
placeholder=
"请输入"
clearable
maxlength=
"500"
/>
</
template
>
<
template
v-else
>
<!-- 双文本框:整型、日期型、日期时间型、时间戳、浮点型、一字节整型、时间类型 -->
<el-input
v-model=
"scope.row.startValue"
placeholder=
"请输入开始值"
style=
"width: 45%;"
clearable
/>
<el-input
v-model=
"scope.row.startValue"
placeholder=
"请输入开始值"
style=
"width: 45%;"
clearable
maxlength=
"200"
/>
<span>
-
</span>
<el-input
v-model=
"scope.row.endValue"
placeholder=
"请输入结束值"
style=
"width: 45%;"
clearable
/>
<el-input
v-model=
"scope.row.endValue"
placeholder=
"请输入结束值"
style=
"width: 45%;"
clearable
maxlength=
"200"
/>
</
template
>
</div>
</template>
</el-table-column>
<!-- 操作列 -->
<el-table-column
label=
"操作"
width=
"120"
align=
"center"
fixed=
"right"
>
<el-table-column
label=
"操作"
width=
"120"
align=
"center"
fixed=
"right"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
class=
"text_btn"
v-if=
"!scope.row.isEdit"
@
click=
"editRow(scope.row)"
>
编辑
</span>
<span
v-else
>
...
...
src/views/data_inventory/tableCreateExisting.vue
View file @
7a8fa58
...
...
@@ -1008,7 +1008,7 @@ onActivated(() => {
<el-button
@
click=
"batchDelete"
>
批量删除
</el-button>
<el-button
@
click=
"createNewSql"
>
生成建表语句
</el-button>
</div>
<div
class=
"bottom_table"
>
<div
class=
"bottom_table"
v-if=
"route.query.editOpt === '1'"
>
<el-table
:data=
"tableDataDetailInfo"
v-loading=
"tableFieldsLoading"
:highlight-current-row=
"true"
stripe
border
height=
"100%"
row-key=
"guid"
@
selection-change=
"selectionFieldsChange"
tooltip-effect=
"light"
:style=
"{
width: '100%',
...
...
@@ -1209,6 +1209,199 @@ onActivated(() => {
</el-table-column>
</el-table>
</div>
<div
class=
"bottom_table"
v-else
>
<el-table
:data=
"tableDataDetailInfo"
v-loading=
"tableFieldsLoading"
:highlight-current-row=
"true"
stripe
border
height=
"100%"
row-key=
"guid"
@
selection-change=
"selectionFieldsChange"
tooltip-effect=
"light"
:style=
"{
width: '100%',
'max-height': 'calc(100% - 16px)',
display: 'inline-block',
}"
>
<el-table-column
type=
"selection"
:width=
"32"
align=
"center"
/>
<!-- 排序列(不可编辑) -->
<el-table-column
type=
"index"
label=
"排序"
width=
"80"
align=
"center"
/>
<!-- 字段中文名(可编辑)fieldChName -->
<el-table-column
prop=
"fieldChName"
label=
"字段中文名"
width=
"150"
show-overflow-tooltip
>
<!-- 可以编辑 -->
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.fieldChName"
>
{{
scope
.
row
.
fieldChName
?
scope
.
row
.
fieldChName
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.fieldChName"
placeholder=
"请输入"
/>
</
template
>
</el-table-column>
<!-- 字段英文名(可编辑) -->
<el-table-column
prop=
"fieldName"
label=
"字段英文名"
width=
"150"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.fieldName"
>
{{
scope
.
row
.
fieldName
?
scope
.
row
.
fieldName
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.fieldName"
placeholder=
"必填"
@
input=
"inputLengthKeyUp(/[^a-zA-Z0-9_]/g, scope, 'fieldName')"
/>
</
template
>
</el-table-column>
<!-- 源数据库 -->
<el-table-column
prop=
"sourceDatabase"
label=
"源数据库"
width=
"150"
show-overflow-tooltip
v-if=
"route.query.editOpt != '1'"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
sourceDatabase
?
scope
.
row
.
sourceDatabase
:
'--'
}}
</
template
>
</el-table-column>
<!-- 源数据表 -->
<el-table-column
prop=
"sourceTableName"
label=
"源数据表"
width=
"150"
show-overflow-tooltip
v-if=
"route.query.editOpt != '1'"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
sourceTableName
?
scope
.
row
.
sourceTableName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 源字段中文 -->
<el-table-column
prop=
"sourceFieldName"
label=
"源字段中文"
width=
"150"
show-overflow-tooltip
v-if=
"route.query.editOpt != '1'"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
sourceFieldName
?
scope
.
row
.
sourceFieldName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 源字段英文 -->
<el-table-column
prop=
"sourceFieldChName"
label=
"源字段英文"
width=
"120"
show-overflow-tooltip
v-if=
"route.query.editOpt != '1'"
>
<
template
#
default=
"scope"
>
<!--
{{
scope
.
row
.
sourceFieldName
?
scope
.
row
.
sourceFieldName
:
'--'
}}
-->
<span>
{{
scope
.
row
.
sourceFieldChName
?
scope
.
row
.
sourceFieldChName
:
'--'
}}
</span>
</
template
>
</el-table-column>
<!-- 源端字段 fieldType fieldTypeProps-->
<el-table-column
prop=
"fieldType"
label=
"字段类型"
width=
"120"
>
<
template
#
default=
"scope"
>
<div
v-if=
"scope.row.isEdit"
>
<el-select
v-model=
"scope.row.fieldType"
placeholder=
"选择类型"
clearable
filterable
:props=
"fieldTypeProps"
>
<el-option
v-for=
"(item, index) in fieldData"
:key=
"index"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
</div>
<div
v-else
>
{{
fieldData
?
fieldData
.
find
(
item
=>
item
.
value
===
scope
.
row
.
fieldType
)?.
label
:
'--'
}}
</div>
</
template
>
</el-table-column>
<!-- 长度(可编辑) -->
<el-table-column
prop=
"fieldLength"
label=
"长度"
width=
"100"
align=
"left"
>
<
template
#
default=
"scope"
>
<!-- 非编辑状态 -->
<span
v-if=
"!scope.row.isEdit"
>
{{
[
'varchar'
,
'decimal'
,
'char'
].
includes
(
scope
.
row
.
fieldType
)
?
scope
.
row
.
fieldLength
||
'--'
:
'--'
}}
</span>
<!-- 编辑状态 -->
<div
v-else
>
<el-input
v-if=
"['varchar', 'decimal', 'char'].includes(scope.row.fieldType)"
v-model=
"scope.row.fieldLength"
placeholder=
"请输入长度"
@
input=
"inputLengthKeyUp(/\D/g, scope, 'fieldLength', 2000, 1)"
/>
<span
v-else
>
--
</span>
</div>
</
template
>
</el-table-column>
<!-- 精度(可编辑) -->
<el-table-column
prop=
"fieldPrecision"
label=
"精度"
width=
"100"
align=
"left"
>
<
template
#
default=
"scope"
>
<!-- 非编辑状态 -->
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
fieldType
===
'decimal'
?
scope
.
row
.
fieldPrecision
||
'--'
:
'--'
}}
</span>
<!-- 编辑状态 -->
<div
v-else
>
<el-input
v-if=
"scope.row.fieldType === 'decimal'"
v-model=
"scope.row.fieldPrecision"
placeholder=
"请输入精度"
@
input=
"inputLengthKeyUp(/\D/g, scope, 'fieldPrecision', 30, 1)"
/>
<span
v-else
>
--
</span>
</div>
</
template
>
</el-table-column>
<!-- 关联字典(可编辑)el-tree-select 形式下拉形式 -->
<el-table-column
prop=
"dictionaryGuid"
label=
"关联字典"
width=
"120"
align=
"left"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
dictionaryGuid
?
dictionaryList
.
find
((
item
:
any
)
=>
item
.
guid
===
scope
.
row
.
dictionaryGuid
)?.
chName
:
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.dictionaryGuid"
placeholder=
"请选择"
>
<el-option
v-for=
"item in dictionaryList"
:key=
"item?.guid"
:label=
"item.chName"
:value=
"item.guid"
/>
</el-select>
</
template
>
</el-table-column>
<!-- 数据是否唯一(可编辑) -->
<el-table-column
prop=
"isPrimary"
label=
"是否主键"
width=
"100"
align=
"left"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.isPrimary"
>
{{
scope
.
row
.
isPrimary
||
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.isPrimary"
placeholder=
"请选择"
>
<el-option
label=
"Y"
value=
"Y"
/>
<el-option
label=
"N"
value=
"N"
/>
</el-select>
</
template
>
</el-table-column>
<!-- 是否必填(可编辑) -->
<el-table-column
prop=
"notNull"
label=
"是否必填"
width=
"100"
align=
"left"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
notNull
||
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.notNull"
placeholder=
"请选择"
>
<el-option
label=
"Y"
value=
"Y"
/>
<el-option
label=
"N"
value=
"N"
/>
</el-select>
</
template
>
</el-table-column>
<!-- 分类(不可编辑)classifyName -->
<el-table-column
prop=
"classifyDetailNameRoutes"
label=
"分类"
width=
"150"
show-overflow-tooltip
>
<
template
#
default=
"scope"
>
<!-- 如果当前行是编辑状态,显示 tree-select -->
<div
v-if=
"scope.row.isEdit"
>
<el-tree-select
v-model=
"scope.row.classifyDetailGuid"
:data=
"treeSelectOptions"
:props=
"treeSelectProps"
placeholder=
"请选择分类"
clearable
filterable
@
change=
"(value) => handleClassifyChange(scope.row, value)"
@
node-click=
"(node, data) => handleNodeClick(scope.row, node, data)"
>
</el-tree-select>
</div>
<!-- 否则直接显示分类名称 -->
<div
v-else
>
{{
Array
.
isArray
(
scope
.
row
?.
classifyDetailNameRoutes
)
?
scope
.
row
.
classifyDetailNameRoutes
.
join
(
'/'
)
:
'--'
}}
</div>
</
template
>
</el-table-column>
<!-- 分级(不可编辑) -->
<el-table-column
prop=
"gradeDetailGuid"
label=
"分级"
width=
"100"
align=
"left"
>
<
template
#
default=
"scope"
>
<div
v-if=
"scope.row.isEdit"
>
<el-select
v-model=
"scope.row.gradeDetailGuid"
placeholder=
"请选择分级"
clearable
filterable
:props=
"gradeSelectProps"
@
change=
"handleGradeChange(scope.row)"
>
<el-option
v-for=
"(item, index) in scope.row.gradeOptions || []"
:key=
"index"
:label=
"item.name"
:value=
"item.guid"
></el-option>
</el-select>
</div>
<div
v-else
>
{{
scope
.
row
.
gradeDetailName
||
'--'
}}
</div>
</
template
>
</el-table-column>
<!-- 操作列 -->
<el-table-column
label=
"操作"
width=
"100"
align=
"center"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<span
class=
"text_btn"
v-if=
"!scope.row.isEdit"
@
click=
"editRow(scope.row)"
>
编辑
</span>
<span
class=
"text_btn"
v-else
@
click=
"saveRow(scope.row)"
>
保存
</span>
<el-divider
direction=
"vertical"
/>
<span
class=
"text_btn"
@
click=
"deleteRow(scope.$index)"
>
删除
</span>
</
template
>
</el-table-column>
</el-table>
</div>
</div>
</div>
<div
class=
"bottom_tool_wrap"
v-show=
"!(route.query.editOpt && route.query.editOpt === '1')"
>
...
...
src/views/data_inventory/tableCreateFile.vue
View file @
7a8fa58
...
...
@@ -33,7 +33,7 @@ import {
getSubjectTableDetail
,
checkSubjectTableData
}
from
"@/api/modules/dataCatalogService"
;
import
{
getDictionaryAll
,
getFidldEnName
,
getGradeList
,
getNewDataTypeList
,
getTaskExeTreeList
,
saveDbDirTable
}
from
"@/api/modules/dataInventory"
;
import
{
getDictionaryAll
,
getFidldEnName
,
getGradeList
,
getNewDataTypeList
,
getTaskExeTreeList
,
saveDbDirTable
,
getFieldClassifyAndGrade
}
from
"@/api/modules/dataInventory"
;
import
{
useDefault
}
from
"@/hooks/useDefault"
;
import
uploadExcelFile
from
"./components/uploadExcelFile.vue"
;
import
{
add
}
from
"lodash-es"
;
...
...
@@ -115,7 +115,7 @@ const uploadFileRef = ref();
const
getSubjectField
=
()
=>
{
tableFieldsLoading
.
value
=
true
;
getFidldEnName
(
fileTableFields
.
value
.
map
(
f
=>
f
.
chName
)).
then
((
res
:
any
)
=>
{
getFidldEnName
(
fileTableFields
.
value
.
map
(
f
=>
f
.
chName
)).
then
(
async
(
res
:
any
)
=>
{
tableFieldsLoading
.
value
=
false
;
if
(
res
.
code
==
proxy
.
$passCode
)
{
tableCreateInfo
.
value
.
tableFields
=
res
.
data
?.
map
((
field
,
i
)
=>
{
...
...
@@ -125,6 +125,55 @@ const getSubjectField = () => {
!
field
.
notNull
&&
(
field
.
notNull
=
'N'
);
return
field
;
})
||
[];
console
.
log
(
tableCreateInfo
.
value
.
tableFields
,
'7897987'
);
// 遍历 tableCreateInfo.value.tableFields,找到item.fieldName,组合成入参
let
tempFileNames
:
any
=
[]
tableCreateInfo
.
value
.
tableFields
.
forEach
((
item
:
any
)
=>
{
tempFileNames
.
push
(
item
.
fieldName
);
});
const
classify
:
any
=
await
getFieldClassifyAndGrade
({
fieldName
:
tempFileNames
,
execGuid
:
execGuid
.
value
,
type
:
'C'
})
const
grade
:
any
=
await
getFieldClassifyAndGrade
({
fieldName
:
tempFileNames
,
execGuid
:
execGuid
.
value
,
type
:
'G'
})
// 通过分类数据和分级数据赋值给 tableFields 的每一项
tableCreateInfo
.
value
.
tableFields
.
forEach
((
item
:
any
)
=>
{
// 在分类数据中查找对应 fieldName 的项
const
classifyItem
=
classify
.
find
((
classify
:
any
)
=>
classify
.
fieldName
===
item
.
fieldName
);
// 在分级数据中查找对应 fieldName 的项
const
gradeItem
=
grade
.
find
((
grade
:
any
)
=>
grade
.
fieldName
===
item
.
fieldName
);
// 如果找到对应的分类数据,赋值给 tableFields 的相应项
if
(
classifyItem
)
{
item
.
classifyDetailGuid
=
classifyItem
.
classifyDetailGuid
||
null
;
item
.
classifyDetailName
=
classifyItem
.
classifyDetailName
||
null
;
item
.
classifyDetailGuidRoutes
=
classifyItem
.
classifyDetailGuidRoutes
||
null
;
item
.
classifyDetailNameRoutes
=
classifyItem
.
classifyDetailNameRoutes
||
null
;
}
// 如果找到对应的分级数据,赋值给 tableFields 的相应项
if
(
gradeItem
)
{
item
.
gradeDetailGuid
=
gradeItem
.
gradeDetailGuid
||
null
;
item
.
gradeDetailName
=
gradeItem
.
gradeDetailName
||
null
;
}
});
}
else
{
ElMessage
.
error
(
res
.
msg
);
}
});
}
const
getGradeClassifyInfo
=
(
params
)
=>
{
getFieldClassifyAndGrade
(
params
).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
proxy
.
$passCode
)
{
}
else
{
ElMessage
.
error
(
res
.
msg
);
}
...
...
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