手工入库功能
This commit is contained in:
parent
73f32472f3
commit
199c547199
2
.gitignore
vendored
2
.gitignore
vendored
@ -21,3 +21,5 @@ selenium-debug.log
|
||||
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
.trae/
|
||||
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
@ -2,16 +2,13 @@
|
||||
<div class="hand-in-storage">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button type="primary" plain :icon="Search" @click="handleSearch">检索</el-button>
|
||||
<!-- <el-button type="primary" plain :icon="Search" @click="handleSearch">检索</el-button> -->
|
||||
<el-button type="success" plain :icon="Plus" @click="handleAdd">新增</el-button>
|
||||
<el-button type="warning" plain :icon="Fold" @click="handleSave" :loading="saveLoading">保存</el-button>
|
||||
<el-button type="info" plain :icon="Printer">打印</el-button>
|
||||
<el-button type="primary" plain :icon="Upload">导入</el-button>
|
||||
<!-- <el-button type="primary" plain :icon="Upload">导入</el-button> -->
|
||||
<el-button type="danger" plain :icon="Close" @click="handleClose">关闭</el-button>
|
||||
</div>
|
||||
<!-- <div class="toolbar-right">
|
||||
<el-checkbox v-model="printDetail">打印明细</el-checkbox>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
@ -31,7 +28,8 @@
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="经手人">
|
||||
<SelectTable v-model:data="mainForm.handle_person" :tableData="userList" placeholder="经手人" />
|
||||
<SelectTable v-model:data="mainForm.handle_person" :tableData="userList"
|
||||
placeholder="经手人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
@ -40,9 +38,10 @@
|
||||
<el-select v-model="mainForm.source_type" placeholder="血站" style="width: 80px"
|
||||
@change="handleSourceType">
|
||||
<el-option label="血站" value="1" />
|
||||
<el-option label="其它" value="2" />
|
||||
<el-option label="医院" value="2" />
|
||||
</el-select>
|
||||
<el-input v-model="mainForm.org" placeholder="请输入来源" style="flex: 1" />
|
||||
<SelectTable v-model:data="mainForm.org" :tableData="hospitalList" placeholder="请输入血液来源"
|
||||
style="flex: 1" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -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<any[]>([])
|
||||
|
||||
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()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user