update:数据搜索优化

This commit is contained in:
2025-12-04 14:32:01 +08:00
parent e416c3bd8b
commit 5b47637d82
9 changed files with 436 additions and 534 deletions

View File

@@ -90,6 +90,3 @@
height: 100%;
}
}
.el-input-number {
width: 100%;
}

View File

@@ -21,7 +21,7 @@ import OnlyOffiece from '@/components/common/onlyOffice/index.vue';
interface Props {
modelValue: boolean;
fileId: number;
fileId: any;
type?: string;
}

View File

@@ -34,13 +34,17 @@ const choseList = ref<any>([]);
const emit = defineEmits(['update:modelValue', 'change']);
watch(() => props.modelValue, (val: any) => {
if (props.multiple) {
choseList.value = val ? val.split(',') : [];
} else {
choseList.value = val;
}
}, { deep: true, immediate: true });
watch(
() => props.modelValue,
(val: any) => {
if (props.multiple) {
choseList.value = val ? val.split(',') : [];
} else {
choseList.value = val;
}
},
{ deep: true, immediate: true }
);
onMounted(() => {
getlistDataFun();
@@ -72,7 +76,7 @@ const changeFun = () => {
emit('update:modelValue', ids);
const changeData: any[] = [];
listData.value.forEach((item: any) => {
if (choseList.value.includes(String(item.id))) {
if (choseList.value.includes(String(item.uuid))) {
changeData.push(item);
}
});
@@ -81,7 +85,7 @@ const changeFun = () => {
emit('update:modelValue', choseList.value);
let changeData: any = {};
listData.value.some((item: any) => {
if (choseList.value === String(item.id)) {
if (choseList.value === String(item.uuid)) {
changeData = item;
return true;
}

View File

@@ -6,12 +6,13 @@
:searchItems="searchList"
:searchLimitNum="searchLimitNum"
:searchParams="searchParams"
:searchAttrs="searchAttrs"
@search="searchFun"
@reset="resetFun"
@change="changeFun"
@load="searchLoadFun"
>
<template v-for="(name) in Object.keys($slots)" :key="name" #[name]="scope">
<template v-for="name in Object.keys($slots)" :key="name" #[name]="scope">
<slot :name="name" v-bind="scope" />
</template>
</TableSearch>
@@ -23,14 +24,14 @@
<div class="btns">
<slot name="leftOptions" />
<template v-if="$slots['cardTemplate']">
<el-tooltip v-if="viewType === 'list'" content="切换至卡片视图" placement="top" >
<el-tooltip v-if="viewType === 'list'" content="切换至卡片视图" placement="top">
<div class="icon-btn" @click="viewTypeChangeFun('card')">
<el-icon :size="18">
<List />
</el-icon>
</div>
</el-tooltip>
<el-tooltip v-else content="切换至列表视图" placement="top" >
<el-tooltip v-else content="切换至列表视图" placement="top">
<div class="icon-btn" @click="viewTypeChangeFun('list')">
<el-icon :size="18">
<Menu />
@@ -38,21 +39,21 @@
</div>
</el-tooltip>
</template>
<el-tooltip v-if="exportApi" :content="$t('表格.导出')" placement="top" >
<el-tooltip v-if="exportApi" :content="$t('表格.导出')" placement="top">
<div v-if="exportApi" class="icon-btn" @click="exportFun">
<el-icon :size="18">
<Download />
</el-icon>
</div>
</el-tooltip>
<el-tooltip v-if="showImport" :content="$t('表格.导入')" placement="top" >
<el-tooltip v-if="showImport" :content="$t('表格.导入')" placement="top">
<div v-if="showImport" class="icon-btn" @click="formDiaVisible = true">
<el-icon :size="18">
<Upload />
</el-icon>
</div>
</el-tooltip>
<el-tooltip :content="$t('表格.列表字段设置')" placement="top" >
<el-tooltip :content="$t('表格.列表字段设置')" placement="top">
<div class="icon-btn" @click="formDiaVisible = true">
<el-icon :size="18">
<Setting />
@@ -68,20 +69,26 @@
:loading="loading"
:data="tableData"
v-bind="$attrs"
:seq-config="{startIndex: (current - 1) * size}"
:seq-config="{ startIndex: (current - 1) * size }"
:column-config="{
drag: true,
resizable: true,
}"
:column-drag-config="{
showIcon: false,
trigger: 'cell'
trigger: 'cell',
}"
>
<vxe-column v-if="showCheckbox" type="checkbox" width="60" align="left" header-align="left"></vxe-column>
<vxe-column
v-if="showCheckbox"
type="checkbox"
width="60"
align="left"
header-align="left"
></vxe-column>
<vxe-column v-if="showIndex" type="seq" width="80" align="left" header-align="left" />
<vxe-column
v-for="(item) in tableHeadVisible"
v-for="item in tableHeadVisible"
:key="item.key"
:field="item.key"
:title="item.title"
@@ -109,7 +116,12 @@
<template #default="{ row }">
<div v-if="!$slots.tableActions" class="actions">
<template v-for="(action, aIndex) in actionList" :key="aIndex">
<el-link v-if="!(action.hide && action.hide(row)) && (findVisibleIndex(row, action) <= 2)" class="action-item" :type="action.type" @click="actionClickFun(row, action)">
<el-link
v-if="!(action.hide && action.hide(row)) && findVisibleIndex(row, action) <= 2"
class="action-item"
:type="action.type"
@click="actionClickFun(row, action)"
>
{{ action.title }}
</el-link>
</template>
@@ -120,7 +132,12 @@
<template #dropdown>
<el-dropdown-menu>
<template v-for="(action, aIndex) in actionList" :key="aIndex">
<el-dropdown-item v-if="!(action.hide && action.hide(row)) && (findVisibleIndex(row, action) > 2)" @click="actionClickFun(row, action)">
<el-dropdown-item
v-if="
!(action.hide && action.hide(row)) && findVisibleIndex(row, action) > 2
"
@click="actionClickFun(row, action)"
>
<el-link :type="action.type">{{ action.title }}</el-link>
</el-dropdown-item>
</template>
@@ -189,7 +206,8 @@ interface Props {
showImport?: boolean;
listTitle?: string;
actionList?: any;
showOverflow?:boolean;
showOverflow?: boolean;
searchAttrs?: any;
}
const props = withDefaults(defineProps<Props>(), {
@@ -215,6 +233,7 @@ const props = withDefaults(defineProps<Props>(), {
listTitle: '',
actionList: [],
showOverflow: true,
searchAttrs: {},
});
const tableData = ref<any[]>([]);
@@ -244,33 +263,46 @@ const findVisibleIndex = (row: any, action: any) => {
return index;
};
const visibleNum = (row: any) => { // 展示按钮数量
const visibleNum = (row: any) => {
// 展示按钮数量
return props.actionList.filter((d: any) => !(d.hide && d.hide(row))).length;
};
watch(() => props.actionList, (list: any) => {
let width = 20; // cell内边距
list.some((item: any, index: number) => {
if (index < 2) {
width += item.title.length * 14; // 一个汉字14
width += 8; // 内边距
} else {
return true;
watch(
() => props.actionList,
(list: any) => {
let width = 20; // cell内边距
list.some((item: any, index: number) => {
if (index < 2) {
width += item.title.length * 14; // 一个汉字14
width += 8; // 内边距
} else {
return true;
}
});
if (list.length > 2) {
width += 30; // 更多宽度
}
});
if (list.length > 2) {
width += 30; // 更多宽度
}
actionAutoWidth.value = width;
}, { immediate: true });
actionAutoWidth.value = width;
},
{ immediate: true }
);
watch(() => props.params, (val: any) => {
resetFun(val);
}, { deep: true });
watch(
() => props.params,
(val: any) => {
resetFun(val);
},
{ deep: true }
);
watch(() => props.searchItems, (val) => {
searchList.value = val;
}, { deep: true, immediate: true });
watch(
() => props.searchItems,
(val) => {
searchList.value = val;
},
{ deep: true, immediate: true }
);
onMounted(() => {
initFun();
@@ -298,7 +330,8 @@ const getHeadDataFun = () => {
const formConfig = JSON.parse(res.data.formConfig);
tableHead.value = formConfig;
tableHeadVisible.value = formConfig.filter((item: any) => item.isShow);
if (props.searchItems.length === 0) { // 没有传入搜索配置,则默认搜索配置
if (props.searchItems.length === 0) {
// 没有传入搜索配置,则默认搜索配置
const searchBuild: any[] = [];
formConfig.forEach((item: any) => {
if (item.tableSearch) {
@@ -322,23 +355,26 @@ const getTableDataFun = () => {
};
loading.value = true;
if (props.api) {
props.api(reqParams)?.then((res: ApiResult) => {
if (res.code === 200) {
if (props.render) {
props.render(res.data, (cbData: any) => {
const { data, total } = cbData;
props
.api(reqParams)
?.then((res: ApiResult) => {
if (res.code === 200) {
if (props.render) {
props.render(res.data, (cbData: any) => {
const { data, total } = cbData;
tableData.value = data;
pageTotal.value = total || 0;
});
} else {
const { data, total } = res.data;
tableData.value = data;
pageTotal.value = total || 0;
});
} else {
const { data, total } = res.data;
tableData.value = data;
pageTotal.value = total || 0;
}
}
}
}).finally(() => {
loading.value = false;
});
})
.finally(() => {
loading.value = false;
});
} else {
if (props.render) {
props.render(null, (data: any) => {
@@ -364,13 +400,17 @@ const resetFun = (data: object) => {
searchData.value = data;
getTableDataFun();
};
watch(() => props.head, (val) => {
if (val) {
tableHead.value = val;
tableHeadVisible.value = val.filter((item: any) => item.isShow);
resetFun({});
}
}, { deep: true, immediate: true });
watch(
() => props.head,
(val) => {
if (val) {
tableHead.value = val;
tableHeadVisible.value = val.filter((item: any) => item.isShow);
resetFun({});
}
},
{ deep: true, immediate: true }
);
// 分页变化
const sizeChangeFun = (value: number) => {
size.value = value;
@@ -428,9 +468,11 @@ const actionClickFun = (row: any, action: any) => {
if (needConfirm) {
ElMessageBox.confirm(confirmTip || '确定操作吗?', '提示', {
type: 'warning',
}).then(() => {
click(row);
}).catch(() => {});
})
.then(() => {
click(row);
})
.catch(() => {});
} else {
click(row);
}
@@ -438,12 +480,21 @@ const actionClickFun = (row: any, action: any) => {
};
const exportFun = () => {
exportFile(props.exportApi, props.tableName, props.exportFileName, { ...searchData.value, ...props.exportParams }, props.exportDict);
exportFile(
props.exportApi,
props.tableName,
props.exportFileName,
{ ...searchData.value, ...props.exportParams },
props.exportDict
);
};
watch(() => props.tableName, () => {
initFun();
});
watch(
() => props.tableName,
() => {
initFun();
}
);
defineExpose({
tableData,

View File

@@ -154,7 +154,18 @@
@change="(val: any) => changeFun(item.key, val)"
/>
</template>
<slot v-else :name="`form-${item.key}`" :row="formData">插槽</slot>
<slot
v-if="item.inputMode === 'slot' && $slots[`form-${item.key}`]"
:name="`form-${item.key}`"
:row="formData"
>表单插槽</slot
>
<slot
v-if="item.inputMode === 'slot' && $slots[`search-${item.key}`]"
:name="`search-${item.key}`"
:row="formData"
>搜索插槽</slot
>
</template>
<script setup lang="ts">

View File

@@ -12,7 +12,12 @@
:lg="6"
>
<el-form-item :label="item.title" class="spdm-form-item">
<FormItem :item="item" :form="searchForm" @change="(val) => changeFun(val)">
<FormItem
:item="item"
:form="searchForm"
:attrs="searchAttrs[item.key]"
@change="(val) => changeFun(val)"
>
<template v-for="name in Object.keys($slots)" :key="name" #[name]="scope">
<slot :name="name" v-bind="scope" />
</template>
@@ -59,12 +64,14 @@ interface Props {
searchItems: any[];
searchLimitNum?: number;
searchParams?: any;
searchAttrs?: any;
}
const props = withDefaults(defineProps<Props>(), {
searchItems: () => [] as any[],
searchLimitNum: 0,
searchParams: {},
searchAttrs: {},
});
const searchForm = ref<any>(props.searchParams);

View File

@@ -1,229 +1,51 @@
<template>
<div class="gl-page-content">
<BaseTable
v-if="currentModel === '仿真工况'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '仿真工况' }"
:api="getTaskListFun"
:searchLimitNum="3"
tableName="SIMULATION_TASK_ANALYSIS"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('仿真工况')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-link type="primary" @click="showTaskDetailFun(row)">查看详情</el-link>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '仿真算例'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '仿真算例' }"
:api="getRunListFun"
:searchLimitNum="3"
tableName="SIMULATION_RUN_ANALYSIS"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('仿真算例')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-link type="primary" @click="showRunDetailFun(row)">查看详情</el-link>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '数据指标'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '数据指标' }"
:api="getPerformanceListFun"
:searchLimitNum="3"
tableName="SIMULATION_PERFORMANCE_ANALYSIS"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('数据指标')">对比</el-button>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '模型文件'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '模型文件' }"
:params="{ fileBizType: 1 }"
:api="getSimulationTaskFileFun"
:searchLimitNum="3"
tableName="RESULT_MODEL"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('模型文件')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-space>
<el-link type="primary" @click="previewFileFun(row)">预览</el-link>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
</el-space>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '仿真报告'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '仿真报告' }"
:params="{ fileBizType: 2 }"
:api="getSimulationTaskFileFun"
:searchLimitNum="3"
tableName="RESULT_REPORT"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('仿真报告')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-space>
<el-link type="primary" @click="previewFileFun(row)">预览</el-link>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
</el-space>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '计算文件'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '计算文件' }"
:params="{ fileBizType: 3 }"
:api="getSimulationTaskFileFun"
:searchLimitNum="3"
tableName="RESULT_FILE"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('计算文件')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-space>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
</el-space>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '结果曲线'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '结果曲线' }"
:params="{ fileBizType: 4 }"
:api="getSimulationTaskFileFun"
:searchLimitNum="3"
tableName="RESULT_CURVE"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('结果曲线')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-space>
<el-link type="primary" @click="previewFileFun(row)">预览</el-link>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
</el-space>
</template>
</BaseTable>
<BaseTable
v-if="currentModel === '结果云图'"
ref="tableRef"
:searchItems="searchItems"
:searchParams="{ model: '结果云图' }"
:params="{ fileBizType: 5 }"
:api="getSimulationTaskFileFun"
:searchLimitNum="3"
tableName="RESULT_PNG"
showIndex
showCheckbox
@searchChange="searchChangeFun"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
>
<template #leftOptions>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun('结果云图')">对比</el-button>
</template>
<template #tableActions="{ row }">
<el-space>
<el-link type="primary" @click="previewFileFun(row)">预览</el-link>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
</el-space>
</template>
</BaseTable>
<div class="table">
<BaseTable
ref="tableRef"
:tableName="modelData[currentModel].tableName"
:api="modelData[currentModel].api"
showIndex
showCheckbox
:params="modelData[currentModel].params"
:actionList="actionList"
:searchAttrs="{
startTime: {
'disabled-date': disabledStartDateFun,
},
beginTime: {
'disabled-date': disabledStartDateFun,
},
endTime: {
'disabled-date': disabledEndDateFun,
},
}"
:checkboxConfig="{
checkMethod: ({ row }: any) => {
return !compareListIds.includes(row.id);
},
}"
@searchChange="searchChangeFun"
>
<template #leftOptions>
<div class="options">
<div class="chose-mode">
<el-select v-model="currentModel" @change="modeChangeFun">
<el-option
v-for="item in modeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<el-button type="primary" @click="addCompareListFun">加入对比池</el-button>
<el-button type="primary" @click="showCompareListFun">查看对比池</el-button>
<el-button type="primary" @click="compareFun(currentModel)">对比</el-button>
</div>
</template>
</BaseTable>
</div>
<Dialog
v-model="diaVisible"
diaTitle="曲线对比"
@@ -399,7 +221,6 @@ import { ElMessage } from 'element-plus';
import Dialog from '@/components/common/dialog/index.vue';
import EchartCard from '@/components/common/echartCard/index.vue';
import { groupBy } from 'lodash-es';
import UploadFile from '@/components/common/uploadFile/index.vue';
import analysisDataDialog from './components/analysisDataDialog.vue';
import taskDetail from '@/views/task/projectDetail/components/taskDetail.vue';
import FilePreview from '@/components/common/filePreview/index.vue';
@@ -409,70 +230,191 @@ const showTaskDetailDialog = ref(false);
const showRunDetailDialog = ref(false);
const tableRef = ref();
const searchChangeFun = ({ data, key, val }:any) => {
console.log('1740', data, key, val );
compareList.value = [];
compareListIds.value = [];
if (key === 'model') {
compareList.value = [];
currentModel.value = val;
const disabledStartDateFun = (time: any) => {
const params = tableRef.value?.getSearchParamsFun();
if (params.endTime) {
const end = new Date(params.endTime).getTime();
return time.getTime() > end;
}
if (val) {
if (key === 'project') {
getPhaseOptionsFun();
}
if (key === 'phase') {
getDisciplineOptionsFun();
}
} else {
if (key === 'project') {
tableRef.value?.setSearchParamByKeyFun('phase', '');
tableRef.value?.setOptionsFun('phase', []);
}
if (key === 'phase') {
tableRef.value?.setSearchParamByKeyFun('discipline', '');
tableRef.value?.setOptionsFun('discipline', []);
return false;
};
const disabledEndDateFun = (time: any) => {
const params = tableRef.value?.getSearchParamsFun();
if (params.beginTime) {
const start = new Date(params.beginTime).getTime();
return time.getTime() < start;
} else if (params.startTime) {
const start = new Date(params.startTime).getTime();
return time.getTime() < start;
}
return false;
};
const modelData = ref<any>({
仿真工况: {
tableName: 'SIMULATION_TASK_ANALYSIS',
api: getTaskListApi,
params: { model: '仿真工况' },
},
仿真算例: {
tableName: 'SIMULATION_RUN_ANALYSIS',
api: getRunListApi,
params: { model: '仿真算例' },
},
数据指标: {
tableName: 'SIMULATION_PERFORMANCE_ANALYSIS',
api: getPerformanceListApi,
params: { model: '数据指标' },
},
模型文件: {
tableName: 'RESULT_MODEL',
api: getSimulationTaskFileApi,
params: { model: '模型文件', fileBizType: 1 },
},
仿真报告: {
tableName: 'RESULT_REPORT',
api: getSimulationTaskFileApi,
params: { model: '仿真报告', fileBizType: 2 },
},
计算文件: {
tableName: 'RESULT_FILE',
api: getSimulationTaskFileApi,
params: { model: '计算文件', fileBizType: 3 },
},
结果曲线: {
tableName: 'RESULT_CURVE',
api: getSimulationTaskFileApi,
params: { model: '结果曲线', fileBizType: 4 },
},
结果云图: {
tableName: 'RESULT_PNG',
api: getSimulationTaskFileApi,
params: { model: '结果云图', fileBizType: 5 },
},
});
const modeOptions = ref<any>([
{ label: '仿真工况', value: '仿真工况' },
{ label: '仿真算例', value: '仿真算例' },
{ label: '数据指标', value: '数据指标' },
{ label: '模型文件', value: '模型文件' },
{ label: '仿真报告', value: '仿真报告' },
{ label: '计算文件', value: '计算文件' },
{ label: '结果曲线', value: '结果曲线' },
{ label: '结果云图', value: '结果云图' },
]);
const actionList = ref<any>([
{
title: '查看详情',
type: 'primary',
click: (row: any) => {
if (currentModel.value === '仿真工况') {
showTaskDetailFun(row);
}
if (currentModel.value === '仿真算例') {
showRunDetailFun(row);
}
},
hide: () => {
return !['仿真工况', '仿真算例'].includes(currentModel.value);
},
},
{
title: '预览',
type: 'primary',
click: (row: any) => {
previewFileFun(row);
},
hide: () => {
return !['模型文件', '仿真报告', '结果曲线', '结果云图'].includes(currentModel.value);
},
},
{
title: '下载',
type: 'primary',
click: (row: any) => {
const downloadUrl = `${env.VITE_API_FILE_URL}/data/downloadFile?fileId=${row.id}`;
window.open(downloadUrl, '_blank');
},
hide: () => {
return !['模型文件', '仿真报告', '计算文件', '结果曲线', '结果云图'].includes(
currentModel.value
);
},
},
]);
const modeChangeFun = () => {
tableRef.value?.setSearchParamsFun({});
};
const searchChangeFun = (searchData: any) => {
const { key, val } = searchData;
const searchParams = tableRef.value?.getSearchParamsFun();
if (key === 'projectNodeId') {
if (val.uuid) {
getChildNodeFun(val.uuid, 'phase', getChildrenNodeListApi);
} else {
searchParams.phaseNodeId = '';
tableRef.value?.setOptionsFun('phaseNodeId', []);
searchParams.disciplineNodeId = '';
tableRef.value?.setOptionsFun('disciplineNodeId', []);
}
}
if (key === 'phaseNodeId') {
if (val) {
getChildNodeFun(val, 'discipline', queryNodeListApi);
} else {
searchParams.disciplineNodeId = '';
tableRef.value?.setOptionsFun('disciplineNodeId', []);
}
}
};
const getChildNodeFun = (nodeId: any, nodeType: any, api: any) => {
const params = {
nodeId,
nodeType,
current: 1,
size: 9999,
};
api(params).then((res: any) => {
if (res.code === 200) {
if (nodeType === 'phase') {
tableRef.value?.setOptionsFun(
'phaseNodeId',
res.data.map((item: any) => {
return {
label: item.nodeName,
value: item.uuid,
};
})
);
}
if (nodeType === 'discipline') {
tableRef.value?.setOptionsFun(
'disciplineNodeId',
res.data.data.map((item: any) => {
return {
label: item.nodeName,
value: item.uuid,
};
})
);
}
}
});
};
const currentModel = ref('仿真工况');
const projectOptions = ref<any[]>([]);
const phaseOptions = ref<any[]>([]);
const disciplineOptions = ref<any[]>([]);
const searchItems = [
{
title: '模块', key: 'model', type: 'select', inputMode: 'select', clearable: false, options: [
{ label: '仿真工况', value: '仿真工况' },
{ label: '仿真算例', value: '仿真算例' },
{ label: '数据指标', value: '数据指标' },
{ label: '模型文件', value: '模型文件' },
{ label: '仿真报告', value: '仿真报告' },
{ label: '计算文件', value: '计算文件' },
{ label: '结果曲线', value: '结果曲线' },
{ label: '结果云图', value: '结果云图' },
],
},
{
title: '项目', key: 'project', type: 'select', inputMode: 'select', clearable: true, options: [],
},
{
title: '阶段', key: 'phase', type: 'select', inputMode: 'select', clearable: true, options: [],
},
{
title: '学科', key: 'discipline', type: 'select', inputMode: 'select', clearable: true, options: [],
},
{ title: '名称', key: 'name', clearable: true, type: 'input', inputMode: 'input' },
{ title: '时间范围', key: 'dateRange', clearable: true, inputMode: 'daterange' },
];
const getProjectOptionsFun = () => {
queryNodeListApi({ current: 1, size: 999, nodeType: NODE_TYPE.PROJECT }).then((res: any) => {
console.log(res);
if (res.code === 200) {
projectOptions.value = res.data.data.map((item: any) => {
return {
@@ -481,43 +423,11 @@ const getProjectOptionsFun = () => {
uuid: item.uuid,
};
});
tableRef.value?.setOptionsFun( NODE_TYPE.PROJECT, projectOptions.value );
}
});
};
const getPhaseOptionsFun = () => {
const projectId = tableRef.value?.getSearchParamByKeyFun('project');
console.log('1440', projectId);
getChildrenNodeListApi({ current: 1, size: 999, nodeType: NODE_TYPE.PHASE, nodeId: projectId }).then((res: any) => {
console.log(res);
if (res.code === 200) {
phaseOptions.value = res.data?.map((item: any) => {
return {
label: item.nodeName,
value: item.uuid,
uuid: item.uuid,
};
});
tableRef.value?.setOptionsFun( NODE_TYPE.PHASE, phaseOptions.value );
}
});
};
const getDisciplineOptionsFun = () => {
const phaseId = tableRef.value?.getSearchParamByKeyFun('phase');
queryNodeListApi({ current: 1, size: 999, nodeType: 'discipline', pid: phaseId }).then((res: any) => {
console.log(res);
if (res.code === 200) {
disciplineOptions.value = res.data.data.map((item: any) => {
return {
label: item.nodeName,
value: item.uuid,
uuid: item.uuid,
};
});
tableRef.value?.setOptionsFun( 'discipline', disciplineOptions.value );
tableRef.value?.setOptionsFun(NODE_TYPE.PROJECT, projectOptions.value);
}
});
};
const compareList = ref<any[]>([]);
const addCompareListFun = () => {
const selectedRows = tableRef.value?.tableRef?.getCheckboxRecords();
@@ -532,7 +442,9 @@ const addCompareListFun = () => {
ElMessage.warning('请先选择要对比的数据');
}
compareListIds.value = compareList.value.map((item:any) => {return item.id;});
compareListIds.value = compareList.value.map((item: any) => {
return item.id;
});
tableRef.value?.tableRef?.clearCheckboxRow();
};
@@ -540,13 +452,13 @@ const diaVisible = ref<boolean>(false);
const closeFun = () => {
diaVisible.value = false;
};
const displayCompareFun = (flag:any) => {
const displayCompareFun = (flag: any) => {
if (!compareList.value.length) {
ElMessage.warning('请先加入对比池');
return;
}
const data = compareList.value.map((item:any) => {
const data = compareList.value.map((item: any) => {
return {
...item,
name: item.originalName,
@@ -558,15 +470,12 @@ const displayCompareFun = (flag:any) => {
nextTick(() => {
tableCompareRef.value.setDataFun(data);
});
} else {
diaPngVisible.value = true;
nextTick(() => {
tableComparePngRef.value.setDataFun(data);
});
}
};
const columnData = ref<number>(1);
@@ -574,7 +483,7 @@ const tableCompareRef = ref();
const compareData = ref<any>({});
const projectStorageSpaceStatisticsRef = ref<any>({});
// 初始化图表chart-1
const initProjectTaskAchievementStatistics = async ({ dom, seriesData, titleList, key }:any) => {
const initProjectTaskAchievementStatistics = async ({ dom, seriesData, titleList, key }: any) => {
dom.commonChartRef.disposeEchartsByKey('chart-' + key);
dom.commonChartRef.option = {
title: {
@@ -622,7 +531,6 @@ const initProjectTaskAchievementStatistics = async ({ dom, seriesData, titleList
// },
// ]
// : null,
};
dom.commonChartRef.initChart();
};
@@ -632,12 +540,14 @@ const setChartFun = () => {
compareData.value = groupBy(selectedRows, 'imageNumber');
nextTick(() => {
for (const key in compareData.value) {
getCSVDataApi({ fileId: compareData.value[key].map((item:any) => item.id).join(',') }).then((res:any) => {
const seriesData:any = [];
const titleList:any = [];
getCSVDataApi({
fileId: compareData.value[key].map((item: any) => item.id).join(','),
}).then((res: any) => {
const seriesData: any = [];
const titleList: any = [];
if (res.code === 200) {
res.data.xData.forEach((item:any, index:number) => {
const data = res.data.xData[index].map((item_1:any, index_1:number) => {
res.data.xData.forEach((item: any, index: number) => {
const data = res.data.xData[index].map((item_1: any, index_1: number) => {
return [item_1, res.data.yData[index][index_1]];
});
const title = compareData.value[key][index].originalName;
@@ -650,9 +560,12 @@ const setChartFun = () => {
});
});
}
console.log('1030', res);
initProjectTaskAchievementStatistics({ dom: projectStorageSpaceStatisticsRef.value[`chart-${key}`], seriesData, titleList, key });
initProjectTaskAchievementStatistics({
dom: projectStorageSpaceStatisticsRef.value[`chart-${key}`],
seriesData,
titleList,
key,
});
});
}
});
@@ -684,7 +597,7 @@ const closePngFun = () => {
const env = import.meta.env;
const checkBoxPngChangeFun = () => {
comparePngData.value = tableComparePngRef.value?.tableRef?.getCheckboxRecords();
comparePngData.value.forEach((item:any) => {
comparePngData.value.forEach((item: any) => {
item.url = `${env.VITE_API_IMAGE_PREVIEW_URL}/data/previewImage?fileId=${item.id}`;
});
};
@@ -693,7 +606,7 @@ const loadcaseAnalysisVisable = ref(false);
const selectAnalysisData = ref<any>({});
const openDataAnalysisFun = (flag:any, tableName:any) => {
const openDataAnalysisFun = (flag: any, tableName: any) => {
selectAnalysisData.value = {
flag,
data: compareList.value,
@@ -704,37 +617,30 @@ const openDataAnalysisFun = (flag:any, tableName:any) => {
const closeAnalysisFun = () => {
loadcaseAnalysisVisable.value = false;
};
const compareFun = (flag:any) => {
const compareFun = (flag: any) => {
if (!compareList.value.length) {
ElMessage.warning('对比池为空,无法对比');
return;
}
if (flag === '仿真工况') {
openDataAnalysisFun( flag, 'SIMULATION_TASK_ANALYSIS');
openDataAnalysisFun(flag, 'SIMULATION_TASK_ANALYSIS');
}
if (flag === '仿真算例') {
openDataAnalysisFun( flag, 'SIMULATION_RUN_ANALYSIS');
openDataAnalysisFun(flag, 'SIMULATION_RUN_ANALYSIS');
}
if (flag === '数据指标') {
openDataAnalysisFun( flag, 'SIMULATION_PERFORMANCE_ANALYSIS');
openDataAnalysisFun(flag, 'SIMULATION_PERFORMANCE_ANALYSIS');
}
if (flag === '模型文件') {
openDataAnalysisFun( flag, 'RESULT_MODEL');
openDataAnalysisFun(flag, 'RESULT_MODEL');
}
if (flag === '仿真报告') {
openDataAnalysisFun( flag, 'RESULT_REPORT');
openDataAnalysisFun(flag, 'RESULT_REPORT');
}
if (flag === '计算文件') {
openDataAnalysisFun( flag, 'RESULT_FILE');
openDataAnalysisFun(flag, 'RESULT_FILE');
}
if (flag === '结果曲线') {
// openDataAnalysisFun( flag, 'RESULT_CURVE');
@@ -770,33 +676,24 @@ const compareListVisible = ref(false);
const compareTableRef = ref();
// 查看对比池
const showCompareListFun = () => {
for (let i = 0;i < compareList.value.length;i++) {
let compareName:any = '';
for (let i = 0; i < compareList.value.length; i++) {
let compareName: any = '';
if (currentModel.value === '仿真工况') {
compareName = compareList.value[i].taskName;
}
else if (currentModel.value === '仿真算例') {
} else if (currentModel.value === '仿真算例') {
compareName = compareList.value[i].runName;
}
else if (currentModel.value === '数据指标') {
} else if (currentModel.value === '数据指标') {
compareName = compareList.value[i].performanceName;
}
else if (currentModel.value === '模型文件') {
} else if (currentModel.value === '模型文件') {
compareName = compareList.value[i].performanceName;
} else {
compareName = compareList.value[i].fileName;
}
compareList.value[i].compareName = compareName;
compareList.value[i].compareType = currentModel.value;
}
console.log(compareList.value, 'compareList.value');
compareListVisible.value = true;
nextTick(() => {
compareTableRef.value?.setDataFun(compareList.value);
@@ -805,120 +702,29 @@ const showCompareListFun = () => {
const closeCompareListFun = () => {
compareListVisible.value = false;
};
// 删除对比元素
const deleteCompareDataFun = (data:any) => {
compareList.value = compareList.value.filter((item:any) => {
const deleteCompareDataFun = (data: any) => {
compareList.value = compareList.value.filter((item: any) => {
return item.id != data.id;
});
compareListIds.value = compareList.value.map((item:any) => {return item.id;});
compareListIds.value = compareList.value.map((item: any) => {
return item.id;
});
nextTick(() => {
compareTableRef.value?.setDataFun(compareList.value);
});
};
const getSimulationTaskFileFun = async (param:any) => {
const params:any = {
...param,
};
params.fileName = params?.name || '';
if (params?.project) {
params.uuid = projectOptions.value.find((item:any) => {
return item.value === params.project;
})?.uuid;
}
if (params?.phase) {
params.uuid = phaseOptions.value.find((item:any) => {
return item.value === params.phase;
})?.uuid;
}
if (params?.discipline) {
params.uuid = disciplineOptions.value.find((item:any) => {
return item.value === params.discipline;
})?.uuid;
}
// if (params?.dateRange) {
// params.beginTime = params?.dateRange[0];
// params.endTime = params?.dateRange[1];
// delete params?.dateRange;
// }
const res:any = await getSimulationTaskFileApi(params);
if (res && res.code === 200) {
return res;
}
};
const getTaskListFun = async (param:any) => {
console.log(param, 'param');
const params:any = {
...param,
};
setParamFun(params);
const res:any = await getTaskListApi(params);
return res;
};
const getRunListFun = async (param:any) => {
const params:any = {
...param,
};
setParamFun(params);
const res:any = await getRunListApi(params);
return res;
};
const getPerformanceListFun = async (param:any) => {
const params:any = {
...param,
};
setParamFun(params);
const res:any = await getPerformanceListApi(params);
return res;
};
const setParamFun = (params:any) => {
if (params?.project) {
params.projectNodeId = params?.project;
delete params.project;
}
if (params?.phase) {
params.phaseNodeId = params?.phase;
delete params.phase;
}
if (params?.discipline) {
params.disciplineNodeId = params?.discipline;
delete params.discipline;
}
if (params?.dateRange) {
params.beginTime = params?.dateRange[0];
params.endTime = params?.dateRange[1];
delete params?.dateRange;
}
};
const currentTaskInfo = ref({ id: '', uuid: '' });
const showTaskDetailFun = (row: any) => {
console.log(row, 'row');
showTaskDetailDialog.value = true;
currentTaskInfo.value = row;
};
const currentRunInfo = ref({ id: '', uuid: '' });
const showRunDetailFun = (row: any) => {
showRunDetailDialog.value = true;
currentRunInfo.value = row;
};
@@ -939,6 +745,16 @@ onMounted(() => {
.content {
height: 100%;
}
.table {
.options {
display: flex;
align-items: center;
.chose-mode {
width: 120px;
margin-right: 12px;
}
}
}
}
:deep(.compare-container) {
height: 100%;

View File

@@ -12,7 +12,12 @@
</template>
</BaseTable>
</div>
<ClassDetailDrawer v-model="detailVisible" :data="detailData" tableName="SYSTEM_DICTIONARY" @submit="submitFun" />
<ClassDetailDrawer
v-model="detailVisible"
:data="detailData"
tableName="SYSTEM_DICTIONARY"
@submit="submitFun"
/>
<DictListDrawer v-model="listVisible" :data="detailData" />
</div>
</template>

View File

@@ -27,4 +27,15 @@
@filterReset 表头过滤器重置
@filterConfirm 表头过滤器确认
@settingConfirm 表格列设置确认
##### 自定义组件事件名称 ######
##### 自定义组件事件名称 ######
####插槽说明####
#key表格列插槽
#form-keytableForm插槽
#search-keytableSearch插槽
####插槽说明####
####attrs说明####
:formAttrstableForm绑定属性
:searchAttrstableSearch绑定属性
####attrs说明####