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