diff --git a/common/config/env.js b/common/config/env.js
index 9f3e623..ae149a1 100644
--- a/common/config/env.js
+++ b/common/config/env.js
@@ -2,12 +2,12 @@
const env = {
// 开发环境
development: {
- baseUrl: 'http://192.168.1.55:48081',
+ baseUrl: 'https://test.jichengshanshui.com.cn:28302',
// https://test.jichengshanshui.com.cn:28302
// baseUrl: 'http://192.168.1.111:48081',
- uploadUrl: 'http://192.168.1.55:48081',
+ uploadUrl: 'https://test.jichengshanshui.com.cn:28302',
// baseApi:'admin-api',
// appApi:'app-api'
},
diff --git a/pages-sub/daily/maintain-manage/finish-plan-detail.vue b/pages-sub/daily/maintain-manage/finish-plan-detail.vue
index 8a2cbd3..2622c4b 100644
--- a/pages-sub/daily/maintain-manage/finish-plan-detail.vue
+++ b/pages-sub/daily/maintain-manage/finish-plan-detail.vue
@@ -199,10 +199,10 @@ const previewImage = (currentUrl, allUrls) => {
/**
* 获取工单详情
*/
-const getOrderDetail = async (planNo: string, commitId?: string) => {
+const getOrderDetail = async (planNo: string, commitId?: string, workRecordIndex: number = 0) => {
+ console.log('===传入的workRecordIndex===', workRecordIndex)
try {
loading.value = true;
- // 后端 page 接口支持 commitId 精确过滤:从上报记录列表点「查看」时只展示这一条
let queryData: any = {
planNo: planNo,
pageSize: commitId ? 1 : 100,
@@ -213,17 +213,24 @@ const getOrderDetail = async (planNo: string, commitId?: string) => {
}
const res = await detailList(queryData);
console.log('接口返回:', res);
-
- // 修复2:正确解析接口数据(res.data.list 而非 res.list)
const list = res.data?.list || res.list || [];
- // 预解析动态字段,避免模板里重复 JSON.parse
- orderDetail.value = list.map(item => ({
- ...item,
- fieldRows: (item.fields || []).map(buildFieldRow)
- }));
-
- // 调试:打印格式化后的图片URL
- console.log('格式化后图片URL:', formatImageUrls(orderDetail.value[0]?.beginImgList || []));
+
+ orderDetail.value = list.map(item => {
+ let useValues: any[] = []
+ // 取 workRecords 指定下标的 values
+ if (Array.isArray(item.workRecords) && item.workRecords.length > 0) {
+ const targetRecord = item.workRecords[workRecordIndex];
+ if (targetRecord && Array.isArray(targetRecord.values)) {
+ useValues = targetRecord.values
+ }
+ }
+ return {
+ ...item,
+ // ✅这里直接拿 workRecords[index].values,传给buildFieldRow渲染
+ fieldRows: useValues.map(buildFieldRow)
+ }
+ })
+
} catch (error) {
console.error('获取工单详情失败:', error);
uni.showToast({title: '加载失败,请重试', icon: 'none'});
@@ -232,6 +239,8 @@ const getOrderDetail = async (planNo: string, commitId?: string) => {
}
};
+
+
// ========== 动态配置字段(fieldValue)展示 ==========
// 解析口径与 PC 端 FieldValueCell.vue + WorkRecordTab.vue 保持一致:
// 后端 valueText 是「类型无关直拷、提交无校验」,历史格式与脏数据都可能出现,故所有解析一律降级、不抛异常。
@@ -528,12 +537,14 @@ const openGeo = (geo) => {
fail: () => uni.showToast({title: '地图打开失败', icon: 'none'})
});
};
-
+ // const workRecordIndex = ref(0)
// 页面加载
onLoad((options) => {
- const {planNo, commitId} = options;
+ const {planNo, commitId ,index} = options;
+ console.log("load:"+index)
+ const workRecordIndex= Number(index)
if (planNo) {
- getOrderDetail(planNo, commitId);
+ getOrderDetail(planNo, commitId,workRecordIndex);
} else {
loading.value = false;
uni.showToast({title: '缺少工单ID', icon: 'none'});
diff --git a/pages-sub/daily/maintain-manage/now-list-page.vue b/pages-sub/daily/maintain-manage/now-list-page.vue
index 940acc9..6651162 100644
--- a/pages-sub/daily/maintain-manage/now-list-page.vue
+++ b/pages-sub/daily/maintain-manage/now-list-page.vue
@@ -10,7 +10,7 @@
【第{{ item.sortNum || (index + 1) }}次上报】{{ planName }}
提交时间:{{ timeFormat(item.createTime,'yyyy-mm-dd hh:MM:ss')}}
- 查看
+ 查看
@@ -92,11 +92,12 @@ const getReportList = async () => {
}
}
// 查看上报详情
-const handleView = (item,i) => {
+const handleView = (index,item,i) => {
console.log('查看详情', item)
+ console.log('查看详情', index)
uni.navigateTo({
// 后端 page 接口支持 commitId 精确过滤,必须带上,否则会把该计划全部上报都展示出来
- url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${i.planNo}&commitId=${i.commitId}`
+ url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${i.planNo}&commitId=${i.commitId}&index=${index}`
})
}
// 新增上报记录,把planNo + currentCommitId带到新增页面
diff --git a/pages-sub/daily/maintain-manage/type-list-page.vue b/pages-sub/daily/maintain-manage/type-list-page.vue
index 5c02c7e..ac4aa59 100644
--- a/pages-sub/daily/maintain-manage/type-list-page.vue
+++ b/pages-sub/daily/maintain-manage/type-list-page.vue
@@ -23,9 +23,9 @@
- 完成次数:{{ item.planFinishNum }}次
+ 完成次数:{{ item.planFinishNum }}次
任务次数:第{{ item.planFinishNum +1 }}次
-
+
去作业
去查看
@@ -37,8 +37,8 @@
有效期:{{ timeFormat(item.beginTime, 'yyyy-mm-dd') }}—{{
timeFormat(item.endTime, 'yyyy-mm-dd') }}
-
-
+ 结束任务
@@ -66,7 +66,6 @@ import { onShow, onUnload, onLoad } from '@dcloudio/uni-app'
import { useUserStore } from '@/pinia/user';
import { maintainPlanNum, finishPlan, invalidatePlan, maintainCreate } from "@/api/maintain-manage/maintain-manage";
import { timeFormat } from '@/uni_modules/uview-plus';
-
/** 获取当天日期 yyyy-MM-dd */
const getTodayStr = () => {
const d = new Date()
@@ -101,7 +100,6 @@ const currentInvalidItem = ref(null)
// ===================== 结束任务确认弹窗 =====================
const endTaskModalShow = ref(false)
const currentEndTaskItem = ref(null)
-
// 加载数据,根据当前activeStatus动态调用接口
const loadData = async () => {
console.log('123123')
@@ -150,7 +148,7 @@ const loadData = async () => {
allTotalData.value = tempResult
} catch (err) {
console.error('批量请求接口异常', err)
- uni.showToast({ title: '数据加载失败', icon: 'none' })
+ uni.showToast({ title: err.msg || '数据加载失败', icon: 'none', duration:2000 })
} finally {
uni.hideLoading()
pagingRef.value?.reload()
@@ -193,7 +191,7 @@ const confirmSetInvalid = async () => {
const item = currentInvalidItem.value
console.log(currentInvalidItem.value)
if (!item) {
- uni.showToast({ title: '数据异常', icon: 'none' })
+ uni.showToast({ title: '数据异常', icon: 'none', duration:2000 })
return
}
uni.showLoading({ title: '提交中...', mask: true })
@@ -213,25 +211,25 @@ const confirmSetInvalid = async () => {
targetCommitId = createRes && typeof createRes === 'object' ? createRes.id : createRes
if (!targetCommitId) {
uni.hideLoading()
- uni.showToast({ title: '创建养护草稿失败,无法置为失效', icon: 'none' })
+ uni.showToast({ title: '创建养护草稿失败,无法置为失效', icon: 'none', duration:2000 })
return
}
}
-
const params = {
commitId: targetCommitId,
+ invalidReason: '管理员手动置为失效',
+ invalidFiles: ''
}
console.log('置为失效提交参数:', params)
- console.log(params.commitId)
- await invalidatePlan({ commitId: params.commitId })
- uni.showToast({ title: '操作成功', icon: 'success' })
+ await invalidatePlan(params)
+ uni.showToast({ title: '操作成功', icon: 'success', duration:2000 })
handleInvalidModalCancel()
// 重新加载数据刷新列表
await loadData()
pagingRef.value?.reload()
} catch (err) {
console.error(err)
- uni.showToast({ title: '提交失败,请重试', icon: 'none' })
+ uni.showToast({ title: err?.msg || '提交失败,请重试', icon: 'none', duration:2000 })
} finally {
uni.hideLoading()
}
@@ -248,8 +246,6 @@ const handleGoWorkLook = (item) => {
url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo}&planTypeId=${planTypeId.value}&businessType=${item.busiLine}&isView=${isView}`
})
}
-
-
const handleEndTask = async (item) => {
currentEndTaskItem.value = item
endTaskModalShow.value = true
@@ -259,23 +255,43 @@ const handleEndTaskModalCancel = () => {
endTaskModalShow.value = false
currentEndTaskItem.value = null
}
-// 确认结束任务,真正调用接口
+// ✅改造confirmEndTask:没有commitId先maintainCreate,和置为失效逻辑保持一致
const confirmEndTask = async () => {
const item = currentEndTaskItem.value
- if (!item || !item.commitId) return
+ if (!item) {
+ uni.showToast({ title: '数据异常', icon: 'none', duration:2000 })
+ return
+ }
endTaskModalShow.value = false
uni.showLoading({ title: '提交中...', mask: true })
try {
- await finishPlan({ commitId: item.commitId })
+ let targetCommitId = item.commitId
+ // 不存在commitId,先创建草稿
+ if (!targetCommitId) {
+ const submitData = {
+ planNo: item.planNo,
+ imgHost: '1',
+ beginImg: [],
+ commonUserList: [],
+ remark: ''
+ }
+ const createRes: any = await maintainCreate(submitData)
+ targetCommitId = createRes && typeof createRes === 'object' ? createRes.id : createRes
+ if (!targetCommitId) {
+ uni.hideLoading()
+ uni.showToast({ title: '创建养护草稿失败,无法结束任务', icon: 'none', duration:2000 })
+ return
+ }
+ }
+ await finishPlan({ commitId: targetCommitId })
uni.hideLoading()
- uni.showToast({ title: '结束任务成功', icon: 'success' })
+ uni.showToast({ title: '结束任务成功', icon: 'success', duration:2000 })
await loadData()
pagingRef.value?.reload()
} catch (err) {
console.error('结束任务失败', err)
uni.hideLoading()
- if (err && err.msg) return
- uni.showToast({ title: '结束任务失败,请重试', icon: 'none' })
+ uni.showToast({ title: err?.msg || '结束任务失败,请重试', icon: 'none', duration:2000 })
} finally {
currentEndTaskItem.value = null
}