fix
Showing
3 changed files
with
73 additions
and
49 deletions
| ... | @@ -378,6 +378,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { | ... | @@ -378,6 +378,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { |
| 378 | return obj | 378 | return obj |
| 379 | }) | 379 | }) |
| 380 | loading.value = true | 380 | loading.value = true |
| 381 | tableInfo.value.loading = true | ||
| 381 | saveStandardCodeFieldsData(params).then((res: any) => { | 382 | saveStandardCodeFieldsData(params).then((res: any) => { |
| 382 | if (res.code == proxy.$passCode) { | 383 | if (res.code == proxy.$passCode) { |
| 383 | getFirstPageData(); | 384 | getFirstPageData(); |
| ... | @@ -390,6 +391,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { | ... | @@ -390,6 +391,7 @@ const saveData = async (scope: any = null, checkParamData: any = null) => { |
| 390 | type: 'error', | 391 | type: 'error', |
| 391 | message: res.msg, | 392 | message: res.msg, |
| 392 | }) | 393 | }) |
| 394 | tableInfo.value.loading = false | ||
| 393 | } | 395 | } |
| 394 | }).finally(() => loading.value = false) | 396 | }).finally(() => loading.value = false) |
| 395 | } | 397 | } | ... | ... |
| ... | @@ -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,10 +901,31 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -895,10 +901,31 @@ 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') { |
| 907 | let removeRows = () => { | ||
| 899 | const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID) | 908 | const existIndex = formTableData.value.findIndex(s => s.ROWID == row.ROWID) |
| 900 | existIndex > -1 && formTableData.value.splice(existIndex, 1) | 909 | existIndex > -1 && formTableData.value.splice(existIndex, 1) |
| 901 | } | 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 | } | ||
| 928 | } | ||
| 902 | else if (type == "delete") { | 929 | else if (type == "delete") { |
| 903 | currTableData.value = row; | 930 | currTableData.value = row; |
| 904 | tableInfo.value.loading = true | 931 | tableInfo.value.loading = true |
| ... | @@ -917,41 +944,19 @@ const tableBtnClick = (scope, btn) => { | ... | @@ -917,41 +944,19 @@ 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) { | ||
| 921 | return new Promise((resolve, reject) => { | 947 | return new Promise((resolve, reject) => { |
| 922 | let params: any = { | 948 | let params: any = { |
| 923 | guid: currTableData.value.guid | 949 | pageIndex: 1, |
| 924 | } | 950 | pageSize: -1, |
| 925 | checkDeleteDictionaryScheme(params).then((res: any) => { | 951 | standardGuid: currTableData.value.guid |
| 926 | if (res.code == proxy.$passCode) { | ||
| 927 | const data = res.data | ||
| 928 | resolve(data) | ||
| 929 | } else { | ||
| 930 | reject(res.msg) | ||
| 931 | } | ||
| 932 | }).catch((xhr: any) => { | ||
| 933 | reject(xhr.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 | } | 952 | } |
| 942 | checkDeleteDictionary(guids).then((res: any) => { | 953 | |
| 954 | getStandardCodeDataList(params).then((res: any) => { | ||
| 943 | if (res.code == proxy.$passCode) { | 955 | if (res.code == proxy.$passCode) { |
| 944 | const data = res.data ?? {} | 956 | if (res.data.records.length) { |
| 945 | if (data.used) { | 957 | resolve(res.data) |
| 946 | resolve({ | ||
| 947 | used: true, | ||
| 948 | data: data.used | ||
| 949 | }) | ||
| 950 | } else { | 958 | } else { |
| 951 | resolve({ | 959 | resolve(null) |
| 952 | used: false, | ||
| 953 | data: data.unuse | ||
| 954 | }) | ||
| 955 | } | 960 | } |
| 956 | } else { | 961 | } else { |
| 957 | reject(res.msg) | 962 | reject(res.msg) |
| ... | @@ -960,7 +965,6 @@ const checkDelete = (isBatch: any = false) => { | ... | @@ -960,7 +965,6 @@ const checkDelete = (isBatch: any = false) => { |
| 960 | reject(xhr.msg) | 965 | reject(xhr.msg) |
| 961 | }) | 966 | }) |
| 962 | }) | 967 | }) |
| 963 | } | ||
| 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页"> | ... | ... |
-
Please register or sign in to post a comment