提交 ccbb5382 authored 作者: 张伊明's avatar 张伊明

智能写报更新

上级 4986aeb7
......@@ -146,6 +146,47 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', {
}
},
// ========== 获取政令基础信息 (翻译栏数据) ==========
async fetchOrderBaseInfo(orderId) {
try {
const response = await fetch('/reportData/get-order-base-info', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ order_id: Number(orderId) })
});
const data = await response.json();
if (data.status === 'success' && data.result) {
const res = data.result;
// 1. 填充元数据 (用于翻译栏顶部的标题卡片)
this.pdfMetadata = {
name: res.order_name_zh,
order_title: res.order_name,
signing_date: res.post_date
};
// 2. 填充条款翻译内容
this.clauseTranslationMessages = (res.clauses || []).map(item => ({
event: 'clause_translation',
payload: {
clause_number: item.section_num,
clause_section: item.section_num, // 这里根据结构复用 section_num
clause_content: item.section_text,
clause_content_zh: item.section_text_zh
}
}));
// 3. 自动展示翻译栏
this.isShowClauseTranslation = true;
this.isShowSteps = true;
console.log('政令基础信息获取并回填成功:', res);
}
} catch (error) {
console.error('获取政令基础信息失败:', error);
}
},
// ========== 获取业务数据并触发生成 (业务封装) ==========
async fetchOrderReportData(orderId) {
await this._fetchBusinessData({
......@@ -409,7 +450,7 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', {
this.isShowProcess = true;
if (Object.keys(this.routeQuery).length !== 0) {
const { fileId, topic } = this.routeQuery;
const { fileId } = this.routeQuery;
// 外部跳转:根据 topic 决定调用哪种数据获取接口,再触发生成
if (fileId) {
......@@ -418,6 +459,8 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', {
} else if (this.curTempTitle === '清单') {
await this.fetchListReportData(fileId);
} else {
// 政令:先获取基础信息(用于翻译栏),再获取写报数据并生成
await this.fetchOrderBaseInfo(fileId);
await this.fetchOrderReportData(fileId);
}
return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论