123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <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>患者名称:{{name}}</div>
- <div>发药状态:{{state}}</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">
- <template slot-scope="scope" >
- <span>{{scope.row.Name ? scope.row.Name : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="SingleDosage" label="单次用量" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.SingleDosage ? scope.row.SingleDosage : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="use" label="用法" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.Usage ? scope.row.Usage : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="frequency" label="频率" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.Frequency ? scope.row.Frequency : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="day" label="天数" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.Days ? scope.row.Days : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="amount" label="总量" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.Total ? scope.row.Total : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="tips" label="数据来源" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.DataSources ? scope.row.DataSources : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="tips" label="备注" width="120">
- <template slot-scope="scope" >
- <span>{{scope.row.Remarks ? scope.row.Remarks : ""}}</span>
- </template>
- </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,
- name:"",
- state:null,
- };
- },
- 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 (val,data,state) {
- this.visibility = true;
- console.log("val",val)
- this.tableData = val
- this.name = data.Name
- if (state == 1){
- this.state = "待发药"
- }
- if (state == 2){
- this.state = "已发药"
- }
-
- },
-
- 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: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;">
- <div style="width: 230px;padding: 10px 0;">患者名称:${this.name}</div>
- <div style="width: 230px;padding: 10px 0;">发药状态:${this.state}</div>
- </div>`, // 打印出来的标题
- data: this.tableData, // 需要打印的数据
- serial: true, // 是否需要打印序列号
- fields: [
- // 需要打印的字段
-
- "Name",
- "SingleDosage",
- "Usage",
- "Frequency",
- "Days",
- "Total",
- "DataSources",
- "Remarks",
- ],
- properties: [
- // 需要打印的字段对应的表头名
-
- {
- field: "Name",
- displayName: "姓名",
- },
- {
- field: "SingleDosage",
- displayName: "单次用量",
- },
- {
- field: "Usage",
- displayName: "用法",
- },
- {
- field: "Frequency",
- displayName: "频率",
- },
- {
- field: "Days",
- displayName: "天数",
- },
- {
- field: "Total",
- displayName: "总量",
- },
- {
- field: "DataSources",
- displayName: "数据来源",
- },
- {
- field: "Remarks",
- displayName: "备注",
- },
- ],
- });
- },
- },
- };
- </script>
-
- <style lang="scss" scoped>
- .print_style {
- position: absolute;
- right: 10px;
- top: 42px;
- }
-
- .list_title {
- width: 940px;
- border-bottom: 1px solid;
- display: flex;
- margin: 30px auto;
-
- div {
- width: 230px;
- padding: 10px 0;
- }
- }
- </style>
|