|
|
@@ -167,6 +167,10 @@ Page({
|
|
|
updateData.team = team;
|
|
|
updateData.selectedTrainers = team.filter(t => t._active);
|
|
|
}
|
|
|
+ // 回填 report_content,确保确认完成时能拿到之前保存的值
|
|
|
+ if (d.report_content) {
|
|
|
+ updateData['detail.report_content'] = d.report_content;
|
|
|
+ }
|
|
|
this.setData(updateData);
|
|
|
}).catch(() => {});
|
|
|
},
|
|
|
@@ -551,11 +555,32 @@ Page({
|
|
|
this.setData({ loading: true });
|
|
|
|
|
|
try {
|
|
|
- // 第一步:完成工单(isconfirm: 1)
|
|
|
+ // 第一步:获取天气和日期
|
|
|
+ const now = new Date();
|
|
|
+ const weatherdate = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
|
|
+
|
|
|
+ let weather = '';
|
|
|
+ if (this.data.workpresetjson.logreport == 1) {
|
|
|
+ try {
|
|
|
+ const weatherRes = await _Http.basic({ id: 20231012093701 });
|
|
|
+ if (weatherRes.code == 1 && weatherRes.data && weatherRes.data.real && weatherRes.data.real.weather) {
|
|
|
+ const w = weatherRes.data.real.weather;
|
|
|
+ weather = `${w.info} ${w.temperature}℃`;
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.log('获取天气失败', e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("weather",weather)
|
|
|
+ // 第二步:完成工单(isconfirm: 1),带上天气和日期
|
|
|
const confirmContent = this.buildContent(1);
|
|
|
const confirmRes = await _Http.basic({
|
|
|
id: 2026052615154602,
|
|
|
- content: confirmContent,
|
|
|
+ content: {
|
|
|
+ ...confirmContent,
|
|
|
+ weather,
|
|
|
+ weatherdate,
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
if (confirmRes.code != 1) {
|
|
|
@@ -568,24 +593,7 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 第二步:获取天气数据(仅 logreport 为 1 时)
|
|
|
- let weather = '';
|
|
|
- if (this.data.workpresetjson.logreport == 1) {
|
|
|
- try {
|
|
|
- const weatherRes = await _Http.basic({ id: 20231012093701 });
|
|
|
- if (weatherRes.code == 1 && weatherRes.data && weatherRes.data.weather) {
|
|
|
- const w = weatherRes.data.weather;
|
|
|
- weather = `${w.info} ${w.temperature}℃`;
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.log('获取天气失败', e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 第三步:保存工序,带上天气和日期信息
|
|
|
- const now = new Date();
|
|
|
- const weatherdate = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
|
|
|
-
|
|
|
+ // 第三步:保存工序 report_content,带上天气和日期信息
|
|
|
// report_content 优先取原本返回的,再把天气和日期替换进去
|
|
|
const originalReportContent = this.data.detail.report_content || {};
|
|
|
|