cf29fe5f by fanguang

fix

1 parent abe3f91c
...@@ -341,4 +341,15 @@ export const deleteMetaStandard = (params) => request({ ...@@ -341,4 +341,15 @@ export const deleteMetaStandard = (params) => request({
341 export const getMetaStandardDetail = (guid) => request({ 341 export const getMetaStandardDetail = (guid) => request({
342 url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/detail?guid=${guid}`, 342 url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/detail?guid=${guid}`,
343 method: 'get' 343 method: 'get'
344 })
345 /** 元数据标准-标准数据 */
346 export const getMetaStandardDataList = (params) => request({
347 url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/page-list`,
348 method: 'post',
349 data: params
350 })
351 /** 元数据标准-标准字段 */
352 export const getMetaStandardDataFields = (metaStandardGuid) => request({
353 url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/get-standard-field?metaStandardGuid=${metaStandardGuid}`,
354 method: 'get'
344 }) 355 })
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
28 const emits = defineEmits(["exportData"]) 28 const emits = defineEmits(["exportData"])
29 const { proxy } = getCurrentInstance() as any; 29 const { proxy } = getCurrentInstance() as any;
30 30
31 const tableEl = ref()
31 const cacheStore = useCatchStore() 32 const cacheStore = useCatchStore()
32 const standardGuid = ref("") 33 const standardGuid = ref("")
33 const standardName = ref('') 34 const standardName = ref('')
...@@ -154,22 +155,32 @@ const tableSelectionChange = (val, tId) => { ...@@ -154,22 +155,32 @@ const tableSelectionChange = (val, tId) => {
154 }; 155 };
155 156
156 const tablePageChange = (info) => { 157 const tablePageChange = (info) => {
157 console.log('info', info) 158 const toChange = checkSave()
158 page.value.curr = Number(info.curr); 159 const changeCont = () => {
159 page.value.limit = Number(info.limit); 160 console.log('info', info)
160 toSearch({}); 161 page.value.curr = Number(info.curr)
161 // page.value.curr = Number(info.curr); 162 page.value.limit = Number(info.limit)
162 // if (page.value.limit != Number(info.limit)) { 163 toSearch({})
163 // page.value.limit = Number(info.limit); 164 }
164 // chunkData() 165 if (!toChange) {
165 // } else { 166 ElMessageBox.confirm(
166 // tableData.value = tableChunkData.value[page.value.curr - 1] 167 '存在未保存的数据,切换后会丢失,是否确定切换',
167 // tableInfo.value.data = tableData.value 168 '提示',
168 // tableInfo.value.page.limit = page.value.limit 169 {
169 // tableInfo.value.page.curr = page.value.curr 170 confirmButtonText: '确定',
170 // } 171 cancelButtonText: '取消',
172 type: 'warning',
173 }
174 ).then(() => {
175 changeCont()
176 })
177 } else {
178 changeCont()
179 }
180
171 }; 181 };
172 182
183 const saveDisabled = ref(true)
173 const toolBtnClick = (btn) => { 184 const toolBtnClick = (btn) => {
174 const type = btn.value 185 const type = btn.value
175 if (type == 'export') { 186 if (type == 'export') {
...@@ -188,33 +199,24 @@ const toolBtnClick = (btn) => { ...@@ -188,33 +199,24 @@ const toolBtnClick = (btn) => {
188 } else if (type == 'submit') { 199 } else if (type == 'submit') {
189 saveData() 200 saveData()
190 } else if (type == 'add_row') { 201 } else if (type == 'add_row') {
191 const params = { 202 let rowInfo: any = {}
192 guid: standardGuid.value 203 tableFields.value.map(item => {
193 } 204 rowInfo[item.field] = ''
194 getDictionaryRuleData(params).then((res: any) => {
195 if (res.code == proxy.$passCode) {
196 const data = res.data ?? {}
197 let rowInfo: any = {}
198 tableFields.value.map(item => {
199 rowInfo[item.field] = data[item.field] ?? ''
200 })
201 rowInfo.guid = undefined;
202 rowInfo.STATE = 'Running'
203 rowInfo.STATUS = 'edit'
204 rowInfo.ROWID = `upload_${tableData.value.length}`
205 tableData.value.unshift(rowInfo)
206 orginData.value.unshift(rowInfo)
207 tableInfo.value.page.rows = tableData.value.length
208 // orginData.value.unshift(rowInfo)
209 // page.value.curr = 1
210 // chunkData()
211 } else {
212 ElMessage({
213 type: 'error',
214 message: res.msg
215 })
216 }
217 }) 205 })
206 rowInfo.guid = undefined;
207 rowInfo.STATE = 'Running'
208 rowInfo.STATUS = 'edit'
209 rowInfo.ROWID = `upload_${tableData.value.length}`
210 tableData.value.unshift(rowInfo)
211 orginData.value.unshift(rowInfo)
212 tableInfo.value.page.rows = tableData.value.length
213 saveDisabled.value = false
214 // 表格滚动到第一行
215 tableEl.value.setCurrentRow(rowInfo)
216 let table = tableEl.value.layout.table.refs
217 let tableScrollEle =
218 table.bodyWrapper.firstElementChild.firstElementChild
219 tableScrollEle.scrollTop = tableScrollEle.scrollHeight
218 } 220 }
219 } 221 }
220 222
...@@ -226,6 +228,7 @@ const tableBtnClick = (scope, btn) => { ...@@ -226,6 +228,7 @@ const tableBtnClick = (scope, btn) => {
226 row.STATE = 'Running' 228 row.STATE = 'Running'
227 row.STATUS = 'edit' 229 row.STATUS = 'edit'
228 tableData.value[scope.$index] = row 230 tableData.value[scope.$index] = row
231 saveDisabled.value = false
229 } else if (type == 'save') { 232 } else if (type == 'save') {
230 saveData(scope) 233 saveData(scope)
231 } else if (type == 'cancel') { 234 } else if (type == 'cancel') {
...@@ -245,6 +248,7 @@ const tableBtnClick = (scope, btn) => { ...@@ -245,6 +248,7 @@ const tableBtnClick = (scope, btn) => {
245 // chunkData() 248 // chunkData()
246 } 249 }
247 tableInfo.value.page.rows = tableData.value.length 250 tableInfo.value.page.rows = tableData.value.length
251 saveDisabled.value = true
248 } else if (type == 'remove') { 252 } else if (type == 'remove') {
249 open("是否确定删除所选数据?", "warning"); 253 open("是否确定删除所选数据?", "warning");
250 } 254 }
...@@ -580,7 +584,7 @@ defineExpose({ ...@@ -580,7 +584,7 @@ defineExpose({
580 <div class="table_tool_wrap"> 584 <div class="table_tool_wrap">
581 <div class="tools_btns"> 585 <div class="tools_btns">
582 <el-button type="primary" @click="toolBtnClick({ value: 'add_row' })" v-preReClick :disabled="loading">新增行</el-button> 586 <el-button type="primary" @click="toolBtnClick({ value: 'add_row' })" v-preReClick :disabled="loading">新增行</el-button>
583 <el-button type="primary" plain @click="toolBtnClick({ value: 'submit' })" v-preReClick :disabled="loading">保存数据</el-button> 587 <el-button type="primary" plain @click="toolBtnClick({ value: 'submit' })" v-preReClick :disabled="saveDisabled || loading">保存数据</el-button>
584 <el-button @click="batching('delete')" v-preReClick :disabled="loading">批量删除</el-button> 588 <el-button @click="batching('delete')" v-preReClick :disabled="loading">批量删除</el-button>
585 <el-button @click="toolBtnClick({ value: 'import' })" v-preReClick :disabled="loading">导入数据</el-button> 589 <el-button @click="toolBtnClick({ value: 'import' })" v-preReClick :disabled="loading">导入数据</el-button>
586 <el-button @click="toolBtnClick({ value: 'export' })" v-preReClick :disabled="loading">导出数据</el-button> 590 <el-button @click="toolBtnClick({ value: 'export' })" v-preReClick :disabled="loading">导出数据</el-button>
...@@ -590,8 +594,14 @@ defineExpose({ ...@@ -590,8 +594,14 @@ defineExpose({
590 @change="val => toSearch({})" /> --> 594 @change="val => toSearch({})" /> -->
591 </div> 595 </div>
592 <div class="table_panel_wrap full"> 596 <div class="table_panel_wrap full">
593 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" 597 <Table
594 @tablePageChange="tablePageChange" /> 598 ref="tableEl"
599 :tableInfo="tableInfo"
600 height="400px"
601 @tableBtnClick="tableBtnClick"
602 @tableSelectionChange="tableSelectionChange"
603 @tablePageChange="tablePageChange"
604 />
595 </div> 605 </div>
596 </div> 606 </div>
597 607
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
51 </el-form-item> 51 </el-form-item>
52 </el-col> 52 </el-col>
53 <el-col :span="24"> 53 <el-col :span="24">
54 <el-form-item label="自定义字段选择" v-if="form.fieldRQVOS.length"> 54 <el-form-item label="自定义字段选择" v-if="form.fieldRQVOS && form.fieldRQVOS.length">
55 <div class="table-form"> 55 <div class="table-form">
56 <div class="table-form-wrapper" v-for="item,index in form.fieldRQVOS" :key="index"> 56 <div class="table-form-wrapper" v-for="item,index in form.fieldRQVOS" :key="index">
57 <div class="table-form-item"> 57 <div class="table-form-item">
...@@ -112,10 +112,6 @@ const { proxy } = getCurrentInstance() as any; ...@@ -112,10 +112,6 @@ const { proxy } = getCurrentInstance() as any;
112 112
113 const props = defineProps({ 113 const props = defineProps({
114 modelValue: Boolean, 114 modelValue: Boolean,
115 title: {
116 type: String,
117 default: '新建'
118 },
119 standardOptions: { 115 standardOptions: {
120 type: Array, 116 type: Array,
121 default: () => ([]) 117 default: () => ([])
...@@ -138,6 +134,9 @@ const visible = computed({ ...@@ -138,6 +134,9 @@ const visible = computed({
138 emit('update:modelValue', val); 134 emit('update:modelValue', val);
139 } 135 }
140 }) 136 })
137 const title = computed(() => {
138 return props.type === 'add' ? '新建元标准' : '编辑元标准'
139 })
141 140
142 /** 141 /**
143 * 配置项列表 142 * 配置项列表
...@@ -215,10 +214,11 @@ function inputTypeChange (val, item) { ...@@ -215,10 +214,11 @@ function inputTypeChange (val, item) {
215 } 214 }
216 215
217 function getDetail () { 216 function getDetail () {
218 console.log('testsetse')
219 getMetaStandardDetail(props.guid).then((res:any) => { 217 getMetaStandardDetail(props.guid).then((res:any) => {
220 if (res.code === proxy.$passCode) { 218 if (res.code === proxy.$passCode) {
221 219 const data = res.data
220 data.fieldRQVOS = data.fieldRSVOS
221 form.value = { ...data }
222 } 222 }
223 }) 223 })
224 } 224 }
...@@ -228,9 +228,11 @@ function confirm () { ...@@ -228,9 +228,11 @@ function confirm () {
228 if (!valid) return 228 if (!valid) return
229 let body = { ...form.value } 229 let body = { ...form.value }
230 console.log(body) 230 console.log(body)
231 delete body.fieldRSVOS
231 // return 232 // return
233 const request = props.type === 'add' ? saveMetaStandard : updateMetaStandard
232 confirmLoading.value = true 234 confirmLoading.value = true
233 saveMetaStandard(body).then((res:any) => { 235 request(body).then((res:any) => {
234 if (res.code === proxy.$passCode) { 236 if (res.code === proxy.$passCode) {
235 ElMessage.success('操作成功') 237 ElMessage.success('操作成功')
236 emit('success') 238 emit('success')
......
...@@ -13,7 +13,9 @@ import DictFileds from './components/dictFileds.vue' ...@@ -13,7 +13,9 @@ import DictFileds from './components/dictFileds.vue'
13 import useCatchStore from "@/store/modules/catch"; 13 import useCatchStore from "@/store/modules/catch";
14 import { download } from '@/utils/common' 14 import { download } from '@/utils/common'
15 import { getParamsList } from '@/api/modules/dataAsset' 15 import { getParamsList } from '@/api/modules/dataAsset'
16 import { getMetaStandardTree } from '@/api/modules/dataMetaService' 16 import { getMetaStandardTree, deleteMetaStandard,
17 getMetaStandardDataList, getMetaStandardDataFields
18 } from '@/api/modules/dataMetaService'
17 import router from '@/router' 19 import router from '@/router'
18 import { TableColumnWidth } from '@/utils/enum'; 20 import { TableColumnWidth } from '@/utils/enum';
19 import StandardDialog from './components/standardDialog.vue' 21 import StandardDialog from './components/standardDialog.vue'
...@@ -46,47 +48,10 @@ const treeInfo = ref({ ...@@ -46,47 +48,10 @@ const treeInfo = ref({
46 className: 'tree-list' 48 className: 'tree-list'
47 }) 49 })
48 function nodeClick (data) { 50 function nodeClick (data) {
49 // drawerInfo.value.visible = false 51 console.log('nodeData', data)
50 const changeCont = () => { 52 treeInfo.value.currentObj = data
51 nextTick(() => { 53 getFirstPageData()
52 treeInfo.value.currentNodeKey = data.value 54 getTableFields()
53 treeInfo.value.currentObj = data
54 if (data.isLeaf) {
55 showFiledsPage.value = true
56 nextTick(() => {
57 dictFiledsRef.value.standardGuid = data.value
58 dictFiledsRef.value.standardName = data.label
59 treeCurrentNodeKey.value = data.value
60 dictFiledsRef.value.getFirstPageData()
61 })
62 } else {
63 showFiledsPage.value = false
64 getFirstPageData()
65 }
66 })
67 }
68 if (showFiledsPage.value) {
69 const toChange = dictFiledsRef.value.checkSave()
70 if (!toChange) {
71 ElMessageBox.confirm(
72 '存在未保存的数据,切换后会丢失,是否确定切换',
73 '提示',
74 {
75 confirmButtonText: '确定',
76 cancelButtonText: '取消',
77 type: 'warning',
78 }
79 ).then(() => {
80 changeCont()
81 }).catch(() => {
82 treeInfo.value.currentNodeKey = dictGuid.value
83 })
84 } else {
85 changeCont()
86 }
87 } else {
88 changeCont()
89 }
90 } 55 }
91 function treeCustomClick (node, type) { 56 function treeCustomClick (node, type) {
92 console.log(node, type) 57 console.log(node, type)
...@@ -97,6 +62,14 @@ function treeCustomClick (node, type) { ...@@ -97,6 +62,14 @@ function treeCustomClick (node, type) {
97 standardDialog.visible = true 62 standardDialog.visible = true
98 return 63 return
99 } 64 }
65 if (type === 'delete') {
66 // 删除
67 ElMessageBox.confirm('确定删除吗?', '提示', {
68 confirmButtonText: '确定',
69 cancelButtonText: '取消',
70 type: 'warning'
71 }).then(() => deleteTreeNode(node.data.guid))
72 }
100 } 73 }
101 function getTree () { 74 function getTree () {
102 getMetaStandardTree().then((res:any) => { 75 getMetaStandardTree().then((res:any) => {
...@@ -106,6 +79,19 @@ function getTree () { ...@@ -106,6 +79,19 @@ function getTree () {
106 item.showEdit = true 79 item.showEdit = true
107 }) 80 })
108 treeInfo.value.data = data 81 treeInfo.value.data = data
82 treeInfo.value.expandedKey = [data[0].guid]
83 treeInfo.value.currentNodeKey = data[0].guid
84 nodeClick(data[0])
85 }
86 })
87 }
88 function deleteTreeNode (guid) {
89 deleteMetaStandard([guid]).then((res:any) => {
90 if (res.code === proxy.$passCode) {
91 ElMessage.success('删除成功')
92 getTree()
93 } else {
94 ElMessage.error(res.msg)
109 } 95 }
110 }) 96 })
111 } 97 }
...@@ -131,11 +117,11 @@ const tableInfo: any = ref({ ...@@ -131,11 +117,11 @@ const tableInfo: any = ref({
131 fixedSelection: true, 117 fixedSelection: true,
132 fields: [ 118 fields: [
133 { label: "序号", type: "index", width: 56, align: "center" }, 119 { label: "序号", type: "index", width: 56, align: "center" },
134 { label: '数据源标识符', field: 'codeName', width: 140 }, 120 // { label: '数据源标识符', field: 'codeName', width: 140 },
135 { label: '数据元名称', field: 'standard', width: 140 }, 121 // { label: '数据元名称', field: 'standard', width: 140 },
136 { label: '定义', field: 'standardName', width: 140 }, 122 // { label: '定义', field: 'standardName', width: 140 },
137 { label: '数据类型', field: '', width: 120 }, 123 // { label: '数据类型', field: '', width: 120 },
138 { label: '表示格式', field: 'createTime', width: TableColumnWidth } 124 // { label: '表示格式', field: 'createTime', width: TableColumnWidth }
139 ], 125 ],
140 data: [], 126 data: [],
141 page: { 127 page: {
...@@ -156,6 +142,61 @@ const tableInfo: any = ref({ ...@@ -156,6 +142,61 @@ const tableInfo: any = ref({
156 }, 142 },
157 loading: false 143 loading: false
158 }) 144 })
145 function getFirstPageData () {
146 page.value.curr = 1
147 toSearch({})
148 }
149 function toSearch (val: any, clear: boolean = false) {
150 let params: any = Object.keys(val).length ? { ...val } : {}
151 let { currentNodeKey, currentObj } = treeInfo.value
152 params.pageIndex = page.value.curr;
153 params.pageSize = page.value.limit;
154 params.metaStandardGuid = currentObj.guid
155 getTable(params)
156 }
157 function getTable (params) {
158 tableInfo.value.loading = true
159 getMetaStandardDataList(params).then((res:any) => {
160 if (res.code === proxy.$passCode) {
161 let data = res.data
162 let list = res.data.records || []
163 list.forEach((item:any) => {
164 Object.keys(item.metaStandardValue).forEach(key => {
165 item[key] = item.metaStandardValue[key]
166 })
167 })
168 tableInfo.value.data = list
169 tableInfo.value.page.limit = data.pageSize
170 tableInfo.value.page.curr = data.pageIndex
171 tableInfo.value.page.rows = data.totalRows
172 }
173 }).finally(() => tableInfo.value.loading = false)
174 }
175 function getTableFields () {
176 let { currentObj } = treeInfo.value
177 const indexField = { label: '序号', type: 'index', width: 56, align: 'center' }
178 getMetaStandardDataFields(currentObj.guid).then((res:any) => {
179 if (res.code === proxy.$passCode && res.data) {
180 const data = res.data
181 const fields = data.map(item => {
182 return {
183 label: item.fileNameCodeName,
184 field: item.fileNameCode,
185 width: 140
186 }
187 })
188 fields.unshift(indexField)
189 tableInfo.value.fields = fields
190 } else {
191 tableInfo.value.fields = [indexField]
192 }
193 })
194 }
195 function tablePageChange (info) {
196 page.value.curr = Number(info.curr)
197 page.value.limit = Number(info.limit)
198 toSearch({})
199 }
159 200
160 const formItems: any = ref([ 201 const formItems: any = ref([
161 { 202 {
...@@ -290,7 +331,8 @@ const standardDialog = reactive({ ...@@ -290,7 +331,8 @@ const standardDialog = reactive({
290 guid: null 331 guid: null
291 }) 332 })
292 function openStandardDialog () { 333 function openStandardDialog () {
293 standardDialog.visible = true 334 standardDialog.type = 'add'
335 standardDialog.visible = true
294 } 336 }
295 337
296 onBeforeMount(() => { 338 onBeforeMount(() => {
...@@ -326,7 +368,7 @@ onBeforeMount(() => { ...@@ -326,7 +368,7 @@ onBeforeMount(() => {
326 </div> 368 </div>
327 <div class="table_panel_wrap full"> 369 <div class="table_panel_wrap full">
328 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" 370 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange"
329 @tablePageChange="tablePageChange" @tableSwitchBeforeChange="tableSwitchBeforeChange" /> 371 @tablePageChange="tablePageChange"/>
330 </div> 372 </div>
331 </div> 373 </div>
332 <StandardDialog 374 <StandardDialog
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!