merge
This commit is contained in:
9
src/api/system/lyricUser.ts
Normal file
9
src/api/system/lyricUser.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { post } from '@/api/request';
|
||||
|
||||
const env = import.meta.env;
|
||||
const PREFIX = env.VITE_API_PREFIX_SYSTEM;
|
||||
|
||||
// 同步利元亨的工种
|
||||
export const syncLyricUsersApi = () => {
|
||||
return post(`${PREFIX}lyricUser/syncLyricUsers`);
|
||||
};
|
||||
@@ -97,3 +97,7 @@ export const getSimulationPoolTaskApi = (params: {
|
||||
}) => {
|
||||
return get(`${PREFIX}taskpool/getSimulationPoolTask`, params);
|
||||
};
|
||||
|
||||
export const updateTaskPoolBriefApi = (params: any) => {
|
||||
return post(`${PREFIX}taskpool/updateTaskPoolBrief`, params);
|
||||
};
|
||||
|
||||
@@ -145,6 +145,7 @@
|
||||
:attrs="attrs"
|
||||
v-model="formData[item.searchKey || item.key]"
|
||||
:multiple="attrs.multiple"
|
||||
:limit="attrs.limit"
|
||||
:disabled="attrs.disabled || (item.disabled && showDisabled)"
|
||||
@change="(val: any) => changeFun(item.key, val)"
|
||||
/>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { getTaskPoolVersionsApi, getTaskPoolApi } from '@/api/task/taskpool';
|
||||
import { STANDARD_SCENE_POOL_NAME, transformPoolNodesToTree } from '@/utils/node';
|
||||
import { NODE_TYPE } from '@/utils/enum/node';
|
||||
@@ -95,7 +95,9 @@ const onChangeFun = (nodeCode: string) => {
|
||||
const scene = sceneList.value.find((item: any) => item.nodeCode === nodeCode);
|
||||
emits('select', scene || null);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchListFun();
|
||||
});
|
||||
defineExpose({ fetchListFun });
|
||||
</script>
|
||||
|
||||
|
||||
@@ -52,19 +52,20 @@ interface Props {
|
||||
modelValue: any;
|
||||
multiple?: boolean;
|
||||
disabled?: boolean;
|
||||
limit?: any;
|
||||
viewMode?: string;
|
||||
limitUpload?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
modelValue: '',
|
||||
multiple: false,
|
||||
disabled: false,
|
||||
limit: null,
|
||||
viewMode: 'card', // card卡片模式 text文本模式 inline内联模式
|
||||
limitUpload: false,
|
||||
});
|
||||
|
||||
const imgList = ref<any>([]);
|
||||
const limitNum = ref(0);
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val: any) => {
|
||||
@@ -77,9 +78,20 @@ watch(
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => imgList.value,
|
||||
(val: any) => {
|
||||
limitNum.value = val.length;
|
||||
}
|
||||
);
|
||||
|
||||
const uploading = ref(false);
|
||||
const percentage = ref(0);
|
||||
const beforeUploadFun = (file: any) => {
|
||||
if (props.limit && limitNum.value >= Number(props.limit)) {
|
||||
return false;
|
||||
}
|
||||
limitNum.value++;
|
||||
uploading.value = true;
|
||||
const params = {
|
||||
avatar: file,
|
||||
@@ -92,12 +104,7 @@ const beforeUploadFun = (file: any) => {
|
||||
.then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
const avatarId = res.data.avatarId;
|
||||
|
||||
if (props.limitUpload) {
|
||||
imgList.value = [avatarId];
|
||||
} else {
|
||||
imgList.value.push(avatarId);
|
||||
}
|
||||
imgList.value.push(avatarId);
|
||||
updateFun(avatarId);
|
||||
ElMessage.success('上传成功');
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ emitter.on('ADD_UPLOAD_FILE', (addData: any) => {
|
||||
}
|
||||
});
|
||||
|
||||
$wujie.bus.$on('UPLOAD_LIST_DATA_EMPTY', () => {
|
||||
$wujie?.bus?.$on('UPLOAD_LIST_DATA_EMPTY', () => {
|
||||
emptyFun();
|
||||
});
|
||||
|
||||
$wujie.bus.$on('UPLOAD_LIST_DATA_REMOVE', (index: any) => {
|
||||
$wujie?.bus?.$on('UPLOAD_LIST_DATA_REMOVE', (index: any) => {
|
||||
removeFun(index);
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,11 @@
|
||||
nodeCode: { disabled: projectInfo.projectSource === 'EP' },
|
||||
projectId: { disabled: projectInfo.projectSource === 'EP' },
|
||||
nodeSubType: !!props.projectId ? {} : { defaultSelects: [0] },
|
||||
detailImgUrl: {
|
||||
limit: 1,
|
||||
},
|
||||
}"
|
||||
:hideKeys="hideKeys"
|
||||
@load="loadFun"
|
||||
@change="formChangeFun"
|
||||
v-model:data="editRowInfo"
|
||||
@@ -57,6 +61,7 @@ import { PROJECT_EXE_STATUS_CODE } from '@/utils/enum/project';
|
||||
import { getMemberListIds } from '@/utils/task';
|
||||
import dayjs from 'dayjs';
|
||||
import EpProjectSelect from './epProjectSelect.vue';
|
||||
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean;
|
||||
@@ -68,6 +73,7 @@ const tableFormRef = ref();
|
||||
|
||||
const loadingInterface = ref(false);
|
||||
const epProjectId = ref<number | null>(null);
|
||||
const hideKeys = ref<any>(enableConfigByTenant([TENANT_ENUM.BASE]) ? [] : ['detailImgUrl']);
|
||||
|
||||
const dialogVisible = computed(() => {
|
||||
return props.modelValue;
|
||||
|
||||
@@ -770,11 +770,23 @@ const createTaskPoolFun = async (formData: any) => {
|
||||
const wrappedNodes = wrapWithVirtualNodeFun(nodes);
|
||||
const pickedNodes = transformTreeToPoolNodes(wrappedNodes);
|
||||
|
||||
const poolBrief = {
|
||||
poolName: currentPoolBrief.value.poolName,
|
||||
tenantId: currentPoolBrief.value.tenantId,
|
||||
};
|
||||
|
||||
Object.keys(currentPoolBrief.value).forEach((key) => {
|
||||
if (key !== 'poolName' && key !== 'tenantId' && key !== 'versions') {
|
||||
poolBrief[key] = currentPoolBrief.value[key];
|
||||
}
|
||||
});
|
||||
|
||||
if (formData.poolBriefData) {
|
||||
Object.assign(poolBrief, formData.poolBriefData);
|
||||
}
|
||||
|
||||
const req = {
|
||||
poolBrief: {
|
||||
poolName: currentPoolBrief.value.poolName,
|
||||
tenantId: currentPoolBrief.value.tenantId,
|
||||
},
|
||||
poolBrief,
|
||||
nodes: pickedNodes,
|
||||
bApprove: formData.bApprove,
|
||||
approveTemplateId: formData.approveTemplateId,
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
alt=""
|
||||
/>
|
||||
<div class="overlay-text">
|
||||
<div class="pool-title" :title="scene.nodeName">{{ scene.nodeCode }}</div>
|
||||
<div class="pool-title" :title="scene.nodeCode">{{ scene.nodeName }}</div>
|
||||
</div>
|
||||
<div class="bottom-box">
|
||||
<span class="gl-text-ellipsis gl-pointer-class" :title="scene.nodeName">
|
||||
{{ scene.nodeName }}
|
||||
<span class="gl-text-ellipsis gl-pointer-class" :title="scene.nodeCode">
|
||||
{{ scene.nodeCode }}
|
||||
</span>
|
||||
<span class="pool-meta">
|
||||
{{ scene.discipline || '--' }}
|
||||
|
||||
@@ -145,6 +145,7 @@ export const poolNodePropPickMap = {
|
||||
'days',
|
||||
'flowTemplate',
|
||||
'standard',
|
||||
'exceptionFile',
|
||||
'reportTemplate',
|
||||
'analyseTarget',
|
||||
'confidence',
|
||||
|
||||
@@ -5,33 +5,40 @@
|
||||
show-cancel-button
|
||||
show-confirm-button
|
||||
:confirm-closable="false"
|
||||
:diaTitle="mode === 'add' ? $t('知识库.新增') : $t('知识库.编辑')"
|
||||
:diaTitle="mode === 'add' ? $t('通用.新增') : $t('通用.编辑')"
|
||||
:width="500"
|
||||
>
|
||||
<template #default>
|
||||
<el-form ref="formRef" :rules="rules" :model="form" labelWidth="80">
|
||||
<el-form-item :label="$t('知识库.名称')" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<TableForm
|
||||
ref="tableFormRef"
|
||||
:tableName="TABLE_NAME.TASK_POOL_CARD_LIST"
|
||||
v-model:data="formData"
|
||||
:formAttrs="{ poolName: { disabled: mode === 'edit' } }"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="onCancelFun">{{ $t('通用.取消') }}</el-button>
|
||||
<el-button type="primary" @click="onConfirmFun">{{ $t('通用.确定') }}</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onConfirmFun">
|
||||
{{ $t('通用.确定') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed, reactive, watchEffect, watch } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
import type { FormInstance, FormRules } from 'element-plus';
|
||||
import TableForm from '@/components/common/table/tableForm.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { TABLE_NAME } from '@/utils/enum/tableName';
|
||||
import { updateTaskPoolBriefApi } from '@/api/task/taskpool';
|
||||
import type { Pool } from './types';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean;
|
||||
detail: any;
|
||||
@@ -47,78 +54,70 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:modelValue', 'confirm']);
|
||||
const form = ref({
|
||||
name: '',
|
||||
});
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emits('update:modelValue', val),
|
||||
});
|
||||
watchEffect(() => {
|
||||
if (props.detail && props.mode === 'edit') {
|
||||
form.value.name = props.detail.originalName;
|
||||
} else {
|
||||
form.value.name = '';
|
||||
}
|
||||
});
|
||||
|
||||
const tableFormRef = ref();
|
||||
const formData = ref<any>({});
|
||||
const loading = ref(false);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
if (val) {
|
||||
resetFun();
|
||||
if (props.detail && props.mode === 'edit') {
|
||||
form.value.name = props.detail.originalName;
|
||||
if (props.mode === 'edit' && props.detail) {
|
||||
formData.value = { ...props.detail };
|
||||
} else {
|
||||
form.value.name = '';
|
||||
formData.value = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const resetFun = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
const formRef = ref<FormInstance>();
|
||||
interface RuleForm {
|
||||
name: string;
|
||||
}
|
||||
const rules = reactive<FormRules<RuleForm>>({
|
||||
name: [
|
||||
{ required: true, message: t('知识库.请输入名称'), trigger: 'blur' },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
if (props.poolList && props.poolList.length > 0) {
|
||||
const isExist = props.poolList.some((item: Pool) => item.poolName === value);
|
||||
if (isExist) {
|
||||
callback(new Error('名称已存在'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
});
|
||||
const onCancelFun = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const onConfirmFun = async () => {
|
||||
if (!formRef.value) {
|
||||
if (!tableFormRef.value) {
|
||||
return;
|
||||
}
|
||||
await formRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
emits('confirm', form.value);
|
||||
|
||||
const valid = await tableFormRef.value.validateFun();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
const formValues = formData.value;
|
||||
|
||||
if (props.mode === 'add' && props.poolList && props.poolList.length > 0) {
|
||||
const isExist = props.poolList.some((item: Pool) => item.poolName === formValues.poolName);
|
||||
if (isExist) {
|
||||
ElMessage.warning('名称已存在');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (props.mode === 'edit') {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res: any = await updateTaskPoolBriefApi(formValues);
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success(res.message || t('通用.操作成功'));
|
||||
emits('confirm', formValues);
|
||||
visible.value = false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('更新工况库失败', error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
} else {
|
||||
emits('confirm', formValues);
|
||||
visible.value = false;
|
||||
}
|
||||
};
|
||||
onMounted(async () => {});
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<div class="pool-card" @click="cardClickFun">
|
||||
<img class="cover-img" :src="index % 2 !== 0 ? projectBlue : projectGreen" alt="" />
|
||||
<img
|
||||
class="cover-img"
|
||||
:src="coverImgMap[pool.iconFile ? 'custom' : index % 2 !== 0 ? 'blue' : 'green']"
|
||||
alt=""
|
||||
/>
|
||||
<div class="overlay-text">
|
||||
<div class="pool-title" :title="pool.poolName">{{ pool.poolName }}</div>
|
||||
</div>
|
||||
@@ -36,8 +40,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { MoreFilled } from '@element-plus/icons-vue';
|
||||
import { FileUtil } from '@/utils/file';
|
||||
import projectBlue from '@/assets/imgs/projectList/project-blue.png';
|
||||
import projectGreen from '@/assets/imgs/projectList/project-green.png';
|
||||
|
||||
@@ -55,6 +60,15 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
|
||||
const emit = defineEmits(['cardClick', 'actionClick']);
|
||||
|
||||
const coverImgMap = computed(() => {
|
||||
const firstIconFile = props.pool.iconFile ? props.pool.iconFile.split(',')[0] : '';
|
||||
return {
|
||||
custom: FileUtil.getFilePreviewImgPathUrl(firstIconFile),
|
||||
blue: projectBlue,
|
||||
green: projectGreen,
|
||||
};
|
||||
});
|
||||
|
||||
const isDropdownVisible = ref(false);
|
||||
|
||||
const cardClickFun = () => {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</span>
|
||||
</template>
|
||||
<template #leftOptions>
|
||||
<el-button type="primary" icon="plus" @click="addPoolModalVisible = true">
|
||||
<el-button type="primary" icon="plus" @click="openAddPoolFun">
|
||||
{{ $t('工况库.创建地图库') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -49,8 +49,8 @@
|
||||
/>
|
||||
<AddPoolModal
|
||||
v-model="addPoolModalVisible"
|
||||
mode="add"
|
||||
:detail="{}"
|
||||
:mode="poolModalMode"
|
||||
:detail="editPoolData"
|
||||
:poolList="poolListData"
|
||||
@confirm="onAddPoolConfirmFun"
|
||||
/>
|
||||
@@ -83,6 +83,13 @@ const actionList = ref([
|
||||
cardClickFun(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
openEditPoolFun(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
@@ -148,15 +155,35 @@ const onDelPoolConfirmFun = () => {
|
||||
|
||||
const addPoolModalVisible = ref(false);
|
||||
const poolListData = ref<any[]>([]);
|
||||
const editPoolData = ref<any>(null);
|
||||
const poolModalMode = ref<'add' | 'edit'>('add');
|
||||
|
||||
const openAddPoolFun = () => {
|
||||
editPoolData.value = null;
|
||||
poolModalMode.value = 'add';
|
||||
addPoolModalVisible.value = true;
|
||||
};
|
||||
|
||||
const openEditPoolFun = (row: any) => {
|
||||
editPoolData.value = row;
|
||||
poolModalMode.value = 'edit';
|
||||
addPoolModalVisible.value = true;
|
||||
};
|
||||
|
||||
const onAddPoolConfirmFun = (formData: any) => {
|
||||
addPoolModalVisible.value = false;
|
||||
jumpPage({
|
||||
path: `${route.path}/detail`,
|
||||
query: {
|
||||
poolName: formData.name,
|
||||
isNew: 'true',
|
||||
},
|
||||
});
|
||||
if (poolModalMode.value === 'edit') {
|
||||
baseTableRef.value?.resetFun();
|
||||
} else {
|
||||
jumpPage({
|
||||
path: `${route.path}/detail`,
|
||||
query: {
|
||||
poolName: formData.poolName,
|
||||
isNew: 'true',
|
||||
poolBriefData: JSON.stringify(formData),
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -543,11 +543,24 @@ const createTaskPoolFun = async (formData: any) => {
|
||||
const columns = getVxeRef()?.getColumns();
|
||||
const nodes = cloneDeep(fullData);
|
||||
const pickedNodes = transformTreeToPoolNodes(nodes);
|
||||
|
||||
const poolBrief = {
|
||||
poolName: currentPoolBrief.value.poolName,
|
||||
tenantId: currentPoolBrief.value.tenantId,
|
||||
};
|
||||
|
||||
Object.keys(currentPoolBrief.value).forEach((key) => {
|
||||
if (key !== 'poolName' && key !== 'tenantId' && key !== 'versions') {
|
||||
poolBrief[key] = currentPoolBrief.value[key];
|
||||
}
|
||||
});
|
||||
|
||||
if (formData.poolBriefData) {
|
||||
Object.assign(poolBrief, formData.poolBriefData);
|
||||
}
|
||||
|
||||
const req = {
|
||||
poolBrief: {
|
||||
poolName: currentPoolBrief.value.poolName,
|
||||
tenantId: currentPoolBrief.value.tenantId,
|
||||
},
|
||||
poolBrief,
|
||||
nodes: pickedNodes,
|
||||
bApprove: formData.bApprove,
|
||||
approveTemplateId: formData.approveTemplateId,
|
||||
@@ -1288,11 +1301,22 @@ const onListTableFilterConfirmFun = (params: any) => {
|
||||
const initPageDataFun = async () => {
|
||||
const queryPoolName = route.query?.poolName as string;
|
||||
const isNewPool = route.query?.isNew === 'true';
|
||||
const poolBriefDataStr = route.query?.poolBriefData as string;
|
||||
|
||||
if (isNewPool && queryPoolName) {
|
||||
let poolBriefData = {};
|
||||
if (poolBriefDataStr) {
|
||||
try {
|
||||
poolBriefData = JSON.parse(poolBriefDataStr);
|
||||
} catch (error) {
|
||||
console.error('解析 poolBriefData 失败', error);
|
||||
}
|
||||
}
|
||||
|
||||
const newPool = {
|
||||
tenantId,
|
||||
poolName: queryPoolName,
|
||||
...poolBriefData,
|
||||
};
|
||||
const { pools } = await getEarlyPoolData(true);
|
||||
poolList.value = pools;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch, onMounted, reactive } from 'vue';
|
||||
import { ref, nextTick, watch, reactive } from 'vue';
|
||||
import TableForm from '@/components/common/table/tableForm.vue';
|
||||
import appNameBg from './appNameBg.vue';
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:hide-pagination="true"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<!-- <el-button type="primary">同步</el-button> -->
|
||||
<el-button type="primary" @click="syncFun">同步</el-button>
|
||||
<el-button type="primary" @click="openDialog('add')">新增</el-button>
|
||||
</template>
|
||||
</BaseTable>
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
} from '@/api/system/systemData';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { syncLyricUsersApi } from '@/api/system/lyricUser';
|
||||
|
||||
const tableData = ref<any>([]);
|
||||
const isEditDialog = ref(false);
|
||||
@@ -169,6 +170,15 @@ const updateDataFun = async () => {
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const syncFun = async () => {
|
||||
try {
|
||||
const res: any = await syncLyricUsersApi();
|
||||
if (res && res.code === 200) {
|
||||
await getTableDataFun();
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await getTableDataFun();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,534 @@
|
||||
<template>
|
||||
<div class="img-page">
|
||||
<DragUploader @beforeUpload="beforeUploadFun">
|
||||
<FileTable
|
||||
showIndex
|
||||
ref="baseTableRef"
|
||||
tableName="RUN_RESULT_CANVAS_TABLE"
|
||||
:show-checkbox="true"
|
||||
:api="listSimulationKeyResultFun"
|
||||
:params="apiParam"
|
||||
:full-height="true"
|
||||
:action-list="showLeftOptions ? actionList : []"
|
||||
:default-actions="showLeftOptions ? ['rename', 'refresh'] : []"
|
||||
fileNameField="name"
|
||||
fileIdField="fileId"
|
||||
v-model:viewType="viewType"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
:accept="accept"
|
||||
multiple
|
||||
:before-upload="beforeUploadFun"
|
||||
>
|
||||
<el-button class="mr12" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
<el-button type="primary" @click="downLoadBatchFileFun">下载文件</el-button>
|
||||
<el-button @click="refreshFun">刷新</el-button>
|
||||
</template>
|
||||
<template #cardTemplate="{ tableData }">
|
||||
<ImageCard
|
||||
ref="imageCardRef"
|
||||
:list="tableData"
|
||||
:columnCount="columnCount"
|
||||
:showDelete="showLeftOptions"
|
||||
@download="downloadFileFun"
|
||||
@preview="previewFileFun"
|
||||
@delete="deleteFile"
|
||||
@refresh="refreshFun"
|
||||
/>
|
||||
</template>
|
||||
</FileTable>
|
||||
</DragUploader>
|
||||
<FilePreview v-model="previewVisible" :fileId="currentRow?.fileId" />
|
||||
|
||||
<Dialog
|
||||
v-model="uploadFileVisible"
|
||||
diaTitle="上传文件"
|
||||
:width="'70%'"
|
||||
:height="'70%'"
|
||||
@close="closeFun"
|
||||
show-footer
|
||||
>
|
||||
<BaseTable
|
||||
v-if="uploadFileVisible"
|
||||
tableName="RUN_RESULT_CANVAS_TABLE"
|
||||
ref="baseUploadTableRef"
|
||||
:actionList="uploadActionList"
|
||||
:hidePagination="true"
|
||||
:full-height="true"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<el-form class="select-form" :model="formData" inline>
|
||||
<el-form-item label="学科">
|
||||
<el-select class="select-style" v-model="formData.discipline">
|
||||
<el-option
|
||||
v-for="item in disciplineList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件类型">
|
||||
<el-select class="select-style" v-model="formData.fileType" multiple>
|
||||
<el-option
|
||||
v-for="item in fileTypeList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
:accept="accept"
|
||||
multiple
|
||||
:before-upload="beforeUploadFun"
|
||||
>
|
||||
<el-button>上传文件</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
|
||||
<template #max="{ row }">
|
||||
<el-input v-model="row.max"></el-input>
|
||||
</template>
|
||||
<template #min="{ row }">
|
||||
<el-input v-model="row.min"></el-input>
|
||||
</template>
|
||||
<template #description="{ row }">
|
||||
<el-input v-model="row.description"></el-input>
|
||||
</template>
|
||||
|
||||
<template #xquantityType="{ row }">
|
||||
<el-select
|
||||
v-model="row.xquantityType"
|
||||
filterable
|
||||
@change="getCsvQuantityUnitFun(row, 'xquantityType', 'xunitsList')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in quantityTypeList"
|
||||
:key="item.id"
|
||||
:label="item.physical"
|
||||
:value="item.physical"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #xunits="{ row }">
|
||||
<el-select v-model="row.xunits" filterable>
|
||||
<el-option
|
||||
v-for="item in row.xunitsList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #yquantityType="{ row }">
|
||||
<el-select
|
||||
v-model="row.yquantityType"
|
||||
filterable
|
||||
@change="getCsvQuantityUnitFun(row, 'yquantityType', 'yunitsList')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in quantityTypeList"
|
||||
:key="item.id"
|
||||
:label="item.physical"
|
||||
:value="item.physical"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #yunits="{ row }">
|
||||
<el-select v-model="row.yunits" filterable>
|
||||
<el-option
|
||||
v-for="item in row.yunitsList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</BaseTable>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="closeFun">关闭</el-button>
|
||||
<el-button type="primary" @click="submitFun">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import FileTable from '@/components/common/fileTable/index.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import DragUploader from '@/components/common/dragUploader/index.vue';
|
||||
import ImageCard from '@/components/taskDetail/imageCard.vue';
|
||||
import {
|
||||
addSimulationKeyResultApi,
|
||||
deleteSimulationKeyResultApi,
|
||||
listSimulationKeyResultApi,
|
||||
} from '@/api/project/run';
|
||||
import { watch } from 'vue';
|
||||
import { downloadFileById } from '@/utils/file';
|
||||
import FilePreview from '@/components/common/filePreview/index.vue';
|
||||
import { FILE_TYPE } from '@/utils/enum/file';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
import { useDict } from '@/utils/useDict';
|
||||
import { querySystemParamConfigureApi } from '@/api/system/systemData';
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
showLeftOptions: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
taskData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 是否可以更新
|
||||
canUpdate: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
showCheckbox: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
noAuth: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const { ALL_FILE_TYPE, DISCIPLINE_TYPE }: any = useDict('ALL_FILE_TYPE', 'DISCIPLINE_TYPE');
|
||||
|
||||
const viewType = ref('card');
|
||||
const columnCount = ref(4);
|
||||
const apiParam = ref<any>({ taskId: '', keyResultType: '2' });
|
||||
const accept = ref('.csv');
|
||||
const baseTableRef = ref();
|
||||
const baseUploadTableRef = ref();
|
||||
const uploadFileVisible = ref(false);
|
||||
const num = ref(1);
|
||||
const uploadFileData = ref<any>([]);
|
||||
const formData = reactive<any>({
|
||||
fileType: [`${FILE_TYPE.CANVAS_FILE}`],
|
||||
discipline: '',
|
||||
});
|
||||
const fileTypeList = ref<any>(ALL_FILE_TYPE.value['A']);
|
||||
const disciplineList = ref<any>(DISCIPLINE_TYPE.value['A']);
|
||||
|
||||
const actionList = ref([
|
||||
{
|
||||
title: '下载',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
downloadFileById(row.fileId, props.noAuth);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '预览',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
previewFileFun(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
needConfirm: true,
|
||||
confirmTip: '确认删除吗?',
|
||||
click: (row: any) => {
|
||||
deleteFile(row);
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const uploadActionList = ref([
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
click: (row: any) => {
|
||||
uploadFileData.value = uploadFileData.value.filter((item: any) => {
|
||||
return item.id != row.id;
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
baseUploadTableRef.value.setDataFun(uploadFileData.value);
|
||||
});
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const downloadFileFun = (row: any) => {
|
||||
downloadFileById(row.id, props.noAuth);
|
||||
};
|
||||
|
||||
const currentRow = ref();
|
||||
const previewVisible = ref(false);
|
||||
const previewFileFun = (row: any) => {
|
||||
currentRow.value = row;
|
||||
previewVisible.value = true;
|
||||
};
|
||||
|
||||
const deleteFile = async (row: any) => {
|
||||
const res: any = await deleteSimulationKeyResultApi({
|
||||
uuid: row.uuid,
|
||||
fileId: row.fileId,
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success('删除成功');
|
||||
refreshFun();
|
||||
} else {
|
||||
ElMessage.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const refreshFun = () => {
|
||||
reloadFun();
|
||||
};
|
||||
|
||||
const reloadFun = () => {
|
||||
if (baseTableRef.value) {
|
||||
baseTableRef.value.resetFun();
|
||||
}
|
||||
};
|
||||
|
||||
const listSimulationKeyResultFun = async (param: any) => {
|
||||
const res: any = await listSimulationKeyResultApi(param);
|
||||
if (res && res.code === 200) {
|
||||
const list = res.data.data.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
id: item.fileId,
|
||||
originalName: item.name,
|
||||
};
|
||||
});
|
||||
res.data.data = list;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
const beforeUploadFun = async (file: any) => {
|
||||
if (!uploadFileVisible.value) {
|
||||
uploadFileVisible.value = true;
|
||||
}
|
||||
num.value++;
|
||||
const { name, size } = file;
|
||||
|
||||
let result: any = false;
|
||||
const list = accept.value.split(',');
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (name.endsWith(list[i])) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
ElMessage.warning(name + '文件不符合文件上传要求');
|
||||
return false;
|
||||
}
|
||||
|
||||
const obj: any = {
|
||||
name: name,
|
||||
fileName: name,
|
||||
fileSize: size,
|
||||
size,
|
||||
file,
|
||||
id: new Date().getTime() + num.value,
|
||||
quantityType: '',
|
||||
units: '',
|
||||
max: '',
|
||||
min: '',
|
||||
description: '',
|
||||
xQuantityType: '',
|
||||
xquantityType: '',
|
||||
xUnits: '',
|
||||
xunits: '',
|
||||
yQuantityType: '',
|
||||
yquantityType: '',
|
||||
yUnits: '',
|
||||
yunits: '',
|
||||
fileType: FILE_TYPE.CANVAS_FILE,
|
||||
keyResultType: apiParam.value.keyResultType,
|
||||
// 云图类型5
|
||||
fileTypeDictValue: FILE_TYPE.CANVAS_FILE, // 这里写死的,后面要调用打标签上传组件
|
||||
disciplineDictValue: '',
|
||||
fileTypeDictClass: 'ALL_FILE_TYPE',
|
||||
disciplineTypeDictClass: 'DISCIPLINE_TYPE',
|
||||
dictTags: ['fileTypeDictClass', 'fileTypeDictValue'],
|
||||
};
|
||||
|
||||
const res: any = await addSimulationKeyResultApi({
|
||||
file,
|
||||
fileName: name,
|
||||
name: name,
|
||||
fileType: FILE_TYPE.CANVAS_FILE,
|
||||
keyResultType: apiParam.value.keyResultType,
|
||||
onlyFile: true,
|
||||
taskId: props.taskData.uuid,
|
||||
});
|
||||
|
||||
if (res && res.code === 200) {
|
||||
obj.xQuantityType = res.data.xPhysics;
|
||||
obj.xquantityType = res.data.xPhysics;
|
||||
obj.yQuantityType = res.data.yPhysics;
|
||||
obj.yquantityType = res.data.yPhysics;
|
||||
obj.max = res.data.max;
|
||||
obj.min = res.data.min;
|
||||
obj.xUnits = res.data.xUnit;
|
||||
obj.xunits = res.data.xUnit;
|
||||
obj.yUnits = res.data.yUnit;
|
||||
obj.yunits = res.data.yUnit;
|
||||
// 曲线类型4
|
||||
obj.fileTypeDictValue = FILE_TYPE.CANVAS_FILE; // TODO 这里写死的,后面要调用打标签上传组件
|
||||
}
|
||||
|
||||
uploadFileData.value.push(obj);
|
||||
nextTick(() => {
|
||||
baseUploadTableRef.value.setDataFun(uploadFileData.value);
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const downLoadBatchFileFun = () => {
|
||||
const files = baseTableRef.value.tableRef.getCheckboxRecords();
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
downloadFileById(files[i].fileId, props.noAuth);
|
||||
}
|
||||
};
|
||||
|
||||
const quantityTypeList = ref<any>([]);
|
||||
|
||||
const getQuantityTypeListFun = async () => {
|
||||
const param = {
|
||||
paramName: 'PHYSICAL_UNITS',
|
||||
};
|
||||
|
||||
try {
|
||||
const res: any = await querySystemParamConfigureApi(param);
|
||||
if (res && res.code === 200) {
|
||||
quantityTypeList.value = res.data?.values.map((item: any) => {
|
||||
return JSON.parse(item as string);
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const getCsvQuantityUnitFun = (row: any, phy: string, listName: string) => {
|
||||
const units =
|
||||
quantityTypeList.value.find((item: any) => {
|
||||
return item.physical === row[phy];
|
||||
})?.unitsList || [];
|
||||
|
||||
row[listName] = units;
|
||||
};
|
||||
|
||||
const closeFun = () => {
|
||||
uploadFileData.value = [];
|
||||
uploadFileVisible.value = false;
|
||||
};
|
||||
|
||||
const submitFun = async () => {
|
||||
if (!formData.fileType?.length) {
|
||||
ElMessage.warning('请选择文件类型!');
|
||||
return;
|
||||
}
|
||||
let isSubmit: any = true;
|
||||
|
||||
for (let i = 0; i < uploadFileData.value.length; i++) {
|
||||
const file = uploadFileData.value[i].file;
|
||||
const name = file.name;
|
||||
const paramData: any = {};
|
||||
uploadFileData.value[i].fileTypeDictValue = formData.fileType.join(',');
|
||||
uploadFileData.value[i].disciplineDictValue = formData.discipline;
|
||||
if (uploadFileData.value[i].disciplineDictValue) {
|
||||
uploadFileData.value[i].dictTags.push('disciplineTypeDictClass');
|
||||
uploadFileData.value[i].dictTags.push('disciplineDictValue');
|
||||
}
|
||||
|
||||
uploadFileData.value[i].dictTags = uploadFileData.value[i].dictTags.join(',');
|
||||
for (const key in uploadFileData.value[i]) {
|
||||
if (key != '_X_ROW_KEY' && key != 'unitsList') {
|
||||
paramData[key] = uploadFileData.value[i][key];
|
||||
}
|
||||
}
|
||||
const params: any = {
|
||||
fileName: name,
|
||||
name: name,
|
||||
file: file,
|
||||
fileType: FILE_TYPE.CANVAS_FILE,
|
||||
keyResultType: apiParam.value.keyResultType,
|
||||
...paramData,
|
||||
taskId: props.taskData.uuid,
|
||||
};
|
||||
|
||||
params.xQuantityType = params.xquantityType;
|
||||
params.yQuantityType = params.yquantityType;
|
||||
params.yUnits = params.yunits;
|
||||
params.xUnits = params.xunits;
|
||||
|
||||
await addSimulationKeyResultApi(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
} else {
|
||||
isSubmit = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (isSubmit) {
|
||||
ElMessage.success('上传成功');
|
||||
uploadFileData.value = [];
|
||||
refreshFun();
|
||||
}
|
||||
|
||||
uploadFileVisible.value = false;
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.taskData,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
apiParam.value.taskId = newVal.uuid;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getQuantityTypeListFun();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.select-style {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.mr12 {
|
||||
margin-right: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,475 @@
|
||||
<template>
|
||||
<div class="img-page">
|
||||
<DragUploader @beforeUpload="beforeUploadFun">
|
||||
<FileTable
|
||||
showIndex
|
||||
ref="baseTableRef"
|
||||
tableName="RUN_RESULT_IMAGE_TABLE"
|
||||
:show-checkbox="true"
|
||||
:api="listSimulationKeyResultFun"
|
||||
:params="apiParam"
|
||||
:full-height="true"
|
||||
:action-list="showLeftOptions ? actionList : []"
|
||||
:default-actions="showLeftOptions ? ['rename', 'refresh'] : []"
|
||||
fileNameField="name"
|
||||
fileIdField="fileId"
|
||||
v-model:viewType="viewType"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
:accept="accept"
|
||||
multiple
|
||||
:before-upload="beforeUploadFun"
|
||||
>
|
||||
<el-button class="mr12" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
<el-button type="primary" @click="downLoadBatchFileFun">下载文件</el-button>
|
||||
<el-button @click="refreshFun">刷新</el-button>
|
||||
</template>
|
||||
<template #cardTemplate="{ tableData }">
|
||||
<ImageCard
|
||||
ref="imageCardRef"
|
||||
:list="tableData"
|
||||
:columnCount="columnCount"
|
||||
:showDelete="showLeftOptions"
|
||||
@download="downloadFileFun"
|
||||
@preview="previewFileFun"
|
||||
@delete="deleteFile"
|
||||
@refresh="refreshFun"
|
||||
/>
|
||||
</template>
|
||||
</FileTable>
|
||||
</DragUploader>
|
||||
<FilePreview v-model="previewVisible" :fileId="currentRow?.fileId" />
|
||||
|
||||
<Dialog
|
||||
v-model="uploadFileVisible"
|
||||
diaTitle="上传文件"
|
||||
:width="'70%'"
|
||||
:height="'70%'"
|
||||
@close="closeFun"
|
||||
show-footer
|
||||
>
|
||||
<BaseTable
|
||||
v-if="uploadFileVisible"
|
||||
tableName="RUN_RESULT_IMAGE_TABLE"
|
||||
ref="baseUploadTableRef"
|
||||
:actionList="uploadActionList"
|
||||
:hidePagination="true"
|
||||
:full-height="true"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<el-form class="select-form" :model="formData" inline>
|
||||
<el-form-item label="学科">
|
||||
<el-select class="select-style" v-model="formData.discipline">
|
||||
<el-option
|
||||
v-for="item in disciplineList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件类型">
|
||||
<el-select class="select-style" v-model="formData.fileType" multiple>
|
||||
<el-option
|
||||
v-for="item in fileTypeList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
:accept="accept"
|
||||
multiple
|
||||
:before-upload="beforeUploadFun"
|
||||
>
|
||||
<el-button>上传文件</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
|
||||
<template #quantityType="{ row }">
|
||||
<el-select v-model="row.quantityType" filterable @change="getQuantityUnitFun(row)">
|
||||
<el-option
|
||||
v-for="item in quantityTypeList"
|
||||
:key="item.id"
|
||||
:label="item.physical"
|
||||
:value="item.physical"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #units="{ row }">
|
||||
<el-select v-model="row.units" filterable>
|
||||
<el-option
|
||||
v-for="item in row.unitsList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.label"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #max="{ row }">
|
||||
<el-input v-model="row.max"></el-input>
|
||||
</template>
|
||||
<template #min="{ row }">
|
||||
<el-input v-model="row.min"></el-input>
|
||||
</template>
|
||||
<template #description="{ row }">
|
||||
<el-input v-model="row.description"></el-input>
|
||||
</template>
|
||||
</BaseTable>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="closeFun">关闭</el-button>
|
||||
<el-button type="primary" @click="submitFun">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, reactive, ref } from 'vue';
|
||||
import FileTable from '@/components/common/fileTable/index.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import DragUploader from '@/components/common/dragUploader/index.vue';
|
||||
import ImageCard from '@/components/taskDetail/imageCard.vue';
|
||||
import {
|
||||
addSimulationKeyResultApi,
|
||||
deleteSimulationKeyResultApi,
|
||||
listSimulationKeyResultApi,
|
||||
} from '@/api/project/run';
|
||||
import { watch } from 'vue';
|
||||
import { downloadFileById } from '@/utils/file';
|
||||
import FilePreview from '@/components/common/filePreview/index.vue';
|
||||
import { FILE_TYPE } from '@/utils/enum/file';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
import { useDict } from '@/utils/useDict';
|
||||
import { querySystemParamConfigureApi } from '@/api/system/systemData';
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
|
||||
const props = defineProps({
|
||||
showLeftOptions: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
taskData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
// 是否可以更新
|
||||
canUpdate: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
showCheckbox: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
noAuth: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const { ALL_FILE_TYPE, DISCIPLINE_TYPE }: any = useDict('ALL_FILE_TYPE', 'DISCIPLINE_TYPE');
|
||||
|
||||
const viewType = ref('card');
|
||||
const columnCount = ref(4);
|
||||
const apiParam = ref<any>({ taskId: '', keyResultType: '1' });
|
||||
const accept = ref('.jpg,.jpeg,.png,.gif');
|
||||
const baseTableRef = ref();
|
||||
const baseUploadTableRef = ref();
|
||||
const uploadFileVisible = ref(false);
|
||||
const num = ref(1);
|
||||
const uploadFileData = ref<any>([]);
|
||||
const formData = reactive<any>({
|
||||
fileType: [`${FILE_TYPE.PNG_FILE}`],
|
||||
discipline: '',
|
||||
});
|
||||
const fileTypeList = ref<any>(ALL_FILE_TYPE.value['A']);
|
||||
const disciplineList = ref<any>(DISCIPLINE_TYPE.value['A']);
|
||||
|
||||
const actionList = ref([
|
||||
{
|
||||
title: '下载',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
downloadFileById(row.fileId, props.noAuth);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '预览',
|
||||
type: 'primary',
|
||||
click: (row: any) => {
|
||||
previewFileFun(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
needConfirm: true,
|
||||
confirmTip: '确认删除吗?',
|
||||
click: (row: any) => {
|
||||
deleteFile(row);
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const uploadActionList = ref([
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
click: (row: any) => {
|
||||
uploadFileData.value = uploadFileData.value.filter((item: any) => {
|
||||
return item.id != row.id;
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
baseUploadTableRef.value.setDataFun(uploadFileData.value);
|
||||
});
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const downloadFileFun = (row: any) => {
|
||||
downloadFileById(row.id, props.noAuth);
|
||||
};
|
||||
|
||||
const currentRow = ref();
|
||||
const previewVisible = ref(false);
|
||||
const previewFileFun = (row: any) => {
|
||||
currentRow.value = row;
|
||||
previewVisible.value = true;
|
||||
};
|
||||
|
||||
const deleteFile = async (row: any) => {
|
||||
const res: any = await deleteSimulationKeyResultApi({
|
||||
uuid: row.uuid,
|
||||
fileId: row.fileId,
|
||||
});
|
||||
if (res && res.code === 200) {
|
||||
ElMessage.success('删除成功');
|
||||
refreshFun();
|
||||
} else {
|
||||
ElMessage.error('删除失败');
|
||||
}
|
||||
};
|
||||
|
||||
const refreshFun = () => {
|
||||
reloadFun();
|
||||
};
|
||||
|
||||
const reloadFun = () => {
|
||||
if (baseTableRef.value) {
|
||||
baseTableRef.value.resetFun();
|
||||
}
|
||||
};
|
||||
|
||||
const listSimulationKeyResultFun = async (param: any) => {
|
||||
const res: any = await listSimulationKeyResultApi(param);
|
||||
if (res && res.code === 200) {
|
||||
const list = res.data.data.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
id: item.fileId,
|
||||
originalName: item.name,
|
||||
};
|
||||
});
|
||||
res.data.data = list;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
const beforeUploadFun = async (file: any) => {
|
||||
if (!uploadFileVisible.value) {
|
||||
uploadFileVisible.value = true;
|
||||
}
|
||||
num.value++;
|
||||
const { name, size } = file;
|
||||
|
||||
let result: any = false;
|
||||
const list = accept.value.split(',');
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (name.endsWith(list[i])) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
ElMessage.warning(name + '文件不符合文件上传要求');
|
||||
return false;
|
||||
}
|
||||
|
||||
const obj: any = {
|
||||
name: name,
|
||||
fileName: name,
|
||||
fileSize: size,
|
||||
size,
|
||||
file,
|
||||
id: new Date().getTime() + num.value,
|
||||
quantityType: '',
|
||||
units: '',
|
||||
max: '',
|
||||
min: '',
|
||||
description: '',
|
||||
xQuantityType: '',
|
||||
xquantityType: '',
|
||||
xUnits: '',
|
||||
xunits: '',
|
||||
yQuantityType: '',
|
||||
yquantityType: '',
|
||||
yUnits: '',
|
||||
yunits: '',
|
||||
fileType: FILE_TYPE.PNG_FILE,
|
||||
keyResultType: apiParam.value.keyResultType,
|
||||
// 云图类型5
|
||||
fileTypeDictValue: FILE_TYPE.PNG_FILE, // 这里写死的,后面要调用打标签上传组件
|
||||
disciplineDictValue: '',
|
||||
fileTypeDictClass: 'ALL_FILE_TYPE',
|
||||
disciplineTypeDictClass: 'DISCIPLINE_TYPE',
|
||||
dictTags: ['fileTypeDictClass', 'fileTypeDictValue'],
|
||||
};
|
||||
|
||||
uploadFileData.value.push(obj);
|
||||
nextTick(() => {
|
||||
baseUploadTableRef.value.setDataFun(uploadFileData.value);
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const downLoadBatchFileFun = () => {
|
||||
const files = baseTableRef.value.tableRef.getCheckboxRecords();
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
downloadFileById(files[i].fileId, props.noAuth);
|
||||
}
|
||||
};
|
||||
|
||||
const quantityTypeList = ref<any>([]);
|
||||
|
||||
const getQuantityTypeListFun = async () => {
|
||||
const param = {
|
||||
paramName: 'PHYSICAL_UNITS',
|
||||
};
|
||||
|
||||
try {
|
||||
const res: any = await querySystemParamConfigureApi(param);
|
||||
if (res && res.code === 200) {
|
||||
quantityTypeList.value = res.data?.values.map((item: any) => {
|
||||
return JSON.parse(item as string);
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
const getQuantityUnitFun = (row: any) => {
|
||||
const units =
|
||||
quantityTypeList.value.find((item: any) => {
|
||||
return item.physical === row.quantityType;
|
||||
})?.unitsList || [];
|
||||
|
||||
row.unitsList = units;
|
||||
};
|
||||
|
||||
const closeFun = () => {
|
||||
uploadFileData.value = [];
|
||||
uploadFileVisible.value = false;
|
||||
};
|
||||
|
||||
const submitFun = async () => {
|
||||
if (!formData.fileType?.length) {
|
||||
ElMessage.warning('请选择文件类型!');
|
||||
return;
|
||||
}
|
||||
let isSubmit: any = true;
|
||||
|
||||
for (let i = 0; i < uploadFileData.value.length; i++) {
|
||||
const file = uploadFileData.value[i].file;
|
||||
const name = file.name;
|
||||
const paramData: any = {};
|
||||
uploadFileData.value[i].fileTypeDictValue = formData.fileType.join(',');
|
||||
uploadFileData.value[i].disciplineDictValue = formData.discipline;
|
||||
if (uploadFileData.value[i].disciplineDictValue) {
|
||||
uploadFileData.value[i].dictTags.push('disciplineTypeDictClass');
|
||||
uploadFileData.value[i].dictTags.push('disciplineDictValue');
|
||||
}
|
||||
|
||||
uploadFileData.value[i].dictTags = uploadFileData.value[i].dictTags.join(',');
|
||||
for (const key in uploadFileData.value[i]) {
|
||||
if (key != '_X_ROW_KEY' && key != 'unitsList') {
|
||||
paramData[key] = uploadFileData.value[i][key];
|
||||
}
|
||||
}
|
||||
const params: any = {
|
||||
fileName: name,
|
||||
name: name,
|
||||
file: file,
|
||||
fileType: FILE_TYPE.PNG_FILE,
|
||||
keyResultType: apiParam.value.keyResultType,
|
||||
...paramData,
|
||||
taskId: props.taskData.uuid,
|
||||
};
|
||||
|
||||
await addSimulationKeyResultApi(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
} else {
|
||||
isSubmit = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (isSubmit) {
|
||||
ElMessage.success('上传成功');
|
||||
uploadFileData.value = [];
|
||||
refreshFun();
|
||||
}
|
||||
|
||||
uploadFileVisible.value = false;
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.taskData,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
apiParam.value.taskId = newVal.uuid;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getQuantityTypeListFun();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.select-style {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.mr12 {
|
||||
margin-right: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -95,27 +95,41 @@
|
||||
class="tabs-component tabs-component-son"
|
||||
v-if="keyResultType === 'resultImage' && activeName === 'keyResult'"
|
||||
>
|
||||
<resultImage
|
||||
<!-- <resultImage
|
||||
:task-id="currentTaskInfo?.uuid"
|
||||
:task-data="currentTaskInfo"
|
||||
:show-left-options="showLeftOptions"
|
||||
:canUpdate="isPMemberOrEMember"
|
||||
:show-checkbox="showCheckbox"
|
||||
:no-auth="noAuth"
|
||||
></resultImage>
|
||||
></resultImage> -->
|
||||
<taskResultImage
|
||||
:task-data="currentTaskInfo"
|
||||
:show-checkbox="showCheckbox"
|
||||
:no-auth="noAuth"
|
||||
:show-left-options="showLeftOptions"
|
||||
:canUpdate="isPMemberOrEMember"
|
||||
></taskResultImage>
|
||||
</div>
|
||||
<div
|
||||
class="tabs-component tabs-component-son"
|
||||
v-if="keyResultType === 'curveView' && activeName === 'keyResult'"
|
||||
>
|
||||
<taskCurve
|
||||
<taskResultCsv
|
||||
:task-data="currentTaskInfo"
|
||||
:show-checkbox="showCheckbox"
|
||||
:no-auth="noAuth"
|
||||
:show-left-options="showLeftOptions"
|
||||
:canUpdate="isPMemberOrEMember"
|
||||
></taskResultCsv>
|
||||
<!-- <taskCurve
|
||||
:task-id="currentTaskInfo?.uuid"
|
||||
:task-data="currentTaskInfo"
|
||||
:show-left-options="showLeftOptions"
|
||||
:canUpdate="isPMemberOrEMember"
|
||||
:show-checkbox="showCheckbox"
|
||||
:no-auth="noAuth"
|
||||
></taskCurve>
|
||||
></taskCurve> -->
|
||||
</div>
|
||||
<div
|
||||
class="tabs-component tabs-component-son"
|
||||
@@ -234,11 +248,11 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, watch } from 'vue';
|
||||
import taskPerformance from '@/components/taskDetail/taskPerformance.vue';
|
||||
import resultImage from '@/components/taskDetail/resultImage.vue';
|
||||
// import resultImage from '@/components/taskDetail/resultImage.vue';
|
||||
import taskReport from '@/components/taskDetail/taskReport.vue';
|
||||
import taskDeliverable from '@/components/taskDetail/taskDeliverable.vue';
|
||||
import taskModel from '@/components/taskDetail/taskModel.vue';
|
||||
import taskCurve from '@/components/taskDetail/taskCurve.vue';
|
||||
// import taskCurve from '@/components/taskDetail/taskCurve.vue';
|
||||
import experimentResult from './components/experimentResult.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { deliverableApproveApi } from '@/api/project/run';
|
||||
@@ -246,12 +260,13 @@ import { systemApproveQueryApproveFlowTempalteApi } from '@/api/system/systemApp
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
import task3DModel from '@/components/taskDetail/task3DModel.vue';
|
||||
import taskInfoPage from '@/components/taskDetail/taskInfo.vue';
|
||||
import { getSimulationTaskFileApi } from '@/api/data/dataAnalysis';
|
||||
import videoFile from '@/components/taskDetail/videoFile.vue';
|
||||
import reviewData from '@/components/taskDetail/reviewData.vue';
|
||||
import { isSimManagerOrExecutor, judgmentTaskCompletedFun } from '@/utils/task';
|
||||
import ReportInputDialog from '@/components/common/report/reportInputDialog.vue';
|
||||
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
|
||||
import taskResultImage from './components/taskResultImage.vue';
|
||||
import taskResultCsv from './components/taskResultCsv.vue';
|
||||
|
||||
const props = defineProps({
|
||||
taskInfo: {
|
||||
|
||||
@@ -748,10 +748,6 @@ const changeFun = async (val: any) => {
|
||||
// };
|
||||
// });
|
||||
}
|
||||
|
||||
if (editFormInfo.value.simType) {
|
||||
await disposeDeptMember();
|
||||
}
|
||||
}
|
||||
if (nodeId) {
|
||||
const optionList = await getPhaseList(nodeType, nodeId);
|
||||
@@ -802,6 +798,9 @@ const changeFun = async (val: any) => {
|
||||
tableFormRef.value.setOptionsFun('workspaceId', []);
|
||||
tableFormRef.value.setOptionsFun('workspaceCode', []);
|
||||
}
|
||||
if (editFormInfo.value.simType && editFormInfo.value?.selectPhaseName) {
|
||||
await disposeDeptMember();
|
||||
}
|
||||
} else {
|
||||
tableFormRef.value.setOptionsFun(nextKey, []);
|
||||
editFormInfo.value.phaseId = '';
|
||||
@@ -916,13 +915,13 @@ const disposeDeptMember = async () => {
|
||||
// 非设计阶段 走技术中心 设计阶段不走技术中心
|
||||
if (editFormInfo.value?.selectPhaseName.indexOf('设计') !== -1) {
|
||||
return (
|
||||
item.deptName.indexOf(currentProjectUndertaker.value) !== -1 &&
|
||||
item.deptName.indexOf('技术中心') === -1
|
||||
item.deptName.startsWith(currentProjectUndertaker.value) &&
|
||||
item.deptName.endsWith('技术中心')
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
item.deptName.indexOf(currentProjectUndertaker.value) !== -1 &&
|
||||
item.deptName.indexOf('技术中心') !== -1
|
||||
item.deptName.startsWith(currentProjectUndertaker.value) &&
|
||||
item.deptName.endsWith('技术中心')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user