Merge branch 'release-test' of http://117.78.60.236:8000/csbr-daop/fe-data-asset…
…-management into release-test
Showing
10 changed files
with
265 additions
and
163 deletions
| ... | @@ -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 | ... | ... |
| ... | @@ -58,7 +58,7 @@ watch( | ... | @@ -58,7 +58,7 @@ watch( |
| 58 | const changeTab = (pane: any, ev: any) => { | 58 | const changeTab = (pane: any, ev: any) => { |
| 59 | const tabIndex = Number(pane.index); | 59 | const tabIndex = Number(pane.index); |
| 60 | const paneData: any = tabbarList.value[tabIndex]; | 60 | const paneData: any = tabbarList.value[tabIndex]; |
| 61 | if (paneData.name == 'budgetDataIndex' || paneData.name == 'iframePage') { | 61 | if (paneData.name == 'budgetDataIndex' || paneData.name == 'iframePage' || paneData.name == 'portraitMap' || paneData.name == 'portraitMaps') { |
| 62 | router.push(paneData.fullPath); | 62 | router.push(paneData.fullPath); |
| 63 | } else { | 63 | } else { |
| 64 | router.push({ | 64 | router.push({ | ... | ... |
| ... | @@ -176,6 +176,19 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -176,6 +176,19 @@ const routes: RouteRecordRaw[] = [ |
| 176 | reuse: true, | 176 | reuse: true, |
| 177 | activeMenu: '/data-meta/reports/iframePage', | 177 | activeMenu: '/data-meta/reports/iframePage', |
| 178 | }, | 178 | }, |
| 179 | }, | ||
| 180 | { | ||
| 181 | path: 'portraitMaps', | ||
| 182 | name: 'portraitMaps', | ||
| 183 | component: () => import('@/views/data_meta/portraitMap.vue'), | ||
| 184 | meta: { | ||
| 185 | title: '全景地图', | ||
| 186 | sidebar: true, | ||
| 187 | breadcrumb: false, | ||
| 188 | cache: true, | ||
| 189 | reuse: true, | ||
| 190 | activeMenu: '/data-meta/reports/portraitMaps', | ||
| 191 | }, | ||
| 179 | } | 192 | } |
| 180 | ] | 193 | ] |
| 181 | }, | 194 | }, | ... | ... |
| ... | @@ -174,7 +174,7 @@ const useMenuStore = defineStore( | ... | @@ -174,7 +174,7 @@ const useMenuStore = defineStore( |
| 174 | else { | 174 | else { |
| 175 | // 如果是 string 类型,则认为是路由,需要查找对应的主导航索引 | 175 | // 如果是 string 类型,则认为是路由,需要查找对应的主导航索引 |
| 176 | const findIndex = allMenus.value.findIndex(item => item.children.some(r => { | 176 | const findIndex = allMenus.value.findIndex(item => item.children.some(r => { |
| 177 | if ((data== "/data-meta/reports/iframePage" || data== "/data-meta/report/budgetDataIndex") && r.path?.includes('/data-meta/report')) { | 177 | if ((data== "/data-meta/reports/iframePage" || data == '/data-meta/reports/portraitMaps' || data== "/data-meta/report/budgetDataIndex") && r.path?.includes('/data-meta/report')) { |
| 178 | return true; | 178 | return true; |
| 179 | } | 179 | } |
| 180 | if (data== "/data-meta/portraitMap" && r.path?.includes('/data-meta/portraitMap')) { | 180 | if (data== "/data-meta/portraitMap" && r.path?.includes('/data-meta/portraitMap')) { | ... | ... |
| ... | @@ -157,7 +157,7 @@ const useRouteStore = defineStore( | ... | @@ -157,7 +157,7 @@ const useRouteStore = defineStore( |
| 157 | }; | 157 | }; |
| 158 | } | 158 | } |
| 159 | r = routes.find((route: any) => { | 159 | r = routes.find((route: any) => { |
| 160 | return route.path === path || route.path === m.path || `/${route.path}` === m.path || ((path.includes('budgetDataIndex') && path.includes('/data-meta/report') && route.path.includes('/data-meta/report')) || (path.includes('iframePage') && path.includes('/data-meta/report')) || (path.includes('/data-meta/portraitMap') && route.path.includes('/data-meta/portraitMap'))); | 160 | return route.path === path || route.path === m.path || `/${route.path}` === m.path || ((path.includes('budgetDataIndex') && path.includes('/data-meta/report') && route.path.includes('/data-meta/report')) || (path.includes('iframePage') && path.includes('/data-meta/report')) || (path.includes('portraitMaps') && path.includes('/data-meta/report')) || (path.includes('/data-meta/portraitMap') && route.path.includes('/data-meta/portraitMap'))); |
| 161 | }); | 161 | }); |
| 162 | if (r && (path.includes('budgetDataIndex') || path.includes('iframePage')) || path.includes('portraitMap')) { | 162 | if (r && (path.includes('budgetDataIndex') || path.includes('iframePage')) || path.includes('portraitMap')) { |
| 163 | r.path = path; | 163 | r.path = path; | ... | ... |
| ... | @@ -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,25 @@ const toolBtnClick = (btn) => { | ... | @@ -188,33 +199,25 @@ 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 | let $tableEl = tableEl.value.tableRef | ||
| 216 | $tableEl.setCurrentRow(rowInfo) | ||
| 217 | let table = $tableEl.layout.table.refs | ||
| 218 | let tableScrollEle = | ||
| 219 | table.bodyWrapper.firstElementChild.firstElementChild | ||
| 220 | tableScrollEle.scrollTop = 0 | ||
| 218 | } | 221 | } |
| 219 | } | 222 | } |
| 220 | 223 | ||
| ... | @@ -226,6 +229,7 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -226,6 +229,7 @@ const tableBtnClick = (scope, btn) => { |
| 226 | row.STATE = 'Running' | 229 | row.STATE = 'Running' |
| 227 | row.STATUS = 'edit' | 230 | row.STATUS = 'edit' |
| 228 | tableData.value[scope.$index] = row | 231 | tableData.value[scope.$index] = row |
| 232 | saveDisabled.value = false | ||
| 229 | } else if (type == 'save') { | 233 | } else if (type == 'save') { |
| 230 | saveData(scope) | 234 | saveData(scope) |
| 231 | } else if (type == 'cancel') { | 235 | } else if (type == 'cancel') { |
| ... | @@ -245,6 +249,7 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -245,6 +249,7 @@ const tableBtnClick = (scope, btn) => { |
| 245 | // chunkData() | 249 | // chunkData() |
| 246 | } | 250 | } |
| 247 | tableInfo.value.page.rows = tableData.value.length | 251 | tableInfo.value.page.rows = tableData.value.length |
| 252 | saveDisabled.value = true | ||
| 248 | } else if (type == 'remove') { | 253 | } else if (type == 'remove') { |
| 249 | open("是否确定删除所选数据?", "warning"); | 254 | open("是否确定删除所选数据?", "warning"); |
| 250 | } | 255 | } |
| ... | @@ -378,6 +383,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { | ... | @@ -378,6 +383,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { |
| 378 | return obj | 383 | return obj |
| 379 | }) | 384 | }) |
| 380 | loading.value = true | 385 | loading.value = true |
| 386 | tableInfo.value.loading = true | ||
| 381 | saveStandardCodeFieldsData(params).then((res: any) => { | 387 | saveStandardCodeFieldsData(params).then((res: any) => { |
| 382 | if (res.code == proxy.$passCode) { | 388 | if (res.code == proxy.$passCode) { |
| 383 | getFirstPageData(); | 389 | getFirstPageData(); |
| ... | @@ -390,6 +396,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { | ... | @@ -390,6 +396,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { |
| 390 | type: 'error', | 396 | type: 'error', |
| 391 | message: res.msg, | 397 | message: res.msg, |
| 392 | }) | 398 | }) |
| 399 | tableInfo.value.loading = false | ||
| 393 | } | 400 | } |
| 394 | }).finally(() => loading.value = false) | 401 | }).finally(() => loading.value = false) |
| 395 | } | 402 | } |
| ... | @@ -578,7 +585,7 @@ defineExpose({ | ... | @@ -578,7 +585,7 @@ defineExpose({ |
| 578 | <div class="table_tool_wrap"> | 585 | <div class="table_tool_wrap"> |
| 579 | <div class="tools_btns"> | 586 | <div class="tools_btns"> |
| 580 | <el-button type="primary" @click="toolBtnClick({ value: 'add_row' })" v-preReClick :disabled="loading">新增行</el-button> | 587 | <el-button type="primary" @click="toolBtnClick({ value: 'add_row' })" v-preReClick :disabled="loading">新增行</el-button> |
| 581 | <el-button type="primary" plain @click="toolBtnClick({ value: 'submit' })" v-preReClick :disabled="loading">保存数据</el-button> | 588 | <el-button type="primary" plain @click="toolBtnClick({ value: 'submit' })" v-preReClick :disabled="saveDisabled || loading">保存数据</el-button> |
| 582 | <el-button @click="batching('delete')" v-preReClick :disabled="loading">批量删除</el-button> | 589 | <el-button @click="batching('delete')" v-preReClick :disabled="loading">批量删除</el-button> |
| 583 | <el-button @click="toolBtnClick({ value: 'import' })" v-preReClick :disabled="loading">导入数据</el-button> | 590 | <el-button @click="toolBtnClick({ value: 'import' })" v-preReClick :disabled="loading">导入数据</el-button> |
| 584 | <el-button @click="toolBtnClick({ value: 'export' })" v-preReClick :disabled="loading">导出数据</el-button> | 591 | <el-button @click="toolBtnClick({ value: 'export' })" v-preReClick :disabled="loading">导出数据</el-button> |
| ... | @@ -588,8 +595,13 @@ defineExpose({ | ... | @@ -588,8 +595,13 @@ defineExpose({ |
| 588 | @change="val => toSearch({})" /> --> | 595 | @change="val => toSearch({})" /> --> |
| 589 | </div> | 596 | </div> |
| 590 | <div class="table_panel_wrap full"> | 597 | <div class="table_panel_wrap full"> |
| 591 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" | 598 | <Table |
| 592 | @tablePageChange="tablePageChange" /> | 599 | ref="tableEl" |
| 600 | :tableInfo="tableInfo" | ||
| 601 | @tableBtnClick="tableBtnClick" | ||
| 602 | @tableSelectionChange="tableSelectionChange" | ||
| 603 | @tablePageChange="tablePageChange" | ||
| 604 | /> | ||
| 593 | </div> | 605 | </div> |
| 594 | </div> | 606 | </div> |
| 595 | 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') | ... | ... |
| ... | @@ -15,7 +15,8 @@ import { download } from '@/utils/common' | ... | @@ -15,7 +15,8 @@ import { download } from '@/utils/common' |
| 15 | import { getParamsList } from '@/api/modules/dataAsset' | 15 | 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 | } from '@/api/modules/dataMetaService' | 20 | } from '@/api/modules/dataMetaService' |
| 20 | import { | 21 | import { |
| 21 | addDictionary, | 22 | addDictionary, |
| ... | @@ -165,7 +166,7 @@ const formItems: any = ref([ | ... | @@ -165,7 +166,7 @@ const formItems: any = ref([ |
| 165 | placeholder: '请输入', | 166 | placeholder: '请输入', |
| 166 | field: 'codeName', | 167 | field: 'codeName', |
| 167 | default: '', | 168 | default: '', |
| 168 | maxlength: 20, | 169 | maxlength: 30, |
| 169 | clearable: true, | 170 | clearable: true, |
| 170 | required: true | 171 | required: true |
| 171 | }, | 172 | }, |
| ... | @@ -185,7 +186,7 @@ const formItems: any = ref([ | ... | @@ -185,7 +186,7 @@ const formItems: any = ref([ |
| 185 | placeholder: '请输入', | 186 | placeholder: '请输入', |
| 186 | field: 'standardName', | 187 | field: 'standardName', |
| 187 | default: '', | 188 | default: '', |
| 188 | maxlength: 20, | 189 | maxlength: 30, |
| 189 | clearable: true, | 190 | clearable: true, |
| 190 | required: true | 191 | required: true |
| 191 | }, | 192 | }, |
| ... | @@ -634,9 +635,10 @@ const getTableData = (params) => { | ... | @@ -634,9 +635,10 @@ const getTableData = (params) => { |
| 634 | if (res.code === proxy.$passCode) { | 635 | if (res.code === proxy.$passCode) { |
| 635 | let data = res.data | 636 | let data = res.data |
| 636 | let list = res.data.records || [] | 637 | let list = res.data.records || [] |
| 637 | list = list.map(item => { | 638 | list = list.map((item,index) => { |
| 638 | item.label = item.codeName | 639 | item.label = item.codeName |
| 639 | item.value = item.guid | 640 | item.value = item.guid |
| 641 | item.index = index | ||
| 640 | return item | 642 | return item |
| 641 | }) | 643 | }) |
| 642 | tableInfo.value.data = list | 644 | tableInfo.value.data = list |
| ... | @@ -651,6 +653,7 @@ const getTableData = (params) => { | ... | @@ -651,6 +653,7 @@ const getTableData = (params) => { |
| 651 | }; | 653 | }; |
| 652 | 654 | ||
| 653 | const tableSelectionChange = (val, tId) => { | 655 | const tableSelectionChange = (val, tId) => { |
| 656 | val.sort((pre, cur) => pre.index - cur.index) | ||
| 654 | if (drawerInfo.value.visible) { | 657 | if (drawerInfo.value.visible) { |
| 655 | if (formItems.value.length == 2) { | 658 | if (formItems.value.length == 2) { |
| 656 | uploadSelectRowData.value = val | 659 | uploadSelectRowData.value = val |
| ... | @@ -774,7 +777,7 @@ const toolBtnClick = (btn, data) => { | ... | @@ -774,7 +777,7 @@ const toolBtnClick = (btn, data) => { |
| 774 | if (drawerInfo.value.type == 'edit') { | 777 | if (drawerInfo.value.type == 'edit') { |
| 775 | const editRows = formTableSelectRowData.value.filter(item => item.guid !== undefined) | 778 | const editRows = formTableSelectRowData.value.filter(item => item.guid !== undefined) |
| 776 | if (editRows.length) { | 779 | if (editRows.length) { |
| 777 | formTable.value.tableInfo.loading = true | 780 | // formTable.value.tableInfo.loading = true |
| 778 | checkDelete().then((res: any) => { | 781 | checkDelete().then((res: any) => { |
| 779 | if (res) { | 782 | if (res) { |
| 780 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { | 783 | ElMessageBox.confirm("数据字典有数据, 确定是否继续删除?", "提示", { |
| ... | @@ -787,7 +790,7 @@ const toolBtnClick = (btn, data) => { | ... | @@ -787,7 +790,7 @@ const toolBtnClick = (btn, data) => { |
| 787 | } else { | 790 | } else { |
| 788 | removeRows() | 791 | removeRows() |
| 789 | } | 792 | } |
| 790 | formTable.value.tableInfo.loading = false | 793 | // formTable.value.tableInfo.loading = false |
| 791 | }).catch(xhr => { | 794 | }).catch(xhr => { |
| 792 | ElMessage({ | 795 | ElMessage({ |
| 793 | type: 'error', | 796 | type: 'error', |
| ... | @@ -883,6 +886,9 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -883,6 +886,9 @@ const tableBtnClick = (scope, btn) => { |
| 883 | let data = res.data | 886 | let data = res.data |
| 884 | currTableData.value = data; | 887 | currTableData.value = data; |
| 885 | setDetailInfo(type) | 888 | setDetailInfo(type) |
| 889 | checkDelete().then((res:any) => { | ||
| 890 | formItems.value.find(v => v.field === 'typeCode')['disabled'] = res ? true : false | ||
| 891 | }) | ||
| 886 | } else { | 892 | } else { |
| 887 | ElMessage({ | 893 | ElMessage({ |
| 888 | type: "error", | 894 | type: "error", |
| ... | @@ -895,9 +901,30 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -895,9 +901,30 @@ const tableBtnClick = (scope, btn) => { |
| 895 | formTable.value.tableInfo.loading = false | 901 | formTable.value.tableInfo.loading = false |
| 896 | drawerInfo.value.loading = false; | 902 | drawerInfo.value.loading = false; |
| 897 | }) | 903 | }) |
| 904 | // 代码有数据后不允许编辑代码类型 | ||
| 905 | |||
| 898 | } else if (type === 'remove') { | 906 | } else if (type === 'remove') { |
| 899 | const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID) | 907 | let removeRows = () => { |
| 900 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | 908 | const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID) |
| 909 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | ||
| 910 | } | ||
| 911 | if (drawerInfo.value.type == 'edit') { | ||
| 912 | checkDelete().then((res:any) => { | ||
| 913 | if (res) { | ||
| 914 | ElMessageBox.confirm("标准代码有数据, 确定是否继续删除?", "提示", { | ||
| 915 | confirmButtonText: "确定", | ||
| 916 | cancelButtonText: "取消", | ||
| 917 | type: 'warning', | ||
| 918 | }).then(() => { | ||
| 919 | removeRows() | ||
| 920 | }) | ||
| 921 | } else { | ||
| 922 | removeRows() | ||
| 923 | } | ||
| 924 | }) | ||
| 925 | } else { | ||
| 926 | removeRows() | ||
| 927 | } | ||
| 901 | } | 928 | } |
| 902 | else if (type == "delete") { | 929 | else if (type == "delete") { |
| 903 | currTableData.value = row; | 930 | currTableData.value = row; |
| ... | @@ -917,50 +944,27 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -917,50 +944,27 @@ const tableBtnClick = (scope, btn) => { |
| 917 | } | 944 | } |
| 918 | 945 | ||
| 919 | const checkDelete = (isBatch: any = false) => { | 946 | const checkDelete = (isBatch: any = false) => { |
| 920 | if (drawerInfo.value.visible) { | 947 | return new Promise((resolve, reject) => { |
| 921 | return new Promise((resolve, reject) => { | 948 | let params: any = { |
| 922 | let params: any = { | 949 | pageIndex: 1, |
| 923 | guid: currTableData.value.guid | 950 | pageSize: -1, |
| 924 | } | 951 | standardGuid: currTableData.value.guid |
| 925 | checkDeleteDictionaryScheme(params).then((res: any) => { | 952 | } |
| 926 | if (res.code == proxy.$passCode) { | 953 | |
| 927 | const data = res.data | 954 | getStandardCodeDataList(params).then((res: any) => { |
| 928 | resolve(data) | 955 | if (res.code == proxy.$passCode) { |
| 956 | if (res.data.records.length) { | ||
| 957 | resolve(res.data) | ||
| 929 | } else { | 958 | } else { |
| 930 | reject(res.msg) | 959 | resolve(null) |
| 931 | } | 960 | } |
| 932 | }).catch((xhr: any) => { | 961 | } else { |
| 933 | reject(xhr.msg) | 962 | reject(res.msg) |
| 934 | }) | ||
| 935 | }) | ||
| 936 | } else { | ||
| 937 | return new Promise((resolve, reject) => { | ||
| 938 | let guids = [currTableData.value.guid] | ||
| 939 | if (isBatch) { | ||
| 940 | guids = selectRowData.value | ||
| 941 | } | 963 | } |
| 942 | checkDeleteDictionary(guids).then((res: any) => { | 964 | }).catch((xhr: any) => { |
| 943 | if (res.code == proxy.$passCode) { | 965 | reject(xhr.msg) |
| 944 | const data = res.data ?? {} | ||
| 945 | if (data.used) { | ||
| 946 | resolve({ | ||
| 947 | used: true, | ||
| 948 | data: data.used | ||
| 949 | }) | ||
| 950 | } else { | ||
| 951 | resolve({ | ||
| 952 | used: false, | ||
| 953 | data: data.unuse | ||
| 954 | }) | ||
| 955 | } | ||
| 956 | } else { | ||
| 957 | reject(res.msg) | ||
| 958 | } | ||
| 959 | }).catch((xhr: any) => { | ||
| 960 | reject(xhr.msg) | ||
| 961 | }) | ||
| 962 | }) | 966 | }) |
| 963 | } | 967 | }) |
| 964 | } | 968 | } |
| 965 | 969 | ||
| 966 | const open = (msg, type, isBatch = false) => { | 970 | const open = (msg, type, isBatch = false) => { |
| ... | @@ -1120,11 +1124,16 @@ const loadDrawer = async () => { | ... | @@ -1120,11 +1124,16 @@ const loadDrawer = async () => { |
| 1120 | item.default = 'Y' | 1124 | item.default = 'Y' |
| 1121 | } else if (item.field === 'typeCode') { | 1125 | } else if (item.field === 'typeCode') { |
| 1122 | item.default = '1' | 1126 | item.default = '1' |
| 1123 | } else { | 1127 | } else if (item.field === 'hierarchy') { |
| 1128 | item.default = '' | ||
| 1129 | item.visible = false | ||
| 1130 | } | ||
| 1131 | else { | ||
| 1124 | item.default = '' | 1132 | item.default = '' |
| 1125 | } | 1133 | } |
| 1126 | item.disabled = false | 1134 | item.disabled = false |
| 1127 | }) | 1135 | }) |
| 1136 | |||
| 1128 | formInfo.value.formInfo.items = formItems.value | 1137 | formInfo.value.formInfo.items = formItems.value |
| 1129 | formTableData.value = JSON.parse(JSON.stringify(orginData)) | 1138 | formTableData.value = JSON.parse(JSON.stringify(orginData)) |
| 1130 | formTable.value.tableInfo.data = formTableData.value | 1139 | formTable.value.tableInfo.data = formTableData.value |
| ... | @@ -1374,11 +1383,7 @@ const scrollTable = (rowInfo) => { | ... | @@ -1374,11 +1383,7 @@ const scrollTable = (rowInfo) => { |
| 1374 | const drawerBtnClick = (btn, info) => { | 1383 | const drawerBtnClick = (btn, info) => { |
| 1375 | console.log('btn', btn, info) | 1384 | console.log('btn', btn, info) |
| 1376 | console.log('table', formTable.value) | 1385 | console.log('table', formTable.value) |
| 1377 | let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName))) | 1386 | |
| 1378 | if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) { | ||
| 1379 | ElMessage.error('表结构字段名称需唯一,不允许重名') | ||
| 1380 | return | ||
| 1381 | } | ||
| 1382 | let params = { | 1387 | let params = { |
| 1383 | standardCodeFields: formTable.value.tableInfo.data.map(item => { | 1388 | standardCodeFields: formTable.value.tableInfo.data.map(item => { |
| 1384 | let obj = { | 1389 | let obj = { |
| ... | @@ -1397,6 +1402,22 @@ const drawerBtnClick = (btn, info) => { | ... | @@ -1397,6 +1402,22 @@ const drawerBtnClick = (btn, info) => { |
| 1397 | params.guid = currTableData.value.guid | 1402 | params.guid = currTableData.value.guid |
| 1398 | } | 1403 | } |
| 1399 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { | 1404 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { |
| 1405 | let uniqFieldNameList = Array.from(new Set(formTable.value.tableInfo.data.map(item => item.fieldName))) | ||
| 1406 | if (uniqFieldNameList.length !== formTable.value.tableInfo.data.length) { | ||
| 1407 | ElMessage.error('表结构字段名称需唯一,不允许重名') | ||
| 1408 | return | ||
| 1409 | } | ||
| 1410 | let standardCodeFields = params.standardCodeFields.map(v => v.fieldName).join() | ||
| 1411 | let codeFieldName = params.codeFieldName | ||
| 1412 | let codeFields = params.codeFields | ||
| 1413 | let fieldValidate = false | ||
| 1414 | if (standardCodeFields.includes(codeFieldName) && codeFields.every(v => standardCodeFields.includes(v))) { | ||
| 1415 | fieldValidate = true | ||
| 1416 | } | ||
| 1417 | if (!fieldValidate) { | ||
| 1418 | ElMessage.error('所选的编码字段和编码名称必须在字段名称中有') | ||
| 1419 | return | ||
| 1420 | } | ||
| 1400 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = true) | 1421 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = true) |
| 1401 | saveData(params,btn.value) | 1422 | saveData(params,btn.value) |
| 1402 | } else { | 1423 | } else { |
| ... | @@ -1434,6 +1455,7 @@ onBeforeMount(() => { | ... | @@ -1434,6 +1455,7 @@ onBeforeMount(() => { |
| 1434 | getStandardCodeList(params).then((res:any) => { | 1455 | getStandardCodeList(params).then((res:any) => { |
| 1435 | if (res.code === proxy.$passCode) { | 1456 | if (res.code === proxy.$passCode) { |
| 1436 | let data = res.data | 1457 | let data = res.data |
| 1458 | data.records && data.records.forEach((item,index) => item.index = index) | ||
| 1437 | tableInfo.value.data = data.records | 1459 | tableInfo.value.data = data.records |
| 1438 | tableInfo.value.page.limit = data.pageSize | 1460 | tableInfo.value.page.limit = data.pageSize |
| 1439 | tableInfo.value.page.curr = data.pageIndex | 1461 | tableInfo.value.page.curr = data.pageIndex |
| ... | @@ -1469,7 +1491,7 @@ onMounted(() => { | ... | @@ -1469,7 +1491,7 @@ onMounted(() => { |
| 1469 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> | 1491 | <el-button @click="batching('delete')" v-preReClick>批量删除</el-button> |
| 1470 | <el-button @click="batching('export')" v-preReClick>批量导入</el-button> | 1492 | <el-button @click="batching('export')" v-preReClick>批量导入</el-button> |
| 1471 | </div> | 1493 | </div> |
| 1472 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索" | 1494 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索" |
| 1473 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | 1495 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> |
| 1474 | </div> | 1496 | </div> |
| 1475 | <div class="table_panel_wrap full"> | 1497 | <div class="table_panel_wrap full"> | ... | ... |
| ... | @@ -120,7 +120,7 @@ const uploadInfo = ref({ | ... | @@ -120,7 +120,7 @@ const uploadInfo = ref({ |
| 120 | 120 | ||
| 121 | const dialogInfo: any = ref({ | 121 | const dialogInfo: any = ref({ |
| 122 | visible: false, | 122 | visible: false, |
| 123 | size: 700, | 123 | size: 560, |
| 124 | direction: "column", | 124 | direction: "column", |
| 125 | header: { | 125 | header: { |
| 126 | title: "新建", | 126 | title: "新建", |
| ... | @@ -265,7 +265,7 @@ const batching = (type) => { | ... | @@ -265,7 +265,7 @@ const batching = (type) => { |
| 265 | if (type == 'import') { | 265 | if (type == 'import') { |
| 266 | dialogInfo.value.header.title = '导入数据' | 266 | dialogInfo.value.header.title = '导入数据' |
| 267 | dialogInfo.value.type = 'upload' | 267 | dialogInfo.value.type = 'upload' |
| 268 | dialogInfo.value.size = 640 | 268 | dialogInfo.value.size = 560 |
| 269 | uploadFiles.value = [] | 269 | uploadFiles.value = [] |
| 270 | // if (tabsActiveName.value == 'field' || tabsActiveName.value == 'naming') { | 270 | // if (tabsActiveName.value == 'field' || tabsActiveName.value == 'naming') { |
| 271 | // uploadSteps.value[0].selectInfo.options = standardSetList.value | 271 | // uploadSteps.value[0].selectInfo.options = standardSetList.value |
| ... | @@ -291,7 +291,7 @@ const batching = (type) => { | ... | @@ -291,7 +291,7 @@ const batching = (type) => { |
| 291 | if (isfileImport == '2' || isfileImport == '4') { | 291 | if (isfileImport == '2' || isfileImport == '4') { |
| 292 | dialogInfo.value.header.title = '导入数据' | 292 | dialogInfo.value.header.title = '导入数据' |
| 293 | dialogInfo.value.type = 'upload' | 293 | dialogInfo.value.type = 'upload' |
| 294 | dialogInfo.value.size = isfileImport == '4' ? 600 : 500; | 294 | dialogInfo.value.size = isfileImport == '4' ? 560 : 560; |
| 295 | uploadFiles.value = [] | 295 | uploadFiles.value = [] |
| 296 | uploadInfo.value.uploadInfo.steps = uploadSteps.value | 296 | uploadInfo.value.uploadInfo.steps = uploadSteps.value |
| 297 | const content: any = [uploadInfo.value] | 297 | const content: any = [uploadInfo.value] |
| ... | @@ -516,9 +516,9 @@ onActivated(() => { | ... | @@ -516,9 +516,9 @@ onActivated(() => { |
| 516 | </div> | 516 | </div> |
| 517 | <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick" | 517 | <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @onUpload="onUpload" @uploadBtnClick="uploadBtnClick" |
| 518 | @cascaderChange="cascaderChange" @selectChange="selectChange"> | 518 | @cascaderChange="cascaderChange" @selectChange="selectChange"> |
| 519 | <div> | 519 | <div style="overflow: auto;"> |
| 520 | <div class="title" style="color:#333;margin:20px 0 10px">2、导入前请先导入文件的sheet与标准做对应</div> | 520 | <div class="title" style="color:#333;margin:20px 0 10px">2、导入前请先导入文件的sheet与标准做对应</div> |
| 521 | <el-table :data="uploadSetting"> | 521 | <el-table :data="uploadSetting" border height="310"> |
| 522 | <el-table-column type="index" label="序号" width="55" align="center"/> | 522 | <el-table-column type="index" label="序号" width="55" align="center"/> |
| 523 | <el-table-column label="代码名称" prop="standardName"></el-table-column> | 523 | <el-table-column label="代码名称" prop="standardName"></el-table-column> |
| 524 | <el-table-column label="选择sheet页"> | 524 | <el-table-column label="选择sheet页"> | ... | ... |
| ... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment