update : 分类分级 和 标签管理的chName
Showing
7 changed files
with
598 additions
and
223 deletions
| ... | @@ -757,8 +757,8 @@ export const createTableSql = (data) => request({ | ... | @@ -757,8 +757,8 @@ export const createTableSql = (data) => request({ |
| 757 | * @param {no params} | 757 | * @param {no params} |
| 758 | * @path /cg-dir/export | 758 | * @path /cg-dir/export |
| 759 | */ | 759 | */ |
| 760 | export const exportCgDir = () => request({ | 760 | export const exportCgDir = (params) => request({ |
| 761 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/export`, | 761 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/export?execGuid=${params.execGuid}`, |
| 762 | method: 'post', | 762 | method: 'post', |
| 763 | responseType: 'blob', | 763 | responseType: 'blob', |
| 764 | }) | 764 | }) |
| ... | @@ -785,6 +785,21 @@ export const getDbDirDetail = (params) => request({ | ... | @@ -785,6 +785,21 @@ export const getDbDirDetail = (params) => request({ |
| 785 | method: 'get', | 785 | method: 'get', |
| 786 | }) | 786 | }) |
| 787 | 787 | ||
| 788 | /** | ||
| 789 | * 数据库目录修改规划数据资产 | ||
| 790 | * @param {Object} | ||
| 791 | * @path /db-dir/table/update-data-asset | ||
| 792 | * | ||
| 793 | */ | ||
| 794 | |||
| 795 | export const updateDataAsset = (data) => request({ | ||
| 796 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/update-data-asset`, | ||
| 797 | method: 'post', | ||
| 798 | data | ||
| 799 | }) | ||
| 800 | |||
| 801 | |||
| 802 | |||
| 788 | /*********************业务规则配置 ************数据库目录************************* */ | 803 | /*********************业务规则配置 ************数据库目录************************* */ |
| 789 | 804 | ||
| 790 | /** | 805 | /** | ... | ... |
| ... | @@ -235,8 +235,8 @@ const routes: RouteRecordRaw[] = [ | ... | @@ -235,8 +235,8 @@ const routes: RouteRecordRaw[] = [ |
| 235 | reuse: true | 235 | reuse: true |
| 236 | }, | 236 | }, |
| 237 | beforeEnter: (to, from) => { | 237 | beforeEnter: (to, from) => { |
| 238 | if (to.query.domainName) { | 238 | if (to.query.editOpt) { |
| 239 | to.meta.title = `已有表新建(${to.query.domainName})`; | 239 | to.meta.title = `编辑-(${to.query.tableChName})`; |
| 240 | to.meta.editPage = true; | 240 | to.meta.editPage = true; |
| 241 | } | 241 | } |
| 242 | } | 242 | } | ... | ... |
| ... | @@ -23,7 +23,8 @@ import { | ... | @@ -23,7 +23,8 @@ import { |
| 23 | exportDbDirTable, | 23 | exportDbDirTable, |
| 24 | getDbDirDetail, | 24 | getDbDirDetail, |
| 25 | getDbDirTableSelectList, | 25 | getDbDirTableSelectList, |
| 26 | getDbDirFieldSelectList | 26 | getDbDirFieldSelectList, |
| 27 | updateDataAsset | ||
| 27 | } from '@/api/modules/dataInventory'; | 28 | } from '@/api/modules/dataInventory'; |
| 28 | import { TableColumnWidth } from "@/utils/enum"; | 29 | import { TableColumnWidth } from "@/utils/enum"; |
| 29 | import router from "@/router"; | 30 | import router from "@/router"; |
| ... | @@ -32,7 +33,7 @@ import { getLabelList } from "@/api/modules/dataLabel"; | ... | @@ -32,7 +33,7 @@ import { getLabelList } from "@/api/modules/dataLabel"; |
| 32 | 33 | ||
| 33 | const currentPath = ref<string[]>([]); | 34 | const currentPath = ref<string[]>([]); |
| 34 | const { proxy } = getCurrentInstance() as any; | 35 | const { proxy } = getCurrentInstance() as any; |
| 35 | 36 | const route = useRoute(); | |
| 36 | // 分级分类树形列表 | 37 | // 分级分类树形列表 |
| 37 | const CgDirTreeList = ref(); | 38 | const CgDirTreeList = ref(); |
| 38 | const getCgDirTreeData = async () => { | 39 | const getCgDirTreeData = async () => { |
| ... | @@ -121,7 +122,7 @@ onMounted(async () => { | ... | @@ -121,7 +122,7 @@ onMounted(async () => { |
| 121 | 122 | ||
| 122 | // 左侧tree-list | 123 | // 左侧tree-list |
| 123 | const treeInfo = ref({ | 124 | const treeInfo = ref({ |
| 124 | id: "data-pickup-tree", | 125 | id: "data-tree", |
| 125 | filter: true, | 126 | filter: true, |
| 126 | editTreeItem: false, | 127 | editTreeItem: false, |
| 127 | queryValue: "", | 128 | queryValue: "", |
| ... | @@ -179,7 +180,7 @@ const searchItemList = ref([ | ... | @@ -179,7 +180,7 @@ const searchItemList = ref([ |
| 179 | }, | 180 | }, |
| 180 | block: false, | 181 | block: false, |
| 181 | filterable: false, | 182 | filterable: false, |
| 182 | clearable: false, | 183 | clearable: true, |
| 183 | required: false | 184 | required: false |
| 184 | }, { | 185 | }, { |
| 185 | label: '分级', | 186 | label: '分级', |
| ... | @@ -219,20 +220,24 @@ const toSearch = (val: any, clear: boolean = false) => { | ... | @@ -219,20 +220,24 @@ const toSearch = (val: any, clear: boolean = false) => { |
| 219 | fieldGuid: selectedC.value, | 220 | fieldGuid: selectedC.value, |
| 220 | }); | 221 | }); |
| 221 | } | 222 | } |
| 222 | if (activeName.value === 'second') { | 223 | if (activeName.value === 'second' && activeTab.value === 'table') { |
| 223 | getDataBaseFieldData({ | 224 | getDataBaseTableData({ |
| 224 | pageIndex: 1, | 225 | pageIndex: 1, |
| 225 | pageSize: 50, | 226 | pageSize: 50, |
| 226 | execGuid: execGuidInfo.value.execGuid, | 227 | execGuid: execGuidInfo.value.execGuid, |
| 227 | databaseGuid: selectedA.value, | 228 | databaseGuid: selectedA.value || '', |
| 228 | tableGuid: selectedB.value, | 229 | tableGuid: selectedB.value || '', |
| 229 | fieldGuid: selectedC.value, | 230 | fieldGuid: selectedC.value || '', |
| 230 | }); | 231 | }); |
| 231 | } | 232 | } |
| 232 | if (activeName.value === 'second' && activeTab.value === 'word') { | 233 | if (activeName.value === 'second' && activeTab.value === 'word') { |
| 233 | getSearchTableList(1, selectedA.value); | 234 | getDataBaseFieldData({ |
| 234 | getSearchTableList(2, selectedB.value); | 235 | pageIndex: 1, |
| 235 | getSearchTableList(3, selectedC.value); | 236 | pageSize: 50, |
| 237 | execGuid: execGuidInfo.value.execGuid, | ||
| 238 | databaseGuid: selectedA.value || '', | ||
| 239 | tableGuid: selectedB.value || '', | ||
| 240 | }); | ||
| 236 | } | 241 | } |
| 237 | }; | 242 | }; |
| 238 | 243 | ||
| ... | @@ -297,7 +302,9 @@ const checked = ref(false); | ... | @@ -297,7 +302,9 @@ const checked = ref(false); |
| 297 | const changeCheck = (val) => { | 302 | const changeCheck = (val) => { |
| 298 | 303 | ||
| 299 | checked.value = val; | 304 | checked.value = val; |
| 300 | getDataBaseTableData(); | 305 | getDataBaseTableData({ |
| 306 | isDataAsset: val ? 'Y' : '' | ||
| 307 | }); | ||
| 301 | } | 308 | } |
| 302 | 309 | ||
| 303 | //下方表格配置 | 310 | //下方表格配置 |
| ... | @@ -414,7 +421,7 @@ const dataBaseTreeInfo = ref<any>({ | ... | @@ -414,7 +421,7 @@ const dataBaseTreeInfo = ref<any>({ |
| 414 | }); | 421 | }); |
| 415 | 422 | ||
| 416 | const dataBasePage = ref({ | 423 | const dataBasePage = ref({ |
| 417 | limit: 10, | 424 | limit: 50, |
| 418 | curr: 1, | 425 | curr: 1, |
| 419 | sizes: [ | 426 | sizes: [ |
| 420 | { label: "10", value: 10 }, | 427 | { label: "10", value: 10 }, |
| ... | @@ -432,7 +439,7 @@ const dataBaseTableInfo = ref({ | ... | @@ -432,7 +439,7 @@ const dataBaseTableInfo = ref({ |
| 432 | fields: [ | 439 | fields: [ |
| 433 | { label: "序号", type: "index", width: 56, align: "center" }, | 440 | { label: "序号", type: "index", width: 56, align: "center" }, |
| 434 | { label: "数据源", field: "databaseChName", width: 140 }, | 441 | { label: "数据源", field: "databaseChName", width: 140 }, |
| 435 | { label: "表名称", field: "tableChName", width: 180 }, | 442 | { label: "表名称", field: "tableChName", width: 120 }, |
| 436 | { label: "数据库表", field: "tableName", width: 120 }, | 443 | { label: "数据库表", field: "tableName", width: 120 }, |
| 437 | { | 444 | { |
| 438 | label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { | 445 | label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { |
| ... | @@ -445,13 +452,13 @@ const dataBaseTableInfo = ref({ | ... | @@ -445,13 +452,13 @@ const dataBaseTableInfo = ref({ |
| 445 | } | 452 | } |
| 446 | }, | 453 | }, |
| 447 | { | 454 | { |
| 448 | label: "状态", field: "state", type: 'tag', width: 180, getName: (scope) => { | 455 | label: "状态", field: "state", type: 'tag', width: 120, getName: (scope) => { |
| 449 | let status = scope.row.state; | 456 | let status = scope.row.state; |
| 450 | // 0 草稿中 1 已建表 2 已有默认表 | 457 | // 0 草稿中 1 已建表 2 已有默认表 |
| 451 | return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; | 458 | return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; |
| 452 | } | 459 | } |
| 453 | }, | 460 | }, |
| 454 | { label: "任务修改人", field: "updateUserName", width: 120 }, | 461 | { label: "任务修改人", field: "updateUserName", width: 100 }, |
| 455 | { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, | 462 | { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, |
| 456 | { label: "描述", field: "description", width: 120, align: 'center' }, | 463 | { label: "描述", field: "description", width: 120, align: 'center' }, |
| 457 | { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, | 464 | { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, |
| ... | @@ -466,13 +473,13 @@ const dataBaseTableInfo = ref({ | ... | @@ -466,13 +473,13 @@ const dataBaseTableInfo = ref({ |
| 466 | actionInfo: { | 473 | actionInfo: { |
| 467 | label: "操作", | 474 | label: "操作", |
| 468 | type: "btn", | 475 | type: "btn", |
| 469 | width: 300, | 476 | width: 200, |
| 470 | fixed: 'right', | 477 | fixed: 'right', |
| 471 | btns: (scope) => { | 478 | btns: (scope) => { |
| 472 | return [ | 479 | return [ |
| 473 | { | 480 | { |
| 474 | label: "配置业务规则", value: "edit", click: (scope) => { | 481 | label: "配置业务规则", value: "edit", click: (scope) => { |
| 475 | console.log('编辑', scope); | 482 | console.log('配置', scope); |
| 476 | // 路由跳转configure-rules | 483 | // 路由跳转configure-rules |
| 477 | router.push({ | 484 | router.push({ |
| 478 | name: 'configureRules', | 485 | name: 'configureRules', |
| ... | @@ -490,30 +497,37 @@ const dataBaseTableInfo = ref({ | ... | @@ -490,30 +497,37 @@ const dataBaseTableInfo = ref({ |
| 490 | { | 497 | { |
| 491 | label: "编辑表结构", value: "edit", click: (scope) => { | 498 | label: "编辑表结构", value: "edit", click: (scope) => { |
| 492 | console.log('复制', scope); | 499 | console.log('复制', scope); |
| 493 | getDbDirDetail({ | 500 | // foundMode 1 已有表新建 2 根据文件新建 |
| 494 | tableGuid: scope.row.tableGuid | 501 | if (scope.row.foundMode === 1) { |
| 495 | }).then((res: any) => { | 502 | // 已有表新建编辑 editOpt 代表时编辑 |
| 496 | if (res.code == proxy.$passCode) { | ||
| 497 | console.log('res', res); | ||
| 498 | router.push({ | 503 | router.push({ |
| 499 | name: 'tableCreateExisting', | 504 | name: 'tableCreateExisting', |
| 500 | query: { | 505 | query: { |
| 501 | execGuid: execGuidInfo.value.execGuid, | 506 | foundMode: '1', |
| 502 | foundMode: 1, | 507 | editOpt: '1', |
| 503 | database: res.data.database, | ||
| 504 | databaseChName: res.data.databaseChName, | ||
| 505 | databaseGuid: res.data.databaseGuid, | ||
| 506 | tableGuid: scope.row.tableGuid, | 508 | tableGuid: scope.row.tableGuid, |
| 507 | tableName: scope.row.tableName, | 509 | execGuid: execGuidInfo.value.execGuid, |
| 508 | tableChName: scope.row.tableChName, | 510 | tableChName: scope.row.tableChName, |
| 509 | description: scope.row.description, | 511 | database: dataBaseInfo.value.database, |
| 512 | databaseChName: dataBaseInfo.value.databaseChName, | ||
| 513 | databaseGuid: dataBaseInfo.value.databaseGuid, | ||
| 510 | } | 514 | } |
| 511 | }); | 515 | }); |
| 512 | } else { | 516 | } else { |
| 513 | proxy.$ElMessage.error(res.msg); | 517 | router.push({ |
| 518 | name: 'tableCreateExisting', | ||
| 519 | query: { | ||
| 520 | foundMode: '2', | ||
| 521 | editOpt: '1', | ||
| 522 | tableGuid: scope.row.tableGuid, | ||
| 523 | execGuid: execGuidInfo.value.execGuid, | ||
| 524 | tableChName: scope.row.tableChName, | ||
| 525 | database: dataBaseInfo.value.database, | ||
| 526 | databaseChName: dataBaseInfo.value.databaseChName, | ||
| 527 | databaseGuid: dataBaseInfo.value.databaseGuid, | ||
| 528 | } | ||
| 529 | }); | ||
| 514 | } | 530 | } |
| 515 | }) | ||
| 516 | |||
| 517 | }, | 531 | }, |
| 518 | disabled: scope.row.state !== 2 ? false : true | 532 | disabled: scope.row.state !== 2 ? false : true |
| 519 | } | 533 | } |
| ... | @@ -526,7 +540,48 @@ const dataBaseTableInfo = ref({ | ... | @@ -526,7 +540,48 @@ const dataBaseTableInfo = ref({ |
| 526 | loading: false | 540 | loading: false |
| 527 | }); | 541 | }); |
| 528 | 542 | ||
| 529 | 543 | const tableSwitchBeforeChange = (scope, field, callback) => { | |
| 544 | // 弹窗确认 | ||
| 545 | proxy.$confirm('是否修改状态?', '提示', { | ||
| 546 | confirmButtonText: '确定', | ||
| 547 | cancelButtonText: '取消', | ||
| 548 | type: 'warning' | ||
| 549 | }).then(async () => { | ||
| 550 | let params = {}; | ||
| 551 | const state = scope.row.isDataAsset === 'Y' ? 'N' : 'Y'; | ||
| 552 | if (scope.row.foundMode) { | ||
| 553 | params = { | ||
| 554 | tableGuid: scope.row.tableGuid, | ||
| 555 | isDataAsset: state, | ||
| 556 | foundMode: scope.row.foundMode | ||
| 557 | } | ||
| 558 | } else { | ||
| 559 | params = { | ||
| 560 | tableGuid: scope.row.tableGuid, | ||
| 561 | isDataAsset: state | ||
| 562 | } | ||
| 563 | } | ||
| 564 | const res: any = await updateDataAsset(params); | ||
| 565 | const tableGuid = ref(''); | ||
| 566 | const dataBaseGuid = ref(''); | ||
| 567 | if (res.code == proxy.$passCode) { | ||
| 568 | getDataBaseTableData({ | ||
| 569 | dataBaseGuid: dataBaseGuid.value, | ||
| 570 | tableGuid: tableGuid.value, | ||
| 571 | pageIndex: dataBasePage.value.curr, | ||
| 572 | pageSize: dataBasePage.value.limit | ||
| 573 | }); | ||
| 574 | callback(); | ||
| 575 | } else { | ||
| 576 | proxy.$ElMessage.error(res.msg); | ||
| 577 | } | ||
| 578 | }).catch(() => { | ||
| 579 | proxy.$ElMessage({ | ||
| 580 | type: 'info', | ||
| 581 | message: '已取消修改' | ||
| 582 | }); | ||
| 583 | }); | ||
| 584 | } | ||
| 530 | 585 | ||
| 531 | 586 | ||
| 532 | 587 | ||
| ... | @@ -743,6 +798,8 @@ const handleTreeItemMenuClick = (data: any, type) => { | ... | @@ -743,6 +798,8 @@ const handleTreeItemMenuClick = (data: any, type) => { |
| 743 | // tab切换 | 798 | // tab切换 |
| 744 | const activeName = ref('first'); | 799 | const activeName = ref('first'); |
| 745 | const handleClick = (tab: any) => { | 800 | const handleClick = (tab: any) => { |
| 801 | // 切换时选中的配置业务规则清空 | ||
| 802 | selectedRulesData.value = {}; | ||
| 746 | console.log(tab.props.name); | 803 | console.log(tab.props.name); |
| 747 | activeName.value = tab.props.name; | 804 | activeName.value = tab.props.name; |
| 748 | if (tab.props.name === 'second') { | 805 | if (tab.props.name === 'second') { |
| ... | @@ -848,19 +905,17 @@ const dataBaseTablePageChange = (info) => { | ... | @@ -848,19 +905,17 @@ const dataBaseTablePageChange = (info) => { |
| 848 | const tableFieldsLoading = ref(false); | 905 | const tableFieldsLoading = ref(false); |
| 849 | const tableFieldsData = ref([]); | 906 | const tableFieldsData = ref([]); |
| 850 | const getDataBaseFieldData = async (params = {}) => { | 907 | const getDataBaseFieldData = async (params = {}) => { |
| 851 | tableFieldsLoading.value = true; | 908 | tableFieldsDataInfo.value.loading = true; |
| 852 | const dataBaseParams = { | 909 | const dataBaseParams = { |
| 853 | pageIndex: 1, | 910 | pageIndex: 1, |
| 854 | pageSize: 50, | 911 | pageSize: 50, |
| 855 | tableGuid: "", | 912 | tableGuid: "", |
| 856 | execGuid: execGuidInfo.value.execGuid, | 913 | execGuid: execGuidInfo.value.execGuid, |
| 857 | databaseGuid: "", | 914 | databaseGuid: "", |
| 858 | isDataAsset: '', | ||
| 859 | fieldName: '', | 915 | fieldName: '', |
| 860 | gradeDetailName: '', | 916 | gradeDetailName: '', |
| 861 | }; | 917 | }; |
| 862 | const finalParams = { ...dataBaseParams, ...params }; | 918 | const finalParams = { ...dataBaseParams, ...params }; |
| 863 | |||
| 864 | const res: any = await getDbDirFieldPageList(finalParams); | 919 | const res: any = await getDbDirFieldPageList(finalParams); |
| 865 | if (res.code == proxy.$passCode) { | 920 | if (res.code == proxy.$passCode) { |
| 866 | tableFieldsData.value = res.data.records; | 921 | tableFieldsData.value = res.data.records; |
| ... | @@ -868,7 +923,7 @@ const getDataBaseFieldData = async (params = {}) => { | ... | @@ -868,7 +923,7 @@ const getDataBaseFieldData = async (params = {}) => { |
| 868 | } else { | 923 | } else { |
| 869 | proxy.$ElMessage.error(res.msg); | 924 | proxy.$ElMessage.error(res.msg); |
| 870 | } | 925 | } |
| 871 | tableFieldsLoading.value = false; | 926 | tableFieldsDataInfo.value.loading = false; |
| 872 | }; | 927 | }; |
| 873 | 928 | ||
| 874 | const tableFieldsDataInfo = ref({ | 929 | const tableFieldsDataInfo = ref({ |
| ... | @@ -964,6 +1019,9 @@ const handleSubjectTableCommand = (command: string) => { | ... | @@ -964,6 +1019,9 @@ const handleSubjectTableCommand = (command: string) => { |
| 964 | type: 'tableCreateFile', | 1019 | type: 'tableCreateFile', |
| 965 | foundMode: 2, | 1020 | foundMode: 2, |
| 966 | execGuid: execGuidInfo.value.execGuid, | 1021 | execGuid: execGuidInfo.value.execGuid, |
| 1022 | database: dataBaseInfo.value.database, | ||
| 1023 | databaseChName: dataBaseInfo.value.databaseChName, | ||
| 1024 | databaseGuid: dataBaseInfo.value.databaseGuid, | ||
| 967 | } | 1025 | } |
| 968 | }); | 1026 | }); |
| 969 | } else if (command === 'existingCreate') { | 1027 | } else if (command === 'existingCreate') { |
| ... | @@ -988,8 +1046,12 @@ const addIsShowClassifyTip = () => { | ... | @@ -988,8 +1046,12 @@ const addIsShowClassifyTip = () => { |
| 988 | isShowClassifyTip.value = false; | 1046 | isShowClassifyTip.value = false; |
| 989 | } | 1047 | } |
| 990 | 1048 | ||
| 1049 | const tipHeight = ref(200); | ||
| 1050 | const tipHeight1 = ref(220); | ||
| 991 | const addIsShowDatabaseTip = () => { | 1051 | const addIsShowDatabaseTip = () => { |
| 992 | isShowDatabaseTip.value = false; | 1052 | isShowDatabaseTip.value = false; |
| 1053 | tipHeight.value = 148; | ||
| 1054 | tipHeight1.value = 168; | ||
| 993 | } | 1055 | } |
| 994 | 1056 | ||
| 995 | // 表信息和字段信息切换 | 1057 | // 表信息和字段信息切换 |
| ... | @@ -1075,7 +1137,7 @@ const getDbDirTableSelectData = async (type, params = {}) => { | ... | @@ -1075,7 +1137,7 @@ const getDbDirTableSelectData = async (type, params = {}) => { |
| 1075 | const finalParams = { ...inParams, ...params }; | 1137 | const finalParams = { ...inParams, ...params }; |
| 1076 | const res: any = await getDbDirTableSelectList(finalParams); | 1138 | const res: any = await getDbDirTableSelectList(finalParams); |
| 1077 | if (res.code == proxy.$passCode) { | 1139 | if (res.code == proxy.$passCode) { |
| 1078 | console.log('getDbDirTableSelectData', res); | 1140 | |
| 1079 | if (type == 1) { | 1141 | if (type == 1) { |
| 1080 | optionsA.value = res.data.map((item) => ({ | 1142 | optionsA.value = res.data.map((item) => ({ |
| 1081 | dbGuid: item.database, // 数据库标识 | 1143 | dbGuid: item.database, // 数据库标识 |
| ... | @@ -1083,15 +1145,16 @@ const getDbDirTableSelectData = async (type, params = {}) => { | ... | @@ -1083,15 +1145,16 @@ const getDbDirTableSelectData = async (type, params = {}) => { |
| 1083 | })); | 1145 | })); |
| 1084 | } | 1146 | } |
| 1085 | if (type == 2) { | 1147 | if (type == 2) { |
| 1148 | console.log('进来了吗', res); | ||
| 1086 | optionsB.value = res.data.map((item) => ({ | 1149 | optionsB.value = res.data.map((item) => ({ |
| 1087 | dbGuid: item.tableName, // 表标识 | 1150 | dbGuid: item.database, // 表标识 |
| 1088 | name: item.tableName, // 表名称 | 1151 | name: item.database, // 表名称 |
| 1089 | })); | 1152 | })); |
| 1090 | } | 1153 | } |
| 1091 | if (type == 3) { | 1154 | if (type == 3) { |
| 1092 | optionsC.value = res.data.map((item) => ({ | 1155 | optionsC.value = res.data.map((item) => ({ |
| 1093 | dbGuid: item.fieldName, // 字段标识 | 1156 | dbGuid: item.database, // 字段标识 |
| 1094 | name: item.fieldName, // 字段名称 | 1157 | name: item.database, // 字段名称 |
| 1095 | })); | 1158 | })); |
| 1096 | } | 1159 | } |
| 1097 | 1160 | ||
| ... | @@ -1142,7 +1205,9 @@ const onBChange = async () => { | ... | @@ -1142,7 +1205,9 @@ const onBChange = async () => { |
| 1142 | 1205 | ||
| 1143 | // 导出 | 1206 | // 导出 |
| 1144 | const btnClick = async () => { | 1207 | const btnClick = async () => { |
| 1145 | exportCgDir().then((res: any) => { | 1208 | exportCgDir({ |
| 1209 | execGuid: execGuidInfo.value.execGuid, | ||
| 1210 | }).then((res: any) => { | ||
| 1146 | download(res, '分类分级目录数据.xlsx', 'excel') | 1211 | download(res, '分类分级目录数据.xlsx', 'excel') |
| 1147 | }); | 1212 | }); |
| 1148 | 1213 | ||
| ... | @@ -1161,6 +1226,26 @@ const treeSelectNodeChange = (node, item) => { | ... | @@ -1161,6 +1226,26 @@ const treeSelectNodeChange = (node, item) => { |
| 1161 | const { refGradeGuid } = node; | 1226 | const { refGradeGuid } = node; |
| 1162 | getGradeData(refGradeGuid); | 1227 | getGradeData(refGradeGuid); |
| 1163 | } | 1228 | } |
| 1229 | |||
| 1230 | // 这里应该是onActivated 钩子,路由从configure-路由从configure-rules跳转过来要重新请求数据、 | ||
| 1231 | onActivated(async () => { | ||
| 1232 | if (route.query.reload === 'true') { | ||
| 1233 | console.log('重新请求数据'); | ||
| 1234 | await getExecGuid(); | ||
| 1235 | activeName.value = 'second'; | ||
| 1236 | getDataBaseTreeData(); | ||
| 1237 | getDataBaseTableData({ | ||
| 1238 | exexGuid: execGuidInfo.value.execGuid | ||
| 1239 | }); | ||
| 1240 | getDataBaseFieldData( | ||
| 1241 | { | ||
| 1242 | exexGuid: execGuidInfo.value.execGuid | ||
| 1243 | } | ||
| 1244 | ); | ||
| 1245 | getDbDirTableSelectData(1, {}); | ||
| 1246 | } | ||
| 1247 | }); | ||
| 1248 | |||
| 1164 | </script> | 1249 | </script> |
| 1165 | 1250 | ||
| 1166 | <template> | 1251 | <template> |
| ... | @@ -1295,11 +1380,14 @@ const treeSelectNodeChange = (node, item) => { | ... | @@ -1295,11 +1380,14 @@ const treeSelectNodeChange = (node, item) => { |
| 1295 | <el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" /> | 1380 | <el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" /> |
| 1296 | </div> | 1381 | </div> |
| 1297 | </div> | 1382 | </div> |
| 1298 | <div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'"> | 1383 | <div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'" |
| 1299 | <Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange" /> | 1384 | :style="{ height: `calc(100% - ${tipHeight1}px)`, minHeight: '210px' }"> |
| 1385 | <Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange" | ||
| 1386 | @tableSwitchBeforeChange="tableSwitchBeforeChange" /> | ||
| 1300 | </div> | 1387 | </div> |
| 1301 | <div class="table_field" v-if="tableGuid || activeTab === 'word'"> | 1388 | <div class="table_field" v-if="tableGuid || activeTab === 'word'" |
| 1302 | <Table :tableInfo="tableFieldsDataInfo" :loading="tableFieldsLoading" /> | 1389 | :style="{ height: `calc(100% - ${tipHeight}px)`, minHeight: '210px' }"> |
| 1390 | <Table :tableInfo="tableFieldsDataInfo" /> | ||
| 1303 | </div> | 1391 | </div> |
| 1304 | </div> | 1392 | </div> |
| 1305 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" /> | 1393 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" /> |
| ... | @@ -1442,14 +1530,12 @@ const treeSelectNodeChange = (node, item) => { | ... | @@ -1442,14 +1530,12 @@ const treeSelectNodeChange = (node, item) => { |
| 1442 | 1530 | ||
| 1443 | .table_panel_wrap_database { | 1531 | .table_panel_wrap_database { |
| 1444 | width: 100%; | 1532 | width: 100%; |
| 1445 | height: calc(100% - 155px); | ||
| 1446 | min-height: 210px; | 1533 | min-height: 210px; |
| 1447 | overflow: visible; | 1534 | overflow: visible; |
| 1448 | } | 1535 | } |
| 1449 | 1536 | ||
| 1450 | .table_field { | 1537 | .table_field { |
| 1451 | width: 100%; | 1538 | width: 100%; |
| 1452 | height: calc(100% - 150px); | ||
| 1453 | min-height: 210px; | 1539 | min-height: 210px; |
| 1454 | overflow: visible; | 1540 | overflow: visible; |
| 1455 | } | 1541 | } | ... | ... |
| ... | @@ -13,6 +13,7 @@ const fullPath = route.fullPath; | ... | @@ -13,6 +13,7 @@ const fullPath = route.fullPath; |
| 13 | const userStore = useUserStore(); | 13 | const userStore = useUserStore(); |
| 14 | const bizRuleConfigData = ref<any>() | 14 | const bizRuleConfigData = ref<any>() |
| 15 | const getBizRuleConfigDetailData = async () => { | 15 | const getBizRuleConfigDetailData = async () => { |
| 16 | tableFieldsLoading.value = true | ||
| 16 | const params = { | 17 | const params = { |
| 17 | tableGuid: router.currentRoute.value.query.tableGuid, | 18 | tableGuid: router.currentRoute.value.query.tableGuid, |
| 18 | execGuid: router.currentRoute.value.query.execGuid | 19 | execGuid: router.currentRoute.value.query.execGuid |
| ... | @@ -25,6 +26,7 @@ const getBizRuleConfigDetailData = async () => { | ... | @@ -25,6 +26,7 @@ const getBizRuleConfigDetailData = async () => { |
| 25 | item.isEdit = false | 26 | item.isEdit = false |
| 26 | }) | 27 | }) |
| 27 | tableData.value = bizRuleConfigData.value | 28 | tableData.value = bizRuleConfigData.value |
| 29 | tableFieldsLoading.value = false | ||
| 28 | } else { | 30 | } else { |
| 29 | proxy.$message.error(res.msg) | 31 | proxy.$message.error(res.msg) |
| 30 | } | 32 | } | ... | ... |
| ... | @@ -798,7 +798,7 @@ const positionOptions = [ | ... | @@ -798,7 +798,7 @@ const positionOptions = [ |
| 798 | ]; | 798 | ]; |
| 799 | // 语言options | 799 | // 语言options |
| 800 | const languageOptions = [ | 800 | const languageOptions = [ |
| 801 | { label: '中文名', value: 'zhName' }, | 801 | { label: '中文名', value: 'chName' }, |
| 802 | { label: '英文名', value: 'enName' }, | 802 | { label: '英文名', value: 'enName' }, |
| 803 | ]; | 803 | ]; |
| 804 | // 当前悬停的行索引 | 804 | // 当前悬停的行索引 | ... | ... |
| ... | @@ -18,16 +18,18 @@ import { | ... | @@ -18,16 +18,18 @@ import { |
| 18 | getTaskExeTreeList, | 18 | getTaskExeTreeList, |
| 19 | getGradeList, | 19 | getGradeList, |
| 20 | getNewDataTypeList, | 20 | getNewDataTypeList, |
| 21 | getDbDirDetail, | ||
| 21 | } from "@/api/modules/dataInventory"; | 22 | } from "@/api/modules/dataInventory"; |
| 22 | import existingTableSelect from "./existingTableSelect.vue"; | 23 | import existingTableSelect from "./existingTableSelect.vue"; |
| 23 | import { ro } from "element-plus/es/locale"; | 24 | import useUserStore from "@/store/modules/user"; |
| 24 | 25 | ||
| 25 | /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ | 26 | /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ |
| 26 | 27 | ||
| 27 | const { proxy } = getCurrentInstance() as any; | 28 | const { proxy } = getCurrentInstance() as any; |
| 28 | const router = useRouter(); | 29 | const router = useRouter(); |
| 29 | const route = useRoute(); | 30 | const route = useRoute(); |
| 30 | const isDimTable = route.query.isDim; | 31 | const fullPath = route.fullPath; |
| 32 | const userStore = useUserStore(); | ||
| 31 | const execGuid: any = ref(route.query.execGuid); | 33 | const execGuid: any = ref(route.query.execGuid); |
| 32 | 34 | ||
| 33 | // 获取数据库列表 | 35 | // 获取数据库列表 |
| ... | @@ -160,8 +162,34 @@ const saveRow = (row) => { | ... | @@ -160,8 +162,34 @@ const saveRow = (row) => { |
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | 164 | ||
| 165 | const editInfoData = ref<any>({ | ||
| 166 | guid: '' | ||
| 167 | }); | ||
| 163 | onMounted(async () => { | 168 | onMounted(async () => { |
| 169 | if (route.query.editOpt && route.query.editOpt === '1') { | ||
| 170 | tableFieldsLoading.value = true; | ||
| 171 | stepsInfo.value.step = 1; | ||
| 172 | getDbDirDetail({ | ||
| 173 | tableGuid: route.query.tableGuid | ||
| 174 | }).then((res: any) => { | ||
| 175 | if (res.code == proxy.$passCode) { | ||
| 176 | editInfoData.value = res.data; | ||
| 177 | tableDataInfo.value = [{ | ||
| 178 | tableName: editInfoData.value.tableName, | ||
| 179 | tableChName: editInfoData.value.tableChName, | ||
| 180 | description: editInfoData.value.description, | ||
| 181 | }]; | ||
| 182 | console.log('tableDataInfo', res.data.fieldRSVOS) | ||
| 183 | tableDataDetailInfo.value = res.data.fieldRSVOS; | ||
| 184 | tableFieldsLoading.value = false; | ||
| 185 | } else { | ||
| 186 | proxy.$ElMessage.error(res.msg); | ||
| 187 | } | ||
| 188 | }) | ||
| 189 | getFieldTree(); | ||
| 190 | } else { | ||
| 164 | await getDbDirDataSourceListData(); | 191 | await getDbDirDataSourceListData(); |
| 192 | } | ||
| 165 | await getFieldTypeData(); | 193 | await getFieldTypeData(); |
| 166 | }); | 194 | }); |
| 167 | 195 | ||
| ... | @@ -345,6 +373,7 @@ const batchDelete = () => { | ... | @@ -345,6 +373,7 @@ const batchDelete = () => { |
| 345 | 373 | ||
| 346 | // 新增一行 | 374 | // 新增一行 |
| 347 | const addRow = () => { | 375 | const addRow = () => { |
| 376 | console.log('新增一行') | ||
| 348 | refGradeGuid.value = ''; | 377 | refGradeGuid.value = ''; |
| 349 | tableDataDetailInfo.value.push({ | 378 | tableDataDetailInfo.value.push({ |
| 350 | id: tableDataDetailInfo.value.length + 1, | 379 | id: tableDataDetailInfo.value.length + 1, |
| ... | @@ -435,53 +464,153 @@ const data = [ | ... | @@ -435,53 +464,153 @@ const data = [ |
| 435 | }, | 464 | }, |
| 436 | ] | 465 | ] |
| 437 | 466 | ||
| 438 | const submitAsDraft = () => { | 467 | const saveBtnDraft = ref(false) |
| 439 | // 保存为草稿,无论有没有guid 都传入guid | 468 | const submitAsDraft = async () => { |
| 440 | saveOrUpdate({ isDraft: 'Y' }, 0) | 469 | // 保存为草稿, |
| 470 | if (!tableDataInfo.value[0].tableName) { | ||
| 471 | proxy.$ElMessage.error('请填写数据库名称'); | ||
| 472 | return; | ||
| 473 | } | ||
| 474 | if (!tableDataInfo.value[0].tableChName) { | ||
| 475 | proxy.$ElMessage.error('请填写数据库表'); | ||
| 476 | return; | ||
| 477 | } | ||
| 478 | saveBtnDraft.value = true | ||
| 479 | if (!editInfoData.value.guid) { | ||
| 480 | try { | ||
| 481 | await saveOrUpdate({ | ||
| 482 | tableName: tableDataInfo.value[0].tableName, | ||
| 483 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 484 | databaseGuid: route.query.databaseGuid || '', | ||
| 485 | database: route.query.database || '', | ||
| 486 | databaseChName: route.query.databaseChName || '', | ||
| 487 | foundMode: route.query.foundMode, | ||
| 488 | isDraft: 'Y', | ||
| 489 | }, 0) | ||
| 490 | saveBtnDraft.value = false | ||
| 491 | } catch (error) { | ||
| 492 | saveBtnDraft.value = false | ||
| 493 | } | ||
| 441 | 494 | ||
| 495 | } else { | ||
| 496 | try { | ||
| 497 | await saveOrUpdate({ | ||
| 498 | guid: editInfoData.value.guid, | ||
| 499 | tableName: tableDataInfo.value[0].tableName, | ||
| 500 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 501 | databaseGuid: editInfoData.value.databaseGuid || '', | ||
| 502 | database: editInfoData.value.database || '', | ||
| 503 | databaseChName: editInfoData.value.databaseChName || '', | ||
| 504 | foundMode: editInfoData.value.foundMode, | ||
| 505 | isDraft: 'Y', | ||
| 506 | tableGuid: route.query.tableGuid, | ||
| 507 | }, 1) | ||
| 508 | saveBtnDraft.value = false | ||
| 509 | } catch (error) { | ||
| 510 | saveBtnDraft.value = false | ||
| 511 | } | ||
| 512 | } | ||
| 442 | } | 513 | } |
| 443 | 514 | ||
| 444 | /** | 515 | |
| 445 | * 需求写一个校验函数,校验表格数据是否填写完整 | 516 | |
| 446 | * 1、表名称、数据库表、为空 | 517 | const checkTableData = (tableDataDetailInfo) => { |
| 447 | * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空 | 518 | let hasPrimary = false; // 是否有主键字段 |
| 448 | */ | 519 | const enNames: any[] = []; // 用于校验英文名称重复 |
| 449 | 520 | const chNames: any[] = []; // 用于校验中文名称重复 | |
| 450 | // const checkTableData = (tableDataInfo, tableDataDetailInfo) => { | 521 | const regex = /^[a-zA-Z]/; // 校验英文名称必须以字母开头 |
| 451 | 522 | let index = 1; // 记录字段序号 | |
| 452 | // const tableDataInfoKeys = ['tableName', 'tableChName'] | 523 | console.log('tableDataInfo', tableDataDetailInfo) |
| 453 | // const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid'] | 524 | if (!tableDataInfo.value[0].tableName) { |
| 454 | // let flag = true | 525 | proxy.$ElMessage.error('请填写数据库名称'); |
| 455 | // tableDataInfo.forEach(item => { | 526 | return; |
| 456 | // tableDataInfoKeys.forEach(key => { | 527 | } |
| 457 | // if (!item[key]) { | 528 | if (!tableDataInfo.value[0].tableChName) { |
| 458 | // flag = false | 529 | proxy.$ElMessage.error('请填写数据库表'); |
| 459 | // proxy.$ElMessage.error('表名称、数据库表不能为空') | 530 | return; |
| 460 | // } | 531 | } |
| 461 | // }) | 532 | // 校验列表数组 |
| 462 | // }) | 533 | for (const field of tableDataDetailInfo) { |
| 463 | // tableDataDetailInfo.forEach(item => { | 534 | // 校验字段英文名称不能为空 |
| 464 | // tableDataDetailInfoKeys.forEach(key => { | 535 | if (!field.fieldName) { |
| 465 | // if (!item[key]) { | 536 | ElMessage.error(`第 ${index} 个字段的英文名称不能为空!`); |
| 466 | // flag = false | 537 | return false; |
| 467 | // proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空') | 538 | } |
| 468 | // } | 539 | |
| 469 | // }) | 540 | // 校验英文名称必须以字母开头 |
| 470 | // }) | 541 | if (!regex.test(field.fieldName)) { |
| 471 | // return flag | 542 | ElMessage.error(`第 ${index} 个字段的英文名称必须以英文字符开头!`); |
| 472 | // } | 543 | return false; |
| 473 | 544 | } | |
| 474 | const guid = ref('') | 545 | |
| 546 | // 校验英文名称不能重复 | ||
| 547 | if (enNames.includes(field.fieldName)) { | ||
| 548 | ElMessage.error(`字段的英文名称 ${field.fieldName} 不能重复!`); | ||
| 549 | return false; | ||
| 550 | } | ||
| 551 | |||
| 552 | // 校验中文名称不能重复 | ||
| 553 | if (chNames.includes(field.fieldChName)) { | ||
| 554 | ElMessage.error(`字段的中文名称 ${field.fieldChName} 不能重复!`); | ||
| 555 | return false; | ||
| 556 | } | ||
| 557 | |||
| 558 | // 校验字段类型和相应属性 | ||
| 559 | if (field.fieldType === 'decimal') { | ||
| 560 | if (field.fieldPrecision == null) { | ||
| 561 | ElMessage.error(`第 ${index} 个字段的字段类型为浮点型时,精度不能为空!`); | ||
| 562 | return false; | ||
| 563 | } | ||
| 564 | if (field.fieldLength == null) { | ||
| 565 | ElMessage.error(`第 ${index} 个字段的字段类型为浮点型时,长度不能为空!`); | ||
| 566 | return false; | ||
| 567 | } | ||
| 568 | } | ||
| 569 | |||
| 570 | if ((field.fieldType === 'varchar' || field.fieldType === 'char') && field.fieldLength == null) { | ||
| 571 | ElMessage.error(`第 ${index} 个字段的字段类型为字符型时,长度不能为空!`); | ||
| 572 | return false; | ||
| 573 | } | ||
| 574 | |||
| 575 | // 校验主键字段 | ||
| 576 | if (field.isPrimary === 'Y') { | ||
| 577 | hasPrimary = true; | ||
| 578 | if (field.isNotNull !== 'Y') { | ||
| 579 | ElMessage.error(`第 ${index} 个字段为主键,应设置为必填!`); | ||
| 580 | return false; | ||
| 581 | } | ||
| 582 | if (['text', 'json', 'bit'].includes(field.fieldType)) { | ||
| 583 | ElMessage.error(`第 ${index} 个字段为主键,字段类型不能设置为 ${field.fieldType} 类型!`); | ||
| 584 | return false; | ||
| 585 | } | ||
| 586 | } | ||
| 587 | // 更新英文和中文名称集合 | ||
| 588 | enNames.push(field.fieldName); | ||
| 589 | chNames.push(field.fieldChName); | ||
| 590 | index++; | ||
| 591 | } | ||
| 592 | |||
| 593 | // 校验是否至少有一个主键字段 | ||
| 594 | if (!hasPrimary) { | ||
| 595 | ElMessage.error(`字段至少有一个主键字段!`); | ||
| 596 | return false; | ||
| 597 | } | ||
| 598 | |||
| 599 | return true; // 校验通过 | ||
| 600 | }; | ||
| 601 | |||
| 602 | |||
| 475 | const saveBtn = ref(false) | 603 | const saveBtn = ref(false) |
| 476 | const submit = async () => { | 604 | const submit = async () => { |
| 477 | console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) | 605 | console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) |
| 478 | saveBtn.value = true | 606 | saveBtn.value = true |
| 479 | // 校验表格数据是否填写完整 | 607 | // 校验表格数据是否填写完整 |
| 480 | // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { | 608 | if (!checkTableData(tableDataDetailInfo.value)) { |
| 481 | // return | 609 | saveBtn.value = false |
| 482 | // } | 610 | return |
| 611 | } | ||
| 483 | // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 | 612 | // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 |
| 484 | if (!guid.value) { | 613 | if (!editInfoData.value.guid) { |
| 485 | try { | 614 | try { |
| 486 | await saveOrUpdate({ | 615 | await saveOrUpdate({ |
| 487 | tableName: tableDataInfo.value[0].tableName, | 616 | tableName: tableDataInfo.value[0].tableName, |
| ... | @@ -500,14 +629,15 @@ const submit = async () => { | ... | @@ -500,14 +629,15 @@ const submit = async () => { |
| 500 | // 修改 saveOrUpdate({}, 1) | 629 | // 修改 saveOrUpdate({}, 1) |
| 501 | try { | 630 | try { |
| 502 | await saveOrUpdate({ | 631 | await saveOrUpdate({ |
| 503 | guid: guid.value, | 632 | guid: editInfoData.value.guid, |
| 504 | tableName: tableDataInfo.value[0].tableName, | 633 | tableName: tableDataInfo.value[0].tableName, |
| 505 | tableChName: tableDataInfo.value[0].tableChName, | 634 | tableChName: tableDataInfo.value[0].tableChName, |
| 506 | databaseGuid: route.query.databaseGuid || '', | 635 | databaseGuid: editInfoData.value.databaseGuid || '', |
| 507 | database: route.query.database || '', | 636 | database: editInfoData.value.database || '', |
| 508 | databaseChName: route.query.databaseChName || '', | 637 | databaseChName: editInfoData.value.databaseChName || '', |
| 509 | foundMode: route.query.foundMode, | 638 | foundMode: editInfoData.value.foundMode, |
| 510 | isDraft: 'N', | 639 | isDraft: 'N', |
| 640 | tableGuid: route.query.tableGuid, | ||
| 511 | }, 1) | 641 | }, 1) |
| 512 | saveBtn.value = false | 642 | saveBtn.value = false |
| 513 | } catch (error) { | 643 | } catch (error) { |
| ... | @@ -519,6 +649,34 @@ const submit = async () => { | ... | @@ -519,6 +649,34 @@ const submit = async () => { |
| 519 | 649 | ||
| 520 | // 单独将保存和修改函数提取出来 type 0 保存 1 修改 2 生成建表语句 | 650 | // 单独将保存和修改函数提取出来 type 0 保存 1 修改 2 生成建表语句 |
| 521 | const saveOrUpdate = async (params: any = {}, type) => { | 651 | const saveOrUpdate = async (params: any = {}, type) => { |
| 652 | // 要对tableDataDetailInfo.value 进行处理,将其转换为后台需要的格式 | ||
| 653 | let TepmTableDataDetailInfo = tableDataDetailInfo.value.map(item => { | ||
| 654 | return { | ||
| 655 | classifyDetailGuid: item.classifyDetailGuid, | ||
| 656 | classifyDetailName: item.classifyDetailName, | ||
| 657 | database: item.database || editInfoData.value.database, | ||
| 658 | databaseChName: item.databaseChName || editInfoData.value.databaseChName, | ||
| 659 | databaseGuid: item.databaseGuid || editInfoData.value.databaseGuid, | ||
| 660 | dictionaryGuid: item.dictionaryGuid, | ||
| 661 | dimGuid: item.dimGuid, | ||
| 662 | fieldChName: item.fieldChName, | ||
| 663 | fieldGuid: item.fieldGuid, | ||
| 664 | fieldLength: item.fieldLength, | ||
| 665 | fieldName: item.fieldName, | ||
| 666 | fieldPrecision: item.fieldPrecision, | ||
| 667 | fieldType: item.fieldType, | ||
| 668 | gradeDetailGuid: item.gradeDetailGuid, | ||
| 669 | gradeDetailName: item.gradeDetailName, | ||
| 670 | guid: item.guid, | ||
| 671 | isFk: item.isFk, | ||
| 672 | isNotNull: item.isNotNull, | ||
| 673 | isPrimary: item.isPrimary, | ||
| 674 | sortValue: item.sortValue, | ||
| 675 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 676 | tableGuid: route.query.tableGuid || '', | ||
| 677 | tableName: tableDataInfo.value[0].tableName, | ||
| 678 | } | ||
| 679 | }) | ||
| 522 | const InParams = { | 680 | const InParams = { |
| 523 | guid: '', | 681 | guid: '', |
| 524 | cgDirName: '', | 682 | cgDirName: '', |
| ... | @@ -531,21 +689,27 @@ const saveOrUpdate = async (params: any = {}, type) => { | ... | @@ -531,21 +689,27 @@ const saveOrUpdate = async (params: any = {}, type) => { |
| 531 | databaseChName: '', | 689 | databaseChName: '', |
| 532 | foundMode: 0, | 690 | foundMode: 0, |
| 533 | isDraft: '', | 691 | isDraft: '', |
| 534 | fieldRQVOList: tableDataDetailInfo.value | 692 | fieldRQVOList: TepmTableDataDetailInfo |
| 535 | } | 693 | } |
| 536 | const finalParams = { ...InParams, ...params } | 694 | const finalParams = { ...InParams, ...params } |
| 537 | // 使用switch case 语句 | 695 | // 使用switch case 语句 |
| 538 | switch (type) { | 696 | switch (type) { |
| 539 | case 0: | 697 | case 0: |
| 540 | // 保存/保存为草稿 | 698 | // 保存/保存为草稿 |
| 699 | saveBtn.value = true | ||
| 541 | const res: any = await saveDbDirTable(finalParams); | 700 | const res: any = await saveDbDirTable(finalParams); |
| 542 | if (res.code === proxy.$passCode) { | 701 | if (res.code === proxy.$passCode) { |
| 543 | if (params.isDraft === 'Y') { | 702 | if (params.isDraft === 'Y') { |
| 544 | proxy.$ElMessage.success('保存为草稿成功!'); | 703 | proxy.$ElMessage.success('保存为草稿成功!'); |
| 704 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); | ||
| 705 | router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); | ||
| 706 | return | ||
| 545 | } | 707 | } |
| 546 | proxy.$ElMessage.success('保存成功!'); | 708 | proxy.$ElMessage.success('保存成功!'); |
| 547 | router.push({ name: 'classifyGradeCatalogue' }); | 709 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); |
| 710 | router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); | ||
| 548 | } else { | 711 | } else { |
| 712 | saveBtn.value = false | ||
| 549 | proxy.$ElMessage.error(res.msg); | 713 | proxy.$ElMessage.error(res.msg); |
| 550 | } | 714 | } |
| 551 | break; | 715 | break; |
| ... | @@ -553,9 +717,11 @@ const saveOrUpdate = async (params: any = {}, type) => { | ... | @@ -553,9 +717,11 @@ const saveOrUpdate = async (params: any = {}, type) => { |
| 553 | // 修改 | 717 | // 修改 |
| 554 | const res1: any = await updateDbDirTable(finalParams); | 718 | const res1: any = await updateDbDirTable(finalParams); |
| 555 | if (res1.code === proxy.$passCode) { | 719 | if (res1.code === proxy.$passCode) { |
| 556 | proxy.$ElMessage.success('修改成功!'); | 720 | proxy.$ElMessage.success('编辑成功!'); |
| 557 | router.push({ name: 'classifyGradeCatalogue' }); | 721 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); |
| 722 | router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); | ||
| 558 | } else { | 723 | } else { |
| 724 | saveBtn.value = false | ||
| 559 | proxy.$ElMessage.error(res1.msg); | 725 | proxy.$ElMessage.error(res1.msg); |
| 560 | } | 726 | } |
| 561 | break; | 727 | break; |
| ... | @@ -672,9 +838,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -672,9 +838,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 672 | <template> | 838 | <template> |
| 673 | <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading"> | 839 | <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading"> |
| 674 | <div class="content_main"> | 840 | <div class="content_main"> |
| 675 | <div class="top_tool_wrap"> | 841 | |
| 842 | <div class="top_tool_wrap" v-if="!(route.query.editOpt && route.query.editOpt === '1')"> | ||
| 676 | <StepBar :steps-info="stepsInfo" /> | 843 | <StepBar :steps-info="stepsInfo" /> |
| 677 | </div> | 844 | </div> |
| 845 | <div class="edit-btn-wrap" v-show="(route.query.editOpt && route.query.editOpt === '1')"> | ||
| 846 | <el-button type="primary" @click="submitAsDraft" :loading="saveBtnDraft">保存为草稿</el-button> | ||
| 847 | <el-button type="primary" @click="submit" :loading="saveBtn">保存</el-button> | ||
| 848 | </div> | ||
| 678 | <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" | 849 | <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" |
| 679 | :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> | 850 | :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> |
| 680 | <div class="second-step-content" v-show="stepsInfo.step === 1"> | 851 | <div class="second-step-content" v-show="stepsInfo.step === 1"> |
| ... | @@ -754,31 +925,31 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -754,31 +925,31 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 754 | </template> | 925 | </template> |
| 755 | </el-table-column> | 926 | </el-table-column> |
| 756 | <!-- 源数据库 --> | 927 | <!-- 源数据库 --> |
| 757 | <el-table-column prop="sourceDatabase" label="源数据库" width="150"> | 928 | <el-table-column prop="databaseChName" label="源数据库" width="150"> |
| 758 | <template #default="scope"> | 929 | <template #default="scope"> |
| 759 | {{ scope.row.sourceDatabase ? scope.row.sourceDatabase : '--' }} | 930 | {{ scope.row.databaseChName ? scope.row.databaseChName : '--' }} |
| 760 | </template> | 931 | </template> |
| 761 | </el-table-column> | 932 | </el-table-column> |
| 762 | <!-- 源数据表 --> | 933 | <!-- 源数据表 --> |
| 763 | <el-table-column prop="sourceTableName" label="源数据表" width="150"> | 934 | <el-table-column prop="tableName" label="源数据表" width="150"> |
| 764 | <template #default="scope"> | 935 | <template #default="scope"> |
| 765 | {{ scope.row.sourceTableName ? scope.row.sourceTableName : '--' }} | 936 | {{ scope.row.tableName ? scope.row.tableName : '--' }} |
| 766 | </template> | 937 | </template> |
| 767 | </el-table-column> | 938 | </el-table-column> |
| 768 | <!-- 源字段中文 --> | 939 | <!-- 源字段中文 --> |
| 769 | <el-table-column prop="sourceFieldChName" label="源字段中文" width="150"> | 940 | <el-table-column prop="fieldChName" label="源字段中文" width="150"> |
| 770 | <template #default="scope"> | 941 | <template #default="scope"> |
| 771 | {{ scope.row.sourceFieldChName ? scope.row.sourceFieldChName : '--' }} | 942 | {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }} |
| 772 | </template> | 943 | </template> |
| 773 | </el-table-column> | 944 | </el-table-column> |
| 774 | <!-- 源字段英文 --> | 945 | <!-- 源字段英文 --> |
| 775 | <el-table-column prop="sourceFieldName" label="源字段英文" width="150"> | 946 | <el-table-column prop="fieldName" label="源字段英文" width="150"> |
| 776 | <template #default="scope"> | 947 | <template #default="scope"> |
| 777 | <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} --> | 948 | <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} --> |
| 778 | 949 | ||
| 779 | <span v-if="!scope.row.isEdit || !editableFields.sourceFieldName">{{ scope.row.sourceFieldName ? | 950 | <span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ? |
| 780 | scope.row.sourceFieldName : '--' }}</span> | 951 | scope.row.fieldName : '--' }}</span> |
| 781 | <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" /> | 952 | <el-input v-else v-model="scope.row.fieldName" placeholder="请输入长度" /> |
| 782 | </template> | 953 | </template> |
| 783 | </el-table-column> | 954 | </el-table-column> |
| 784 | <!-- 源端字段 fieldType fieldTypeProps--> | 955 | <!-- 源端字段 fieldType fieldTypeProps--> |
| ... | @@ -792,7 +963,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -792,7 +963,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 792 | </el-select> | 963 | </el-select> |
| 793 | </div> | 964 | </div> |
| 794 | <div v-else> | 965 | <div v-else> |
| 795 | {{ fieldData.find(item => item.value === scope.row.fieldType)?.label || '--' }} | 966 | {{ fieldData ? fieldData.find(item => item.value === scope.row.fieldType)?.label : '--' }} |
| 796 | </div> | 967 | </div> |
| 797 | </template> | 968 | </template> |
| 798 | </el-table-column> | 969 | </el-table-column> |
| ... | @@ -897,17 +1068,6 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -897,17 +1068,6 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 897 | <!-- 操作列 --> | 1068 | <!-- 操作列 --> |
| 898 | <el-table-column label="操作" width="100" align="center" fixed="right"> | 1069 | <el-table-column label="操作" width="100" align="center" fixed="right"> |
| 899 | <template #default="scope"> | 1070 | <template #default="scope"> |
| 900 | |||
| 901 | <!-- <el-button v-if="!scope.row.isEdit" type="primary" size="small" @click="editRow(scope.row)"> | ||
| 902 | 编辑 | ||
| 903 | </el-button> --> | ||
| 904 | <!-- <el-button v-else type="success" size="small" @click="saveRow(scope.row)"> | ||
| 905 | 保存 | ||
| 906 | </el-button> | ||
| 907 | |||
| 908 | <el-button type="danger" size="small" @click="deleteRow(scope.$index)"> | ||
| 909 | 删除 | ||
| 910 | </el-button> --> | ||
| 911 | <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span> | 1071 | <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span> |
| 912 | <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span> | 1072 | <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span> |
| 913 | <el-divider direction="vertical" /> | 1073 | <el-divider direction="vertical" /> |
| ... | @@ -918,14 +1078,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -918,14 +1078,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 918 | </div> | 1078 | </div> |
| 919 | </div> | 1079 | </div> |
| 920 | </div> | 1080 | </div> |
| 921 | <div class="bottom_tool_wrap"> | 1081 | <div class="bottom_tool_wrap" v-show="!(route.query.editOpt && route.query.editOpt === '1')"> |
| 922 | <template v-if="stepsInfo.step == 0"> | 1082 | <template v-if="stepsInfo.step == 0"> |
| 923 | <el-button type="primary" @click="nextStep">下一步</el-button> | 1083 | <el-button type="primary" @click="nextStep">下一步</el-button> |
| 924 | </template> | 1084 | </template> |
| 925 | <template v-else> | 1085 | <template v-else> |
| 926 | <el-button @click="previousStep">上一步</el-button> | 1086 | <el-button @click="previousStep">上一步</el-button> |
| 927 | <el-button type="primary" @click="submitAsDraft">保存为草稿</el-button> | 1087 | <el-button type="primary" @click="submitAsDraft" :loading="saveBtnDraft">保存为草稿</el-button> |
| 928 | <el-button type="primary" @click="submit" v-loading="saveBtn">提交</el-button> | 1088 | <el-button type="primary" @click="submit" :loading="saveBtn">提交</el-button> |
| 929 | </template> | 1089 | </template> |
| 930 | </div> | 1090 | </div> |
| 931 | <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" /> | 1091 | <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" /> |
| ... | @@ -949,6 +1109,11 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -949,6 +1109,11 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 949 | .content_main { | 1109 | .content_main { |
| 950 | height: calc(100% - 40px); | 1110 | height: calc(100% - 40px); |
| 951 | 1111 | ||
| 1112 | .edit-btn-wrap { | ||
| 1113 | display: flex; | ||
| 1114 | padding: 16px 16px 0 16px; | ||
| 1115 | } | ||
| 1116 | |||
| 952 | .second-step-content { | 1117 | .second-step-content { |
| 953 | height: calc(100% - 80px); | 1118 | height: calc(100% - 80px); |
| 954 | width: 100%; | 1119 | width: 100%; | ... | ... |
| ... | @@ -33,9 +33,10 @@ import { | ... | @@ -33,9 +33,10 @@ import { |
| 33 | getSubjectTableDetail, | 33 | getSubjectTableDetail, |
| 34 | checkSubjectTableData | 34 | checkSubjectTableData |
| 35 | } from "@/api/modules/dataCatalogService"; | 35 | } from "@/api/modules/dataCatalogService"; |
| 36 | import { getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList } from "@/api/modules/dataInventory"; | 36 | import { getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable } from "@/api/modules/dataInventory"; |
| 37 | import { useDefault } from "@/hooks/useDefault"; | 37 | import { useDefault } from "@/hooks/useDefault"; |
| 38 | import uploadExcelFile from "./components/uploadExcelFile.vue"; | 38 | import uploadExcelFile from "./components/uploadExcelFile.vue"; |
| 39 | import { add } from "lodash-es"; | ||
| 39 | 40 | ||
| 40 | const userStore = useUserStore(); | 41 | const userStore = useUserStore(); |
| 41 | const dataCatalogStore = useDataCatalogStore(); | 42 | const dataCatalogStore = useDataCatalogStore(); |
| ... | @@ -63,6 +64,7 @@ const tableCreateInfo: Ref<any> = ref({ | ... | @@ -63,6 +64,7 @@ const tableCreateInfo: Ref<any> = ref({ |
| 63 | { | 64 | { |
| 64 | //数据库表信息。 | 65 | //数据库表信息。 |
| 65 | dataSourceGuid: '', | 66 | dataSourceGuid: '', |
| 67 | databaseChName: route.query.databaseChName, | ||
| 66 | dataServerName: "", | 68 | dataServerName: "", |
| 67 | dataServerChName: "", | 69 | dataServerChName: "", |
| 68 | enName: "", | 70 | enName: "", |
| ... | @@ -161,10 +163,10 @@ const handleClassifyChange = (row, value) => { | ... | @@ -161,10 +163,10 @@ const handleClassifyChange = (row, value) => { |
| 161 | } | 163 | } |
| 162 | }); | 164 | }); |
| 163 | console.log("选中的节点信息:", selectedNode); | 165 | console.log("选中的节点信息:", selectedNode); |
| 164 | row.classifyName = selectedNode.classifyName; // 假设树节点的 `label` 是分类名 | 166 | row.classifyDetailName = selectedNode.classifyName; // 假设树节点的 `label` 是分类名 |
| 165 | } else { | 167 | } else { |
| 166 | console.error("未找到对应的节点"); | 168 | console.error("未找到对应的节点"); |
| 167 | row.classifyName = ""; // 重置分类名 | 169 | row.classifyDetailName = ""; // 重置分类名 |
| 168 | } | 170 | } |
| 169 | }; | 171 | }; |
| 170 | const getTreeNode = (tree, value) => { | 172 | const getTreeNode = (tree, value) => { |
| ... | @@ -211,16 +213,16 @@ const nextStep = () => { | ... | @@ -211,16 +213,16 @@ const nextStep = () => { |
| 211 | tableCreateInfo.value.isSync = 'Y'; | 213 | tableCreateInfo.value.isSync = 'Y'; |
| 212 | } | 214 | } |
| 213 | stepsInfo.value.step = 1; | 215 | stepsInfo.value.step = 1; |
| 214 | getDictionaryList(); | 216 | // getDictionaryList(); |
| 215 | getDimListData(); | 217 | // getDimListData(); |
| 216 | if (!fieldTypes.value.length) { | 218 | if (!fieldTypes.value.length) { |
| 217 | getFieldTypeList(); | 219 | getFieldTypeList(); |
| 218 | getCharacterListData(); | 220 | // getCharacterListData(); |
| 219 | } | 221 | } |
| 220 | if (!databaseList.value.length) { | 222 | if (!databaseList.value.length) { |
| 221 | getDatabaseList(); | 223 | getDatabaseList(); |
| 222 | } | 224 | } |
| 223 | getDomainDetail(subjectDomainGuid.value); | 225 | // getDomainDetail(subjectDomainGuid.value); |
| 224 | if (!tableCreateInfo.value.tableFields.length) { | 226 | if (!tableCreateInfo.value.tableFields.length) { |
| 225 | getSubjectField(); | 227 | getSubjectField(); |
| 226 | } | 228 | } |
| ... | @@ -428,7 +430,7 @@ onActivated(() => { | ... | @@ -428,7 +430,7 @@ onActivated(() => { |
| 428 | document.title = tab.meta.title; | 430 | document.title = tab.meta.title; |
| 429 | } | 431 | } |
| 430 | } | 432 | } |
| 431 | getDomainDetail(subjectDomainGuid.value); | 433 | // getDomainDetail(subjectDomainGuid.value); |
| 432 | } | 434 | } |
| 433 | }); | 435 | }); |
| 434 | 436 | ||
| ... | @@ -461,19 +463,19 @@ watch(() => tableStandardDetail.value, (val) => { | ... | @@ -461,19 +463,19 @@ watch(() => tableStandardDetail.value, (val) => { |
| 461 | }); | 463 | }); |
| 462 | 464 | ||
| 463 | 465 | ||
| 464 | const getDomainDetail = (domainGuid) => { | 466 | // const getDomainDetail = (domainGuid) => { |
| 465 | getSubjectDomainDetail(domainGuid).then((res: any) => { | 467 | // getSubjectDomainDetail(domainGuid).then((res: any) => { |
| 466 | if (res.code == proxy.$passCode) { | 468 | // if (res.code == proxy.$passCode) { |
| 467 | tableStandardGuid.value = res.data.tableStandardGuid || ''; | 469 | // tableStandardGuid.value = res.data.tableStandardGuid || ''; |
| 468 | fieldStandardSetGuids.value = res.data.fieldStandardSetGuids || []; | 470 | // fieldStandardSetGuids.value = res.data.fieldStandardSetGuids || []; |
| 469 | standardSetGuids.value = res.data.fieldStandardSetGuids || []; | 471 | // standardSetGuids.value = res.data.fieldStandardSetGuids || []; |
| 470 | getFieldStandardOptions(fieldStandardSetGuids.value || []); | 472 | // getFieldStandardOptions(fieldStandardSetGuids.value || []); |
| 471 | isOpenStandard.value = res.data.isOpenStandard === 'Y'; | 473 | // isOpenStandard.value = res.data.isOpenStandard === 'Y'; |
| 472 | } else { | 474 | // } else { |
| 473 | ElMessage.error(res.msg); | 475 | // ElMessage.error(res.msg); |
| 474 | } | 476 | // } |
| 475 | }); | 477 | // }); |
| 476 | } | 478 | // } |
| 477 | 479 | ||
| 478 | const getFieldStandardOptions = (guids) => { | 480 | const getFieldStandardOptions = (guids) => { |
| 479 | if (!guids?.length) { | 481 | if (!guids?.length) { |
| ... | @@ -1193,7 +1195,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null | ... | @@ -1193,7 +1195,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null |
| 1193 | } | 1195 | } |
| 1194 | 1196 | ||
| 1195 | /** 保存表 */ | 1197 | /** 保存表 */ |
| 1196 | const saveTable = () => { | 1198 | const saveTable = async () => { |
| 1197 | let tableData = tableCreateInfo.value.tableData[0]; | 1199 | let tableData = tableCreateInfo.value.tableData[0]; |
| 1198 | if (!tableData.chName) { | 1200 | if (!tableData.chName) { |
| 1199 | ElMessage({ | 1201 | ElMessage({ |
| ... | @@ -1359,42 +1361,95 @@ const saveTable = () => { | ... | @@ -1359,42 +1361,95 @@ const saveTable = () => { |
| 1359 | staffGuid: userData.staffGuid | 1361 | staffGuid: userData.staffGuid |
| 1360 | } | 1362 | } |
| 1361 | }) | 1363 | }) |
| 1362 | if (!tableCreateInfo.value.guid) { //添加 | 1364 | console.log(addInfo, '--------------------------------------'); |
| 1363 | fullscreenLoading.value = true; | 1365 | |
| 1364 | saveSubjectTable(addInfo).then((res: any) => { | 1366 | let TepmTableDataDetailInfo = addInfo.subjectFieldAddDTOS.map(item => { |
| 1365 | fullscreenLoading.value = false; | 1367 | return { |
| 1366 | if (res.code == proxy.$passCode) { | 1368 | classifyDetailGuid: item.classifyDetailGuid, |
| 1367 | ElMessage.success('手动新建表保存成功!'); | 1369 | classifyDetailName: item.classifyDetailName, |
| 1368 | router.push({ | 1370 | database: route.query.database, |
| 1369 | name: 'dataWarehouse' | 1371 | databaseChName: route.query.databaseChName, |
| 1370 | }); | 1372 | databaseGuid: route.query.databaseGuid, |
| 1371 | dataCatalogStore.set(subjectDomainGuid.value); | 1373 | dictionaryGuid: item.dictionaryGuid, |
| 1372 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | 1374 | dimGuid: item.dimGuid, |
| 1373 | } else { | 1375 | fieldChName: item.fieldChName, |
| 1374 | ElMessage.error(res.msg); | 1376 | fieldGuid: item.fieldGuid, |
| 1377 | fieldLength: item.fieldLength, | ||
| 1378 | fieldName: item.fieldName, | ||
| 1379 | fieldPrecision: item.fieldPrecision, | ||
| 1380 | fieldType: item.dataType, | ||
| 1381 | gradeDetailGuid: item.gradeDetailGuid, | ||
| 1382 | gradeDetailName: item.gradeDetailName, | ||
| 1383 | guid: item.guid, | ||
| 1384 | isFk: item.isFk, | ||
| 1385 | isNotNull: item.isNotNull, | ||
| 1386 | isPrimary: item.isPrimary, | ||
| 1387 | sortValue: item.sortValue, | ||
| 1388 | tableChName: addInfo.chName, | ||
| 1389 | tableGuid: route.query.tableGuid || '', | ||
| 1390 | tableName: addInfo.enName, | ||
| 1375 | } | 1391 | } |
| 1376 | }); | 1392 | }) |
| 1377 | } else { //更新 | 1393 | const InParams = { |
| 1378 | addInfo.guid = tableCreateInfo.value.guid; | 1394 | guid: '', |
| 1379 | addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; | 1395 | cgDirName: '', |
| 1380 | fullscreenLoading.value = true; | 1396 | dirGuid: '', |
| 1381 | updateSubjectTable(addInfo).then((res: any) => { | 1397 | tableGuid: route.query.tableGuid || '', |
| 1382 | fullscreenLoading.value = false; | 1398 | tableName: addInfo.enName, |
| 1383 | if (res.code == proxy.$passCode) { | 1399 | tableChName: addInfo.chName, |
| 1384 | ElMessage.success('编辑更新成功!'); | 1400 | databaseGuid: route.query.databaseGuid || '', |
| 1385 | router.push({ | 1401 | database: route.query.database || '', |
| 1386 | name: 'dataWarehouse' | 1402 | databaseChName: addInfo.databaseChName, |
| 1387 | }); | 1403 | foundMode: 2, |
| 1388 | dataCatalogStore.set(subjectDomainGuid.value); | 1404 | isDraft: 'N', |
| 1389 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | 1405 | fieldRQVOList: TepmTableDataDetailInfo |
| 1406 | } | ||
| 1407 | console.log(InParams, '--------------------------------------'); | ||
| 1408 | const res: any = await saveDbDirTable(InParams); | ||
| 1409 | if (res.code === proxy.$passCode) { | ||
| 1410 | proxy.$ElMessage.success('保存成功!'); | ||
| 1411 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); | ||
| 1412 | router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); | ||
| 1390 | } else { | 1413 | } else { |
| 1391 | ElMessage.error(res.msg); | 1414 | proxy.$ElMessage.error(res.msg); |
| 1392 | } | ||
| 1393 | }); | ||
| 1394 | } | 1415 | } |
| 1416 | |||
| 1417 | // if (!tableCreateInfo.value.guid) { //添加 | ||
| 1418 | // fullscreenLoading.value = true; | ||
| 1419 | // saveSubjectTable(addInfo).then((res: any) => { | ||
| 1420 | // fullscreenLoading.value = false; | ||
| 1421 | // if (res.code == proxy.$passCode) { | ||
| 1422 | // ElMessage.success('手动新建表保存成功!'); | ||
| 1423 | // router.push({ | ||
| 1424 | // name: 'dataWarehouse' | ||
| 1425 | // }); | ||
| 1426 | // dataCatalogStore.set(subjectDomainGuid.value); | ||
| 1427 | // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | ||
| 1428 | // } else { | ||
| 1429 | // ElMessage.error(res.msg); | ||
| 1430 | // } | ||
| 1431 | // }); | ||
| 1432 | // } else { //更新 | ||
| 1433 | // addInfo.guid = tableCreateInfo.value.guid; | ||
| 1434 | // addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; | ||
| 1435 | // fullscreenLoading.value = true; | ||
| 1436 | // updateSubjectTable(addInfo).then((res: any) => { | ||
| 1437 | // fullscreenLoading.value = false; | ||
| 1438 | // if (res.code == proxy.$passCode) { | ||
| 1439 | // ElMessage.success('编辑更新成功!'); | ||
| 1440 | // router.push({ | ||
| 1441 | // name: 'dataWarehouse' | ||
| 1442 | // }); | ||
| 1443 | // dataCatalogStore.set(subjectDomainGuid.value); | ||
| 1444 | // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | ||
| 1445 | // } else { | ||
| 1446 | // ElMessage.error(res.msg); | ||
| 1447 | // } | ||
| 1448 | // }); | ||
| 1449 | // } | ||
| 1395 | }; | 1450 | }; |
| 1396 | 1451 | ||
| 1397 | const saveDraftTable = () => { | 1452 | const saveDraftTable = async () => { |
| 1398 | let tableData = tableCreateInfo.value.tableData[0]; | 1453 | let tableData = tableCreateInfo.value.tableData[0]; |
| 1399 | if (!tableData.chName) { | 1454 | if (!tableData.chName) { |
| 1400 | ElMessage({ | 1455 | ElMessage({ |
| ... | @@ -1430,39 +1485,90 @@ const saveDraftTable = () => { | ... | @@ -1430,39 +1485,90 @@ const saveDraftTable = () => { |
| 1430 | staffGuid: userData.staffGuid | 1485 | staffGuid: userData.staffGuid |
| 1431 | } | 1486 | } |
| 1432 | }) | 1487 | }) |
| 1433 | if (!tableCreateInfo.value.guid) { //添加 | 1488 | |
| 1434 | fullscreenLoading.value = true; | 1489 | let TepmTableDataDetailInfo = addInfo.subjectFieldAddDTOS.map(item => { |
| 1435 | saveSubjectTableDraft(addInfo).then((res: any) => { | 1490 | return { |
| 1436 | fullscreenLoading.value = false; | 1491 | classifyDetailGuid: item.classifyDetailGuid, |
| 1437 | if (res.code == proxy.$passCode) { | 1492 | classifyDetailName: item.classifyDetailName, |
| 1438 | ElMessage.success('手动新建表保存草稿成功!'); | 1493 | database: route.query.database, |
| 1439 | router.push({ | 1494 | databaseChName: route.query.databaseChName, |
| 1440 | name: 'dataWarehouse' | 1495 | databaseGuid: route.query.databaseGuid, |
| 1441 | }); | 1496 | dictionaryGuid: item.dictionaryGuid, |
| 1442 | dataCatalogStore.set(subjectDomainGuid.value); | 1497 | dimGuid: item.dimGuid, |
| 1443 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | 1498 | fieldChName: item.fieldChName, |
| 1444 | } else { | 1499 | fieldGuid: item.fieldGuid, |
| 1445 | ElMessage.error(res.msg); | 1500 | fieldLength: item.fieldLength, |
| 1501 | fieldName: item.fieldName, | ||
| 1502 | fieldPrecision: item.fieldPrecision, | ||
| 1503 | fieldType: item.dataType, | ||
| 1504 | gradeDetailGuid: item.gradeDetailGuid, | ||
| 1505 | gradeDetailName: item.gradeDetailName, | ||
| 1506 | guid: item.guid, | ||
| 1507 | isFk: item.isFk, | ||
| 1508 | isNotNull: item.isNotNull, | ||
| 1509 | isPrimary: item.isPrimary, | ||
| 1510 | sortValue: item.sortValue, | ||
| 1511 | tableChName: addInfo.chName, | ||
| 1512 | tableGuid: route.query.tableGuid || '', | ||
| 1513 | tableName: addInfo.enName, | ||
| 1446 | } | 1514 | } |
| 1447 | }) | 1515 | }) |
| 1516 | const InParams = { | ||
| 1517 | guid: '', | ||
| 1518 | cgDirName: '', | ||
| 1519 | dirGuid: '', | ||
| 1520 | tableGuid: route.query.tableGuid || '', | ||
| 1521 | tableName: addInfo.enName, | ||
| 1522 | tableChName: addInfo.chName, | ||
| 1523 | databaseGuid: route.query.databaseGuid || '', | ||
| 1524 | database: route.query.database || '', | ||
| 1525 | databaseChName: addInfo.databaseChName, | ||
| 1526 | foundMode: 2, | ||
| 1527 | isDraft: 'Y', | ||
| 1528 | fieldRQVOList: TepmTableDataDetailInfo | ||
| 1529 | } | ||
| 1530 | console.log(InParams, '--------------------------------------'); | ||
| 1531 | const res: any = await saveDbDirTable(InParams); | ||
| 1532 | if (res.code === proxy.$passCode) { | ||
| 1533 | proxy.$ElMessage.success('保存草稿成功!'); | ||
| 1534 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); | ||
| 1535 | router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } }); | ||
| 1448 | } else { | 1536 | } else { |
| 1449 | addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; | 1537 | proxy.$ElMessage.error(res.msg); |
| 1450 | addInfo.guid = tableCreateInfo.value.guid; | 1538 | } |
| 1451 | fullscreenLoading.value = true; | 1539 | // if (!tableCreateInfo.value.guid) { //添加 |
| 1452 | updateSubjectTableDraft(addInfo).then((res: any) => { | 1540 | // fullscreenLoading.value = true; |
| 1453 | fullscreenLoading.value = false; | 1541 | // saveSubjectTableDraft(addInfo).then((res: any) => { |
| 1454 | if (res.code == proxy.$passCode) { | 1542 | // fullscreenLoading.value = false; |
| 1455 | ElMessage.success('编辑保存草稿成功!'); | 1543 | // if (res.code == proxy.$passCode) { |
| 1456 | router.push({ | 1544 | // ElMessage.success('手动新建表保存草稿成功!'); |
| 1457 | name: 'dataWarehouse' | 1545 | // router.push({ |
| 1458 | }); | 1546 | // name: 'dataWarehouse' |
| 1459 | dataCatalogStore.set(subjectDomainGuid.value); | 1547 | // }); |
| 1460 | userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | 1548 | // dataCatalogStore.set(subjectDomainGuid.value); |
| 1461 | } else { | 1549 | // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); |
| 1462 | ElMessage.error(res.msg); | 1550 | // } else { |
| 1463 | } | 1551 | // ElMessage.error(res.msg); |
| 1464 | }); | 1552 | // } |
| 1465 | } | 1553 | // }) |
| 1554 | // } else { | ||
| 1555 | // addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; | ||
| 1556 | // addInfo.guid = tableCreateInfo.value.guid; | ||
| 1557 | // fullscreenLoading.value = true; | ||
| 1558 | // updateSubjectTableDraft(addInfo).then((res: any) => { | ||
| 1559 | // fullscreenLoading.value = false; | ||
| 1560 | // if (res.code == proxy.$passCode) { | ||
| 1561 | // ElMessage.success('编辑保存草稿成功!'); | ||
| 1562 | // router.push({ | ||
| 1563 | // name: 'dataWarehouse' | ||
| 1564 | // }); | ||
| 1565 | // dataCatalogStore.set(subjectDomainGuid.value); | ||
| 1566 | // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); | ||
| 1567 | // } else { | ||
| 1568 | // ElMessage.error(res.msg); | ||
| 1569 | // } | ||
| 1570 | // }); | ||
| 1571 | // } | ||
| 1466 | }; | 1572 | }; |
| 1467 | 1573 | ||
| 1468 | const batchAddDialogBtnClick = (btn, info) => { | 1574 | const batchAddDialogBtnClick = (btn, info) => { |
| ... | @@ -1541,17 +1647,18 @@ const tableSelectFields = computed(() => { | ... | @@ -1541,17 +1647,18 @@ const tableSelectFields = computed(() => { |
| 1541 | height: 'auto', | 1647 | height: 'auto', |
| 1542 | display: 'inline-block', | 1648 | display: 'inline-block', |
| 1543 | }"> | 1649 | }"> |
| 1544 | <el-table-column prop="dataSourceGuid" label="数据源" width="200px" align="left" show-overflow-tooltip> | 1650 | <el-table-column prop="databaseChName" label="数据源" width="200px" align="left" show-overflow-tooltip> |
| 1545 | <template #header> | 1651 | <template #header> |
| 1546 | <span>数据源</span> | 1652 | <span>数据源</span> |
| 1547 | <span style="color:red;margin-left: 2px;">*</span> | 1653 | <span style="color:red;margin-left: 2px;">*</span> |
| 1548 | </template> | 1654 | </template> |
| 1549 | <template #default="scope"> | 1655 | <template #default="scope"> |
| 1550 | <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate" | 1656 | <!-- <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate" |
| 1551 | @change="(val) => selectDatabaseChange(val)" clearable filterable> | 1657 | @change="(val) => selectDatabaseChange(val)" clearable filterable> |
| 1552 | <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']" | 1658 | <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']" |
| 1553 | :value="opt['guid']" /> | 1659 | :value="opt['guid']" /> |
| 1554 | </el-select> | 1660 | </el-select> --> |
| 1661 | <el-input v-model.trim="scope.row['databaseChName']" :disabled="true" /> | ||
| 1555 | </template> | 1662 | </template> |
| 1556 | </el-table-column> | 1663 | </el-table-column> |
| 1557 | <el-table-column prop="enName" label="数据库表" width="200px" align="left" show-overflow-tooltip> | 1664 | <el-table-column prop="enName" label="数据库表" width="200px" align="left" show-overflow-tooltip> |
| ... | @@ -1654,12 +1761,12 @@ const tableSelectFields = computed(() => { | ... | @@ -1654,12 +1761,12 @@ const tableSelectFields = computed(() => { |
| 1654 | <el-input v-model.trim="scope.row['description']" /> | 1761 | <el-input v-model.trim="scope.row['description']" /> |
| 1655 | </template> | 1762 | </template> |
| 1656 | </el-table-column> | 1763 | </el-table-column> |
| 1657 | <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip> | 1764 | <!-- <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip> |
| 1658 | <template #default="scope"> | 1765 | <template #default="scope"> |
| 1659 | <span class="text_btn" :class="{ 'is-disabled': tableCreateInfo.isCreate }" @click="handleClickExpand()" | 1766 | <span class="text_btn" :class="{ 'is-disabled': tableCreateInfo.isCreate }" @click="handleClickExpand()" |
| 1660 | v-preReClick>扩展属性</span> | 1767 | v-preReClick>扩展属性</span> |
| 1661 | </template> | 1768 | </template> |
| 1662 | </el-table-column> | 1769 | </el-table-column> --> |
| 1663 | </el-table> | 1770 | </el-table> |
| 1664 | <div class="tools_btns"> | 1771 | <div class="tools_btns"> |
| 1665 | <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="batchAddFields" | 1772 | <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="batchAddFields" |
| ... | @@ -1734,7 +1841,7 @@ const tableSelectFields = computed(() => { | ... | @@ -1734,7 +1841,7 @@ const tableSelectFields = computed(() => { |
| 1734 | <el-option v-for="opt in fieldTypes" :key="opt['value']" :label="opt['label']" | 1841 | <el-option v-for="opt in fieldTypes" :key="opt['value']" :label="opt['label']" |
| 1735 | :value="opt['value']" /> | 1842 | :value="opt['value']" /> |
| 1736 | </el-select> | 1843 | </el-select> |
| 1737 | <span v-else>{{ fieldTypes.find(f => f.paramValue === scope.row["dataType"])?.paramName || "--" | 1844 | <span v-else>{{ fieldTypes.find(f => f.value === scope.row["dataType"])?.label || "--" |
| 1738 | }}</span> | 1845 | }}</span> |
| 1739 | </template> | 1846 | </template> |
| 1740 | </el-table-column> | 1847 | </el-table-column> |
| ... | @@ -1816,7 +1923,7 @@ const tableSelectFields = computed(() => { | ... | @@ -1816,7 +1923,7 @@ const tableSelectFields = computed(() => { |
| 1816 | </el-tree-select> | 1923 | </el-tree-select> |
| 1817 | </div> | 1924 | </div> |
| 1818 | <!-- 显示treeSelectOptions 中classifyDetailGuid所在item的classifyName--> | 1925 | <!-- 显示treeSelectOptions 中classifyDetailGuid所在item的classifyName--> |
| 1819 | <div v-else>{{ scope.row.classifyName || '--' }}</div> | 1926 | <div v-else>{{ scope.row.classifyDetailName || '--' }}</div> |
| 1820 | </template> | 1927 | </template> |
| 1821 | </el-table-column> | 1928 | </el-table-column> |
| 1822 | 1929 | ||
| ... | @@ -1862,8 +1969,8 @@ const tableSelectFields = computed(() => { | ... | @@ -1862,8 +1969,8 @@ const tableSelectFields = computed(() => { |
| 1862 | <el-button type="primary" @click="nextStep">下一步</el-button> | 1969 | <el-button type="primary" @click="nextStep">下一步</el-button> |
| 1863 | </template> | 1970 | </template> |
| 1864 | <template v-else> | 1971 | <template v-else> |
| 1865 | <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length" | 1972 | <!-- <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length" |
| 1866 | false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> | 1973 | false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> --> |
| 1867 | <el-button @click="previousStep">上一步</el-button> | 1974 | <el-button @click="previousStep">上一步</el-button> |
| 1868 | <el-button type="primary" @click="saveDraftTable">保存为草稿</el-button> | 1975 | <el-button type="primary" @click="saveDraftTable">保存为草稿</el-button> |
| 1869 | <el-button type="primary" @click="saveTable">提交</el-button> | 1976 | <el-button type="primary" @click="saveTable">提交</el-button> | ... | ... |
-
Please register or sign in to post a comment