Merge branch 'dev_20241202_xukangle' into develop
Showing
5 changed files
with
275 additions
and
154 deletions
| ... | @@ -130,7 +130,7 @@ export const getTenantAttach = (params) => request({ | ... | @@ -130,7 +130,7 @@ export const getTenantAttach = (params) => request({ |
| 130 | 130 | ||
| 131 | /** 获取cron表达式最近五次执行时间 */ | 131 | /** 获取cron表达式最近五次执行时间 */ |
| 132 | export const getCronExecTime = (cronExpress) => request({ | 132 | export const getCronExecTime = (cronExpress) => request({ |
| 133 | url: `${import.meta.env.VITE_APP_API_BASEURL}/common/get-recently-time?cronExpress=${cronExpress}`, | 133 | url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/common/get-recently-time?cronExpress=${cronExpress}`, |
| 134 | method: 'get' | 134 | method: 'get' |
| 135 | }) | 135 | }) |
| 136 | 136 | ... | ... |
| ... | @@ -31,6 +31,7 @@ import { TableColumnWidth } from "@/utils/enum"; | ... | @@ -31,6 +31,7 @@ import { TableColumnWidth } from "@/utils/enum"; |
| 31 | import router from "@/router"; | 31 | import router from "@/router"; |
| 32 | import { download } from "@/utils/common"; | 32 | import { download } from "@/utils/common"; |
| 33 | import { getLabelList } from "@/api/modules/dataLabel"; | 33 | import { getLabelList } from "@/api/modules/dataLabel"; |
| 34 | import { de } from "element-plus/es/locale"; | ||
| 34 | 35 | ||
| 35 | const currentPath = ref<string[]>([]); | 36 | const currentPath = ref<string[]>([]); |
| 36 | const currentDatabasePath = ref<string[]>([]); | 37 | const currentDatabasePath = ref<string[]>([]); |
| ... | @@ -531,7 +532,7 @@ const dataBaseTableInfo = ref({ | ... | @@ -531,7 +532,7 @@ const dataBaseTableInfo = ref({ |
| 531 | }, | 532 | }, |
| 532 | { | 533 | { |
| 533 | label: "编辑表结构", value: "edit", click: (scope) => { | 534 | label: "编辑表结构", value: "edit", click: (scope) => { |
| 534 | console.log('复制', scope); | 535 | console.log('编辑表结构', scope); |
| 535 | // foundMode 1 已有表新建 2 根据文件新建 | 536 | // foundMode 1 已有表新建 2 根据文件新建 |
| 536 | if (scope.row.foundMode === 1) { | 537 | if (scope.row.foundMode === 1) { |
| 537 | // 已有表新建编辑 editOpt 代表时编辑 | 538 | // 已有表新建编辑 editOpt 代表时编辑 | ... | ... |
| ... | @@ -156,13 +156,15 @@ const batchDelete = () => { | ... | @@ -156,13 +156,15 @@ const batchDelete = () => { |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | // 暂存编辑的行数据 | 158 | // 暂存编辑的行数据 |
| 159 | const tempRowData = ref<any>(); | 159 | const tempRowData = ref<any>([]); |
| 160 | 160 | ||
| 161 | // 编辑行 | 161 | // 编辑行 |
| 162 | const editRow = (row) => { | 162 | const editRow = (row) => { |
| 163 | console.log('编辑:', row); | 163 | console.log('编辑:', row); |
| 164 | // 暂存编辑前的数据 | 164 | // 暂存编辑前的数据 用于取消编辑时恢复原始数据,先判断是否已经暂存过tempRowData通过fieldGuid |
| 165 | tempRowData.value = { ...row }; | 165 | if (!tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid)) { |
| 166 | tempRowData.value.push({ ...row }); | ||
| 167 | } | ||
| 166 | if (row.fieldLengthCondition) { | 168 | if (row.fieldLengthCondition) { |
| 167 | const arr = row.fieldLengthCondition.split('#') | 169 | const arr = row.fieldLengthCondition.split('#') |
| 168 | row.lengthSymbol = arr[0] | 170 | row.lengthSymbol = arr[0] |
| ... | @@ -280,13 +282,13 @@ const saveData = async () => { | ... | @@ -280,13 +282,13 @@ const saveData = async () => { |
| 280 | fieldPrecision: item.fieldPrecision, | 282 | fieldPrecision: item.fieldPrecision, |
| 281 | dictionaryGuid: item.dictionaryGuid, | 283 | dictionaryGuid: item.dictionaryGuid, |
| 282 | isUnique: item.isUnique, | 284 | isUnique: item.isUnique, |
| 283 | isNotNull: item.isRequired, | 285 | notNull: item.notNull, |
| 284 | fieldValueRange: item.fieldValueRange | 286 | fieldValueRange: item.fieldValueRange |
| 285 | } | 287 | } |
| 286 | inParams.push(obj) | 288 | inParams.push(obj) |
| 287 | }) | 289 | }) |
| 288 | 290 | ||
| 289 | console.log('finalParams', inParams) | 291 | // console.log('finalParams', inParams) |
| 290 | const res: any = await saveBizRuleConfig(inParams) | 292 | const res: any = await saveBizRuleConfig(inParams) |
| 291 | if (res.code === proxy.$passCode) { | 293 | if (res.code === proxy.$passCode) { |
| 292 | loading.value = false | 294 | loading.value = false |
| ... | @@ -316,8 +318,9 @@ const cancel = () => { | ... | @@ -316,8 +318,9 @@ const cancel = () => { |
| 316 | // 点击取消 | 318 | // 点击取消 |
| 317 | const cancelEdit = (row) => { | 319 | const cancelEdit = (row) => { |
| 318 | console.log('取消编辑:', row); | 320 | console.log('取消编辑:', row); |
| 319 | // 可在此恢复原始数据逻辑,如果需要 | 321 | // 可在此恢复原始数据逻辑,要查找暂存的数据 tempRowData 中 fieldGuid 与当前行的 fieldGuid 相同的数据 |
| 320 | Object.assign(row, tempRowData.value); | 322 | const tempRow = tempRowData.value.find((item) => item.fieldGuid === row.fieldGuid); |
| 323 | Object.assign(row, tempRow); | ||
| 321 | 324 | ||
| 322 | row.isEdit = false; // 退出编辑状态 | 325 | row.isEdit = false; // 退出编辑状态 |
| 323 | } | 326 | } | ... | ... |
| ... | @@ -22,6 +22,7 @@ import { | ... | @@ -22,6 +22,7 @@ import { |
| 22 | import existingTableSelect from "./existingTableSelect.vue"; | 22 | import existingTableSelect from "./existingTableSelect.vue"; |
| 23 | import useUserStore from "@/store/modules/user"; | 23 | import useUserStore from "@/store/modules/user"; |
| 24 | 24 | ||
| 25 | |||
| 25 | /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ | 26 | /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ |
| 26 | 27 | ||
| 27 | const { proxy } = getCurrentInstance() as any; | 28 | const { proxy } = getCurrentInstance() as any; |
| ... | @@ -142,6 +143,7 @@ const editRow = (row) => { | ... | @@ -142,6 +143,7 @@ const editRow = (row) => { |
| 142 | if (refGradeGuid.value) { | 143 | if (refGradeGuid.value) { |
| 143 | getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { | 144 | getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { |
| 144 | if (res.code === proxy.$passCode) { | 145 | if (res.code === proxy.$passCode) { |
| 146 | gradeInfo.value = res.data.records || []; | ||
| 145 | row.gradeOptions = res.data.records || []; | 147 | row.gradeOptions = res.data.records || []; |
| 146 | } else { | 148 | } else { |
| 147 | ElMessage.error(res.msg); | 149 | ElMessage.error(res.msg); |
| ... | @@ -153,8 +155,9 @@ const editRow = (row) => { | ... | @@ -153,8 +155,9 @@ const editRow = (row) => { |
| 153 | row.isEdit = true | 155 | row.isEdit = true |
| 154 | } | 156 | } |
| 155 | 157 | ||
| 158 | |||
| 159 | |||
| 156 | const handleGradeChange = (row) => { | 160 | const handleGradeChange = (row) => { |
| 157 | console.log('分级改变', row) | ||
| 158 | const gradeOptions = row.gradeOptions || []; | 161 | const gradeOptions = row.gradeOptions || []; |
| 159 | const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid); | 162 | const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid); |
| 160 | if (matchedItem) { | 163 | if (matchedItem) { |
| ... | @@ -266,29 +269,59 @@ const getNextTableInfo = async (params) => { | ... | @@ -266,29 +269,59 @@ const getNextTableInfo = async (params) => { |
| 266 | } | 269 | } |
| 267 | }; | 270 | }; |
| 268 | 271 | ||
| 269 | 272 | // 查找目标节点的路径 | |
| 270 | 273 | const findDDatabasePath = (data: any[], targetGuid: string, path: string[] = [], route: string[] = []) => { | |
| 271 | const handleClassifyChange = (row, value) => { | 274 | for (const item of data) { |
| 272 | console.log('分类改变', row, value) | 275 | path.push(item.classifyName); // 添加当前节点名称 |
| 273 | if (!row.classifyDetailGuid) { | 276 | route.push(item.classifyDetailGuid); |
| 274 | row.gradeGuid = null; | 277 | if (item.classifyDetailGuid === targetGuid) { |
| 275 | row.gradeOptions = []; | 278 | return { |
| 276 | return; | 279 | path, |
| 280 | route | ||
| 281 | }; // 找到目标节点,返回路径 | ||
| 282 | } | ||
| 283 | if (item.children && item.children.length > 0) { | ||
| 284 | const result = findDDatabasePath(item.children, targetGuid, path, route); | ||
| 285 | if (result) return result; // 子节点找到目标节点,返回路径 | ||
| 286 | } | ||
| 287 | path.pop(); // 回溯,移除当前节点 | ||
| 288 | route.pop(); | ||
| 277 | } | 289 | } |
| 290 | return null; // 未找到目标节点 | ||
| 291 | }; | ||
| 278 | 292 | ||
| 279 | refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid); | 293 | // 存储分级数据 |
| 280 | console.log('refGradeGuid', refGradeGuid.value) | 294 | const gradeInfo = ref<any>(); |
| 281 | row.classifyDetailName = refGradeGuid.value.classifyName; | 295 | const handleClassifyChange = (row, value) => { |
| 282 | getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { | 296 | const pathInfo = findDDatabasePath(treeSelectOptions.value, value) |
| 283 | if (res.code === proxy.$passCode) { | 297 | row.classifyDetailNameRoutes = pathInfo.path; |
| 284 | row.gradeOptions = res.data.records || []; | 298 | row.classifyDetailGuidRoutes = pathInfo.route; |
| 285 | } else { | 299 | // if (!row.classifyDetailGuid) { |
| 286 | ElMessage.error(res.msg); | 300 | // row.gradeGuid = null; |
| 287 | } | 301 | // row.gradeOptions = []; |
| 288 | }); | 302 | // return; |
| 303 | // } | ||
| 289 | 304 | ||
| 305 | // refGradeGuid.value = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid); | ||
| 306 | // row.classifyDetailName = refGradeGuid.value.classifyName; | ||
| 307 | // getGradeList({ classifyGradeGuid: refGradeGuid.value.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { | ||
| 308 | // if (res.code === proxy.$passCode) { | ||
| 309 | // row.gradeOptions = res.data.records || []; | ||
| 310 | // } else { | ||
| 311 | // ElMessage.error(res.msg); | ||
| 312 | // } | ||
| 313 | // }); | ||
| 290 | }; | 314 | }; |
| 291 | 315 | ||
| 316 | const handleNodeClick = (row, node, data) => { | ||
| 317 | // 在gradeInfo找到item.guid === row.gradeGuid | ||
| 318 | const matchedItem = gradeInfo.value.find((item) => item.guid === node.gradeGuid); | ||
| 319 | if (matchedItem) { | ||
| 320 | row.gradeDetailGuid = matchedItem.guid; | ||
| 321 | row.gradeDetailName = matchedItem.name; | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 292 | const isPrevious = ref(false); | 325 | const isPrevious = ref(false); |
| 293 | /** 上一步 */ | 326 | /** 上一步 */ |
| 294 | const previousStep = () => { | 327 | const previousStep = () => { |
| ... | @@ -320,7 +353,7 @@ const editableFields = { | ... | @@ -320,7 +353,7 @@ const editableFields = { |
| 320 | classifyDetailGuid: true, // 分类可编辑 | 353 | classifyDetailGuid: true, // 分类可编辑 |
| 321 | fieldType: true, // 字段类型可编辑 | 354 | fieldType: true, // 字段类型可编辑 |
| 322 | fieldChName: true, // 字段中文名可编辑 | 355 | fieldChName: true, // 字段中文名可编辑 |
| 323 | sourceFieldChName: true, // 源字段中文名可编辑 | 356 | |
| 324 | } | 357 | } |
| 325 | 358 | ||
| 326 | const tableFieldsLoading = ref(false) | 359 | const tableFieldsLoading = ref(false) |
| ... | @@ -401,18 +434,29 @@ const addRow = () => { | ... | @@ -401,18 +434,29 @@ const addRow = () => { |
| 401 | tableDataDetailInfo.value.push({ | 434 | tableDataDetailInfo.value.push({ |
| 402 | id: tableDataDetailInfo.value.length + 1, | 435 | id: tableDataDetailInfo.value.length + 1, |
| 403 | fieldName: '', | 436 | fieldName: '', |
| 404 | fieldEnglish: '', | 437 | fieldChName: '', |
| 405 | fieldType: '', | 438 | fieldType: '', |
| 406 | length: '', | ||
| 407 | fieldPrecision: '', | 439 | fieldPrecision: '', |
| 408 | isUnique: '', | 440 | isUnique: '', |
| 409 | isRequired: '', | ||
| 410 | fieldValueRange: '', | 441 | fieldValueRange: '', |
| 411 | dictionaryGuid: '', | 442 | dictionaryGuid: '', |
| 412 | isEdit: true, | 443 | isEdit: true, |
| 413 | gradeOptions: [], | 444 | gradeOptions: [], |
| 445 | sourceDatabase: '', | ||
| 446 | sourceTableName: '', | ||
| 447 | sourceFieldName: '', | ||
| 448 | sourceFieldChName: '', | ||
| 449 | fieldLength: '', | ||
| 450 | isPrimary: '', | ||
| 451 | notNull: '', | ||
| 452 | isFk: '', | ||
| 453 | classifyDetailGuid: '', | ||
| 414 | classifyDetailName: '', | 454 | classifyDetailName: '', |
| 455 | gradeDetailGuid: '', | ||
| 415 | gradeDetailName: '', | 456 | gradeDetailName: '', |
| 457 | classifyDetailNameRoutes: [], | ||
| 458 | classifyDetailGuidRoutes: [], | ||
| 459 | |||
| 416 | }) | 460 | }) |
| 417 | } | 461 | } |
| 418 | 462 | ||
| ... | @@ -502,8 +546,6 @@ const submitAsDraft = async () => { | ... | @@ -502,8 +546,6 @@ const submitAsDraft = async () => { |
| 502 | if (!editInfoData.value.guid) { | 546 | if (!editInfoData.value.guid) { |
| 503 | try { | 547 | try { |
| 504 | await saveOrUpdate({ | 548 | await saveOrUpdate({ |
| 505 | tableName: tableDataInfo.value[0].tableName, | ||
| 506 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 507 | databaseGuid: route.query.databaseGuid || '', | 549 | databaseGuid: route.query.databaseGuid || '', |
| 508 | database: route.query.database || '', | 550 | database: route.query.database || '', |
| 509 | databaseChName: route.query.databaseChName || '', | 551 | databaseChName: route.query.databaseChName || '', |
| ... | @@ -519,8 +561,6 @@ const submitAsDraft = async () => { | ... | @@ -519,8 +561,6 @@ const submitAsDraft = async () => { |
| 519 | try { | 561 | try { |
| 520 | await saveOrUpdate({ | 562 | await saveOrUpdate({ |
| 521 | guid: editInfoData.value.guid, | 563 | guid: editInfoData.value.guid, |
| 522 | tableName: tableDataInfo.value[0].tableName, | ||
| 523 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 524 | databaseGuid: editInfoData.value.databaseGuid || '', | 564 | databaseGuid: editInfoData.value.databaseGuid || '', |
| 525 | database: editInfoData.value.database || '', | 565 | database: editInfoData.value.database || '', |
| 526 | databaseChName: editInfoData.value.databaseChName || '', | 566 | databaseChName: editInfoData.value.databaseChName || '', |
| ... | @@ -598,7 +638,7 @@ const checkTableData = (tableDataDetailInfo) => { | ... | @@ -598,7 +638,7 @@ const checkTableData = (tableDataDetailInfo) => { |
| 598 | // 校验主键字段 | 638 | // 校验主键字段 |
| 599 | if (field.isPrimary === 'Y') { | 639 | if (field.isPrimary === 'Y') { |
| 600 | hasPrimary = true; | 640 | hasPrimary = true; |
| 601 | if (field.isNotNull !== 'Y') { | 641 | if (field.notNull !== 'Y') { |
| 602 | ElMessage.error(`第 ${index} 个字段为主键,应设置为必填!`); | 642 | ElMessage.error(`第 ${index} 个字段为主键,应设置为必填!`); |
| 603 | return false; | 643 | return false; |
| 604 | } | 644 | } |
| ... | @@ -625,48 +665,43 @@ const checkTableData = (tableDataDetailInfo) => { | ... | @@ -625,48 +665,43 @@ const checkTableData = (tableDataDetailInfo) => { |
| 625 | 665 | ||
| 626 | const saveBtn = ref(false) | 666 | const saveBtn = ref(false) |
| 627 | const submit = async () => { | 667 | const submit = async () => { |
| 628 | console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) | ||
| 629 | saveBtn.value = true | 668 | saveBtn.value = true |
| 630 | // 校验表格数据是否填写完整 | 669 | // 校验表格数据是否填写完整 |
| 631 | // if (!checkTableData(tableDataDetailInfo.value)) { | 670 | if (!checkTableData(tableDataDetailInfo.value)) { |
| 632 | // saveBtn.value = false | 671 | saveBtn.value = false |
| 633 | // return | 672 | return |
| 634 | // } | 673 | } |
| 635 | // // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 | 674 | // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 |
| 636 | // if (!editInfoData.value.guid) { | 675 | if (!editInfoData.value.guid) { |
| 637 | // try { | 676 | try { |
| 638 | // await saveOrUpdate({ | 677 | await saveOrUpdate({ |
| 639 | // tableName: tableDataInfo.value[0].tableName, | 678 | databaseGuid: route.query.databaseGuid || '', |
| 640 | // tableChName: tableDataInfo.value[0].tableChName, | 679 | database: route.query.database || '', |
| 641 | // databaseGuid: route.query.databaseGuid || '', | 680 | databaseChName: route.query.databaseChName || '', |
| 642 | // database: route.query.database || '', | 681 | foundMode: route.query.foundMode, |
| 643 | // databaseChName: route.query.databaseChName || '', | 682 | isDraft: 'N', |
| 644 | // foundMode: route.query.foundMode, | 683 | }, 0) |
| 645 | // isDraft: 'N', | 684 | saveBtn.value = false |
| 646 | // }, 0) | 685 | } catch (error) { |
| 647 | // saveBtn.value = false | 686 | saveBtn.value = false |
| 648 | // } catch (error) { | 687 | } |
| 649 | // saveBtn.value = false | 688 | } else { |
| 650 | // } | 689 | // 修改 saveOrUpdate({}, 1) |
| 651 | // } else { | 690 | try { |
| 652 | // // 修改 saveOrUpdate({}, 1) | 691 | await saveOrUpdate({ |
| 653 | // try { | 692 | guid: editInfoData.value.guid, |
| 654 | // await saveOrUpdate({ | 693 | databaseGuid: editInfoData.value.databaseGuid || '', |
| 655 | // guid: editInfoData.value.guid, | 694 | database: editInfoData.value.database || '', |
| 656 | // tableName: tableDataInfo.value[0].tableName, | 695 | databaseChName: editInfoData.value.databaseChName || '', |
| 657 | // tableChName: tableDataInfo.value[0].tableChName, | 696 | foundMode: editInfoData.value.foundMode, |
| 658 | // databaseGuid: editInfoData.value.databaseGuid || '', | 697 | isDraft: 'N', |
| 659 | // database: editInfoData.value.database || '', | 698 | tableGuid: route.query.tableGuid, |
| 660 | // databaseChName: editInfoData.value.databaseChName || '', | 699 | }, 1) |
| 661 | // foundMode: editInfoData.value.foundMode, | 700 | saveBtn.value = false |
| 662 | // isDraft: 'N', | 701 | } catch (error) { |
| 663 | // tableGuid: route.query.tableGuid, | 702 | saveBtn.value = false |
| 664 | // }, 1) | 703 | } |
| 665 | // saveBtn.value = false | 704 | } |
| 666 | // } catch (error) { | ||
| 667 | // saveBtn.value = false | ||
| 668 | // } | ||
| 669 | // } | ||
| 670 | 705 | ||
| 671 | } | 706 | } |
| 672 | 707 | ||
| ... | @@ -675,29 +710,29 @@ const saveOrUpdate = async (params: any = {}, type) => { | ... | @@ -675,29 +710,29 @@ const saveOrUpdate = async (params: any = {}, type) => { |
| 675 | // 要对tableDataDetailInfo.value 进行处理,将其转换为后台需要的格式 | 710 | // 要对tableDataDetailInfo.value 进行处理,将其转换为后台需要的格式 |
| 676 | let TepmTableDataDetailInfo = tableDataDetailInfo.value.map(item => { | 711 | let TepmTableDataDetailInfo = tableDataDetailInfo.value.map(item => { |
| 677 | return { | 712 | return { |
| 678 | classifyDetailGuid: item.classifyDetailGuid, | 713 | guid: item.guid, |
| 679 | classifyDetailName: item.classifyDetailName, | 714 | sourceTableName: item.sourceTableName, |
| 680 | database: item.database || editInfoData.value.database, | 715 | sourceDatabase: item.sourceDatabase, |
| 681 | databaseChName: item.databaseChName || editInfoData.value.databaseChName, | 716 | sourceFieldName: item.sourceFieldName, |
| 682 | databaseGuid: item.databaseGuid || editInfoData.value.databaseGuid, | 717 | sourceFieldChName: item.sourceFieldChName, |
| 683 | dictionaryGuid: item.dictionaryGuid, | ||
| 684 | dimGuid: item.dimGuid, | ||
| 685 | fieldChName: item.fieldChName, | ||
| 686 | fieldGuid: item.fieldGuid, | 718 | fieldGuid: item.fieldGuid, |
| 687 | fieldLength: item.fieldLength, | ||
| 688 | fieldName: item.fieldName, | 719 | fieldName: item.fieldName, |
| 689 | fieldPrecision: item.fieldPrecision, | 720 | fieldChName: item.fieldChName, |
| 690 | fieldType: item.fieldType, | 721 | fieldType: item.fieldType, |
| 691 | gradeDetailGuid: item.gradeDetailGuid, | 722 | fieldLength: item.fieldLength, |
| 692 | gradeDetailName: item.gradeDetailName, | 723 | fieldPrecision: item.fieldPrecision, |
| 693 | guid: item.guid, | 724 | dimGuid: item.dimGuid, |
| 725 | dictionaryGuid: item.dictionaryGuid, | ||
| 726 | sortValue: item.sortValue, | ||
| 694 | isFk: item.isFk, | 727 | isFk: item.isFk, |
| 695 | isNotNull: item.isNotNull, | 728 | notNull: item.notNull, |
| 696 | isPrimary: item.isPrimary, | 729 | isPrimary: item.isPrimary, |
| 697 | sortValue: item.sortValue, | 730 | classifyDetailGuid: item.classifyDetailGuid, |
| 698 | tableChName: tableDataInfo.value[0].tableChName, | 731 | classifyDetailName: item.classifyDetailName, |
| 699 | tableGuid: route.query.tableGuid || '', | 732 | gradeDetailGuid: item.gradeDetailGuid, |
| 700 | tableName: tableDataInfo.value[0].tableName, | 733 | gradeDetailName: item.gradeDetailName, |
| 734 | classifyDetailNameRoutes: item.classifyDetailNameRoutes, | ||
| 735 | classifyDetailGuidRoutes: item.classifyDetailGuidRoutes, | ||
| 701 | } | 736 | } |
| 702 | }) | 737 | }) |
| 703 | const InParams = { | 738 | const InParams = { |
| ... | @@ -705,8 +740,9 @@ const saveOrUpdate = async (params: any = {}, type) => { | ... | @@ -705,8 +740,9 @@ const saveOrUpdate = async (params: any = {}, type) => { |
| 705 | cgDirName: '', | 740 | cgDirName: '', |
| 706 | dirGuid: '', | 741 | dirGuid: '', |
| 707 | tableGuid: '', | 742 | tableGuid: '', |
| 708 | tableName: '', | 743 | tableName: tableDataInfo.value[0].tableName, |
| 709 | tableChName: '', | 744 | tableChName: tableDataInfo.value[0].tableChName, |
| 745 | description: tableDataInfo.value[0].description, | ||
| 710 | databaseGuid: '', | 746 | databaseGuid: '', |
| 711 | database: '', | 747 | database: '', |
| 712 | databaseChName: '', | 748 | databaseChName: '', |
| ... | @@ -715,6 +751,7 @@ const saveOrUpdate = async (params: any = {}, type) => { | ... | @@ -715,6 +751,7 @@ const saveOrUpdate = async (params: any = {}, type) => { |
| 715 | fieldRQVOList: TepmTableDataDetailInfo | 751 | fieldRQVOList: TepmTableDataDetailInfo |
| 716 | } | 752 | } |
| 717 | const finalParams = { ...InParams, ...params } | 753 | const finalParams = { ...InParams, ...params } |
| 754 | console.log('finalParams', finalParams) | ||
| 718 | // 使用switch case 语句 | 755 | // 使用switch case 语句 |
| 719 | switch (type) { | 756 | switch (type) { |
| 720 | case 0: | 757 | case 0: |
| ... | @@ -818,8 +855,6 @@ const newCreateSqlDialogInfo = ref({ | ... | @@ -818,8 +855,6 @@ const newCreateSqlDialogInfo = ref({ |
| 818 | newCreateSqlDialogInfo.value.submitBtnLoading = true; | 855 | newCreateSqlDialogInfo.value.submitBtnLoading = true; |
| 819 | const params = { | 856 | const params = { |
| 820 | ...info, | 857 | ...info, |
| 821 | tableName: tableDataInfo.value[0].tableName, | ||
| 822 | tableChName: tableDataInfo.value[0].tableChName, | ||
| 823 | foundMode: route.query.foundMode, | 858 | foundMode: route.query.foundMode, |
| 824 | isDraft: 'N', | 859 | isDraft: 'N', |
| 825 | databaseGuid: route.query.databaseGuid || '', | 860 | databaseGuid: route.query.databaseGuid || '', |
| ... | @@ -887,7 +922,8 @@ onActivated(() => { | ... | @@ -887,7 +922,8 @@ onActivated(() => { |
| 887 | </div> | 922 | </div> |
| 888 | <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" | 923 | <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" |
| 889 | :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> | 924 | :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> |
| 890 | <div class="second-step-content" v-show="stepsInfo.step === 1"> | 925 | <div class="second-step-content" v-show="stepsInfo.step === 1" |
| 926 | :style="`height: ${route.query.editOpt === '1' ? '100%' : 'calc(100% - 80px)'}`"> | ||
| 891 | <div class="table_panel_wrap"> | 927 | <div class="table_panel_wrap"> |
| 892 | <el-table :data="tableDataInfo" :highlight-current-row="true" stripe border height="100%" row-key="guid" | 928 | <el-table :data="tableDataInfo" :highlight-current-row="true" stripe border height="100%" row-key="guid" |
| 893 | tooltip-effect="light" :style="{ | 929 | tooltip-effect="light" :style="{ |
| ... | @@ -996,7 +1032,7 @@ onActivated(() => { | ... | @@ -996,7 +1032,7 @@ onActivated(() => { |
| 996 | </template> | 1032 | </template> |
| 997 | </el-table-column> | 1033 | </el-table-column> |
| 998 | <!-- 源字段英文 --> | 1034 | <!-- 源字段英文 --> |
| 999 | <el-table-column prop="sourceFieldChName" label="源字段英文" width="150" show-overflow-tooltip> | 1035 | <el-table-column prop="sourceFieldChName" label="源字段英文" width="120" show-overflow-tooltip> |
| 1000 | <template #default="scope"> | 1036 | <template #default="scope"> |
| 1001 | <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} --> | 1037 | <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} --> |
| 1002 | 1038 | ||
| ... | @@ -1006,7 +1042,7 @@ onActivated(() => { | ... | @@ -1006,7 +1042,7 @@ onActivated(() => { |
| 1006 | </template> | 1042 | </template> |
| 1007 | </el-table-column> | 1043 | </el-table-column> |
| 1008 | <!-- 源端字段 fieldType fieldTypeProps--> | 1044 | <!-- 源端字段 fieldType fieldTypeProps--> |
| 1009 | <el-table-column prop="fieldType" label="源端字段类型" width="150"> | 1045 | <el-table-column prop="fieldType" label="源端字段类型" width="120"> |
| 1010 | <template #default="scope"> | 1046 | <template #default="scope"> |
| 1011 | <div v-if="scope.row.isEdit"> | 1047 | <div v-if="scope.row.isEdit"> |
| 1012 | <el-select v-model="scope.row.fieldType" placeholder="选择类型" clearable filterable | 1048 | <el-select v-model="scope.row.fieldType" placeholder="选择类型" clearable filterable |
| ... | @@ -1022,7 +1058,7 @@ onActivated(() => { | ... | @@ -1022,7 +1058,7 @@ onActivated(() => { |
| 1022 | </el-table-column> | 1058 | </el-table-column> |
| 1023 | 1059 | ||
| 1024 | <!-- 长度(可编辑) --> | 1060 | <!-- 长度(可编辑) --> |
| 1025 | <el-table-column prop="fieldLength" label="长度" width="120" align="left"> | 1061 | <el-table-column prop="fieldLength" label="长度" width="100" align="left"> |
| 1026 | <template #default="scope"> | 1062 | <template #default="scope"> |
| 1027 | <!-- 非编辑状态 --> | 1063 | <!-- 非编辑状态 --> |
| 1028 | <span v-if="!scope.row.isEdit"> | 1064 | <span v-if="!scope.row.isEdit"> |
| ... | @@ -1040,7 +1076,7 @@ onActivated(() => { | ... | @@ -1040,7 +1076,7 @@ onActivated(() => { |
| 1040 | </el-table-column> | 1076 | </el-table-column> |
| 1041 | 1077 | ||
| 1042 | <!-- 精度(可编辑) --> | 1078 | <!-- 精度(可编辑) --> |
| 1043 | <el-table-column prop="fieldPrecision" label="精度" width="120" align="left"> | 1079 | <el-table-column prop="fieldPrecision" label="精度" width="100" align="left"> |
| 1044 | <template #default="scope"> | 1080 | <template #default="scope"> |
| 1045 | <!-- 非编辑状态 --> | 1081 | <!-- 非编辑状态 --> |
| 1046 | <span v-if="!scope.row.isEdit"> | 1082 | <span v-if="!scope.row.isEdit"> |
| ... | @@ -1055,7 +1091,7 @@ onActivated(() => { | ... | @@ -1055,7 +1091,7 @@ onActivated(() => { |
| 1055 | </template> | 1091 | </template> |
| 1056 | </el-table-column> | 1092 | </el-table-column> |
| 1057 | <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> | 1093 | <!-- 关联字典(可编辑)el-tree-select 形式下拉形式 --> |
| 1058 | <el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="left"> | 1094 | <el-table-column prop="dictionaryGuid" label="关联字典" width="120" align="left"> |
| 1059 | <template #default="scope"> | 1095 | <template #default="scope"> |
| 1060 | <span v-if="!scope.row.isEdit">{{ scope.row.dictionaryGuid | 1096 | <span v-if="!scope.row.isEdit">{{ scope.row.dictionaryGuid |
| 1061 | ? dictionaryList.find((item: any) => item.guid === scope.row.dictionaryGuid)?.chName : '--' }}</span> | 1097 | ? dictionaryList.find((item: any) => item.guid === scope.row.dictionaryGuid)?.chName : '--' }}</span> |
| ... | @@ -1067,7 +1103,7 @@ onActivated(() => { | ... | @@ -1067,7 +1103,7 @@ onActivated(() => { |
| 1067 | </el-table-column> | 1103 | </el-table-column> |
| 1068 | 1104 | ||
| 1069 | <!-- 数据是否唯一(可编辑) --> | 1105 | <!-- 数据是否唯一(可编辑) --> |
| 1070 | <el-table-column prop="isPrimary" label="是否主键" width="150" align="left"> | 1106 | <el-table-column prop="isPrimary" label="是否主键" width="100" align="left"> |
| 1071 | <template #default="scope"> | 1107 | <template #default="scope"> |
| 1072 | <span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ? | 1108 | <span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ? |
| 1073 | (scope.row.isPrimary === | 1109 | (scope.row.isPrimary === |
| ... | @@ -1079,7 +1115,7 @@ onActivated(() => { | ... | @@ -1079,7 +1115,7 @@ onActivated(() => { |
| 1079 | </template> | 1115 | </template> |
| 1080 | </el-table-column> | 1116 | </el-table-column> |
| 1081 | <!-- 是否必填(可编辑) --> | 1117 | <!-- 是否必填(可编辑) --> |
| 1082 | <el-table-column prop="notNull" label="是否必填" width="120" align="left"> | 1118 | <el-table-column prop="notNull" label="是否必填" width="100" align="left"> |
| 1083 | <template #default="scope"> | 1119 | <template #default="scope"> |
| 1084 | <span v-if="!scope.row.isEdit">{{ scope.row.notNull ? (scope.row.notNull === | 1120 | <span v-if="!scope.row.isEdit">{{ scope.row.notNull ? (scope.row.notNull === |
| 1085 | 'Y' ? '是' : '否') : '--' }}</span> | 1121 | 'Y' ? '是' : '否') : '--' }}</span> |
| ... | @@ -1092,23 +1128,25 @@ onActivated(() => { | ... | @@ -1092,23 +1128,25 @@ onActivated(() => { |
| 1092 | 1128 | ||
| 1093 | <!-- 分类(不可编辑)classifyName --> | 1129 | <!-- 分类(不可编辑)classifyName --> |
| 1094 | 1130 | ||
| 1095 | <el-table-column prop="classifyDetailGuid" label="分类" width="150"> | 1131 | <el-table-column prop="classifyDetailNameRoutes" label="分类" width="150" show-overflow-tooltip> |
| 1096 | <template #default="scope"> | 1132 | <template #default="scope"> |
| 1097 | <!-- 如果当前行是编辑状态,显示 tree-select --> | 1133 | <!-- 如果当前行是编辑状态,显示 tree-select --> |
| 1098 | <div v-if="scope.row.isEdit"> | 1134 | <div v-if="scope.row.isEdit"> |
| 1099 | <el-tree-select v-model="scope.row.classifyDetailGuid" :data="treeSelectOptions" | 1135 | <el-tree-select v-model="scope.row.classifyDetailGuid" :data="treeSelectOptions" |
| 1100 | :props="treeSelectProps" placeholder="请选择分类" clearable filterable | 1136 | :props="treeSelectProps" placeholder="请选择分类" clearable filterable |
| 1101 | @change="(value) => handleClassifyChange(scope.row, value)"> | 1137 | @change="(value) => handleClassifyChange(scope.row, value)" |
| 1138 | @node-click="(node, data) => handleNodeClick(scope.row, node, data)"> | ||
| 1102 | </el-tree-select> | 1139 | </el-tree-select> |
| 1103 | </div> | 1140 | </div> |
| 1104 | <!-- 否则直接显示分类名称 --> | 1141 | <!-- 否则直接显示分类名称 --> |
| 1105 | <div v-else> | 1142 | <div v-else> |
| 1106 | {{ scope.row.classifyDetailName || '--' }} | 1143 | {{ Array.isArray(scope.row?.classifyDetailNameRoutes) ? scope.row.classifyDetailNameRoutes.join('/') : |
| 1144 | '--' }} | ||
| 1107 | </div> | 1145 | </div> |
| 1108 | </template> | 1146 | </template> |
| 1109 | </el-table-column> | 1147 | </el-table-column> |
| 1110 | <!-- 分级(不可编辑) --> | 1148 | <!-- 分级(不可编辑) --> |
| 1111 | <el-table-column prop="gradeDetailGuid" label="分级" width="120" align="left"> | 1149 | <el-table-column prop="gradeDetailGuid" label="分级" width="100" align="left"> |
| 1112 | <template #default="scope"> | 1150 | <template #default="scope"> |
| 1113 | <div v-if="scope.row.isEdit"> | 1151 | <div v-if="scope.row.isEdit"> |
| 1114 | <el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable | 1152 | <el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable |
| ... | @@ -1172,7 +1210,7 @@ onActivated(() => { | ... | @@ -1172,7 +1210,7 @@ onActivated(() => { |
| 1172 | } | 1210 | } |
| 1173 | 1211 | ||
| 1174 | .second-step-content { | 1212 | .second-step-content { |
| 1175 | height: calc(100% - 80px); | 1213 | |
| 1176 | width: 100%; | 1214 | width: 100%; |
| 1177 | padding: 16px; | 1215 | padding: 16px; |
| 1178 | 1216 | ... | ... |
| ... | @@ -153,36 +153,96 @@ const treeSelectProps = { | ... | @@ -153,36 +153,96 @@ const treeSelectProps = { |
| 153 | }; | 153 | }; |
| 154 | const treeSelectOptions = ref<any>([]); | 154 | const treeSelectOptions = ref<any>([]); |
| 155 | 155 | ||
| 156 | const getFieldTree = () => { | 156 | // 存储引用分级的guid |
| 157 | getTaskExeTreeList({ execGuid: execGuid.value }).then((res: any) => { | 157 | const gradeGuidInfo = ref(''); |
| 158 | if (res.code == proxy.$passCode) { | 158 | const getFieldTree = async () => { |
| 159 | treeSelectOptions.value = res.data || []; | 159 | // getTaskExeTreeList({ execGuid: execGuid.value }).then((res: any) => { |
| 160 | } else { | 160 | // if (res.code == proxy.$passCode) { |
| 161 | ElMessage.error(res.msg); | 161 | // treeSelectOptions.value = res.data || []; |
| 162 | } | 162 | // gradeGuidInfo.value = res.data[0].refGradeGuid; |
| 163 | }).catch(() => { | 163 | // } else { |
| 164 | ElMessage.error('获取分类树形数据失败'); | 164 | // ElMessage.error(res.msg); |
| 165 | }) | 165 | // } |
| 166 | // }).catch(() => { | ||
| 167 | // ElMessage.error('获取分类树形数据失败'); | ||
| 168 | // }) | ||
| 169 | const res: any = await getTaskExeTreeList({ execGuid: execGuid.value }); | ||
| 170 | if (res.code === proxy.$passCode) { | ||
| 171 | treeSelectOptions.value = res.data || []; | ||
| 172 | gradeGuidInfo.value = res.data[0].refGradeGuid; | ||
| 173 | } else { | ||
| 174 | ElMessage.error(res.msg); | ||
| 175 | } | ||
| 166 | } | 176 | } |
| 177 | |||
| 178 | // 查找目标节点的路径 | ||
| 179 | const findDDatabasePath = (data: any[], targetGuid: string, path: string[] = [], route: string[] = []) => { | ||
| 180 | for (const item of data) { | ||
| 181 | path.push(item.classifyName); // 添加当前节点名称 | ||
| 182 | route.push(item.classifyDetailGuid); | ||
| 183 | if (item.classifyDetailGuid === targetGuid) { | ||
| 184 | return { | ||
| 185 | path, | ||
| 186 | route | ||
| 187 | }; // 找到目标节点,返回路径 | ||
| 188 | } | ||
| 189 | if (item.children && item.children.length > 0) { | ||
| 190 | const result = findDDatabasePath(item.children, targetGuid, path, route); | ||
| 191 | if (result) return result; // 子节点找到目标节点,返回路径 | ||
| 192 | } | ||
| 193 | path.pop(); // 回溯,移除当前节点 | ||
| 194 | route.pop(); | ||
| 195 | } | ||
| 196 | return null; // 未找到目标节点 | ||
| 197 | }; | ||
| 198 | |||
| 199 | const gradeInfo = ref<any>(); | ||
| 167 | const handleClassifyChange = (row, value) => { | 200 | const handleClassifyChange = (row, value) => { |
| 201 | const pathInfo = findDDatabasePath(treeSelectOptions.value, value) | ||
| 202 | row.classifyDetailNameRoutes = pathInfo.path; | ||
| 203 | row.classifyDetailGuidRoutes = pathInfo.route; | ||
| 168 | // 查找选中的节点 | 204 | // 查找选中的节点 |
| 169 | const selectedNode = getTreeNode(treeSelectOptions.value, value); | 205 | // const selectedNode = getTreeNode(treeSelectOptions.value, value); |
| 206 | // if (selectedNode) { | ||
| 207 | // getGradeList({ classifyGradeGuid: selectedNode.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { | ||
| 208 | // if (res.code === proxy.$passCode) { | ||
| 209 | // gradeInfo.value = res.data.records || []; | ||
| 210 | // row.gradeOptions = res.data.records || []; | ||
| 211 | // } else { | ||
| 212 | // ElMessage.error(res.msg); | ||
| 213 | // } | ||
| 214 | // }); | ||
| 215 | // row.classifyDetailName = selectedNode.classifyName; | ||
| 216 | // } else { | ||
| 217 | // console.error("未找到对应的节点"); | ||
| 218 | // row.classifyDetailName = ""; // 重置分类名 | ||
| 219 | // } | ||
| 220 | }; | ||
| 170 | 221 | ||
| 171 | if (selectedNode) { | 222 | const gradeOptions = ref<any>() |
| 172 | getGradeList({ classifyGradeGuid: selectedNode.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => { | 223 | // 获取分级 |
| 173 | if (res.code === proxy.$passCode) { | 224 | const getGrade = async () => { |
| 174 | row.gradeOptions = res.data.records || []; | 225 | const res: any = await getGradeList({ classifyGradeGuid: gradeGuidInfo.value, pageIndex: 1, pageSize: -1 }); |
| 175 | } else { | 226 | if (res.code === proxy.$passCode) { |
| 176 | ElMessage.error(res.msg); | 227 | gradeInfo.value = res.data.records || []; |
| 177 | } | 228 | gradeOptions.value = res.data.records || []; |
| 178 | }); | ||
| 179 | console.log("选中的节点信息:", selectedNode); | ||
| 180 | row.classifyDetailName = selectedNode.classifyName; // 假设树节点的 `label` 是分类名 | ||
| 181 | } else { | 229 | } else { |
| 182 | console.error("未找到对应的节点"); | 230 | ElMessage.error(res.msg); |
| 183 | row.classifyDetailName = ""; // 重置分类名 | ||
| 184 | } | 231 | } |
| 185 | }; | 232 | } |
| 233 | |||
| 234 | const handleNodeClick = (row, node, data) => { | ||
| 235 | setTimeout(() => { | ||
| 236 | // 在gradeInfo找到item.guid === row.gradeGuid | ||
| 237 | const matchedItem = gradeInfo.value.find((item) => item.guid === node.gradeGuid); | ||
| 238 | if (matchedItem) { | ||
| 239 | row.gradeDetailGuid = matchedItem.guid; | ||
| 240 | row.gradeDetailName = matchedItem.name; | ||
| 241 | } | ||
| 242 | }, 300); | ||
| 243 | |||
| 244 | } | ||
| 245 | |||
| 186 | const getTreeNode = (tree, value) => { | 246 | const getTreeNode = (tree, value) => { |
| 187 | for (const node of tree) { | 247 | for (const node of tree) { |
| 188 | if (node.classifyDetailGuid === value) { | 248 | if (node.classifyDetailGuid === value) { |
| ... | @@ -198,8 +258,7 @@ const getTreeNode = (tree, value) => { | ... | @@ -198,8 +258,7 @@ const getTreeNode = (tree, value) => { |
| 198 | 258 | ||
| 199 | const handleGradeChange = (row) => { | 259 | const handleGradeChange = (row) => { |
| 200 | console.log('分级改变', row) | 260 | console.log('分级改变', row) |
| 201 | const gradeOptions = row.gradeOptions || []; | 261 | const matchedItem = gradeOptions.value.find((item) => item.guid === row.gradeDetailGuid); |
| 202 | const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid); | ||
| 203 | if (matchedItem) { | 262 | if (matchedItem) { |
| 204 | row.gradeDetailName = matchedItem.name; | 263 | row.gradeDetailName = matchedItem.name; |
| 205 | } | 264 | } |
| ... | @@ -212,7 +271,7 @@ const gradeSelectProps = { | ... | @@ -212,7 +271,7 @@ const gradeSelectProps = { |
| 212 | } | 271 | } |
| 213 | 272 | ||
| 214 | const nextStep = () => { | 273 | const nextStep = () => { |
| 215 | uploadFileRef.value.fileFormRef.ruleFormRef.validate((valid) => { | 274 | uploadFileRef.value.fileFormRef.ruleFormRef.validate(async (valid) => { |
| 216 | if (valid) { | 275 | if (valid) { |
| 217 | if (!fileTableFields.value.length) { | 276 | if (!fileTableFields.value.length) { |
| 218 | ElMessage({ | 277 | ElMessage({ |
| ... | @@ -241,7 +300,8 @@ const nextStep = () => { | ... | @@ -241,7 +300,8 @@ const nextStep = () => { |
| 241 | if (!tableCreateInfo.value.tableFields.length) { | 300 | if (!tableCreateInfo.value.tableFields.length) { |
| 242 | getSubjectField(); | 301 | getSubjectField(); |
| 243 | } | 302 | } |
| 244 | getFieldTree(); | 303 | await getFieldTree(); |
| 304 | await getGrade(); | ||
| 245 | } | 305 | } |
| 246 | }); | 306 | }); |
| 247 | }; | 307 | }; |
| ... | @@ -1304,30 +1364,32 @@ const saveTable = async () => { | ... | @@ -1304,30 +1364,32 @@ const saveTable = async () => { |
| 1304 | ElMessage.error(`第 ${index} 个字段的字段类型为浮点符型时,长度不能为空`); | 1364 | ElMessage.error(`第 ${index} 个字段的字段类型为浮点符型时,长度不能为空`); |
| 1305 | return; | 1365 | return; |
| 1306 | } | 1366 | } |
| 1367 | console.log(field, '---------------------'); | ||
| 1307 | if (field.isPrimary === 'Y') { | 1368 | if (field.isPrimary === 'Y') { |
| 1308 | hasPrimary = true; | 1369 | hasPrimary = true; |
| 1309 | if (field.notNull != 'Y') { | 1370 | if (field.notNull != 'Y') { |
| 1310 | ElMessage.error(`第 ${field.orderNum} 个字段为主键,应设置为必填`); | 1371 | ElMessage.error(`第 ${index} 个字段为主键,应设置为必填`); |
| 1311 | return; | 1372 | return; |
| 1312 | } | 1373 | } |
| 1313 | if (field.dataType == 'text') { | 1374 | if (field.dataType == 'text') { |
| 1314 | ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘大字段型’`); | 1375 | ElMessage.error(`第 ${index} 个字段为主键,字段类型不能设置为‘大字段型’`); |
| 1315 | return; | 1376 | return; |
| 1316 | } | 1377 | } |
| 1317 | if (field.dataType == 'json') { | 1378 | if (field.dataType == 'json') { |
| 1318 | ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘JSON类型’`); | 1379 | ElMessage.error(`第 ${index} 个字段为主键,字段类型不能设置为‘JSON类型’`); |
| 1319 | return; | 1380 | return; |
| 1320 | } | 1381 | } |
| 1321 | if (field.dataType == 'bit') { | 1382 | if (field.dataType == 'bit') { |
| 1322 | ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘布尔类型’`); | 1383 | ElMessage.error(`第 ${index} 个字段为主键,字段类型不能设置为‘布尔类型’`); |
| 1323 | return; | ||
| 1324 | } | ||
| 1325 | } else { | ||
| 1326 | if (!field.aggWay && isSumModel) { | ||
| 1327 | ElMessage.error(`聚合模型的非主键字段必须设置聚合方式!`); | ||
| 1328 | return; | 1384 | return; |
| 1329 | } | 1385 | } |
| 1330 | } | 1386 | } |
| 1387 | // } else { | ||
| 1388 | // if (!field.aggWay && isSumModel) { | ||
| 1389 | // ElMessage.error(`聚合模型的非主键字段必须设置聚合方式!`); | ||
| 1390 | // return; | ||
| 1391 | // } | ||
| 1392 | // } | ||
| 1331 | if (tableCreateInfo.value.isSync == 'Y' && field.notNull == 'Y' && !field.fileFieldName && (field.defaultValue === "" || field.defaultValue == null)) { | 1393 | if (tableCreateInfo.value.isSync == 'Y' && field.notNull == 'Y' && !field.fileFieldName && (field.defaultValue === "" || field.defaultValue == null)) { |
| 1332 | ElMessage.error(`第 ${index} 个字段为必填且建表勾选同步数据时,文件字段名和默认值不能同时为空`); | 1394 | ElMessage.error(`第 ${index} 个字段为必填且建表勾选同步数据时,文件字段名和默认值不能同时为空`); |
| 1333 | return; | 1395 | return; |
| ... | @@ -1397,7 +1459,7 @@ const saveTable = async () => { | ... | @@ -1397,7 +1459,7 @@ const saveTable = async () => { |
| 1397 | gradeDetailName: item.gradeDetailName, | 1459 | gradeDetailName: item.gradeDetailName, |
| 1398 | guid: item.guid, | 1460 | guid: item.guid, |
| 1399 | isFk: item.isFk, | 1461 | isFk: item.isFk, |
| 1400 | isNotNull: item.isNotNull, | 1462 | notNull: item.isNotNull, |
| 1401 | isPrimary: item.isPrimary, | 1463 | isPrimary: item.isPrimary, |
| 1402 | sortValue: item.sortValue, | 1464 | sortValue: item.sortValue, |
| 1403 | tableChName: addInfo.chName, | 1465 | tableChName: addInfo.chName, |
| ... | @@ -1415,6 +1477,7 @@ const saveTable = async () => { | ... | @@ -1415,6 +1477,7 @@ const saveTable = async () => { |
| 1415 | databaseGuid: route.query.databaseGuid || '', | 1477 | databaseGuid: route.query.databaseGuid || '', |
| 1416 | database: route.query.database || '', | 1478 | database: route.query.database || '', |
| 1417 | databaseChName: addInfo.databaseChName, | 1479 | databaseChName: addInfo.databaseChName, |
| 1480 | description: addInfo.description, | ||
| 1418 | foundMode: 2, | 1481 | foundMode: 2, |
| 1419 | isDraft: 'N', | 1482 | isDraft: 'N', |
| 1420 | fieldRQVOList: TepmTableDataDetailInfo | 1483 | fieldRQVOList: TepmTableDataDetailInfo |
| ... | @@ -1538,6 +1601,7 @@ const saveDraftTable = async () => { | ... | @@ -1538,6 +1601,7 @@ const saveDraftTable = async () => { |
| 1538 | databaseGuid: route.query.databaseGuid || '', | 1601 | databaseGuid: route.query.databaseGuid || '', |
| 1539 | database: route.query.database || '', | 1602 | database: route.query.database || '', |
| 1540 | databaseChName: addInfo.databaseChName, | 1603 | databaseChName: addInfo.databaseChName, |
| 1604 | description: addInfo.description, | ||
| 1541 | foundMode: 2, | 1605 | foundMode: 2, |
| 1542 | isDraft: 'Y', | 1606 | isDraft: 'Y', |
| 1543 | fieldRQVOList: TepmTableDataDetailInfo | 1607 | fieldRQVOList: TepmTableDataDetailInfo |
| ... | @@ -1955,18 +2019,33 @@ const tableSelectFields = computed(() => { | ... | @@ -1955,18 +2019,33 @@ const tableSelectFields = computed(() => { |
| 1955 | </template> | 2019 | </template> |
| 1956 | </el-table-column> | 2020 | </el-table-column> |
| 1957 | <!-- 分类 --> | 2021 | <!-- 分类 --> |
| 1958 | <el-table-column prop="classifyDetailGuid" label="分类" width="120px" align="center" show-overflow-tooltip> | 2022 | <!-- <el-table-column prop="classifyDetailGuid" label="分类" width="120px" align="center" show-overflow-tooltip> |
| 1959 | <template #default="scope"> | 2023 | <template #default="scope"> |
| 1960 | <!-- 如果当前行是编辑状态,显示 tree-select --> | ||
| 1961 | <div v-if="scope.row.isEdit"> | 2024 | <div v-if="scope.row.isEdit"> |
| 1962 | <el-tree-select v-if="scope.row['isEdit']" v-model="scope.row['classifyDetailGuid']" placeholder="请选择" | 2025 | <el-tree-select v-if="scope.row['isEdit']" v-model="scope.row['classifyDetailGuid']" placeholder="请选择" |
| 1963 | :data="treeSelectOptions" :props="treeSelectProps" clearable filterable | 2026 | :data="treeSelectOptions" :props="treeSelectProps" clearable filterable |
| 1964 | @change="(value) => handleClassifyChange(scope.row, value)"> | 2027 | @change="(value) => handleClassifyChange(scope.row, value)"> |
| 1965 | </el-tree-select> | 2028 | </el-tree-select> |
| 1966 | </div> | 2029 | </div> |
| 1967 | <!-- 显示treeSelectOptions 中classifyDetailGuid所在item的classifyName--> | ||
| 1968 | <div v-else>{{ scope.row.classifyDetailName || '--' }}</div> | 2030 | <div v-else>{{ scope.row.classifyDetailName || '--' }}</div> |
| 1969 | </template> | 2031 | </template> |
| 2032 | </el-table-column> --> | ||
| 2033 | <el-table-column prop="classifyDetailNameRoutes" label="分类" width="150" show-overflow-tooltip> | ||
| 2034 | <template #default="scope"> | ||
| 2035 | <!-- 如果当前行是编辑状态,显示 tree-select --> | ||
| 2036 | <div v-if="scope.row.isEdit"> | ||
| 2037 | <el-tree-select v-if="scope.row['isEdit']" v-model="scope.row['classifyDetailGuid']" | ||
| 2038 | :data="treeSelectOptions" :props="treeSelectProps" placeholder="请选择分类" clearable filterable | ||
| 2039 | @change="(value) => handleClassifyChange(scope.row, value)" | ||
| 2040 | @node-click="(node, data) => handleNodeClick(scope.row, node, data)"> | ||
| 2041 | </el-tree-select> | ||
| 2042 | </div> | ||
| 2043 | <!-- 否则直接显示分类名称 --> | ||
| 2044 | <div v-else> | ||
| 2045 | {{ Array.isArray(scope.row?.classifyDetailNameRoutes) ? scope.row.classifyDetailNameRoutes.join('/') : | ||
| 2046 | '--' }} | ||
| 2047 | </div> | ||
| 2048 | </template> | ||
| 1970 | </el-table-column> | 2049 | </el-table-column> |
| 1971 | 2050 | ||
| 1972 | <!-- 分级 --> | 2051 | <!-- 分级 --> |
| ... | @@ -1975,7 +2054,7 @@ const tableSelectFields = computed(() => { | ... | @@ -1975,7 +2054,7 @@ const tableSelectFields = computed(() => { |
| 1975 | <div v-if="scope.row.isEdit"> | 2054 | <div v-if="scope.row.isEdit"> |
| 1976 | <el-select v-if="scope.row['isEdit']" v-model="scope.row['gradeDetailGuid']" placeholder="请选择分级" | 2055 | <el-select v-if="scope.row['isEdit']" v-model="scope.row['gradeDetailGuid']" placeholder="请选择分级" |
| 1977 | clearable filterable :props="gradeSelectProps" @change="handleGradeChange(scope.row)"> | 2056 | clearable filterable :props="gradeSelectProps" @change="handleGradeChange(scope.row)"> |
| 1978 | <el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name" | 2057 | <el-option v-for="(item, index) in gradeOptions || []" :key="index" :label="item.name" |
| 1979 | :value="item.guid"></el-option> | 2058 | :value="item.guid"></el-option> |
| 1980 | </el-select> | 2059 | </el-select> |
| 1981 | </div> | 2060 | </div> | ... | ... |
-
Please register or sign in to post a comment