refactor: tableName

This commit is contained in:
JiangSheng
2025-11-26 13:40:56 +08:00
parent f7b43c9085
commit 81119cea4d
8 changed files with 38 additions and 11 deletions

View File

@@ -185,6 +185,7 @@ import { disposeTagKey } from '@/views/task/projectDetail/components/project';
import { ElMessage } from 'element-plus';
import { generateFakeId } from '@/utils/node';
import i18n from '@/utils/i18n';
import { TABLE_NAME } from '@/utils/enum/tableName';
const loadcaseTableRef = ref();
@@ -219,7 +220,7 @@ const props = withDefaults(defineProps<Props>(), {
data: [],
tableName: '',
loading: false,
modalTableNameList: () => (['TASK_POOL_CATEGORY', 'TASK_POOL_TASK', 'TASK_POOL_PERFORMANCE']),
modalTableNameList: () => ([TABLE_NAME.TASK_POOL_CATEGORY, TABLE_NAME.TASK_POOL_TASK, TABLE_NAME.TASK_POOL_PERFORMANCE]),
leftVisible: true,
leftButtonVisible: true,
hasOperationColumn: true,

View File

@@ -48,6 +48,7 @@ import { disposeTagKey } from '@/views/task/projectDetail/components/project';
import { isCategoryType, isCategoryNodeType } from '@/utils/node';
import flowTemplateSelect from './flowTemplateSelect.vue';
import knowledgeSelect from './knowledgeSelect.vue';
import { TABLE_NAME } from '@/utils/enum/tableName';
enum OPERATION_TYPE {
ADD = 'add',
@@ -68,7 +69,7 @@ const props = withDefaults(defineProps<Props>(), {
tableName: '',
operationType: OPERATION_TYPE.ADD,
nodeType: '',
modalTableNameList: () => (['TASK_POOL_CATEGORY', 'TASK_POOL_TASK', 'TASK_POOL_PERFORMANCE']),
modalTableNameList: () => ([TABLE_NAME.TASK_POOL_CATEGORY, TABLE_NAME.TASK_POOL_TASK, TABLE_NAME.TASK_POOL_PERFORMANCE]),
detail: null,
belongProject: false,
});

View File

@@ -0,0 +1,20 @@
export enum TABLE_NAME {
/** 工况库(树结构) */
TASK_POOL = 'TASK_POOL',
/** 工况库(一维表格) */
TASK_POOL_LIST = 'TASK_POOL_LIST',
/** 工况库 - 分类 */
TASK_POOL_CATEGORY = 'TASK_POOL_CATEGORY',
/** 工况库 - 任务 */
TASK_POOL_TASK = 'TASK_POOL_TASK',
/** 工况库 - 指标 */
TASK_POOL_PERFORMANCE = 'TASK_POOL_PERFORMANCE',
/** 指标库 */
PERFORMANCE_POOL = 'PERFORMANCE_POOL',
/** 知识库 */
SIMULATION_KNOWLEDGE = 'SIMULATION_KNOWLEDGE',
/** 知识库 - 审批预览 */
SIMULATION_KNOWLEDGE_APPROVE_PREVIEW = 'SIMULATION_KNOWLEDGE_APPROVE_PREVIEW',
/** 项目任务弹窗 */
PROJECT_TASK_MODAL = 'PROJECT_TASK_MODAL',
}

View File

@@ -80,8 +80,8 @@
<loadCaseTable
v-show="currentTableType === TableViewType.TREE"
ref="treeTableRef"
tableName="TASK_POOL"
:modalTableNameList="['TASK_POOL_CATEGORY', 'TASK_POOL_TASK', 'TASK_POOL_PERFORMANCE']"
:tableName="TABLE_NAME.TASK_POOL"
:modalTableNameList="[TABLE_NAME.TASK_POOL_CATEGORY, TABLE_NAME.TASK_POOL_TASK, TABLE_NAME.TASK_POOL_PERFORMANCE]"
:data="tableData"
:loading="loading"
:editMode="true"
@@ -103,7 +103,7 @@
border="full"
:hasOperationColumn="false"
readonly
tableName="TASK_POOL_LIST"
:tableName="TABLE_NAME.TASK_POOL_LIST"
:data="extractTableData"
:loading="loading"
:editMode="false"
@@ -169,7 +169,7 @@
:loading="performanceLoading"
readonly
:loadCaseTable="false"
tableName="PERFORMANCE_POOL"
:tableName="TABLE_NAME.PERFORMANCE_POOL"
:data="performanceData"
:hasOperationColumn="false"
:showCheckBox="false"
@@ -233,6 +233,7 @@ import { TableViewType } from './types';
import type { TreeNode } from '@/utils/enum/node';
import { getUserTenantId } from '@/utils/user';
import i18n from '@/utils/i18n';
import { TABLE_NAME } from '@/utils/enum/tableName';
const props = defineProps(['pageType']);

View File

@@ -103,7 +103,7 @@
v-model="visible"
:detail="currentRow"
:folder="currentFolder"
tableName="SIMULATION_KNOWLEDGE"
:tableName="TABLE_NAME.SIMULATION_KNOWLEDGE"
@confirm="onConfirmFun"
/>
<folderModal
@@ -136,6 +136,7 @@ import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
import i18n from '@/utils/i18n';
import FilePreview from '@/components/common/filePreview/index.vue';
import emitter from '@/utils/eventBus';
import { TABLE_NAME } from '@/utils/enum/tableName';
const { KNOWLEDGE_APPROVE_STATUS, KNOWLEDGE_APPROVE_TYPE } = useDict('KNOWLEDGE_APPROVE_STATUS', 'KNOWLEDGE_APPROVE_TYPE');
const env = import.meta.env;

View File

@@ -7,7 +7,7 @@
</div>
<BaseTable
ref="baseTableRef"
tableName="SIMULATION_KNOWLEDGE_APPROVE_PREVIEW"
:tableName="TABLE_NAME.SIMULATION_KNOWLEDGE_APPROVE_PREVIEW"
showIndex
:actionsWidth="200"
:actionList="actionList"
@@ -34,6 +34,7 @@ import BaseTable from '@/components/common/table/baseTable.vue';
import i18n from '@/utils/i18n';
import { formatFileSize } from '@/utils/file';
import FilePreview from '@/components/common/filePreview/index.vue';
import { TABLE_NAME } from '@/utils/enum/tableName';
interface Props {
data: any;

View File

@@ -21,7 +21,7 @@
:editMode="false"
ref="treeTableRef"
readonly
tableName="TASK_POOL"
:tableName="TABLE_NAME.TASK_POOL"
:data="mergedPreviewTree"
:hasOperationColumn="false"
:showCheckBox="false"
@@ -37,6 +37,7 @@
import { nextTick, onMounted, ref, watchEffect } from 'vue';
import loadCaseTable from '@/components/common/treeCaseTable/loadCaseTable.vue';
import type { VxeTablePropTypes } from 'vxe-table';
import { TABLE_NAME } from '@/utils/enum/tableName';
interface Props {
data: any;

View File

@@ -50,7 +50,7 @@
<div class="left-table">
<loadCaseTable
ref="leftPoolTableRef"
tableName="TASK_POOL"
:tableName="TABLE_NAME.TASK_POOL"
:data="leftPoolTableDataList"
readonly
:loading="leftTableLoading"
@@ -126,7 +126,7 @@
<loadCaseTable
ref="rightTableRef"
tableName="PROJECT_TASK_PLANNING"
:modalTableNameList="['TASK_POOL_CATEGORY','PROJECT_TASK_MODAL','TASK_POOL_PERFORMANCE']"
:modalTableNameList="[TABLE_NAME.TASK_POOL_CATEGORY,TABLE_NAME.PROJECT_TASK_MODAL,TABLE_NAME.TASK_POOL_PERFORMANCE]"
:data="rightTableData"
:loading="rightTableLoading"
:projectUuid="nodeLevel1Uuid"
@@ -183,6 +183,7 @@ import loadCaseTable from '@/components/common/treeCaseTable/loadCaseTable.vue';
import { getMemberListIds } from '@/utils/task';
import { getUserTenantId } from '@/utils/user';
import ProjectSelect from '@/components/common/projectSelect/index.vue';
import { TABLE_NAME } from '@/utils/enum/tableName';
const props = defineProps<{
showTaskDialog: boolean;