Browse Source

Merge branch '20201109_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201109_pc_vue_new_branch

XMLWAN 3 years ago
parent
commit
46a51684e2

+ 11 - 0
src/router/modules/workforce.js View File

@@ -93,5 +93,16 @@ export default {
93 93
         noCache: true
94 94
       }
95 95
     },
96
+    {
97
+      path: '/scheduleTablePrint',
98
+      component: () => import('@/xt_pages/workforce/scheduleTablePrint'),
99
+      name: 'scheduleTablePrint',
100
+      hidden: true,
101
+      is_menu: false,
102
+      meta: {
103
+        title: 'scheduleTablePrint',
104
+        noCache: true
105
+      }
106
+    },
96 107
   ]
97 108
 }

+ 1 - 7
src/xt_pages/workforce/appointment.vue View File

@@ -228,13 +228,7 @@
228 228
     },
229 229
     methods: {
230 230
       printTable(){
231
-        this.$nextTick(() => {
232
-          if(this.activeName == 'thisWeek'){
233
-            this.$refs.tableData.printHTML('#newTable')
234
-          }
235
-          
236
-        })
237
-        
231
+        this.$router.push({path: '/scheduleTablePrint'})
238 232
       },
239 233
       generateTxt: function(log) {
240 234
         var content = ''

+ 3 - 125
src/xt_pages/workforce/components/tableData.vue View File

@@ -129,7 +129,6 @@
129 129
       :height="tableContainHeight"
130 130
       ref="table"
131 131
       style="width: 100%;cursor: pointer;"
132
-      id="newTable"
133 132
     >
134 133
       <el-table-column
135 134
         prop="area"
@@ -1120,6 +1119,7 @@ export default {
1120 1119
           
1121 1120
         
1122 1121
           var that = this;
1122
+          console.log('that.scheduleZonethat.scheduleZone',that.scheduleZone)
1123 1123
           this.scheduleZone.forEach(function(zone, index) {
1124 1124
            
1125 1125
             that.scheduleZone[index].Mon_M = {
@@ -1277,12 +1277,14 @@ export default {
1277 1277
                           : that.modeOptions[schedule.mode_id].name
1278 1278
                     };
1279 1279
                     that.scheduleZone[index].total += 1;
1280
+                    
1280 1281
                   }
1281 1282
                 }
1282 1283
               });
1283 1284
             }
1284 1285
 
1285 1286
           });
1287
+          
1286 1288
         } else {
1287 1289
           this.$message.error("网络错误");
1288 1290
           return false;
@@ -2207,130 +2209,6 @@ export default {
2207 2209
      this.schedule_type = val
2208 2210
      this.getSchedules()
2209 2211
     },
2210
-    printHTML(id) {
2211
-      // let printStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>";
2212
-      //       // 定义element-ui table组件的样式
2213
-      //       const tabStyle = `<style>
2214
-      //           table{width:100%;display:table-cell!important;box-sizing:border-box;}
2215
-      //           .el-table__header,.el-table__body,.el-table__footer{width:100%!important;border-collapse: collapse;text-align:center;}
2216
-      //           table,table tr th, table tr td { border:1px solid #ddd;color:#606266;word-wrap:break-word}
2217
-      //           table tr th,table tr td{padding:4mm 0mm;word-wrap:break-word }
2218
-      //           .el-table__body, tr td .cell{width:100%!important}
2219
-      //           .el-table th.gutter{display: none;}
2220
-      //           .el-table colgroup.gutter{display: none;}
2221
-      //           </style><body>`;
2222
-      //       let content = "";
2223
-      //       // 获取名为传入id的 dom元素内的内容
2224
-      //       let str = document.getElementById(id).innerHTML;
2225
-      //       // 拼接空页面+style样式+dom内容
2226
-      //       content = content + str;
2227
-      //       printStr = printStr + tabStyle + content + "</body></html>";
2228
-      //       // 打开新页面
2229
-      //       let pwin = window.open("_blank");
2230
-      //       // 将内容赋值到新页面
2231
-      //       pwin.document.write(printStr);
2232
-      //       pwin.document.close();
2233
-      //       // 聚焦-不加focuse,在某些情况下,打印页面会有问题。
2234
-      //       pwin.focus();
2235
-      //       // 使用setTimeout,等页面dom元素渲染完成后再打印。
2236
-      //       setTimeout(() => {
2237
-      //           pwin.print(); // 打印功能。 例如 window.print() 直接打印当前整个页面。 
2238
-      //           pwin.close(); // 关闭 打印创建的当前页面
2239
-      //       }, 500);
2240
-    //   const html = document.querySelector(id).innerHTML
2241
-    // // 新建一个 DOM
2242
-    // const div = document.createElement('div')
2243
-    // const printDOMID = 'printDOMElement'
2244
-    // div.id = printDOMID
2245
-    // div.innerHTML = html
2246
-
2247
-    // // 提取第一个表格的内容 即表头
2248
-    // const ths = div.querySelectorAll('.el-table__header-wrapper th')
2249
-    // const ThsTextArry = []
2250
-    // for (let i = 0, len = ths.length; i < len; i++) {
2251
-    //     if (ths[i].innerText !== '') ThsTextArry.push(ths[i].innerText)
2252
-    // }
2253
-
2254
-    // // 删除多余的表头
2255
-    // div.querySelector('.hidden-columns').remove()
2256
-    // // 第一个表格的内容提取出来后已经没用了 删掉
2257
-    // div.querySelector('.el-table__header-wrapper').remove()
2258
-
2259
-    // // 将第一个表格的内容插入到第二个表格
2260
-    // let newHTML = '<tr>'
2261
-    // for (let i = 0, len = ThsTextArry.length; i < len; i++) {
2262
-    //     newHTML += '<td style="text-align: center; font-weight: bold">' + ThsTextArry[i] + '</td>'
2263
-    // }
2264
-
2265
-    // newHTML += '</tr>'
2266
-    // div.querySelector('.el-table__body-wrapper table').insertAdjacentHTML('afterbegin', newHTML)
2267
-    // // 将新的 DIV 添加到页面 打印后再删掉
2268
-    // document.querySelector('body').appendChild(div);
2269
-
2270
-
2271
-let printStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>";
2272
-            // 定义element-ui table组件的样式
2273
-            const tabStyle = `<style>
2274
-                table{width:100%;display:table-cell!important;box-sizing:border-box;}
2275
-                .el-table__header,.el-table__body,.el-table__footer{width:100%!important;border-collapse: collapse;text-align:center;}
2276
-                table,table tr th, table tr td { border:1px solid #ddd;color:#606266;word-wrap:break-word}
2277
-                table tr th,table tr td{padding:4mm 0mm;word-wrap:break-word }
2278
-                .el-table__body, tr td .cell{width:100%!important}
2279
-                .el-table th.gutter{display: none;}
2280
-                .el-table colgroup.gutter{display: none;}
2281
-                </style><body>`;
2282
-    let content = "";
2283
-            // 获取名为传入id的 dom元素内的内容
2284
-            let newId = document.querySelector(id)
2285
-            // if(document.querySelector('.el-table__fixed') && document.querySelector('.el-table__fixed-right') && document.querySelector('.el-table__fixed-right-patch')){
2286
-            //   document.querySelector('.el-table__fixed').parentNode.removeChild(document.querySelector('.el-table__fixed'))
2287
-            //   document.querySelector('.el-table__fixed-right').parentNode.removeChild(document.querySelector('.el-table__fixed-right'))
2288
-            //   document.querySelector('.el-table__fixed-right-patch').parentNode.removeChild(document.querySelector('.el-table__fixed-right-patch'))
2289
-            // }
2290
-            
2291
-            let str = document.querySelector(id).innerHTML;
2292
-            // var reg = new RegExp(document.querySelector('.el-table__fixed').innerHTML,"g");
2293
-            var a = str.replace(document.querySelector('.el-table__fixed').innerHTML,"")
2294
-            // var reg1 = new RegExp(document.querySelector('.el-table__fixed-right').innerHTML,"g");
2295
-            var b = a.replace(document.querySelector('.el-table__fixed-right').innerHTML,"")
2296
-            // var reg2 = new RegExp(document.querySelector('.el-table__fixed-right-patch').innerHTML,"g");
2297
-            var c = b.replace(document.querySelector('.el-table__fixed-right-patch').innerHTML,"")
2298
-            // 拼接空页面+style样式+dom内容
2299
-            content = content + c;
2300
-            printStr = printStr  + content + "</body></html>";
2301
-            console.log('printStr',document.querySelector(id))
2302
-            
2303
-            // document.querySelector('.el-table__fixed').remove()
2304
-            // document.querySelector('.el-table__fixed-right').remove()
2305
-            // document.querySelector('.el-table__fixed-right-patch').remove()
2306
-            // 打开新页面
2307
-            let pwin = window.open("_blank");
2308
-            // 将内容赋值到新页面
2309
-            pwin.document.write(printStr);
2310
-            pwin.document.close();
2311
-            // 聚焦-不加focuse,在某些情况下,打印页面会有问题。
2312
-            pwin.focus();
2313
-
2314
-            
2315
-            // 使用setTimeout,等页面dom元素渲染完成后再打印。
2316
-            // setTimeout(() => {
2317
-              this.$nextTick(() => {
2318
-                pwin.print(); // 打印功能。 例如 window.print() 直接打印当前整个页面。 
2319
-                // pwin.close(); // 关闭 打印创建的当前页面
2320
-              })
2321
-                
2322
-            // }, 500);
2323
-    // console.log('document.querySelector',document.querySelector('#printDOMElement'))
2324
-    //   printJS({
2325
-    //   printable: printDOMID,
2326
-    //   type: 'html',
2327
-    //   scanStyles: false,
2328
-    //   style: 'table { border-collapse: collapse }' // 表格样式
2329
-    // })
2330
-
2331
-    // div.remove()
2332
- 
2333
-    }
2334 2212
   },
2335 2213
   components: {
2336 2214
     ScheduleItem