merge
Showing
3 changed files
with
284 additions
and
5 deletions
| ... | @@ -353,3 +353,44 @@ export const getMetaStandardDataFields = (metaStandardGuid) => request({ | ... | @@ -353,3 +353,44 @@ export const getMetaStandardDataFields = (metaStandardGuid) => request({ |
| 353 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/get-standard-field?metaStandardGuid=${metaStandardGuid}`, | 353 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/get-standard-field?metaStandardGuid=${metaStandardGuid}`, |
| 354 | method: 'get' | 354 | method: 'get' |
| 355 | }) | 355 | }) |
| 356 | /** 元数据标准-标准字段保存 */ | ||
| 357 | export const saveMetaStandardDataFields = (params) => request({ | ||
| 358 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/save-or-update`, | ||
| 359 | method: 'post', | ||
| 360 | data: params | ||
| 361 | }) | ||
| 362 | /** 元数据标准-标准字段删除 */ | ||
| 363 | export const deleteMetaStandardDataFields = (params) => request({ | ||
| 364 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/del`, | ||
| 365 | method: 'delete', | ||
| 366 | data: params | ||
| 367 | }) | ||
| 368 | /** 标准代码-树形表 */ | ||
| 369 | export const getStandardCodeTree = () => request({ | ||
| 370 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/standard-code/code-tree`, | ||
| 371 | method: 'get' | ||
| 372 | }) | ||
| 373 | |||
| 374 | /** 元数据标准树形列表查询 */ | ||
| 375 | export const getMetaStandardTreeList = (guid) => request({ | ||
| 376 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/list-tree?metaStandardGuid=${guid}`, | ||
| 377 | method: 'get' | ||
| 378 | }) | ||
| 379 | |||
| 380 | /** 元数据标准guid查询只展示的字段 */ | ||
| 381 | export const getMetaStandardField = (guid) => request({ | ||
| 382 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/list-by-meta-standard-guid?metaStandardGuid=${guid}`, | ||
| 383 | method: 'get' | ||
| 384 | }) | ||
| 385 | |||
| 386 | /** 根据元数据标准展示字段去获取未展示的详情信息 */ | ||
| 387 | export const getMetaStandardFieldDetail = (guid) => request({ | ||
| 388 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/data/detail?guid=${guid}`, | ||
| 389 | method: 'get' | ||
| 390 | }) | ||
| 391 | |||
| 392 | /** 获取桑基图数据 */ | ||
| 393 | export const getSankeyData = (guid) => request({ | ||
| 394 | url: `${import.meta.env.VITE_APP_STANDARD_URL}/meta-standard/sankey-data?metaStandardGuid=${guid}`, | ||
| 395 | method: 'get' | ||
| 396 | }) | ... | ... |
| 1 | <template> | ||
| 2 | <el-dialog | ||
| 3 | v-model="visible" | ||
| 4 | :title="title" | ||
| 5 | width="600" | ||
| 6 | modal-class="standard-modal" | ||
| 7 | > | ||
| 8 | <el-form :model="form" :rules="formRules" ref="formEl" style="min-height: 200px;"> | ||
| 9 | <el-row> | ||
| 10 | <el-col v-for="item,index in fields" :key="index" :span="12" style="padding-right:10px"> | ||
| 11 | <el-form-item :label="item.fileNameCodeName" :prop="item.fileNameCode"> | ||
| 12 | <el-input | ||
| 13 | v-if="item.inputTypeCode == '1' || item.inputTypeCode == '3'" | ||
| 14 | v-model="form[item.fileNameCode]" | ||
| 15 | placeholder="请输入" | ||
| 16 | /> | ||
| 17 | <el-select | ||
| 18 | v-else-if="item.inputTypeCode == '2'" | ||
| 19 | v-model="form[item.fileNameCode]" | ||
| 20 | filterable | ||
| 21 | clearable | ||
| 22 | placeholder="请选择" | ||
| 23 | > | ||
| 24 | <el-option v-for="op in formOptions[item.fileNameCode]" :label="op.label" :value="op.value" :key="op.value"></el-option> | ||
| 25 | </el-select> | ||
| 26 | |||
| 27 | </el-form-item> | ||
| 28 | </el-col> | ||
| 29 | </el-row> | ||
| 30 | </el-form> | ||
| 31 | <template #footer> | ||
| 32 | <el-button @click="visible = false" :disabled="confirmLoading">取消</el-button> | ||
| 33 | <el-button type="primary" @click="confirm" :loading="confirmLoading">确认</el-button> | ||
| 34 | </template> | ||
| 35 | </el-dialog> | ||
| 36 | </template> | ||
| 37 | |||
| 38 | <script setup lang="ts"> | ||
| 39 | import { watch } from 'vue' | ||
| 40 | import { ElMessage } from "element-plus"; | ||
| 41 | import { getParamsList } from '@/api/modules/dataAsset' | ||
| 42 | import { saveMetaStandardDataFields, getMetaStandardFieldDetail } from '@/api/modules/dataMetaService' | ||
| 43 | |||
| 44 | const { proxy } = getCurrentInstance() as any; | ||
| 45 | const props = defineProps({ | ||
| 46 | modelValue: Boolean, | ||
| 47 | fields: { | ||
| 48 | type: Array, | ||
| 49 | default: () => ([]) | ||
| 50 | }, | ||
| 51 | metaStandardGuid: { | ||
| 52 | type: String, | ||
| 53 | default: '' | ||
| 54 | }, | ||
| 55 | type: { | ||
| 56 | type: String, | ||
| 57 | default: 'add' | ||
| 58 | }, | ||
| 59 | data: { | ||
| 60 | type: Object, | ||
| 61 | default: () => ({}) | ||
| 62 | } | ||
| 63 | }) | ||
| 64 | const emit = defineEmits(['update:modelValue', 'success', 'confirm']) | ||
| 65 | const visible = computed({ | ||
| 66 | get() { | ||
| 67 | return props.modelValue; | ||
| 68 | }, | ||
| 69 | set(val) { | ||
| 70 | emit('update:modelValue', val); | ||
| 71 | } | ||
| 72 | }) | ||
| 73 | const title = computed(() => { | ||
| 74 | return props.type === 'add' ? '新增字段标准' : '编辑字段标准' | ||
| 75 | }) | ||
| 76 | |||
| 77 | const formEl = ref() | ||
| 78 | const form = ref({}) | ||
| 79 | const formRules = ref({}) | ||
| 80 | const formOptions = ref({}) | ||
| 81 | |||
| 82 | async function initForm () { | ||
| 83 | const { fields, type, data } = props | ||
| 84 | console.log(data) | ||
| 85 | if (!fields) return | ||
| 86 | let formData = {} | ||
| 87 | let formRuleData = {} | ||
| 88 | let formOptionData = {} | ||
| 89 | let detailData:any = {} | ||
| 90 | if (type === 'edit') { | ||
| 91 | detailData = await getDetail() | ||
| 92 | } | ||
| 93 | fields.forEach(async (item:any) => { | ||
| 94 | formData[item.fileNameCode] = type === 'add' ? '' : detailData.metaStandardValue[item.fileNameCode] | ||
| 95 | formRuleData[item.fileNameCode] = { | ||
| 96 | required: item.isNotnull === 'Y' ? true : false, | ||
| 97 | message: `缺少${item.fileNameCodeName}` | ||
| 98 | } | ||
| 99 | // formOptionData[item.fileNameCode] = await getOptions(item.dataTypeCode) | ||
| 100 | if (item.inputTypeCode == '2') { | ||
| 101 | formOptions.value[item.fileNameCode] = await getOptions(item.dataTypeCode) | ||
| 102 | } | ||
| 103 | }) | ||
| 104 | // formOptions.value = formOptionData | ||
| 105 | form.value = formData | ||
| 106 | formRules.value = formRuleData | ||
| 107 | nextTick(() => formEl.value.clearValidate()) | ||
| 108 | setTimeout(() => { | ||
| 109 | formEl.value.clearValidate() | ||
| 110 | }, 100) | ||
| 111 | } | ||
| 112 | function getOptions (dictType) { | ||
| 113 | return new Promise((resolve, reject) => { | ||
| 114 | getParamsList({ dictType }).then((res:any) => { | ||
| 115 | if (res.code === proxy.$passCode) { | ||
| 116 | resolve(res.data) | ||
| 117 | } | ||
| 118 | }) | ||
| 119 | }) | ||
| 120 | } | ||
| 121 | function getDetail () { | ||
| 122 | return new Promise((resolve) => { | ||
| 123 | getMetaStandardFieldDetail(props.data.guid).then((res:any) => { | ||
| 124 | if (res.code === proxy.$passCode) { | ||
| 125 | resolve(res.data) | ||
| 126 | } | ||
| 127 | }) | ||
| 128 | }) | ||
| 129 | } | ||
| 130 | |||
| 131 | const confirmLoading = ref(false) | ||
| 132 | function confirm () { | ||
| 133 | console.log(form.value) | ||
| 134 | formEl.value.validate(valid => { | ||
| 135 | if (!valid) return | ||
| 136 | let body = { | ||
| 137 | metaStandardGuid: props.metaStandardGuid, | ||
| 138 | metaStandardValue: { ...form.value } | ||
| 139 | } | ||
| 140 | if (props.type === 'edit') { | ||
| 141 | body.guid = props.data.guid | ||
| 142 | } | ||
| 143 | confirmLoading.value = true | ||
| 144 | saveMetaStandardDataFields(body).then((res:any) => { | ||
| 145 | if (res.code === proxy.$passCode) { | ||
| 146 | ElMessage.success('操作成功') | ||
| 147 | emit('success') | ||
| 148 | visible.value = false | ||
| 149 | return | ||
| 150 | } | ||
| 151 | }).finally(() => confirmLoading.value = false) | ||
| 152 | }) | ||
| 153 | } | ||
| 154 | |||
| 155 | watch( | ||
| 156 | () => visible.value, | ||
| 157 | (v) => { | ||
| 158 | if (!v) return | ||
| 159 | initForm() | ||
| 160 | } | ||
| 161 | ) | ||
| 162 | </script> | ||
| 163 | |||
| 164 | <style lang="scss"> | ||
| 165 | .standard-modal { | ||
| 166 | .el-form-item { | ||
| 167 | flex-direction: column; | ||
| 168 | .el-form-item__label { | ||
| 169 | justify-content: flex-start; | ||
| 170 | } | ||
| 171 | } | ||
| 172 | .el-dialog__footer { | ||
| 173 | padding: 10px; | ||
| 174 | } | ||
| 175 | |||
| 176 | .table-form-wrapper { | ||
| 177 | display: flex; | ||
| 178 | margin-bottom: 5px; | ||
| 179 | .table-form-item { | ||
| 180 | padding-right: 10px; | ||
| 181 | } | ||
| 182 | .table-form-operation { | ||
| 183 | flex: 0 0 70px; | ||
| 184 | padding-left: 6px; | ||
| 185 | } | ||
| 186 | } | ||
| 187 | } | ||
| 188 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -14,11 +14,13 @@ import useCatchStore from "@/store/modules/catch"; | ... | @@ -14,11 +14,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, deleteMetaStandard, | 16 | import { getMetaStandardTree, deleteMetaStandard, |
| 17 | getMetaStandardDataList, getMetaStandardDataFields | 17 | getMetaStandardDataList, getMetaStandardDataFields, |
| 18 | deleteMetaStandardDataFields | ||
| 18 | } from '@/api/modules/dataMetaService' | 19 | } from '@/api/modules/dataMetaService' |
| 19 | import router from '@/router' | 20 | import router from '@/router' |
| 20 | import { TableColumnWidth } from '@/utils/enum'; | 21 | import { TableColumnWidth } from '@/utils/enum'; |
| 21 | import StandardDialog from './components/standardDialog.vue' | 22 | import StandardDialog from './components/standardDialog.vue' |
| 23 | import StandardFieldsDialog from './components/standardFieldsDialog.vue' | ||
| 22 | 24 | ||
| 23 | const { proxy } = getCurrentInstance() as any; | 25 | const { proxy } = getCurrentInstance() as any; |
| 24 | 26 | ||
| ... | @@ -113,7 +115,7 @@ const selectRowData = ref([]) | ... | @@ -113,7 +115,7 @@ const selectRowData = ref([]) |
| 113 | const selectedRowData = ref([]) | 115 | const selectedRowData = ref([]) |
| 114 | const tableInfo: any = ref({ | 116 | const tableInfo: any = ref({ |
| 115 | id: 'data-source-table', | 117 | id: 'data-source-table', |
| 116 | multiple: true, | 118 | multiple: false, |
| 117 | fixedSelection: true, | 119 | fixedSelection: true, |
| 118 | fields: [ | 120 | fields: [ |
| 119 | { label: "序号", type: "index", width: 56, align: "center" }, | 121 | { label: "序号", type: "index", width: 56, align: "center" }, |
| ... | @@ -142,6 +144,7 @@ const tableInfo: any = ref({ | ... | @@ -142,6 +144,7 @@ const tableInfo: any = ref({ |
| 142 | }, | 144 | }, |
| 143 | loading: false | 145 | loading: false |
| 144 | }) | 146 | }) |
| 147 | const standardFields = ref([]) | ||
| 145 | function getFirstPageData () { | 148 | function getFirstPageData () { |
| 146 | page.value.curr = 1 | 149 | page.value.curr = 1 |
| 147 | toSearch({}) | 150 | toSearch({}) |
| ... | @@ -152,6 +155,7 @@ function toSearch (val: any, clear: boolean = false) { | ... | @@ -152,6 +155,7 @@ function toSearch (val: any, clear: boolean = false) { |
| 152 | params.pageIndex = page.value.curr; | 155 | params.pageIndex = page.value.curr; |
| 153 | params.pageSize = page.value.limit; | 156 | params.pageSize = page.value.limit; |
| 154 | params.metaStandardGuid = currentObj.guid | 157 | params.metaStandardGuid = currentObj.guid |
| 158 | params.keyWords = tableSearchInput.value | ||
| 155 | getTable(params) | 159 | getTable(params) |
| 156 | } | 160 | } |
| 157 | function getTable (params) { | 161 | function getTable (params) { |
| ... | @@ -178,6 +182,7 @@ function getTableFields () { | ... | @@ -178,6 +182,7 @@ function getTableFields () { |
| 178 | getMetaStandardDataFields(currentObj.guid).then((res:any) => { | 182 | getMetaStandardDataFields(currentObj.guid).then((res:any) => { |
| 179 | if (res.code === proxy.$passCode && res.data) { | 183 | if (res.code === proxy.$passCode && res.data) { |
| 180 | const data = res.data | 184 | const data = res.data |
| 185 | standardFields.value = data | ||
| 181 | const fields = data.map(item => { | 186 | const fields = data.map(item => { |
| 182 | return { | 187 | return { |
| 183 | label: item.fileNameCodeName, | 188 | label: item.fileNameCodeName, |
| ... | @@ -197,6 +202,30 @@ function tablePageChange (info) { | ... | @@ -197,6 +202,30 @@ function tablePageChange (info) { |
| 197 | page.value.limit = Number(info.limit) | 202 | page.value.limit = Number(info.limit) |
| 198 | toSearch({}) | 203 | toSearch({}) |
| 199 | } | 204 | } |
| 205 | function tableBtnClick (scope, btn) { | ||
| 206 | console.log(scope, btn) | ||
| 207 | const type = btn.value | ||
| 208 | const row = scope.row | ||
| 209 | if (type === 'edit') { | ||
| 210 | openStandardFieldsDialog(type, row) | ||
| 211 | } else if (type === 'delete') { | ||
| 212 | ElMessageBox.confirm('确定删除吗?', '提示', { | ||
| 213 | confirmButtonText: "确定", | ||
| 214 | cancelButtonText: "取消", | ||
| 215 | type: 'warning', | ||
| 216 | }).then(() => deleteStandardFields(row)) | ||
| 217 | } | ||
| 218 | } | ||
| 219 | function deleteStandardFields (row) { | ||
| 220 | deleteMetaStandardDataFields([row.guid]).then((res:any) => { | ||
| 221 | if (res.code === proxy.$passCode) { | ||
| 222 | ElMessage.success('删除成功') | ||
| 223 | getFirstPageData() | ||
| 224 | } else { | ||
| 225 | ElMessage.error(res.msg) | ||
| 226 | } | ||
| 227 | }) | ||
| 228 | } | ||
| 200 | 229 | ||
| 201 | const formItems: any = ref([ | 230 | const formItems: any = ref([ |
| 202 | { | 231 | { |
| ... | @@ -334,6 +363,19 @@ function openStandardDialog () { | ... | @@ -334,6 +363,19 @@ function openStandardDialog () { |
| 334 | standardDialog.type = 'add' | 363 | standardDialog.type = 'add' |
| 335 | standardDialog.visible = true | 364 | standardDialog.visible = true |
| 336 | } | 365 | } |
| 366 | // 元标准数据dialog | ||
| 367 | const standardFieldsDialog = reactive({ | ||
| 368 | visible: false, | ||
| 369 | type: 'add', | ||
| 370 | metaStandardGuid: null, | ||
| 371 | data: {} | ||
| 372 | }) | ||
| 373 | function openStandardFieldsDialog (type, data = {}) { | ||
| 374 | standardFieldsDialog.type = type | ||
| 375 | standardFieldsDialog.metaStandardGuid = treeInfo.value.currentObj.guid | ||
| 376 | standardFieldsDialog.data = data | ||
| 377 | standardFieldsDialog.visible = true | ||
| 378 | } | ||
| 337 | 379 | ||
| 338 | onBeforeMount(() => { | 380 | onBeforeMount(() => { |
| 339 | getTree() | 381 | getTree() |
| ... | @@ -358,16 +400,16 @@ onBeforeMount(() => { | ... | @@ -358,16 +400,16 @@ onBeforeMount(() => { |
| 358 | <div class="main_wrap"> | 400 | <div class="main_wrap"> |
| 359 | <div class="table_tool_wrap"> | 401 | <div class="table_tool_wrap"> |
| 360 | <div class="tools_btns"> | 402 | <div class="tools_btns"> |
| 361 | <el-button type="primary" @click="loadDrawer" v-preReClick>新建</el-button> | 403 | <el-button type="primary" @click="() => openStandardFieldsDialog('add')" v-preReClick>新建</el-button> |
| 362 | <el-button @click="batching('export')" v-preReClick>导入</el-button> | 404 | <el-button @click="batching('export')" v-preReClick>导入</el-button> |
| 363 | <el-button @click="batching('delete')" v-preReClick>导出</el-button> | 405 | <el-button @click="batching('delete')" v-preReClick>导出</el-button> |
| 364 | <el-button @click="batching('delete')" v-preReClick>查看</el-button> | 406 | <el-button @click="batching('delete')" v-preReClick>查看</el-button> |
| 365 | </div> | 407 | </div> |
| 366 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入代码名称搜索" | 408 | <el-input class="table_search_input" v-model.trim="tableSearchInput" placeholder="请输入关键字搜索" |
| 367 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> | 409 | :suffix-icon="Search" clearable @change="val => getFirstPageData()" /> |
| 368 | </div> | 410 | </div> |
| 369 | <div class="table_panel_wrap full"> | 411 | <div class="table_panel_wrap full"> |
| 370 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tableSelectionChange="tableSelectionChange" | 412 | <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" |
| 371 | @tablePageChange="tablePageChange"/> | 413 | @tablePageChange="tablePageChange"/> |
| 372 | </div> | 414 | </div> |
| 373 | </div> | 415 | </div> |
| ... | @@ -378,6 +420,14 @@ onBeforeMount(() => { | ... | @@ -378,6 +420,14 @@ onBeforeMount(() => { |
| 378 | :guid="standardDialog.guid" | 420 | :guid="standardDialog.guid" |
| 379 | @success="getTree" | 421 | @success="getTree" |
| 380 | /> | 422 | /> |
| 423 | <StandardFieldsDialog | ||
| 424 | v-model="standardFieldsDialog.visible" | ||
| 425 | :fields="standardFields" | ||
| 426 | :type="standardFieldsDialog.type" | ||
| 427 | :metaStandardGuid="standardFieldsDialog.metaStandardGuid" | ||
| 428 | :data="standardFieldsDialog.data" | ||
| 429 | @success="getFirstPageData" | ||
| 430 | /> | ||
| 381 | </div> | 431 | </div> |
| 382 | </template> | 432 | </template> |
| 383 | 433 | ... | ... |
-
Please register or sign in to post a comment