Browse Source

元数据 业务关系优化

master
xueyinfei 2 days ago
parent
commit
b1cb66973e
  1. 12
      vue-fastapi-backend/module_admin/dao/meta_dao.py
  2. 3
      vue-fastapi-backend/module_admin/service/meta_service.py
  3. 20
      vue-fastapi-frontend/src/views/meta/metaInfo/businssRelation.vue
  4. 2
      vue-fastapi-frontend/src/views/meta/metaInfo/index.vue

12
vue-fastapi-backend/module_admin/dao/meta_dao.py

@ -494,6 +494,18 @@ class MetaDao:
)).first() )).first()
return CamelCaseUtil.transform_result(result) return CamelCaseUtil.transform_result(result)
@classmethod
async def get_meta_table_cn_name(cls, db: AsyncSession, sysCode, mdlName, tabEngName):
sql = text("select case when a.tab_cn_name is null then b.tab_crrct_name"
" when a.tab_cn_name is not null then a.tab_cn_name end as tab_cn_name"
" from t_metadata_extract_info a "
"left join t_metadata_supp_info b "
"on a.ssys_cd = b.ssys_cd and a.mdl_name=b.mdl_name and a.tab_eng_name=b.tab_crrct_name "
"where a.ssys_cd = :sysCode and a.mdl_name = :mdlName and a.tab_eng_name = :tabEngName")
result = (await db.execute(sql, {"sysCode": sysCode, "mdlName": mdlName, "tabEngName": tabEngName}))
return result.first().tab_cn_name
@classmethod @classmethod
async def get_meta_col_name_list(cls, db: AsyncSession, query_object: MetaColObject): async def get_meta_col_name_list(cls, db: AsyncSession, query_object: MetaColObject):
query_result = ( query_result = (

3
vue-fastapi-backend/module_admin/service/meta_service.py

@ -402,6 +402,9 @@ class MetaService:
query_object.tab_name = table['tab_eng_name'] query_object.tab_name = table['tab_eng_name']
meta_result = await MetaDao.get_meta_col_name_list(result_db, query_object) meta_result = await MetaDao.get_meta_col_name_list(result_db, query_object)
result = CamelCaseUtil.transform_result(meta_result) result = CamelCaseUtil.transform_result(meta_result)
tableCnName = await MetaDao.get_meta_table_cn_name(result_db, table['ssys_cd'], table['mdl_name'],
table['tab_eng_name'])
table['tab_cn_name'] = tableCnName
table['column'] = result table['column'] = result
result = { result = {
"tableList": tableList, "tableList": tableList,

20
vue-fastapi-frontend/src/views/meta/metaInfo/businssRelation.vue

@ -10,8 +10,14 @@ const props = defineProps({
type: Object, type: Object,
default: () => {} default: () => {}
}, },
type: {
type:String, type:String,
default:()=>"" default:()=>""
},
currentTable: {
type:Object,
default:()=>{}
}
}) })
const g6data = ref([]) const g6data = ref([])
@ -300,7 +306,7 @@ function initG6() {
registerNode("dice-er-box", { registerNode("dice-er-box", {
draw(cfg, group) { draw(cfg, group) {
const width = 250; const width = 300;
const { const {
attrs = [], attrs = [],
startIndex = 0, startIndex = 0,
@ -308,10 +314,16 @@ function initG6() {
collapsed, collapsed,
icon, icon,
} = cfg; } = cfg;
let currentTableLabel = props.currentTable.tabEngName
if (props.currentTable.tabCnName && props.currentTable.tabCnName.length>0){
currentTableLabel += "("+props.currentTable.tabCnName+")"
}else if (props.currentTable.tabCrrctName && props.currentTable.tabCnName.tabCrrctName>0){
currentTableLabel += "("+props.currentTable.tabCrrctName+")"
}
const list = attrs; const list = attrs;
const itemCount = list.length; const itemCount = list.length;
const boxStyle = { const boxStyle = {
stroke: "#096DD9", stroke: currentTableLabel === cfg.label?"#67C23A":"#096DD9",
radius: 4, radius: 4,
}; };
const afterList = list.slice( const afterList = list.slice(
@ -596,7 +608,7 @@ function initG6() {
width, width,
height, height,
defaultNode: { defaultNode: {
size: [300, 200], size: [350, 200],
type: 'dice-er-box', type: 'dice-er-box',
color: '#5B8FF9', color: '#5B8FF9',
style: { style: {
@ -646,7 +658,7 @@ watch(
let table = props.data.tableList[i] let table = props.data.tableList[i]
let g6Tab = { let g6Tab = {
id: table.ssys_cd+"-"+table.mdl_name+"-"+table.tab_eng_name, id: table.ssys_cd+"-"+table.mdl_name+"-"+table.tab_eng_name,
label: table.tab_eng_name, label: table.tab_eng_name + ((table.tab_cn_name && table.tab_cn_name.length>0)?"("+table.tab_cn_name+")":""),
attrs:[], attrs:[],
collapsed:true collapsed:true
} }

2
vue-fastapi-frontend/src/views/meta/metaInfo/index.vue

@ -321,7 +321,7 @@
</el-form> </el-form>
</div> </div>
<div style="width: 100%;height: 100%"> <div style="width: 100%;height: 100%">
<businss-relation :data="businessRelation" :type="businessOptionSelect"></businss-relation> <businss-relation :currentTable="currentMetaData" :data="businessRelation" :type="businessOptionSelect"></businss-relation>
</div> </div>
</div> </div>
</el-tab-pane> </el-tab-pane>

Loading…
Cancel
Save