update:算例报告
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { get } from '@/api/request';
|
||||
import { post } from '@/api/request';
|
||||
|
||||
const env = import.meta.env;
|
||||
const PREFIX = env.VITE_API_PREFIX_PROJECT;
|
||||
|
||||
// token校验(宜安)
|
||||
export const verityCidWebTokenApi = (params: any) => {
|
||||
return get(`${PREFIX}dataManager/tree/node/verityCidWebToken`, params);
|
||||
return post(`${PREFIX}dataManager/tree/node/verityCidWebToken`, params);
|
||||
};
|
||||
|
||||
@@ -234,3 +234,8 @@ export const deleteExperimentResultApi = (params: any) => {
|
||||
export const editExperimentResultApi = (params: any) => {
|
||||
return post(`${PREFIX}run/editExperimentResult`, params);
|
||||
};
|
||||
|
||||
// 算例下编辑报告
|
||||
export const editReportApi = (params: any) => {
|
||||
return download(`${PREFIX}run/editReport`, params, params.fileName);
|
||||
};
|
||||
|
||||
@@ -21,16 +21,17 @@ let tenantId = $wujie?.props?.TENANT_ID || localStorage.getItem('TENANT_ID') ||
|
||||
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
if (config.params?.token) {
|
||||
userId = config.params.userId;
|
||||
token = config.params.token;
|
||||
tenantId = config.params.tenantId;
|
||||
const configData = config.data || config.params || {};
|
||||
if (configData.token) {
|
||||
userId = configData.userId;
|
||||
token = configData.token;
|
||||
tenantId = configData.tenantId;
|
||||
}
|
||||
config.headers['company'] = company;
|
||||
config.headers['jobNumber'] = getUserData().username || '';
|
||||
config.headers['token'] = token;
|
||||
config.headers['userId'] = localStorage.getItem('YIAN_USER_ID') || userId;
|
||||
config.headers['tenantId'] = localStorage.getItem('YIAN_TENANT_ID') || tenantId;
|
||||
config.headers['userId'] = userId;
|
||||
config.headers['tenantId'] = tenantId;
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
|
||||
@@ -298,7 +298,6 @@ defineExpose({
|
||||
}
|
||||
.preview {
|
||||
height: calc(100% - 50px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
.edit-content {
|
||||
|
||||
159
src/components/common/report/reportInputDialog.vue
Normal file
159
src/components/common/report/reportInputDialog.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<Dialog v-model="diaVisible" diaTitle="编辑报告" width="80%" height="90%" @close="closeFun">
|
||||
<div class="content">
|
||||
<div class="chose-report">
|
||||
<el-select
|
||||
v-model="reportData"
|
||||
value-key="uuid"
|
||||
placeholder="请选择报告模板"
|
||||
@change="setReportDataFun"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reportList"
|
||||
:key="item.uuid"
|
||||
:label="item.templateName"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="report-content">
|
||||
<ReportEdit
|
||||
v-if="reportFileId"
|
||||
ref="ReportEditRef"
|
||||
v-model:data="reportDataContent"
|
||||
:fileId="reportFileId"
|
||||
mode="input"
|
||||
/>
|
||||
<div class="no-report">暂无报告模板</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="closeFun">关闭</el-button>
|
||||
<el-button type="primary" @click="saveFun">保存并下载</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, nextTick } from 'vue';
|
||||
import Dialog from '@/components/common/dialog/index.vue';
|
||||
import { queryReportTemplateApi } from '@/api/capability/report';
|
||||
import { editReportApi } from '@/api/project/run';
|
||||
import ReportEdit from '@/components/common/report/reportEdit/index.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean;
|
||||
data: any;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
modelValue: false,
|
||||
data: {},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val: boolean) => {
|
||||
diaVisible.value = val;
|
||||
if (val) {
|
||||
initFun();
|
||||
} else {
|
||||
resetFun();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const reportData = ref<any>('');
|
||||
const reportDataId = ref<any>('');
|
||||
const reportDataContent = ref<any>({});
|
||||
const reportFileId = ref<any>('');
|
||||
const diaVisible = ref(false);
|
||||
|
||||
const initFun = () => {
|
||||
getReportListFun();
|
||||
};
|
||||
|
||||
const reportList = ref<any>([]);
|
||||
const getReportListFun = () => {
|
||||
const params = {
|
||||
current: 1,
|
||||
size: 999,
|
||||
type: '1',
|
||||
};
|
||||
queryReportTemplateApi(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
reportList.value = res.data.data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setReportDataFun = (data: any) => {
|
||||
reportFileId.value = '';
|
||||
nextTick(() => {
|
||||
const { templateContent, fileId, uuid } = data;
|
||||
console.log(data);
|
||||
reportDataContent.value = JSON.parse(templateContent);
|
||||
reportDataId.value = uuid;
|
||||
reportFileId.value = fileId;
|
||||
});
|
||||
};
|
||||
|
||||
const ReportEditRef = ref<any>();
|
||||
const saveFun = () => {
|
||||
const fileName = reportData.value.templateName + '.docx';
|
||||
const data = ReportEditRef.value?.getFormatDataFun();
|
||||
const params = {
|
||||
runId: props.data.uuid,
|
||||
reportTemplate: reportDataId.value,
|
||||
reportContent: JSON.stringify(data),
|
||||
fileName,
|
||||
};
|
||||
editReportApi(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('操作成功');
|
||||
closeFun();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const resetFun = () => {
|
||||
reportData.value = '';
|
||||
reportDataId.value = '';
|
||||
reportDataContent.value = {};
|
||||
reportFileId.value = '';
|
||||
};
|
||||
|
||||
const closeFun = () => {
|
||||
emit('update:modelValue', false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.chose-report {
|
||||
width: 200px;
|
||||
height: 32px;
|
||||
}
|
||||
.report-content {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
.no-report {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,12 +7,13 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { getAllDictDataFun } from '@/utils/common';
|
||||
import { getAllDictDataFun, getUserPermissionsFun } from '@/utils/common';
|
||||
|
||||
const loading = ref(true);
|
||||
|
||||
onMounted(async () => {
|
||||
await getAllDictDataFun();
|
||||
getUserPermissionsFun();
|
||||
loading.value = false;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -20,11 +20,14 @@ const goPageFun = () => {
|
||||
const { token = '' as any, redirectUrl = '' as any } = route.query;
|
||||
if (redirectUrl && whitePageList.includes(redirectUrl)) {
|
||||
const tokenData = token || localStorage.getItem('TOKEN');
|
||||
localStorage.setItem('YIAN_USER_ID', '1999363561237610497');
|
||||
localStorage.setItem('YIAN_TENANT_ID', '1999362907622948866');
|
||||
localStorage.setItem('TOKEN', tokenData);
|
||||
localStorage.setItem('USER_ID', '1999363561237610497');
|
||||
localStorage.setItem('TENANT_ID', '1999362907622948866');
|
||||
const path: any = redirectUrl;
|
||||
const params = {
|
||||
token: tokenData,
|
||||
userId: '1999363561237610497',
|
||||
tenantId: '1999362907622948866',
|
||||
};
|
||||
verityCidWebTokenApi(params).then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
|
||||
@@ -153,7 +153,14 @@
|
||||
v-if="rightClickNodeInfo?.nodeType === NODE_TYPE.RUN"
|
||||
@click="showDiaFun('createReport')"
|
||||
>
|
||||
<el-icon> <Tickets /> </el-icon>生成报告
|
||||
<el-icon> <Tickets /> </el-icon>导出报告
|
||||
</p>
|
||||
<p
|
||||
class="menuButton"
|
||||
v-if="rightClickNodeInfo?.nodeType === NODE_TYPE.RUN"
|
||||
@click="reportInpDiaShow = true"
|
||||
>
|
||||
<el-icon> <Edit /> </el-icon>编辑报告
|
||||
</p>
|
||||
<p class="menuButton" @click="showDiaFun('showPerformance')">
|
||||
<el-icon> <DataLine /> </el-icon>查看指标
|
||||
@@ -184,6 +191,7 @@
|
||||
</p>
|
||||
</div>
|
||||
</Teleport>
|
||||
<ReportInputDialog v-model="reportInpDiaShow" :data="rightClickNode" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -191,7 +199,7 @@
|
||||
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||
import filterProject from '../filterProject/index.vue';
|
||||
import { NODE_TYPE } from '@/utils/enum/node';
|
||||
import { Folder, Document, ScaleToOriginal } from '@element-plus/icons-vue';
|
||||
import { Folder, Document, ScaleToOriginal, Edit } from '@element-plus/icons-vue';
|
||||
import createRunDiv from './operateComponent/createRunDiv.vue';
|
||||
import {
|
||||
addTaskRunApi,
|
||||
@@ -203,6 +211,7 @@ import {
|
||||
import runVersionTreeDiv from './operateComponent/runVersionTreeDiv.vue';
|
||||
import taskRunPerformance from './operateComponent/taskRunPerformance.vue';
|
||||
import createRunReport from './operateComponent/createRunReport.vue';
|
||||
import ReportInputDialog from '@/components/common/report/reportInputDialog.vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { attentionTaskApi } from '@/api/project/task';
|
||||
import { disposeAttentionParams } from '@/views/task/simulationTask/taskPage';
|
||||
@@ -217,6 +226,7 @@ const showTaskRunPerformanceWindow = ref(false);
|
||||
const showCreateRunReporteWindow = ref(false);
|
||||
const taskTreeRef = ref();
|
||||
const defaultExpandKeys = ref<any>([]);
|
||||
const reportInpDiaShow = ref(false);
|
||||
|
||||
const changeExpendTypeFun = (data: any) => {
|
||||
defaultExpandKeys.value = [];
|
||||
|
||||
Reference in New Issue
Block a user