| | |
| | | const currentTransport = common_vendor.ref({}); |
| | | const modalTitle = common_vendor.ref(""); |
| | | const modalAction = common_vendor.ref(""); |
| | | const modalTargetStatus = common_vendor.ref(null); |
| | | const transportTypes = [ |
| | | { label: "全部", value: "" }, |
| | | { label: "待转运", value: 1 }, |
| | |
| | | driver: apiData.driver, |
| | | // 其他字段 |
| | | transportStartPlace: apiData.transportStartPlace, |
| | | remark: apiData.remark |
| | | remark: apiData.remark, |
| | | annexfilesList: apiData.annexfilesList || [] |
| | | }; |
| | | }; |
| | | const filteredTransports = common_vendor.computed(() => { |
| | | let result = transports.value; |
| | | if (currentType.value !== "") { |
| | | result = result.filter((item) => item.transitStatus === currentType.value); |
| | | result = result.filter((item) => item.transitStatus == currentType.value); |
| | | } |
| | | return result; |
| | | }); |
| | |
| | | }; |
| | | return map[status] || "待转运"; |
| | | }; |
| | | const getGenderText = (gender) => { |
| | | if (!gender) |
| | | return "待转运"; |
| | | if (!dict.value.sys_user_sex) |
| | | return gender; |
| | | const genderItem = dict.value.sys_user_sex.find( |
| | | (item) => item.dictValue === gender |
| | | ); |
| | | return genderItem ? genderItem.dictLabel : gender; |
| | | }; |
| | | const formatTime = (timeStr) => { |
| | | if (!timeStr) |
| | | return "未设置"; |
| | |
| | | loadTransports(true); |
| | | } |
| | | }; |
| | | const handleStartTransport = (item) => { |
| | | currentTransport.value = { ...item }; |
| | | modalTitle.value = "开始转运"; |
| | | modalAction.value = "开始"; |
| | | modalTargetStatus.value = 2; |
| | | showActionModal.value = true; |
| | | }; |
| | | const handleCompleteTransport = (item) => { |
| | | currentTransport.value = { ...item }; |
| | | modalTitle.value = "完成转运"; |
| | | modalAction.value = "完成"; |
| | | modalTargetStatus.value = 3; |
| | | showActionModal.value = true; |
| | | }; |
| | | const handleCancelTransport = (item) => { |
| | | currentTransport.value = { ...item }; |
| | | modalTitle.value = "取消转运"; |
| | | modalAction.value = "取消"; |
| | | modalTargetStatus.value = 4; |
| | | showActionModal.value = true; |
| | | }; |
| | | const handleRecoverTransport = (item) => { |
| | | currentTransport.value = { ...item }; |
| | | modalTitle.value = "恢复转运"; |
| | | modalAction.value = "恢复"; |
| | | modalTargetStatus.value = 2; |
| | | showActionModal.value = true; |
| | | }; |
| | | const cancelAction = () => { |
| | | showActionModal.value = false; |
| | | }; |
| | | const confirmAction = async () => { |
| | | try { |
| | | const requestData = { |
| | | ...currentTransport.value, |
| | | transitStatus: modalTargetStatus.value |
| | | }; |
| | | if (requestData.annexfilesList && requestData.annexfilesList.length > 0) { |
| | | requestData.annexfilesList.forEach((item) => { |
| | | item.id = null; |
| | | }); |
| | | } |
| | | const res = await common_vendor.index.$uapi.post("/project/transport/edit", requestData); |
| | | if (res && res.code == 200) { |
| | | common_vendor.index.showToast({ |
| | | title: `${modalAction.value}转运成功`, |
| | | icon: "success" |
| | | }); |
| | | if (modalTargetStatus.value == 3) { |
| | | try { |
| | | const caseRes = await common_vendor.index.$uapi.get( |
| | | `/project/donatebaseinforeport/getInfo/${requestData.reportId}` |
| | | ); |
| | | if (caseRes && caseRes.data) { |
| | | const caseData = caseRes.data; |
| | | caseData.isDonate = 1; |
| | | const editRes = await common_vendor.index.$uapi.post( |
| | | "/project/donatebaseinforeport/edit", |
| | | caseData |
| | | ); |
| | | if (editRes && editRes.code == 200) { |
| | | common_vendor.index.showToast({ |
| | | title: "对应上报案例已进入正式案例流程", |
| | | icon: "success" |
| | | }); |
| | | } |
| | | } |
| | | } catch (caseError) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:478", "更新案例状态失败:", caseError); |
| | | common_vendor.index.showToast({ |
| | | title: "案例状态更新失败,请联系管理员", |
| | | icon: "none" |
| | | }); |
| | | } |
| | | } |
| | | const index = transports.value.findIndex( |
| | | (item) => item.id == currentTransport.value.id |
| | | ); |
| | | if (index !== -1) { |
| | | transports.value[index].transitStatus = modalTargetStatus.value; |
| | | } |
| | | await loadStats(); |
| | | showActionModal.value = false; |
| | | } else { |
| | | common_vendor.index.showToast({ |
| | | title: (res == null ? void 0 : res.msg) || `${modalAction.value}转运失败`, |
| | | icon: "none" |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:507", `${modalAction.value}转运失败:`, error); |
| | | common_vendor.index.showToast({ |
| | | title: "操作失败,请稍后重试", |
| | | icon: "none" |
| | | }); |
| | | } |
| | | }; |
| | | const viewDetail = (item) => { |
| | | viewDetails(item); |
| | | }; |
| | |
| | | url: `/pagesSub/case/transferinfo?id=${item.id}` |
| | | }); |
| | | }; |
| | | const editTransport = (item) => { |
| | | common_vendor.index.navigateTo({ |
| | | url: `/pagesSub/case/transferinfo?id=${item.id}&edit=true` |
| | | }); |
| | | }; |
| | | const startTransport = (item) => { |
| | | currentTransport.value = item; |
| | | modalTitle.value = "开始转运"; |
| | | modalAction.value = "开始"; |
| | | showActionModal.value = true; |
| | | }; |
| | | const completeTransport = (item) => { |
| | | currentTransport.value = item; |
| | | modalTitle.value = "完成转运"; |
| | | modalAction.value = "完成"; |
| | | showActionModal.value = true; |
| | | }; |
| | | const confirmAction = async () => { |
| | | try { |
| | | if (modalAction.value === "开始") { |
| | | await updateTransportStatus(2, "开始转运"); |
| | | } else if (modalAction.value === "完成") { |
| | | await updateTransportStatus(3, "完成转运"); |
| | | } |
| | | common_vendor.index.showToast({ |
| | | title: `${modalAction.value}成功`, |
| | | icon: "success" |
| | | }); |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:421", `${modalAction.value}失败:`, error); |
| | | common_vendor.index.showToast({ |
| | | title: `${modalAction.value}失败,请重试`, |
| | | icon: "none" |
| | | }); |
| | | } finally { |
| | | showActionModal.value = false; |
| | | } |
| | | }; |
| | | const cancelAction = () => { |
| | | showActionModal.value = false; |
| | | }; |
| | | const loadInitialData = async () => { |
| | | initLoading.value = true; |
| | | try { |
| | | await Promise.all([loadTransports(true), loadStats()]); |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:442", "初始化数据失败:", error); |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:547", "初始化数据失败:", error); |
| | | } finally { |
| | | initLoading.value = false; |
| | | } |
| | |
| | | params.startDate = startDate.value; |
| | | params.endDate = endDate.value; |
| | | } |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:497", "请求参数:", params); |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:602", "请求参数:", params); |
| | | const res = await common_vendor.index.$uapi.post("/project/transport/list", params); |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:501", "接口返回数据:", res); |
| | | if (res && res.code === 200) { |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:606", "接口返回数据:", res); |
| | | if (res && res.code == 200) { |
| | | let data = []; |
| | | if (res.rows && Array.isArray(res.rows)) { |
| | | data = res.rows; |
| | |
| | | } else if (Array.isArray(res)) { |
| | | data = res; |
| | | } else { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:514", "接口返回格式不正确:", res); |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:619", "接口返回格式不正确:", res); |
| | | throw new Error("接口返回格式不正确"); |
| | | } |
| | | const mappedData = data.map((item) => mapApiDataToTransportItem(item)); |
| | | if (reset || pageNum.value === 1) { |
| | | if (reset || pageNum.value == 1) { |
| | | transports.value = mappedData; |
| | | } else { |
| | | transports.value = [...transports.value, ...mappedData]; |
| | |
| | | throw new Error((res == null ? void 0 : res.msg) || "加载失败"); |
| | | } |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:537", "加载转运单列表失败:", error); |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:642", "加载转运单列表失败:", error); |
| | | common_vendor.index.showToast({ |
| | | title: "网络请求失败", |
| | | icon: "none" |
| | |
| | | } |
| | | }; |
| | | const loadStats = async () => { |
| | | var _a, _b; |
| | | try { |
| | | const res = await common_vendor.index.$uapi.post("/api/totalServiceTransportState"); |
| | | if (res.data) { |
| | | const res = await common_vendor.index.$uapi.post( |
| | | "/project/transport/totalServiceTransportState" |
| | | ); |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:659", 222); |
| | | common_vendor.index.__f__("log", "at pagesSub/case/transfer.vue:660", res, "11"); |
| | | if (res.data && Array.isArray(res.data)) { |
| | | const totalTransports = res.data.reduce((sum, item) => sum + item.count, 0) || 0; |
| | | const pendingTransports = ((_a = res.data.find((item) => item.transit_status == 1)) == null ? void 0 : _a.count) || 0; |
| | | const completedTransports = ((_b = res.data.find((item) => item.transit_status == 3)) == null ? void 0 : _b.count) || 0; |
| | | stats.value = { |
| | | totalTransports: res.data.reduce((sum, item) => sum + item.count, 0) || 0, |
| | | pendingTransports: res.data[0].count || 0, |
| | | completedTransports: res.data[3].count || 0 |
| | | totalTransports, |
| | | pendingTransports, |
| | | completedTransports |
| | | }; |
| | | } |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:561", "加载统计失败:", error); |
| | | } |
| | | }; |
| | | const updateTransportStatus = async (newStatus, actionName) => { |
| | | try { |
| | | const updateData = { |
| | | id: currentTransport.value.id, |
| | | transitStatus: newStatus |
| | | }; |
| | | const res = await common_vendor.index.$uapi.post("/project/transport/edit", updateData); |
| | | if (res && res.code === 200) { |
| | | const index = transports.value.findIndex( |
| | | (item) => item.id === currentTransport.value.id |
| | | ); |
| | | if (index !== -1) { |
| | | transports.value[index].transitStatus = newStatus; |
| | | } |
| | | await loadStats(); |
| | | common_vendor.index.setStorageSync("transportStatusUpdate", { |
| | | orderId: currentTransport.value.id, |
| | | status: newStatus |
| | | }); |
| | | return true; |
| | | } else { |
| | | throw new Error((res == null ? void 0 : res.msg) || `${actionName}失败`); |
| | | stats.value = { |
| | | totalTransports: 0, |
| | | pendingTransports: 0, |
| | | completedTransports: 0 |
| | | }; |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:683", "统计数据格式异常:", res.data); |
| | | } |
| | | } catch (error) { |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:598", `${actionName}失败:`, error); |
| | | throw error; |
| | | common_vendor.index.__f__("error", "at pagesSub/case/transfer.vue:686", "加载统计失败:", error); |
| | | stats.value = { |
| | | totalTransports: 0, |
| | | pendingTransports: 0, |
| | | completedTransports: 0 |
| | | }; |
| | | } |
| | | }; |
| | | const handleStatusUpdate = (update) => { |
| | | const index = transports.value.findIndex( |
| | | (item) => item.id === update.orderId |
| | | (item) => item.id == update.orderId |
| | | ); |
| | | if (index !== -1) { |
| | | transports.value[index].transitStatus = update.status; |
| | |
| | | return common_vendor.e({ |
| | | a: common_vendor.t(item.caseNo || item.reportId), |
| | | b: common_vendor.t(item.patName), |
| | | c: common_vendor.t(getGenderText(item.sex)), |
| | | c: common_vendor.t(item.sex == 1 ? "男" : "女"), |
| | | d: common_vendor.t(item.age), |
| | | e: common_vendor.t(getStatusText(item.transitStatus)), |
| | | f: common_vendor.n(getStatusClass(item.transitStatus)), |
| | |
| | | j: common_vendor.t(item.contactPerson || "未指定"), |
| | | k: common_vendor.t(formatTime(item.createTime)), |
| | | l: common_vendor.t(getStatusText(item.transitStatus)), |
| | | m: item.transitStatus === 1 |
| | | }, item.transitStatus === 1 ? { |
| | | n: common_vendor.o(($event) => startTransport(item), index) |
| | | m: item.transitStatus == 1 |
| | | }, item.transitStatus == 1 ? { |
| | | n: common_vendor.o(($event) => handleStartTransport(item), index) |
| | | } : {}, { |
| | | o: item.transitStatus === 2 |
| | | }, item.transitStatus === 2 ? { |
| | | p: common_vendor.o(($event) => completeTransport(item), index) |
| | | o: item.transitStatus == 2 |
| | | }, item.transitStatus == 2 ? { |
| | | p: common_vendor.o(($event) => handleCompleteTransport(item), index) |
| | | } : {}, { |
| | | q: item.transitStatus != 3 |
| | | }, item.transitStatus != 3 ? { |
| | | r: common_vendor.o(($event) => editTransport(item), index) |
| | | q: item.transitStatus == 2 |
| | | }, item.transitStatus == 2 ? { |
| | | r: common_vendor.o(($event) => handleCancelTransport(item), index) |
| | | } : {}, { |
| | | s: common_vendor.o(($event) => viewDetails(item), index), |
| | | t: index, |
| | | v: common_vendor.o(($event) => viewDetail(item), index) |
| | | s: item.transitStatus == 4 |
| | | }, item.transitStatus == 4 ? { |
| | | t: common_vendor.o(($event) => handleRecoverTransport(item), index) |
| | | } : {}, { |
| | | v: common_vendor.o(($event) => viewDetails(item), index), |
| | | w: index, |
| | | x: common_vendor.o(($event) => viewDetail(item), index) |
| | | }); |
| | | }), |
| | | n: loadingMore.value |
| | |
| | | } : {}, { |
| | | p: !hasMore.value && filteredTransports.value.length > 0 |
| | | }, !hasMore.value && filteredTransports.value.length > 0 ? {} : {}, { |
| | | q: !loading.value && filteredTransports.value.length === 0 |
| | | }, !loading.value && filteredTransports.value.length === 0 ? { |
| | | q: !loading.value && filteredTransports.value.length == 0 |
| | | }, !loading.value && filteredTransports.value.length == 0 ? { |
| | | r: common_assets._imports_0$3 |
| | | } : {}, { |
| | | s: refreshing.value, |
| | | t: common_vendor.o(onRefresh), |
| | | v: common_vendor.o(onLoadMore), |
| | | w: showActionModal.value |
| | | }, showActionModal.value ? { |
| | | }, showActionModal.value ? common_vendor.e({ |
| | | x: common_vendor.t(modalTitle.value), |
| | | y: common_vendor.t(modalAction.value), |
| | | z: common_vendor.t(currentTransport.value.caseNo), |
| | | A: common_vendor.o(cancelAction), |
| | | B: common_vendor.o(confirmAction) |
| | | A: currentTransport.value.patName |
| | | }, currentTransport.value.patName ? { |
| | | B: common_vendor.t(currentTransport.value.patName), |
| | | C: common_vendor.t(getStatusText(currentTransport.value.transitStatus)) |
| | | } : {}, { |
| | | C: initLoading.value |
| | | D: common_vendor.o(cancelAction), |
| | | E: common_vendor.t(modalAction.value), |
| | | F: common_vendor.o(confirmAction), |
| | | G: common_vendor.o(() => { |
| | | }), |
| | | H: common_vendor.o(cancelAction) |
| | | }) : {}, { |
| | | I: initLoading.value |
| | | }, initLoading.value ? { |
| | | D: common_vendor.p({ |
| | | J: common_vendor.p({ |
| | | loading: true, |
| | | text: "数据加载中..." |
| | | }) |
| | | } : {}, { |
| | | E: common_vendor.gei(_ctx, "") |
| | | K: common_vendor.gei(_ctx, "") |
| | | }); |
| | | }; |
| | | } |