Commit eaaa8665749b96944e86e66953be375f5ae85870

Authored by 刘淇
1 parent 34d239d6

全域巡查员

api/work-order-manage/work-order-manage.js
@@ -108,7 +108,7 @@ export const workorderCreate = (data) => { @@ -108,7 +108,7 @@ export const workorderCreate = (data) => {
108 108
109 109
110 /** 110 /**
111 - * 问题工单创建 大区经理 ai经理 督查员 111 + * 问题工单创建 大区经理 ai经理
112 * @returns {Promise} 112 * @returns {Promise}
113 */ 113 */
114 export const regionmgrWorkorderCreate = (data) => { 114 export const regionmgrWorkorderCreate = (data) => {
@@ -124,7 +124,7 @@ export const qyWorkorderCreate = (data) => { @@ -124,7 +124,7 @@ export const qyWorkorderCreate = (data) => {
124 }; 124 };
125 125
126 /** 126 /**
127 - * app端统一审批入口 -- 大区经理 ai经理 督查员 127 + * app端统一审批入口 -- 大区经理 ai经理
128 * @returns {Promise} 128 * @returns {Promise}
129 */ 129 */
130 export const regionmgrUniversalApproval = (params) => { 130 export const regionmgrUniversalApproval = (params) => {
@@ -133,13 +133,33 @@ export const regionmgrUniversalApproval = (params) => { @@ -133,13 +133,33 @@ export const regionmgrUniversalApproval = (params) => {
133 133
134 134
135 /** 135 /**
136 - * app端统一审批入口 大区经理 回退 分配和 全域巡查员 。 136 + * app端统一审批入口 大区经理 回退 分配和 全域巡查员 。
137 * @returns {Promise} 137 * @returns {Promise}
138 */ 138 */
139 export const qyUniversalApproval = (params) => { 139 export const qyUniversalApproval = (params) => {
140 return post('/app-api/bpm/universal/workorder/universalApproval',params); 140 return post('/app-api/bpm/universal/workorder/universalApproval',params);
141 }; 141 };
142 142
  143 +/**
  144 + * 问题工单创建 全域督察员创建工单
  145 + * @returns {Promise}
  146 + */
  147 +export const inspectorWorkorderCreate = (data) => {
  148 + return post('/app-api/bpm/inspector/workorder/create',data);
  149 +};
  150 +
  151 +
  152 +/**
  153 + * 问题工单创建 全域督察员发起审批入口
  154 + * @returns {Promise}
  155 + */
  156 +export const inspectorUniversalApproval = (data) => {
  157 + return post('/app-api/bpm/inspector/workorder/universalApproval',data);
  158 +};
  159 +
  160 +
  161 +
  162 +
143 163
144 164
145 165
pages-sub/problem/regional-order-manage/add-order.vue
@@ -203,7 +203,7 @@ import { ref, reactive } from 'vue' @@ -203,7 +203,7 @@ import { ref, reactive } from 'vue'
203 import { onReady, onShow, onLoad } from '@dcloudio/uni-app'; 203 import { onReady, onShow, onLoad } from '@dcloudio/uni-app';
204 import { useUploadImgs } from '@/common/utils/useUploadImgs' 204 import { useUploadImgs } from '@/common/utils/useUploadImgs'
205 import { getRoadListByLatLng } from '@/api/common' 205 import { getRoadListByLatLng } from '@/api/common'
206 -import { regionmgrUniversalApproval, regionmgrWorkorderCreate } from '@/api/work-order-manage/work-order-manage' 206 +import { regionmgrUniversalApproval, regionmgrWorkorderCreate, inspectorWorkorderCreate } from '@/api/work-order-manage/work-order-manage'
207 import { timeFormat } from '@/uni_modules/uview-plus' 207 import { timeFormat } from '@/uni_modules/uview-plus'
208 import { nextStepMap } from '@/common/utils/common' 208 import { nextStepMap } from '@/common/utils/common'
209 import { useUserStore } from '@/pinia/user'; 209 import { useUserStore } from '@/pinia/user';
@@ -562,6 +562,8 @@ const submitWorkOrder = async () => { @@ -562,6 +562,8 @@ const submitWorkOrder = async () => {
562 return; 562 return;
563 } 563 }
564 564
  565 +
  566 +
565 const commonSubmitData = { 567 const commonSubmitData = {
566 roadId: workOrderForm.roadId, 568 roadId: workOrderForm.roadId,
567 roadName: workOrderForm.roadName, 569 roadName: workOrderForm.roadName,
@@ -594,7 +596,13 @@ const submitWorkOrder = async () => { @@ -594,7 +596,13 @@ const submitWorkOrder = async () => {
594 } 596 }
595 res = await regionmgrUniversalApproval(renewSubmitData) 597 res = await regionmgrUniversalApproval(renewSubmitData)
596 } else { 598 } else {
597 - res = await regionmgrWorkorderCreate(commonSubmitData) 599 +
  600 + if( userStore.userInfo.roles.includes('team_leader_yl')){ // 督察员
  601 + res = await inspectorWorkorderCreate(commonSubmitData)
  602 + }else{
  603 + res = await regionmgrWorkorderCreate(commonSubmitData)
  604 + }
  605 +
598 } 606 }
599 607
600 uni.hideLoading() 608 uni.hideLoading()
pages-sub/problem/regional-order-manage/index.vue
@@ -150,8 +150,7 @@ @@ -150,8 +150,7 @@
150 </view> 150 </view>
151 151
152 <view class="u-body-item u-flex common-justify-between common-item-center"> 152 <view class="u-body-item u-flex common-justify-between common-item-center">
153 - <view class="u-body-item-title">紧急程度:  
154 - {{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }} 153 + <view class="u-body-item-title">紧急程度:{{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }}
155 </view> 154 </view>
156 <view class=" "> 155 <view class=" ">
157 <up-button type="primary" size="mini" @click="handleDetail(item)">工单详情</up-button> 156 <up-button type="primary" size="mini" @click="handleDetail(item)">工单详情</up-button>
@@ -431,7 +430,6 @@ const handleRenew = (item) =&gt; { @@ -431,7 +430,6 @@ const handleRenew = (item) =&gt; {
431 430
432 // 1. 生成唯一临时标识 431 // 1. 生成唯一临时标识
433 const tempKey = generateTempKey(); 432 const tempKey = generateTempKey();
434 -  
435 // 2. 将完整工单数据存入本地临时存储(同步存储,确保数据立即生效) 433 // 2. 将完整工单数据存入本地临时存储(同步存储,确保数据立即生效)
436 try { 434 try {
437 uni.setStorageSync(tempKey, item); 435 uni.setStorageSync(tempKey, item);
@@ -452,7 +450,6 @@ const handleProcess = async (item) =&gt; { @@ -452,7 +450,6 @@ const handleProcess = async (item) =&gt; {
452 console.log(nextStepMap[item.taskKey].name) 450 console.log(nextStepMap[item.taskKey].name)
453 try { 451 try {
454 if (nextStepMap[item.taskKey]?.name == '大区经理分配') { 452 if (nextStepMap[item.taskKey]?.name == '大区经理分配') {
455 - // ======== 核心修改:大区经理分配 改成和养护员待实施一样的逻辑 start ========  
456 // ① 生成唯一临时key(统一规则,避免冲突) 453 // ① 生成唯一临时key(统一规则,避免冲突)
457 const tempKey = `distribute_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`; 454 const tempKey = `distribute_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`;
458 // ② 存储完整item到本地缓存(同步存储,确保立即生效) 455 // ② 存储完整item到本地缓存(同步存储,确保立即生效)
@@ -467,10 +464,8 @@ const handleProcess = async (item) =&gt; { @@ -467,10 +464,8 @@ const handleProcess = async (item) =&gt; {
467 uni.navigateTo({ 464 uni.navigateTo({
468 url: `/pages-sub/problem/regional-order-manage/distribution-order?tempKey=${tempKey}` 465 url: `/pages-sub/problem/regional-order-manage/distribution-order?tempKey=${tempKey}`
469 }) 466 })
470 - // ======== 核心修改 end ========  
471 } 467 }
472 if (nextStepMap[item.taskKey]?.name == '养护员待实施') { 468 if (nextStepMap[item.taskKey]?.name == '养护员待实施') {
473 -  
474 // ① 生成唯一临时key(和重新提交工单逻辑一致,避免冲突) 469 // ① 生成唯一临时key(和重新提交工单逻辑一致,避免冲突)
475 const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`; 470 const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`;
476 471
@@ -605,7 +600,7 @@ const confirmReject = async () =&gt; { @@ -605,7 +600,7 @@ const confirmReject = async () =&gt; {
605 const handleAddOrder = () => { 600 const handleAddOrder = () => {
606 // patrol_global 全域巡查员 601 // patrol_global 全域巡查员
607 // regional_manager 大区经理 602 // regional_manager 大区经理
608 - console.log(userStore.userInfo?.roles.includes('patrol_global')) 603 + console.log(userStore.userInfo?.roles.includes('team_leader_yl'))
609 if(userStore.userInfo?.roles.includes('patrol_global')){ 604 if(userStore.userInfo?.roles.includes('patrol_global')){
610 uni.navigateTo({ 605 uni.navigateTo({
611 url: '/pages-sub/problem/regional-order-manage/add-patrol-order' 606 url: '/pages-sub/problem/regional-order-manage/add-patrol-order'
@@ -616,6 +611,12 @@ const handleAddOrder = () =&gt; { @@ -616,6 +611,12 @@ const handleAddOrder = () =&gt; {
616 url: '/pages-sub/problem/regional-order-manage/add-order' 611 url: '/pages-sub/problem/regional-order-manage/add-order'
617 }); 612 });
618 } 613 }
  614 +
  615 + if(userStore.userInfo?.roles.includes('team_leader_yl')){
  616 + uni.navigateTo({
  617 + url: '/pages-sub/problem/regional-order-manage/add-order'
  618 + });
  619 + }
619 }; 620 };
620 621
621 // 验收弹窗 - 取消按钮(清空状态) 622 // 验收弹窗 - 取消按钮(清空状态)
pages-sub/problem/regional-order-manage/order-detail.vue
@@ -253,23 +253,23 @@ @@ -253,23 +253,23 @@
253 </view> 253 </view>
254 254
255 <!-- activeTab==0的时候才出现, 也就是待办 --> 255 <!-- activeTab==0的时候才出现, 也就是待办 -->
256 -<!-- <view v-if="activeTab==0&&nextStepMap[orderDetail.taskKey]" class="fixed-bottom-btn-wrap">-->  
257 -<!-- <view class="u-body-item u-flex common-justify-between common-item-center ">-->  
258 -<!-- <up-button type="warning" size="normal" @click="handleReject(orderDetail)"-->  
259 -<!-- v-show="nextStepMap[orderDetail.taskKey].backShow">回退-->  
260 -<!-- </up-button>--> 256 + <view v-if="activeTab==0&&nextStepMap[orderDetail.taskKey]" class="fixed-bottom-btn-wrap">
  257 + <view class="u-body-item u-flex common-justify-between common-item-center ">
  258 + <up-button type="warning" size="normal" @click="handleReject(orderDetail)"
  259 + v-show="nextStepMap[orderDetail.taskKey].backShow">回退
  260 + </up-button>
261 261
262 -<!-- <up-button type="success" size="normal" @click="handleRenew(orderDetail)"-->  
263 -<!-- v-show="nextStepMap[orderDetail.taskKey].renewShow">重新提交-->  
264 -<!-- </up-button>--> 262 + <up-button type="success" size="normal" @click="handleRenew(orderDetail)"
  263 + v-show="nextStepMap[orderDetail.taskKey].renewShow">重新提交
  264 + </up-button>
265 265
266 -<!-- <up-button type="primary" size="normal" @click="handleProcess(orderDetail)">{{-->  
267 -<!-- nextStepMap[orderDetail.taskKey].btnText-->  
268 -<!-- }}-->  
269 -<!-- </up-button>--> 266 + <up-button type="primary" size="normal" @click="handleProcess(orderDetail)">{{
  267 + nextStepMap[orderDetail.taskKey].btnText
  268 + }}
  269 + </up-button>
270 270
271 -<!-- </view>-->  
272 -<!-- </view>--> 271 + </view>
  272 + </view>
273 273
274 <!-- 回退原因弹窗(新增图片上传) --> 274 <!-- 回退原因弹窗(新增图片上传) -->
275 <up-modal 275 <up-modal
@@ -361,7 +361,7 @@ @@ -361,7 +361,7 @@
361 </template> 361 </template>
362 362
363 <script setup lang="ts"> 363 <script setup lang="ts">
364 -import {ref, watch} from 'vue'; 364 +import {ref} from 'vue';
365 import {onLoad, onShow} from '@dcloudio/uni-app'; 365 import {onLoad, onShow} from '@dcloudio/uni-app';
366 import {timeFormat} from '@/uni_modules/uview-plus'; 366 import {timeFormat} from '@/uni_modules/uview-plus';
367 import { 367 import {
@@ -369,8 +369,8 @@ import { @@ -369,8 +369,8 @@ import {
369 getDoneTaskDetail, 369 getDoneTaskDetail,
370 getTodoTaskDetail, 370 getTodoTaskDetail,
371 getApprovalDetail, 371 getApprovalDetail,
372 - regionmgrUniversalApproval  
373 - 372 + regionmgrUniversalApproval,
  373 + qyUniversalApproval
374 } from '@/api/work-order-manage/work-order-manage'; 374 } from '@/api/work-order-manage/work-order-manage';
375 import {nextStepMap, buzStatusMap, calculateFormatTimeDiff} from '@/common/utils/common' 375 import {nextStepMap, buzStatusMap, calculateFormatTimeDiff} from '@/common/utils/common'
376 // 引入图片上传组合式函数 376 // 引入图片上传组合式函数
@@ -610,7 +610,6 @@ const handleRenew = (item: any) =&gt; { @@ -610,7 +610,6 @@ const handleRenew = (item: any) =&gt; {
610 610
611 // 1. 生成唯一临时标识 611 // 1. 生成唯一临时标识
612 const tempKey = generateTempKey(); 612 const tempKey = generateTempKey();
613 -  
614 // 2. 将完整工单数据存入本地临时存储(同步存储,确保数据立即生效) 613 // 2. 将完整工单数据存入本地临时存储(同步存储,确保数据立即生效)
615 try { 614 try {
616 uni.setStorageSync(tempKey, item); 615 uni.setStorageSync(tempKey, item);
@@ -620,9 +619,9 @@ const handleRenew = (item: any) =&gt; { @@ -620,9 +619,9 @@ const handleRenew = (item: any) =&gt; {
620 return; 619 return;
621 } 620 }
622 621
623 - // 3. URL 仅传递「唯一标识」和「重新提交标记」 622 + // 3. URL 仅传递「唯一标识」和「重新提交标记」(数据量极小,无长度问题)
624 uni.navigateTo({ 623 uni.navigateTo({
625 - url: `/pages-sub/problem/work-order-manage/add-order?isRenew=1&tempKey=${tempKey}` 624 + url: `/pages-sub/problem/regional-order-manage/add-patrol-order?isRenew=1&tempKey=${tempKey}`
626 }); 625 });
627 }; 626 };
628 627
@@ -675,14 +674,14 @@ const confirmReject = async () =&gt; { @@ -675,14 +674,14 @@ const confirmReject = async () =&gt; {
675 "reason": rejectReasonTrim 674 "reason": rejectReasonTrim
676 }; 675 };
677 // 调用回退工单接口 676 // 调用回退工单接口
678 - const res = await regionmgrUniversalApproval(requestData); 677 + const res = await qyUniversalApproval(requestData);
679 uni.showToast({title: '回退成功', icon: 'success', duration: 1000}); 678 uni.showToast({title: '回退成功', icon: 'success', duration: 1000});
680 679
681 rejectModalShow.value = false; 680 rejectModalShow.value = false;
682 // 重新获取工单详情,刷新页面 681 // 重新获取工单详情,刷新页面
683 // await DetailQuery(taskId.value); 682 // await DetailQuery(taskId.value);
684 uni.reLaunch({ 683 uni.reLaunch({
685 - url: `/pages-sub/problem/work-order-manage/index` 684 + url: `/pages-sub/problem/regional-order-manage/index`
686 }); 685 });
687 } catch (error) { 686 } catch (error) {
688 console.error('回退工单失败:', error); 687 console.error('回退工单失败:', error);
@@ -694,19 +693,30 @@ const confirmReject = async () =&gt; { @@ -694,19 +693,30 @@ const confirmReject = async () =&gt; {
694 }; 693 };
695 694
696 // ========== handleProcess 处理工单 ========== 695 // ========== handleProcess 处理工单 ==========
697 -const handleProcess = async (item: any) => {  
698 - console.log(nextStepMap[item.taskKey]?.name) 696 +const handleProcess = async (item) => {
  697 + console.log(nextStepMap[item.taskKey].name)
699 try { 698 try {
700 - if (nextStepMap[item.taskKey]?.name == '养护组长分配') { 699 + if (nextStepMap[item.taskKey]?.name == '大区经理分配') {
  700 + // ① 生成唯一临时key(统一规则,避免冲突)
  701 + const tempKey = `distribute_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`;
  702 + // ② 存储完整item到本地缓存(同步存储,确保立即生效)
  703 + try {
  704 + uni.setStorageSync(tempKey, item);
  705 + } catch (error) {
  706 + console.error('存储分配工单数据失败:', error);
  707 + uni.showToast({title: '数据存储异常,无法跳转', icon: 'none'});
  708 + return;
  709 + }
  710 + // ③ URL仅传递临时key,无其他冗余参数
701 uni.navigateTo({ 711 uni.navigateTo({
702 - url: `/pages-sub/problem/work-order-manage/distribution-order?taskId=${item.taskId}&orderNo=${item.orderNo}&id=${item.id}` 712 + url: `/pages-sub/problem/regional-order-manage/distribution-order?tempKey=${tempKey}`
703 }) 713 })
704 } 714 }
705 if (nextStepMap[item.taskKey]?.name == '养护员待实施') { 715 if (nextStepMap[item.taskKey]?.name == '养护员待实施') {
706 - // ① 生成唯一临时key 716 + // ① 生成唯一临时key(和重新提交工单逻辑一致,避免冲突)
707 const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`; 717 const tempKey = `maintain_order_${Date.now()}_${Math.floor(Math.random() * 10000)}`;
708 718
709 - // ② 存储完整item到本地缓存 719 + // ② 存储完整item到本地缓存(同步存储,确保立即生效)
710 try { 720 try {
711 uni.setStorageSync(tempKey, item); 721 uni.setStorageSync(tempKey, item);
712 } catch (error) { 722 } catch (error) {
@@ -715,9 +725,9 @@ const handleProcess = async (item: any) =&gt; { @@ -715,9 +725,9 @@ const handleProcess = async (item: any) =&gt; {
715 return; 725 return;
716 } 726 }
717 727
718 - // ③ URL仅传递临时key 728 + // ③ URL仅传递临时key(可选:携带必要简单参数,方便目标页面快速使用)
719 uni.navigateTo({ 729 uni.navigateTo({
720 - url: `/pages-sub/problem/work-order-manage/add-maintain-order?tempKey=${tempKey}` 730 + url: `/pages-sub/problem/regional-order-manage/add-maintain-order?tempKey=${tempKey}`
721 }) 731 })
722 } 732 }
723 // 养护组长验收 - 打开弹窗 733 // 养护组长验收 - 打开弹窗
@@ -725,7 +735,6 @@ const handleProcess = async (item: any) =&gt; { @@ -725,7 +735,6 @@ const handleProcess = async (item: any) =&gt; {
725 currentAcceptItem.value = item; // 存储当前工单信息 735 currentAcceptItem.value = item; // 存储当前工单信息
726 acceptReason.value = ''; // 清空上次的验收原因 736 acceptReason.value = ''; // 清空上次的验收原因
727 acceptRadioValue.value = '0'; // 重置默认选中“通过” 737 acceptRadioValue.value = '0'; // 重置默认选中“通过”
728 - acceptImgs.clearImgs(); // 清空验收图片  
729 acceptModalShow.value = true; // 显示验收弹窗 738 acceptModalShow.value = true; // 显示验收弹窗
730 } 739 }
731 // 巡查员验收 - 打开弹窗 740 // 巡查员验收 - 打开弹窗
@@ -733,7 +742,6 @@ const handleProcess = async (item: any) =&gt; { @@ -733,7 +742,6 @@ const handleProcess = async (item: any) =&gt; {
733 currentAcceptItem.value = item; // 存储当前工单信息 742 currentAcceptItem.value = item; // 存储当前工单信息
734 acceptReason.value = ''; // 清空上次的验收原因 743 acceptReason.value = ''; // 清空上次的验收原因
735 acceptRadioValue.value = '0'; // 重置默认选中“通过” 744 acceptRadioValue.value = '0'; // 重置默认选中“通过”
736 - acceptImgs.clearImgs(); // 清空验收图片  
737 acceptModalShow.value = true; // 显示验收弹窗 745 acceptModalShow.value = true; // 显示验收弹窗
738 } 746 }
739 747
@@ -745,21 +753,21 @@ const handleProcess = async (item: any) =&gt; { @@ -745,21 +753,21 @@ const handleProcess = async (item: any) =&gt; {
745 content: "请确定是否结束工单?", 753 content: "请确定是否结束工单?",
746 success: async function (res) { 754 success: async function (res) {
747 if (res.confirm) { 755 if (res.confirm) {
748 - // 构建请求参数(携带returnImgs) 756 + // 构建请求参数
749 const requestData = { 757 const requestData = {
750 - "returnImgs": rejectImgs.getSuccessImgUrls(), 758 + "returnImgs": rejectImgs.getSuccessImgUrls(), // 改造后:获取上传成功的图片URL
751 "workerDataId": item.id, 759 "workerDataId": item.id,
752 - "taskKey": 'ylInspectorStart', 760 + "taskKey":'ylInspectorStart',
753 "taskId": item.taskId, 761 "taskId": item.taskId,
754 "operateType": 200, 762 "operateType": 200,
755 "agree": 1, 763 "agree": 1,
756 "reason": '结束工单' 764 "reason": '结束工单'
757 }; 765 };
758 // 调用回退工单接口 766 // 调用回退工单接口
759 - const res = await regionmgrUniversalApproval(requestData); 767 + const res = await qyUniversalApproval(requestData);
760 uni.showToast({title: '结束成功', icon: 'success', duration: 1000}); 768 uni.showToast({title: '结束成功', icon: 'success', duration: 1000});
761 - // 重新获取工单详情,刷新页面  
762 - await DetailQuery(taskId.value); 769 + rejectModalShow.value = false;
  770 + paging.value?.reload(); // 刷新列表
763 } else if (res.cancel) { 771 } else if (res.cancel) {
764 console.log("用户点击取消"); 772 console.log("用户点击取消");
765 } 773 }
pages-sub/problem/work-order-manage/index.vue
@@ -150,8 +150,7 @@ @@ -150,8 +150,7 @@
150 </view> 150 </view>
151 151
152 <view class="u-body-item u-flex common-justify-between common-item-center"> 152 <view class="u-body-item u-flex common-justify-between common-item-center">
153 - <view class="u-body-item-title">紧急程度:  
154 - {{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }} 153 + <view class="u-body-item-title">紧急程度:{{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }}
155 </view> 154 </view>
156 <view class=" "> 155 <view class=" ">
157 <up-button type="primary" size="mini" @click="handleDetail(item)">工单详情</up-button> 156 <up-button type="primary" size="mini" @click="handleDetail(item)">工单详情</up-button>