Commit 5059c4dd67a9128daaa5fb6ff1ddd6c730c4fa3b

Authored by 刘淇
1 parent fa775c6b

养护员提交养护工单

api/work-order-manage/work-order-manage.js
... ... @@ -16,6 +16,17 @@ export const ylWorkerExcuteWOrder = (params) => {
16 16 };
17 17  
18 18 /**
  19 + * app端统一审批入口
  20 + * @returns {Promise}
  21 + */
  22 +export const universalApproval = (params) => {
  23 + return post('/app-api/bpm/garden/workorder/universalApproval',params);
  24 +};
  25 +
  26 +
  27 +
  28 +
  29 +/**
19 30 * 获得园林养护员列表、共同处理人也调用此接口
20 31 * @returns {Promise}
21 32 */
... ...
common/utils/common.js
1 1 export const nextStepMap = {
2   - ylTeamLeader: '养护组长分配', //
3   - ylWorker:'养护员待实施'
4   -
  2 + ylTeamLeader: {
  3 + name: '养护组长分配',
  4 + btnText:'分配',
  5 + operateTypePass: 110,
  6 + backShow:true
  7 + },
  8 + ylWorker: {
  9 + name: '养护员待实施',
  10 + btnText:'实施',
  11 + operateTypePass: 120,
  12 + backShow:true
  13 + },
  14 + ylTeamLeaderConfirm: {
  15 + name: '养护组长验收',
  16 + btnText:'验收',
  17 + operateTypePass: 130, //养护组长验收通过: 130
  18 + operateTypeNoPass: 230, // 养护组长验收不通过:230
  19 + backShow:false
  20 + },
5 21 }
6 22 \ No newline at end of file
... ...
pages-sub/problem/work-order-manage/add-maintain-order.vue
... ... @@ -5,7 +5,7 @@
5 5 label-position="left"
6 6 :model="workOrderForm"
7 7 ref="workOrderFormRef"
8   - labelWidth="190rpx"
  8 + labelWidth="170rpx"
9 9 >
10 10 <!-- 1. 工单编号(只读展示,从URL获取) -->
11 11 <up-form-item
... ... @@ -31,7 +31,7 @@
31 31 v-model="workOrderForm.coProcessorName"
32 32 disabled
33 33 disabled-color="#ffffff"
34   - placeholder="请选择共同处理人(支持多选)"
  34 + placeholder="请选择共同处理人"
35 35 border="none"
36 36 ></up-input>
37 37 <template #right>
... ... @@ -41,7 +41,7 @@
41 41  
42 42 <!-- 3. 处理建议(处理情况描述,必填) -->
43 43 <up-form-item
44   - label="处理情况描述"
  44 + label="处理情况"
45 45 prop="reason"
46 46 required
47 47 >
... ... @@ -50,97 +50,103 @@
50 50 v-model.trim="workOrderForm.reason"
51 51 count
52 52 maxlength="200"
53   - rows="4"
54   - border="none"
  53 + rows="5"
55 54 @blur="() => workOrderFormRef.validateField('reason')"
56 55 ></up-textarea>
57 56 </up-form-item>
58 57  
59   -
60   - <!-- Tabs标签栏(图片切换:开始、进行中、结束、人员、材料) -->
61   - <view class="tabs-wrap commonPageLRpadding" style="margin-top: 30rpx;">
62   - <up-tabs
63   - v-model="activeTab"
64   - :list="tabList"
65   - line-width="40rpx"
66   - active-color="#1989fa"
67   - inactive-color="#666666"
68   -
69   - @change = "imgTabChange"
70   - ></up-tabs>
71   - <view class="tab-content" style="padding-top: 20rpx; background: #fff; padding-bottom: 20rpx;">
72   - <!-- 开始阶段图片上传 -->
73   - <view v-if="activeTab == 0">
74   - <up-form-item prop="startImgs">
75   - <up-upload
76   - :file-list="startImgs.imgList"
77   - @after-read="startImgs.uploadImgs"
78   - @delete="startImgs.deleteImg"
79   - multiple
80   - :max-count="startImgs.uploadConfig.maxCount"
81   - :upload-text="startImgs.uploadConfig.uploadText"
82   - :size-type="startImgs.uploadConfig.sizeType"
83   - ></up-upload>
84   - </up-form-item>
85   - </view>
86   - <!-- 进行中阶段图片上传 -->
87   - <view v-if="activeTab == 1">
88   - <up-form-item prop="processingImgs">
89   - <up-upload
90   - :file-list="processingImgs.imgList"
91   - @after-read="processingImgs.uploadImgs"
92   - @delete="processingImgs.deleteImg"
93   - multiple
94   - :max-count="processingImgs.uploadConfig.maxCount"
95   - :upload-text="processingImgs.uploadConfig.uploadText"
96   - :size-type="processingImgs.uploadConfig.sizeType"
97   - ></up-upload>
98   - </up-form-item>
99   - </view>
100   - <!-- 结束阶段图片上传 -->
101   - <view v-if="activeTab == 2">
102   - <up-form-item prop="endImgs">
103   - <up-upload
104   - :file-list="endImgs.imgList"
105   - @after-read="endImgs.uploadImgs"
106   - @delete="endImgs.deleteImg"
107   - multiple
108   - :max-count="endImgs.uploadConfig.maxCount"
109   - :upload-text="endImgs.uploadConfig.uploadText"
110   - :size-type="endImgs.uploadConfig.sizeType"
111   - ></up-upload>
112   - </up-form-item>
113   - </view>
114   - <!-- 人员配置图片上传 -->
115   - <view v-if="activeTab == 3">
116   - <up-form-item prop="personImgs">
117   - <up-upload
118   - :file-list="personImgs.imgList"
119   - @after-read="personImgs.uploadImgs"
120   - @delete="personImgs.deleteImg"
121   - multiple
122   - :max-count="personImgs.uploadConfig.maxCount"
123   - :upload-text="personImgs.uploadConfig.uploadText"
124   - :size-type="personImgs.uploadConfig.sizeType"
125   - ></up-upload>
126   - </up-form-item>
127   - </view>
128   - <!-- 材料使用图片上传 -->
129   - <view v-if="activeTab == 4">
130   - <up-form-item prop="materialImgs">
131   - <up-upload
132   - :file-list="materialImgs.imgList"
133   - @after-read="materialImgs.uploadImgs"
134   - @delete="materialImgs.deleteImg"
135   - multiple
136   - :max-count="materialImgs.uploadConfig.maxCount"
137   - :upload-text="materialImgs.uploadConfig.uploadText"
138   - :size-type="materialImgs.uploadConfig.sizeType"
139   - ></up-upload>
140   - </up-form-item>
  58 + <!-- Tabs标签栏(图片切换:开始、进行中、结束、人员、材料)- 改造后 -->
  59 + <view class="tabs-wrap " style="margin-top: 30rpx;">
  60 + <up-tabs
  61 + v-model="activeTab"
  62 + :list="tabList"
  63 + line-width="40rpx"
  64 + active-color="#1989fa"
  65 + inactive-color="#666666"
  66 + @change = "imgTabChange"
  67 + >
  68 + <!-- 使用content插槽自定义每个tab的内容,添加红色*号 -->
  69 + <template #content="{ item, index }">
  70 + <view class="tab-item-content">
  71 + <!-- 给索引0(开始)和索引2(结束)添加红色*号 -->
  72 + <text v-if="index === 0 || index === 2" class="required-star">*</text>
  73 + <text class="tab-text">{{ item.name }}</text>
  74 + </view>
  75 + </template>
  76 + </up-tabs>
  77 + <view class="tab-content" style="padding-top: 20rpx; background: #fff; padding-bottom: 20rpx;">
  78 + <!-- 开始阶段图片上传 -->
  79 + <view v-if="activeTab == 0">
  80 + <up-form-item prop="startImgs">
  81 + <up-upload
  82 + :file-list="startImgs.imgList"
  83 + @after-read="startImgs.uploadImgs"
  84 + @delete="startImgs.deleteImg"
  85 + multiple
  86 + :max-count="startImgs.uploadConfig.maxCount"
  87 + :upload-text="startImgs.uploadConfig.uploadText"
  88 + :size-type="startImgs.uploadConfig.sizeType"
  89 + ></up-upload>
  90 + </up-form-item>
  91 + </view>
  92 + <!-- 进行中阶段图片上传 -->
  93 + <view v-if="activeTab == 1">
  94 + <up-form-item prop="processingImgs">
  95 + <up-upload
  96 + :file-list="processingImgs.imgList"
  97 + @after-read="processingImgs.uploadImgs"
  98 + @delete="processingImgs.deleteImg"
  99 + multiple
  100 + :max-count="processingImgs.uploadConfig.maxCount"
  101 + :upload-text="processingImgs.uploadConfig.uploadText"
  102 + :size-type="processingImgs.uploadConfig.sizeType"
  103 + ></up-upload>
  104 + </up-form-item>
  105 + </view>
  106 + <!-- 结束阶段图片上传 -->
  107 + <view v-if="activeTab == 2">
  108 + <up-form-item prop="endImgs">
  109 + <up-upload
  110 + :file-list="endImgs.imgList"
  111 + @after-read="endImgs.uploadImgs"
  112 + @delete="endImgs.deleteImg"
  113 + multiple
  114 + :max-count="endImgs.uploadConfig.maxCount"
  115 + :upload-text="endImgs.uploadConfig.uploadText"
  116 + :size-type="endImgs.uploadConfig.sizeType"
  117 + ></up-upload>
  118 + </up-form-item>
  119 + </view>
  120 + <!-- 人员配置图片上传 -->
  121 + <view v-if="activeTab == 3">
  122 + <up-form-item prop="personImgs">
  123 + <up-upload
  124 + :file-list="personImgs.imgList"
  125 + @after-read="personImgs.uploadImgs"
  126 + @delete="personImgs.deleteImg"
  127 + multiple
  128 + :max-count="personImgs.uploadConfig.maxCount"
  129 + :upload-text="personImgs.uploadConfig.uploadText"
  130 + :size-type="personImgs.uploadConfig.sizeType"
  131 + ></up-upload>
  132 + </up-form-item>
  133 + </view>
  134 + <!-- 材料使用图片上传 -->
  135 + <view v-if="activeTab == 4">
  136 + <up-form-item prop="materialImgs">
  137 + <up-upload
  138 + :file-list="materialImgs.imgList"
  139 + @after-read="materialImgs.uploadImgs"
  140 + @delete="materialImgs.deleteImg"
  141 + multiple
  142 + :max-count="materialImgs.uploadConfig.maxCount"
  143 + :upload-text="materialImgs.uploadConfig.uploadText"
  144 + :size-type="materialImgs.uploadConfig.sizeType"
  145 + ></up-upload>
  146 + </up-form-item>
  147 + </view>
141 148 </view>
142 149 </view>
143   - </view>
144 150 </up-form>
145 151 </view>
146 152  
... ... @@ -168,9 +174,9 @@
168 174 import { ref, reactive, watch } from 'vue'
169 175 import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
170 176 import { useUploadImgs } from '@/common/utils/useUploadImgs'
171   -import { getYlWorkersPage, ylWorkerExcuteWOrder } from '@/api/work-order-manage/work-order-manage'
  177 +import { getYlWorkersPage, universalApproval } from '@/api/work-order-manage/work-order-manage'
  178 +import { nextStepMap } from '@/common/utils/common'
172 179 import { useUserStore } from '@/pinia/user';
173   -
174 180 const userStore = useUserStore();
175 181  
176 182 // 表单Ref
... ... @@ -199,6 +205,8 @@ const coProcessorList = ref([])
199 205  
200 206 // 工单表单数据(仅保留需要的字段)
201 207 const workOrderForm = reactive({
  208 + workerDataId:'',
  209 + taskId:'', // 任务id
202 210 orderNo: '', // 工单编号
203 211 coProcessorId: '', // 共同处理人ID数组(多选)
204 212 coProcessorName: '', // 共同处理人名称数组(多选)
... ... @@ -209,7 +217,7 @@ const workOrderForm = reactive({
209 217 // 开始阶段图片
210 218 const startImgs = useUploadImgs({
211 219 maxCount: 3,
212   - uploadText: '选择开始阶段照片',
  220 + uploadText: '选择开始照片',
213 221 sizeType: ['compressed'],
214 222 formRef: workOrderFormRef,
215 223 fieldName: 'startImgs'
... ... @@ -217,7 +225,7 @@ const startImgs = useUploadImgs({
217 225 // 进行中阶段图片
218 226 const processingImgs = useUploadImgs({
219 227 maxCount: 3,
220   - uploadText: '选择进行中阶段照片',
  228 + uploadText: '选择进行中照片',
221 229 sizeType: ['compressed'],
222 230 formRef: workOrderFormRef,
223 231 fieldName: 'processingImgs'
... ... @@ -225,7 +233,7 @@ const processingImgs = useUploadImgs({
225 233 // 结束阶段图片
226 234 const endImgs = useUploadImgs({
227 235 maxCount: 3,
228   - uploadText: '选择结束阶段照片',
  236 + uploadText: '选择结束照片',
229 237 sizeType: ['compressed'],
230 238 formRef: workOrderFormRef,
231 239 fieldName: 'endImgs'
... ... @@ -233,7 +241,7 @@ const endImgs = useUploadImgs({
233 241 // 人员配置图片
234 242 const personImgs = useUploadImgs({
235 243 maxCount: 3,
236   - uploadText: '选择人员配置照片',
  244 + uploadText: '选择人员照片',
237 245 sizeType: ['compressed'],
238 246 formRef: workOrderFormRef,
239 247 fieldName: 'personImgs'
... ... @@ -241,7 +249,7 @@ const personImgs = useUploadImgs({
241 249 // 材料使用图片
242 250 const materialImgs = useUploadImgs({
243 251 maxCount: 3,
244   - uploadText: '选择材料使用照片',
  252 + uploadText: '选择材料照片',
245 253 sizeType: ['compressed'],
246 254 formRef: workOrderFormRef,
247 255 fieldName: 'materialImgs'
... ... @@ -279,19 +287,22 @@ const workOrderFormRules = reactive({
279 287 { type: 'string', max: 200, message: '处理情况描述最多200字', trigger: ['change', 'blur'] }
280 288 ],
281 289 // 新增5个图片字段校验
282   - startImgs: [startImgs.imgValidateRule],
283   - processingImgs: [processingImgs.imgValidateRule],
284   - endImgs: [endImgs.imgValidateRule],
285   - personImgs: [personImgs.imgValidateRule],
286   - materialImgs: [materialImgs.imgValidateRule]
  290 + // startImgs: [startImgs.imgValidateRule],
  291 + // processingImgs: [processingImgs.imgValidateRule],
  292 + // endImgs: [endImgs.imgValidateRule],
  293 + // personImgs: [personImgs.imgValidateRule],
  294 + // materialImgs: [materialImgs.imgValidateRule]
287 295 })
288 296  
289 297 // 生命周期 - 从URL获取工单编号
290 298 onLoad((options) => {
291   - if (options && options.orderNo) {
292   - workOrderForm.orderNo = options.orderNo
293   - }
294   - console.log('从URL获取工单编号:', workOrderForm.orderNo)
  299 +
  300 +
  301 + workOrderForm.workerDataId = options.id
  302 + workOrderForm.taskId = options.taskId
  303 + workOrderForm.orderNo = options.orderNo
  304 +
  305 + console.log('从URL获取工单编号:', workOrderForm.taskId)
295 306 })
296 307  
297 308 // 生命周期 - 初始化表单规则
... ... @@ -393,45 +404,69 @@ const hideKeyboard = () =&gt; {
393 404 uni.hideKeyboard()
394 405 }
395 406  
396   -// 提交工单(整合所有图片URL,与参考示例一致
  407 +// 提交工单(整合所有图片URL,增加开始/结束图片必填校验
397 408 const submitWorkOrder = async () => {
398 409 try {
399   - // 表单校验
  410 + // ========== 新增:校验开始和结束阶段图片至少各1张 ==========
  411 + const startImgUrls = startImgs.getSuccessImgUrls(); // 开始阶段图片URL数组
  412 + const endImgUrls = endImgs.getSuccessImgUrls(); // 结束阶段图片URL数组
  413 +
  414 + // 判断开始图片是否为空
  415 + if (startImgUrls.length === 0) {
  416 + uni.showToast({
  417 + title: '请至少上传1张开始阶段图片',
  418 + icon: 'none',
  419 + duration: 2000
  420 + });
  421 + return; // 终止提交流程
  422 + }
  423 +
  424 + // 判断结束图片是否为空
  425 + if (endImgUrls.length === 0) {
  426 + uni.showToast({
  427 + title: '请至少上传1张结束阶段图片',
  428 + icon: 'none',
  429 + duration: 2000
  430 + });
  431 + return; // 终止提交流程
  432 + }
  433 + // ========== 图片校验结束 ==========
  434 +
  435 + // 原有表单校验
400 436 await workOrderFormRef.value.validate()
401 437  
402   - // 构造所有图片URL(按Tab分类,或合并为一个数组,可按需调整
  438 + // 构造所有图片URL(原有代码不变
403 439 const allImgs = {
404   - startImgs: startImgs.getSuccessImgUrls(),
  440 + startImgs: startImgUrls, // 直接使用已获取的开始图片URL
405 441 processingImgs: processingImgs.getSuccessImgUrls(),
406   - endImgs: endImgs.getSuccessImgUrls(),
  442 + endImgs: endImgUrls, // 直接使用已获取的结束图片URL
407 443 personImgs: personImgs.getSuccessImgUrls(),
408 444 materialImgs: materialImgs.getSuccessImgUrls()
409 445 }
410 446  
411 447 // 构造提交参数(可按需调整图片字段格式,此处既保留分类也提供合并数组)
412 448 const submitData = {
413   - id: workOrderForm.orderNo,
414   - reason: workOrderForm.reason.trim(),
415   - coProcessorId: workOrderForm.coProcessorId, // 数组格式提交,如需字符串可.join(',')
416   - busiLine: 'yl',
417   - // 分类图片URL
  449 + taskId: workOrderForm.taskId,
  450 + taskKey:'ylWorker',
  451 + operateType:nextStepMap['ylWorker'].operateType,
  452 + workerDataId:Number(workOrderForm.workerDataId),
  453 + // nextStepMap
  454 + handleResult: workOrderForm.reason.trim(),
  455 + coHandlers: [String(workOrderForm.coProcessorId)], // 数组格式提交,如需字符串可.join(',')
  456 + // busiLine: 'yl',
  457 + // // 分类图片URL
418 458 startImgs: allImgs.startImgs,
419 459 processingImgs: allImgs.processingImgs,
420 460 endImgs: allImgs.endImgs,
421 461 personImgs: allImgs.personImgs,
422 462 materialImgs: allImgs.materialImgs,
423   - // 合并所有图片为一个数组(若接口需要)
424   - imgs: [
425   - ...allImgs.startImgs,
426   - ...allImgs.processingImgs,
427   - ...allImgs.endImgs,
428   - ...allImgs.personImgs,
429   - ...allImgs.materialImgs
430   - ]
  463 +
  464 + problemsImgs:[]
431 465 }
  466 + console.log(submitData)
432 467  
433 468 uni.showLoading({ title: '提交中...' })
434   - const res = await ylWorkerExcuteWOrder(submitData)
  469 + const res = await universalApproval(submitData)
435 470 uni.hideLoading()
436 471  
437 472 uni.showToast({
... ... @@ -480,4 +515,21 @@ const submitWorkOrder = async () =&gt; {
480 515 background: #fff;
481 516 }
482 517  
  518 +// 新增:Tab自定义内容样式(红色*号)
  519 +.tab-item-content {
  520 + display: flex;
  521 + align-items: center;
  522 +}
  523 +
  524 +.required-star {
  525 + color: #f53f3f; // 红色必填标识
  526 + margin-right: 4rpx; // 与文字保持小间距
  527 + font-weight: bold;
  528 +}
  529 +
  530 +.tab-text {
  531 + font-size: 28rpx; // 与原有Tab文字大小一致
  532 +}
  533 +
  534 +
483 535 </style>
484 536 \ No newline at end of file
... ...
pages-sub/problem/work-order-manage/add-order.vue
... ... @@ -108,6 +108,8 @@
108 108 @after-read="problemImgs.uploadImgs"
109 109 @delete="problemImgs.deleteImg"
110 110 multiple
  111 + :width="70"
  112 + :height="70"
111 113 :max-count="problemImgs.uploadConfig.maxCount"
112 114 :upload-text="problemImgs.uploadConfig.uploadText"
113 115 :size-type="problemImgs.uploadConfig.sizeType"
... ... @@ -168,9 +170,9 @@ import { ref, reactive, watch } from &#39;vue&#39;
168 170 import { onReady, onShow } from '@dcloudio/uni-app';
169 171 import { useUploadImgs } from '@/common/utils/useUploadImgs' // 引入改造后的上传逻辑
170 172 import { getRoadListByLatLng } from '@/api/common'
171   -import { workorderCreate } from '@/api/work-order-manage/work-order-manage'
  173 +import { universalApproval } from '@/api/work-order-manage/work-order-manage'
172 174 import { timeFormat } from '@/uni_modules/uview-plus'
173   -
  175 +import { nextStepMap } from '@/common/utils/common'
174 176 // ========== 表单Ref ==========
175 177 const workOrderFormRef = ref(null)
176 178  
... ... @@ -436,7 +438,7 @@ const submitWorkOrder = async () =&gt; {
436 438 uni.showLoading({ title: '提交中...' })
437 439  
438 440 // 调用提交接口
439   - const res = await workorderCreate(submitData)
  441 + const res = await universalApproval(submitData)
440 442  
441 443 uni.hideLoading()
442 444 uni.showToast({
... ...
pages-sub/problem/work-order-manage/distribution-order.vue
... ... @@ -79,7 +79,8 @@
79 79 <script setup>
80 80 import { ref, reactive } from 'vue'
81 81 import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
82   -import { getYlWorkersPage, ylTeamLeaderAssignWOrder } from '@/api/work-order-manage/work-order-manage'
  82 +import { getYlWorkersPage, universalApproval } from '@/api/work-order-manage/work-order-manage'
  83 +import { nextStepMap } from '@/common/utils/common'
83 84 import { useUserStore } from '@/pinia/user';
84 85 const userStore = useUserStore();
85 86 // ========== 表单Ref ==========
... ... @@ -228,7 +229,10 @@ const submitWorkOrder = async () =&gt; {
228 229 }
229 230 // 3. 构造接口所需参数
230 231 const submitData = {
231   - id: workOrderForm.taskId, // 工单编码(对应接口参数id)
  232 + operateType: nextStepMap['ylTeamLeader'].operateTypePass,
  233 + taskKey:'ylTeamLeader',
  234 + agree:0,
  235 + taskId: workOrderForm.taskId, // 工单编码(对应接口参数id)
232 236 reason: workOrderForm.reason.trim(), // 处理建议(对应接口参数reason)
233 237 nextAssignee: workOrderForm.assigneeId // 养护员ID(对应接口参数nextAssignee)
234 238 }
... ... @@ -236,7 +240,7 @@ const submitWorkOrder = async () =&gt; {
236 240 // 4. 显示加载提示
237 241 uni.showLoading({title: '提交中...'})
238 242 // 5. 调用指定接口 ylTeamLeaderAssignWOrder
239   - const res = await ylTeamLeaderAssignWOrder(submitData)
  243 + const res = await universalApproval(submitData)
240 244 // 6. 隐藏加载提示并给出成功反馈
241 245 uni.hideLoading()
242 246 uni.showToast({
... ...
pages-sub/problem/work-order-manage/index.vue
... ... @@ -54,103 +54,108 @@
54 54 :auto-show-system-loading="true"
55 55  
56 56 >
57   - <template #empty>
58   - <empty-view />
59   - </template>
60   -
61   - <view class="common-card-list" style="padding-top: 200rpx;padding-bottom: 30rpx">
62   - <!-- 待办工单卡片 -->
63   - <up-card
64   - v-if="activeTab == 0"
65   - :border="false"
66   - :foot-border-top="false"
67   - v-for="(item, index) in orderList"
68   - :key="`todo_${item.orderNo}_${index}`"
69   - :show-head="false"
70   - class="order-card"
71   - >
72   - <template #body>
73   - <view class="card-body">
74   - <view class="u-body-item u-flex">
75   - <view class="u-body-item-title">工单编号:</view>
76   - <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view>
77   - </view>
78   - <view class="u-body-item u-flex">
79   - <view class="u-body-item-title">工单位置:</view>
80   - <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view>
81   - </view>
82   - <view class="u-body-item u-flex">
83   - <view class="u-body-item-title">工单名称:</view>
84   - <view class="u-line-1 u-body-value">{{ item.orderName || '未填写' }}</view>
85   - </view>
86   - <view class="u-body-item u-flex">
87   - <view class="u-body-item-title">情况描述:</view>
88   - <view class="u-line-1 u-body-value">{{ item.remark || '无' }}</view>
89   - </view>
90   - <view class="u-body-item u-flex common-item-center common-justify-between">
91   - <view class="u-body-item-title">紧急程度:</view>
92   - <view class="u-line-1 u-body-value">
93   - {{uni.$dict.getDictLabel('workorder_pressing_type',item.pressingType)}}
  57 + <template #empty>
  58 + <empty-view/>
  59 + </template>
  60 +
  61 + <view class="common-card-list" style="padding-top: 200rpx;padding-bottom: 30rpx">
  62 + <!-- 待办工单卡片 -->
  63 + <up-card
  64 + v-if="activeTab == 0"
  65 + :border="false"
  66 + :foot-border-top="false"
  67 + v-for="(item, index) in orderList"
  68 + :key="`todo_${item.orderNo}_${index}`"
  69 + :show-head="false"
  70 + class="order-card"
  71 + >
  72 + <template #body>
  73 + <view class="card-body">
  74 + <view class="u-body-item u-flex">
  75 + <view class="u-body-item-title">工单编号:</view>
  76 + <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view>
  77 + </view>
  78 + <view class="u-body-item u-flex">
  79 + <view class="u-body-item-title">工单位置:</view>
  80 + <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view>
  81 + </view>
  82 + <view class="u-body-item u-flex">
  83 + <view class="u-body-item-title">工单名称:</view>
  84 + <view class="u-line-1 u-body-value">{{ item.orderName || '未填写' }}</view>
  85 + </view>
  86 + <view class="u-body-item u-flex">
  87 + <view class="u-body-item-title">情况描述:</view>
  88 + <view class="u-line-1 u-body-value">{{ item.remark || '无' }}</view>
  89 + </view>
  90 + <view class="u-body-item u-flex common-item-center common-justify-between">
  91 + <view class="u-body-item-title">紧急程度:</view>
  92 + <view class="u-line-1 u-body-value">
  93 + {{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }}
  94 + </view>
  95 + </view>
  96 + <view class="u-body-item u-flex">
  97 + <view class="u-body-item-title">提交时间:</view>
  98 + <view class="u-line-1 u-body-value">{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  99 + </view>
  100 + <!-- 操作按钮行 -->
  101 + <view class="u-body-item u-flex common-justify-between common-item-center mt-20">
  102 + <up-button type="warning" size="mini" @click="handleReject(item)"
  103 + v-show="nextStepMap[item.taskKey].backShow">回退
  104 + </up-button>
  105 + <up-button type="primary" size="mini" @click="handleProcess(item)">{{ nextStepMap[item.taskKey].btnText }}
  106 + </up-button>
  107 + <up-button type="info" size="mini" @click="handleDetail(item)">详情</up-button>
94 108 </view>
95 109 </view>
96   - <view class="u-body-item u-flex">
97   - <view class="u-body-item-title">提交时间:</view>
98   - <view class="u-line-1 u-body-value">{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
99   - </view>
100   - <!-- 操作按钮行 -->
101   - <view class="u-body-item u-flex common-justify-between common-item-center mt-20">
102   - <up-button type="warning" size="mini" @click="handleReject(item)">回退</up-button>
103   - <up-button type="primary" size="mini" @click="handleProcess(item)">处理</up-button>
104   - <up-button type="info" size="mini" @click="handleDetail(item)">详情</up-button>
105   - </view>
106   - </view>
107   - </template>
108   - </up-card>
109   -
110   - <!-- 已办工单卡片和我发起的 -->
111   - <up-card
112   - v-if="activeTab == 2||activeTab == 1"
113   - :border="false"
114   - :foot-border-top="false"
115   - v-for="(item, index) in orderList"
116   - :key="`done_${item.orderNo}_${index}`"
117   - :show-head="false"
118   - class="order-card"
119   - >
120   - <template #body>
121   - <view class="card-body">
122   - <view class="u-body-item u-flex">
123   - <view class="u-body-item-title">工单编号:</view>
124   - <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view>
125   - </view>
126   - <view class="u-body-item u-flex">
127   - <view class="u-body-item-title">工单位置:</view>
128   - <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view>
129   - </view>
130   - <view class="u-body-item u-flex">
131   - <view class="u-body-item-title">工单名称:</view>
132   - <view class="u-line-1 u-body-value">{{ item.orderName || '未填写' }}</view>
133   - </view>
134   - <view class="u-body-item u-flex">
135   - <view class="u-body-item-title">情况描述:</view>
136   - <view class="u-line-1 u-body-value">{{ item.remark || '无' }}</view>
137   - </view>
  110 + </template>
  111 + </up-card>
  112 +
  113 + <!-- 已办工单卡片和我发起的 -->
  114 + <up-card
  115 + v-if="activeTab == 2||activeTab == 1"
  116 + :border="false"
  117 + :foot-border-top="false"
  118 + v-for="(item, index) in orderList"
  119 + :key="`done_${item.orderNo}_${index}`"
  120 + :show-head="false"
  121 + class="order-card"
  122 + >
  123 + <template #body>
  124 + <view class="card-body">
  125 + <view class="u-body-item u-flex">
  126 + <view class="u-body-item-title">工单编号:</view>
  127 + <view class="u-line-1 u-body-value">{{ item.orderNo || '-' }}</view>
  128 + </view>
  129 + <view class="u-body-item u-flex">
  130 + <view class="u-body-item-title">工单位置:</view>
  131 + <view class="u-line-1 u-body-value">{{ item.roadName || '-' }}</view>
  132 + </view>
  133 + <view class="u-body-item u-flex">
  134 + <view class="u-body-item-title">工单名称:</view>
  135 + <view class="u-line-1 u-body-value">{{ item.orderName || '未填写' }}</view>
  136 + </view>
  137 + <view class="u-body-item u-flex">
  138 + <view class="u-body-item-title">情况描述:</view>
  139 + <view class="u-line-1 u-body-value">{{ item.remark || '无' }}</view>
  140 + </view>
138 141  
139 142  
140   - <view class="u-body-item u-flex common-justify-between common-item-center">
141   - <view class="u-body-item-title">紧急程度: {{uni.$dict.getDictLabel('workorder_pressing_type',item.pressingType)}}</view>
  143 + <view class="u-body-item u-flex common-justify-between common-item-center">
  144 + <view class="u-body-item-title">紧急程度:
  145 + {{ uni.$dict.getDictLabel('workorder_pressing_type', item.pressingType) }}
  146 + </view>
142 147 <view class=" ">
143 148 <up-button type="primary" size="mini" @click="handleDetail(item)">工单详情</up-button>
144 149 </view>
  150 + </view>
  151 + <view class="u-body-item u-flex">
  152 + <view class="u-body-item-title">提交时间:</view>
  153 + <view class="u-line-1 u-body-value">{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
  154 + </view>
145 155 </view>
146   - <view class="u-body-item u-flex">
147   - <view class="u-body-item-title">提交时间:</view>
148   - <view class="u-line-1 u-body-value">{{ timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
149   - </view>
150   - </view>
151   - </template>
152   - </up-card>
153   - </view>
  156 + </template>
  157 + </up-card>
  158 + </view>
154 159 </z-paging>
155 160  
156 161 <!-- 底部新增工单按钮(仅巡查员显示) -->
... ... @@ -199,24 +204,23 @@ import { timeFormat } from &#39;@/uni_modules/uview-plus&#39;;
199 204 import { myBuzSimplePage, todoBuzSimplePage, doneBuzSimplePage } from '@/api/work-order-manage/work-order-manage'
200 205 // 假设从用户store获取角色信息
201 206 import { useUserStore } from '@/pinia/user';
202   - import { nextStepMap } from '@/common/utils/common'
203   -
  207 +import { nextStepMap } from '@/common/utils/common'
204 208 // ========== 状态管理 ==========
205 209 const userStore = useUserStore();
206 210 // 标签页切换
207 211 const activeTab = ref(0); // 0-待办 1-我发起的 2-已办
208 212 const tabList = ref([
209   - { name: '待办' },
210   - { name: '我发起的任务' },
211   - { name: '已办' }
  213 + {name: '待办'},
  214 + {name: '我发起的任务'},
  215 + {name: '已办'}
212 216 ]);
213 217 // 排序下拉框
214 218 const selectedSortValue = ref(1);
215 219 const sortOptions = ref([
216   - { name: '位置', id: 1 },
217   - { name: '名称', id: 2 },
218   - { name: '描述', id: 3 },
219   - { name: '编号', id: 4 },
  220 + {name: '位置', id: 1},
  221 + {name: '名称', id: 2},
  222 + {name: '描述', id: 3},
  223 + {name: '编号', id: 4},
220 224 ]);
221 225 // 搜索
222 226 const searchValue = ref('');
... ... @@ -235,10 +239,6 @@ const rejectFileList = ref([]);
235 239 const currentRejectItem = ref(null);
236 240 // 上传地址(根据实际接口配置)
237 241 const uploadUrl = ref('https://xxx.com/upload');
238   -
239   -
240   -
241   -
242 242 // 分页查询列表
243 243 const queryList = async (pageNo, pageSize) => {
244 244 try {
... ... @@ -248,29 +248,25 @@ const queryList = async (pageNo, pageSize) =&gt; {
248 248 pageSize,
249 249 type: selectedSortValue.value // 1-位置 2-工单名称 3-情况描述 4-工单编号
250 250 };
251   -
252 251 let res;
253 252 if (activeTab.value == 0) {
254 253 // 待办工单
255 254 res = await todoBuzSimplePage(apiParams);
256   - } else if(activeTab.value == 1) {
  255 + } else if (activeTab.value == 1) {
257 256 // 我发起的任务
258 257 res = await myBuzSimplePage(apiParams);
259   -
260   - }else {
  258 + } else {
261 259 // 已办工单
262 260 res = await doneBuzSimplePage(apiParams);
263 261 }
264   -
265 262 // 适配z-paging分页
266 263 paging.value.complete(res.list, res.total);
267 264 } catch (error) {
268 265 console.error('加载工单失败:', error);
269 266 paging.value?.complete(false);
270   - uni.showToast({ title: '加载失败,请重试', icon: 'none' });
  267 + uni.showToast({title: '加载失败,请重试', icon: 'none'});
271 268 }
272 269 };
273   -
274 270 // ========== 事件处理 ==========
275 271 // 标签页切换
276 272 const handleTabChange = (item) => {
... ... @@ -278,20 +274,17 @@ const handleTabChange = (item) =&gt; {
278 274 activeTab.value = item.index;
279 275 paging.value?.reload(); // 切换标签页刷新列表
280 276 };
281   -
282 277 // 排序变更
283 278 const handleSortChange = (val) => {
284 279 selectedSortValue.value = val.id;
285 280 searchValue.value = '';
286 281 paging.value?.reload(); // 排序变更刷新列表
287 282 };
288   -
289 283 // 搜索
290 284 const handleSearch = (val) => {
291 285 searchValue.value = val;
292 286 paging.value?.reload(); // 搜索刷新列表
293 287 };
294   -
295 288 // 工单详情
296 289 const handleDetail = (item) => {
297 290 // 0-待办 1我发起的- 2-已办
... ... @@ -299,29 +292,25 @@ const handleDetail = (item) =&gt; {
299 292 url: `/pages-sub/problem/work-order-manage/order-detail?taskId=${item.taskId}&activeTab=${activeTab.value}`
300 293 });
301 294 };
302   -
303 295 // 待办-处理工单
304 296 const handleProcess = async (item) => {
305 297 console.log(nextStepMap)
306 298 try {
307   -
308   - if(nextStepMap[item.taskKey] == '养护组长分配'){
  299 + if (nextStepMap[item.taskKey].name == '养护组长分配') {
309 300 uni.navigateTo({
310 301 url: `/pages-sub/problem/work-order-manage/distribution-order?taskId=${item.taskId}&orderNo=${item.orderNo}`
311 302 })
312 303 }
313   -
314   - if(nextStepMap[item.taskKey] == '养护员待实施'){
  304 + if (nextStepMap[item.taskKey].name == '养护员待实施') {
315 305 uni.navigateTo({
316   - url: `/pages-sub/problem/work-order-manage/add-maintain-order?taskId=${item.taskId}&orderNo=${item.orderNo}`
  306 + url: `/pages-sub/problem/work-order-manage/add-maintain-order?taskId=${item.taskId}&id=${item.id}&orderNo=${item.orderNo}`
317 307 })
318 308 }
319 309 } catch (error) {
320 310 console.error('处理工单失败:', error);
321   - uni.showToast({ title: '处理失败,请重试', icon: 'none' });
  311 + uni.showToast({title: '处理失败,请重试', icon: 'none'});
322 312 }
323 313 };
324   -
325 314 // 待办-回退工单
326 315 const handleReject = (item) => {
327 316 currentRejectItem.value = item;
... ... @@ -329,14 +318,12 @@ const handleReject = (item) =&gt; {
329 318 rejectFileList.value = [];
330 319 rejectPopupShow.value = true;
331 320 };
332   -
333 321 // 确认回退工单
334 322 const confirmReject = async () => {
335 323 if (!rejectReason.value.trim()) {
336   - uni.showToast({ title: '请填写回退原因', icon: 'none' });
  324 + uni.showToast({title: '请填写回退原因', icon: 'none'});
337 325 return;
338 326 }
339   -
340 327 try {
341 328 // 调用回退工单接口
342 329 await uni.request({
... ... @@ -348,35 +335,28 @@ const confirmReject = async () =&gt; {
348 335 fileUrls: rejectFileList.value.map(file => file.url)
349 336 }
350 337 });
351   -
352   - uni.showToast({ title: '回退成功', icon: 'success' });
  338 + uni.showToast({title: '回退成功', icon: 'success'});
353 339 rejectPopupShow.value = false;
354 340 paging.value?.reload(); // 刷新列表
355 341 } catch (error) {
356 342 console.error('回退工单失败:', error);
357   - uni.showToast({ title: '回退失败,请重试', icon: 'none' });
  343 + uni.showToast({title: '回退失败,请重试', icon: 'none'});
358 344 }
359 345 };
360   -
361 346 // 新增工单
362 347 const handleAddOrder = () => {
363 348 uni.navigateTo({
364 349 url: '/pages-sub/problem/work-order-manage/add-order'
365 350 });
366 351 };
367   -
368   -
369   -
370 352 // 上传图片-读取后
371 353 const handleAfterRead = (file) => {
372 354 rejectFileList.value.push(file);
373 355 };
374   -
375 356 // 上传图片-删除
376 357 const handleDeleteFile = (index) => {
377 358 rejectFileList.value.splice(index, 1);
378 359 };
379   -
380 360 // 页面初始化
381 361 onShow(() => {
382 362 // 初始化加载列表
... ...
pages-sub/problem/work-order-manage/order-detail.vue
... ... @@ -63,8 +63,8 @@
63 63 <template #value>
64 64 <view class="cell-content-wrap">
65 65 <up-album
66   - v-if="!!orderDetail.problemImgsList?.length"
67   - :urls="orderDetail.problemImgsList.slice(0, 3)"
  66 + v-if="!!orderDetail.problemsImgs?.length"
  67 + :urls="orderDetail.problemsImgs.slice(0, 3)"
68 68 singleSize="70"
69 69 :preview-full-image="true"
70 70 ></up-album>
... ...