9f02fc59 by lxs

Merge branch 'develop' of http://117.78.60.236:8000/csbr-daop/fe-data-asset-management into develop

2 parents 143d818a cf5151e0
......@@ -306,4 +306,10 @@ export const deleteStandardCodeFieldsData = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/data/remove-data`,
method: 'post',
data: params
})
/** 元数据-导出 */
export const exportStandardCodeData = (params) => request({
url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/data/data-export`,
method: 'post',
data: params
})
\ No newline at end of file
......
......@@ -213,6 +213,17 @@ const routes: RouteRecordRaw[] = [
breadcrumb: false,
cache: true
}
},
{
path: 'standard-import',
name: 'metadataStandardImport',
component: () => import('@/views/data_meta/standard-import.vue'),
meta: {
title: '标准代码导入',
breadcrumb: false,
cache: true,
activeMenu: '/data-meta/metadata-standard/standard-codetable'
}
}
]
}
......
......@@ -26,6 +26,7 @@ const { proxy } = getCurrentInstance() as any;
const cacheStore = useCatchStore()
const standardGuid = ref("")
const standardName = ref('')
const tableSearchInput = ref('')
const tableFields: any = ref([])
const orginData: any = ref([])
......@@ -156,19 +157,17 @@ const tablePageChange = (info) => {
};
const toolBtnClick = (btn) => {
console.log('btnType', btn)
const type = btn.value
if (type == 'export') {
exportData()
} else if (type == 'import') {
const info = {
type: 'dictionary',
standardGuid: standardGuid.value
}
const info = [
{ standardGuid: standardGuid.value, standardName: standardName.value }
]
cacheStore.setCatch('uploadSetting', info)
nextTick(() => {
router.push({
path: '/data-inventory/data-dictionary/import-file',
path: '/data-meta/metadata-standard/standard-import',
});
})
} else if (type == 'submit') {
......@@ -537,6 +536,7 @@ const dialogBtnClick = (btn, info) => {
defineExpose({
standardGuid,
standardName,
getFirstPageData,
checkSave
});
......
......@@ -15,7 +15,7 @@ import { download } from '@/utils/common'
import { getParamsList } from '@/api/modules/dataAsset'
import { getStandardCodeList, saveStandardCode,
updateStandardCode, getStandardCodeDetail,
deleteStandardCode, getStandardCodeStandard
deleteStandardCode, getStandardCodeStandard, exportStandardCodeData
} from '@/api/modules/dataMetaService'
import {
addDictionary,
......@@ -38,6 +38,7 @@ import {
checkDictionaryData,
getNewDataTypeList
} from '@/api/modules/dataInventory';
import router from '@/router'
const { proxy } = getCurrentInstance() as any;
......@@ -103,6 +104,7 @@ const page = ref({
],
});
const selectRowData = ref([])
const selectedRowData = ref([])
const tableInfo: any = ref({
id: 'data-source-table',
multiple: true,
......@@ -140,6 +142,7 @@ const orginOptions = [
{ label: 'code', value: 'code' },
{ label: 'name', value: 'name' },
]
let codeOptions = ref([])
const orginItems = [
{
label: '标准类型',
......@@ -306,18 +309,17 @@ const formItems: any = ref([
required: true
},
{
label: '编码字段',
label: '编码字段11',
type: 'select',
placeholder: '请选择',
field: 'codeFields',
default: [],
options: [
{ label: 'code', value: 'code' },
{ label: 'name', value: 'name' }
],
options: codeOptions,
clearable: true,
required: true,
multiple: true
multiple: true,
tagsTooltip: true,
filterable: true,
},
{
label: '编码名称',
......@@ -325,10 +327,7 @@ const formItems: any = ref([
placeholder: '请选择',
field: 'codeFieldName',
default: '',
options: [
{ label: 'code', value: 'code' },
{ label: 'name', value: 'name' }
],
options: codeOptions,
clearable: true,
required: true
},
......@@ -566,7 +565,7 @@ const drawerInfo: any = ref({
btns: [
{ type: 'default', label: '取消', value: 'cancel' },
{ type: 'primary', label: '保存', value: 'submit' },
{ type: 'primary', label: '保存并添加数据', value: 'saveAndAdd', visible: true },
{ type: 'primary', label: '保存并添加数据', value: 'submit', visible: true },
]
},
})
......@@ -759,6 +758,7 @@ const tableSelectionChange = (val, tId) => {
}
} else {
selectRowData.value = val.map((item) => item.guid);
selectedRowData.value = val
}
};
......@@ -789,11 +789,7 @@ const setCodeOptions = () => {
opts.push(row)
}
})
formItems.value.at(-1).children.map(child => {
if (child.type == 'select') {
child.options = opts
}
})
codeOptions.value = opts
}
const toolBtnClick = (btn, data) => {
......@@ -1084,32 +1080,15 @@ const uploadFile = (file) => {
}
const exportData = (type: any = null) => {
if (type == 'model') {
let params = {
guid: dictGuid.value
}
if (drawerInfo.value.type == 'add') {
params.guid = fieldSheetInfo.value.guid
}
exportDictionary(params).then((res: any) => {
if (res && !res.msg) {
download(res, '数据字典模板.xlsx', 'excel')
} else {
res?.msg && ElMessage.error(res?.msg);
}
});
} else {
let params = {
guid: dictGuid.value
let body = [treeCurrentNodeKey.value]
exportStandardCodeData(body).then((res:any) => {
if (res && !res.msg) {
download(res, '标准代码表.xlsx', 'excel')
} else {
res?.msg && ElMessage.error(res?.msg);
}
exportDictionaryFileds(params).then((res: any) => {
if (res && !res.msg) {
download(res, '字典数据.xlsx', 'excel');
} else {
res?.msg && ElMessage.error(res?.msg);
}
});
}
})
return
}
const importData = (file: any = null) => {
......@@ -1222,9 +1201,10 @@ const loadDrawer = async () => {
drawerInfo.value.visible = true
console.log('table', formTable.value)
console.log('formInfo', formInfo)
setCodeOptions()
};
const treeCurrentNodeKey = ref('')
const batching = (type) => {
if (type == 'delete') {
if (selectRowData.value.length == 0) {
......@@ -1238,6 +1218,26 @@ const batching = (type) => {
open("此操作将永久删除, 是否继续?", "warning", true);
tableInfo.value.loading = false
}
if (type == 'export') {
if (selectRowData.value.length == 0) {
ElMessage({
type: 'error',
message: '请选择代码名称',
})
return
}
// console.log(selectedRowData)
let uploadSetting = selectedRowData.value.map(item => {
return {
standardName: item.codeName,
standardGuid: item.guid
}
})
cacheStore.setCatch('uploadSetting', uploadSetting)
router.push({
path: '/data-meta/metadata-standard/standard-import',
});
}
};
const nodeClick = (data) => {
......@@ -1251,6 +1251,8 @@ const nodeClick = (data) => {
showFiledsPage.value = true
nextTick(() => {
dictFiledsRef.value.standardGuid = data.value
dictFiledsRef.value.standardName = data.label
treeCurrentNodeKey.value = data.value
dictFiledsRef.value.getFirstPageData()
})
} else {
......@@ -1354,6 +1356,7 @@ const setDetailInfo = () => {
drawerInfo.value.container.contents = contents.value['add']
drawerInfo.value.visible = true
setCodeOptions()
}
const saveData = async (params) => {
......@@ -1367,7 +1370,7 @@ const saveData = async (params) => {
drawerInfo.value.visible = false
}
}).finally(() => {
drawerInfo.value.footer.btns.map((item: any) => item.disabled = true)
drawerInfo.value.footer.btns.map((item: any) => item.disabled = false)
})
}
......@@ -1495,7 +1498,7 @@ onMounted(() => {
<template>
<div class="container_wrap full flex">
<div class="aside_wrap">
<div class="aside_title">数据字典列表</div>
<div class="aside_title">标准代码列表</div>
<Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/>
</div>
<DictFileds ref="dictFiledsRef" v-if="showFiledsPage" @exportData="exportData" />
......@@ -1504,6 +1507,7 @@ onMounted(() => {
<div class="tools_btns">
<el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button>
<el-button @click="batching('delete')" v-preReClick>批量删除</el-button>
<el-button @click="batching('export')" v-preReClick>批量导入</el-button>
</div>
<el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索"
:suffix-icon="Search" clearable @change="val => getFirstPageData()" />
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!