Commit dfa5aac5014397a310593d0d0da00296f83422de
1 parent
2b13ab68
验收加上 验收图片非必传
Showing
2 changed files
with
158 additions
and
48 deletions
pages-sub/problem/work-order-manage/index.vue
| @@ -215,14 +215,14 @@ | @@ -215,14 +215,14 @@ | ||
| 215 | </view> | 215 | </view> |
| 216 | </up-modal> | 216 | </up-modal> |
| 217 | 217 | ||
| 218 | - <!-- 验收弹窗 up-modal --> | 218 | + <!-- 验收弹窗 up-modal(含图片上传) --> |
| 219 | <up-modal | 219 | <up-modal |
| 220 | :show="acceptModalShow" | 220 | :show="acceptModalShow" |
| 221 | title="验收" | 221 | title="验收" |
| 222 | :closeOnClickOverlay="false" | 222 | :closeOnClickOverlay="false" |
| 223 | :showConfirmButton="true" | 223 | :showConfirmButton="true" |
| 224 | :showCancelButton="true" | 224 | :showCancelButton="true" |
| 225 | - @cancel="acceptModalShow=false" | 225 | + @cancel="handleAcceptModalCancel" |
| 226 | @confirm="handleAcceptModalConfirm" | 226 | @confirm="handleAcceptModalConfirm" |
| 227 | > | 227 | > |
| 228 | <view class="accept-modal-content"> | 228 | <view class="accept-modal-content"> |
| @@ -245,6 +245,22 @@ | @@ -245,6 +245,22 @@ | ||
| 245 | count | 245 | count |
| 246 | /> | 246 | /> |
| 247 | </view> | 247 | </view> |
| 248 | + | ||
| 249 | + <!-- 验收图片上传(选填,参考回退弹窗样式) --> | ||
| 250 | + <view class="upload-wrap mt-20"> | ||
| 251 | + <view class="upload-title">上传验收图片(选填)</view> | ||
| 252 | + <up-upload | ||
| 253 | + :file-list="acceptImgs.imgList" | ||
| 254 | + @after-read="acceptImgs.uploadImgs" | ||
| 255 | + @delete="acceptImgs.deleteImg" | ||
| 256 | + multiple | ||
| 257 | + width="70" | ||
| 258 | + height="70" | ||
| 259 | + :max-count="acceptImgs.uploadConfig.maxCount" | ||
| 260 | + :upload-text="acceptImgs.uploadConfig.uploadText" | ||
| 261 | + :size-type="acceptImgs.uploadConfig.sizeType" | ||
| 262 | + /> | ||
| 263 | + </view> | ||
| 248 | </view> | 264 | </view> |
| 249 | </up-modal> | 265 | </up-modal> |
| 250 | </view> | 266 | </view> |
| @@ -252,7 +268,7 @@ | @@ -252,7 +268,7 @@ | ||
| 252 | 268 | ||
| 253 | <script setup> | 269 | <script setup> |
| 254 | import { ref, computed, watch } from 'vue'; | 270 | import { ref, computed, watch } from 'vue'; |
| 255 | -import { onReady, onShow } from '@dcloudio/uni-app'; | 271 | +import { onShow } from '@dcloudio/uni-app'; |
| 256 | import { timeFormat } from '@/uni_modules/uview-plus'; | 272 | import { timeFormat } from '@/uni_modules/uview-plus'; |
| 257 | import { | 273 | import { |
| 258 | myBuzSimplePage, | 274 | myBuzSimplePage, |
| @@ -293,31 +309,45 @@ const isInspector = computed(() => { | @@ -293,31 +309,45 @@ const isInspector = computed(() => { | ||
| 293 | // 增加可选链,避免用户信息不存在报错 | 309 | // 增加可选链,避免用户信息不存在报错 |
| 294 | return userStore.userInfo?.roles?.includes('yl_inspector') || false; | 310 | return userStore.userInfo?.roles?.includes('yl_inspector') || false; |
| 295 | }); | 311 | }); |
| 296 | -// 回退弹窗相关(核心改造:使用useUploadImgs替代原始图片管理) | 312 | +// 回退弹窗相关 |
| 297 | const rejectModalShow = ref(false); // 回退modal显示开关 | 313 | const rejectModalShow = ref(false); // 回退modal显示开关 |
| 298 | const rejectReason = ref(''); // 回退原因 | 314 | const rejectReason = ref(''); // 回退原因 |
| 299 | const currentRejectItem = ref(null); // 当前回退工单 | 315 | const currentRejectItem = ref(null); // 当前回退工单 |
| 300 | 316 | ||
| 301 | -// ========== 核心改造:回退图片上传配置(与参考页面风格一致) ========== | 317 | +// 回退图片上传配置(与参考页面风格一致) |
| 302 | const rejectImgs = useUploadImgs({ | 318 | const rejectImgs = useUploadImgs({ |
| 303 | - maxCount: 3, // 最多上传3张,与原有逻辑一致 | 319 | + maxCount: 3, // 最多上传3张 |
| 304 | uploadText: '选择回退图片', // 自定义上传提示文字 | 320 | uploadText: '选择回退图片', // 自定义上传提示文字 |
| 305 | - sizeType: ['compressed'], // 仅上传压缩图,优化性能 | ||
| 306 | - formRef: null, // 该弹窗无表单校验,传null即可 | ||
| 307 | - fieldName: 'rejectImgs' // 自定义字段名,用于标识该上传实例 | 321 | + sizeType: ['compressed'], // 仅上传压缩图 |
| 322 | + formRef: null, // 该弹窗无表单校验 | ||
| 323 | + fieldName: 'rejectImgs' // 自定义字段名 | ||
| 308 | }) | 324 | }) |
| 309 | 325 | ||
| 310 | -// 监听上传实例响应式变化,解决u-upload不刷新问题(与参考页面一致) | 326 | +// 监听上传实例响应式变化,解决u-upload不刷新问题 |
| 311 | watch(() => rejectImgs.rawImgList.value, (newVal) => { | 327 | watch(() => rejectImgs.rawImgList.value, (newVal) => { |
| 312 | rejectImgs.imgList = newVal | 328 | rejectImgs.imgList = newVal |
| 313 | }, { deep: true }) | 329 | }, { deep: true }) |
| 314 | 330 | ||
| 315 | -// ========== 新增:养护组长验收弹窗相关状态 ========== | 331 | +// ========== 验收弹窗相关状态(含图片上传) ========== |
| 316 | const acceptModalShow = ref(false); // 验收弹窗显示开关 | 332 | const acceptModalShow = ref(false); // 验收弹窗显示开关 |
| 317 | const acceptRadioValue = ref('0'); // 单选框值,默认0(通过) | 333 | const acceptRadioValue = ref('0'); // 单选框值,默认0(通过) |
| 318 | const acceptReason = ref(''); // 验收原因 | 334 | const acceptReason = ref(''); // 验收原因 |
| 319 | const currentAcceptItem = ref(null); // 当前验收的工单项 | 335 | const currentAcceptItem = ref(null); // 当前验收的工单项 |
| 320 | 336 | ||
| 337 | +// 验收图片上传配置(独立实例,参考回退弹窗) | ||
| 338 | +const acceptImgs = useUploadImgs({ | ||
| 339 | + maxCount: 3, // 最多上传3张,与回退弹窗一致 | ||
| 340 | + uploadText: '选择验收图片', // 自定义上传提示文字 | ||
| 341 | + sizeType: ['compressed'], // 仅上传压缩图,优化性能 | ||
| 342 | + formRef: null, // 验收弹窗无表单校验 | ||
| 343 | + fieldName: 'acceptImgs' // 自定义字段名,区分回退图片 | ||
| 344 | +}) | ||
| 345 | + | ||
| 346 | +// 监听验收图片上传实例响应式变化,解决u-upload不刷新问题 | ||
| 347 | +watch(() => acceptImgs.rawImgList.value, (newVal) => { | ||
| 348 | + acceptImgs.imgList = newVal | ||
| 349 | +}, { deep: true }) | ||
| 350 | + | ||
| 321 | // 分页查询列表 | 351 | // 分页查询列表 |
| 322 | const queryList = async (pageNo, pageSize) => { | 352 | const queryList = async (pageNo, pageSize) => { |
| 323 | try { | 353 | try { |
| @@ -431,10 +461,6 @@ const handleProcess = async (item) => { | @@ -431,10 +461,6 @@ const handleProcess = async (item) => { | ||
| 431 | uni.navigateTo({ | 461 | uni.navigateTo({ |
| 432 | url: `/pages-sub/problem/work-order-manage/add-maintain-order?tempKey=${tempKey}` | 462 | url: `/pages-sub/problem/work-order-manage/add-maintain-order?tempKey=${tempKey}` |
| 433 | }) | 463 | }) |
| 434 | - | ||
| 435 | - // uni.navigateTo({ | ||
| 436 | - // url: `/pages-sub/problem/work-order-manage/add-maintain-order?taskId=${item.taskId}&id=${item.id}&orderNo=${item.orderNo}` | ||
| 437 | - // }) | ||
| 438 | } | 464 | } |
| 439 | // 养护组长验收 - 打开弹窗 | 465 | // 养护组长验收 - 打开弹窗 |
| 440 | if (nextStepMap[item.taskKey]?.name == '养护组长验收') { | 466 | if (nextStepMap[item.taskKey]?.name == '养护组长验收') { |
| @@ -556,8 +582,15 @@ const handleAddOrder = () => { | @@ -556,8 +582,15 @@ const handleAddOrder = () => { | ||
| 556 | }); | 582 | }); |
| 557 | }; | 583 | }; |
| 558 | 584 | ||
| 559 | -// ========== 验收弹窗事件 ========== | ||
| 560 | -// 验收弹窗 - 确定按钮(含表单校验) | 585 | +// 验收弹窗 - 取消按钮(清空状态) |
| 586 | +const handleAcceptModalCancel = () => { | ||
| 587 | + acceptModalShow.value = false; | ||
| 588 | + acceptReason.value = ''; // 清空验收原因 | ||
| 589 | + acceptRadioValue.value = '0'; // 重置单选框为“通过” | ||
| 590 | + acceptImgs.clearImgs(); // 清空验收图片 | ||
| 591 | +}; | ||
| 592 | + | ||
| 593 | +// 验收弹窗 - 确定按钮(含returnImgs传参) | ||
| 561 | const handleAcceptModalConfirm = async () => { | 594 | const handleAcceptModalConfirm = async () => { |
| 562 | // 1. 校验验收原因是否为空 | 595 | // 1. 校验验收原因是否为空 |
| 563 | if (!acceptReason.value.trim()) { | 596 | if (!acceptReason.value.trim()) { |
| @@ -570,12 +603,13 @@ const handleAcceptModalConfirm = async () => { | @@ -570,12 +603,13 @@ const handleAcceptModalConfirm = async () => { | ||
| 570 | return; | 603 | return; |
| 571 | } | 604 | } |
| 572 | try { | 605 | try { |
| 573 | - // 3. 调用验收接口 | 606 | + // 3. 构建请求参数(含returnImgs) |
| 574 | console.log(currentAcceptItem.value) | 607 | console.log(currentAcceptItem.value) |
| 575 | let postData = {} | 608 | let postData = {} |
| 576 | if (currentAcceptItem.value?.taskKey == 'ylTeamLeaderConfirm') { // 养护组长验收 | 609 | if (currentAcceptItem.value?.taskKey == 'ylTeamLeaderConfirm') { // 养护组长验收 |
| 577 | postData = { | 610 | postData = { |
| 578 | - "taskKey": currentAcceptItem.value.taskKey, // ylTeamLeaderConfirm | 611 | + "returnImgs": acceptImgs.getSuccessImgUrls(), // 验收图片URL数组 |
| 612 | + "taskKey": currentAcceptItem.value.taskKey, | ||
| 579 | "workerDataId": currentAcceptItem.value.id, | 613 | "workerDataId": currentAcceptItem.value.id, |
| 580 | "taskId": currentAcceptItem.value.taskId, | 614 | "taskId": currentAcceptItem.value.taskId, |
| 581 | "operateType": acceptRadioValue.value == 0 ? nextStepMap[currentAcceptItem.value.taskKey].operateTypePass : nextStepMap[currentAcceptItem.value.taskKey].operateTypeNoPass, | 615 | "operateType": acceptRadioValue.value == 0 ? nextStepMap[currentAcceptItem.value.taskKey].operateTypePass : nextStepMap[currentAcceptItem.value.taskKey].operateTypeNoPass, |
| @@ -584,7 +618,8 @@ const handleAcceptModalConfirm = async () => { | @@ -584,7 +618,8 @@ const handleAcceptModalConfirm = async () => { | ||
| 584 | } | 618 | } |
| 585 | if (currentAcceptItem.value?.taskKey == 'ylInspector') { // 巡查员验收 | 619 | if (currentAcceptItem.value?.taskKey == 'ylInspector') { // 巡查员验收 |
| 586 | postData = { | 620 | postData = { |
| 587 | - "taskKey": currentAcceptItem.value.taskKey, //ylInspector | 621 | + "returnImgs": acceptImgs.getSuccessImgUrls(), // 验收图片URL数组 |
| 622 | + "taskKey": currentAcceptItem.value.taskKey, | ||
| 588 | "taskId": currentAcceptItem.value.taskId, | 623 | "taskId": currentAcceptItem.value.taskId, |
| 589 | "workerDataId": currentAcceptItem.value.id, | 624 | "workerDataId": currentAcceptItem.value.id, |
| 590 | "operateType": acceptRadioValue.value == 0 ? nextStepMap[currentAcceptItem.value.taskKey].operateTypePass : nextStepMap[currentAcceptItem.value.taskKey].operateTypeNoPass, | 625 | "operateType": acceptRadioValue.value == 0 ? nextStepMap[currentAcceptItem.value.taskKey].operateTypePass : nextStepMap[currentAcceptItem.value.taskKey].operateTypeNoPass, |
| @@ -595,12 +630,11 @@ const handleAcceptModalConfirm = async () => { | @@ -595,12 +630,11 @@ const handleAcceptModalConfirm = async () => { | ||
| 595 | const acceptRes = await universalApproval(postData); | 630 | const acceptRes = await universalApproval(postData); |
| 596 | // 4. 操作成功处理 | 631 | // 4. 操作成功处理 |
| 597 | uni.showToast({title: '提交成功', icon: 'success', duration: 1000}); | 632 | uni.showToast({title: '提交成功', icon: 'success', duration: 1000}); |
| 598 | - acceptModalShow.value = false; | ||
| 599 | - acceptReason.value = ''; // 清空验收原因 | 633 | + handleAcceptModalCancel(); // 清空状态 |
| 600 | paging.value?.reload(); // 刷新工单列表 | 634 | paging.value?.reload(); // 刷新工单列表 |
| 601 | } catch (error) { | 635 | } catch (error) { |
| 602 | // 5. 操作失败处理 | 636 | // 5. 操作失败处理 |
| 603 | - console.error('养护组长验收失败:', error); | 637 | + console.error('验收失败:', error); |
| 604 | uni.showToast({title: '验收提交失败,请重试', icon: 'none', duration: 1000}); | 638 | uni.showToast({title: '验收提交失败,请重试', icon: 'none', duration: 1000}); |
| 605 | } | 639 | } |
| 606 | }; | 640 | }; |
| @@ -621,7 +655,6 @@ onShow(() => { | @@ -621,7 +655,6 @@ onShow(() => { | ||
| 621 | // 顶部固定区域 | 655 | // 顶部固定区域 |
| 622 | .header-wrap { | 656 | .header-wrap { |
| 623 | background-color: #fff; | 657 | background-color: #fff; |
| 624 | - //box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); | ||
| 625 | } | 658 | } |
| 626 | 659 | ||
| 627 | // 搜索栏样式 | 660 | // 搜索栏样式 |
| @@ -662,7 +695,6 @@ onShow(() => { | @@ -662,7 +695,6 @@ onShow(() => { | ||
| 662 | 695 | ||
| 663 | } | 696 | } |
| 664 | 697 | ||
| 665 | - | ||
| 666 | // 回退modal样式 | 698 | // 回退modal样式 |
| 667 | .reject-modal-content { | 699 | .reject-modal-content { |
| 668 | width: 100%; | 700 | width: 100%; |
| @@ -681,7 +713,6 @@ onShow(() => { | @@ -681,7 +713,6 @@ onShow(() => { | ||
| 681 | } | 713 | } |
| 682 | } | 714 | } |
| 683 | 715 | ||
| 684 | - | ||
| 685 | .upload-wrap { | 716 | .upload-wrap { |
| 686 | margin-top: 20rpx; | 717 | margin-top: 20rpx; |
| 687 | 718 | ||
| @@ -696,6 +727,10 @@ onShow(() => { | @@ -696,6 +727,10 @@ onShow(() => { | ||
| 696 | margin-top: 20rpx; | 727 | margin-top: 20rpx; |
| 697 | } | 728 | } |
| 698 | 729 | ||
| 730 | +.mt-30 { | ||
| 731 | + margin-top: 30rpx; | ||
| 732 | +} | ||
| 733 | + | ||
| 699 | // 养护组长验收弹窗样式 | 734 | // 养护组长验收弹窗样式 |
| 700 | .accept-modal-content { | 735 | .accept-modal-content { |
| 701 | width: 100%; | 736 | width: 100%; |
pages-sub/problem/work-order-manage/order-detail.vue
| @@ -259,7 +259,7 @@ | @@ -259,7 +259,7 @@ | ||
| 259 | </view> | 259 | </view> |
| 260 | </view> | 260 | </view> |
| 261 | 261 | ||
| 262 | - <!-- 回退原因弹窗 --> | 262 | + <!-- 回退原因弹窗(新增图片上传) --> |
| 263 | <up-modal | 263 | <up-modal |
| 264 | :show="rejectModalShow" | 264 | :show="rejectModalShow" |
| 265 | title="回退原因" | 265 | title="回退原因" |
| @@ -278,17 +278,32 @@ | @@ -278,17 +278,32 @@ | ||
| 278 | maxlength="200" | 278 | maxlength="200" |
| 279 | class="reject-textarea" | 279 | class="reject-textarea" |
| 280 | /> | 280 | /> |
| 281 | + <!-- 新增:回退图片上传(选填) --> | ||
| 282 | + <view class="upload-wrap mt-20"> | ||
| 283 | + <view class="upload-title">上传回退图片(选填)</view> | ||
| 284 | + <up-upload | ||
| 285 | + :file-list="rejectImgs.imgList" | ||
| 286 | + @after-read="rejectImgs.uploadImgs" | ||
| 287 | + @delete="rejectImgs.deleteImg" | ||
| 288 | + multiple | ||
| 289 | + width="70" | ||
| 290 | + height="70" | ||
| 291 | + :max-count="rejectImgs.uploadConfig.maxCount" | ||
| 292 | + :upload-text="rejectImgs.uploadConfig.uploadText" | ||
| 293 | + :size-type="rejectImgs.uploadConfig.sizeType" | ||
| 294 | + /> | ||
| 295 | + </view> | ||
| 281 | </view> | 296 | </view> |
| 282 | </up-modal> | 297 | </up-modal> |
| 283 | 298 | ||
| 284 | - <!-- 验收弹窗 --> | 299 | + <!-- 验收弹窗(新增图片上传) --> |
| 285 | <up-modal | 300 | <up-modal |
| 286 | :show="acceptModalShow" | 301 | :show="acceptModalShow" |
| 287 | title="验收" | 302 | title="验收" |
| 288 | :closeOnClickOverlay="false" | 303 | :closeOnClickOverlay="false" |
| 289 | :showConfirmButton="true" | 304 | :showConfirmButton="true" |
| 290 | :showCancelButton="true" | 305 | :showCancelButton="true" |
| 291 | - @cancel="acceptModalShow=false" | 306 | + @cancel="handleAcceptModalCancel" |
| 292 | @confirm="handleAcceptModalConfirm" | 307 | @confirm="handleAcceptModalConfirm" |
| 293 | > | 308 | > |
| 294 | <view class="accept-modal-content"> | 309 | <view class="accept-modal-content"> |
| @@ -311,6 +326,22 @@ | @@ -311,6 +326,22 @@ | ||
| 311 | count | 326 | count |
| 312 | /> | 327 | /> |
| 313 | </view> | 328 | </view> |
| 329 | + | ||
| 330 | + <!-- 新增:验收图片上传(选填) --> | ||
| 331 | + <view class="upload-wrap mt-20"> | ||
| 332 | + <view class="upload-title">上传验收图片(选填)</view> | ||
| 333 | + <up-upload | ||
| 334 | + :file-list="acceptImgs.imgList" | ||
| 335 | + @after-read="acceptImgs.uploadImgs" | ||
| 336 | + @delete="acceptImgs.deleteImg" | ||
| 337 | + multiple | ||
| 338 | + width="70" | ||
| 339 | + height="70" | ||
| 340 | + :max-count="acceptImgs.uploadConfig.maxCount" | ||
| 341 | + :upload-text="acceptImgs.uploadConfig.uploadText" | ||
| 342 | + :size-type="acceptImgs.uploadConfig.sizeType" | ||
| 343 | + /> | ||
| 344 | + </view> | ||
| 314 | </view> | 345 | </view> |
| 315 | </up-modal> | 346 | </up-modal> |
| 316 | 347 | ||
| @@ -522,8 +553,7 @@ const activeTopTabClick = async (item: any) => { | @@ -522,8 +553,7 @@ const activeTopTabClick = async (item: any) => { | ||
| 522 | } | 553 | } |
| 523 | } | 554 | } |
| 524 | 555 | ||
| 525 | - | ||
| 526 | -// ========== 新增:回退弹窗相关状态 ========== | 556 | +// ========== 回退弹窗相关状态(新增图片上传实例) ========== |
| 527 | const rejectModalShow = ref(false); // 回退modal显示开关 | 557 | const rejectModalShow = ref(false); // 回退modal显示开关 |
| 528 | const rejectReason = ref(''); // 回退原因 | 558 | const rejectReason = ref(''); // 回退原因 |
| 529 | const currentRejectItem = ref<any>(null); // 当前回退工单 | 559 | const currentRejectItem = ref<any>(null); // 当前回退工单 |
| @@ -535,23 +565,35 @@ const rejectImgs = useUploadImgs({ | @@ -535,23 +565,35 @@ const rejectImgs = useUploadImgs({ | ||
| 535 | formRef: null, | 565 | formRef: null, |
| 536 | fieldName: 'rejectImgs' | 566 | fieldName: 'rejectImgs' |
| 537 | }) | 567 | }) |
| 538 | -// 监听上传实例响应式变化 | 568 | +// 监听上传实例响应式变化,解决u-upload不刷新问题 |
| 539 | watch(() => rejectImgs.rawImgList.value, (newVal) => { | 569 | watch(() => rejectImgs.rawImgList.value, (newVal) => { |
| 540 | rejectImgs.imgList = newVal | 570 | rejectImgs.imgList = newVal |
| 541 | }, { deep: true }) | 571 | }, { deep: true }) |
| 542 | 572 | ||
| 543 | -// ========== 新增:验收弹窗相关状态 ========== | 573 | +// ========== 验收弹窗相关状态(新增图片上传实例) ========== |
| 544 | const acceptModalShow = ref(false); // 验收弹窗显示开关 | 574 | const acceptModalShow = ref(false); // 验收弹窗显示开关 |
| 545 | const acceptRadioValue = ref('0'); // 单选框值,默认0(通过) | 575 | const acceptRadioValue = ref('0'); // 单选框值,默认0(通过) |
| 546 | const acceptReason = ref(''); // 验收原因 | 576 | const acceptReason = ref(''); // 验收原因 |
| 547 | const currentAcceptItem = ref<any>(null); // 当前验收的工单项 | 577 | const currentAcceptItem = ref<any>(null); // 当前验收的工单项 |
| 578 | +// 验收图片上传配置 | ||
| 579 | +const acceptImgs = useUploadImgs({ | ||
| 580 | + maxCount: 3, | ||
| 581 | + uploadText: '选择验收图片', | ||
| 582 | + sizeType: ['compressed'], | ||
| 583 | + formRef: null, | ||
| 584 | + fieldName: 'acceptImgs' | ||
| 585 | +}) | ||
| 586 | +// 监听验收图片上传实例响应式变化 | ||
| 587 | +watch(() => acceptImgs.rawImgList.value, (newVal) => { | ||
| 588 | + acceptImgs.imgList = newVal | ||
| 589 | +}, { deep: true }) | ||
| 548 | 590 | ||
| 549 | -// ========== 新增:生成临时key ========== | 591 | +// ========== 生成临时key ========== |
| 550 | const generateTempKey = () => { | 592 | const generateTempKey = () => { |
| 551 | return 'renew_order_' + Date.now() + '_' + Math.floor(Math.random() * 10000); | 593 | return 'renew_order_' + Date.now() + '_' + Math.floor(Math.random() * 10000); |
| 552 | }; | 594 | }; |
| 553 | 595 | ||
| 554 | -// ========== 新增:handleRenew 重新提交工单 ========== | 596 | +// ========== handleRenew 重新提交工单 ========== |
| 555 | const handleRenew = (item: any) => { | 597 | const handleRenew = (item: any) => { |
| 556 | // 校验工单有效性 | 598 | // 校验工单有效性 |
| 557 | if (!item || !item.id) { | 599 | if (!item || !item.id) { |
| @@ -577,7 +619,7 @@ const handleRenew = (item: any) => { | @@ -577,7 +619,7 @@ const handleRenew = (item: any) => { | ||
| 577 | }); | 619 | }); |
| 578 | }; | 620 | }; |
| 579 | 621 | ||
| 580 | -// ========== 新增:handleReject 打开回退弹窗 ========== | 622 | +// ========== handleReject 打开回退弹窗 ========== |
| 581 | const handleReject = (item: any) => { | 623 | const handleReject = (item: any) => { |
| 582 | // 校验工单有效性 | 624 | // 校验工单有效性 |
| 583 | if (!item || !item.id) { | 625 | if (!item || !item.id) { |
| @@ -590,14 +632,14 @@ const handleReject = (item: any) => { | @@ -590,14 +632,14 @@ const handleReject = (item: any) => { | ||
| 590 | rejectModalShow.value = true; // 显示回退modal | 632 | rejectModalShow.value = true; // 显示回退modal |
| 591 | }; | 633 | }; |
| 592 | 634 | ||
| 593 | -// ========== 新增:回退弹窗取消按钮 ========== | 635 | +// ========== 回退弹窗取消按钮 ========== |
| 594 | const handleRejectModalCancel = () => { | 636 | const handleRejectModalCancel = () => { |
| 595 | rejectModalShow.value = false; | 637 | rejectModalShow.value = false; |
| 596 | rejectReason.value = ''; | 638 | rejectReason.value = ''; |
| 597 | rejectImgs.clearImgs(); // 清空上传图片 | 639 | rejectImgs.clearImgs(); // 清空上传图片 |
| 598 | }; | 640 | }; |
| 599 | 641 | ||
| 600 | -// ========== 新增:确认回退工单 ========== | 642 | +// ========== 确认回退工单(新增returnImgs传参) ========== |
| 601 | const confirmReject = async () => { | 643 | const confirmReject = async () => { |
| 602 | // 严格校验回退原因(去除首尾空格) | 644 | // 严格校验回退原因(去除首尾空格) |
| 603 | const rejectReasonTrim = rejectReason.value.trim(); | 645 | const rejectReasonTrim = rejectReason.value.trim(); |
| @@ -615,9 +657,9 @@ const confirmReject = async () => { | @@ -615,9 +657,9 @@ const confirmReject = async () => { | ||
| 615 | // 显示加载中,防止重复提交 | 657 | // 显示加载中,防止重复提交 |
| 616 | uni.showLoading({title: '提交中...', mask: true}); | 658 | uni.showLoading({title: '提交中...', mask: true}); |
| 617 | 659 | ||
| 618 | - // 构建请求参数 | 660 | + // 构建请求参数(新增returnImgs) |
| 619 | const requestData = { | 661 | const requestData = { |
| 620 | - "returnImgs": rejectImgs.getSuccessImgUrls(), | 662 | + "returnImgs": rejectImgs.getSuccessImgUrls(), // 回退图片URL数组 |
| 621 | "workerDataId": currentRejectItem.value.id, | 663 | "workerDataId": currentRejectItem.value.id, |
| 622 | "taskKey": currentRejectItem.value.taskKey, | 664 | "taskKey": currentRejectItem.value.taskKey, |
| 623 | "taskId": currentRejectItem.value.taskId, | 665 | "taskId": currentRejectItem.value.taskId, |
| @@ -628,9 +670,13 @@ const confirmReject = async () => { | @@ -628,9 +670,13 @@ const confirmReject = async () => { | ||
| 628 | // 调用回退工单接口 | 670 | // 调用回退工单接口 |
| 629 | const res = await universalApproval(requestData); | 671 | const res = await universalApproval(requestData); |
| 630 | uni.showToast({title: '回退成功', icon: 'success', duration: 1000}); | 672 | uni.showToast({title: '回退成功', icon: 'success', duration: 1000}); |
| 673 | + | ||
| 631 | rejectModalShow.value = false; | 674 | rejectModalShow.value = false; |
| 632 | // 重新获取工单详情,刷新页面 | 675 | // 重新获取工单详情,刷新页面 |
| 633 | - await DetailQuery(taskId.value); | 676 | + // await DetailQuery(taskId.value); |
| 677 | + uni.reLaunch({ | ||
| 678 | + url: `/pages-sub/problem/work-order-manage/index` | ||
| 679 | + }); | ||
| 634 | } catch (error) { | 680 | } catch (error) { |
| 635 | console.error('回退工单失败:', error); | 681 | console.error('回退工单失败:', error); |
| 636 | uni.showToast({title: '网络异常,回退失败', icon: 'none', duration: 1000}); | 682 | uni.showToast({title: '网络异常,回退失败', icon: 'none', duration: 1000}); |
| @@ -640,7 +686,7 @@ const confirmReject = async () => { | @@ -640,7 +686,7 @@ const confirmReject = async () => { | ||
| 640 | } | 686 | } |
| 641 | }; | 687 | }; |
| 642 | 688 | ||
| 643 | -// ========== 新增:handleProcess 处理工单 ========== | 689 | +// ========== handleProcess 处理工单 ========== |
| 644 | const handleProcess = async (item: any) => { | 690 | const handleProcess = async (item: any) => { |
| 645 | console.log(nextStepMap[item.taskKey]?.name) | 691 | console.log(nextStepMap[item.taskKey]?.name) |
| 646 | try { | 692 | try { |
| @@ -672,6 +718,7 @@ const handleProcess = async (item: any) => { | @@ -672,6 +718,7 @@ const handleProcess = async (item: any) => { | ||
| 672 | currentAcceptItem.value = item; // 存储当前工单信息 | 718 | currentAcceptItem.value = item; // 存储当前工单信息 |
| 673 | acceptReason.value = ''; // 清空上次的验收原因 | 719 | acceptReason.value = ''; // 清空上次的验收原因 |
| 674 | acceptRadioValue.value = '0'; // 重置默认选中“通过” | 720 | acceptRadioValue.value = '0'; // 重置默认选中“通过” |
| 721 | + acceptImgs.clearImgs(); // 清空验收图片 | ||
| 675 | acceptModalShow.value = true; // 显示验收弹窗 | 722 | acceptModalShow.value = true; // 显示验收弹窗 |
| 676 | } | 723 | } |
| 677 | // 巡查员验收 - 打开弹窗 | 724 | // 巡查员验收 - 打开弹窗 |
| @@ -679,6 +726,7 @@ const handleProcess = async (item: any) => { | @@ -679,6 +726,7 @@ const handleProcess = async (item: any) => { | ||
| 679 | currentAcceptItem.value = item; // 存储当前工单信息 | 726 | currentAcceptItem.value = item; // 存储当前工单信息 |
| 680 | acceptReason.value = ''; // 清空上次的验收原因 | 727 | acceptReason.value = ''; // 清空上次的验收原因 |
| 681 | acceptRadioValue.value = '0'; // 重置默认选中“通过” | 728 | acceptRadioValue.value = '0'; // 重置默认选中“通过” |
| 729 | + acceptImgs.clearImgs(); // 清空验收图片 | ||
| 682 | acceptModalShow.value = true; // 显示验收弹窗 | 730 | acceptModalShow.value = true; // 显示验收弹窗 |
| 683 | } | 731 | } |
| 684 | 732 | ||
| @@ -690,7 +738,7 @@ const handleProcess = async (item: any) => { | @@ -690,7 +738,7 @@ const handleProcess = async (item: any) => { | ||
| 690 | content: "请确定是否结束工单?", | 738 | content: "请确定是否结束工单?", |
| 691 | success: async function (res) { | 739 | success: async function (res) { |
| 692 | if (res.confirm) { | 740 | if (res.confirm) { |
| 693 | - // 构建请求参数 | 741 | + // 构建请求参数(携带returnImgs) |
| 694 | const requestData = { | 742 | const requestData = { |
| 695 | "returnImgs": rejectImgs.getSuccessImgUrls(), | 743 | "returnImgs": rejectImgs.getSuccessImgUrls(), |
| 696 | "workerDataId": item.id, | 744 | "workerDataId": item.id, |
| @@ -717,7 +765,15 @@ const handleProcess = async (item: any) => { | @@ -717,7 +765,15 @@ const handleProcess = async (item: any) => { | ||
| 717 | } | 765 | } |
| 718 | }; | 766 | }; |
| 719 | 767 | ||
| 720 | -// ========== 新增:验收弹窗确认按钮 ========== | 768 | +// ========== 验收弹窗取消按钮(新增清空图片) ========== |
| 769 | +const handleAcceptModalCancel = () => { | ||
| 770 | + acceptModalShow.value = false; | ||
| 771 | + acceptReason.value = ''; | ||
| 772 | + acceptRadioValue.value = '0'; | ||
| 773 | + acceptImgs.clearImgs(); // 清空验收图片 | ||
| 774 | +}; | ||
| 775 | + | ||
| 776 | +// ========== 验收弹窗确认按钮(新增returnImgs传参) ========== | ||
| 721 | const handleAcceptModalConfirm = async () => { | 777 | const handleAcceptModalConfirm = async () => { |
| 722 | // 1. 校验验收原因是否为空 | 778 | // 1. 校验验收原因是否为空 |
| 723 | if (!acceptReason.value.trim()) { | 779 | if (!acceptReason.value.trim()) { |
| @@ -735,6 +791,7 @@ const handleAcceptModalConfirm = async () => { | @@ -735,6 +791,7 @@ const handleAcceptModalConfirm = async () => { | ||
| 735 | let postData: any = {} | 791 | let postData: any = {} |
| 736 | if (currentAcceptItem.value?.taskKey == 'ylTeamLeaderConfirm') { // 养护组长验收 | 792 | if (currentAcceptItem.value?.taskKey == 'ylTeamLeaderConfirm') { // 养护组长验收 |
| 737 | postData = { | 793 | postData = { |
| 794 | + "returnImgs": acceptImgs.getSuccessImgUrls(), // 验收图片URL数组 | ||
| 738 | "taskKey": currentAcceptItem.value.taskKey, // ylTeamLeaderConfirm | 795 | "taskKey": currentAcceptItem.value.taskKey, // ylTeamLeaderConfirm |
| 739 | "workerDataId": currentAcceptItem.value.id, | 796 | "workerDataId": currentAcceptItem.value.id, |
| 740 | "taskId": currentAcceptItem.value.taskId, | 797 | "taskId": currentAcceptItem.value.taskId, |
| @@ -744,6 +801,7 @@ const handleAcceptModalConfirm = async () => { | @@ -744,6 +801,7 @@ const handleAcceptModalConfirm = async () => { | ||
| 744 | } | 801 | } |
| 745 | if (currentAcceptItem.value?.taskKey == 'ylInspector') { // 巡查员验收 | 802 | if (currentAcceptItem.value?.taskKey == 'ylInspector') { // 巡查员验收 |
| 746 | postData = { | 803 | postData = { |
| 804 | + "returnImgs": acceptImgs.getSuccessImgUrls(), // 验收图片URL数组 | ||
| 747 | "taskKey": currentAcceptItem.value.taskKey, //ylInspector | 805 | "taskKey": currentAcceptItem.value.taskKey, //ylInspector |
| 748 | "taskId": currentAcceptItem.value.taskId, | 806 | "taskId": currentAcceptItem.value.taskId, |
| 749 | "workerDataId": currentAcceptItem.value.id, | 807 | "workerDataId": currentAcceptItem.value.id, |
| @@ -755,10 +813,12 @@ const handleAcceptModalConfirm = async () => { | @@ -755,10 +813,12 @@ const handleAcceptModalConfirm = async () => { | ||
| 755 | const acceptRes = await universalApproval(postData); | 813 | const acceptRes = await universalApproval(postData); |
| 756 | // 4. 操作成功处理 | 814 | // 4. 操作成功处理 |
| 757 | uni.showToast({title: '提交成功', icon: 'success', duration: 1000}); | 815 | uni.showToast({title: '提交成功', icon: 'success', duration: 1000}); |
| 758 | - acceptModalShow.value = false; | ||
| 759 | - acceptReason.value = ''; // 清空验收原因 | 816 | + handleAcceptModalCancel(); // 清空状态 |
| 760 | // 重新获取工单详情,刷新页面 | 817 | // 重新获取工单详情,刷新页面 |
| 761 | - await DetailQuery(taskId.value); | 818 | + // await DetailQuery(taskId.value); |
| 819 | + uni.reLaunch({ | ||
| 820 | + url: `/pages-sub/problem/work-order-manage/index` | ||
| 821 | + }); | ||
| 762 | } catch (error) { | 822 | } catch (error) { |
| 763 | // 5. 操作失败处理 | 823 | // 5. 操作失败处理 |
| 764 | console.error('验收失败:', error); | 824 | console.error('验收失败:', error); |
| @@ -926,7 +986,20 @@ onShow(() => { | @@ -926,7 +986,20 @@ onShow(() => { | ||
| 926 | } | 986 | } |
| 927 | } | 987 | } |
| 928 | 988 | ||
| 989 | +// 上传图片通用样式 | ||
| 990 | +.upload-wrap { | ||
| 991 | + margin-top: 20rpx; | ||
| 992 | + | ||
| 993 | + .upload-title { | ||
| 994 | + font-size: 28rpx; | ||
| 995 | + color: #333; | ||
| 996 | + margin-bottom: 10rpx; | ||
| 997 | + } | ||
| 998 | +} | ||
| 929 | 999 | ||
| 1000 | +.mt-20 { | ||
| 1001 | + margin-top: 20rpx; | ||
| 1002 | +} | ||
| 930 | 1003 | ||
| 931 | // 回退弹窗样式 | 1004 | // 回退弹窗样式 |
| 932 | .reject-modal-content { | 1005 | .reject-modal-content { |
| @@ -935,6 +1008,9 @@ onShow(() => { | @@ -935,6 +1008,9 @@ onShow(() => { | ||
| 935 | padding: 10rpx 0; | 1008 | padding: 10rpx 0; |
| 936 | } | 1009 | } |
| 937 | 1010 | ||
| 1011 | +.reject-textarea { | ||
| 1012 | + width: 100%; | ||
| 1013 | +} | ||
| 938 | 1014 | ||
| 939 | // 验收弹窗样式 | 1015 | // 验收弹窗样式 |
| 940 | .accept-modal-content { | 1016 | .accept-modal-content { |
| @@ -955,7 +1031,6 @@ onShow(() => { | @@ -955,7 +1031,6 @@ onShow(() => { | ||
| 955 | margin-top: 30rpx; | 1031 | margin-top: 30rpx; |
| 956 | } | 1032 | } |
| 957 | 1033 | ||
| 958 | - | ||
| 959 | .mt-30 { | 1034 | .mt-30 { |
| 960 | margin-top: 30rpx; | 1035 | margin-top: 30rpx; |
| 961 | } | 1036 | } |