元数据标准
Showing
6 changed files
with
119 additions
and
8 deletions
| ... | @@ -365,6 +365,13 @@ export const deleteMetaStandardDataFields = (params) => request({ | ... | @@ -365,6 +365,13 @@ export const deleteMetaStandardDataFields = (params) => request({ |
| 365 | method: 'delete', | 365 | method: 'delete', |
| 366 | data: params | 366 | data: params |
| 367 | }) | 367 | }) |
| 368 | /** 元数据标准-导出 */ | ||
| 369 | export const exportMetaStandardData = (params) => request({ | ||
| 370 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/data-export`, | ||
| 371 | method: 'post', | ||
| 372 | data: params, | ||
| 373 | responseType: 'blob' | ||
| 374 | }) | ||
| 368 | /** 标准代码-树形表 */ | 375 | /** 标准代码-树形表 */ |
| 369 | export const getStandardCodeTree = () => request({ | 376 | export const getStandardCodeTree = () => request({ |
| 370 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/code-tree`, | 377 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/code-tree`, | ... | ... |
| ... | @@ -240,6 +240,17 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -240,6 +240,17 @@ const routes: RouteRecordRaw[] = [ |
| 240 | cache: true, | 240 | cache: true, |
| 241 | activeMenu: '/data-meta/metadata-standard/standard-codetable' | 241 | activeMenu: '/data-meta/metadata-standard/standard-codetable' |
| 242 | } | 242 | } |
| 243 | }, | ||
| 244 | { | ||
| 245 | path: 'standard-meta-import', | ||
| 246 | name: 'standardMetaImport', | ||
| 247 | component: () => import('@/views/data_meta/standard-meta-import.vue'), | ||
| 248 | meta: { | ||
| 249 | title: '元数据标准导入', | ||
| 250 | breadcrumb: false, | ||
| 251 | cache: true, | ||
| 252 | activeMenu: '/data-meta/metadata-standard' | ||
| 253 | } | ||
| 243 | } | 254 | } |
| 244 | ] | 255 | ] |
| 245 | } | 256 | } | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | > | 7 | > |
| 8 | <el-form :model="form" :rules="formRules" ref="formEl" style="min-height: 200px;"> | 8 | <el-form :model="form" :rules="formRules" ref="formEl" style="min-height: 200px;"> |
| 9 | <el-row> | 9 | <el-row> |
| 10 | <el-col v-for="item,index in fields" :key="index" :span="12" style="padding-right:10px"> | 10 | <el-col v-for="item,index in fields" :key="index" :span="12" style="padding-right:10px;margin-bottom:10px;"> |
| 11 | <el-form-item :label="item.fileNameCodeName" :prop="item.fileNameCode"> | 11 | <el-form-item :label="item.fileNameCodeName" :prop="item.fileNameCode"> |
| 12 | <el-input | 12 | <el-input |
| 13 | v-if="item.inputTypeCode == '1' || item.inputTypeCode == '3'" | 13 | v-if="item.inputTypeCode == '1' || item.inputTypeCode == '3'" |
| ... | @@ -20,10 +20,17 @@ | ... | @@ -20,10 +20,17 @@ |
| 20 | filterable | 20 | filterable |
| 21 | clearable | 21 | clearable |
| 22 | placeholder="请选择" | 22 | placeholder="请选择" |
| 23 | size="small" | ||
| 23 | > | 24 | > |
| 24 | <el-option v-for="op in formOptions[item.fileNameCode]" :label="op.label" :value="op.value" :key="op.value"></el-option> | 25 | <el-option v-for="op in formOptions[item.fileNameCode]" :label="op.label" :value="op.value" :key="op.value"></el-option> |
| 25 | </el-select> | 26 | </el-select> |
| 26 | 27 | <el-tree-select | |
| 28 | v-else-if="item.inputTypeCode == '4'" | ||
| 29 | v-model="form[item.fileNameCode]" | ||
| 30 | :data="standardCodeTree" | ||
| 31 | :props="treeSelectProps" | ||
| 32 | placeholder="请选择" | ||
| 33 | /> | ||
| 27 | </el-form-item> | 34 | </el-form-item> |
| 28 | </el-col> | 35 | </el-col> |
| 29 | </el-row> | 36 | </el-row> |
| ... | @@ -39,7 +46,7 @@ | ... | @@ -39,7 +46,7 @@ |
| 39 | import { watch } from 'vue' | 46 | import { watch } from 'vue' |
| 40 | import { ElMessage } from "element-plus"; | 47 | import { ElMessage } from "element-plus"; |
| 41 | import { getParamsList } from '@/api/modules/dataAsset' | 48 | import { getParamsList } from '@/api/modules/dataAsset' |
| 42 | import { saveMetaStandardDataFields, getMetaStandardFieldDetail } from '@/api/modules/dataMetaService' | 49 | import { saveMetaStandardDataFields, getMetaStandardFieldDetail, getStandardCodeTree } from '@/api/modules/dataMetaService' |
| 43 | 50 | ||
| 44 | const { proxy } = getCurrentInstance() as any; | 51 | const { proxy } = getCurrentInstance() as any; |
| 45 | const props = defineProps({ | 52 | const props = defineProps({ |
| ... | @@ -152,6 +159,30 @@ function confirm () { | ... | @@ -152,6 +159,30 @@ function confirm () { |
| 152 | }) | 159 | }) |
| 153 | } | 160 | } |
| 154 | 161 | ||
| 162 | const standardCodeTree = ref([]) | ||
| 163 | const treeSelectProps = { | ||
| 164 | label: 'name', | ||
| 165 | value: 'guid', | ||
| 166 | isLeaf: 'isCode' | ||
| 167 | } | ||
| 168 | function getStandardCodeTreeList () { | ||
| 169 | getStandardCodeTree().then((res:any) => { | ||
| 170 | if (res.code === proxy.$passCode) { | ||
| 171 | const data = res.data | ||
| 172 | data.forEach(item => { | ||
| 173 | if (item.children) { | ||
| 174 | item.children.forEach(subItem => { | ||
| 175 | // 二级的标准名字作为key | ||
| 176 | subItem.guid = subItem.name | ||
| 177 | // subItem.value = subItem.name | ||
| 178 | }) | ||
| 179 | } | ||
| 180 | }) | ||
| 181 | standardCodeTree.value = data | ||
| 182 | } | ||
| 183 | }) | ||
| 184 | } | ||
| 185 | |||
| 155 | watch( | 186 | watch( |
| 156 | () => visible.value, | 187 | () => visible.value, |
| 157 | (v) => { | 188 | (v) => { |
| ... | @@ -159,6 +190,10 @@ watch( | ... | @@ -159,6 +190,10 @@ watch( |
| 159 | initForm() | 190 | initForm() |
| 160 | } | 191 | } |
| 161 | ) | 192 | ) |
| 193 | |||
| 194 | onBeforeMount(() => { | ||
| 195 | getStandardCodeTreeList() | ||
| 196 | }) | ||
| 162 | </script> | 197 | </script> |
| 163 | 198 | ||
| 164 | <style lang="scss"> | 199 | <style lang="scss"> | ... | ... |
| ... | @@ -16,7 +16,7 @@ import { getParamsList } from '@/api/modules/dataAsset' | ... | @@ -16,7 +16,7 @@ import { getParamsList } from '@/api/modules/dataAsset' |
| 16 | import { getStandardCodeList, saveStandardCode, | 16 | import { getStandardCodeList, saveStandardCode, |
| 17 | updateStandardCode, getStandardCodeDetail, | 17 | updateStandardCode, getStandardCodeDetail, |
| 18 | deleteStandardCode, getStandardCodeStandard, exportStandardCodeData, | 18 | deleteStandardCode, getStandardCodeStandard, exportStandardCodeData, |
| 19 | getStandardCodeDataList | 19 | getStandardCodeDataList, getStandardCodeTree |
| 20 | } from '@/api/modules/dataMetaService' | 20 | } from '@/api/modules/dataMetaService' |
| 21 | import { | 21 | import { |
| 22 | addDictionary, | 22 | addDictionary, |
| ... | @@ -1440,8 +1440,30 @@ const radioGroupChange = async (val, info) => { | ... | @@ -1440,8 +1440,30 @@ const radioGroupChange = async (val, info) => { |
| 1440 | } | 1440 | } |
| 1441 | } | 1441 | } |
| 1442 | 1442 | ||
| 1443 | function initTree () { | ||
| 1444 | Promise.all([getParamsList({ dictType: '标准类型'}), getStandardCodeTree()]).then((resList:any) => { | ||
| 1445 | let treeRoot = resList[0].data || [] | ||
| 1446 | let treeData = resList[1].data || [] | ||
| 1447 | console.log('treeRoot', treeRoot) | ||
| 1448 | console.log('treeData', treeData) | ||
| 1449 | let tree = treeRoot.map(item => { | ||
| 1450 | let obj:any = {} | ||
| 1451 | obj.treeLevel = 1 | ||
| 1452 | obj.guid = item.value | ||
| 1453 | obj.name = item.label | ||
| 1454 | let target = treeData.find(v => v.guid === item.value) | ||
| 1455 | obj.children = target ? target.children : null | ||
| 1456 | return obj | ||
| 1457 | }) | ||
| 1458 | // standardOptions.value = treeRoot | ||
| 1459 | // treeInfo.value.data = tree | ||
| 1460 | // nodeClick(tree[0]) | ||
| 1461 | }) | ||
| 1462 | } | ||
| 1463 | |||
| 1443 | onBeforeMount(() => { | 1464 | onBeforeMount(() => { |
| 1444 | // getDataType() | 1465 | // getDataType() |
| 1466 | // initTree() | ||
| 1445 | getTreeData().then(() => { | 1467 | getTreeData().then(() => { |
| 1446 | // 默认展开第一个 | 1468 | // 默认展开第一个 |
| 1447 | let data = treeInfo.value.data | 1469 | let data = treeInfo.value.data | ... | ... |
src/views/data_meta/standard-meta-import.vue
0 → 100644
This diff is collapsed.
Click to expand it.
| ... | @@ -15,7 +15,7 @@ import { download } from '@/utils/common' | ... | @@ -15,7 +15,7 @@ import { download } from '@/utils/common' |
| 15 | import { getParamsList } from '@/api/modules/dataAsset' | 15 | import { getParamsList } from '@/api/modules/dataAsset' |
| 16 | import { getMetaStandardTree, deleteMetaStandard, | 16 | import { getMetaStandardTree, deleteMetaStandard, |
| 17 | getMetaStandardDataList, getMetaStandardDataFields, | 17 | getMetaStandardDataList, getMetaStandardDataFields, |
| 18 | deleteMetaStandardDataFields | 18 | deleteMetaStandardDataFields, exportMetaStandardData |
| 19 | } from '@/api/modules/dataMetaService' | 19 | } from '@/api/modules/dataMetaService' |
| 20 | import router from '@/router' | 20 | import router from '@/router' |
| 21 | import { TableColumnWidth } from '@/utils/enum'; | 21 | import { TableColumnWidth } from '@/utils/enum'; |
| ... | @@ -52,8 +52,9 @@ const treeInfo = ref({ | ... | @@ -52,8 +52,9 @@ const treeInfo = ref({ |
| 52 | function nodeClick (data) { | 52 | function nodeClick (data) { |
| 53 | console.log('nodeData', data) | 53 | console.log('nodeData', data) |
| 54 | treeInfo.value.currentObj = data | 54 | treeInfo.value.currentObj = data |
| 55 | getFirstPageData() | 55 | if (data.level == 1) return |
| 56 | getTableFields() | 56 | getTableFields() |
| 57 | getFirstPageData() | ||
| 57 | } | 58 | } |
| 58 | function treeCustomClick (node, type) { | 59 | function treeCustomClick (node, type) { |
| 59 | console.log(node, type) | 60 | console.log(node, type) |
| ... | @@ -79,6 +80,7 @@ function getTree () { | ... | @@ -79,6 +80,7 @@ function getTree () { |
| 79 | let data = res.data || [] | 80 | let data = res.data || [] |
| 80 | data.forEach(item => { | 81 | data.forEach(item => { |
| 81 | item.showEdit = true | 82 | item.showEdit = true |
| 83 | item.level = 1 | ||
| 82 | }) | 84 | }) |
| 83 | treeInfo.value.data = data | 85 | treeInfo.value.data = data |
| 84 | treeInfo.value.expandedKey = [data[0].guid] | 86 | treeInfo.value.expandedKey = [data[0].guid] |
| ... | @@ -377,6 +379,40 @@ function openStandardFieldsDialog (type, data = {}) { | ... | @@ -377,6 +379,40 @@ function openStandardFieldsDialog (type, data = {}) { |
| 377 | standardFieldsDialog.visible = true | 379 | standardFieldsDialog.visible = true |
| 378 | } | 380 | } |
| 379 | 381 | ||
| 382 | function importData () { | ||
| 383 | let currentTreeObj:any = treeInfo.value.currentObj | ||
| 384 | console.log('currentTree', currentTreeObj) | ||
| 385 | let uploadSetting:any = [] | ||
| 386 | if (currentTreeObj.children) { | ||
| 387 | uploadSetting = currentTreeObj.children.map((item:any) => { | ||
| 388 | return { | ||
| 389 | standardName: item.standardName, | ||
| 390 | standardGuid: item.guid | ||
| 391 | } | ||
| 392 | }) | ||
| 393 | } else { | ||
| 394 | uploadSetting = [{ | ||
| 395 | standardName: currentTreeObj.standardName, | ||
| 396 | standardGuid: currentTreeObj.guid | ||
| 397 | }] | ||
| 398 | } | ||
| 399 | cacheStore.setCatch('uploadSetting', uploadSetting) | ||
| 400 | router.push({ | ||
| 401 | path: '/data-meta/metadata-standard/standard-meta-import', | ||
| 402 | }); | ||
| 403 | } | ||
| 404 | |||
| 405 | function exportData () { | ||
| 406 | let body = [treeInfo.value.currentObj.guid] | ||
| 407 | exportMetaStandardData(body).then((res:any) => { | ||
| 408 | if (res && !res.msg) { | ||
| 409 | download(res, '元数据标准表.xlsx', 'excel') | ||
| 410 | } else { | ||
| 411 | res?.msg && ElMessage.error(res?.msg); | ||
| 412 | } | ||
| 413 | }) | ||
| 414 | } | ||
| 415 | |||
| 380 | onBeforeMount(() => { | 416 | onBeforeMount(() => { |
| 381 | getTree() | 417 | getTree() |
| 382 | }) | 418 | }) |
| ... | @@ -412,8 +448,8 @@ const viewGraph = () => { | ... | @@ -412,8 +448,8 @@ const viewGraph = () => { |
| 412 | <div class="table_tool_wrap"> | 448 | <div class="table_tool_wrap"> |
| 413 | <div class="tools_btns"> | 449 | <div class="tools_btns"> |
| 414 | <el-button type="primary" @click="() => openStandardFieldsDialog('add')" v-preReClick>新建</el-button> | 450 | <el-button type="primary" @click="() => openStandardFieldsDialog('add')" v-preReClick>新建</el-button> |
| 415 | <el-button @click="batching('export')" v-preReClick>导入</el-button> | 451 | <el-button @click="importData" v-preReClick>导入</el-button> |
| 416 | <el-button @click="batching('delete')" v-preReClick>导出</el-button> | 452 | <el-button @click="exportData" v-preReClick>导出</el-button> |
| 417 | <el-button @click="viewGraph" v-preReClick>查看</el-button> | 453 | <el-button @click="viewGraph" v-preReClick>查看</el-button> |
| 418 | </div> | 454 | </div> |
| 419 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索" | 455 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索" | ... | ... |
-
Please register or sign in to post a comment