|
@@ -29,14 +29,14 @@
|
|
<HcCard :scrollbar="false" actionSize="lg">
|
|
<HcCard :scrollbar="false" actionSize="lg">
|
|
<template #header>
|
|
<template #header>
|
|
<HcTooltip keys="tentative_laboratory_print_print">
|
|
<HcTooltip keys="tentative_laboratory_print_print">
|
|
- <el-button hc-btn>
|
|
|
|
- <HcIcon name="printer"/>
|
|
|
|
|
|
+ <el-button hc-btn :loading="printLoading" @click="batchPrint">
|
|
|
|
+ <HcIcon name="printer" />
|
|
<span>打印</span>
|
|
<span>打印</span>
|
|
</el-button>
|
|
</el-button>
|
|
</HcTooltip>
|
|
</HcTooltip>
|
|
<HcTooltip keys="tentative_laboratory_print_print_all">
|
|
<HcTooltip keys="tentative_laboratory_print_print_all">
|
|
- <el-button hc-btn>
|
|
|
|
- <HcIcon name="printer" fill/>
|
|
|
|
|
|
+ <el-button hc-btn :loading="printLoading" @click="batchPrint">
|
|
|
|
+ <HcIcon name="printer" fill />
|
|
<span>全部打印</span>
|
|
<span>全部打印</span>
|
|
</el-button>
|
|
</el-button>
|
|
</HcTooltip>
|
|
</HcTooltip>
|
|
@@ -156,7 +156,7 @@ const tableSelection = (rows) => {
|
|
//拼接ID
|
|
//拼接ID
|
|
const rowsToId = (rows) => {
|
|
const rowsToId = (rows) => {
|
|
return rows.map((obj) => {
|
|
return rows.map((obj) => {
|
|
- return obj.id;
|
|
|
|
|
|
+ return obj.pkeyId;
|
|
}).join(",")
|
|
}).join(",")
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,6 +175,21 @@ const onmousedown = () => {
|
|
document.onmouseup = null;
|
|
document.onmouseup = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+//打印
|
|
|
|
+const printLoading = ref(false)
|
|
|
|
+const batchPrint = async () => {
|
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
|
+ const ids = rowsToId(rows)
|
|
|
|
+ //批量下载
|
|
|
|
+ printLoading.value = true
|
|
|
|
+ const {error, code, data} = await dataApi.batchPrint({pKeyIds: ids})
|
|
|
|
+ //处理数据
|
|
|
|
+ printLoading.value = false
|
|
|
|
+ const res = isString(data) ? data ?? '' : ''
|
|
|
|
+ if (!error && code === 200 && res) {
|
|
|
|
+ window.open(res, '_blank')
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|