diff --git a/.gitignore b/.gitignore
index 78a752d..2d300e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,5 @@ selenium-debug.log
package-lock.json
yarn.lock
+
+.trae/
\ No newline at end of file
diff --git a/src/api/blood/handInStorage.ts b/src/api/blood/handInStorage.ts
index 03a9cc1..99d61a3 100644
--- a/src/api/blood/handInStorage.ts
+++ b/src/api/blood/handInStorage.ts
@@ -31,3 +31,11 @@ export function queryDetail(query?: Object) {
params: query,
});
}
+
+export function getHospitalList(query?: Object) {
+ return request({
+ url: "/bus/bloodbank/handInStorage/getHospitalList",
+ method: "get",
+ params: query,
+ });
+}
diff --git a/src/views/blood/handInStorage/index.vue b/src/views/blood/handInStorage/index.vue
index f08128d..50d8897 100644
--- a/src/views/blood/handInStorage/index.vue
+++ b/src/views/blood/handInStorage/index.vue
@@ -2,16 +2,13 @@
@@ -31,7 +28,8 @@
-
+
@@ -40,9 +38,10 @@
-
+
-
+
@@ -210,13 +209,13 @@ import { Search, Plus, Fold, Printer, Upload, Close, Refresh } from '@element-pl
import { ElMessage, ElMessageBox } from 'element-plus'
import useUserStore from '@/store/modules/user'
import { useCommonDict } from '@/hooks'
-import { getBloodBreed, saveData, queryList, queryDetail } from '@/api/blood/handInStorage'
+import { getBloodBreed, saveData, queryList, queryDetail, getHospitalList } from '@/api/blood/handInStorage'
import BloodTypeStatTable from '@/components/BloodTypeStatTable/index.vue'
const userInfo = useUserStore()
const { getServerTime, bloodBreed: bloodBreedList, getBloodList, userList, getUserData } = useCommonDict()
-const printDetail = ref(false)
+
const cancelBlood = ref(false)
const resetBloodAfterScan = ref(false)
const saveLoading = ref(false)
@@ -274,9 +273,26 @@ const formatBloodBreed = (code: string) => {
return item ? item.label : code
}
+const hospitalList = ref
([])
+
+const fetchHospitalList = () => {
+ getHospitalList({ sourceType: mainForm.value.source_type }).then((res: any) => {
+ hospitalList.value = (res.rows || res.data || []).map((item: any) => ({
+ label: item.hospitalName || item.name || item.label,
+ value: item.hospitalCode || item.code || item.value
+ }))
+ // 默认选中第一项
+ if (hospitalList.value.length > 0 && !mainForm.value.org) {
+ mainForm.value.org = hospitalList.value[0].value
+ }
+ })
+}
+
const handleSourceType = () => {
if (mainForm.value.source_type === '1') {
mainForm.value.org = ''
+ } else if (mainForm.value.source_type === '2') {
+ fetchHospitalList()
}
}
@@ -440,6 +456,10 @@ const confirmSelect = () => {
const main = res.data.xkInstorageMain || {}
// 数据库存的是姓名(nick_name),回显时转换回用户代号以匹配下拉选项
main.handle_person = userList.value.find(v => v.label === main.handle_person)?.value || main.handle_person
+ // 数据库存的是医院名称,回显时转换回医院代号以匹配 SelectTable 选项
+ if (main.source_type === '2' && main.org) {
+ main.org = hospitalList.value.find(v => v.label === main.org)?.value || main.org
+ }
mainForm.value = main
bloodList.value = res.data.xkBloodInfoList || []
}
@@ -455,7 +475,7 @@ const handleAdd = () => {
occur_date: time,
handle_person: userInfo.name,
source_type: '1',
- org: '',
+ org: hospitalList.value.length > 0 ? hospitalList.value[0].value : '',
out_date: time,
remark: ''
}
@@ -508,8 +528,7 @@ const handleSave = () => {
org: mainForm.value.org,
out_date: mainForm.value.out_date,
occur_date: mainForm.value.occur_date,
- // 下拉选的是用户代号,入库时写入姓名(nick_name)
- handle_person: userList.value.find(v => v.value === mainForm.value.handle_person)?.label || mainForm.value.handle_person,
+ handle_person: mainForm.value.handle_person,
remark: mainForm.value.remark,
total_money: totalMoney
},
@@ -520,8 +539,12 @@ const handleSave = () => {
saveLoading.value = true
saveData(data).then((res: any) => {
if (res.code === 0) {
- ElMessage.success('保存成功,入库单号:' + res.data)
- mainForm.value.bill_no = res.data
+ ElMessage.success(res.msg || '保存成功,入库单号:' + res.data)
+ // 保存成功后清空界面
+ cancelBlood.value = false
+ handleAdd()
+ } else {
+ ElMessage.error(res.msg || '保存失败')
}
}).finally(() => {
saveLoading.value = false
@@ -543,6 +566,8 @@ onMounted(() => {
mainForm.value.occur_date = time
mainForm.value.out_date = time
})
+ // 默认调用一次医院列表接口
+ fetchHospitalList()
})