fix
Showing
2 changed files
with
47 additions
and
48 deletions
| ... | @@ -115,7 +115,10 @@ const tableInfo: any = ref({ | ... | @@ -115,7 +115,10 @@ const tableInfo: any = ref({ |
| 115 | { label: '标准号', field: 'standard', width: 140 }, | 115 | { label: '标准号', field: 'standard', width: 140 }, |
| 116 | { label: '标准名称', field: 'standardName', width: 140 }, | 116 | { label: '标准名称', field: 'standardName', width: 140 }, |
| 117 | // { label: '启用状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' }, | 117 | // { label: '启用状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' }, |
| 118 | { label: '启用状态', field: 'bizState', type: 'tag', width: 100, align: 'center' }, | 118 | { label: '启用状态', field: 'bizState', type: 'tag', width: 100, align: 'center',getName: (scope) => { |
| 119 | let status = scope.row.bizState; | ||
| 120 | return status == 'Y' ? '启用' : '停用'; | ||
| 121 | } }, | ||
| 119 | { label: '创建时间', field: 'createTime', width: 140 } | 122 | { label: '创建时间', field: 'createTime', width: 140 } |
| 120 | ], | 123 | ], |
| 121 | data: [], | 124 | data: [], |
| ... | @@ -309,7 +312,7 @@ const formItems: any = ref([ | ... | @@ -309,7 +312,7 @@ const formItems: any = ref([ |
| 309 | required: true | 312 | required: true |
| 310 | }, | 313 | }, |
| 311 | { | 314 | { |
| 312 | label: '编码字段11', | 315 | label: '编码字段', |
| 313 | type: 'select', | 316 | type: 'select', |
| 314 | placeholder: '请选择', | 317 | placeholder: '请选择', |
| 315 | field: 'codeFields', | 318 | field: 'codeFields', |
| ... | @@ -320,6 +323,7 @@ const formItems: any = ref([ | ... | @@ -320,6 +323,7 @@ const formItems: any = ref([ |
| 320 | multiple: true, | 323 | multiple: true, |
| 321 | tagsTooltip: true, | 324 | tagsTooltip: true, |
| 322 | filterable: true, | 325 | filterable: true, |
| 326 | visible: true | ||
| 323 | }, | 327 | }, |
| 324 | { | 328 | { |
| 325 | label: '编码名称', | 329 | label: '编码名称', |
| ... | @@ -329,7 +333,8 @@ const formItems: any = ref([ | ... | @@ -329,7 +333,8 @@ const formItems: any = ref([ |
| 329 | default: '', | 333 | default: '', |
| 330 | options: codeOptions, | 334 | options: codeOptions, |
| 331 | clearable: true, | 335 | clearable: true, |
| 332 | required: true | 336 | required: true, |
| 337 | visible: true | ||
| 333 | }, | 338 | }, |
| 334 | { | 339 | { |
| 335 | label: '层级结构', | 340 | label: '层级结构', |
| ... | @@ -338,7 +343,7 @@ const formItems: any = ref([ | ... | @@ -338,7 +343,7 @@ const formItems: any = ref([ |
| 338 | field: 'hierarchy', | 343 | field: 'hierarchy', |
| 339 | default: '', | 344 | default: '', |
| 340 | clearable: true, | 345 | clearable: true, |
| 341 | visible: true | 346 | visible: false |
| 342 | } | 347 | } |
| 343 | ]) | 348 | ]) |
| 344 | const formRules: any = ref({ | 349 | const formRules: any = ref({ |
| ... | @@ -571,36 +576,10 @@ const drawerInfo: any = ref({ | ... | @@ -571,36 +576,10 @@ const drawerInfo: any = ref({ |
| 571 | }) | 576 | }) |
| 572 | 577 | ||
| 573 | const setFormItems = (row: any = null) => { | 578 | const setFormItems = (row: any = null) => { |
| 574 | formItems.value = JSON.parse(JSON.stringify(orginItems)) | 579 | // formItems.value = JSON.parse(JSON.stringify(orginItems)) |
| 575 | formItems.value.map(item => { | 580 | formItems.value.map(item => { |
| 576 | if (item.field == 'databaseNameZh') { | ||
| 577 | item.options = dataBaseList.value | ||
| 578 | item.default = row ? row[item.field] : '' | 581 | item.default = row ? row[item.field] : '' |
| 579 | } else if (item.field == 'dictionaryType') { | 582 | |
| 580 | item.default = dictionaryType.value | ||
| 581 | // item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 582 | item.disabled = true | ||
| 583 | item.children.map(child => { | ||
| 584 | child.options = orginOptions | ||
| 585 | if (child.field == 'codeColumn') { | ||
| 586 | child.default = row ? row[child.field] : 'code' | ||
| 587 | } else if (child.field == 'codeName') { | ||
| 588 | child.default = row ? row[child.field] : 'name' | ||
| 589 | } else { | ||
| 590 | child.default = row ? row[child.field] : '' | ||
| 591 | } | ||
| 592 | child.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 593 | child.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 594 | }) | ||
| 595 | } else if (item.field == 'enName') { | ||
| 596 | item.default = row ? row[item.field] : '' | ||
| 597 | item.disabled = drawerInfo.value.type == 'add' ? false : true | ||
| 598 | item.clearable = drawerInfo.value.type == 'add' ? true : false | ||
| 599 | } else { | ||
| 600 | item.default = row ? row[item.field] : '' | ||
| 601 | item.disabled = drawerInfo.value.type == 'detail' ? true : false | ||
| 602 | item.clearable = drawerInfo.value.type == 'detail' ? false : true | ||
| 603 | } | ||
| 604 | }) | 583 | }) |
| 605 | formInfo.value.formInfo.readonly = drawerInfo.value.type == 'detail' | 584 | formInfo.value.formInfo.readonly = drawerInfo.value.type == 'detail' |
| 606 | formInfo.value.formInfo.items = formItems.value | 585 | formInfo.value.formInfo.items = formItems.value |
| ... | @@ -1359,7 +1338,7 @@ const setDetailInfo = () => { | ... | @@ -1359,7 +1338,7 @@ const setDetailInfo = () => { |
| 1359 | setCodeOptions() | 1338 | setCodeOptions() |
| 1360 | } | 1339 | } |
| 1361 | 1340 | ||
| 1362 | const saveData = async (params) => { | 1341 | const saveData = async (params, btnValue) => { |
| 1363 | // const passInfo = await checkParamsData() | 1342 | // const passInfo = await checkParamsData() |
| 1364 | console.log('params', params) | 1343 | console.log('params', params) |
| 1365 | let request = drawerInfo.value.type === 'add' ? saveStandardCode : updateStandardCode | 1344 | let request = drawerInfo.value.type === 'add' ? saveStandardCode : updateStandardCode |
| ... | @@ -1368,11 +1347,20 @@ const saveData = async (params) => { | ... | @@ -1368,11 +1347,20 @@ const saveData = async (params) => { |
| 1368 | ElMessage.success('操作成功') | 1347 | ElMessage.success('操作成功') |
| 1369 | getTreeData() | 1348 | getTreeData() |
| 1370 | drawerInfo.value.visible = false | 1349 | drawerInfo.value.visible = false |
| 1350 | if (btnValue === 'saveAndAdd') { | ||
| 1351 | // 跳转代码详情 | ||
| 1352 | toStandardCodeDetail(res.data) | ||
| 1353 | } | ||
| 1354 | } else { | ||
| 1355 | ElMessage.error(res.msg) | ||
| 1371 | } | 1356 | } |
| 1372 | }).finally(() => { | 1357 | }).finally(() => { |
| 1373 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = false) | 1358 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = false) |
| 1374 | }) | 1359 | }) |
| 1375 | } | 1360 | } |
| 1361 | function toStandardCodeDetail (guid) { | ||
| 1362 | |||
| 1363 | } | ||
| 1376 | 1364 | ||
| 1377 | const scrollTable = (rowInfo) => { | 1365 | const scrollTable = (rowInfo) => { |
| 1378 | nextTick(() => { | 1366 | nextTick(() => { |
| ... | @@ -1413,7 +1401,7 @@ const drawerBtnClick = (btn, info) => { | ... | @@ -1413,7 +1401,7 @@ const drawerBtnClick = (btn, info) => { |
| 1413 | } | 1401 | } |
| 1414 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { | 1402 | if (btn.value == 'submit' || btn.value == 'saveAndAdd') { |
| 1415 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = true) | 1403 | drawerInfo.value.footer.btns.map((item: any) => item.disabled = true) |
| 1416 | saveData(params) | 1404 | saveData(params,btn.value) |
| 1417 | } else { | 1405 | } else { |
| 1418 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) | 1406 | drawerInfo.value.footer.btns.map((item: any) => delete item.disabled) |
| 1419 | nextTick(() => { | 1407 | nextTick(() => { |
| ... | @@ -1423,9 +1411,19 @@ const drawerBtnClick = (btn, info) => { | ... | @@ -1423,9 +1411,19 @@ const drawerBtnClick = (btn, info) => { |
| 1423 | } | 1411 | } |
| 1424 | 1412 | ||
| 1425 | const radioGroupChange = async (val, info) => { | 1413 | const radioGroupChange = async (val, info) => { |
| 1426 | dictionaryType.value = Number(val) | 1414 | // console.log(val, info) |
| 1427 | await setFormItems(info) | 1415 | await setFormItems(info) |
| 1428 | setGroup() | 1416 | // setGroup() |
| 1417 | if (val == 1) { | ||
| 1418 | // 列表结构 | ||
| 1419 | formItems.value.find(v => v.field === 'codeFields')['visible'] = true | ||
| 1420 | formItems.value.find(v => v.field === 'codeFieldName')['visible'] = true | ||
| 1421 | formItems.value.find(v => v.field === 'hierarchy')['visible'] = false | ||
| 1422 | } else { | ||
| 1423 | formItems.value.find(v => v.field === 'codeFields')['visible'] = false | ||
| 1424 | formItems.value.find(v => v.field === 'codeFieldName')['visible'] = false | ||
| 1425 | formItems.value.find(v => v.field === 'hierarchy')['visible'] = true | ||
| 1426 | } | ||
| 1429 | } | 1427 | } |
| 1430 | 1428 | ||
| 1431 | // 切换结构类型 设置选项显隐 | 1429 | // 切换结构类型 设置选项显隐 |
| ... | @@ -1480,17 +1478,7 @@ onBeforeMount(() => { | ... | @@ -1480,17 +1478,7 @@ onBeforeMount(() => { |
| 1480 | }) | 1478 | }) |
| 1481 | 1479 | ||
| 1482 | onMounted(() => { | 1480 | onMounted(() => { |
| 1483 | let dom = document.getElementById('main-app'); | 1481 | |
| 1484 | if (dom) { | ||
| 1485 | dom.addEventListener('click', (event: any) => { | ||
| 1486 | // 新建时不要处理。 | ||
| 1487 | if (drawerInfo.value.header.title == '数据字典详情' && !event.target?.classList?.contains('drawer-detail-cell')) { | ||
| 1488 | if (drawerInfo.value.visible) { | ||
| 1489 | drawerInfo.value.visible = false; | ||
| 1490 | } | ||
| 1491 | } | ||
| 1492 | }); | ||
| 1493 | } | ||
| 1494 | }); | 1482 | }); |
| 1495 | 1483 | ||
| 1496 | </script> | 1484 | </script> | ... | ... |
| ... | @@ -29,6 +29,7 @@ import { | ... | @@ -29,6 +29,7 @@ import { |
| 29 | getDictionaryTree | 29 | getDictionaryTree |
| 30 | } from '@/api/modules/dataInventory'; | 30 | } from '@/api/modules/dataInventory'; |
| 31 | import { commonPageConfig } from '@/utils/enum'; | 31 | import { commonPageConfig } from '@/utils/enum'; |
| 32 | import * as XLSX from 'xlsx'; | ||
| 32 | 33 | ||
| 33 | const { proxy } = getCurrentInstance() as any; | 34 | const { proxy } = getCurrentInstance() as any; |
| 34 | 35 | ||
| ... | @@ -330,8 +331,18 @@ const open = (msg, type, isBatch = false) => { | ... | @@ -330,8 +331,18 @@ const open = (msg, type, isBatch = false) => { |
| 330 | }); | 331 | }); |
| 331 | }; | 332 | }; |
| 332 | 333 | ||
| 334 | const sheetNameList = ref([]) | ||
| 333 | const onUpload = (file, fileList) => { | 335 | const onUpload = (file, fileList) => { |
| 336 | // console.log('file', file) | ||
| 334 | uploadFiles.value = fileList | 337 | uploadFiles.value = fileList |
| 338 | const reader = new FileReader() | ||
| 339 | reader.onload = function (e) { | ||
| 340 | let data = new Uint8Array(e.target.result) | ||
| 341 | let wb = XLSX.read(data, { type: 'array', raw: false, cellDates: true }) | ||
| 342 | console.log('wb', wb) | ||
| 343 | sheetNameList.value = wb.SheetNames | ||
| 344 | } | ||
| 345 | reader.readAsArrayBuffer(file.raw) | ||
| 335 | } | 346 | } |
| 336 | 347 | ||
| 337 | const uploadBtnClick = (btn) => { | 348 | const uploadBtnClick = (btn) => { |
| ... | @@ -511,7 +522,7 @@ onActivated(() => { | ... | @@ -511,7 +522,7 @@ onActivated(() => { |
| 511 | </el-form-item> | 522 | </el-form-item> |
| 512 | <el-form-item v-for="item in uploadSetting" :key="item.standardGuid" :label="item.standardName" required > | 523 | <el-form-item v-for="item in uploadSetting" :key="item.standardGuid" :label="item.standardName" required > |
| 513 | <el-select v-model="item.value" placeholder="请选择" style="width:200px" clearable> | 524 | <el-select v-model="item.value" placeholder="请选择" style="width:200px" clearable> |
| 514 | <el-option v-for="i in uploadSetting.length" :label="`Sheet${i}`" :value="`Sheet${i}`" :key="i"></el-option> | 525 | <el-option v-for="item,i in sheetNameList" :label="item" :value="item" :key="i"></el-option> |
| 515 | </el-select> | 526 | </el-select> |
| 516 | </el-form-item> | 527 | </el-form-item> |
| 517 | </el-form> | 528 | </el-form> | ... | ... |
-
Please register or sign in to post a comment