15334b20 by fanguang Committed by lihua

标准代码表fix

1 parent 1b45aaba
...@@ -10,7 +10,11 @@ import Table from '@/components/Table/index.vue' ...@@ -10,7 +10,11 @@ import Table from '@/components/Table/index.vue'
10 // import Dialog from '@/components/Dialog/index.vue' 10 // import Dialog from '@/components/Dialog/index.vue'
11 import useCatchStore from "@/store/modules/catch"; 11 import useCatchStore from "@/store/modules/catch";
12 import { chunk } from '@/utils/common' 12 import { chunk } from '@/utils/common'
13 import { getStandardCodeDataList, getStandardCodeFields, saveStandardCodeFieldsData, deleteStandardCodeFieldsData } from '@/api/modules/dataMetaService' 13 import { getStandardCodeDataList, getStandardCodeFields,
14 saveStandardCodeFieldsData, deleteStandardCodeFieldsData,
15 exportStandardCodeData
16 } from '@/api/modules/dataMetaService'
17 import { download } from '@/utils/common'
14 18
15 import { 19 import {
16 saveDictionaryData, 20 saveDictionaryData,
...@@ -36,11 +40,11 @@ const page = ref({ ...@@ -36,11 +40,11 @@ const page = ref({
36 limit: 50, 40 limit: 50,
37 curr: 1, 41 curr: 1,
38 sizes: [ 42 sizes: [
43 { label: "10", value: 10 },
44 { label: "50", value: 50 },
39 { label: "100", value: 100 }, 45 { label: "100", value: 100 },
40 { label: "200", value: 200 }, 46 { label: "200", value: 200 },
41 { label: "300", value: 300 }, 47 { label: "300", value: 300 },
42 { label: "400", value: 400 },
43 { label: "500", value: 500 },
44 ], 48 ],
45 }); 49 });
46 const tableChunkData: any = ref([]) 50 const tableChunkData: any = ref([])
...@@ -136,7 +140,12 @@ const getTableData = (params) => { ...@@ -136,7 +140,12 @@ const getTableData = (params) => {
136 console.log(resList) 140 console.log(resList)
137 let schemaDataVOS = resList[0].data || [] 141 let schemaDataVOS = resList[0].data || []
138 let jsonArray = resList[1].data.records || [] 142 let jsonArray = resList[1].data.records || []
143 let data = resList[1].data
144 tableInfo.value.page.limit = data.pageSize
145 tableInfo.value.page.curr = data.pageIndex
146 tableInfo.value.page.rows = data.totalRows
139 setUploadDataInfo({schemaDataVOS,jsonArray}, true) 147 setUploadDataInfo({schemaDataVOS,jsonArray}, true)
148
140 }).finally(() => tableInfo.value.loading = false) 149 }).finally(() => tableInfo.value.loading = false)
141 }; 150 };
142 151
...@@ -145,6 +154,7 @@ const tableSelectionChange = (val, tId) => { ...@@ -145,6 +154,7 @@ const tableSelectionChange = (val, tId) => {
145 }; 154 };
146 155
147 const tablePageChange = (info) => { 156 const tablePageChange = (info) => {
157 console.log('info', info)
148 page.value.curr = Number(info.curr); 158 page.value.curr = Number(info.curr);
149 page.value.limit = Number(info.limit); 159 page.value.limit = Number(info.limit);
150 toSearch({}); 160 toSearch({});
...@@ -172,6 +182,7 @@ const toolBtnClick = (btn) => { ...@@ -172,6 +182,7 @@ const toolBtnClick = (btn) => {
172 nextTick(() => { 182 nextTick(() => {
173 router.push({ 183 router.push({
174 path: '/data-meta/metadata-standard/standard-import', 184 path: '/data-meta/metadata-standard/standard-import',
185 query: { bizGuid: standardGuid.value }
175 }); 186 });
176 }) 187 })
177 } else if (type == 'submit') { 188 } else if (type == 'submit') {
...@@ -248,7 +259,18 @@ const uploadBtnClick = (btn) => { ...@@ -248,7 +259,18 @@ const uploadBtnClick = (btn) => {
248 } 259 }
249 260
250 const exportData = (type: any = null) => { 261 const exportData = (type: any = null) => {
251 emits('exportData', type) 262 // emits('exportData', type)
263 let body = {
264 standardCodeGuid: standardGuid.value,
265 standardCodeDataGuids: selectRowData.value.map(v => v.guid)
266 }
267 exportStandardCodeData(body).then((res:any) => {
268 if (res && !res.msg) {
269 download(res, '标准代码表.xlsx', 'excel')
270 } else {
271 res?.msg && ElMessage.error(res?.msg);
272 }
273 })
252 } 274 }
253 275
254 const importData = (file: any = null) => { 276 const importData = (file: any = null) => {
...@@ -300,13 +322,6 @@ const checkParamsData = (scope: any = null) => { ...@@ -300,13 +322,6 @@ const checkParamsData = (scope: any = null) => {
300 delete obj.NOTES 322 delete obj.NOTES
301 delete obj.STATE 323 delete obj.STATE
302 delete obj.ROWID 324 delete obj.ROWID
303 // if (item.STATE === 'Running') {
304 for (var i in obj) {
305 if (obj[i] == '') {
306 pass = false
307 }
308 }
309 // }
310 if (obj.guid !== undefined) { 325 if (obj.guid !== undefined) {
311 upJsonArray.push(obj) 326 upJsonArray.push(obj)
312 } else { 327 } else {
...@@ -330,6 +345,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { ...@@ -330,6 +345,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => {
330 passInfo = checkParamData 345 passInfo = checkParamData
331 } else { 346 } else {
332 passInfo = await checkParamsData(scope) 347 passInfo = await checkParamsData(scope)
348 console.log('passInfo', passInfo)
333 if (!passInfo.pass) { 349 if (!passInfo.pass) {
334 ElMessage({ 350 ElMessage({
335 type: 'error', 351 type: 'error',
...@@ -346,9 +362,18 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { ...@@ -346,9 +362,18 @@ const saveData = async (scope: any = null, checkParamData: any = null) => {
346 let obj = { 362 let obj = {
347 standardGuid: standardGuid.value, 363 standardGuid: standardGuid.value,
348 standardCodeValue, 364 standardCodeValue,
349 guid: item.guid || null, 365 // guid: item.guid || null,
350 standardCodeId: item.standardCodeId || null, 366 // standardCodeId: item.standardCodeId || null,
351 parentId: item.parentId || null 367 // parentId: item.parentId || null
368 }
369 if (item.guid) {
370 obj.guid = item.guid
371 }
372 if (item.standardCodeId) {
373 obj.standardCodeId = item.standardCodeId
374 }
375 if (item.parentId) {
376 obj.parentId = item.parentId
352 } 377 }
353 return obj 378 return obj
354 }) 379 })
...@@ -439,7 +464,7 @@ const setUploadDataInfo = async (info, setField = false) => { ...@@ -439,7 +464,7 @@ const setUploadDataInfo = async (info, setField = false) => {
439 } 464 }
440 orginData.value = JSON.parse(JSON.stringify(tableData.value)) 465 orginData.value = JSON.parse(JSON.stringify(tableData.value))
441 tableInfo.value.data = tableData.value 466 tableInfo.value.data = tableData.value
442 tableInfo.value.page.rows = tableData.value.length 467 // tableInfo.value.page.rows = tableData.value.length
443 // if (setField) { 468 // if (setField) {
444 // orginData.value = data 469 // orginData.value = data
445 // } else { 470 // } else {
......
...@@ -857,7 +857,7 @@ const tableSwitchChange = (val, scope, field) => { ...@@ -857,7 +857,7 @@ const tableSwitchChange = (val, scope, field) => {
857 const tableBtnClick = (scope, btn) => { 857 const tableBtnClick = (scope, btn) => {
858 const type = btn.value; 858 const type = btn.value;
859 const row = scope.row; 859 const row = scope.row;
860 if (type == "edit" || type == 'detail') { 860 if (type == "edit") {
861 fieldTableInfo.value.tableInfo.fields = [] 861 fieldTableInfo.value.tableInfo.fields = []
862 fieldTableInfo.value.tableInfo.data = [] 862 fieldTableInfo.value.tableInfo.data = []
863 drawerInfo.value.header.title = type == 'edit' ? "编辑标准代码" : "标准代码详情"; 863 drawerInfo.value.header.title = type == 'edit' ? "编辑标准代码" : "标准代码详情";
...@@ -895,6 +895,15 @@ const tableBtnClick = (scope, btn) => { ...@@ -895,6 +895,15 @@ const tableBtnClick = (scope, btn) => {
895 tableInfo.value.loading = true 895 tableInfo.value.loading = true
896 open("此操作将永久删除, 是否继续?", "warning"); 896 open("此操作将永久删除, 是否继续?", "warning");
897 tableInfo.value.loading = false 897 tableInfo.value.loading = false
898 } else if (type == 'detail') {
899 showFiledsPage.value = true
900 nextTick(() => {
901 dictFiledsRef.value.standardGuid = row.guid
902 dictFiledsRef.value.standardName = row.standardName
903 treeCurrentNodeKey.value = row.guid
904 treeInfo.value.currentNodeKey = row.guid
905 dictFiledsRef.value.getFirstPageData()
906 })
898 } 907 }
899 } 908 }
900 909
...@@ -985,7 +994,10 @@ const uploadFile = (file) => { ...@@ -985,7 +994,10 @@ const uploadFile = (file) => {
985 } 994 }
986 995
987 const exportData = (type: any = null) => { 996 const exportData = (type: any = null) => {
988 let body = [treeCurrentNodeKey.value] 997 let body = {
998 standardCodeGuid: treeCurrentNodeKey.value,
999 standardCodeDataGuids: []
1000 }
989 exportStandardCodeData(body).then((res:any) => { 1001 exportStandardCodeData(body).then((res:any) => {
990 if (res && !res.msg) { 1002 if (res && !res.msg) {
991 download(res, '标准代码表.xlsx', 'excel') 1003 download(res, '标准代码表.xlsx', 'excel')
...@@ -1356,7 +1368,7 @@ const drawerBtnClick = (btn, info) => { ...@@ -1356,7 +1368,7 @@ const drawerBtnClick = (btn, info) => {
1356 }), 1368 }),
1357 ...info 1369 ...info
1358 } 1370 }
1359 if (params.typeCode === '1') { 1371 if (params.typeCode === '1' || !params.hierarchy) {
1360 delete params.hierarchy 1372 delete params.hierarchy
1361 } 1373 }
1362 if (drawerInfo.value.type === 'edit') { 1374 if (drawerInfo.value.type === 'edit') {
......
1 <route lang="yaml">
2 ame: metadataStandard
3 </route>
4
5 <script lang="ts" setup name="metadataStandard">
6 import { ref, reactive } from 'vue'
7 import { ElMessage, ElMessageBox } from "element-plus";
8 import { Search, CirclePlus } from '@element-plus/icons-vue'
9 import Tree from '@/components/Tree/index.vue'
10 import Table from '@/components/Table/index.vue'
11 import Drawer from '@/components/Drawer/index.vue'
12 import DictFileds from './components/dictFileds.vue'
13 import useCatchStore from "@/store/modules/catch";
14 import { download } from '@/utils/common'
15 import { getParamsList } from '@/api/modules/dataAsset'
16 import { getStandardCodeList } from '@/api/modules/dataMetaService'
17 import router from '@/router'
18 import { TableColumnWidth } from '@/utils/enum';
19
20 const { proxy } = getCurrentInstance() as any;
21
22 const cacheStore = useCatchStore()
23 const showFiledsPage = ref(false)
24
25 // 树菜单
26 const treeInfo = ref({
27 id: "data-pickup-tree",
28 filter: true,
29 queryValue: "",
30 queryPlaceholder: "请输入关键字搜索",
31 props: {
32 label: "label",
33 value: "value",
34 isLeaf: "isLeaf",
35 },
36 lazy: true,
37 nodeKey: 'value',
38 expandedKey: ['01'],
39 currentNodeKey: '01',
40 data: [],
41 expandOnNodeClick: false,
42 loading: false,
43 currentObj: {}
44 })
45 function nodeClick (data) {
46 drawerInfo.value.visible = false
47 const changeCont = () => {
48 nextTick(() => {
49 treeInfo.value.currentNodeKey = data.value
50 treeInfo.value.currentObj = data
51 if (data.isLeaf) {
52 showFiledsPage.value = true
53 nextTick(() => {
54 dictFiledsRef.value.standardGuid = data.value
55 dictFiledsRef.value.standardName = data.label
56 treeCurrentNodeKey.value = data.value
57 dictFiledsRef.value.getFirstPageData()
58 })
59 } else {
60 showFiledsPage.value = false
61 getFirstPageData()
62 }
63 })
64 }
65 if (showFiledsPage.value) {
66 const toChange = dictFiledsRef.value.checkSave()
67 if (!toChange) {
68 ElMessageBox.confirm(
69 '存在未保存的数据,切换后会丢失,是否确定切换',
70 '提示',
71 {
72 confirmButtonText: '确定',
73 cancelButtonText: '取消',
74 type: 'warning',
75 }
76 ).then(() => {
77 changeCont()
78 }).catch(() => {
79 treeInfo.value.currentNodeKey = dictGuid.value
80 })
81 } else {
82 changeCont()
83 }
84 } else {
85 changeCont()
86 }
87 }
88
89 const tableSearchInput = ref('')
90 const currTableData: any = ref<Object>({});
91 const page = ref({
92 limit: 50,
93 curr: 1,
94 sizes: [
95 { label: "10", value: 10 },
96 { label: "50", value: 50 },
97 { label: "100", value: 100 },
98 { label: "150", value: 150 },
99 { label: "200", value: 200 },
100 ]
101 })
102 const selectRowData = ref([])
103 const selectedRowData = ref([])
104 const tableInfo: any = ref({
105 id: 'data-source-table',
106 multiple: true,
107 fixedSelection: true,
108 fields: [
109 { label: "序号", type: "index", width: 56, align: "center" },
110 { label: '数据源标识符', field: 'codeName', width: 140 },
111 { label: '数据元名称', field: 'standard', width: 140 },
112 { label: '定义', field: 'standardName', width: 140 },
113 { label: '数据类型', field: '', width: 120 },
114 { label: '表示格式', field: 'createTime', width: TableColumnWidth }
115 ],
116 data: [],
117 page: {
118 type: "normal",
119 rows: 0,
120 ...page.value,
121 },
122 actionInfo: {
123 label: "操作",
124 type: "btn",
125 width: 92, //不要刚好90.缩小浏览器会因为小数点的差距而换行,
126 fixed: 'right',
127 btns: [
128 // { label: '查看', value: 'detail'},
129 { label: "编辑", value: "edit" },
130 { label: "删除", value: "delete" },
131 ],
132 },
133 loading: false
134 })
135
136 const formItems: any = ref([
137 {
138 label: '中文名称',
139 type: 'input',
140 placeholder: '请输入',
141 field: 'codeName',
142 default: '',
143 maxlength: 20,
144 clearable: true,
145 required: true
146 },
147 {
148 label: '英文生成规则',
149 type: 'select',
150 placeholder: '请选择',
151 field: 'publishingUnitCode',
152 default: '',
153 options: [],
154 clearable: true,
155 required: true
156 },
157 {
158 label: '英文名称',
159 type: 'input',
160 placeholder: '请输入',
161 field: 'orderNum',
162 default: '',
163 maxlength: 2,
164 clearable: true,
165 required: true
166 },
167 {
168 label: '标准编号',
169 type: 'input',
170 placeholder: '请选择',
171 field: 'codeFieldName',
172 default: '',
173 clearable: true,
174 required: true,
175 visible: true
176 },
177 {
178 label: '标准集',
179 type: 'Select',
180 placeholder: '请选择',
181 field: 'hierarchy',
182 default: '',
183 options: [],
184 clearable: true,
185 visible: false
186 },
187 {
188 label: '字段类型',
189 type: 'Select',
190 placeholder: '请选择',
191 field: 'hierarchy',
192 default: '',
193 options: [],
194 clearable: true,
195 visible: false
196 },
197 {
198 label: '数据分类',
199 type: 'Select',
200 placeholder: '请选择',
201 field: 'hierarchy',
202 default: '',
203 options: [],
204 clearable: true,
205 visible: false
206 },
207 {
208 label: '数据加密等级',
209 type: 'Select',
210 placeholder: '请选择',
211 field: 'hierarchy',
212 default: '',
213 options: [],
214 clearable: true,
215 visible: false
216 },
217 {
218 label: '关联数据字典',
219 type: 'checkbox',
220 placeholder: '请选择',
221 field: 'hierarchy',
222 default: '',
223 options: [],
224 clearable: true,
225 visible: false
226 },
227 {
228 label: '业务定义',
229 type: 'textarea',
230 placeholder: '请选择',
231 field: 'hierarchy',
232 default: '',
233 options: [],
234 clearable: true,
235 visible: false
236 }
237 ])
238 const formRules: any = ref({
239 standardTypeCode: { required: true, message: '请选择标准类型' },
240 codeName: { required: true, message: '请输入代码名称' },
241 standard: { required: true, message: '请输入标准号' },
242 standardName: { required: true, message: '请输入标准名称' },
243 publishingUnitCode: { required: true, message: '请选择发布单位' },
244 orderNum: { required: true, message: '请输入排序' },
245 typeCode: { required: true, message: '请选择代码类型' },
246 codeFields: { required: true, message: '请选择编码字段' },
247 codeFieldName: { required: true, message: '请选择编码名称' }
248 })
249 const formInfo = ref({
250 type: 'form',
251 title: '',
252 col: 'span',
253 formInfo: {
254 id: 'add-dict-form',
255 col: 'col2',
256 readonly: false,
257 items: formItems.value,
258 rules: formRules.value
259 }
260 })
261
262 // 元标准dialog
263 const standardDialog = reactive({
264 visible: false,
265 title: '新增元标准'
266 })
267 function openStandardDialog () {
268 standardDialog.visible = true
269 }
270 </script>
271
1 <template> 272 <template>
2 <div>元数据标准</div> 273 <!-- <div class="container_wrap full flex standard">
274 <div class="aside_wrap">
275 <div class="aside_title">
276 元数据标准列表
277 <el-icon color="#4fa1a4" @click="openStandardDialog">
278 <CirclePlus />
279 </el-icon>
280 </div>
281 <Tree ref="dictTreeRef" :treeInfo="treeInfo" @nodeClick="nodeClick" @loadNode="loadTreeNode"/>
282 </div>
283 <div class="main_wrap">
284 <div class="table_tool_wrap">
285 <div class="tools_btns">
286 <el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button>
287 <el-button @click="batching('export')" v-preReClick>导入</el-button>
288 <el-button @click="batching('delete')" v-preReClick>导出</el-button>
289 <el-button @click="batching('delete')" v-preReClick>查看</el-button>
290 </div>
291 <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索"
292 :suffix-icon="Search" clearable @change="val => getFirstPageData()" />
293 </div>
294 <div class="table_panel_wrap full">
295 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange"
296 @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" />
297 </div>
298 </div>
299 <el-dialog v-model="standardDialog.visible" :title="standardDialog.title" width="700">
300
301 </el-dialog>
302 </div> -->
3 </template> 303 </template>
4 304
5 <script> 305 <style lang="scss">
6 export default { 306 .standard {
307 .el-icon {
308 cursor: pointer;
309 width: 2em;
310 height: 2em
311 }
312 .el-icon svg {
313 width: 20px;
314 height: 20px;
315 }
316 }
317 </style>
318 <style lang="scss" scoped>
319 .container_wrap {
320 .aside_wrap {
321 width: 200px;
322 }
323 .aside_title {
324 display: flex;
325 justify-content: space-between;
326 align-items: center;
327
328 }
7 } 329 }
8 </script>
9 330
10 <style>
11 </style>
...\ No newline at end of file ...\ No newline at end of file
331 .tree_panel {
332 height: 100%;
333 padding-top: 0;
334
335 :deep(.el-tree) {
336 margin: 0;
337 height: calc(100% - 68px);
338 overflow: hidden auto;
339 }
340 }
341 </style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!