From 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 18:09:58 +0800
Subject: [PATCH] 上报转运调试
---
pages/case/transferinfo.vue | 229 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 132 insertions(+), 97 deletions(-)
diff --git a/pages/case/transferinfo.vue b/pages/case/transferinfo.vue
index 83713e6..1ada6e7 100644
--- a/pages/case/transferinfo.vue
+++ b/pages/case/transferinfo.vue
@@ -4,7 +4,7 @@
<scroll-view scroll-y class="form-scroll" :show-scrollbar="false">
<view class="form-content">
<!-- 妗堜緥淇℃伅鍗$墖 -->
- <view class="form-section" v-if="transportData.caseNo">
+ <view class="form-section" v-if="transportData.reportId">
<view class="section-header">
<view class="section-icon">馃搵</view>
<text class="section-title">鍏宠仈妗堜緥淇℃伅</text>
@@ -54,7 +54,7 @@
</view>
<view class="form-grid">
- <view class="form-item">
+ <!-- <view class="form-item">
<text class="item-label">杞繍鍗曞彿</text>
<u-input
v-model="transportData.reportId"
@@ -63,7 +63,7 @@
:disabledColor="disabledColor"
border="none"
/>
- </view>
+ </view> -->
<view class="form-item">
<text class="item-label required">鍑哄彂鍦扮偣</text>
@@ -249,47 +249,6 @@
</view>
</view>
- <!-- 闄勪欢淇℃伅 -->
- <view
- class="form-section"
- v-if="
- transportData.annexfilesList &&
- transportData.annexfilesList.length > 0
- "
- >
- <view class="section-header">
- <view class="section-icon">馃搸</view>
- <text class="section-title"
- >闄勪欢淇℃伅 ({{ transportData.annexfilesList.length }})</text
- >
- </view>
-
- <view class="attachment-list">
- <view
- v-for="(file, index) in transportData.annexfilesList"
- :key="index"
- class="attachment-item"
- @click="previewFile(file)"
- >
- <view class="file-info">
- <u-icon
- name="file-text"
- color="#409EFF"
- size="20"
- class="file-icon"
- ></u-icon>
- <view class="file-details">
- <text class="file-name">{{ file.fileName }}</text>
- <text class="file-time">{{
- formatTime(file.createTime)
- }}</text>
- </view>
- </view>
- <u-icon name="arrow-right" color="#999" size="16"></u-icon>
- </view>
- </view>
- </view>
-
<!-- 澶囨敞淇℃伅 -->
<view class="form-section">
<view class="section-header">
@@ -334,9 +293,9 @@
>
瀹屾垚杞繍
</u-button>
- <u-button v-if="canDelete" class="btn error" @click="handleDelete">
+ <!-- <u-button v-if="canDelete" class="btn error" @click="handleDelete">
鍒犻櫎
- </u-button>
+ </u-button> -->
</template>
<!-- 缂栬緫妯″紡 -->
@@ -354,7 +313,15 @@
</view>
</view>
</scroll-view>
-
+ <attachment-upload
+ ref="attachment"
+ :files="attachments"
+ :readonly="isReadonly"
+ :maxCount="5"
+ @update:files="handleFilesUpdate"
+ @upload-base="handleBaseUpload"
+ @preview="handlePreview"
+ />
<!-- 鏃堕棿閫夋嫨鍣� -->
<u-datetime-picker
:show="showTimePicker"
@@ -372,13 +339,18 @@
<script setup>
import { ref, computed, onMounted } from "vue";
+import attachmentUpload from "@/components/attachment";
+import { useUserStore } from "@/stores/user";
+
import { onLoad } from "@dcloudio/uni-app";
// 瀛楀吀鏁版嵁
const dict = ref({});
// 鏁版嵁
-const transportData = ref({});
+const transportData = ref({
+ annexfilesList: [], // 闄勪欢鏂囦欢鍦板潃闆嗗悎
+});
const loading = ref(false);
const saving = ref(false);
const isEdit = ref(false);
@@ -386,6 +358,9 @@
const showTimePicker = ref(false);
const departureTimeValue = ref(0);
const statusSelectVisible = ref(false);
+const isReadonly = ref(false);
+const attachments = ref([]);
+
// 瀛楀吀閫夐」
const statusOptions = ref([
@@ -459,10 +434,18 @@
const loadTransportData = async (id) => {
loading.value = true;
try {
- const res = await uni.$uapi.post(`/project/transport/list`, { id: id });
+ const res = await uni.$uapi.get(`/project/transport/getInfo/${id}`);
- if (res) {
- transportData.value = res[0];
+ if (res.data) {
+ transportData.value = res.data;
+
+ if (res.data.annexfilesList) {
+ attachments.value = res.data.annexfilesList;
+ attachments.value.forEach(item=>{
+ item.url=item.opath,
+ item.name=item.fileName
+ })
+ }
} else {
throw new Error(res.msg || "鏁版嵁鍔犺浇澶辫触");
}
@@ -482,26 +465,28 @@
try {
// 濡傛灉鏈夋渚婭D锛屽姞杞芥渚嬩俊鎭�
if (caseId) {
- const res = await uni.$uapi.post(
- `/project/transport/list`,
- { id: caseId },
+ const res = await uni.$uapi.get(
+ `/project/donatebaseinforeport/getInfo/${caseId}`,
);
- if (res) {
- const caseData = res[0];
+ if (res.data) {
+ const caseData = res.data;
+ console.log(caseData);
+
transportData.value = {
...transportData.value,
- caseNo: caseNo || caseData.caseNo,
- patName: caseData.patName,
- sex: caseData.sex,
- age: caseData.age,
- diagnosisname: caseData.diagnosisname,
- treatmentHospitalName: caseData.treatmenthospitalname,
- transitStatus: 1, // 寰呰浆杩�
- createTime: new Date()
- .toISOString()
- .replace("T", " ")
- .substring(0, 19),
+ caseNo: caseData.caseNo || "",
+ patName: caseData.name || "",
+ sex: caseData.sex || "",
+ age: caseData.age || "",
+ reportId: caseData.id || null,
+ diagnosisname: caseData.diagnosisname || "",
+ treatmentHospitalName: caseData.treatmenthospitalname || "",
+ treatmentDeptName: caseData.treatmentdeptname || "",
+ // 鍙互璁剧疆涓�浜涢粯璁ゅ��
+ transportStartPlace: caseData.treatmenthospitalname || "",
+ contactPerson: caseData.coordinatorName || "",
};
+ console.log(transportData.value, "transportData.value");
}
} else {
transportData.value = {
@@ -560,6 +545,7 @@
// 鏃堕棿纭
const onTimeConfirm = (e) => {
const date = new Date(e.value);
+ // 娣诲姞绉掔殑閮ㄥ垎
transportData.value.transportStartTime = `${date.getFullYear()}-${(
date.getMonth() + 1
)
@@ -567,7 +553,11 @@
.padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")} ${date
.getHours()
.toString()
- .padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
+ .padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}:${date
+ .getSeconds()
+ .toString()
+ .padStart(2, "0")}`; // 娣诲姞绉�
+
showTimePicker.value = false;
};
@@ -641,10 +631,18 @@
saving.value = true;
try {
+ // const submitData = {
+ // ...transportData.value,
+
+ // };
const submitData = {
...transportData.value,
+ annexfilesList: attachments.value.map((file) => ({
+ path: file.url,
+ fileName: file.name,
+ type: file.type,
+ })),
};
-
let res;
if (transportId.value) {
// 淇敼
@@ -737,9 +735,15 @@
const updateData = {
id: transportId.value,
transitStatus: newStatus,
+ ...transportData.value,
+ annexfilesList: attachments.value.map((file) => ({
+ path: file.url,
+ fileName: file.name,
+ type: file.type,
+ })),
};
- const res = await uni.$uapi.post("/system/transport/edit", updateData);
+ const res = await uni.$uapi.post("/project/transport/edit", updateData);
if (res.code === 200) {
uni.showToast({ title: `${actionName}鎴愬姛`, icon: "success" });
@@ -753,32 +757,63 @@
}
};
-// 鍒犻櫎杞繍鍗�
-const handleDelete = () => {
- uni.showModal({
- title: "纭鍒犻櫎",
- content: `纭畾瑕佸垹闄よ浆杩愬崟 ${transportData.value.reportId} 鍚楋紵`,
- success: async (res) => {
- if (res.confirm) {
- try {
- const result = await uni.$uapi.delete(
- `/system/transport/${transportId.value}`,
- );
- if (result.code === 200) {
- uni.showToast({ title: "鍒犻櫎鎴愬姛", icon: "success" });
- setTimeout(() => {
- uni.navigateBack();
- }, 1500);
- } else {
- uni.showToast({ title: result.msg || "鍒犻櫎澶辫触", icon: "none" });
- }
- } catch (error) {
- console.error("鍒犻櫎澶辫触:", error);
- uni.showToast({ title: "鍒犻櫎澶辫触", icon: "none" });
- }
- }
- },
- });
+// 澶勭悊鍩虹闄勪欢涓婁紶
+const handleBaseUpload = (file) => {
+ console.log("鍩虹闄勪欢涓婁紶鎴愬姛:", file);
+ attachments.value.push(file);
+
+};
+
+// 澶勭悊鍏朵粬闄勪欢涓婁紶
+const handleFilesUpdate = (files) => {
+ console.log(files,'files');
+
+ attachments.value = files.map((file) => ({
+ ...file,
+ // 纭繚鍙瓨鍌ㄥ崐璺緞
+ // url: file.url.startsWith("http")
+ // ? file.url.replace(baseUrlHt, "")
+ // : file.url,
+ }));
+ console.log(attachments.value);
+
+};
+
+// 棰勮鏂囦欢 - 淇敼涓轰娇鐢ㄥ畬鏁碪RL
+const handlePreview = (file) => {
+ const fullUrl = file.url.startsWith("http")
+ ? file.url
+ : baseUrlHt + (file.url.startsWith("/") ? "" : "/") + file.url;
+
+ if (file.type.includes("image")) {
+ uni.previewImage({
+ urls: attachments.value
+ .filter((f) => f.type.includes("image"))
+ .map((f) =>
+ f.url.startsWith("http")
+ ? f.url
+ : baseUrlHt + (f.url.startsWith("/") ? "" : "/") + f.url,
+ ),
+ current: fullUrl,
+ });
+ } else if (file.type.includes("pdf")) {
+ uni.downloadFile({
+ url: fullUrl,
+ success: (res) => {
+ uni.openDocument({
+ filePath: res.tempFilePath,
+ fileType: "pdf",
+ showMenu: true,
+ });
+ },
+ fail: (err) => {
+ console.error("鎵撳紑鏂囨。澶辫触:", err);
+ uni.showToast({ title: "鎵撳紑鏂囦欢澶辫触", icon: "none" });
+ },
+ });
+ } else {
+ uni.showToast({ title: "鏆備笉鏀寔姝ゆ枃浠剁被鍨嬮瑙�", icon: "none" });
+ }
};
</script>
@@ -1006,7 +1041,7 @@
padding: 20rpx 30rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
box-shadow: 0 -2rpx 20rpx rgba(0, 0, 0, 0.08);
- z-index: 100;
+ z-index: 9;
}
.btn {
--
Gitblit v1.9.3