Commit eaaa8665749b96944e86e66953be375f5ae85870

Authored by 刘淇
1 parent 34d239d6

全域巡查员

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