From 4ddfa807643c73ff90840b0b65a5118741e12b48 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期六, 09 五月 2026 18:06:13 +0800
Subject: [PATCH] 移动端维护
---
pages/case/CaseDetails.vue | 694 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 499 insertions(+), 195 deletions(-)
diff --git a/pages/case/CaseDetails.vue b/pages/case/CaseDetails.vue
index 6577fb6..4e84cef 100644
--- a/pages/case/CaseDetails.vue
+++ b/pages/case/CaseDetails.vue
@@ -16,51 +16,41 @@
</view>
<view class="form-grid">
- <view class="form-item">
- <text class="item-label">妗堜緥缂栧彿</text>
+ <!-- 淇敼鍚庯細娌荤枟鍖婚櫌杈撳叆妗� -->
+ <!-- <view class="form-item">
+ <text class="item-label required">娌荤枟鍖婚櫌</text>
<u-input
- v-model="form.caseNo"
- placeholder="涓婃姤鍚庤嚜鍔ㄧ敓鎴�"
- disabled
- :disabledColor="disabledColor"
- border="none"
+ v-model="form.treatmenthospitalname"
+ placeholder="璇疯緭鍏ユ不鐤楀尰闄㈠悕绉�"
+ maxlength="100"
+ class="custom-input"
+ />
+ </view> -->
+
+ <!-- 鏂板锛氫笂鎶ュ尰闄� -->
+ <view class="form-item">
+ <text class="item-label">涓婃姤鍖婚櫌</text>
+ <u-input
+ v-model="form.toHospital"
+ placeholder="璇疯緭鍏ヤ笂鎶ュ尰闄�"
+ maxlength="100"
+ class="custom-input"
/>
</view>
- <!-- 鏀归�犲悗鐨勫尰鐤楁満鏋勯�夋嫨 -->
+ <!-- 鏂板锛氶儴闂ㄥ悕绉� -->
<view class="form-item">
- <text class="item-label">鍖荤枟鏈烘瀯</text>
- <picker
- mode="selector"
- :range="hospitalLabels"
- :value="hospitalIndex"
- @change="onHospitalChange"
- >
- <view class="picker">
- <text>{{ currentHospital }}</text>
- <text class="icon-arrow">鈥�</text>
- </view>
- </picker>
- </view>
-
- <!-- 鏀归�犲悗鐨勭瀹ら�夋嫨 -->
- <view class="form-item">
- <text class="item-label">绉戝</text>
- <picker
- mode="selector"
- :range="deptLabels"
- :value="deptIndex"
- @change="onDeptChange"
- >
- <view class="picker">
- <text>{{ currentDept }}</text>
- <text class="icon-arrow">鈥�</text>
- </view>
- </picker>
+ <text class="item-label">绉戝鍚嶇О</text>
+ <u-input
+ v-model="form.deptName"
+ placeholder="璇疯緭鍏ヤ笂鎶ョ瀹�"
+ maxlength="50"
+ class="custom-input"
+ />
</view>
<view class="form-item">
- <text class="item-label required">濮撳悕</text>
+ <text class="item-label required">鎮h�呭鍚�</text>
<u-input
type="text"
v-model="form.name"
@@ -130,7 +120,7 @@
placeholder="璇疯緭鍏ヨ瘉浠跺彿鐮�"
maxlength="18"
class="custom-input"
- @blur="validateIdCard"
+ @blur="onIdCardChange"
/>
<text class="error-text" v-if="idCardError">{{
idCardError
@@ -201,7 +191,7 @@
<view class="form-item">
<text class="item-label">GCS璇勫垎</text>
<u-input
- v-model="form.gscScore"
+ v-model="form.gcsScore"
placeholder="璇疯緭鍏CS璇勫垎"
border="none"
/>
@@ -217,7 +207,23 @@
:customStyle="textareaStyle(!form.diagnosisname)"
/>
</view>
-
+ <view class="form-item">
+ <text class="item-label">鏄惁闇�瑕佽浆杩�</text>
+ <view class="radio-group horizontal">
+ <view
+ v-for="bloodType in isTransportOptions"
+ :key="bloodType.value"
+ class="radio-item"
+ @click="form.isTransport = bloodType.value"
+ >
+ <view
+ class="radio-dot"
+ :class="{ active: form.isTransport === bloodType.value }"
+ ></view>
+ <text class="radio-label">{{ bloodType.label }}</text>
+ </view>
+ </view>
+ </view>
<view class="form-item">
<text class="item-label">琛�鍨�</text>
<view class="radio-group horizontal">
@@ -225,38 +231,44 @@
v-for="bloodType in bloodTypeOptions"
:key="bloodType.value"
class="radio-item"
- @click="form.bloodtype = bloodType.value"
+ @click="form.bloodType = bloodType.value"
>
<view
class="radio-dot"
- :class="{ active: form.bloodtype === bloodType.value }"
+ :class="{ active: form.bloodType === bloodType.value }"
></view>
<text class="radio-label">{{ bloodType.label }}</text>
</view>
</view>
</view>
- <view class="form-item">
+ <view class="form-item full-width">
<text class="item-label">浼犳煋鐥�</text>
- <view class="radio-group horizontal">
+ <view class="checkbox-group single-line">
<view
- v-for="bloodType in infectiousDiseaselist"
- :key="bloodType.value"
- class="radio-item"
- @click="form.infectious = bloodType.value"
+ v-for="disease in infectiousDiseaselist"
+ :key="disease.value"
+ class="checkbox-item"
+ @click="toggleInfectious(disease.value)"
>
<view
- class="radio-dot"
- :class="{ active: form.bloodtype === bloodType.value }"
- ></view>
- <text class="radio-label">{{ bloodType.label }}</text>
+ class="checkbox-box"
+ :class="{ active: isInfectiousSelected(disease.value) }"
+ >
+ <text
+ v-if="isInfectiousSelected(disease.value)"
+ class="checkbox-check"
+ >鉁�</text
+ >
+ </view>
+ <text class="checkbox-label">{{ disease.label }}</text>
</view>
</view>
</view>
- <view class="form-item">
+ <view class="form-item full-width"">
<text class="item-label">鍏朵粬</text>
<u-input
v-model="form.infectiousOther"
- placeholder="璇疯緭鍏ヤ綇闄㈠彿"
+ placeholder="璇疯緭鍏ュ叾浠栦紶鏌撶梾"
border="none"
/>
</view>
@@ -268,11 +280,11 @@
v-for="rh in rhOptions"
:key="rh.value"
class="radio-item"
- @click="form.rhyin = rh.value"
+ @click="form.rhYin = rh.value"
>
<view
class="radio-dot"
- :class="{ active: form.rhyin === rh.value }"
+ :class="{ active: form.rhYin === rh.value }"
></view>
<text class="radio-label">{{ rh.label }}</text>
</view>
@@ -290,9 +302,9 @@
<view class="form-grid">
<view class="form-item">
- <text class="item-label">淇℃伅鍛�</text>
+ <text class="item-label">涓婃姤淇℃伅鍛�</text>
<u-input
- v-model="form.infoname"
+ v-model="form.infoName"
placeholder="璇疯緭鍏ヤ俊鎭憳"
border="none"
/>
@@ -301,7 +313,7 @@
<view class="form-item">
<text class="item-label">鑱旂郴鐢佃瘽</text>
<u-input
- v-model="form.infophone"
+ v-model="form.phone"
placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
type="number"
border="none"
@@ -426,7 +438,7 @@
</template>
<script setup>
-import { ref, computed, onMounted } from "vue";
+import { ref, computed, onMounted, watch } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import attachmentUpload from "@/components/attachment";
import { useUserStore } from "@/stores/user";
@@ -436,10 +448,15 @@
const userStore = useUserStore();
const isEditMode = ref(false);
const currentId = ref(null);
+const selectedInfectious = ref([]); // 瀛樺偍閫変腑鐨勪紶鏌撶梾鍊兼暟缁�
+
// 琛ㄥ崟鏁版嵁
const form = ref({
caseNo: "",
- treatmenthospitalname: "",
+ treatmenthospitalname: userStore.userInfo.user.orgName,
+ toHospital: userStore.userInfo.user.orgName,
+ coordinatorName: userStore.userInfo.user.coordinatorName,
+ coordinatorNo: userStore.userInfo.user.coordinatorNo,
treatmentdeptname: "",
name: "",
nation: "",
@@ -452,10 +469,10 @@
ageunit: "", // 鏂板锛氬勾榫勫崟浣�
inpatientno: "",
diagnosisname: "",
- bloodtype: "",
- rhyin: "",
- infoname: "",
- infophone: "",
+ bloodType: "",
+ rhYin: "",
+ infoName: userStore.userInfo.user.nickName,
+ phone: userStore.userInfo.user.phonenumber,
reportername: userStore.name || "",
reporterno: userStore.userId || "",
reporterphone: "", // 鎶ュ憡鑰呰仈绯荤數璇�
@@ -469,7 +486,6 @@
nativeplace: "", // 鏂板锛氱睄璐�
occupation: "", // 鏂板锛氳亴涓�
patientstate: "", // 鏂板锛氱梾浜虹姸鍐�
- phone: "", // 鏂板锛氳仈绯荤數璇�
registeraddress: "", // 鏂板锛氭埛绫嶅湴鍧�
registerprovince: "", // 鏂板锛氭埛绫嶅湴鍧�鐪佺紪鍙�
registerprovincename: "", // 鏂板锛氭埛绫嶅湴鍧�鐪佸悕绉�
@@ -493,6 +509,8 @@
// 閫夋嫨鍣ㄧ姸鎬�
const attachments = ref([]);
const infectiousDiseaselist = ref([]);
+const nationLabel = ref([]);
+
const isReadonly = ref(false);
const id = ref(null);
const selectShow = ref(false);
@@ -543,15 +561,18 @@
]);
const bloodTypeOptions = ref([
- { label: "A鍨�", value: "A" },
- { label: "B鍨�", value: "B" },
- { label: "O鍨�", value: "O" },
- { label: "AB鍨�", value: "AB" },
+ { label: "A鍨�", value: "A鍨�" },
+ { label: "B鍨�", value: "B鍨�" },
+ { label: "O鍨�", value: "O鍨�" },
+ { label: "AB鍨�", value: "AB鍨�" },
]);
-
+const isTransportOptions = ref([
+ { label: "闇�瑕�", value: "2" },
+ { label: "涓嶉渶瑕�", value: "1" },
+]);
const rhOptions = ref([
- { label: "闃虫��", value: "positive" },
- { label: "闃存��", value: "negative" },
+ { label: "闃虫��", value: "1" },
+ { label: "闃存��", value: "0" },
]);
const reporterOptions = ref([
@@ -566,7 +587,12 @@
// 璁$畻灞炴��
const isFormValid = computed(() => {
- return form.value.name && form.value.idcardno && form.value.diagnosisname;
+ return (
+ form.value.name &&
+ form.value.idcardno &&
+ form.value.diagnosisname &&
+ form.value.toHospital
+ );
});
// 閫夋嫨鍣ㄧ储寮�
const hospitalIndex = ref(-1);
@@ -576,11 +602,11 @@
// 璁$畻灞炴�� - 鏍囩鏁扮粍
const hospitalLabels = computed(() =>
- hospitalOptions.value.map((item) => item.label)
+ hospitalOptions.value.map((item) => item.label),
);
const ageDisplay = computed(() => {
if (!form.value.age || !form.value.ageunit) {
- return '鑷姩璁$畻';
+ return "鑷姩璁$畻";
}
return `${form.value.age}${form.value.ageunit}`;
});
@@ -588,10 +614,10 @@
return pickerColumns.value[0].map((item) => item.label);
});
const nationLabels = computed(() =>
- nationOptions.value.map((item) => item.label)
+ nationLabel.value.map((item) => item.label),
);
const idCardTypeLabels = computed(() =>
- idCardTypeOptions.value.map((item) => item.label)
+ idCardTypeOptions.value.map((item) => item.label),
);
// 璁$畻灞炴�� - 褰撳墠閫変腑鏄剧ず鏂囨湰
@@ -610,7 +636,7 @@
const currentNation = computed(() => {
return nationIndex.value >= 0
? nationLabels.value[nationIndex.value]
- : "璇烽�夋嫨姘戞棌";
+ : (form.value.nation?form.value.nation:"璇烽�夋嫨璇佷欢绫诲瀷");
});
const currentIdCardType = computed(() => {
@@ -619,29 +645,18 @@
: "璇烽�夋嫨璇佷欢绫诲瀷";
});
-// 閫夋嫨鍣ㄥ彉鏇翠簨浠�
-const onHospitalChange = (e) => {
- const index = parseInt(e.detail.value);
- hospitalIndex.value = index;
- form.value.treatmenthospitalname = hospitalOptions.value[index].label;
-};
-
-const onDeptChange = (e) => {
- const index = parseInt(e.detail.value);
- deptIndex.value = index;
- form.value.treatmentdeptname = pickerColumns.value[0][index].label;
-};
-
const onNationChange = (e) => {
const index = parseInt(e.detail.value);
nationIndex.value = index;
form.value.nation = nationOptions.value[index].label;
+ console.log(form.value.nation, "form.value.nation");
};
const onIdCardTypeChange = (e) => {
const index = parseInt(e.detail.value);
idCardTypeIndex.value = index;
form.value.idcardtype = idCardTypeOptions.value[index].value;
+ console.log(form.value.idcardtype, "form.value.idcardtype");
};
const onBirthdayChange = (e) => {
@@ -650,12 +665,12 @@
};
const onDateConfirm = (e) => {
const date = new Date(e.value);
-
+
// 鏍煎紡鍖栨棩鏈熶负 YYYY-MM-DD
form.value.birthday = `${date.getFullYear()}-${(date.getMonth() + 1)
.toString()
.padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`;
-
+
calculateAge();
showDatePicker.value = false;
};
@@ -663,24 +678,153 @@
// 韬唤璇侀獙璇�
const idCardError = ref("");
const validateIdCard = () => {
- if (!form.value.idcardno) {
+ const idCard = form.value.idcardno;
+ console.log(idCard, "褰撳墠杈撳叆");
+
+ if (!idCard) {
idCardError.value = "璇疯緭鍏ヨ瘉浠跺彿鐮�";
return false;
}
- if (form.value.idcardno.length !== 18) {
- idCardError.value = "璇疯緭鍏�18浣嶈韩浠借瘉鍙风爜";
+ if (idCard.length !== 18) {
+ idCardError.value = "韬唤璇佸彿鐮佸繀椤绘槸18浣�";
return false;
}
+ console.log(1);
+
+ // 楠岃瘉鍓�17浣嶅繀椤绘槸鏁板瓧
+ const reg = /^\d{17}(\d|X|x)$/;
+ if (!reg.test(idCard)) {
+ idCardError.value = "韬唤璇佸彿鐮佹牸寮忎笉姝g‘";
+ return false;
+ }
+ console.log(2);
+
+ // 楠岃瘉鍑虹敓鏃ユ湡
+ const birthStr = idCard.substring(6, 14);
+ const year = birthStr.substring(0, 4);
+ const month = birthStr.substring(4, 6);
+ const day = birthStr.substring(6, 8);
+
+ const birthDate = new Date(`${year}-${month}-${day}`);
+ if (isNaN(birthDate.getTime())) {
+ idCardError.value = "韬唤璇佸彿鐮佷腑鐨勫嚭鐢熸棩鏈熸棤鏁�";
+ return false;
+ }
+ console.log(3);
+
+ // 楠岃瘉鏃ユ湡鑼冨洿锛�1900骞磋嚦浠婏級
+ const currentYear = new Date().getFullYear();
+ const birthYear = parseInt(year, 10);
+ if (birthYear < 1900 || birthYear > currentYear) {
+ idCardError.value = "鍑虹敓骞翠唤涓嶅湪鏈夋晥鑼冨洿鍐�";
+ return false;
+ }
+ console.log(4);
+
+ // 楠岃瘉鏍¢獙鐮侊紙绗�18浣嶏級
+ if (!validateIdCardCheckCode(idCard)) {
+ idCardError.value = "韬唤璇佸彿鐮佹牎楠屽け璐�";
+ return false;
+ }
+ console.log(5);
idCardError.value = "";
return true;
};
-// 鏍峰紡鏂规硶
-const inputStyle = (isError) => {
- return isError
- ? "border: 2rpx solid #ff4757; border-radius: 12rpx;"
- : "border: 2rpx solid #e5e5e7; border-radius: 12rpx;";
+// 韬唤璇佸彿鍙樺寲澶勭悊
+const onIdCardChange = (value) => {
+ // 楠岃瘉韬唤璇佹牸寮�
+ if (validateIdCard()) {
+ // 灏濊瘯鎻愬彇鍑虹敓鏃ユ湡
+ extractBirthdayFromIdCard();
+ }
+};
+// 韬唤璇佹牎楠岀爜楠岃瘉鍑芥暟
+const validateIdCardCheckCode = (idCard) => {
+ // 绯绘暟鏁扮粍
+ const coefficientArray = [
+ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2,
+ ];
+ // 鏍¢獙鐮佸搴斿��
+ const checkCodeMap = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
+
+ let sum = 0;
+ for (let i = 0; i < 17; i++) {
+ sum += parseInt(idCard.charAt(i), 10) * coefficientArray[i];
+ }
+
+ const checkCode = checkCodeMap[sum % 11];
+ return checkCode === idCard.charAt(17).toUpperCase();
+};
+// 浠庤韩浠借瘉鍙锋彁鍙栧嚭鐢熸棩鏈�
+const extractBirthdayFromIdCard = () => {
+ const idCard = form.value.idcardno;
+
+ if (!idCard || idCard.length !== 18) {
+ return;
+ }
+
+ try {
+ // 鎻愬彇鍑虹敓鏃ユ湡閮ㄥ垎锛堢7-14浣嶏細YYYYMMDD锛�
+ const birthStr = idCard.substring(6, 14);
+ const year = birthStr.substring(0, 4);
+ const month = birthStr.substring(4, 6);
+ const day = birthStr.substring(6, 8);
+
+ // 楠岃瘉鏃ユ湡鏄惁鏈夋晥
+ const birthDate = new Date(`${year}-${month}-${day}`);
+ if (isNaN(birthDate.getTime())) {
+ console.log("韬唤璇佸彿鐮佷腑鐨勫嚭鐢熸棩鏈熸棤鏁�");
+ return;
+ }
+
+ // 楠岃瘉鏃ユ湡鑼冨洿锛堜笉鑳芥槸鏈潵鏃ユ湡锛�
+ const today = new Date();
+ if (birthDate > today) {
+ console.log("鍑虹敓鏃ユ湡涓嶈兘鏄湭鏉ユ棩鏈�");
+ return;
+ }
+
+ // 楠岃瘉鏈堜唤鍜屾棩鏈熸槸鍚﹀悎鐞�
+ const monthNum = parseInt(month, 10);
+ const dayNum = parseInt(day, 10);
+
+ if (monthNum < 1 || monthNum > 12) {
+ console.log("鏈堜唤鏃犳晥");
+ return;
+ }
+
+ // 妫�鏌ユ棩鏈熸槸鍚︽湁鏁堬紙绠�鍗曢獙璇侊級
+ const daysInMonth = new Date(year, monthNum, 0).getDate();
+ if (dayNum < 1 || dayNum > daysInMonth) {
+ console.log("鏃ユ湡鏃犳晥");
+ return;
+ }
+
+ // 璁剧疆鍑虹敓鏃ユ湡
+ form.value.birthday = `${year}-${month.padStart(2, "0")}-${day.padStart(
+ 2,
+ "0",
+ )}`;
+
+ // 璁$畻骞撮緞
+ calculateAge();
+
+ // 浠庤韩浠借瘉鎻愬彇鎬у埆锛堢17浣嶏紝濂囨暟涓虹敺锛屽伓鏁颁负濂筹級
+ const genderCode = parseInt(idCard.charAt(16), 10);
+ if (!isNaN(genderCode)) {
+ form.value.sex = genderCode % 2 === 1 ? "1" : "2";
+ }
+
+ uni.showToast({
+ title: "宸茶嚜鍔ㄦ彁鍙栧嚭鐢熸棩鏈熷拰鎬у埆",
+ icon: "success",
+ duration: 1500,
+ });
+ } catch (error) {
+ console.error("瑙f瀽韬唤璇佸嚭鐢熸棩鏈熷け璐�:", error);
+ }
};
const textareaStyle = (isError) => {
@@ -710,12 +854,12 @@
dict.value = await useDict(
"sys_IDType",
"sys_user_sex",
+ "sys_Nation",
"sys_BloodType",
"sys_Infectious",
"sys_AgeUnit", // 鏂板骞撮緞鍗曚綅
"sys_education", // 鏂板瀛﹀巻
- "sys_nation", // 鏂板姘戞棌
- "sys_occupation" // 鏂板鑱屼笟
+ "sys_occupation", // 鏂板鑱屼笟
);
initOptions();
updateCurrentTime();
@@ -724,7 +868,36 @@
const initOptions = () => {
infectiousDiseaselist.value = dict.value.sys_Infectious || [];
idCardTypeOptions.value = dict.value.sys_IDType || [];
+ nationLabel.value = dict.value.sys_Nation || [];
+
+ // 鍒濆鍖栦紶鏌撶梾閫夋嫨鐘舵��
+ if (form.value.infectious) {
+ // 灏嗛�楀彿鍒嗛殧鐨勫瓧绗︿覆杞崲涓烘暟缁�
+ selectedInfectious.value = form.value.infectious
+ .split(",")
+ .filter((item) => item.trim() !== "");
+ }
};
+// 鍒囨崲浼犳煋鐥呴�夋嫨
+const toggleInfectious = (value) => {
+ const index = selectedInfectious.value.indexOf(value);
+
+ if (index === -1) {
+ // 娣诲姞閫変腑
+ selectedInfectious.value.push(value);
+ } else {
+ // 绉婚櫎閫変腑
+ selectedInfectious.value.splice(index, 1);
+ }
+
+ // 鏇存柊琛ㄥ崟鐨� infectious 瀛楁锛堥�楀彿鍒嗛殧鐨勫瓧绗︿覆锛�
+ form.value.infectious = selectedInfectious.value.join(",");
+};
+// 妫�鏌ヤ紶鏌撶梾鏄惁琚�変腑
+const isInfectiousSelected = (value) => {
+ return selectedInfectious.value.includes(value);
+};
+
// 鏂规硶瀹氫箟
const updateCurrentTime = () => {
const now = new Date();
@@ -753,18 +926,29 @@
const calculateAge = () => {
if (!form.value.birthday) {
- form.value.age = '';
- form.value.ageunit = '';
+ form.value.age = "";
+ form.value.ageunit = "";
return;
}
const birthDate = new Date(form.value.birthday);
const today = new Date();
-
+
// 妫�鏌ユ棩鏈熸湁鏁堟��
if (isNaN(birthDate.getTime())) {
- form.value.age = '';
- form.value.ageunit = '';
+ form.value.age = "";
+ form.value.ageunit = "";
+ return;
+ }
+
+ // 妫�鏌ユ槸鍚︿负鏈潵鏃ユ湡
+ if (birthDate > today) {
+ uni.showToast({
+ title: "鍑虹敓鏃ユ湡涓嶈兘鏄湭鏉ユ棩鏈�",
+ icon: "none",
+ });
+ form.value.age = "";
+ form.value.ageunit = "";
return;
}
@@ -774,8 +958,8 @@
if (daysDiff < 0) {
// 鏈潵鏃ユ湡澶勭悊
- form.value.age = '';
- form.value.ageunit = '';
+ form.value.age = "";
+ form.value.ageunit = "";
return;
}
@@ -789,14 +973,14 @@
if (years >= 1) {
// 澶т簬绛変簬1骞达細鏄剧ず骞�
let actualYears = years;
-
+
// 澶勭悊鏈堜唤鍜屾棩鏈熺殑杈圭晫鎯呭喌
if (months < 0 || (months === 0 && days < 0)) {
actualYears = years - 1;
}
-
+
ageValue = actualYears.toString();
- ageUnit = '宀�';
+ ageUnit = "宀�";
} else if (daysDiff >= 30) {
// 澶т簬绛変簬30澶╋細鏄剧ず鏈�
let totalMonths = years * 12 + months;
@@ -804,11 +988,11 @@
totalMonths--;
}
ageValue = Math.max(1, totalMonths).toString(); // 纭繚鑷冲皯1涓湀
- ageUnit = '涓湀';
+ ageUnit = "涓湀";
} else {
// 灏忎簬30澶╋細鏄剧ず澶�
ageValue = Math.max(1, daysDiff).toString(); // 纭繚鑷冲皯1澶�
- ageUnit = '澶�';
+ ageUnit = "澶�";
}
form.value.age = ageValue;
@@ -818,16 +1002,19 @@
// 澶勭悊鍩虹闄勪欢涓婁紶
const handleBaseUpload = (file) => {
console.log("鍩虹闄勪欢涓婁紶鎴愬姛:", file);
+ attachments.value.push(file);
};
// 澶勭悊鍏朵粬闄勪欢涓婁紶
const handleFilesUpdate = (files) => {
- formData.attachments = files.map((file) => ({
+ console.log(files, "files");
+
+ attachments.value = files.map((file) => ({
...file,
// 纭繚鍙瓨鍌ㄥ崐璺緞
- url: file.url.startsWith("http")
- ? file.url.replace(baseUrlHt, "")
- : file.url,
+ // url: file.url.startsWith("http")
+ // ? file.url.replace(baseUrlHt, "")
+ // : file.url,
}));
};
@@ -839,12 +1026,12 @@
if (file.type.includes("image")) {
uni.previewImage({
- urls: formData.attachments
+ urls: attachments.value
.filter((f) => f.type.includes("image"))
.map((f) =>
f.url.startsWith("http")
? f.url
- : baseUrlHt + (f.url.startsWith("/") ? "" : "/") + f.url
+ : baseUrlHt + (f.url.startsWith("/") ? "" : "/") + f.url,
),
current: fullUrl,
});
@@ -876,6 +1063,8 @@
};
const onHospitalConfirm = (e) => {
+ console.log(e, "姘戞棌");
+
if (e.value && e.value[0]) {
form.value.treatmenthospitalname = e.value[0].label;
}
@@ -933,6 +1122,10 @@
deptIndex.value = -1;
nationIndex.value = -1;
idCardTypeIndex.value = -1;
+ // 閲嶇疆浼犳煋鐥呴�夋嫨
+ selectedInfectious.value = [];
+
+ // 閲嶇疆闄勪欢
attachments.value = [];
form.value.nationality = "涓浗";
form.value.isTransport = "1";
@@ -960,35 +1153,32 @@
try {
uni.showLoading({ title: isEditMode.value ? "淇敼涓�..." : "鎻愪氦涓�..." });
-
// 鍑嗗鎻愪氦鏁版嵁
const submitData = {
...form.value,
age: parseInt(form.value.age) || 0,
annexfilesList: attachments.value.map((file) => ({
- url: file.url,
- name: file.name,
+ path: file.url,
+ fileName: file.name,
type: file.type,
})),
- phone: form.value.infophone,
isTransport: form.value.isTransport || "1",
terminationCase: form.value.terminationCase || 0,
reportStatus: form.value.reportStatus || "1",
-
};
let res;
if (isEditMode.value) {
// 淇敼鎺ュ彛
res = await uni.$uapi.post(
- "/system/donatebaseinforeport/edit",
- submitData
+ "/project/donatebaseinforeport/edit",
+ submitData,
);
} else {
// 鏂板鎺ュ彛
res = await uni.$uapi.post(
- "/system/donatebaseinforeport/add",
- submitData
+ "/project/donatebaseinforeport/add",
+ submitData,
);
}
@@ -1028,49 +1218,32 @@
};
const loadCaseData = async (id) => {
- // 妯℃嫙鍔犺浇缂栬緫鏁版嵁
- // form.value = {
- // caseNo: "DON20241216001",
- // treatmenthospitalname: "闈掑矝闀滄箹鍖婚櫌",
- // treatmentdeptname: "绁炵粡澶栫",
- // name: "寮犱笁",
- // nation: "姹夋棌",
- // nationality: "涓浗",
- // idcardtype: "灞呮皯韬唤璇�",
- // idcardno: "370203198510123456",
- // sex: "1",
- // birthday: "1985-10-12",
- // age: "38",
- // inpatientno: "ZY20241216001",
- // diagnosisname: "鑴戝浼ゅ鑷磋剳姝讳骸",
- // bloodtype: "A",
- // rhyin: "positive",
- // infoname: "鏉庡尰鐢�",
- // infophone: "13800138000",
- // reporterno: "寮犲尰鐢�",
- // reporttime: currentTime.value,
- // };
try {
loading.value = true;
const res = await uni.$uapi.get(
- `/system/donatebaseinforeport/getInfo/${id}`
+ `/project/donatebaseinforeport/getInfo/${id}`,
);
- if (res.code === 200 && res.data) {
- // 濉厖琛ㄥ崟鏁版嵁
- Object.keys(form.value).forEach((key) => {
- if (res.data[key] !== undefined && res.data[key] !== null) {
- form.value[key] = res.data[key];
- }
- });
-
+ if (res.code) {
+ form.value = res.data;
+ if (res.data.infectious) {
+ selectedInfectious.value = res.data.infectious
+ .split(",")
+ .filter((item) => item.trim() !== "");
+ }
+ currentNation.value=form.value.nation;
+ idCardTypeIndex.value=form.value.idcardtype;
// 澶勭悊閫夋嫨鍣ㄧ储寮�
- updatePickerIndexes();
-
+ // updatePickerIndexes();
// 澶勭悊闄勪欢
if (res.data.annexfilesList) {
attachments.value = res.data.annexfilesList;
+ attachments.value.forEach((item) => {
+ item.url = item.path;
+ item.name = item.fileName;
+ });
}
+ console.log(3, "res");
uni.showToast({
title: "鏁版嵁鍔犺浇鎴愬姛",
@@ -1088,32 +1261,6 @@
} finally {
loading.value = false;
}
-};
-// 鏇存柊閫夋嫨鍣ㄧ储寮�
-const updatePickerIndexes = () => {
- // 鍖荤枟鏈烘瀯绱㈠紩
- const hospitalIndex = hospitalOptions.value.findIndex(
- (item) => item.label === form.value.treatmenthospitalname
- );
- if (hospitalIndex !== -1) hospitalIndex.value = hospitalIndex;
-
- // 绉戝绱㈠紩
- const deptIndex = pickerColumns.value[0].findIndex(
- (item) => item.label === form.value.treatmentdeptname
- );
- if (deptIndex !== -1) deptIndex.value = deptIndex;
-
- // 姘戞棌绱㈠紩
- const nationIndex = nationOptions.value.findIndex(
- (item) => item.label === form.value.nation
- );
- if (nationIndex !== -1) nationIndex.value = nationIndex;
-
- // 璇佷欢绫诲瀷绱㈠紩
- const idCardTypeIndex = idCardTypeOptions.value.findIndex(
- (item) => item.value === form.value.idcardtype
- );
- if (idCardTypeIndex !== -1) idCardTypeIndex.value = idCardTypeIndex;
};
</script>
<style lang="scss" scoped>
@@ -1249,6 +1396,16 @@
display: flex;
gap: 20rpx;
margin-top: 40rpx;
+ // background: #fff;
+ // padding: 20rpx 0;
+ // position: fixed;
+ // bottom: 0;
+ // left: 0;
+ // right: 0;
+ // 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: 9;
}
.btn {
@@ -1473,13 +1630,30 @@
padding: 20rpx 24rpx !important;
background: #fff !important;
}
-
-.action-buttons {
- display: flex;
- gap: 20rpx;
- margin-top: 40rpx;
+.idcard-hint {
+ margin-top: 8rpx;
+ padding: 12rpx 16rpx;
+ background: #f0f9ff;
+ border-radius: 8rpx;
+ border-left: 4rpx solid #0f95b0;
}
+.hint-text {
+ display: block;
+ font-size: 24rpx;
+ color: #0f95b0;
+ margin-bottom: 4rpx;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+}
+
+.error-text {
+ font-size: 24rpx;
+ color: #ff4757;
+ margin-top: 8rpx;
+}
.btn {
flex: 1;
height: 80rpx;
@@ -1502,4 +1676,134 @@
}
}
}
+.checkbox-group {
+ display: flex;
+ flex-wrap: nowrap; /* 绂佹鎹㈣ */
+ gap: 20rpx;
+ overflow-x: auto; /* 姘村钩婊氬姩 */
+ padding-bottom: 10rpx; /* 缁欐粴鍔ㄦ潯鐣欏嚭绌洪棿 */
+ -webkit-overflow-scrolling: touch; /* iOS骞虫粦婊氬姩 */
+
+ &.single-line {
+ display: flex;
+ flex-wrap: nowrap;
+ overflow-x: auto;
+ width: 100%;
+
+ /* 闅愯棌婊氬姩鏉★紝浣嗕繚鎸佹粴鍔ㄥ姛鑳� */
+ &::-webkit-scrollbar {
+ display: none;
+ }
+ }
+}
+
+.checkbox-item {
+ display: flex;
+ align-items: center;
+ gap: 8rpx;
+ flex-shrink: 0; /* 闃叉閫夐」琚帇缂� */
+ padding: 8rpx 16rpx;
+ border-radius: 20rpx;
+ background: #f5f5f7;
+ transition: all 0.3s ease;
+
+ &.active {
+ background: rgba(15, 149, 176, 0.1);
+ }
+}
+
+.checkbox-box {
+ width: 28rpx;
+ height: 28rpx;
+ border: 2rpx solid #e5e5e7;
+ border-radius: 6rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: #fff;
+ transition: all 0.3s ease;
+ flex-shrink: 0;
+
+ &.active {
+ border-color: #0f95b0;
+ background: #0f95b0;
+ }
+}
+
+.checkbox-check {
+ font-size: 20rpx;
+ color: white;
+ font-weight: bold;
+}
+
+.checkbox-label {
+ font-size: 24rpx;
+ color: #1d1d1f;
+ white-space: nowrap;
+}
+
+/* 浼樺寲鍗曢�夋寜閽粍鐨勬牱寮忥紝淇濇寔涓�鑷存�� */
+.radio-group.horizontal {
+ display: flex;
+ flex-wrap: nowrap;
+ overflow-x: auto;
+ gap: 20rpx;
+ padding-bottom: 10rpx;
+ -webkit-overflow-scrolling: touch;
+
+ &::-webkit-scrollbar {
+ display: none;
+ }
+
+ .radio-item {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ gap: 8rpx;
+ padding: 8rpx 16rpx;
+ border-radius: 20rpx;
+ }
+
+ .radio-item .radio-dot.active {
+ border-color: #0f95b0;
+
+ &::after {
+ background: #0f95b0;
+ }
+ }
+}
+
+/* 濡傛灉闇�瑕佸浐瀹氶珮搴︼紝鍙互杩欐牱璁剧疆 */
+.checkbox-group.single-line {
+ min-height: 60rpx;
+ align-items: center;
+}
+
+/* 鍦ㄧЩ鍔ㄧ浼樺寲瑙︽懜鍖哄煙 */
+.checkbox-item {
+ min-height: 60rpx;
+ padding: 8rpx 20rpx;
+ cursor: pointer;
+}
+
+/* 娣诲姞閫変腑鐘舵�佺殑瑙嗚鍙嶉 */
+.checkbox-item.active {
+ border: 1rpx solid #0f95b0;
+ background: rgba(15, 149, 176, 0.08);
+}
+
+/* 鍝嶅簲寮忚皟鏁� */
+@media (max-width: 768px) {
+ .checkbox-group.single-line {
+ gap: 12rpx;
+ }
+
+ .checkbox-item {
+ padding: 6rpx 14rpx;
+ }
+
+ .checkbox-label {
+ font-size: 22rpx;
+ }
+}
</style>
--
Gitblit v1.9.3