From 1f1f236ca4c36b6c01fa9a32556b45b0002fb726 Mon Sep 17 00:00:00 2001
From: liugongyu <290219706@qq.com>
Date: Sun, 21 Dec 2025 14:15:34 +0800
Subject: [PATCH] 工单详情
---
api/work-order-manage/work-order-manage.js | 10 +++++++++-
common/utils/common.js | 7 +++++++
pages-sub/problem/work-order-manage/add-maintain-order.vue | 2 +-
pages-sub/problem/work-order-manage/index.vue | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
pages-sub/problem/work-order-manage/order-detail.vue | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------
5 files changed, 355 insertions(+), 96 deletions(-)
diff --git a/api/work-order-manage/work-order-manage.js b/api/work-order-manage/work-order-manage.js
index 7567616..40526fc 100644
--- a/api/work-order-manage/work-order-manage.js
+++ b/api/work-order-manage/work-order-manage.js
@@ -1,6 +1,5 @@
import { post, get, put } from '@/common/utils/request';
-// /app-api/bpm/garden/workorder/getApprovalDetail 获得审批详情
// /app-api/bpm/garden/workorder/approve 验收通过调用此接口、巡查员结束工单也调用此接口
@@ -8,6 +7,15 @@ import { post, get, put } from '@/common/utils/request';
/**
+ * 获得审批详情 流程节点
+ * @returns {Promise}
+ */
+export const getApprovalDetail = (params) => {
+ return get('/app-api/bpm/garden/workorder/getApprovalDetail',params);
+};
+
+
+/**
* 养护员工单实施页面提交接口
* @returns {Promise}
*/
diff --git a/common/utils/common.js b/common/utils/common.js
index 850329a..fcae8f5 100644
--- a/common/utils/common.js
+++ b/common/utils/common.js
@@ -18,4 +18,11 @@ export const nextStepMap = {
operateTypeNoPass: 230, // 养护组长验收不通过:230
backShow:false
},
+ ylInspector:{
+ name: '巡查员验收',
+ btnText:'验收',
+ operateTypePass: 140, //巡查员验收通过: 140
+ operateTypeNoPass: 240, // 巡查员验收不通过:230
+ backShow:false
+ }
}
\ No newline at end of file
diff --git a/pages-sub/problem/work-order-manage/add-maintain-order.vue b/pages-sub/problem/work-order-manage/add-maintain-order.vue
index 0246e86..3eb67d4 100644
--- a/pages-sub/problem/work-order-manage/add-maintain-order.vue
+++ b/pages-sub/problem/work-order-manage/add-maintain-order.vue
@@ -448,7 +448,7 @@ const submitWorkOrder = async () => {
const submitData = {
taskId: workOrderForm.taskId,
taskKey:'ylWorker',
- operateType:nextStepMap['ylWorker'].operateType,
+ operateType:nextStepMap['ylWorker'].operateTypePass,
workerDataId:Number(workOrderForm.workerDataId),
// nextStepMap
handleResult: workOrderForm.reason.trim(),
diff --git a/pages-sub/problem/work-order-manage/index.vue b/pages-sub/problem/work-order-manage/index.vue
index aab3928..ea93205 100644
--- a/pages-sub/problem/work-order-manage/index.vue
+++ b/pages-sub/problem/work-order-manage/index.vue
@@ -10,7 +10,6 @@
active-color="#1989fa"
inactive-color="#666"
font-size="30rpx"
-
@click="handleTabChange"
/>
@@ -52,7 +51,6 @@
v-model="orderList"
@query="queryList"
:auto-show-system-loading="true"
-
>
@@ -102,7 +100,9 @@
回退
- {{ nextStepMap[item.taskKey].btnText }}
+ {{
+ nextStepMap[item.taskKey].btnText
+ }}
详情
@@ -174,7 +174,7 @@
placeholder="请输入回退原因(必填)"
:required="true"
maxlength="-1"
- rows="4"
+ rows="6"
class="mt-20"
/>
@@ -194,6 +194,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -201,7 +236,12 @@
import { ref, computed } from 'vue';
import { onReady, onShow } from '@dcloudio/uni-app';
import { timeFormat } from '@/uni_modules/uview-plus';
-import { myBuzSimplePage, todoBuzSimplePage, doneBuzSimplePage } from '@/api/work-order-manage/work-order-manage'
+import {
+ myBuzSimplePage,
+ todoBuzSimplePage,
+ doneBuzSimplePage,
+ universalApproval
+} from '@/api/work-order-manage/work-order-manage'
// 假设从用户store获取角色信息
import { useUserStore } from '@/pinia/user';
import { nextStepMap } from '@/common/utils/common'
@@ -239,6 +279,11 @@ const rejectFileList = ref([]);
const currentRejectItem = ref(null);
// 上传地址(根据实际接口配置)
const uploadUrl = ref('https://xxx.com/upload');
+// ========== 新增:养护组长验收弹窗相关状态 ==========
+const acceptModalShow = ref(false); // 验收弹窗显示开关
+const acceptRadioValue = ref('0'); // 单选框值,默认0(通过)
+const acceptReason = ref(''); // 验收原因
+const currentAcceptItem = ref(null); // 当前验收的工单项
// 分页查询列表
const queryList = async (pageNo, pageSize) => {
try {
@@ -289,12 +334,12 @@ const handleSearch = (val) => {
const handleDetail = (item) => {
// 0-待办 1我发起的- 2-已办
uni.navigateTo({
- url: `/pages-sub/problem/work-order-manage/order-detail?taskId=${item.taskId}&activeTab=${activeTab.value}`
+ url: `/pages-sub/problem/work-order-manage/order-detail?taskId=${item.taskId}&activeTab=${activeTab.value}&processInstanceId=${item.processInstanceId}`
});
};
// 待办-处理工单
const handleProcess = async (item) => {
- console.log(nextStepMap)
+ console.log(nextStepMap[item.taskKey].name)
try {
if (nextStepMap[item.taskKey].name == '养护组长分配') {
uni.navigateTo({
@@ -306,6 +351,24 @@ const handleProcess = async (item) => {
url: `/pages-sub/problem/work-order-manage/add-maintain-order?taskId=${item.taskId}&id=${item.id}&orderNo=${item.orderNo}`
})
}
+ // 养护组长验收 - 打开弹窗
+ if (nextStepMap[item.taskKey].name == '养护组长验收') {
+ console.log('123')
+ currentAcceptItem.value = item; // 存储当前工单信息
+ acceptReason.value = ''; // 清空上次的验收原因
+ acceptRadioValue.value = '0'; // 重置默认选中“通过”
+ acceptModalShow.value = true; // 显示验收弹窗
+ }
+
+ // 巡查员验收 - 打开弹窗
+ if (nextStepMap[item.taskKey].name == '巡查员验收') {
+ console.log('456')
+ currentAcceptItem.value = item; // 存储当前工单信息
+ acceptReason.value = ''; // 清空上次的验收原因
+ acceptRadioValue.value = '0'; // 重置默认选中“通过”
+ acceptModalShow.value = true; // 显示验收弹窗
+ }
+
} catch (error) {
console.error('处理工单失败:', error);
uni.showToast({title: '处理失败,请重试', icon: 'none'});
@@ -357,6 +420,58 @@ const handleAfterRead = (file) => {
const handleDeleteFile = (index) => {
rejectFileList.value.splice(index, 1);
};
+// ========== 新增:养护组长验收弹窗事件 ==========
+// 验收弹窗 - 取消按钮
+const handleAcceptModalCancel = () => {
+ acceptModalShow.value = false;
+ acceptReason.value = ''; // 清空验收原因
+};
+// 验收弹窗 - 确定按钮(含表单校验)
+const handleAcceptModalConfirm = async () => {
+ // 1. 校验验收原因是否为空
+ if (!acceptReason.value.trim()) {
+ uni.showToast({title: '请填写验收原因', icon: 'none', duration: 2000});
+ return;
+ }
+ // 2. 校验验收原因长度(虽textarea已限制maxlength,此处做兜底校验)
+ if (acceptReason.value.length > 200) {
+ uni.showToast({title: '验收原因最多200字', icon: 'none', duration: 2000});
+ return;
+ }
+ try {
+ // 3. 调用验收接口
+ console.log(currentAcceptItem.value)
+ let postData = {}
+ if(currentAcceptItem.value.taskKey == 'ylTeamLeaderConfirm'){ // 养护组长验收
+ postData = {
+ "taskKey": "ylTeamLeaderConfirm",
+ "taskId": currentAcceptItem.value.taskId,
+ "operateType": acceptRadioValue.value == 0 ? nextStepMap['ylTeamLeaderConfirm'].operateTypePass : nextStepMap['ylTeamLeaderConfirm'].operateTypeNoPass,
+ "reason": acceptReason.value.trim()
+ }
+ }
+ if(currentAcceptItem.value.taskKey == 'ylInspector'){ // 巡查员验收
+ postData = {
+ "taskKey": "ylTeamLeaderConfirm",
+ "taskId": currentAcceptItem.value.taskId,
+ "operateType": acceptRadioValue.value == 0 ? nextStepMap['ylTeamLeaderConfirm'].operateTypePass : nextStepMap['ylTeamLeaderConfirm'].operateTypeNoPass,
+ "reason": acceptReason.value.trim(),
+ "agree":acceptRadioValue.value
+ }
+ }
+
+ const acceptRes = await universalApproval(postData);
+ // 4. 操作成功处理
+ uni.showToast({title: '提交成功', icon: 'success', duration: 1500});
+ acceptModalShow.value = false;
+ acceptReason.value = ''; // 清空验收原因
+ paging.value?.reload(); // 刷新工单列表
+ } catch (error) {
+ // 5. 操作失败处理
+ console.error('养护组长验收失败:', error);
+ uni.showToast({title: '验收提交失败,请重试', icon: 'none', duration: 2000});
+ }
+};
// 页面初始化
onShow(() => {
// 初始化加载列表
@@ -401,5 +516,28 @@ onShow(() => {
}
}
+// 新增:养护组长验收弹窗样式
+.accept-modal-content {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.radio-group-wrap {
+ display: flex;
+ align-items: center;
+ gap: 40rpx; // 单选框之间的间距
+ font-size: 28rpx;
+ margin-bottom: 20rpx;
+}
+
+.textarea-wrap {
+ width: 100%;
+}
+.modal-btn-wrap {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ padding-right: 10rpx;
+}
\ No newline at end of file
diff --git a/pages-sub/problem/work-order-manage/order-detail.vue b/pages-sub/problem/work-order-manage/order-detail.vue
index a16a7cb..6542052 100644
--- a/pages-sub/problem/work-order-manage/order-detail.vue
+++ b/pages-sub/problem/work-order-manage/order-detail.vue
@@ -26,31 +26,33 @@
-
+
-
-
-
+
+
- 工单位置
+ 工单位置
{{ orderDetail.roadName || '--' }}
+
+
-
+
- 情况描述
+ 情况描述
{{ orderDetail.remark || '--' }}
+
+
+
+
+
+
+
+
+
+
+ 处理结果
+
+
+ {{ orderDetail.handleResult || '--' }}
+
+
+
+
+
+
@@ -72,48 +97,49 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ 暂无图片
+
+
-
-
+
+
+
+
@@ -124,7 +150,7 @@
import { ref, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { timeFormat } from '@/uni_modules/uview-plus';
-import { getMyTaskDetail, getDoneTaskDetail, getTodoTaskDetail } from '@/api/work-order-manage/work-order-manage';
+import { getMyTaskDetail, getDoneTaskDetail, getTodoTaskDetail, getApprovalDetail } from '@/api/work-order-manage/work-order-manage';
// 状态管理
const loading = ref(true);
@@ -137,9 +163,16 @@ const topTabList = ref([
{ name: '流程节点' }
]);
-const activeTopTabClick = (item)=>{
+const activeTopTabClick = async (item: any) => {
console.log(item)
activeTopTab.value = item.index
+ if(activeTopTab.value ==1){
+ let getData = {
+ processInstanceId:processInstanceId.value,
+ }
+ const res = await getApprovalDetail(getData)
+ console.log(res)
+ }
}
// 图片分类Tab列表(带角标配置)
@@ -151,42 +184,100 @@ const imgTabList = ref([
{ name: '材料' }
]);
-// 工单详情数据
-const orderDetail = ref({});
+// 工单详情数据(初始化赋值,可被接口数据覆盖)
+const orderDetail = ref({
+ id: 0,
+ busiLine: '',
+ orderNo: '',
+ orderName: '',
+ sourceId: 0,
+ sourceName: '',
+ roadId: 0,
+ roadName: '',
+ streetId: '',
+ streetName: '',
+ curingLevelId: 0,
+ curingLevelName: '',
+ commitDate: 0,
+ finishDate: 0,
+ pressingType: 0,
+ userId: 0,
+ userName: '',
+ companyId: 0,
+ latLonType: 0,
+ lat: 0,
+ lon: 0,
+ lonLatAddress: '',
+ thirdWorkNo: '',
+ thirdPushState: 0,
+ buzStatus: null,
+ status: 0,
+ processInstanceId: '',
+ remark: '',
+ handleResult: '',
+ createTime: 0,
+ fileNames: null,
+ coHandlers: null,
+ coHandlersName: null,
+ companyName: null,
+ userMobile: null,
+ taskId: '',
+ taskName: '',
+ taskKey: '',
+ processDefinitionName: '',
+ startTime: 0,
+ endTime: 0,
+ key_: '',
+ problemsImgs: [],
+ startImgs: [],
+ processingImgs: [],
+ endImgs: [],
+ personImgs: [],
+ materialImgs: []
+});
/**
- * 获取当前激活的图片列表
+ * 当前激活的图片列表(无需函数调用,直接访问)
*/
-const getCurrentImgList = computed(() => {
- const tabKeyMap = ['startImgs', 'processingImgs', 'endImgs', 'personImgs', 'materialImgs'];
- return orderDetail[tabKeyMap[activeImgTab.value]] || [];
-});
+const currentImgList = ref([])
+
+const tabKeyMap = ['startImgs', 'processingImgs', 'endImgs', 'personImgs', 'materialImgs'];
+const imgTabChange = (({index})=>{
+ console.log(index)
+ const currentKey = tabKeyMap[index]
+ console.log(currentKey)
+ console.log(orderDetail.value[currentKey])
+ currentImgList.value = orderDetail.value[currentKey]
+})
+
/**
* 获取工单详情
*/
-const DetailQuery = async (taskIdStr) => {
- console.log(taskIdStr)
+const DetailQuery = async (taskIdStr: string) => {
+ console.log('当前工单ID:', taskIdStr)
try {
loading.value = true;
- if(activeTab.value==0){
-
- const res = await getTodoTaskDetail({ taskId:taskIdStr });
- orderDetail.value = res
+ // 转换activeTab为数字类型,避免类型不一致导致接口调用失败
+ const tabType = Number(activeTab.value);
+ let res: any;
+
+ if (tabType === 0) {
+ res = await getTodoTaskDetail({ taskId: taskIdStr });
+ } else if (tabType === 1) {
+ res = await getMyTaskDetail({ taskId: taskIdStr });
+ } else if (tabType === 2) {
+ res = await getDoneTaskDetail({ taskId: taskIdStr });
+ } else {
+ uni.showToast({ title: '无效的工单类型', icon: 'none' });
+ return;
}
- if(activeTab.value==1){
-
- const res = await getMyTaskDetail({ taskId: taskIdStr });
- orderDetail.value = res
+ // 覆盖工单详情数据
+ if (res) {
+ orderDetail.value = res;
+ currentImgList.value = orderDetail.value.startImgs
}
- if(activeTab.value==2){
-
- const res = await getDoneTaskDetail({ taskId: taskIdStr });
- orderDetail.value = res
- }
-
-
} catch (error) {
console.error('获取工单详情失败:', error);
uni.showToast({ title: '加载失败,请重试', icon: 'none' });
@@ -195,28 +286,33 @@ const DetailQuery = async (taskIdStr) => {
}
};
-// 页面加载
+// 页面加载参数
const taskId = ref('')
const activeTab = ref('')
-onLoad((options) => {
- console.log(options)
- const { taskId: taskIdOpt, activeTab: activeTabOpt } = options;
- // 0-待办 1我发起的- 2-已办
- console.log(taskIdOpt)
- taskId.value = taskIdOpt
- activeTab.value = activeTabOpt
+const processInstanceId = ref('')
+onLoad((options: any) => {
+ console.log('页面入参:', options)
+ const { taskId: taskIdOpt, activeTab: activeTabOpt, processInstanceId:processInstanceIdOpt } = options;
+ // 0-待办 1-我发起的 2-已办
+ taskId.value = taskIdOpt || '';
+ activeTab.value = activeTabOpt || '0';
+ processInstanceId.value = processInstanceIdOpt ;
+});
+onShow(() => {
+ if (taskId.value) {
+ DetailQuery(taskId.value);
+ } else {
+ loading.value = false;
+ uni.showToast({ title: '缺少工单ID参数', icon: 'none' });
+ }
});
-onShow(()=>{
- DetailQuery(taskId.value)
-})