diff --git a/pages-sub/daily/maintain-manage/finish-plan-detail.vue b/pages-sub/daily/maintain-manage/finish-plan-detail.vue index 8fd821f..ac7399b 100644 --- a/pages-sub/daily/maintain-manage/finish-plan-detail.vue +++ b/pages-sub/daily/maintain-manage/finish-plan-detail.vue @@ -14,6 +14,10 @@ {{i.planName || '--'}} + + + 第 {{ i.sortNum }} 次 · {{ commitStateText(i.commitState) }} + @@ -95,56 +99,66 @@ 提交时间: {{ i.createTime==null?'--':timeFormat(i.createTime,'yyyy-mm-dd hh:MM:ss') }} + + + + 失效原因: + {{ i.invalidReason || '--' }} + - - - - - - - 养护填报内容 - - - {{ f.name }} - - - - - - {{ t.text }} - - - - {{ file.name }} - - - {{ f.text }} - - {{ f.text }} - - {{ f.text }} - - - - - - 直接结束了本次任务 - + + + + + {{ i.commitState === 3 ? '本次养护已置为失效,未填写养护内容' : '直接结束了本次任务' }} + @@ -195,18 +209,34 @@ const previewImage = (currentUrl, allUrls) => { }); }; +/** 上报状态文案:1进行中/2已完成/3已失效 */ +const commitStateText = (state) => { + if (state === 1) return '进行中' + if (state === 2) return '已完成' + if (state === 3) return '已失效' + return '--' +}; + /** * 获取工单详情 + * 传 batchNo 时返回该批次下所有期次的上报记录(一次一条期次,多次提交要全部列出); + * 只传 planNo 时仍按计划编码查单条,兼容原入口。 */ -const getOrderDetail = async (planNo: string, commitId?: string) => { +const getOrderDetail = async (planNo: string, commitId?: string, batchNo?: string) => { console.log('getOrderDetail') try { loading.value = true; let queryData: any = { - planNo: planNo, pageSize: commitId ? 1 : 100, pageNo: 1, }; + // 计划编码 + 批次号同时带上:只查当前这一期次(planNo)的提交记录,批次号用于限定范围 + if (planNo) { + queryData.planNo = planNo; + } + if (batchNo) { + queryData.batchNo = batchNo; + } if (commitId) { queryData.commitId = commitId; } @@ -214,12 +244,25 @@ const getOrderDetail = async (planNo: string, commitId?: string) => { console.log('接口返回:', res); const list = res.data?.list || res.list || []; + // 按批次查看时按「第几次」正序,读起来和 App 列表一致 + if (batchNo) { + list.sort((a, b) => Number(a.sortNum || 0) - Number(b.sortNum || 0)); + } + orderDetail.value = list.map(item => { - // ✅直接使用接口返回的 item.fields,不再读取 workRecords + // 一次养护可能有多次子上报(workRecords),每次上报有自己的字段值,逐条展示; + // 历史数据(双写上线前)没有 workRecords,退回用 item.fields 当唯一一条记录。 const useValues = Array.isArray(item.fields) ? item.fields : [] + const workRecords = Array.isArray(item.workRecords) && item.workRecords.length + ? item.workRecords + : [{ workTime: item.createTime, values: useValues }] return { ...item, - fieldRows: useValues.map(buildFieldRow) + // 每条子上报一行自己的字段渲染结果,模板里一条记录一张卡 + recordRows: workRecords.map(record => ({ + workTime: record?.workTime ?? item.createTime, + fieldRows: (Array.isArray(record?.values) ? record.values : []).map(buildFieldRow) + })) } }) } catch (error) { @@ -532,9 +575,9 @@ const openGeo = (geo) => { // const workRecordIndex = ref(0) // 页面加载 onLoad((options) => { - const {planNo, commitId } = options; - if (planNo) { - getOrderDetail(planNo, commitId); + const {planNo, commitId, batchNo } = options; + if (planNo || batchNo) { + getOrderDetail(planNo, commitId, batchNo); } else { loading.value = false; uni.showToast({title: '缺少工单ID', icon: 'none'}); @@ -582,7 +625,9 @@ onLoad((options) => { // 计划名称标题卡:白底 / 8px 圆角 / 卡片阴影 / 32rpx 500(设计稿顶部卡) .record-head { display: flex; - align-items: center; + flex-direction: column; + align-items: flex-start; + gap: 8rpx; margin: 0 24rpx 24rpx; padding: 24rpx; background: #ffffff; @@ -590,6 +635,13 @@ onLoad((options) => { box-shadow: 0 4rpx 16rpx rgba(17, 24, 39, 0.06); } +// 标题卡副标题:第X次 + 上报状态 +.record-sub { + font-size: 26rpx; + color: #6B7280; + line-height: 1.4; +} + .record-title { flex: 1; min-width: 0; @@ -625,6 +677,21 @@ onLoad((options) => { line-height: 1.4; } +/* 区块标题右侧:多条上报时标注第几条 + 上报时间 */ +.sec-count { + margin-left: auto; + font-size: 24rpx; + color: #9CA3AF; + white-space: nowrap; +} + +/* 某条子上报没填字段时的占位文案 */ +.no-field-tip { + font-size: 26rpx; + color: #9CA3AF; + padding: 8rpx 0; +} + // 图片容器样式 .cell-content-wrap { //padding: 10rpx 0; diff --git a/pages-sub/daily/maintain-manage/index.vue b/pages-sub/daily/maintain-manage/index.vue index 32fdd71..3d65c63 100644 --- a/pages-sub/daily/maintain-manage/index.vue +++ b/pages-sub/daily/maintain-manage/index.vue @@ -91,9 +91,6 @@ - - 养护任务 - diff --git a/pages-sub/daily/maintain-manage/type-list-page.vue b/pages-sub/daily/maintain-manage/type-list-page.vue index b855642..924693a 100644 --- a/pages-sub/daily/maintain-manage/type-list-page.vue +++ b/pages-sub/daily/maintain-manage/type-list-page.vue @@ -14,14 +14,11 @@ - {{ item.planName || '无计划名称' }} - - - - 任务次数 - 完成 {{ item.planFinishNum }} 次 - - 第 {{ item.planNum === 1 ? (item.sortNum || 1) : (item.planFinishNum + 1) }} 次 + + {{ item.planName || '无计划名称' }} + + 计划编码:{{ item.planNo }} + @@ -31,6 +28,16 @@ timeFormat(item.endTime, 'yyyy-mm-dd') }} + + + 任务次数 + + + 有效期内第 {{ item.sortNum || 1 }} 个任务,共提交 {{ item.submitCount || 0 }} 次 + + + 第 {{ item.planNum === 1 ? (item.sortNum || 1) : (item.planFinishNum + 1) }} 次 + @@ -326,8 +333,11 @@ const handleGoWork = (item) => { } const handleGoWorkLook = (item) => { const isView = activeStatus.value + // 已完成:一次一条期次,传批次号让详情页把该批次所有期次的上报记录一起列出来; + // 已失效:只看向被置为失效的那一次,仍按计划编码查单条。 + const batchParam = activeStatus.value === '2' && item.batchNo ? `&batchNo=${item.batchNo}` : '' uni.navigateTo({ - url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo}&planTypeId=${planTypeId.value}&businessType=${item.busiLine}&isView=${isView}` + url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo}&planTypeId=${planTypeId.value}&businessType=${item.busiLine}&isView=${isView}${batchParam}` }) } const handleEndTask = async (item) => { @@ -408,22 +418,31 @@ onUnload(() => { display: flex; align-items: center; gap: 16rpx; - margin-bottom: 16rpx; + /* 与 .plan-no / .info-row 的间距保持一致,卡内文字行上下距离统一 */ + margin-bottom: 8rpx; } -.plan-name { +.plan-name-wrap { flex: 1; min-width: 0; +} +.plan-name { font-size: 32rpx; color: #1F2937; font-weight: 500; line-height: 1.4; } +.plan-no { + margin-top: 8rpx; + font-size: 24rpx; + color: #9CA3AF; + line-height: 1.4; +} .info-row { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; - margin-bottom: 6rpx; + margin-bottom: 8rpx; } .info-label { font-size: 26rpx; diff --git a/pages-sub/daily/maintain-manage/type-list.vue b/pages-sub/daily/maintain-manage/type-list.vue index 4c44760..cc1343c 100644 --- a/pages-sub/daily/maintain-manage/type-list.vue +++ b/pages-sub/daily/maintain-manage/type-list.vue @@ -1,15 +1,15 @@