see999 3 years ago
parent
commit
9b4f3e10e8

+ 24 - 25
src/xt_pages/dialysis/signPrint.vue View File

@@ -11,37 +11,29 @@
11 11
         <div class="app-container" style="background-color: white;" v-show="show">
12 12
             <div id="dialysisTable">
13 13
                 <div v-for="(item, index) in list" :key="index">
14
-                    <ul>
15
-                        <li>分区/床位号:{{item.device_number.zone.name}}/{{item.device_number.number}}</li>  
16
-                        <li>姓名:{{item.patient.name}}</li>  
17
-                        <li>医嘱内容:{{getAdvice(item.doctor_advice)}}</li>  
18
-                        <li>给药途径:
19
-                            {{item.doctor_advice[0].execution_frequency}}
20
-                        </li>  
21
-                        <li>执行频率:{{item.doctor_advice[0].delivery_way}}</li>  
22
-                        <li>打印时间:{{time}}</li>   
23
-                    </ul>  
14
+                    <div class="signPrint" v-for="it in item.doctor_advice" style="page-break-after: always;">
15
+                        <div>分区/床位号:{{item.device_number.zone.name}}/{{item.device_number.number}}</div>  
16
+                        <div>姓名:{{item.patient.name}}</div>  
17
+                        <div>医嘱内容:{{ it.advice_name }}</div>  
18
+                        <div>给药途径:{{it.execution_frequency}}</div>  
19
+                        <div>执行频率:{{it.delivery_way}}</div>  
20
+                        <div>打印时间:{{time}}</div>   
21
+                    </div>  
24 22
                 </div>
25 23
             </div>
26 24
         </div>
27 25
 
28 26
           <div class="app-container" style="background-color: white;" v-show="showOne">
29 27
             <div id="dialysisTable">
30
-                <div class="order_title_panl">
31
-                    <span class="main_title">透析医嘱</span>
32
-                </div>
33
-                <p style="width: 960px;text-align: right;margin: 0 auto 10px;">日期:{{ time }}</p>
34 28
                 <div v-for="(item, index) in list" :key="index">
35
-                    <ul>
36
-                        <li>分区/床位号:{{item.device_number.zone.name}}/{{item.device_number.number}}</li>  
37
-                        <li>姓名:{{item.patient.name}}</li>  
38
-                        <li>医嘱内容:{{getAdvice(item.doctor_advice)}}</li>  
39
-                        <li>给药途径:
40
-                            {{item.doctor_advice[0].execution_frequency}}
41
-                        </li>  
42
-                        <li>执行频率:{{item.doctor_advice[0].delivery_way}}</li>  
43
-                        <li>打印时间:{{time}}</li>   
44
-                    </ul>  
29
+                    <div class="signPrint" v-for="it in item.doctor_advice" style="page-break-after: always;">
30
+                        <div>分区/床位号:{{item.device_number.zone.name}}/{{item.device_number.number}}</div>  
31
+                        <div>姓名:{{item.patient.name}}</div>  
32
+                        <div>医嘱内容:{{getAdvice(item.doctor_advice)}}</div>  
33
+                        <div>给药途径:{{item.doctor_advice[0].execution_frequency}}</div>  
34
+                        <div>执行频率:{{item.doctor_advice[0].delivery_way}}</div>  
35
+                        <div>打印时间:{{time}}</div>   
36
+                    </div>  
45 37
                   
46 38
                 </div>
47 39
             </div>
@@ -418,7 +410,7 @@ export default {
418 410
                      this.list = schedules
419 411
                      this.scheduleMap = scheduleMap  
420 412
                  }
421
-
413
+                console.log("this.list",this.list)
422 414
                 
423 415
                 }
424 416
             })
@@ -652,6 +644,13 @@ export default {
652 644
 
653 645
 
654 646
 <style rel="stylesheet/scss" lang="scss" scoped>
647
+.signPrint{
648
+    -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 60px rgba(0, 0, 0, 0.06) inset;
649
+    -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
650
+    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
651
+    margin-bottom: 20px;
652
+    padding: 20px 10px;
653
+}
655 654
 .dialysisTable{
656 655
     width:960px;
657 656
     margin: 0 auto;

+ 10 - 5
src/xt_pages/outpatientCharges/invoicePrint.vue View File

@@ -13,7 +13,8 @@
13 13
     </template>
14 14
     <div class="app-container" style="padding-top:40px;">
15 15
         <div class='dialysisPage'>
16
-            <printOne :paramsObj="invoiceParams"></printOne>
16
+            <printOne v-if="org_id != 10106" :paramsObj="invoiceParams"></printOne>
17
+            <printTwo v-if="org_id == 10106" :paramsObj="invoiceParams"></printTwo>
17 18
         </div>
18 19
     </div>
19 20
   </div>
@@ -21,10 +22,12 @@
21 22
 
22 23
 <script>
23 24
 import printOne from './invoiceTemplate/printOne'
25
+import printTwo from './invoiceTemplate/printTwo'
24 26
 export default {
25 27
   name: "invoicePrint",
26 28
   components: {
27
-    printOne
29
+    printOne,
30
+    printTwo
28 31
   },
29 32
   props:{
30 33
     invoiceParams:Object
@@ -32,7 +35,8 @@ export default {
32 35
   data() {
33 36
     return {
34 37
       childResponse: {},
35
-    //   invoiceParams:{}
38
+    //   invoiceParams:{},
39
+     org_id:''
36 40
       
37 41
 
38 42
     };
@@ -61,8 +65,7 @@ export default {
61 65
       return "";
62 66
     },
63 67
     printThisPage() {
64
-
65
-      const style =
68
+        const style =
66 69
         '@media print {#invoice-print{font-size:12px;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;}.infoMain{display: flex;flex-wrap: wrap;padding:0 10px;margin-top:10px;}.infoMain .infoP{width: 33%;}.chargeBox{border: 1px solid #000;}.chargeUl{display:flex;justify-content: space-between;text-align: center;}.chargeUl p{line-height: 1px;}.chargeP{line-height: 1px;padding-bottom:16px;}.moneyBox{display: flex;justify-content: space-between;padding: 0 10px;background: #eeeeee;-webkit-print-color-adjust:exact;-moz-print-color-adjust:exact;-ms-print-color-adjust:exact;print-color-adjust:exact;height: 40px;align-items: center;border:1px solid #000; border-top:none}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar div{width:150px;}}';
67 70
         printJS({
68 71
             printable: "invoice-print",
@@ -70,6 +73,7 @@ export default {
70 73
             style: style,
71 74
             scanStyles: false
72 75
         });
76
+      
73 77
 
74 78
       // if (this.org_template_info.template_id == 1) {
75 79
       //   printJS({
@@ -83,6 +87,7 @@ export default {
83 87
   },
84 88
   created() {
85 89
       console.log('this.invoiceParams',this.invoiceParams)
90
+      this.org_id = this.$store.getters.xt_user.org_id
86 91
   },
87 92
   watch:{
88 93
     paramsObj:{//深度监听,可监听到对象、数组的变化

+ 221 - 0
src/xt_pages/outpatientCharges/invoiceTemplate/printTwo.vue View File

@@ -0,0 +1,221 @@
1
+<template>
2
+    <div id='invoice-print'>
3
+        <div style="display:flex;">
4
+            <div style="position: absolute;top:30px;left:70px;">{{ list.order_number }}</div>
5
+            <!-- <div>{{ list.id_card_no }}</div> -->
6
+        </div>
7
+        <div style="display:flex;justify-content: space-between;">
8
+            <!-- <div>{{ list.department_name }}</div> -->
9
+            <div  style="position: absolute;top:40px;left:300px">{{ list.number }}</div>
10
+            <div></div>
11
+            <div  style="position: absolute;left:610px;top:40px;">
12
+                <span>{{ printDate.slice(0,4) }}</span>
13
+                <span>{{ printDate.slice(5,7) }}</span>
14
+                <span>{{ printDate.slice(8,11) }}</span>
15
+            </div>
16
+        </div>
17
+        <div style="display:flex;justify-content: space-between;">
18
+            <div style="position: absolute;top:60px;left:120px;"> {{ paramsObj.name }}</div>
19
+            <div style="position: absolute;top:60px;left:210px;">√</div>
20
+            <!-- <div>{{ list.pay_way }}</div> -->
21
+            <!-- <div style="position: absolute;top:70px;left:460px;">{{ paramsObj.setl_time.split(' ')[0] }}</div>
22
+            <div style="position: absolute;top:70px;left:560px;">{{ paramsObj.setl_time.split(' ')[0] }}</div> -->
23
+        </div>
24
+        <div style="display:flex;justify-content: space-between;">
25
+            <!-- <div>{{ paramsObj.gend == 1 ? '男' : '女' }}</div> -->
26
+            <div style="position: absolute;top:90px;left:290px;">{{ totalPrice - list.psn_cash_money }}</div>
27
+            <div style="position: absolute;top:90px;left:460px;">{{ list.psn_cash_money }}</div>
28
+            <div style="position: absolute;top:90px;left:640px;">门慢结算</div>
29
+        </div>
30
+        <div style="display:flex;justify-content: space-between;">
31
+            <div style="position: absolute;top:140px;left:40px">西药</div>
32
+            <div style="position: absolute;top:140px;left:110px">{{ list.westernMedicineCostTotal }}</div>
33
+            <div style="position: absolute;top:140px;left:200px">检查费</div>
34
+            <div style="position: absolute;top:140px;left:280px">{{ list.checkCostTotal }}</div>
35
+            <div style="position: absolute;top:140px;left:380px">治疗费</div>
36
+            <div style="position: absolute;top:140px;left:460px">{{ list.treatCostTotal }}</div>
37
+            <div style="position: absolute;top:140px;left:560px">床位费</div>
38
+            <div style="position: absolute;top:140px;left:640px">{{ list.bedCostTotal }}</div>
39
+        </div>
40
+        <div style="display:flex;justify-content: space-between;">
41
+            <div style="position: absolute;top:170px;left:40px">中成药</div>
42
+            <div style="position: absolute;top:170px;left:110px">{{ list.chineseTraditionalMedicineCostTotal }}</div>
43
+            <div style="position: absolute;top:170px;left:200px">化验费</div>
44
+            <div style="position: absolute;top:170px;left:280px">{{ list.laboratoryCostTotal }}</div>
45
+            <div style="position: absolute;top:170px;left:380px">手术费</div>
46
+            <div style="position: absolute;top:170px;left:460px">{{ list.operationCostTotal }}</div>
47
+            <div style="position: absolute;top:170px;left:560px">其他费</div>
48
+            <div style="position: absolute;top:170px;left:640px">{{ list.otherCostTotal }}</div>
49
+        </div>
50
+        <div style="display:flex;justify-content: space-between;">
51
+            <div style="position: absolute;top:200px;left:40px"></div>
52
+            <div style="position: absolute;top:200px;left:110px"></div>
53
+            <div style="position: absolute;top:200px;left:200px"></div>
54
+            <div style="position: absolute;top:200px;left:280px"></div>
55
+            <div style="position: absolute;top:200px;left:380px">材料费</div>
56
+            <div style="position: absolute;top:200px;left:460px">{{ list.materialCostTotal }}</div>
57
+            <div style="position: absolute;top:200px;left:560px"></div>
58
+            <div style="position: absolute;top:200px;left:640px"></div>
59
+        </div>
60
+        <div>
61
+            <span>
62
+            <span style="position: absolute;top:250px;left:200px">
63
+                <span v-if="zhongwen.indexOf('万') > -1">
64
+                    {{ zhongwen.substring(zhongwen.indexOf('万') - 1,zhongwen.indexOf('万')) }}
65
+                </span>
66
+                <span v-else>零</span>
67
+            </span>
68
+            <span style="position: absolute;top:250px;left:260px">
69
+                <span v-if="zhongwen.indexOf('仟') > -1">
70
+                    {{ zhongwen.substring(zhongwen.indexOf('仟') - 1,zhongwen.indexOf('仟')) }}
71
+                </span>
72
+                <span v-else>零</span>
73
+            </span>
74
+            <span style="position: absolute;top:250px;left:320px">
75
+                <span v-if="zhongwen.indexOf('佰') > -1">
76
+                    {{ zhongwen.substring(zhongwen.indexOf('佰') - 1,zhongwen.indexOf('佰')) }}
77
+                </span>
78
+                <span v-else>零</span>
79
+            </span>
80
+            <span style="position: absolute;top:250px;left:380px">
81
+                <span v-if="zhongwen.indexOf('拾') > -1">
82
+                    {{ zhongwen.substring(zhongwen.indexOf('拾') - 1,zhongwen.indexOf('拾')) }}
83
+                </span>
84
+                <span v-else>零</span>
85
+            </span>
86
+            <span style="position: absolute;top:250px;left:440px">
87
+                <span v-if="zhongwen.indexOf('元') > -1 && zhongwen.substring(zhongwen.indexOf('元') - 1,zhongwen.indexOf('元')) != '拾'">
88
+                    {{ zhongwen.substring(zhongwen.indexOf('元') - 1,zhongwen.indexOf('元')) }}
89
+                </span>
90
+                <span v-else>零</span>
91
+            </span>
92
+            <span style="position: absolute;top:250px;left:500px">
93
+                <span v-if="zhongwen.indexOf('角') > -1">
94
+                    {{ zhongwen.substring(zhongwen.indexOf('角') - 1,zhongwen.indexOf('角')) }}
95
+                </span>
96
+                <span v-else>零</span>
97
+            </span>
98
+            <span style="position: absolute;top:250px;left:560px">
99
+                <span v-if="zhongwen.indexOf('分') > -1">
100
+                    {{ zhongwen.substring(zhongwen.indexOf('分') - 1,zhongwen.indexOf('分')) }}
101
+                </span>
102
+                <span v-else>零</span>
103
+            </span>
104
+            </span>
105
+            <span style="position: absolute;top:250px;left:610px">{{ totalPrice }}</span>
106
+        </div>
107
+        <div style="position: absolute;top:280px;left:460px">现金:{{ list.psn_cash_money }}</div>
108
+        <div>
109
+            <div style="position: absolute;top:320px;left:120px">{{ org_name }}</div>
110
+            <div v-if="org_id == 10106" style="position: absolute;top:320px;left:460px">林美华</div>
111
+        </div>
112
+    </div>
113
+</template>
114
+
115
+
116
+<script>
117
+import { getInvoice } from '@/api/project/project'
118
+export default {
119
+    props:{
120
+        paramsObj:Object
121
+    },
122
+    data(){
123
+        return{
124
+            list:{},
125
+            printDate:'',
126
+            zhongwen:'',
127
+            totalPrice:0.0,
128
+            org_id:'',
129
+            org_name:''
130
+        }
131
+    },
132
+    created(){
133
+        console.log('paramsObj',this.paramsObj)
134
+        let params = {
135
+            order_id: this.paramsObj.order_id,
136
+            patient_id: this.paramsObj.patient_id,
137
+        }
138
+        this.getInvoice(params)
139
+        // var data = new Date();
140
+        // var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
141
+        // var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
142
+        // this.printDate = data.getFullYear() + "-" + month + "-" + date;
143
+        // this.smalltoBIG(982732.21)
144
+        this.org_id = this.$store.getters.xt_user.org_id
145
+        this.org_name = this.$store.getters.xt_user.org.org_name
146
+    },
147
+    methods:{
148
+        getInvoice(params){
149
+            getInvoice(params).then((res) => {
150
+                console.log('res',res)
151
+                this.list = res.data.data
152
+                this.totalPrice = this.list.westernMedicineCostTotal + this.list.checkCostTotal + this.list.treatCostTotal + this.list.bedCostTotal + this.list.chineseTraditionalMedicineCostTotal +
153
+                                    this.list.laboratoryCostTotal + this.list.operationCostTotal + this.list.otherCostTotal + this.list.materialCostTotal
154
+                this.smalltoBIG(this.totalPrice)
155
+                var data = new Date(res.data.data.date * 1000);
156
+                var month =data.getMonth() < 9 ? "0" + (data.getMonth() + 1) : data.getMonth() + 1;
157
+                var date = data.getDate() <= 9 ? "0" + data.getDate() : data.getDate();
158
+                this.printDate = data.getFullYear() + "-" + month + "-" + date;
159
+            })
160
+        },
161
+        smalltoBIG(n) {
162
+            // let fraction = ['角', '分'];
163
+            // let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
164
+            // let unit = [['元.', '万,', '亿,'], ["元",'拾', '佰', '仟']];
165
+            // let head = price < 0 ? '欠' : '';
166
+            // price = Math.abs(price);
167
+            // let upper = '';
168
+            // for (let i = 0; i < fraction.length; i++) {
169
+            // upper += (digit[Math.floor(price * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
170
+            // }
171
+            // upper = upper || '整';
172
+            // price = Math.floor(price);
173
+            // for (let i = 0; i < unit[0].length && price > 0; i++) {
174
+            // let p = '';
175
+            // for (let j = 0; j < unit[1].length && price > 0; j++) {
176
+            //     p = digit[price % 10] + unit[1][j] + p;
177
+            //     price = Math.floor(price / 10);
178
+            // }
179
+            // upper = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + upper;
180
+            // }
181
+            // this.zhongwen = head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整')
182
+            // console.log('6666',head + upper.replace(/(零.)*零圆/, '圆').replace(/(零.)+/g, '零').replace(/^整$/, '零圆整'))
183
+            if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)){
184
+                return "数据非法";  //判断数据是否大于0
185
+            }
186
+
187
+            var unit = "仟佰拾亿仟佰拾万仟佰拾元角分", str = "";
188
+            n += "00";  
189
+
190
+            var indexpoint = n.indexOf('.');  // 如果是小数,截取小数点前面的位数
191
+
192
+            if (indexpoint >= 0){
193
+
194
+                n = n.substring(0, indexpoint) + n.substr(indexpoint+1, 2);   // 若为小数,截取需要使用的unit单位
195
+            }
196
+
197
+            unit = unit.substr(unit.length - n.length);  // 若为整数,截取需要使用的unit单位
198
+            for (var i=0; i < n.length; i++){
199
+                str += "零壹贰叁肆伍陆柒捌玖".charAt(n.charAt(i)) + unit.charAt(i);  //遍历转化为大写的数字
200
+            }
201
+
202
+            this.zhongwen =  str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
203
+            console.log(this.zhongwen)
204
+        },
205
+
206
+    },
207
+    watch:{
208
+        paramsObj:{//深度监听,可监听到对象、数组的变化
209
+            handler(val, oldVal){
210
+                let params = {
211
+                    order_id: val.order_id,
212
+                    patient_id: val.patient_id,
213
+                }
214
+                this.getInvoice(params)
215
+
216
+            },
217
+            deep:true
218
+        }
219
+    }
220
+}
221
+</script>

+ 2 - 2
src/xt_pages/stock/drugs/drugStockOutOrderDetailPrint.vue View File

@@ -9,7 +9,7 @@
9 9
       <div id="dialysis-print-box">
10 10
         <div class="dialysis-print-order">
11 11
          <div class="order-yy-name" style="font-weight:bold;">{{orgName}}</div>
12
-          <div class="order-title" style="font-weight:none;">药品出库登记表</div>
12
+          <div class="order-title" style="font-weight:normal;">药品出库登记表</div>
13 13
 
14 14
           <div style="float: right;margin-bottom: 1px;">{{getDateTwo()}}</div>
15 15
 
@@ -22,7 +22,7 @@
22 22
               <td style="line-height: 50px" width="80">出货数量</td>
23 23
               <td style="line-height:50px" width="80">出库价格</td>
24 24
               <td style="line-height: 50px" width="">总价</td>
25
-              <td style="line-height: 50px" width="">批</td>
25
+              <td style="line-height: 50px" width="">批</td>
26 26
               <td style="line-height: 50px" width="">生产日期</td>
27 27
               <td style="line-height: 50px" width="">有效日期</td>
28 28
             </tr>

+ 11 - 2
src/xt_pages/workforce/appointment.vue View File

@@ -68,6 +68,7 @@
68 68
     <div class="position">
69 69
       <bread-crumb :crumbs="crumbs"></bread-crumb>
70 70
         <div style="display:flex;align-items:center">
71
+          <el-button @click="printTable">打印表格</el-button>
71 72
           <schedule-upload-excel style="margin-right:10px;" :on-success='handleSuccess' ></schedule-upload-excel>
72 73
           <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
73 74
             导出模版
@@ -121,7 +122,7 @@
121 122
       <!-- </el-col>
122 123
     </el-row> -->
123 124
 
124
-      <table-data :week-time="activeName" :partitions-prop="partitions" :schedule-zone-row-prop="scheduleZoneRow"
125
+      <table-data ref="tableData" :week-time="activeName" :partitions-prop="partitions" :schedule-zone-row-prop="scheduleZoneRow"
125 126
                   :schedule-zone-prop="scheduleZone" title="" @event1="changePartition" @event2="changeSchedule"></table-data>
126 127
 
127 128
 
@@ -226,7 +227,15 @@
226 227
       UploadExcel
227 228
     },
228 229
     methods: {
229
-
230
+      printTable(){
231
+        this.$nextTick(() => {
232
+          if(this.activeName == 'thisWeek'){
233
+            this.$refs.tableData.printHTML('#newTable')
234
+          }
235
+          
236
+        })
237
+        
238
+      },
230 239
       generateTxt: function(log) {
231 240
         var content = ''
232 241
         var errlog = log.err_logs

+ 126 - 1
src/xt_pages/workforce/components/tableData.vue View File

@@ -129,7 +129,7 @@
129 129
       :height="tableContainHeight"
130 130
       ref="table"
131 131
       style="width: 100%;cursor: pointer;"
132
-      
132
+      id="newTable"
133 133
     >
134 134
       <el-table-column
135 135
         prop="area"
@@ -617,6 +617,7 @@
617 617
 
618 618
 <script>
619 619
 import { uParseTime } from "@/utils/tools";
620
+import print from 'print-js'
620 621
 
621 622
 import {
622 623
   CancelSchedule,
@@ -2012,6 +2013,130 @@ export default {
2012 2013
      this.$emit('event2', val)
2013 2014
      this.schedule_type = val
2014 2015
      this.getSchedules()
2016
+    },
2017
+    printHTML(id) {
2018
+      // let printStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>";
2019
+      //       // 定义element-ui table组件的样式
2020
+      //       const tabStyle = `<style>
2021
+      //           table{width:100%;display:table-cell!important;box-sizing:border-box;}
2022
+      //           .el-table__header,.el-table__body,.el-table__footer{width:100%!important;border-collapse: collapse;text-align:center;}
2023
+      //           table,table tr th, table tr td { border:1px solid #ddd;color:#606266;word-wrap:break-word}
2024
+      //           table tr th,table tr td{padding:4mm 0mm;word-wrap:break-word }
2025
+      //           .el-table__body, tr td .cell{width:100%!important}
2026
+      //           .el-table th.gutter{display: none;}
2027
+      //           .el-table colgroup.gutter{display: none;}
2028
+      //           </style><body>`;
2029
+      //       let content = "";
2030
+      //       // 获取名为传入id的 dom元素内的内容
2031
+      //       let str = document.getElementById(id).innerHTML;
2032
+      //       // 拼接空页面+style样式+dom内容
2033
+      //       content = content + str;
2034
+      //       printStr = printStr + tabStyle + content + "</body></html>";
2035
+      //       // 打开新页面
2036
+      //       let pwin = window.open("_blank");
2037
+      //       // 将内容赋值到新页面
2038
+      //       pwin.document.write(printStr);
2039
+      //       pwin.document.close();
2040
+      //       // 聚焦-不加focuse,在某些情况下,打印页面会有问题。
2041
+      //       pwin.focus();
2042
+      //       // 使用setTimeout,等页面dom元素渲染完成后再打印。
2043
+      //       setTimeout(() => {
2044
+      //           pwin.print(); // 打印功能。 例如 window.print() 直接打印当前整个页面。 
2045
+      //           pwin.close(); // 关闭 打印创建的当前页面
2046
+      //       }, 500);
2047
+    //   const html = document.querySelector(id).innerHTML
2048
+    // // 新建一个 DOM
2049
+    // const div = document.createElement('div')
2050
+    // const printDOMID = 'printDOMElement'
2051
+    // div.id = printDOMID
2052
+    // div.innerHTML = html
2053
+
2054
+    // // 提取第一个表格的内容 即表头
2055
+    // const ths = div.querySelectorAll('.el-table__header-wrapper th')
2056
+    // const ThsTextArry = []
2057
+    // for (let i = 0, len = ths.length; i < len; i++) {
2058
+    //     if (ths[i].innerText !== '') ThsTextArry.push(ths[i].innerText)
2059
+    // }
2060
+
2061
+    // // 删除多余的表头
2062
+    // div.querySelector('.hidden-columns').remove()
2063
+    // // 第一个表格的内容提取出来后已经没用了 删掉
2064
+    // div.querySelector('.el-table__header-wrapper').remove()
2065
+
2066
+    // // 将第一个表格的内容插入到第二个表格
2067
+    // let newHTML = '<tr>'
2068
+    // for (let i = 0, len = ThsTextArry.length; i < len; i++) {
2069
+    //     newHTML += '<td style="text-align: center; font-weight: bold">' + ThsTextArry[i] + '</td>'
2070
+    // }
2071
+
2072
+    // newHTML += '</tr>'
2073
+    // div.querySelector('.el-table__body-wrapper table').insertAdjacentHTML('afterbegin', newHTML)
2074
+    // // 将新的 DIV 添加到页面 打印后再删掉
2075
+    // document.querySelector('body').appendChild(div);
2076
+
2077
+
2078
+let printStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>";
2079
+            // 定义element-ui table组件的样式
2080
+            const tabStyle = `<style>
2081
+                table{width:100%;display:table-cell!important;box-sizing:border-box;}
2082
+                .el-table__header,.el-table__body,.el-table__footer{width:100%!important;border-collapse: collapse;text-align:center;}
2083
+                table,table tr th, table tr td { border:1px solid #ddd;color:#606266;word-wrap:break-word}
2084
+                table tr th,table tr td{padding:4mm 0mm;word-wrap:break-word }
2085
+                .el-table__body, tr td .cell{width:100%!important}
2086
+                .el-table th.gutter{display: none;}
2087
+                .el-table colgroup.gutter{display: none;}
2088
+                </style><body>`;
2089
+    let content = "";
2090
+            // 获取名为传入id的 dom元素内的内容
2091
+            let newId = document.querySelector(id)
2092
+            // if(document.querySelector('.el-table__fixed') && document.querySelector('.el-table__fixed-right') && document.querySelector('.el-table__fixed-right-patch')){
2093
+            //   document.querySelector('.el-table__fixed').parentNode.removeChild(document.querySelector('.el-table__fixed'))
2094
+            //   document.querySelector('.el-table__fixed-right').parentNode.removeChild(document.querySelector('.el-table__fixed-right'))
2095
+            //   document.querySelector('.el-table__fixed-right-patch').parentNode.removeChild(document.querySelector('.el-table__fixed-right-patch'))
2096
+            // }
2097
+            
2098
+            let str = document.querySelector(id).innerHTML;
2099
+            // var reg = new RegExp(document.querySelector('.el-table__fixed').innerHTML,"g");
2100
+            var a = str.replace(document.querySelector('.el-table__fixed').innerHTML,"")
2101
+            // var reg1 = new RegExp(document.querySelector('.el-table__fixed-right').innerHTML,"g");
2102
+            var b = a.replace(document.querySelector('.el-table__fixed-right').innerHTML,"")
2103
+            // var reg2 = new RegExp(document.querySelector('.el-table__fixed-right-patch').innerHTML,"g");
2104
+            var c = b.replace(document.querySelector('.el-table__fixed-right-patch').innerHTML,"")
2105
+            // 拼接空页面+style样式+dom内容
2106
+            content = content + c;
2107
+            printStr = printStr  + content + "</body></html>";
2108
+            console.log('printStr',document.querySelector(id))
2109
+            
2110
+            // document.querySelector('.el-table__fixed').remove()
2111
+            // document.querySelector('.el-table__fixed-right').remove()
2112
+            // document.querySelector('.el-table__fixed-right-patch').remove()
2113
+            // 打开新页面
2114
+            let pwin = window.open("_blank");
2115
+            // 将内容赋值到新页面
2116
+            pwin.document.write(printStr);
2117
+            pwin.document.close();
2118
+            // 聚焦-不加focuse,在某些情况下,打印页面会有问题。
2119
+            pwin.focus();
2120
+
2121
+            
2122
+            // 使用setTimeout,等页面dom元素渲染完成后再打印。
2123
+            // setTimeout(() => {
2124
+              this.$nextTick(() => {
2125
+                pwin.print(); // 打印功能。 例如 window.print() 直接打印当前整个页面。 
2126
+                // pwin.close(); // 关闭 打印创建的当前页面
2127
+              })
2128
+                
2129
+            // }, 500);
2130
+    // console.log('document.querySelector',document.querySelector('#printDOMElement'))
2131
+    //   printJS({
2132
+    //   printable: printDOMID,
2133
+    //   type: 'html',
2134
+    //   scanStyles: false,
2135
+    //   style: 'table { border-collapse: collapse }' // 表格样式
2136
+    // })
2137
+
2138
+    // div.remove()
2139
+ 
2015 2140
     }
2016 2141
   },
2017 2142
   components: {

+ 1 - 1
src/xt_pages/workforce/remind_print.vue View File

@@ -149,7 +149,7 @@
149 149
               list[i].sort = list[i].number.sort
150 150
            }
151 151
            var arr = list.sort(this.compare('sort'))
152
-             console.log("list2222999999999",list)
152
+             console.log("888888",list)
153 153
              this.scheduleData = arr
154 154
              let a = response.data.data.day
155 155
               console.log("a",a)