feat: 能力中心

This commit is contained in:
JiangSheng
2025-11-21 16:19:49 +08:00
parent 0aafc8528c
commit c865aa4eeb
12 changed files with 86 additions and 24 deletions

View File

@@ -176,6 +176,7 @@ import { random } from 'lodash-es';
import { TASK_CALCULATE_STATUS, TASK_PROCESS_STATUS } from '@/utils/enum/task';
import { disposeMemberList, disposeTagKey } from '@/views/task/projectDetail/components/project';
import { ElMessage } from 'element-plus';
import { generateFakeId } from '@/utils/node';
const loadcaseTableRef = ref();
@@ -292,7 +293,7 @@ const onNodeDetailConfirmFun = (formData: any) => {
if (operationType.value === 'add') {
const addRow = {
parentId: checkRowData[0]?.fakeId,
fakeId: random(0, 1, true) * random(0, 1, true) + '',
fakeId: generateFakeId(),
discipline: checkRowData[0]?.discipline,
...formData,
depth: checkRowData[0]?.depth + 1,

View File

@@ -30,8 +30,8 @@
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>

View File

@@ -1,4 +1,16 @@
const lang = {
'通用': {
'确定': 'Confirm',
'取消': 'Cancel',
'保存': 'Save',
'关闭': 'Close',
'新增': 'Add',
'编辑': 'Edit',
'删除': 'Delete',
'是': 'Yes',
'否': 'No',
'返回上一级': 'Back',
},
'菜单': {
'首页': 'Home',
'审核预览': 'Approval Preview',
@@ -112,6 +124,9 @@ const lang = {
'操作': 'Operation',
'请输入': 'Please Enter ',
'请选择': 'Please Select ',
'新增': 'Add',
'编辑': 'Edit',
'审批预览提示': 'Green row indicates new content, blue row indicates modified content, red row indicates deleted content',
},
'知识库': {
'上传': 'Upload',

View File

@@ -1,4 +1,16 @@
const lang = {
'通用': {
'确定': '确定',
'取消': '取消',
'保存': '保存',
'关闭': '关闭',
'新增': '新增',
'编辑': '编辑',
'删除': '删除',
'是': '是',
'否': '否',
'返回上一级': '返回上一级',
},
'菜单': {
'首页': '首页',
'审核预览': '审核预览',
@@ -112,6 +124,9 @@ const lang = {
'操作': '操作',
'请输入': '请输入',
'请选择': '请选择',
'新增': '新增',
'编辑': '编辑',
'审批预览提示': '绿色行表示新增内容,蓝色行表示修改内容,红色行表示删除内容',
},
'知识库': {
'上传': '上传',

View File

@@ -79,9 +79,27 @@ export const traverseTreeAsync = async<T extends TreeNode>(tree: T[] | undefined
}
};
const generateFakeId = (id: number | undefined): string => {
return 'fakeId' + Math.random() + id;
export const generateFakeId = (id?: number | string): string => {
const prefix = 'fakeId';
const timePart = Date.now().toString(36);
let randomPart = '';
try {
const cryptoObj = (typeof globalThis !== 'undefined' ? (globalThis as any).crypto : undefined);
if (cryptoObj && typeof cryptoObj.getRandomValues === 'function') {
const bytes = new Uint8Array(6);
cryptoObj.getRandomValues(bytes);
randomPart = Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
} else {
randomPart = Math.random().toString(36).slice(2, 8);
}
} catch {
randomPart = Math.random().toString(36).slice(2, 8);
}
const idPart = id !== undefined && id !== null ? `_${String(id)}` : '';
return `${prefix}_${timePart}_${randomPart}${idPart}`;
};
export const transformPoolNodesToTree = (nodes: TreeNode[]): TreeNode[] => {
if (Array.isArray(nodes) && nodes.length > 0) {
return nodes.map(node => {

View File

@@ -14,8 +14,8 @@
<el-form ref="formRef" :rules="rules" :model="form" label-width="120">
<el-form-item :label="$t('工况库.审批')" prop="bApprove">
<el-radio-group v-model="form.bApprove">
<el-radio :value="true" size="large"></el-radio>
<el-radio :value="false" size="large"></el-radio>
<el-radio :value="true" size="large">{{ $t('通用.是') }}</el-radio>
<el-radio :value="false" size="large">{{ $t('通用.否') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('工况库.审核模版')" prop="approveTemplateId" v-if="form.bApprove === true">
@@ -26,22 +26,22 @@
</el-form-item>
<el-form-item :label="$t('工况库.升版')" prop="bNewVersion" >
<el-radio-group v-model="form.bNewVersion" :disabled="props.isInitial">
<el-radio :value="true" size="large"></el-radio>
<el-radio :value="false" size="large"></el-radio>
<el-radio :value="true" size="large">{{ $t('通用.是') }}</el-radio>
<el-radio :value="false" size="large">{{ $t('通用.否') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('工况库.升大版本')" prop="versionType" v-if="form.bNewVersion === true" >
<el-radio-group v-model="form.versionType" :disabled="props.isInitial">
<el-radio :value="1" size="large"></el-radio>
<el-radio :value="0" size="large"></el-radio>
<el-radio :value="1" size="large">{{ $t('通用.是') }}</el-radio>
<el-radio :value="0" size="large">{{ $t('通用.否') }}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>

View File

@@ -17,8 +17,8 @@
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>

View File

@@ -5,7 +5,12 @@
<div v-for="item in poolList" :key="item.id" class="pool-item">
<div class="name">{{ item.poolName }}</div>
<div class="btn">
<el-popconfirm :title="$t('知识库.确认删除')" @confirm="onDelPoolFun(item)">
<el-popconfirm
:title="$t('知识库.确认删除')"
:cancelButtonText="$t('通用.取消')"
:confirmButtonText="$t('通用.确定')"
@confirm="onDelPoolFun(item)"
>
<template #reference>
<el-link type="danger">{{ $t('工况库.删除') }}</el-link>
</template>

View File

@@ -43,8 +43,8 @@
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>

View File

@@ -17,8 +17,8 @@
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>

View File

@@ -22,8 +22,8 @@
</template>
<template #footer>
<div>
<el-button @click="onCancelFun">取消</el-button>
<el-button type="primary" @click="onConfirmFun">确定</el-button>
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
</div>
</template>
</Dialog>
@@ -127,6 +127,9 @@ const getDisciplineNodeTypeFun = () => {
};
const onFormChangeFun = (data:any) => {
form.value = tableFormRef.value?.getFormDataFun();
if (data.key === 'projectId') {
form.value.analysisDirectionId = '';
}
if (data.key === 'templateId') {
form.value.templateName = data?.val?.label;
}

View File

@@ -19,7 +19,12 @@
<EditPen />
</el-icon>
</el-button>
<el-popconfirm :title="$t('知识库.确认删除')" @confirm="removeFun(data)">
<el-popconfirm
:title="$t('知识库.确认删除')"
:cancelButtonText="$t('通用.取消')"
:confirmButtonText="$t('通用.确定')"
@confirm="removeFun(data)"
>
<template #reference>
<el-button type="danger" link>
<el-icon>
@@ -49,7 +54,7 @@
>
<template #leftOptions>
<div>
<el-button :icon="DArrowLeft" @click="backFun" :disabled="navList.length <= 1">返回上一级</el-button>
<el-button :icon="DArrowLeft" @click="backFun" :disabled="navList.length <= 1">{{ $t('通用.返回上一级') }}</el-button>
<el-button type="primary" :icon="Plus" @click="openModalFun" :disabled="!currentFolder">
{{ $t('知识库.上传') }}
</el-button>