123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <el-row style="float:right;">
- <el-col :span="24">
- <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
- </el-col>
- </el-row>
- </div>
- <div class="app-container" style="background-color: white;">
- <div id="print_content">
- <div class="print_main_content">
- <div class="order_title_panl">
- <span class="main_title">{{ $store.getters.xt_user.org.org_name }}医护排班表</span>
- </div>
- <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
- 打印时间:{{ getNowFormatDate() }}
- </div>
- <div class="table_panel">
- <table class="table">
- <thead>
- <tr>
- <td width="120">医护姓名</td>
- <td width="120">周一</td>
- <td width="120">周二</td>
- <td width="120">周三</td>
- <td width="120">周四</td>
- <td width="120">周五</td>
- <td width="120">周六</td>
- <td width="120">周日</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for='(item,index) in tableData' :key="index">
- <td>{{ item.user_name }}</td>
- <td>{{ getClass(item.user_name,1) }}</td>
- <td>{{ getClass(item.user_name,2) }}</td>
- <td>{{ getClass(item.user_name,3) }}</td>
- <td>{{ getClass(item.user_name,4) }}</td>
- <td>{{ getClass(item.user_name,5) }}</td>
- <td>{{ getClass(item.user_name,6) }}</td>
- <td>{{ getClass(item.user_name,7) }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import print from 'print-js'
- import { getDoctorList,getStaffScheduleList } from '@/api/doctorSchedule'
- export default {
- components:{
- BreadCrumb
- },
- data(){
- return{
- crumbs: [
- { path: false, name: '医护排班' },
- { path: false, name: '排班打印' }
- ],
- start_time:"",
- end_time:"",
-
- doctorlist:[],
- tableData:[]
- }
- },
- methods:{
- printAction: function() {
- const style = '@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 20px; padding: 15px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 18px; padding: 10px 5px; } .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
-
- printJS({
- printable: 'print_content',
- type: 'html',
- documentTitle: ' ',
- style: style,
- scanStyles: false
- })
- },
- getDoctorList(){
- getDoctorList().then(response=>{
- var list = response.data.data.list
- console.log("医护列表",list)
- this.doctorlist = list
- this.getStaffScheduleList()
- })
- },
- //获取本周的所有排班列表
- getStaffScheduleList(){
- const params = {
- start_time:this.start_time,
- end_time:this.end_time,
- }
- getStaffScheduleList(params).then(response=>{
- if(response.data.state == 1){
- var staffList = response.data.data.staffList
- console.log("staffList",staffList)
-
- let tempArr = [], newArr = []
- for (let i = 0; i < staffList.length; i++) {
- if(tempArr.indexOf(staffList[i].user_name) === -1) {
- newArr.push({
- user_name: staffList[i].user_name,
- admin_user_id:staffList[i].admin_user_id,
- list: [{class_name:staffList[i].class_name,schedule_week:staffList[i].schedule_week}]
- })
- tempArr.push(staffList[i].user_name);
- } else {
- for (let j = 0; j < newArr.length; j++) {
- if (newArr[j].user_name == staffList[i].user_name) {
- newArr[j].list.push({class_name:staffList[i].class_name,admin_user_id:staffList[i].admin_user_id,schedule_week:staffList[i].schedule_week})
- }
- }
- }
- }
- let arr = [...newArr]
- this.doctorlist.map((item,index) => {
- if(!(arr[index] && item.admin_user_id == arr[index].admin_user_id)){
- arr.splice(index,0,{user_name:item.user_name,admin_user_id: item.admin_user_id,list: []})
- }
- })
- console.log(arr)
- this.tableData = arr
-
- }
- })
- },
- getClass(name,index){
- if(name != undefined){
- let newClass = '';
- this.tableData.map(item => {
- if(item.user_name == name){
- if(item.list){
- item.list.map(it => {
- if(it.schedule_week == index){
- newClass = it.class_name
- }
- })
- }
- }
- })
- return newClass
- }
- },
- getNowFormatDate() {
- var date = new Date();
- var seperator1 = "-";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate;
- return currentdate;
- }
- },
- created(){
- var starttime = this.$route.query.starttime
- console.log("starttime",starttime)
- this.start_time = starttime
- var endtime = this.$route.query.endtime
- console.log("endtime",endtime)
- this.end_time = endtime
- //获取该机构所有医护人员
- this.getDoctorList()
- }
- }
- </script>
-
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .print_main_content {
- background-color: white;
- max-width: 1500px;
- margin: 0 auto;
- padding: 0 0 20px 0;
-
- .order_title_panl {
- text-align: center;
-
- .main_title {
- font-size: 18px;
- line-height: 40px;
- font-weight: 500;
- }
- }
- .table_panel {
- .table {
- width: 100%;
- border: 1px solid;
- border-collapse: collapse;
- padding: 2px;
-
- thead {
- tr {
- td {
- border: 1px solid;
- text-align: center;
- font-size: 20px;
- padding: 15px 5px;
- }
- }
- }
- tbody {
- tr {
- td {
- border: 1px solid;
- text-align: center;
- font-size: 18px;
- padding: 10px 5px;
-
- .proj {
- padding: 5px 0;
- text-align: left;
-
- .proj_title {
- font-size: 16px;
- font-weight: 500;
- line-height: 25px;
- }
-
- .proj_item {
- font-size: 15px;
- line-height: 20px;
-
- .zone_name {
- font-weight: 500;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|