Commit 6847fb738acf1f94440161cc900f584eeea8c8a3

Authored by 刘淇
1 parent a4ce4276

置为失效

api/maintain-manage/maintain-manage.js
@@ -76,7 +76,7 @@ export const getDetailList = (params) => { @@ -76,7 +76,7 @@ export const getDetailList = (params) => {
76 * @returns {Promise} 76 * @returns {Promise}
77 */ 77 */
78 export const maintainPlan= (params) => { 78 export const maintainPlan= (params) => {
79 - return get('/admin-api/garden/maintain-plan/page',params); 79 + return get('/app-api/app/garden/maintain-plan-today/page',params);
80 }; 80 };
81 /** 81 /**
82 * 养护类型次数 82 * 养护类型次数
@@ -111,7 +111,8 @@ export const finishPlan= (params = {}) => { @@ -111,7 +111,8 @@ export const finishPlan= (params = {}) => {
111 * @returns {Promise} 111 * @returns {Promise}
112 */ 112 */
113 export const invalidatePlan= (params) => { 113 export const invalidatePlan= (params) => {
114 - return put('/admin-api/garden/maintain-plan-detail/invalidate',params); 114 + const commitId = params && params.commitId != null ? params.commitId : '';
  115 + return post(`/admin-api/garden/maintain-plan-detail/invalidate?commitId=${encodeURIComponent(commitId)}`,params);
115 }; 116 };
116 117
117 118
pages-sub/daily/maintain-manage/add-record.vue
@@ -157,6 +157,7 @@ import { getByType, getOptionsByCode, getMaterialByCode, workRecordSubmit } from @@ -157,6 +157,7 @@ import { getByType, getOptionsByCode, getMaterialByCode, workRecordSubmit } from
157 export default { 157 export default {
158 data() { 158 data() {
159 return { 159 return {
  160 + commitId:'',
160 submitting: false, 161 submitting: false,
161 imagesList: [], 162 imagesList: [],
162 initProgress: 0, 163 initProgress: 0,
@@ -229,8 +230,11 @@ export default { @@ -229,8 +230,11 @@ export default {
229 onLoad(option) { 230 onLoad(option) {
230 console.log('页面参数:', option) 231 console.log('页面参数:', option)
231 this.paramsOptins = option 232 this.paramsOptins = option
232 - const { businessType, planTypeId } = option 233 + const { businessType, planTypeId,commitId } = option
233 this.loadDynamicFields(businessType, planTypeId) 234 this.loadDynamicFields(businessType, planTypeId)
  235 + if(commitId){
  236 + this.commitId = commitId
  237 + }
234 }, 238 },
235 onReady() { 239 onReady() {
236 this.$refs.inspectFormRef.setRules(this.inspectFormRules) 240 this.$refs.inspectFormRef.setRules(this.inspectFormRules)
pages-sub/daily/maintain-manage/index.vue
@@ -92,10 +92,10 @@ @@ -92,10 +92,10 @@
92 <view class="u-body-item-title">道路名称:</view> 92 <view class="u-body-item-title">道路名称:</view>
93 <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view> 93 <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view>
94 </view> 94 </view>
95 - <view class="u-body-item u-flex"> 95 + <!-- <view class="u-body-item u-flex">
96 <view class="u-body-item-title">计划名称:</view> 96 <view class="u-body-item-title">计划名称:</view>
97 <view class="u-line-1 u-body-value">{{ item.planName || '-' }}</view> 97 <view class="u-line-1 u-body-value">{{ item.planName || '-' }}</view>
98 - </view> 98 + </view> -->
99 99
100 100
101 <!-- <view class="u-body-item u-flex"> 101 <!-- <view class="u-body-item u-flex">
@@ -307,7 +307,7 @@ const goToDetail = (item) =&gt; { @@ -307,7 +307,7 @@ const goToDetail = (item) =&gt; {
307 // }) 307 // })
308 308
309 uni.navigateTo({ 309 uni.navigateTo({
310 - url: `/pages-sub/daily/maintain-manage/type-list?roadName=${encodeURIComponent(item.roadName)}&levelId=${item.levelId}` 310 + url: `/pages-sub/daily/maintain-manage/type-list?roadName=${encodeURIComponent(item.roadName)}&planTypeId=${item.planTypeId}`
311 }) 311 })
312 312
313 } 313 }
pages-sub/daily/maintain-manage/now-list-page.vue
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 一个任务可提交多次上报记录,每一次作业需如实上报。 5 一个任务可提交多次上报记录,每一次作业需如实上报。
6 </view> 6 </view>
7 <!-- 上报记录列表 --> 7 <!-- 上报记录列表 -->
8 - <view class="list-wrap" v-if="reportList.length > 0">  
9 - <view class="report-item" v-for="(item, index) in reportList" :key="index">  
10 - <view class="item-title">【第{{ item.sortNum || (index + 1) }}次上报】{{ item.planName }}</view> 8 + <view class="list-wrap" v-if="dataList.length > 0">
  9 + <view class="report-item" v-for="(item, index) in dataList" :key="index">
  10 + <view class="item-title">【第{{ item.sortNum || (index + 1) }}次上报】{{ planName }}</view>
11 <view class="item-row item-row-bottom"> 11 <view class="item-row item-row-bottom">
12 - <view class="item-time">提交时间:{{ timeFormat(item.createTime,'yyyy-mm-dd')}}</view> 12 + <view class="item-time">提交时间:{{ timeFormat(item.createTime,'yyyy-mm-dd hh:MM:ss')}}</view>
13 <view class="look-btn" @click="handleView(item)">查看</view> 13 <view class="look-btn" @click="handleView(item)">查看</view>
14 </view> 14 </view>
15 </view> 15 </view>
@@ -30,11 +30,17 @@ import { onShow, onLoad } from &#39;@dcloudio/uni-app&#39; @@ -30,11 +30,17 @@ import { onShow, onLoad } from &#39;@dcloudio/uni-app&#39;
30 import { maintainPlanList } from "@/api/maintain-manage/maintain-manage"; 30 import { maintainPlanList } from "@/api/maintain-manage/maintain-manage";
31 import {timeFormat} from '@/uni_modules/uview-plus'; 31 import {timeFormat} from '@/uni_modules/uview-plus';
32 // 上报记录数据 32 // 上报记录数据
  33 +const dataList = ref<any[]>([])
33 const reportList = ref<any[]>([]) 34 const reportList = ref<any[]>([])
  35 +
34 let planNo = ref('') 36 let planNo = ref('')
35 let planTypeId = ref('') 37 let planTypeId = ref('')
36 let businessType = ref('') 38 let businessType = ref('')
  39 +let planName = ref('')
37 let isView = ref(true) 40 let isView = ref(true)
  41 +// 存储commitState=1对应的commitId,没有则为空字符串
  42 +const currentCommitId = ref('')
  43 +
38 // onLoad接收url传过来的planNo 44 // onLoad接收url传过来的planNo
39 onLoad((options) => { 45 onLoad((options) => {
40 if (options.planNo) { 46 if (options.planNo) {
@@ -42,13 +48,11 @@ onLoad((options) =&gt; { @@ -42,13 +48,11 @@ onLoad((options) =&gt; {
42 planTypeId.value = options.planTypeId 48 planTypeId.value = options.planTypeId
43 businessType.value = options.businessType 49 businessType.value = options.businessType
44 isView.value = options.isView 50 isView.value = options.isView
45 - // planTypeId=${item.planTypeId}&businessType=${item.busiLine}  
46 getReportList() 51 getReportList()
47 } else { 52 } else {
48 uni.showToast({ title: 'planNo参数缺失', icon: 'none' }) 53 uni.showToast({ title: 'planNo参数缺失', icon: 'none' })
49 } 54 }
50 }) 55 })
51 -  
52 // 请求上报记录接口 56 // 请求上报记录接口
53 const getReportList = async () => { 57 const getReportList = async () => {
54 console.log('3123') 58 console.log('3123')
@@ -62,7 +66,24 @@ const getReportList = async () =&gt; { @@ -62,7 +66,24 @@ const getReportList = async () =&gt; {
62 } 66 }
63 const res = await maintainPlanList(data) 67 const res = await maintainPlanList(data)
64 // 接口返回list,无数据则reportList为空,页面自动显示empty 68 // 接口返回list,无数据则reportList为空,页面自动显示empty
65 - reportList.value = res?.list || [] 69 + dataList.value = res?.list[0].workRecords
  70 + planName.value = res?.list[0].planName
  71 + reportList.value = res?.list || []
  72 +
  73 +
  74 +
  75 + // ============ 新增逻辑:寻找commitState ===1 的commitId ============
  76 + currentCommitId.value = ''
  77 + if(reportList.value.length > 0){
  78 + // 找到第一条 commitState ===1 的数据
  79 + const activeItem = reportList.value.find(item => item.commitState === 1)
  80 + if(activeItem){
  81 + currentCommitId.value = activeItem.commitId || ''
  82 + }
  83 + // 没有找到 activeItem,currentCommitId保持 ''
  84 + }
  85 + // reportList为空直接 currentCommitId=''
  86 +
66 } catch (err) { 87 } catch (err) {
67 console.error('获取上报记录失败', err) 88 console.error('获取上报记录失败', err)
68 uni.showToast({ title: '加载失败', icon: 'none' }) 89 uni.showToast({ title: '加载失败', icon: 'none' })
@@ -70,7 +91,6 @@ const getReportList = async () =&gt; { @@ -70,7 +91,6 @@ const getReportList = async () =&gt; {
70 uni.hideLoading() 91 uni.hideLoading()
71 } 92 }
72 } 93 }
73 -  
74 // 查看上报详情 94 // 查看上报详情
75 const handleView = (item) => { 95 const handleView = (item) => {
76 console.log('查看详情', item) 96 console.log('查看详情', item)
@@ -79,11 +99,11 @@ const handleView = (item) =&gt; { @@ -79,11 +99,11 @@ const handleView = (item) =&gt; {
79 url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo}&commitId=${item.commitId}` 99 url: `/pages-sub/daily/maintain-manage/finish-plan-detail?planNo=${item.planNo}&commitId=${item.commitId}`
80 }) 100 })
81 } 101 }
82 -// 新增上报记录,把planNo带到新增页面 102 +// 新增上报记录,把planNo + currentCommitId带到新增页面
83 const handleAddReport = () => { 103 const handleAddReport = () => {
84 - console.log('上报本次记录') 104 + console.log('上报本次记录', currentCommitId.value)
85 uni.navigateTo({ 105 uni.navigateTo({
86 - url: `/pages-sub/daily/maintain-manage/add-record?planNo=${planNo.value}&planTypeId=${planTypeId.value}&businessType=${businessType.value}` 106 + url: `/pages-sub/daily/maintain-manage/add-record?planNo=${planNo.value}&planTypeId=${planTypeId.value}&businessType=${businessType.value}&commitId=${currentCommitId.value}`
87 }) 107 })
88 } 108 }
89 </script> 109 </script>
@@ -93,7 +113,6 @@ const handleAddReport = () =&gt; { @@ -93,7 +113,6 @@ const handleAddReport = () =&gt; {
93 padding-bottom: 120rpx; // 给底部按钮预留空间 113 padding-bottom: 120rpx; // 给底部按钮预留空间
94 background: #ffffff; 114 background: #ffffff;
95 } 115 }
96 -  
97 // 顶部黄色提示条 116 // 顶部黄色提示条
98 .tip-bar { 117 .tip-bar {
99 background-color: #f9e0a2; 118 background-color: #f9e0a2;
@@ -102,45 +121,37 @@ const handleAddReport = () =&gt; { @@ -102,45 +121,37 @@ const handleAddReport = () =&gt; {
102 padding: 24rpx 20rpx; 121 padding: 24rpx 20rpx;
103 line-height: 1.5; 122 line-height: 1.5;
104 } 123 }
105 -  
106 .list-wrap { 124 .list-wrap {
107 padding: 0; 125 padding: 0;
108 } 126 }
109 -  
110 .report-item { 127 .report-item {
111 padding: 30rpx 24rpx; 128 padding: 30rpx 24rpx;
112 border-bottom: 1rpx solid #eee; 129 border-bottom: 1rpx solid #eee;
113 -  
114 .item-title { 130 .item-title {
115 font-size: 32rpx; 131 font-size: 32rpx;
116 color: #222; 132 color: #222;
117 font-weight: 500; 133 font-weight: 500;
118 margin-bottom: 20rpx; 134 margin-bottom: 20rpx;
119 } 135 }
120 -  
121 .item-row { 136 .item-row {
122 font-size: 28rpx; 137 font-size: 28rpx;
123 color: #555; 138 color: #555;
124 margin-bottom: 12rpx; 139 margin-bottom: 12rpx;
125 } 140 }
126 -  
127 .item-row-bottom { 141 .item-row-bottom {
128 display: flex; 142 display: flex;
129 justify-content: space-between; 143 justify-content: space-between;
130 align-items: center; 144 align-items: center;
131 margin-bottom: 0; 145 margin-bottom: 0;
132 } 146 }
133 -  
134 .look-btn { 147 .look-btn {
135 font-size: 28rpx; 148 font-size: 28rpx;
136 color: #1989fa; 149 color: #1989fa;
137 } 150 }
138 } 151 }
139 -  
140 .empty-wrap { 152 .empty-wrap {
141 padding-top: 120rpx; 153 padding-top: 120rpx;
142 } 154 }
143 -  
144 .fixed-bottom-btn-wrap { 155 .fixed-bottom-btn-wrap {
145 // position: fixed; 156 // position: fixed;
146 // bottom: 0; 157 // bottom: 0;
pages-sub/daily/maintain-manage/type-list-page.vue
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 </view> 23 </view>
24 <!-- 第二行:任务次数 + 去作业按钮 --> 24 <!-- 第二行:任务次数 + 去作业按钮 -->
25 <view class="row row-2"> 25 <view class="row row-2">
26 - <view class="info-text">任务次数:第{{ item.planNum || 1 }}次</view> 26 + <view class="info-text">任务次数:第{{ item.planFinishNum +1 }}次</view>
27 <!-- 待完成:去作业;已完成:去查看 --> 27 <!-- 待完成:去作业;已完成:去查看 -->
28 <view v-if="activeStatus === '1'" class="mini-btn" @click.stop="handleGoWork(item)">去作业</view> 28 <view v-if="activeStatus === '1'" class="mini-btn" @click.stop="handleGoWork(item)">去作业</view>
29 <view v-else-if="activeStatus === '2'" class="mini-btn" @click.stop="handleGoWork(item)">去查看</view> 29 <view v-else-if="activeStatus === '2'" class="mini-btn" @click.stop="handleGoWork(item)">去查看</view>
@@ -42,23 +42,14 @@ @@ -42,23 +42,14 @@
42 </view> 42 </view>
43 </view> 43 </view>
44 </z-paging> 44 </z-paging>
45 - <!-- ========== 置为失效弹窗(参考回退弹窗结构) ========== -->  
46 - <up-modal :show="invalidModalShow" title="失效原因" :closeOnClickOverlay="false" :showConfirmButton="true" 45 + <!-- ========== 置为失效 简单二次确认弹窗【修改后】 ========== -->
  46 + <up-modal :show="invalidModalShow" title="提示" :closeOnClickOverlay="false" :showConfirmButton="true"
47 :showCancelButton="true" @cancel="handleInvalidModalCancel" @confirm="confirmSetInvalid"> 47 :showCancelButton="true" @cancel="handleInvalidModalCancel" @confirm="confirmSetInvalid">
48 <view class="invalid-modal-content"> 48 <view class="invalid-modal-content">
49 - <up-textarea v-model.trim="invalidReason" placeholder="请输入失效原因(必填)" rows="6" :count="200"  
50 - maxlength="200" class="invalid-textarea" />  
51 - <view class="upload-wrap mt-20">  
52 - <view class="upload-title">上传图片(选填)</view>  
53 - <up-upload :file-list="invalidImgs.rawImgList.value || []" @after-read="invalidImgs.uploadImgs"  
54 - @delete="invalidImgs.deleteImg" multiple width="70" height="70"  
55 - :max-count="invalidImgs.uploadConfig.maxCount"  
56 - :upload-text="invalidImgs.uploadConfig.uploadText"  
57 - :size-type="invalidImgs.uploadConfig.sizeType" />  
58 - </view> 49 + <text>确定要置为失效该任务吗?</text>
59 </view> 50 </view>
60 </up-modal> 51 </up-modal>
61 - <!-- ========== 结束任务二次确认弹窗【新增】 ========== --> 52 + <!-- ========== 结束任务二次确认弹窗 ========== -->
62 <up-modal :show="endTaskModalShow" title="提示" :closeOnClickOverlay="false" :showConfirmButton="true" 53 <up-modal :show="endTaskModalShow" title="提示" :closeOnClickOverlay="false" :showConfirmButton="true"
63 :showCancelButton="true" @cancel="handleEndTaskModalCancel" @confirm="confirmEndTask"> 54 :showCancelButton="true" @cancel="handleEndTaskModalCancel" @confirm="confirmEndTask">
64 <view class="end-task-modal-content"> 55 <view class="end-task-modal-content">
@@ -71,9 +62,8 @@ @@ -71,9 +62,8 @@
71 import { ref, computed } from 'vue' 62 import { ref, computed } from 'vue'
72 import { onShow, onUnload, onLoad } from '@dcloudio/uni-app' 63 import { onShow, onUnload, onLoad } from '@dcloudio/uni-app'
73 import { useUserStore } from '@/pinia/user'; 64 import { useUserStore } from '@/pinia/user';
74 -import { maintainPlanNum, finishPlan, invalidatePlan } from "@/api/maintain-manage/maintain-manage"; 65 +import { maintainPlanNum, finishPlan, invalidatePlan, maintainCreate } from "@/api/maintain-manage/maintain-manage";
75 import { timeFormat } from '@/uni_modules/uview-plus'; 66 import { timeFormat } from '@/uni_modules/uview-plus';
76 -import { useUploadImgs } from '@/common/utils/useUploadImgs'  
77 67
78 /** 获取当天日期 yyyy-MM-dd */ 68 /** 获取当天日期 yyyy-MM-dd */
79 const getTodayStr = () => { 69 const getTodayStr = () => {
@@ -83,7 +73,6 @@ const getTodayStr = () =&gt; { @@ -83,7 +73,6 @@ const getTodayStr = () =&gt; {
83 const day = String(d.getDate()).padStart(2, '0') 73 const day = String(d.getDate()).padStart(2, '0')
84 return `${year}-${month}-${day}` 74 return `${year}-${month}-${day}`
85 } 75 }
86 -  
87 const userStore = useUserStore(); 76 const userStore = useUserStore();
88 const userRoles = computed<string[]>(() => userStore.userInfo?.roles || []); 77 const userRoles = computed<string[]>(() => userStore.userInfo?.roles || []);
89 // 判断是否拥有置为失效权限:任意一个组长角色就可以 78 // 判断是否拥有置为失效权限:任意一个组长角色就可以
@@ -100,28 +89,19 @@ const statusTabs = ref([ @@ -100,28 +89,19 @@ const statusTabs = ref([
100 const activeStatus = ref('1') 89 const activeStatus = ref('1')
101 const pagingRef = ref(null) 90 const pagingRef = ref(null)
102 const currentList = ref([]) 91 const currentList = ref([])
103 -// 保存上一页传过来的原始数组  
104 -let originRawList: any[] = [] 92 +// originRawList:存储batchNo字符串数组,例 ["BN17925709862917163193","xxx"]
  93 +let originRawList: string[] = []
105 // 合并之后全部接口返回的总数据 94 // 合并之后全部接口返回的总数据
106 const allTotalData = ref<any[]>([]) 95 const allTotalData = ref<any[]>([])
107 // ===================== 失效弹窗状态 ===================== 96 // ===================== 失效弹窗状态 =====================
108 const invalidModalShow = ref(false) 97 const invalidModalShow = ref(false)
109 -const invalidReason = ref('')  
110 const currentInvalidItem = ref(null) 98 const currentInvalidItem = ref(null)
111 -// ===================== 结束任务确认弹窗【新增】 ===================== 99 +// ===================== 结束任务确认弹窗 =====================
112 const endTaskModalShow = ref(false) 100 const endTaskModalShow = ref(false)
113 const currentEndTaskItem = ref<any>(null) 101 const currentEndTaskItem = ref<any>(null)
114 -// 图片上传实例,和回退保持一致,最多3张  
115 -const invalidImgs = useUploadImgs({  
116 - maxCount: 3,  
117 - uploadText: '选择失效图片',  
118 - sizeType: ['compressed'],  
119 - formRef: null,  
120 - fieldName: 'invalidImgs'  
121 -}) 102 +
122 // 加载数据,根据当前activeStatus动态调用接口 103 // 加载数据,根据当前activeStatus动态调用接口
123 const loadData = async () => { 104 const loadData = async () => {
124 - // originRawList = uni.getStorageSync('temp_maintain_rawList')  
125 console.log('123123') 105 console.log('123123')
126 if (!originRawList || originRawList.length === 0) { 106 if (!originRawList || originRawList.length === 0) {
127 return 107 return
@@ -141,16 +121,17 @@ const loadData = async () =&gt; { @@ -141,16 +121,17 @@ const loadData = async () =&gt; {
141 // 已完成,只查2 121 // 已完成,只查2
142 stateArr = ['2'] 122 stateArr = ['2']
143 } 123 }
144 - // 遍历state数组,每个状态,循环rawList里面所有batchNo请求 124 + // 遍历state数组
145 for (const finishState of stateArr) { 125 for (const finishState of stateArr) {
146 - for (const item of originRawList) { 126 + // originRawList 为batchNo字符串数组,循环每一个batchNo去请求
  127 + for (const batchNoItem of originRawList) {
147 const apiParams: any = { 128 const apiParams: any = {
148 pageNo: 1, 129 pageNo: 1,
149 pageSize: 10, 130 pageSize: 10,
150 - planNo: item.planNo || '', 131 + planNo: '',
151 planAttr: '', 132 planAttr: '',
152 finishState: finishState, 133 finishState: finishState,
153 - batchNo: item.batchNo 134 + batchNo: batchNoItem
154 } 135 }
155 // 待完成状态追加当天日期 beginTime endTime 136 // 待完成状态追加当天日期 beginTime endTime
156 if (activeStatus.value === '1') { 137 if (activeStatus.value === '1') {
@@ -177,11 +158,9 @@ const planTypeId = ref(&#39;&#39;) @@ -177,11 +158,9 @@ const planTypeId = ref(&#39;&#39;)
177 onLoad((options) => { 158 onLoad((options) => {
178 planTypeId.value = options.planTypeId 159 planTypeId.value = options.planTypeId
179 }); 160 });
180 -// onShow 只保留一处,读取storage,只第一次读取storage 161 +// onShow 只保留一处,读取storage,originRawList接收batchNo字符串数组
181 onShow(async () => { 162 onShow(async () => {
182 originRawList = uni.getStorageSync('temp_maintain_rawList') || [] 163 originRawList = uni.getStorageSync('temp_maintain_rawList') || []
183 - // ✅ 读取完立刻删除,防止脏数据  
184 - // uni.removeStorageSync('temp_maintain_rawList')  
185 await loadData() 164 await loadData()
186 }) 165 })
187 // z-paging分页查询,直接使用allTotalData 166 // z-paging分页查询,直接使用allTotalData
@@ -200,41 +179,49 @@ const handleStatusChange = async (tabItem) =&gt; { @@ -200,41 +179,49 @@ const handleStatusChange = async (tabItem) =&gt; {
200 // 打开失效弹窗 179 // 打开失效弹窗
201 const handleSetInvalid = (item) => { 180 const handleSetInvalid = (item) => {
202 currentInvalidItem.value = item 181 currentInvalidItem.value = item
203 - invalidReason.value = ''  
204 - invalidImgs.clearImgs()  
205 invalidModalShow.value = true 182 invalidModalShow.value = true
206 } 183 }
207 // 关闭弹窗,重置数据 184 // 关闭弹窗,重置数据
208 const handleInvalidModalCancel = () => { 185 const handleInvalidModalCancel = () => {
209 invalidModalShow.value = false 186 invalidModalShow.value = false
210 - invalidReason.value = ''  
211 - invalidImgs.clearImgs() 187 + currentInvalidItem.value = null
212 } 188 }
213 // 确认提交置为失效 189 // 确认提交置为失效
214 const confirmSetInvalid = async () => { 190 const confirmSetInvalid = async () => {
215 - const reason = invalidReason.value.trim()  
216 - if (!reason) {  
217 - uni.showToast({ title: '请填写失效原因', icon: 'none' })  
218 - return  
219 - }  
220 const item = currentInvalidItem.value 191 const item = currentInvalidItem.value
221 - if (!item || !item.commitId) {  
222 - uni.showToast({ title: '缺少commitId,无法操作', icon: 'none' }) 192 + console.log(currentInvalidItem.value)
  193 + if (!item) {
  194 + uni.showToast({ title: '数据异常', icon: 'none' })
223 return 195 return
224 } 196 }
225 uni.showLoading({ title: '提交中...', mask: true }) 197 uni.showLoading({ title: '提交中...', mask: true })
226 try { 198 try {
227 - // 获取上传成功图片url数组,拼接逗号  
228 - const imgUrlArr = invalidImgs.getSuccessImgUrls()  
229 - const invalidFiles = imgUrlArr.join(',') 199 + let targetCommitId = item.commitId
  200 + // ✅ 如果没有 commitId,先执行 maintainCreate 创建草稿
  201 + if (!targetCommitId) {
  202 + const submitData = {
  203 + planNo: item.planNo,
  204 + imgHost: '1',
  205 + beginImg: [],
  206 + commonUserList: [],
  207 + remark: ''
  208 + }
  209 + const createRes: any = await maintainCreate(submitData)
  210 + // 兼容后端两种返回:裸id / {id:xxx}
  211 + targetCommitId = createRes && typeof createRes === 'object' ? createRes.id : createRes
  212 + if (!targetCommitId) {
  213 + uni.hideLoading()
  214 + uni.showToast({ title: '创建养护草稿失败,无法置为失效', icon: 'none' })
  215 + return
  216 + }
  217 + }
  218 +
230 const params = { 219 const params = {
231 - commitId: item.commitId,  
232 - invalidReason: reason,  
233 - invalidFiles: invalidFiles 220 + commitId: targetCommitId,
234 } 221 }
235 console.log('置为失效提交参数:', params) 222 console.log('置为失效提交参数:', params)
236 - // 调用接口 invalidatePlan  
237 - await invalidatePlan(params) 223 + console.log(params.commitId)
  224 + await invalidatePlan({ commitId: params.commitId })
238 uni.showToast({ title: '操作成功', icon: 'success' }) 225 uni.showToast({ title: '操作成功', icon: 'success' })
239 handleInvalidModalCancel() 226 handleInvalidModalCancel()
240 // 重新加载数据刷新列表 227 // 重新加载数据刷新列表
@@ -262,26 +249,21 @@ const handleEndTaskModalCancel = () =&gt; { @@ -262,26 +249,21 @@ const handleEndTaskModalCancel = () =&gt; {
262 endTaskModalShow.value = false 249 endTaskModalShow.value = false
263 currentEndTaskItem.value = null 250 currentEndTaskItem.value = null
264 } 251 }
265 -// 确认结束任务,真正调用接口【新增】 252 +// 确认结束任务,真正调用接口
266 const confirmEndTask = async () => { 253 const confirmEndTask = async () => {
267 const item = currentEndTaskItem.value 254 const item = currentEndTaskItem.value
268 - // commitId 由明细列表接口回填(commit_state=1),按钮只在有值时渲染  
269 if (!item || !item.commitId) return 255 if (!item || !item.commitId) return
270 endTaskModalShow.value = false 256 endTaskModalShow.value = false
271 uni.showLoading({ title: '提交中...', mask: true }) 257 uni.showLoading({ title: '提交中...', mask: true })
272 try { 258 try {
273 - // 后端 /finish 只认 commitId,且要求本次养护至少有一条有效子上报  
274 await finishPlan({ commitId: item.commitId }) 259 await finishPlan({ commitId: item.commitId })
275 - // 先关 loading 再弹提示:微信端 showLoading/showToast 共用同一个 toast,顺序反了会把成功提示顶掉  
276 uni.hideLoading() 260 uni.hideLoading()
277 uni.showToast({ title: '结束任务成功', icon: 'success' }) 261 uni.showToast({ title: '结束任务成功', icon: 'success' })
278 - // 操作成功,重新加载数据,刷新列表(commitId 随之清空,按钮消失)  
279 await loadData() 262 await loadData()
280 pagingRef.value?.reload() 263 pagingRef.value?.reload()
281 } catch (err) { 264 } catch (err) {
282 console.error('结束任务失败', err) 265 console.error('结束任务失败', err)
283 uni.hideLoading() 266 uni.hideLoading()
284 - // 业务错误 request.js 已弹过后端 msg,这里不重复弹  
285 if (err && err.msg) return 267 if (err && err.msg) return
286 uni.showToast({ title: '结束任务失败,请重试', icon: 'none' }) 268 uni.showToast({ title: '结束任务失败,请重试', icon: 'none' })
287 } finally { 269 } finally {
@@ -349,20 +331,9 @@ onUnload(() =&gt; { @@ -349,20 +331,9 @@ onUnload(() =&gt; {
349 padding: 8rpx 20rpx; 331 padding: 8rpx 20rpx;
350 flex-shrink: 0; 332 flex-shrink: 0;
351 } 333 }
352 -// 弹窗样式,和回退弹窗保持一致  
353 .invalid-modal-content { 334 .invalid-modal-content {
354 width: 100%; 335 width: 100%;
355 box-sizing: border-box; 336 box-sizing: border-box;
356 padding: 10rpx 0; 337 padding: 10rpx 0;
357 } 338 }
358 -.upload-wrap {  
359 - .upload-title {  
360 - font-size: 28rpx;  
361 - color: #333;  
362 - margin-bottom: 10rpx;  
363 - }  
364 -}  
365 -.mt-20 {  
366 - margin-top: 20rpx;  
367 -}  
368 </style> 339 </style>
pages-sub/daily/maintain-manage/type-list.vue
@@ -6,8 +6,8 @@ @@ -6,8 +6,8 @@
6 @click="toNextPage(item)"> 6 @click="toNextPage(item)">
7 <view class="tag-text"> 7 <view class="tag-text">
8 <!-- 文字区域:超长省略号,数字括号单独放后面,永远可见 --> 8 <!-- 文字区域:超长省略号,数字括号单独放后面,永远可见 -->
9 - <text class="tag-name">{{ item.label }}</text>  
10 - <text class="tag-count">({{ item.count }})</text> 9 + <text class="tag-name">{{ item.planTypeName }}</text>
  10 + <text class="tag-count">({{ item.todayPendingCount }})</text>
11 </view> 11 </view>
12 </view> 12 </view>
13 </template> 13 </template>
@@ -38,7 +38,7 @@ const roadName = ref&lt;string | null&gt;(null) @@ -38,7 +38,7 @@ const roadName = ref&lt;string | null&gt;(null)
38 const levelId = ref<string | null>(null) 38 const levelId = ref<string | null>(null)
39 onLoad((options) => { 39 onLoad((options) => {
40 roadName.value = decodeURIComponent(options.roadName) 40 roadName.value = decodeURIComponent(options.roadName)
41 - levelId.value = decodeURIComponent(options.levelId); 41 + // levelId.value = decodeURIComponent(options.levelId);
42 }); 42 });
43 onShow(() => { 43 onShow(() => {
44 if (!roadName.value) { 44 if (!roadName.value) {
@@ -55,10 +55,14 @@ const fetchData = async () =&gt; { @@ -55,10 +55,14 @@ const fetchData = async () =&gt; {
55 try { 55 try {
56 const res = await maintainPlan({ 56 const res = await maintainPlan({
57 roadName: roadName.value, 57 roadName: roadName.value,
58 - levelId: levelId.value 58 + // roadName: '月坛南街',
  59 + pageNo:1,
  60 + pageSize:100,
  61 + finishState:1
  62 + // levelId: levelId.value
59 }) 63 })
60 console.log('maintainPlan返回', res) 64 console.log('maintainPlan返回', res)
61 - if (!Array.isArray(res.list) || res.list.length === 0) { 65 + if (res.list.length == 0) {
62 tagList.value = [] 66 tagList.value = []
63 uni.showToast({ 67 uni.showToast({
64 title: '暂无养护类型', 68 title: '暂无养护类型',
@@ -66,7 +70,8 @@ const fetchData = async () =&gt; { @@ -66,7 +70,8 @@ const fetchData = async () =&gt; {
66 }); 70 });
67 return 71 return
68 } 72 }
69 - await requestBatchList(res.list) 73 + tagList.value = res.list[0].planTypes
  74 + // await requestBatchList(res.list)
70 } catch (error) { 75 } catch (error) {
71 console.error('请求失败:', error) 76 console.error('请求失败:', error)
72 uni.showToast({ title: '网络异常,请重试', icon: 'none' }) 77 uni.showToast({ title: '网络异常,请重试', icon: 'none' })
@@ -145,7 +150,7 @@ const requestBatchList = async (list: any[]) =&gt; { @@ -145,7 +150,7 @@ const requestBatchList = async (list: any[]) =&gt; {
145 // 标签点击跳转,rawList存入storage,并且把planTypeId拼到url传给下一页 150 // 标签点击跳转,rawList存入storage,并且把planTypeId拼到url传给下一页
146 const toNextPage = (item: any) => { 151 const toNextPage = (item: any) => {
147 // maintainStore.setRawList(item.rawList) 152 // maintainStore.setRawList(item.rawList)
148 - uni.setStorageSync('temp_maintain_rawList', item.rawList) 153 + uni.setStorageSync('temp_maintain_rawList', item.batchNos)
149 uni.navigateTo({ 154 uni.navigateTo({
150 url: `/pages-sub/daily/maintain-manage/type-list-page?planTypeId=${item.planTypeId}` 155 url: `/pages-sub/daily/maintain-manage/type-list-page?planTypeId=${item.planTypeId}`
151 }) 156 })