This commit is contained in:
weibl
2026-01-23 16:12:27 +08:00
6 changed files with 55 additions and 34 deletions

View File

@@ -235,9 +235,14 @@ export const editExperimentResultApi = (params: any) => {
return post(`${PREFIX}run/editExperimentResult`, params);
};
// 算例编辑报告
// 保存算例编辑报告
export const editReportApi = (params: any) => {
return download(`${PREFIX}run/editReport`, params, params.fileName);
return post(`${PREFIX}run/editReport`, params);
};
// 保存并下载算例编辑报告
export const editReportAndDownloadApi = (params: any) => {
return download(`${PREFIX}run/editReportAndDownload`, params, params.fileName);
};
// 算例下编辑报告

View File

@@ -18,7 +18,12 @@
<img :src="item.src" />
</div>
<div class="tip">
<el-input v-model="item.title" placeholder="请输入图例名称" clearable />
<el-input
v-model="item.title"
placeholder="请输入图例名称"
clearable
@input="inputFun"
/>
</div>
<div class="del-btn" @click.stop="delFun(index)">
<el-icon :size="22"><DeleteFilled /></el-icon>
@@ -50,6 +55,7 @@
import { ref, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
import { Picture, DeleteFilled } from '@element-plus/icons-vue';
import Dialog from '@/components/common/dialog/index.vue';
import { cloneDeep } from 'lodash-es';
const emit = defineEmits(['update:keyValue', 'update:value']);
@@ -83,11 +89,11 @@ watch(
);
watch(
() => fileList.value,
() => props.value,
(val: any) => {
emit('update:value', val);
fileList.value = cloneDeep(val);
},
{ deep: true }
{ deep: true, immediate: true }
);
onMounted(() => {
@@ -121,17 +127,10 @@ const delFun = (index: any) => {
PasteContentRef.value.focus();
fileList.value.splice(index, 1);
contenteditable.value = false;
emit('update:value', fileList.value);
});
};
watch(
() => fileList.value,
(val: any) => {
emit('update:value', val);
},
{ deep: true }
);
const pasteFun = (event: any) => {
if (props.disabled) {
return;
@@ -151,6 +150,7 @@ const pasteFun = (event: any) => {
fileList.value.push({
src: base64,
});
emit('update:value', fileList.value);
};
reader.readAsDataURL(file);
break;
@@ -158,6 +158,10 @@ const pasteFun = (event: any) => {
}
};
const inputFun = () => {
emit('update:value', fileList.value);
};
const closeFun = () => {
diaShow.value = false;
};

View File

@@ -58,7 +58,7 @@
</div>
</div>
<div v-else-if="unit.type === 'form'" class="unit">
<Form v-model:value="unit.value" :mode="modeType" :disabled="preview" />
<Form v-model:value="unit.children" :mode="modeType" :disabled="preview" />
<div class="del-btn" @click="delFun(paragraphIndex, gridIndex, unitIndex)">
<el-icon :size="22"><DeleteFilled /></el-icon>
</div>
@@ -310,7 +310,7 @@ const getFormatDataFun = () => {
});
grid.children.forEach((unit: any) => {
if (unit.type === 'form') {
unit.value.forEach((item: any) => {
unit.children.forEach((item: any) => {
build.push({
type: 'text',
key: item.key,

View File

@@ -8,7 +8,7 @@
:label="item.title"
>
<template #default="scope">
<el-input v-model="scope.row[item.key]" clearable />
<el-input v-model="scope.row[item.key]" clearable @input="inputFun" />
</template>
</el-table-column>
<el-table-column v-if="mode === 'input'" prop="actions" label="操作" width="60">
@@ -96,14 +96,6 @@ watch(
{ deep: true }
);
watch(
() => tableData.value,
(val: any) => {
emit('update:value', val);
},
{ deep: true }
);
watch(
() => props.head,
(val: any) => {
@@ -112,6 +104,18 @@ watch(
{ deep: true, immediate: true }
);
watch(
() => props.value,
(val: any) => {
tableData.value = cloneDeep(val);
},
{ deep: true, immediate: true }
);
const inputFun = () => {
emit('update:value', tableData.value);
};
const addFun = () => {
headData.value.push({
title: '',
@@ -121,10 +125,12 @@ const addFun = () => {
const addDataFun = () => {
tableData.value.push({});
emit('update:value', tableData.value);
};
const delDataFun = (index: any) => {
tableData.value.splice(index, 1);
emit('update:value', tableData.value);
};
const delHeadFun = (index: any) => {

View File

@@ -1,7 +1,8 @@
<template>
<Dialog v-model="diaVisible" diaTitle="编辑报告" width="80%" height="90%" @close="closeFun">
<div class="content">
<div v-if="!(historyData?.length > 0)" class="chose-report">
<!-- <div v-if="!(historyData?.length > 0)" class="chose-report"> -->
<div class="chose-report">
<el-select
v-model="reportData"
value-key="uuid"
@@ -21,7 +22,7 @@
v-if="reportFileId"
ref="ReportEditRef"
v-model:data="reportDataContent"
:valueList="valueListData"
:valueList="historyData"
:fileId="reportFileId"
mode="input"
/>
@@ -31,7 +32,10 @@
<template #footer>
<div>
<el-button @click="closeFun">关闭</el-button>
<el-button type="primary" @click="saveFun">确定并下载</el-button>
<el-button type="primary" @click="saveFun(false)" :disabled="!reportFileId">保存</el-button>
<el-button type="primary" @click="saveFun(true)" :disabled="!reportFileId">
保存并下载
</el-button>
</div>
</template>
</Dialog>
@@ -41,7 +45,7 @@
import { ref, watch, nextTick } from 'vue';
import Dialog from '@/components/common/dialog/index.vue';
import { queryReportTemplateApi } from '@/api/capability/report';
import { editReportApi, queryTaskRunApi } from '@/api/project/run';
import { editReportApi, editReportAndDownloadApi, queryTaskRunApi } from '@/api/project/run';
import ReportEdit from '@/components/common/report/reportEdit/index.vue';
import { ElMessage } from 'element-plus';
@@ -73,7 +77,6 @@ const reportDataId = ref<any>('');
const reportDataContent = ref<any>({});
const reportFileId = ref<any>('');
const diaVisible = ref(false);
const valueListData = ref<any>([]);
const initFun = () => {
getReportListFun();
@@ -123,12 +126,11 @@ const setReportDataFun = (data: any) => {
reportDataContent.value = JSON.parse(templateContent);
reportDataId.value = uuid;
reportFileId.value = fileId;
valueListData.value = historyData.value;
});
};
const ReportEditRef = ref<any>();
const saveFun = () => {
const saveFun = (download: boolean) => {
const fileName = reportData.value.templateName + '.docx';
const data = ReportEditRef.value?.getFormatDataFun();
const params = {
@@ -137,7 +139,11 @@ const saveFun = () => {
reportContent: JSON.stringify(data),
fileName,
};
editReportApi(params).then(() => {
let api: any = editReportApi;
if (download) {
api = editReportAndDownloadApi;
}
api(params).then(() => {
ElMessage.success('操作成功');
closeFun();
});

View File

@@ -148,7 +148,7 @@ dayjs.extend(isoWeek);
let Gantt: any = gantt;
const ganttEvents = ref<any>([]);
const colorList: string[] = ['#ffffff', '#d9ecff', '#c6e2ff', '#c6e2ff', '#79bbff', '#409eff']; // 格子颜色
const colorList: string[] = ['#ffffff', '#e9f4ff', '#c6e2ff', '#acd3ff', '#79bbff', '#409eff']; // 格子颜色
const taskOriginData = ref<any>([]); // 所有用户的任务数据
const loading = ref<boolean>(false);
// const workDaysRange = ref<number>(0);