前端 批量打印

main
鹿和sa0ChunLuyu 7 days ago
parent ff156c8eec
commit 7a84345a0c

@ -330,6 +330,14 @@
const dates = new Set(dated.map(v => v.reservation_date)) const dates = new Set(dated.map(v => v.reservation_date))
return dates.size > 1 return dates.size > 1
}); });
let debounceTimer = null
const debouncedGetPlan = () => {
if (debounceTimer) clearTimeout(debounceTimer)
debounceTimer = setTimeout(() => {
GetEnablePlanFunc()
debounceTimer = null
}, 500)
}
const handleSelectionChange = (selection) => { const handleSelectionChange = (selection) => {
selectedMianListId.value = [] selectedMianListId.value = []
selectedEntrustId.value = [] selectedEntrustId.value = []
@ -395,7 +403,7 @@
GetEnablePlanFunc(); GetEnablePlanFunc();
} }
} else { } else {
GetEnablePlanFunc(); debouncedGetPlan()
} }
} }
// dialog // dialog
@ -519,6 +527,22 @@
break break
} }
} }
//
if (selectedMianListId.value.length === 0) {
const firstNormal = entrustTableDate.value.find(v => v.tishi_msg === '')
if (firstNormal) {
isHandlingSelection.value = false
if (skipRestore && tempSelected.length > 0) {
tempSelected.forEach(id => {
const row = entrustTableDate.value.find(v => v.id === id)
if (row) entrustTableRef.value.toggleRowSelection(row, true)
})
} else {
entrustTableRef.value.toggleRowSelection(firstNormal, true)
}
isHandlingSelection.value = true
}
}
} }
if(onMountedStatus.value){//, if(onMountedStatus.value){//,
@ -1492,12 +1516,20 @@
if (selectedRows.value.length > 0) { if (selectedRows.value.length > 0) {
const firstDept = selectedRows.value[0].department_resources?.department_resources_name const firstDept = selectedRows.value[0].department_resources?.department_resources_name
if (firstDept) activeZhenShi.value = firstDept if (firstDept) activeZhenShi.value = firstDept
}
const hasUnbooked = selectedRows.value.some(v => v.list_status === 0)
if (!hasUnbooked) {
GetEnablePlanFunc() GetEnablePlanFunc()
} }
}, true)
if (auto_print.value.length > 0) { if (auto_print.value.length > 0) {
print_shenqingdan() const bookedIds = selectedRows.value
.filter(v => v.list_status === 1)
.map(v => v.entrust_id)
if (bookedIds.length > 0) {
print_shenqingdan(bookedIds)
} }
}
}, true)
} else { } else {
ElMessageBox.confirm( ElMessageBox.confirm(
res.msg, res.msg,
@ -1624,16 +1656,19 @@
const firstDept = selectedRows.value[0].department_resources?.department_resources_name const firstDept = selectedRows.value[0].department_resources?.department_resources_name
if (firstDept) activeZhenShi.value = firstDept if (firstDept) activeZhenShi.value = firstDept
} }
const hasUnbooked = selectedRows.value.some(v => v.list_status === 0)
if (!hasUnbooked) {
GetEnablePlanFunc() GetEnablePlanFunc()
}
if (auto_print.value.length > 0) {
print_shenqingdan(successEntrustIds)
}
}, true) }, true)
systemConfigs.value.forEach((v, i) => { systemConfigs.value.forEach((v, i) => {
if (v.label == '开启申请单pdf' && v.value === "1") { if (v.label == '开启申请单pdf' && v.value === "1") {
// CreateJianChaShenQingDanPdfFunc(successEntrustIds) // CreateJianChaShenQingDanPdfFunc(successEntrustIds)
} }
}) })
if (auto_print.value.length > 0) {
print_shenqingdan(successEntrustIds)
}
} }
} }
//(,) //(,)
@ -1777,7 +1812,7 @@
return return
} }
const params = ids.map(id => 'OrderNoList[]=' + id).join('&') const params = ids.map(id => 'OrderNoList[]=' + id).join('&')
const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=single&' + params const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=group&' + params
fetch(url) fetch(url)
.then(res => res.blob()) .then(res => res.blob())
.then(blob => { .then(blob => {
@ -1869,7 +1904,12 @@
onMountedStatus.value=true; onMountedStatus.value=true;
GetConfigInfoFunc() GetConfigInfoFunc()
date_list.value = getDatesAfter() date_list.value = getDatesAfter()
GetMainInfo() GetMainInfo(() => {
const hasUnbooked = selectedRows.value.some(v => v.list_status === 0)
if (!hasUnbooked) {
GetEnablePlanFunc()
}
})
}) })
</script> </script>

@ -95,6 +95,7 @@
<el-button type="primary" @click="SignInFunc()" style="margin-left: 40px;">报到</el-button> <el-button type="primary" @click="SignInFunc()" style="margin-left: 40px;">报到</el-button>
<el-button v-if="false" type="danger" @click="CancelSignFunc()"></el-button> <el-button v-if="false" type="danger" @click="CancelSignFunc()"></el-button>
<el-button @click="print_shenqingdan()"></el-button> <el-button @click="print_shenqingdan()"></el-button>
<el-button @click="batchPrint()"></el-button>
<el-button v-if="false" v-print="'#tablelist'" >打印表格</el-button> <el-button v-if="false" v-print="'#tablelist'" >打印表格</el-button>
</el-row> </el-row>
@ -238,6 +239,72 @@
{{item}} {{item}}
</div> </div>
</el-dialog> </el-dialog>
<el-dialog v-model="batchPrintDialogVisible" title="批量打印申请单" width="95%">
<el-table :data="tableData.filter(v => v.list_status === 1)" ref="batchPrintTableRef"
@selection-change="handleBatchSelectionChange" row-key="id" class="batch-print-table">
<el-table-column type="selection" width="50" />
<el-table-column prop="list_status" label="状态" width="80">
<template #default="scope">
<el-tag v-if="scope.row.list_status===0" class="ml-2" type="info"></el-tag>
<el-tag v-if="scope.row.list_status===1" class="ml-2" type="success"></el-tag>
<el-tag v-if="scope.row.list_status===2" class="ml-2"></el-tag>
<el-tag v-if="scope.row.list_status===3" class="ml-2" type="warning"></el-tag>
</template>
</el-table-column>
<el-table-column label="门诊号" width="120">
<template #default="scope">
<span v-if="scope.row.patient_type != 0">{{ scope.row.reg_num }}</span>
</template>
</el-table-column>
<el-table-column label="住院号" width="120">
<template #default="scope">
<span v-if="scope.row.patient_type == 0">{{ scope.row.episodeid?.slice(-10) }}</span>
</template>
</el-table-column>
<el-table-column prop="user_name" label="姓名" />
<el-table-column prop="user_sex" label="性别" width="60">
<template #default="scope">
<span v-if="scope.row.user_sex==1"></span>
<span v-if="scope.row.user_sex==2"></span>
</template>
</el-table-column>
<el-table-column prop="age" label="年龄" width="115" />
<el-table-column prop="entrust" label="医嘱" width="200" />
<el-table-column prop="is_pay" label="是否交费" width="80">
<template #default="scope">
<span v-if="scope.row.is_pay==1"></span>
<span v-if="scope.row.is_pay==0"></span>
</template>
</el-table-column>
<el-table-column prop="reservation_date" label="预约日期" width="120" />
<el-table-column prop="check_begin_time" label="预约时间" width="120">
<template #default="scope">
<span v-if="scope.row.period_begin_time && scope.row.period_end_time">{{scope.row.period_begin_time.substring(0, 5)}}~{{scope.row.period_end_time.substring(0, 5)}}</span>
</template>
</el-table-column>
<el-table-column prop="department_resources_name" label="排班" width="120" />
<el-table-column prop="reservation_department" label="申请科室" width="120" />
<el-table-column prop="" label="医嘱时间" width="160">
<template #default="scope">
{{scope.row.entrust_date}} {{scope.row.entrust_time}}
</template>
</el-table-column>
<el-table-column prop="docotr" label="申请医生" width="80" />
<el-table-column prop="patient_type" label="病人类型" width="80">
<template #default="scope">
<span v-if="scope.row.patient_type==0"></span>
<span v-if="scope.row.patient_type==1"></span>
<span v-if="scope.row.patient_type==2"></span>
<span v-if="scope.row.patient_type==3"></span>
</template>
</el-table-column>
<el-table-column prop="user_phone" label="电话" width="120" />
</el-table>
<template #footer>
<el-button @click="batchPrintDialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirmBatchPrint"></el-button>
</template>
</el-dialog>
</div> </div>
</template> </template>
@ -701,6 +768,48 @@
document.body.appendChild(iframe) document.body.appendChild(iframe)
}) })
} }
//
let batchPrintDialogVisible = ref(false)
let batchPrintSelected = ref([])
let batchPrintTableRef = ref(null)
const batchPrint = () => {
const printable = tableData.value.filter(v => v.list_status === 1)
if (printable.length === 0) {
ElMessage.info('当前列表中没有可打印的已预约项目')
return
}
batchPrintDialogVisible.value = true
}
const handleBatchSelectionChange = (selection) => {
batchPrintSelected.value = selection
}
const confirmBatchPrint = () => {
if (batchPrintSelected.value.length === 0) {
ElMessage.error('请选择至少1项进行打印')
return
}
const params = batchPrintSelected.value
.map(v => 'OrderNoList[]=' + v.entrust_id)
.join('&')
const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=group&' + params
fetch(url)
.then(res => res.blob())
.then(blob => {
const blobUrl = URL.createObjectURL(blob)
const iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = blobUrl
iframe.onload = () => {
iframe.contentWindow.print()
URL.revokeObjectURL(blobUrl)
}
document.body.appendChild(iframe)
batchPrintDialogVisible.value = false
})
}
const closeYuYueDialog=()=>{ const closeYuYueDialog=()=>{
GetList() GetList()
} }
@ -843,6 +952,10 @@
display: none; display: none;
} }
.batch-print-table .el-checkbox[aria-label="选择所有行"] {
display: inline-flex;
}
.el-dialog.is-fullscreen { .el-dialog.is-fullscreen {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

Loading…
Cancel
Save