【调度系统】广东民航医疗快线调度系统源代码
wzp
2025-05-06 18c7a44d2e9db3f4a5322389c3ee94468cce4de1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html>
<html lang="en" >
 
<head>
 
  <meta charset="UTF-8">
 <meta name="apple-mobile-web-app-title" content="CodePen">
<?php 
$beginDate=empty($_REQUEST['beginDate'])!=false ? date("Y-m-d") : $_REQUEST['beginDate'];
?>
 
 
  <title>排班表</title>
  
  
  
  
  
<style>
* {
            margin: 0;
            padding: 0;
        }
        
        .date-box {
            padding: 10px 100px;
        }
        
        .date-box h2 {
            margin-top: 20px;
            padding-bottom: 20px;
        }
        
        table {
            width: 100%;
            border-collapse: collapse;
        }
        
        table tr {
            display: -webkit-flex;
            display: flex;
        }
        
        table tr th,
        table tr td {
            flex: 1;
            padding: 10px 0;
            text-align: center;
            border: 1px solid #e1e8f6;
        }
        
        table tr th {
            background-color: #dddddd;
        }
        
        table tr td.active {
            background-color: #7087f4;
            color: #ffffff;
        }
</style>
 
  <script>
  window.console = window.console || function(t) {};
</script>
 
  
  
  <script>
  if (document.location.search.match(/type=embed/gi)) {
    window.parent.postMessage("resize", "*");
  }
</script>
 
 
</head>
 
<body translate="no" >
  <!--排班时间 begin-->
    <div class="date-box">
        <h2>一周排班</h2>
        <?php
        $beginDate1=date_create($beginDate);
        date_sub($beginDate1,date_interval_create_from_date_string("7 days"));
        $beginDate1=date_format($beginDate1,"Y-m-d");
 
        $beginDate2=date_create($beginDate);
        date_sub($beginDate2,date_interval_create_from_date_string("-7 days"));
        $beginDate2=date_format($beginDate2,"Y-m-d");
        ?>
        <a href="?beginDate=<?php echo $beginDate1;?>">上一周</a>
        <a href="?beginDate=<?php echo $beginDate2;?>">下一周</a>
        <table id="oneWeekDate"></table>
    </div>
    <!--排班时间 end-->
    <script src="/js/stopExecutionOnTimeout.js"></script>
 
  
      <script id="rendered-js" >
/*
       * 通过参数动态获取排班时间
       * @author:kevinInsight 20180411
       */
 
/*
           * 获取当天及之后的排班时间
           * @param dayCount:相对于今天的天数,形如:0,1,2.......
           */
var now = new Date('<?php echo $beginDate;?>'); //当前日期
var nowDayOfWeek = now.getDay(); //今天本周的第几天
var nowDay = now.getDate(); //当前日
var nowMonth = now.getMonth(); //当前月
var nowYear = now.getFullYear(); //当前年
function getDateData(dayCount) {
  var d = getWeekStartDate();
  d.setDate(d.getDate() + dayCount);
  var y = d.getFullYear();
  var m = d.getMonth() + 1 > 9 ? d.getMonth() + 1 : '0' + (d.getMonth() + 1);
  var d = d.getDate() > 9 ? d.getDate() : '0' + d.getDate();
  return y + "-" + m + "-" + d;
}
//获得本周的开端日期
function getWeekStartDate() {
    var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek + 1);
    return weekStartDate;
}
 
//获得本周的停止日期
function getWeekEndDate() {
    var weekEndDate = new Date(nowYear, nowMonth, nowDay + (7 - nowDayOfWeek));
    return weekEndDate;
}
 
//获得本月的开端日期
function getMonthStartDate(){
    var monthStartDate = new Date(nowYear, nowMonth, 1);
    return monthStartDate;
}
 
//获得本月的停止日期
function getMonthEndDate(){
    var monthEndDate = new Date(nowYear, nowMonth, getMonthDays(nowMonth));
    return monthEndDate;
}
/*
   * 获取日期对应的星期名称
   * @param date:待转换日期,形如:'2018-04-11' 或 '2018-4-11'
   */
function dateToDay(date) {
  var dayNo = new Date(date).getDay();
  var date=new Date(date).getMonth()+1+'-'+new Date(date).getDate();
  switch (dayNo) {
    case 0:
      return date+' 星期日';
      break;
    case 1:
      return date+' 星期一';
      break;
    case 2:
      return date+' 星期二';
      break;
    case 3:
      return date+' 星期三';
      break;
    case 4:
      return date+' 星期四';
      break;
    case 5:
      return date+' 星期五';
      break;
    case 6:
      return date+' 星期六';
      break;
    default:
      break;}
 
}
/*
   * 获取排班日期
   * @param weekCount:排班周数,int型
   * @param domId: 输出DomId
   */
function initWeekData(weekCount, domId) {
  var weekDateTempl = '',
  tableTempl = '',
  tableTh = '',
  tableTd = '',
  tableTdArr = [],
  weekData = [],
  weekDataFinal = [],
  weekDateEle;
  for (var i = 0; i < weekCount * 7; i++) {if (window.CP.shouldStopExecution(0)) break;
    weekData[i] = getDateData(i);
  }window.CP.exitedLoop(0);
  for (var i = 0; i < weekData.length; i = i + 7) {if (window.CP.shouldStopExecution(1)) break;
    weekDataFinal.push(weekData.slice(i, i + 7));
  }window.CP.exitedLoop(1);
  weekDataFinal.forEach(function (item, index) {
    if (index === 0) {
      for (var i = 0; i < item.length; i++) {if (window.CP.shouldStopExecution(2)) break;
        tableTh += '<th>' + dateToDay(item[i]) + '</th>';
      }window.CP.exitedLoop(2);
      tableTh = '<tr>' + tableTh + '</tr>';
      //firstWeek
      for (var j = 0; j < item.length; j++) {if (window.CP.shouldStopExecution(3)) break;
        tableTd += '<td attr-date=' + item[j] + '>' + new Date(item[j]).getDate() + '</td>';
      }window.CP.exitedLoop(3);
      tableTd = '<tr>' + tableTd + '</tr>';
      tableTdArr[index] = tableTd;
      tableTd = '';
    } else {
      for (var k = 0; k < item.length; k++) {if (window.CP.shouldStopExecution(4)) break;
        tableTd += '<td attr-date=' + item[k] + '>' + new Date(item[k]).getDate() + '</td>';
      }window.CP.exitedLoop(4);
      tableTd = '<tr>' + tableTd + '</tr>';
      tableTdArr[index] = tableTd;
      tableTd = '';
    }
  });
  tableTempl = tableTh + tableTdArr.join('');
  weekDateEle = document.querySelector('#' + domId);
  weekDateEle.innerHTML = tableTempl;
  weekDateEle.querySelectorAll('tr>td').forEach(function (item, index) {
    item.addEventListener("click", function () {
      weekDateEle.querySelectorAll('tr>td').forEach(function (item, index) {
        item.classList.remove('active');
      });
      this.classList.add('active');
      alert(this.getAttribute('attr-date'));
    });
  });
}
 
//调用实例
 
//一周
initWeekData(1, 'oneWeekDate');
 
//两周
initWeekData(2, 'twoWeekDate');
 
//四周
initWeekData(4, 'fourWeekDate');
//# sourceURL=pen.js
    </script>
 
  
  
 
</body>
 
</html>