Commit a4ce4276096223506adfe73c27d5eb2303dfec1d

Authored by 刘淇
1 parent 57ce269d

秩序管理组长 不让看巡查

pages-sub/daily/maintain-manage/index.vue
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 <!-- </up-button>--> 81 <!-- </up-button>-->
82 <!-- </view>--> 82 <!-- </view>-->
83 83
84 - <view class="common-custom-btn" style="--btn-top: 28px;" @click="goToDetail(item)"> 84 + <view class="common-custom-btn" style="--btn-top: 18px;" @click="goToDetail(item)">
85 养护任务 85 养护任务
86 </view> 86 </view>
87 <!-- <view class="u-body-item u-flex">--> 87 <!-- <view class="u-body-item u-flex">-->
@@ -92,6 +92,11 @@ @@ -92,6 +92,11 @@
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">
  96 + <view class="u-body-item-title">计划名称:</view>
  97 + <view class="u-line-1 u-body-value">{{ item.planName || '-' }}</view>
  98 + </view>
  99 +
95 100
96 <!-- <view class="u-body-item u-flex"> 101 <!-- <view class="u-body-item u-flex">
97 <view class="u-body-item-title">所属街道:</view> 102 <view class="u-body-item-title">所属街道:</view>
@@ -280,6 +285,7 @@ const fetchData = async (pageNo, pageSize) =&gt; { @@ -280,6 +285,7 @@ const fetchData = async (pageNo, pageSize) =&gt; {
280 roadName: searchValue.value.trim(), 285 roadName: searchValue.value.trim(),
281 pageNo, 286 pageNo,
282 pageSize, 287 pageSize,
  288 + finishState:1
283 // finishState: activeStatus.value 289 // finishState: activeStatus.value
284 }) 290 })
285 291
pages-sub/daily/maintain-manage/type-list-page.vue
@@ -24,11 +24,10 @@ @@ -24,11 +24,10 @@
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.planNum || 1 }}次</view>
27 - <!-- 仅待完成才显示去作业 -->  
28 - <!-- 待完成:去作业;已完成:去查看 -->  
29 -<view v-if="activeStatus === '1'" class="mini-btn" @click.stop="handleGoWork(item)">去作业</view>  
30 -<view v-else-if="activeStatus === '2'" class="mini-btn" @click.stop="handleGoWork(item)">去查看</view>  
31 -<view v-else-if="activeStatus === '3'" class="mini-btn" @click.stop="handleGoWork(item)">去查看</view> 27 + <!-- 待完成:去作业;已完成:去查看 -->
  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>
  30 + <view v-else-if="activeStatus === '3'" class="mini-btn" @click.stop="handleGoWork(item)">去查看</view>
32 </view> 31 </view>
33 <!-- 第三行:有效期 + 结束任务按钮 --> 32 <!-- 第三行:有效期 + 结束任务按钮 -->
34 <view class="row row-3"> 33 <view class="row row-3">
@@ -59,7 +58,6 @@ @@ -59,7 +58,6 @@
59 </view> 58 </view>
60 </view> 59 </view>
61 </up-modal> 60 </up-modal>
62 -  
63 <!-- ========== 结束任务二次确认弹窗【新增】 ========== --> 61 <!-- ========== 结束任务二次确认弹窗【新增】 ========== -->
64 <up-modal :show="endTaskModalShow" title="提示" :closeOnClickOverlay="false" :showConfirmButton="true" 62 <up-modal :show="endTaskModalShow" title="提示" :closeOnClickOverlay="false" :showConfirmButton="true"
65 :showCancelButton="true" @cancel="handleEndTaskModalCancel" @confirm="confirmEndTask"> 63 :showCancelButton="true" @cancel="handleEndTaskModalCancel" @confirm="confirmEndTask">
@@ -67,7 +65,6 @@ @@ -67,7 +65,6 @@
67 <text>确定要结束该任务吗?结束后将不可再去作业。</text> 65 <text>确定要结束该任务吗?结束后将不可再去作业。</text>
68 </view> 66 </view>
69 </up-modal> 67 </up-modal>
70 -  
71 </view> 68 </view>
72 </template> 69 </template>
73 <script setup lang="ts"> 70 <script setup lang="ts">
@@ -77,16 +74,24 @@ import { useUserStore } from &#39;@/pinia/user&#39;; @@ -77,16 +74,24 @@ import { useUserStore } from &#39;@/pinia/user&#39;;
77 import { maintainPlanNum, finishPlan, invalidatePlan } from "@/api/maintain-manage/maintain-manage"; 74 import { maintainPlanNum, finishPlan, invalidatePlan } from "@/api/maintain-manage/maintain-manage";
78 import { timeFormat } from '@/uni_modules/uview-plus'; 75 import { timeFormat } from '@/uni_modules/uview-plus';
79 import { useUploadImgs } from '@/common/utils/useUploadImgs' 76 import { useUploadImgs } from '@/common/utils/useUploadImgs'
  77 +
  78 +/** 获取当天日期 yyyy-MM-dd */
  79 +const getTodayStr = () => {
  80 + const d = new Date()
  81 + const year = d.getFullYear()
  82 + const month = String(d.getMonth() + 1).padStart(2, '0')
  83 + const day = String(d.getDate()).padStart(2, '0')
  84 + return `${year}-${month}-${day}`
  85 +}
  86 +
80 const userStore = useUserStore(); 87 const userStore = useUserStore();
81 const userRoles = computed<string[]>(() => userStore.userInfo?.roles || []); 88 const userRoles = computed<string[]>(() => userStore.userInfo?.roles || []);
82 -  
83 // 判断是否拥有置为失效权限:任意一个组长角色就可以 89 // 判断是否拥有置为失效权限:任意一个组长角色就可以
84 const hasInvalidPerm = computed(() => { 90 const hasInvalidPerm = computed(() => {
85 const roles = userRoles.value 91 const roles = userRoles.value
86 const leaderRoles = ['team_leader_yl', 'team_leader_wy', 'team_leader_hjws'] 92 const leaderRoles = ['team_leader_yl', 'team_leader_wy', 'team_leader_hjws']
87 return leaderRoles.some(key => roles.includes(key)) 93 return leaderRoles.some(key => roles.includes(key))
88 }) 94 })
89 -  
90 const statusTabs = ref([ 95 const statusTabs = ref([
91 { name: '待完成', id: '1' }, 96 { name: '待完成', id: '1' },
92 { name: '已失效', id: '3' }, 97 { name: '已失效', id: '3' },
@@ -139,14 +144,21 @@ const loadData = async () =&gt; { @@ -139,14 +144,21 @@ const loadData = async () =&gt; {
139 // 遍历state数组,每个状态,循环rawList里面所有batchNo请求 144 // 遍历state数组,每个状态,循环rawList里面所有batchNo请求
140 for (const finishState of stateArr) { 145 for (const finishState of stateArr) {
141 for (const item of originRawList) { 146 for (const item of originRawList) {
142 - const res = await maintainPlanNum({ 147 + const apiParams: any = {
143 pageNo: 1, 148 pageNo: 1,
144 pageSize: 10, 149 pageSize: 10,
145 planNo: item.planNo || '', 150 planNo: item.planNo || '',
146 planAttr: '', 151 planAttr: '',
147 finishState: finishState, 152 finishState: finishState,
148 batchNo: item.batchNo 153 batchNo: item.batchNo
149 - }) 154 + }
  155 + // 待完成状态追加当天日期 beginTime endTime
  156 + if (activeStatus.value === '1') {
  157 + const today = getTodayStr()
  158 + apiParams.beginTime = today
  159 + apiParams.endTime = today
  160 + }
  161 + const res = await maintainPlanNum(apiParams)
150 if (Array.isArray(res.list)) { 162 if (Array.isArray(res.list)) {
151 tempResult.push(...res.list) 163 tempResult.push(...res.list)
152 } 164 }
@@ -164,7 +176,6 @@ const loadData = async () =&gt; { @@ -164,7 +176,6 @@ const loadData = async () =&gt; {
164 const planTypeId = ref('') 176 const planTypeId = ref('')
165 onLoad((options) => { 177 onLoad((options) => {
166 planTypeId.value = options.planTypeId 178 planTypeId.value = options.planTypeId
167 -  
168 }); 179 });
169 // onShow 只保留一处,读取storage,只第一次读取storage 180 // onShow 只保留一处,读取storage,只第一次读取storage
170 onShow(async () => { 181 onShow(async () => {
@@ -199,7 +210,6 @@ const handleInvalidModalCancel = () =&gt; { @@ -199,7 +210,6 @@ const handleInvalidModalCancel = () =&gt; {
199 invalidReason.value = '' 210 invalidReason.value = ''
200 invalidImgs.clearImgs() 211 invalidImgs.clearImgs()
201 } 212 }
202 -  
203 // 确认提交置为失效 213 // 确认提交置为失效
204 const confirmSetInvalid = async () => { 214 const confirmSetInvalid = async () => {
205 const reason = invalidReason.value.trim() 215 const reason = invalidReason.value.trim()
@@ -208,23 +218,23 @@ const confirmSetInvalid = async () =&gt; { @@ -208,23 +218,23 @@ const confirmSetInvalid = async () =&gt; {
208 return 218 return
209 } 219 }
210 const item = currentInvalidItem.value 220 const item = currentInvalidItem.value
211 - if (!item || !item.id) return  
212 - 221 + if (!item || !item.commitId) {
  222 + uni.showToast({ title: '缺少commitId,无法操作', icon: 'none' })
  223 + return
  224 + }
213 uni.showLoading({ title: '提交中...', mask: true }) 225 uni.showLoading({ title: '提交中...', mask: true })
214 try { 226 try {
215 // 获取上传成功图片url数组,拼接逗号 227 // 获取上传成功图片url数组,拼接逗号
216 const imgUrlArr = invalidImgs.getSuccessImgUrls() 228 const imgUrlArr = invalidImgs.getSuccessImgUrls()
217 const invalidFiles = imgUrlArr.join(',') 229 const invalidFiles = imgUrlArr.join(',')
218 -  
219 const params = { 230 const params = {
220 - id: item.id, 231 + commitId: item.commitId,
221 invalidReason: reason, 232 invalidReason: reason,
222 invalidFiles: invalidFiles 233 invalidFiles: invalidFiles
223 } 234 }
224 console.log('置为失效提交参数:', params) 235 console.log('置为失效提交参数:', params)
225 // 调用接口 invalidatePlan 236 // 调用接口 invalidatePlan
226 await invalidatePlan(params) 237 await invalidatePlan(params)
227 -  
228 uni.showToast({ title: '操作成功', icon: 'success' }) 238 uni.showToast({ title: '操作成功', icon: 'success' })
229 handleInvalidModalCancel() 239 handleInvalidModalCancel()
230 // 重新加载数据刷新列表 240 // 重新加载数据刷新列表
@@ -237,9 +247,8 @@ const confirmSetInvalid = async () =&gt; { @@ -237,9 +247,8 @@ const confirmSetInvalid = async () =&gt; {
237 uni.hideLoading() 247 uni.hideLoading()
238 } 248 }
239 } 249 }
240 -  
241 const handleGoWork = (item) => { 250 const handleGoWork = (item) => {
242 - const isView = activeStatus.value 251 + const isView = activeStatus.value
243 uni.navigateTo({ 252 uni.navigateTo({
244 url: `/pages-sub/daily/maintain-manage/now-list-page?planNo=${item.planNo}&planTypeId=${planTypeId.value}&businessType=${item.busiLine}&isView=${isView}` 253 url: `/pages-sub/daily/maintain-manage/now-list-page?planNo=${item.planNo}&planTypeId=${planTypeId.value}&businessType=${item.busiLine}&isView=${isView}`
245 }) 254 })
@@ -248,20 +257,17 @@ const handleEndTask = async (item) =&gt; { @@ -248,20 +257,17 @@ const handleEndTask = async (item) =&gt; {
248 currentEndTaskItem.value = item 257 currentEndTaskItem.value = item
249 endTaskModalShow.value = true 258 endTaskModalShow.value = true
250 } 259 }
251 -  
252 // 关闭结束任务弹窗 260 // 关闭结束任务弹窗
253 const handleEndTaskModalCancel = () => { 261 const handleEndTaskModalCancel = () => {
254 endTaskModalShow.value = false 262 endTaskModalShow.value = false
255 currentEndTaskItem.value = null 263 currentEndTaskItem.value = null
256 } 264 }
257 -  
258 // 确认结束任务,真正调用接口【新增】 265 // 确认结束任务,真正调用接口【新增】
259 const confirmEndTask = async () => { 266 const confirmEndTask = async () => {
260 const item = currentEndTaskItem.value 267 const item = currentEndTaskItem.value
261 // commitId 由明细列表接口回填(commit_state=1),按钮只在有值时渲染 268 // commitId 由明细列表接口回填(commit_state=1),按钮只在有值时渲染
262 if (!item || !item.commitId) return 269 if (!item || !item.commitId) return
263 endTaskModalShow.value = false 270 endTaskModalShow.value = false
264 -  
265 uni.showLoading({ title: '提交中...', mask: true }) 271 uni.showLoading({ title: '提交中...', mask: true })
266 try { 272 try {
267 // 后端 /finish 只认 commitId,且要求本次养护至少有一条有效子上报 273 // 后端 /finish 只认 commitId,且要求本次养护至少有一条有效子上报
@@ -282,7 +288,6 @@ const confirmEndTask = async () =&gt; { @@ -282,7 +288,6 @@ const confirmEndTask = async () =&gt; {
282 currentEndTaskItem.value = null 288 currentEndTaskItem.value = null
283 } 289 }
284 } 290 }
285 -  
286 // 页面卸载清空,防止内存残留 291 // 页面卸载清空,防止内存残留
287 onUnload(() => { 292 onUnload(() => {
288 allTotalData.value = [] 293 allTotalData.value = []
@@ -294,19 +299,16 @@ onUnload(() =&gt; { @@ -294,19 +299,16 @@ onUnload(() =&gt; {
294 height: 100vh; 299 height: 100vh;
295 background-color: #f5f5f5; 300 background-color: #f5f5f5;
296 } 301 }
297 -  
298 .sticky-wrap { 302 .sticky-wrap {
299 background: #fff; 303 background: #fff;
300 border-bottom: 1rpx solid #eee; 304 border-bottom: 1rpx solid #eee;
301 } 305 }
302 -  
303 .card-list { 306 .card-list {
304 padding: 100rpx 20rpx 20rpx; 307 padding: 100rpx 20rpx 20rpx;
305 display: flex; 308 display: flex;
306 flex-direction: column; 309 flex-direction: column;
307 gap: 20rpx; 310 gap: 20rpx;
308 } 311 }
309 -  
310 .task-card { 312 .task-card {
311 background: #fff; 313 background: #fff;
312 border-radius: 12rpx; 314 border-radius: 12rpx;
@@ -315,34 +317,29 @@ onUnload(() =&gt; { @@ -315,34 +317,29 @@ onUnload(() =&gt; {
315 flex-direction: column; 317 flex-direction: column;
316 gap: 20rpx; 318 gap: 20rpx;
317 } 319 }
318 -  
319 .row { 320 .row {
320 display: flex; 321 display: flex;
321 align-items: center; 322 align-items: center;
322 justify-content: space-between; 323 justify-content: space-between;
323 gap: 16rpx; 324 gap: 16rpx;
324 } 325 }
325 -  
326 .plan-name { 326 .plan-name {
327 font-size: 30rpx; 327 font-size: 30rpx;
328 color: #333; 328 color: #333;
329 font-weight: 500; 329 font-weight: 500;
330 flex: 1; 330 flex: 1;
331 } 331 }
332 -  
333 .btn-set-invalid { 332 .btn-set-invalid {
334 font-size: 26rpx; 333 font-size: 26rpx;
335 color: #1677ff; 334 color: #1677ff;
336 flex-shrink: 0; 335 flex-shrink: 0;
337 padding-left: 16rpx; 336 padding-left: 16rpx;
338 } 337 }
339 -  
340 .info-text { 338 .info-text {
341 font-size: 26rpx; 339 font-size: 26rpx;
342 color: #666; 340 color: #666;
343 flex: 1; 341 flex: 1;
344 } 342 }
345 -  
346 .mini-btn { 343 .mini-btn {
347 font-size: 24rpx; 344 font-size: 24rpx;
348 color: #333; 345 color: #333;
@@ -352,14 +349,12 @@ onUnload(() =&gt; { @@ -352,14 +349,12 @@ onUnload(() =&gt; {
352 padding: 8rpx 20rpx; 349 padding: 8rpx 20rpx;
353 flex-shrink: 0; 350 flex-shrink: 0;
354 } 351 }
355 -  
356 // 弹窗样式,和回退弹窗保持一致 352 // 弹窗样式,和回退弹窗保持一致
357 .invalid-modal-content { 353 .invalid-modal-content {
358 width: 100%; 354 width: 100%;
359 box-sizing: border-box; 355 box-sizing: border-box;
360 padding: 10rpx 0; 356 padding: 10rpx 0;
361 } 357 }
362 -  
363 .upload-wrap { 358 .upload-wrap {
364 .upload-title { 359 .upload-title {
365 font-size: 28rpx; 360 font-size: 28rpx;
@@ -367,7 +362,6 @@ onUnload(() =&gt; { @@ -367,7 +362,6 @@ onUnload(() =&gt; {
367 margin-bottom: 10rpx; 362 margin-bottom: 10rpx;
368 } 363 }
369 } 364 }
370 -  
371 .mt-20 { 365 .mt-20 {
372 margin-top: 20rpx; 366 margin-top: 20rpx;
373 } 367 }
pages/index/index.vue
@@ -199,7 +199,7 @@ console.log(&#39;当前用户角色数组:&#39;, userRoles.value) @@ -199,7 +199,7 @@ console.log(&#39;当前用户角色数组:&#39;, userRoles.value)
199 199
200 // 权限控制角色列表:包含这些角色,则隐藏对应tab 200 // 权限控制角色列表:包含这些角色,则隐藏对应tab
201 const hideYhRoleList = ['patrol_leader', 'patrol_global', 'yl_inspector', 'hjws_inspector', 'zxgl_inspector']; 201 const hideYhRoleList = ['patrol_leader', 'patrol_global', 'yl_inspector', 'hjws_inspector', 'zxgl_inspector'];
202 -const hideXjRoleList = ['zxgl_worker', 'team_leader_hjws', 'hjws_worker', 'team_leader_wy', 'wy_worker', 'yl_worker', 'team_leader_yl']; 202 +const hideXjRoleList = ['zxgl_worker', 'team_leader_hjws', 'hjws_worker', 'team_leader_wy', 'wy_worker', 'yl_worker', 'team_leader_yl','team_leader_zxgl'];
203 203
204 // ✅ 修复:用户角色数组 和 黑名单数组 存在交集 → 隐藏养护tab 204 // ✅ 修复:用户角色数组 和 黑名单数组 存在交集 → 隐藏养护tab
205 const showMainTabYh = computed(() => { 205 const showMainTabYh = computed(() => {