123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <el-dialog
- title="打印"
- :visible.sync="visibility"
- :close-on-click-modal="isClose"
- :close-on-press-escape="isClose"
- >
- <el-button type="primary" @click="print" class="print_style"
- >打印</el-button
- >
- <div id="dialysis-print-box-1" class="dialysis-print-box-1">
- <div class="list_title">
- <div>患者名称:</div>
- <div>数据来源:</div>
- <div>发药状态:</div>
- <div>领药时间:</div>
- </div>
-
- <el-table
- style="width: 940px; margin: 0 auto"
- :data="tableData"
- border
- max-height="450"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- >
- <el-table-column type="index" prop="index" label="序号" width="60">
- </el-table-column>
- <el-table-column prop="name" label="名称" width="160">
- </el-table-column>
- <el-table-column prop="SingleDosage" label="单次用量" width="120">
- </el-table-column>
- <el-table-column prop="use" label="用法" width="120"> </el-table-column>
- <el-table-column prop="frequency" label="频率" width="120">
- </el-table-column>
- <el-table-column prop="day" label="天数" width="120"> </el-table-column>
- <el-table-column prop="amount" label="总量" width="120">
- </el-table-column>
- <el-table-column prop="tips" label="备注" width="120">
- </el-table-column>
- </el-table>
- </div>
- </el-dialog>
- </template>
- <script>
- import Vue from "vue";
- import print from "print-js";
- import printutils from "./print.js";
-
- export default {
- data() {
- return {
- visibility: false,
- tableData: [{}],
- isClose:false,
- org_name:"",
- };
- },
- props: {
- propForm: {
- type: Object,
- },
- },
-
- methods: {
- // isClose() {
- // this.visibility = false;
- // },
-
- hide: function () {
- this.visibility = false;
- for (let i = 0; i < this.propForm.goods.length; i++) {
- for (let key in this.propForm.goods[i]) {
- if (key != "index") {
- this.propForm.goods[i][key].isSelected = false;
- }
- }
- }
- },
- show: function () {
- this.visibility = true;
- },
-
- comfirm: function (formName) {
- this.goodInfo = [];
- this.goodInfoTableData = [];
- this.$emit("dialog-comfirm", this.getValue());
- this.$refs.multipleTable.clearSelection();
- this.$refs.table.setCurrentRow(null);
- },
- getValue() {},
-
- // 打印
- print() {
- Vue.prototype.printJson = printutils.printJson;
- // const style =
- // '@media print {.list_title{ width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto}}';
- // printJS({
- // printable: "dialysis-print-box-1",
- // type: "html",
- // style: style,
- // scanStyles: false,
- // });
- this.printJson({
- title: `<div style="width:100%;text-align:center;font-size:16px;font-weight:bold;">${this.org_name}医院 发药单</div>
- <div style="width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;">
- <div style="width: 310px;padding: 10px 0;">患者名称:${1}</div>
- <div style="width: 310px;padding: 10px 0;">数据来源:${1}</div>
- <div style="width: 310px;padding: 10px 0;">发药状态:${1}</div>
- </div>`, // 打印出来的标题
- data: this.tableData, // 需要打印的数据
- serial: true, // 是否需要打印序列号
- fields: [
- // 需要打印的字段
-
- "name",
- "SingleDosage",
- "use",
- "frequency",
- "day",
- "amount",
- "from",
- "tips",
- ],
- properties: [
- // 需要打印的字段对应的表头名
-
- {
- field: "name",
- displayName: "姓名",
- },
- {
- field: "SingleDosage",
- displayName: "单词用量",
- },
- {
- field: "use",
- displayName: "用法",
- },
- {
- field: "frequency",
- displayName: "频率",
- },
- {
- field: "day",
- displayName: "天数",
- },
- {
- field: "amount",
- displayName: "总量",
- },
- {
- field: "from",
- displayName: "数据来源",
- },
- {
- field: "tips",
- displayName: "备注",
- },
- ],
- });
- },
- },
- };
- </script>
-
- <style lang="scss" scoped>
- /deep/ .el-dialog{
- width: 60%;
- }
- .print_style {
- position: absolute;
- right: 65px;
- top: 50px;
- }
-
- .list_title {
- width: 940px;
- border-bottom: 1px solid;
- display: flex;
- margin: 30px auto;
-
- div {
- width: 230px;
- padding: 10px 0;
- }
- }
- </style>
|