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
1fec05c1
authored
2024-12-23 16:33:29 +0800
by
xukangle
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update: 联调分类分级目录接口
1 parent
4fa77310
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
254 additions
and
99 deletions
src/api/modules/dataInventory.ts
src/views/data_inventory/classifyGradeCatalogue.vue
src/views/data_inventory/configureRules.vue
src/views/data_inventory/existingTableSelect.vue
src/views/data_inventory/tableCreateExisting.vue
src/api/modules/dataInventory.ts
View file @
1fec05c
...
...
@@ -461,15 +461,46 @@ export const getDbDirFieldPageList = (data) => request({
data
})
/**
* 数据库目录-表联动查询
* @param data
* @returns
* @path /db-dir/table/select-list
*/
export
const
getDbDirTableSelectList
=
(
data
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/table/select-list`
,
method
:
'post'
,
data
})
/** 获取已有字段信息 */
export
const
getDsTableStructure
=
(
data
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/field/list-by-table-guid`
,
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/field/list-by-table-guid?tableGuid=
${
data
.
tableGuid
}
&execGuid=
${
data
.
execGuid
}
`
,
method
:
'post'
,
});
/** 获取已有数据库目录字段信息 入参是数组 */
export
const
getDsTableStructures
=
(
data
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/field/list-by-table-guids`
,
method
:
'post'
,
data
});
/**
* 数据库目录-字段查询分类分级
* @param {Object}
* @path /db-dir/field/get-classify-and-grade
*/
export
const
getDbDirFieldClassifyAndGrade
=
(
data
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/field/get-classify-and-grade`
,
method
:
'post'
,
data
})
/** 根据选择的连接池获取表列表 */
export
const
getDsTableByDs
=
(
params
)
=>
request
({
url
:
`
${
import
.
meta
.
env
.
VITE_APP_CHECK_BASEURL
}
/db-dir/table/list-by-datasource-guid`
,
...
...
src/views/data_inventory/classifyGradeCatalogue.vue
View file @
1fec05c
...
...
@@ -90,6 +90,10 @@ const getExecGuid = async () => {
}
//
onMounted
(()
=>
{
getCgDirTreeData
();
getCgDirFieldPage
();
...
...
@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({
fixedSelection
:
true
,
fields
:
[
{
label
:
"序号"
,
type
:
"index"
,
width
:
56
,
align
:
"center"
},
{
label
:
"数据源"
,
field
:
"
cgDir
Name"
,
width
:
140
},
{
label
:
"表名称"
,
field
:
"tableName"
,
width
:
180
},
{
label
:
"数据库表"
,
field
:
"table
Ch
Name"
,
width
:
120
},
{
label
:
"数据源"
,
field
:
"
databaseCh
Name"
,
width
:
140
},
{
label
:
"表名称"
,
field
:
"table
Ch
Name"
,
width
:
180
},
{
label
:
"数据库表"
,
field
:
"tableName"
,
width
:
120
},
{
label
:
"新建方式"
,
field
:
"foundMode"
,
width
:
140
,
getName
:
(
scope
)
=>
{
let
dataGrade
=
scope
.
row
.
foundMode
;
...
...
@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({
return
status
==
0
?
'草稿中'
:
status
==
1
?
'已建表'
:
'已有默认表'
;
}
},
{
label
:
"任务修改人"
,
field
:
"
dam
Name"
,
width
:
120
},
{
label
:
"任务修改人"
,
field
:
"
updateUser
Name"
,
width
:
120
},
{
label
:
"修改时间"
,
field
:
"updateTime"
,
width
:
TableColumnWidth
.
DATETIME
},
{
label
:
"描述"
,
field
:
"description"
,
width
:
120
,
align
:
'center'
},
{
label
:
"规划数据资产"
,
field
:
"isDataAsset"
,
type
:
'switch'
,
activeText
:
'是'
,
inactiveText
:
'否'
,
activeValue
:
'Y'
,
inactiveValue
:
'N'
,
switchWidth
:
56
,
width
:
120
,
align
:
'center'
},
...
...
@@ -397,7 +401,8 @@ const dataBaseTableInfo = ref({
type
:
"btn"
,
width
:
300
,
fixed
:
'right'
,
btns
:
[
btns
:
(
scope
)
=>
{
return
[
{
label
:
"配置业务规则"
,
value
:
"edit"
,
click
:
(
scope
)
=>
{
console
.
log
(
'编辑'
,
scope
);
...
...
@@ -415,13 +420,16 @@ const dataBaseTableInfo = ref({
});
}
},
{
label
:
"编辑表结构"
,
value
:
"copy
"
,
click
:
(
scope
)
=>
{
label
:
"编辑表结构"
,
value
:
"edit
"
,
click
:
(
scope
)
=>
{
console
.
log
(
'复制'
,
scope
);
}
},
disabled
:
scope
.
row
.
state
!==
2
?
false
:
true
}
]
}
},
loading
:
false
...
...
@@ -687,7 +695,7 @@ const getDataBaseTableData = async (params = {}) => {
pageIndex
:
1
,
pageSize
:
10
,
databaseGuid
:
""
,
isDataAsset
:
checked
.
value
?
'Y'
:
'N
'
,
isDataAsset
:
'
'
,
execGuid
:
execGuidInfo
.
value
.
execGuid
,
};
const
finalParams
=
{
...
dataBaseParams
,
...
params
};
...
...
@@ -727,7 +735,9 @@ const getDataBaseFieldData = async (params = {}) => {
tableGuid
:
""
,
execGuid
:
execGuidInfo
.
value
.
execGuid
,
databaseGuid
:
""
,
isDataAsset
:
checked
.
value
?
'Y'
:
'N'
,
isDataAsset
:
''
,
fieldName
:
''
,
gradeDetailName
:
''
,
};
const
finalParams
=
{
...
dataBaseParams
,
...
params
};
...
...
@@ -773,11 +783,14 @@ const tableFieldsDataInfo = ref({
const
showTableOrDatabase
=
ref
(
true
);
const
isShowCreateBtn
=
ref
(
false
);
// 定义tableGuid
const
tableGuid
=
ref
(
''
);
const
dataBaseGuid
=
ref
(
''
);
const
dataBaseInfo
=
ref
<
any
>
({});
const
dataBasenodeClick
=
(
data
:
any
)
=>
{
isShowCreateBtn
.
value
=
false
;
console
.
log
(
'dataBasenodeClick'
,
data
);
if
(
data
.
cgDirName
)
{
tableGuid
.
value
=
''
;
...
...
@@ -786,7 +799,9 @@ const dataBasenodeClick = (data: any) => {
getDataBaseTableData
();
}
if
(
data
.
databaseGuid
)
{
dataBaseInfo
.
value
=
data
;
dataBaseGuid
.
value
=
data
.
databaseGuid
;
isShowCreateBtn
.
value
=
true
;
tableGuid
.
value
=
''
;
getDataBaseFieldData
({
databaseGuid
:
data
.
databaseGuid
...
...
@@ -801,9 +816,9 @@ const dataBasenodeClick = (data: any) => {
getDataBaseFieldData
({
tableGuid
:
data
.
tableGuid
});
getDataBaseTableData
({
tableGuid
:
data
.
tableGuid
});
//
getDataBaseTableData({
//
tableGuid: data.tableGuid
//
});
}
if
(
data
.
databaseGuid
||
data
.
cgDirName
)
{
...
...
@@ -826,7 +841,8 @@ const handleSubjectTableCommand = (command: string) => {
router
.
push
({
name
:
'tableCreateFile'
,
query
:
{
type
:
'tableCreateFile'
type
:
'tableCreateFile'
,
foundMode
:
2
}
});
}
else
if
(
command
===
'existingCreate'
)
{
...
...
@@ -834,7 +850,11 @@ const handleSubjectTableCommand = (command: string) => {
router
.
push
({
name
:
'tableCreateExisting'
,
query
:
{
execGuid
:
execGuidInfo
.
value
.
execGuid
execGuid
:
execGuidInfo
.
value
.
execGuid
,
foundMode
:
1
,
database
:
dataBaseInfo
.
value
.
database
,
databaseChName
:
dataBaseInfo
.
value
.
databaseChName
,
databaseGuid
:
dataBaseInfo
.
value
.
databaseGuid
,
}
});
}
...
...
@@ -1033,7 +1053,7 @@ loadOptionsA();
<div
class=
"btns-area"
v-if=
"!tableGuid && activeTab === 'table'"
>
<div
class=
"left-btns"
>
<div
class=
"dropdown_btn"
>
<div
class=
"dropdown_btn"
v-if=
"isShowCreateBtn"
>
<el-dropdown
popper-class=
"table-create-menu"
@
command=
"handleSubjectTableCommand"
placement=
"bottom-start"
trigger=
"click"
>
<span
class=
"el-dropdown-link"
>
...
...
src/views/data_inventory/configureRules.vue
View file @
1fec05c
...
...
@@ -6,7 +6,6 @@
import
{
ref
}
from
"vue"
;
import
router
from
"@/router"
;
import
{
getBizRuleConfigDetail
,
updateBizRuleConfig
}
from
'@/api/modules/dataInventory'
const
{
proxy
}
=
getCurrentInstance
()
as
any
;
const
bizRuleConfigData
=
ref
<
any
>
()
const
getBizRuleConfigDetailData
=
async
()
=>
{
...
...
@@ -105,9 +104,25 @@ const moveDown = () => {
// 编辑行
const
editRow
=
(
row
)
=>
{
if
(
!
row
.
isEdit
)
{
// 编辑fieldLengthCondition
if
(
row
.
fieldLengthCondition
)
{
const
[
symbol
,
value
]
=
row
.
fieldLengthCondition
.
split
(
'#'
);
row
.
lengthSymbol
=
symbol
;
// 初始化符号部分
row
.
lengthValue
=
value
;
// 初始化数值部分
}
else
{
row
.
lengthSymbol
=
''
;
// 默认值
row
.
lengthValue
=
''
;
// 默认值
}
//编辑fieldValueRange
if
(
row
.
fieldValueRange
)
{
const
[
start
,
end
]
=
row
.
fieldValueRange
.
split
(
'-'
);
row
.
rangeStart
=
start
;
// 初始化符号部分
row
.
rangeEnd
=
end
;
// 初始化数值部分
}
else
{
row
.
rangeStart
=
''
;
// 默认值
row
.
rangeEnd
=
''
;
// 默认值
}
row
.
isEdit
=
true
;
// 进入编辑模式
}
};
...
...
@@ -115,6 +130,7 @@ const editRow = (row) => {
// 保存数据
const
saveRow
=
(
row
)
=>
{
row
.
fieldLengthCondition
=
`
${
row
.
lengthSymbol
}
#
${
row
.
lengthValue
}
`
;
row
.
fieldValueRange
=
[
row
.
rangeStart
||
''
,
row
.
rangeEnd
||
''
];
row
.
isEdit
=
false
}
...
...
@@ -213,19 +229,23 @@ const saveData = async () => {
"isNotNull": "string",
"fieldValueRange": "string"
*/
const
params
=
tableData
.
value
.
map
((
item
:
any
)
=>
{
return
{
guid
:
item
.
guid
,
const
inParams
=
[]
as
any
tableData
.
value
.
forEach
((
item
:
any
)
=>
{
const
obj
=
{
guid
:
router
.
currentRoute
.
value
.
query
.
tableGuid
,
fieldGuid
:
item
.
fieldGuid
,
fieldLengthCondition
:
item
.
fieldLengthCondition
,
fieldPrecision
:
item
.
fieldPrecision
,
dictionaryGuid
:
item
.
dictionaryGuid
,
isUnique
:
item
.
isUnique
,
isNotNull
:
item
.
is
NotNull
,
isNotNull
:
item
.
is
Required
,
fieldValueRange
:
item
.
fieldValueRange
}
inParams
.
push
(
obj
)
})
const
res
:
any
=
await
updateBizRuleConfig
(
params
)
console
.
log
(
'finalParams'
,
inParams
)
const
res
:
any
=
await
updateBizRuleConfig
(
inParams
)
if
(
res
.
code
===
proxy
.
$passCode
)
{
proxy
.
$message
.
success
(
'修改配置规则成功!'
)
router
.
back
()
...
...
@@ -270,29 +290,29 @@ const cancel = () => {
<!-- 排序列(不可编辑) -->
<el-table-column
type=
"index"
label=
"排序"
width=
"80"
align=
"center"
/>
<!-- 字段中文名(不可编辑)fieldChName -->
<el-table-column
prop=
"fieldName"
label=
"字段中文名"
width=
"120"
>
<el-table-column
prop=
"field
Ch
Name"
label=
"字段中文名"
width=
"120"
>
<template
#
default=
"scope"
>
{{
scope
.
row
.
field
Name
?
scope
.
row
.
field
Name
:
'--'
}}
{{
scope
.
row
.
field
ChName
?
scope
.
row
.
fieldCh
Name
:
'--'
}}
</
template
>
</el-table-column>
<!-- 字段英文名(不可编辑) -->
<el-table-column
prop=
"field
English
"
label=
"字段英文名"
width=
"120"
>
<el-table-column
prop=
"field
Name
"
label=
"字段英文名"
width=
"120"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
field
English
?
scope
.
row
.
fieldEnglish
:
'--'
}}
{{
scope
.
row
.
field
Name
?
scope
.
row
.
fieldName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 分类(不可编辑)classifyName -->
<el-table-column
prop=
"fieldEnglish"
label=
"分类"
width=
"120"
>
<
!-- <
el-table-column prop="fieldEnglish" label="分类" width="120">
<template #default="scope">
{{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
</template>
</el-table-column>
</el-table-column>
-->
<!-- 分级(不可编辑) -->
<el-table-column
prop=
"gradeDetailName"
label=
"分级"
width=
"120"
align=
"center"
>
<
!-- <
el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<template #default="scope">
{{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
</template>
</el-table-column>
</el-table-column>
-->
<!-- 字段类型fieldType (不可编辑) -->
<el-table-column
prop=
"fieldType"
label=
"字段类型"
width=
"150"
align=
"center"
>
<
template
#
default=
"scope"
>
...
...
@@ -367,11 +387,20 @@ const cancel = () => {
</el-select>
</
template
>
</el-table-column>
<!-- 字段取值范围 fieldValueRange(可编辑)-->
<el-table-column
prop=
"fieldValueRange"
label=
"字段取值范围"
width=
"
15
0"
align=
"center"
>
<el-table-column
prop=
"fieldValueRange"
label=
"字段取值范围"
width=
"
26
0"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
fieldValueRange
?
scope
.
row
.
fieldValueRange
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.fieldValueRange"
placeholder=
"请输入字段取值范围"
/>
<!-- 非编辑模式,展示取值范围 -->
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
fieldValueRange
?
scope
.
row
.
fieldValueRange
.
join
(
'-'
)
:
'--'
}}
</span>
<!-- 编辑模式,显示两个输入框 -->
<div
v-else
style=
"display: flex; gap: 5px; align-items: center;"
>
<el-input
v-model=
"scope.row.rangeStart"
placeholder=
"最小值"
style=
"width: 45%;"
type=
"number"
/>
<span>
-
</span>
<el-input
v-model=
"scope.row.rangeEnd"
placeholder=
"最大值"
style=
"width: 45%;"
type=
"number"
/>
</div>
</
template
>
</el-table-column>
...
...
src/views/data_inventory/existingTableSelect.vue
View file @
1fec05c
...
...
@@ -196,13 +196,16 @@ const getPreviewData = () => {
const
getTableStructure
=
()
=>
{
let
tableName
=
currDatasourceSelect
.
value
.
tableName
;
console
.
log
(
'tableName'
,
currDatasourceSelect
.
value
);
currDsTableStructureLoading
.
value
=
true
;
currDsTableStructure
.
value
=
[];
getDsTableStructure
({
tableName
:
tableName
,
dataSourceGuid
:
databaseInfo
.
value
.
guid
,
database
:
databaseInfo
.
value
.
databaseNameEn
,
databaseType
:
databaseInfo
.
value
.
databaseType
// tableName: tableName,
// dataSourceGuid: databaseInfo.value.guid,
// database: databaseInfo.value.databaseNameEn,
// databaseType: databaseInfo.value.databaseType,
tableGuid
:
currDatasourceSelect
.
value
.
tableGuid
,
execGuid
:
props
.
execGuid
}).
then
((
res
:
any
)
=>
{
currDsTableStructureLoading
.
value
=
false
;
if
(
res
.
code
==
proxy
.
$passCode
)
{
...
...
@@ -318,7 +321,7 @@ watch(
if
(
val
?.
length
&&
!
currDatasourceSelect
.
value
?.
tableName
)
{
currDatasourceSelect
.
value
=
val
[
0
];
}
emits
(
"datasourceSelectedChange"
,
val
);
emits
(
"datasourceSelectedChange"
,
val
,
databaseGuid
.
value
);
},
{
deep
:
true
,
...
...
src/views/data_inventory/tableCreateExisting.vue
View file @
1fec05c
...
...
@@ -9,10 +9,12 @@ import StepBar from "@/components/StepBar/index.vue";
import
{
getDbDirDataSourceList
,
getDsData
,
getDsTableStructure
,
saveDbDirTable
,
updateDbDirTable
,
createTableSql
,
getDsTableStructures
,
getDbDirFieldClassifyAndGrade
,
getDbDirTableSelectList
}
from
"@/api/modules/dataInventory"
;
import
existingTableSelect
from
"./existingTableSelect.vue"
;
...
...
@@ -45,8 +47,44 @@ const processData = (data) => {
databaseGuid
:
undefined
,
// 删除旧键 "databaseGuid"
})).
map
(({
databaseGuid
,
...
rest
})
=>
rest
);
// 过滤掉 undefined 键
};
// 获取分类分级的数据 getDbDirFieldClassifyAndGrade
const
gradeList
:
any
=
ref
([]);
const
classifyList
:
any
=
ref
([]);
const
getDbDirFieldClassifyAndGradeList
=
async
()
=>
{
const
params
=
{
execGuid
:
execGuid
.
value
,
type
:
'C'
,
fieldName
:
'classifyName'
,
}
const
res
:
any
=
await
getDbDirFieldClassifyAndGrade
(
params
);
if
(
res
.
code
===
proxy
.
$passCode
)
{
console
.
log
(
'分类分级数据'
,
res
.
data
)
}
else
{
proxy
.
$ElMessage
.
error
(
res
.
msg
);
}
};
// 联动查询数据getDbDirTableSelectList
const
getTableSelectList
=
async
(
params
)
=>
{
const
inParams
=
{
}
const
res
:
any
=
await
getDbDirTableSelectList
(
params
);
if
(
res
.
code
===
proxy
.
$passCode
)
{
console
.
log
(
'联动查询数据'
,
res
.
data
)
}
else
{
proxy
.
$ElMessage
.
error
(
res
.
msg
);
}
};
onMounted
(
async
()
=>
{
await
getDbDirDataSourceListData
();
await
getDbDirFieldClassifyAndGradeList
();
});
const
stepsInfo
=
ref
({
...
...
@@ -63,14 +101,14 @@ const datasourceSelectedRows: Ref<any> = ref([]);
//记录下一步时选中的库表信息。
const
selectedDatabaseTable
:
Ref
<
any
>
=
ref
([]);
const
handlDsSelectedChange
=
(
v
)
=>
{
// 记录数据库databaseGuid
const
handlDsSelectedChange
=
(
v
,
guid
)
=>
{
datasourceSelectedRows
.
value
=
v
||
[];
const
params
:
any
=
[];
v
.
forEach
((
item
)
=>
{
params
.
push
({
table
Name
:
item
.
tableName
,
database
:
item
.
databas
e
,
table
Guid
:
item
.
tableGuid
,
execGuid
:
execGuid
.
valu
e
,
});
});
selectedDatabaseTable
.
value
=
params
;
...
...
@@ -99,7 +137,7 @@ const nextStep = () => {
//下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value
const
getNextTableInfo
=
async
()
=>
{
const
res
:
any
=
await
getDsTableStructure
(
selectedDatabaseTable
.
value
);
const
res
:
any
=
await
getDsTableStructure
s
(
selectedDatabaseTable
.
value
);
if
(
res
.
code
===
proxy
.
$passCode
)
{
tableDataDetailInfo
.
value
=
res
.
data
;
}
else
{
...
...
@@ -331,37 +369,42 @@ const submitAsDraft = () => {
* 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空
*/
const
checkTableData
=
(
tableDataInfo
,
tableDataDetailInfo
)
=>
{
const
tableDataInfoKeys
=
[
'tableName'
,
'tableChName'
]
const
tableDataDetailInfoKeys
=
[
'fieldName'
,
'fieldEnglish'
,
'fieldType'
,
'length'
,
'fieldPrecision'
,
'isUnique'
,
'isRequired'
,
'fieldValueRange'
,
'dictionaryGuid'
]
let
flag
=
true
tableDataInfo
.
forEach
(
item
=>
{
tableDataInfoKeys
.
forEach
(
key
=>
{
if
(
!
item
[
key
])
{
flag
=
false
proxy
.
$ElMessage
.
error
(
'表名称、数据库表不能为空'
)
}
})
})
tableDataDetailInfo
.
forEach
(
item
=>
{
tableDataDetailInfoKeys
.
forEach
(
key
=>
{
if
(
!
item
[
key
])
{
flag
=
false
proxy
.
$ElMessage
.
error
(
'字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空'
)
}
})
})
return
flag
}
//
const checkTableData = (tableDataInfo, tableDataDetailInfo) => {
//
const tableDataInfoKeys = ['tableName', 'tableChName']
//
const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid']
//
let flag = true
//
tableDataInfo.forEach(item => {
//
tableDataInfoKeys.forEach(key => {
//
if (!item[key]) {
//
flag = false
//
proxy.$ElMessage.error('表名称、数据库表不能为空')
//
}
//
})
//
})
//
tableDataDetailInfo.forEach(item => {
//
tableDataDetailInfoKeys.forEach(key => {
//
if (!item[key]) {
//
flag = false
//
proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空')
//
}
//
})
//
})
//
return flag
//
}
const
guid
=
ref
(
''
)
const
submit
=
async
()
=>
{
console
.
log
(
'提交'
,
tableDataDetailInfo
.
value
,
tableDataInfo
.
value
)
// 校验表格数据是否填写完整
if
(
!
checkTableData
(
tableDataDetailInfo
.
value
,
tableDataInfo
.
value
))
{
return
const
params
=
{
tableName
:
tableDataInfo
.
value
[
0
].
tableName
,
tableChName
:
tableDataInfo
.
value
[
0
].
tableChName
,
foundMode
:
route
.
query
.
foundMode
,
}
// 校验表格数据是否填写完整
// if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) {
// return
// }
/**
"guid": "string",
"cgDirName": "string",
...
...
@@ -407,7 +450,15 @@ const submit = async () => {
*/
// 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
if
(
!
guid
.
value
)
{
saveOrUpdate
({},
0
)
saveOrUpdate
({
tableName
:
tableDataInfo
.
value
[
0
].
tableName
,
tableChName
:
tableDataInfo
.
value
[
0
].
tableChName
,
databaseGuid
:
route
.
query
.
databaseGuid
||
''
,
database
:
route
.
query
.
database
||
''
,
databaseChName
:
route
.
query
.
databaseChName
||
''
,
foundMode
:
route
.
query
.
foundMode
,
isDraft
:
'N'
,
},
0
)
}
else
{
saveOrUpdate
({},
1
)
}
...
...
@@ -425,7 +476,6 @@ const saveOrUpdate = async (params: any = {}, type) => {
tableChName
:
''
,
databaseGuid
:
''
,
database
:
''
,
dbType
:
''
,
databaseChName
:
''
,
foundMode
:
0
,
state
:
0
,
...
...
@@ -519,6 +569,10 @@ const newCreateSqlDialogInfo = ref({
newCreateSqlDialogInfo
.
value
.
submitBtnLoading
=
true
;
const
params
=
{
...
info
,
tableName
:
tableDataInfo
.
value
[
0
].
tableName
,
tableChName
:
tableDataInfo
.
value
[
0
].
tableChName
,
foundMode
:
route
.
query
.
foundMode
,
isDraft
:
'N'
,
};
await
saveOrUpdate
(
params
,
2
);
newCreateSqlDialogInfo
.
value
.
submitBtnLoading
=
false
;
...
...
@@ -597,42 +651,55 @@ const createNewSql = () => {
}"
>
<el-table-column
type=
"selection"
:width=
"32"
align=
"center"
/>
<!-- 排序列(不可编辑) -->
<el-table-column
prop=
"id
"
label=
"排序"
width=
"80"
align=
"center"
/>
<el-table-column
type=
"index
"
label=
"排序"
width=
"80"
align=
"center"
/>
<!-- 字段中文名(不可编辑)fieldChName -->
<el-table-column
prop=
"field
Name"
label=
"
字段中文名"
width=
"150"
>
<el-table-column
prop=
"field
ChName"
label=
"目标
字段中文名"
width=
"150"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
field
Name
?
scope
.
row
.
field
Name
:
'--'
}}
{{
scope
.
row
.
field
ChName
?
scope
.
row
.
fieldCh
Name
:
'--'
}}
</
template
>
</el-table-column>
<!-- 字段英文名(不可编辑) -->
<el-table-column
prop=
"field
English"
label=
"
字段英文名"
width=
"150"
>
<el-table-column
prop=
"field
Name"
label=
"目标
字段英文名"
width=
"150"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
field
English
?
scope
.
row
.
fieldEnglish
:
'--'
}}
{{
scope
.
row
.
field
Name
?
scope
.
row
.
fieldName
:
'--'
}}
</
template
>
</el-table-column>
<!--
分类(不可编辑)classifyName
-->
<el-table-column
prop=
"
classifyName"
label=
"分类
"
width=
"150"
>
<!--
源数据库
-->
<el-table-column
prop=
"
sourceDatabase"
label=
"源数据库
"
width=
"150"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
classifyName
?
scope
.
row
.
classifyNam
e
:
'--'
}}
{{
scope
.
row
.
sourceDatabase
?
scope
.
row
.
sourceDatabas
e
:
'--'
}}
</
template
>
</el-table-column>
<!--
分级(不可编辑)
-->
<el-table-column
prop=
"
gradeDetailName"
label=
"分级"
width=
"120"
align=
"center
"
>
<!--
源数据表
-->
<el-table-column
prop=
"
sourceTableName"
label=
"源数据表"
width=
"150
"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
gradeDetailName
?
scope
.
row
.
gradeDetailName
:
'--'
}}
{{
scope
.
row
.
sourceTableName
?
scope
.
row
.
sourceTableName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 源字段中文 -->
<el-table-column
prop=
"sourceFieldChName"
label=
"源字段中文"
width=
"150"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
sourceFieldChName
?
scope
.
row
.
sourceFieldChName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 源字段英文 -->
<el-table-column
prop=
"sourceFieldName"
label=
"源字段英文"
width=
"150"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
sourceFieldName
?
scope
.
row
.
sourceFieldName
:
'--'
}}
</
template
>
</el-table-column>
<!--
字段类型fieldType (不可编辑)
-->
<el-table-column
prop=
"fieldType"
label=
"
字段类型"
width=
"150"
align=
"center
"
>
<!--
源端字段 fieldType
-->
<el-table-column
prop=
"fieldType"
label=
"
源端字段类型"
width=
"150
"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
fieldType
?
scope
.
row
.
fieldType
:
'--'
}}
</
template
>
</el-table-column>
<!-- 长度(可编辑) -->
<el-table-column
prop=
"
l
ength"
label=
"长度"
width=
"120"
align=
"center"
>
<el-table-column
prop=
"
fieldL
ength"
label=
"长度"
width=
"120"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.length"
>
{{
scope
.
row
.
length
?
scope
.
row
.
length
<span
v-if=
"!scope.row.isEdit || !editableFields.length"
>
{{
scope
.
row
.
fieldLength
?
scope
.
row
.
fieldLength
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.length"
placeholder=
"请输入长度"
/>
</
template
>
...
...
@@ -656,34 +723,39 @@ const createNewSql = () => {
</el-table-column>
<!-- 数据是否唯一(可编辑) -->
<el-table-column
prop=
"is
Unique"
label=
"数据是否唯一
"
width=
"150"
align=
"center"
>
<el-table-column
prop=
"is
Primary"
label=
"是否主键
"
width=
"150"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit || !editableFields.
isUnique"
>
{{
scope
.
row
.
isUnique
?
scope
.
row
.
isUnique
:
<span
v-if=
"!scope.row.isEdit || !editableFields.
length"
>
{{
scope
.
row
.
isPrimary
?
scope
.
row
.
isPrimary
:
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.is
Unique
"
placeholder=
"请选择"
>
<el-select
v-else
v-model=
"scope.row.is
Primary
"
placeholder=
"请选择"
>
<el-option
label=
"是"
value=
"是"
/>
<el-option
label=
"否"
value=
"否"
/>
</el-select>
</
template
>
</el-table-column>
<!-- 是否必填(可编辑) -->
<el-table-column
prop=
"is
Required
"
label=
"是否必填"
width=
"120"
align=
"center"
>
<el-table-column
prop=
"is
NotNull
"
label=
"是否必填"
width=
"120"
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
is
Required
?
scope
.
row
.
isRequired
:
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.is
Required
"
placeholder=
"请选择"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
is
NotNull
?
scope
.
row
.
isNotNull
:
'--'
}}
</span>
<el-select
v-else
v-model=
"scope.row.is
NotNull
"
placeholder=
"请选择"
>
<el-option
label=
"是"
value=
"是"
/>
<el-option
label=
"否"
value=
"否"
/>
</el-select>
</
template
>
</el-table-column>
<!-- 字段取值范围 fieldValueRange(可编辑)-->
<el-table-column
prop=
"fieldValueRange"
label=
"字段取值范围"
width=
"150"
align=
"center"
>
<!-- 分类(不可编辑)classifyName -->
<el-table-column
prop=
"classifyName"
label=
"分类"
width=
"150"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.isEdit"
>
{{
scope
.
row
.
fieldValueRange
?
scope
.
row
.
fieldValueRange
:
'--'
}}
</span>
<el-input
v-else
v-model=
"scope.row.fieldValueRange"
placeholder=
"请输入字段取值范围"
/>
{{
scope
.
row
.
classifyName
?
scope
.
row
.
classifyName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 分级(不可编辑) -->
<el-table-column
prop=
"gradeDetailName"
label=
"分级"
width=
"120"
align=
"center"
>
<
template
#
default=
"scope"
>
{{
scope
.
row
.
gradeDetailName
?
scope
.
row
.
gradeDetailName
:
'--'
}}
</
template
>
</el-table-column>
<!-- 操作列 -->
<el-table-column
label=
"操作"
width=
"100"
align=
"center"
fixed=
"right"
>
<
template
#
default=
"scope"
>
...
...
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