diff --git a/pages-sub/daily/maintain-manage/finish-plan-detail.vue b/pages-sub/daily/maintain-manage/finish-plan-detail.vue index 2622c4b..a2568b4 100644 --- a/pages-sub/daily/maintain-manage/finish-plan-detail.vue +++ b/pages-sub/daily/maintain-manage/finish-plan-detail.vue @@ -85,11 +85,7 @@ --> - + + + @@ -108,6 +110,11 @@ title="" > + @@ -199,8 +206,8 @@ const previewImage = (currentUrl, allUrls) => { /** * 获取工单详情 */ -const getOrderDetail = async (planNo: string, commitId?: string, workRecordIndex: number = 0) => { - console.log('===传入的workRecordIndex===', workRecordIndex) +const getOrderDetail = async (planNo: string, commitId?: string) => { + console.log('getOrderDetail') try { loading.value = true; let queryData: any = { @@ -216,21 +223,13 @@ const getOrderDetail = async (planNo: string, commitId?: string, workRecordIndex const list = res.data?.list || res.list || []; 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 - } - } + // ✅直接使用接口返回的 item.fields,不再读取 workRecords + const useValues = Array.isArray(item.fields) ? item.fields : [] return { ...item, - // ✅这里直接拿 workRecords[index].values,传给buildFieldRow渲染 fieldRows: useValues.map(buildFieldRow) } }) - } catch (error) { console.error('获取工单详情失败:', error); uni.showToast({title: '加载失败,请重试', icon: 'none'}); @@ -241,6 +240,7 @@ const getOrderDetail = async (planNo: string, commitId?: string, workRecordIndex + // ========== 动态配置字段(fieldValue)展示 ========== // 解析口径与 PC 端 FieldValueCell.vue + WorkRecordTab.vue 保持一致: // 后端 valueText 是「类型无关直拷、提交无校验」,历史格式与脏数据都可能出现,故所有解析一律降级、不抛异常。 @@ -540,16 +540,15 @@ const openGeo = (geo) => { // const workRecordIndex = ref(0) // 页面加载 onLoad((options) => { - const {planNo, commitId ,index} = options; - console.log("load:"+index) - const workRecordIndex= Number(index) + const {planNo, commitId } = options; if (planNo) { - getOrderDetail(planNo, commitId,workRecordIndex); + getOrderDetail(planNo, commitId); } else { loading.value = false; uni.showToast({title: '缺少工单ID', icon: 'none'}); } }); +