935090232@qq.com
2021-10-06 e7eea688585603c5a8f134d92762e8431d885d36
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
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <LINK rel="Bookmark" href="../images/favicon.ico">
    <!-- 本框架基本脚本和样式 -->
    <!-- 引入样式 -->
 
    <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
    <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
    <link rel="stylesheet" th:href="@{/plugin/bootstrap-3.3.5/css/bootstrap.min.css}">
    <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css" />
 
</head>
<body>
 
<div class="ibox-content" id="app" v-cloak>
 
    <div class="row">
        <div class="panel panel-primary">
            <div class="panel-heading">
                美疗师排班
            </div>
            <div class="panel-body">
                <el-form ref="form">
 
                    <el-form-item label="排班时间">
                        <el-col :span="11">
                            <el-date-picker  @change="loadInfo()" type="date" placeholder="选择日期" v-model="dateTime"></el-date-picker>
                        </el-col>
                    </el-form-item>
 
                    <table class="table table-bordered text-center">
                        <thead>
                        <tr>
                            <th data-align="center"
                                data-width="300px">时间\班次
                            </th>
                            <th v-for="item in workTimes">
                                {{item.name }}
                                {{item.startTime | format('hh:mm') }}至{{item.endTime | format('hh:mm') }}
                            </th>
                        </tr>
                        </thead>
                        <tbody>
 
                        <tr v-for="(item,i) in beaWorkForms">
                            <td style="width:150px;">{{item.date|format('yy年MM月dd日')}}</td>
                            <td v-for="(timeCode,j) in workTimes">
                                <el-select style="width: 100%;" v-model="staffIds[i*workTimes.length+j]"
                                           placeholder="请选择" multiple>
                                    <el-option
                                            v-for="item in mlss"
                                            :key="item.suId"
                                            :label="item.suName"
                                            :value="item.suId">
                                    </el-option>
                                </el-select>
                            </td>
                        </tr>
 
                        </tbody>
 
                    </table>
                    <div class="form-group ">
                        <div class="col-sm-12 text-center">
                            <el-button type="primary" :disabled="isBefore" @click="submit()" >保存</el-button>
                        </div>
                    </div>
                </el-form>
            </div>
        </div>
    </div>
</div>
 
<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
<script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script>
 
 
<script type="text/javascript">
 
    var app = new Vue({
        el: '#app',
        data: {
            workTimes: {},
            tableData: [],
            staffIds: [],
            dateTime:new  Date(),
        },
        computed:{
            isBefore: function(){
                let time=parseInt(MTools.formatDate(this.dateTime,'yyyyMMdd'));
                let now=parseInt(MTools.formatDate(new Date(),'yyyyMMdd'));
                console.log(time,now,time>now);
                return time<now;
            }
 
        },
        created: function () {
            this.loadInfo();
        },
 
        mounted: function () {
            //  this.initDate();
        },
 
 
        methods: {
 
            loadInfo: function () {
                var _this = this;
                AjaxProxy.requst({
                    app: _this,
                    data:{'dateTime':MTools.formatDate(_this.dateTime,'yyyy-MM-dd')},
                    async: false,
                    url: basePath + '/admin/beautiWork/getPaiBanInfo',
                    callback: function (data) {
                        let map = data.mapInfo;
                        _this.dateTime = map.dateTime;
                        //班次
                        _this.workTimes = map.workTimes;
                        //获取最近一周的日期
                        _this.beaWorkForms = map.beaWorkForms;
                        _this.mlss = map.mlss;
                        let staffIds = [];
                        //设置选中的staffIds
                        for (let i = 0; i < _this.beaWorkForms.length; i++) {
                            //获取到已经排班的人
                            let queryListWorks = _this.beaWorkForms[i].queryListWorks;
                            for (let j = 0; j < queryListWorks.length; j++) {
                                console.log(i * queryListWorks.length + j, queryListWorks[j])
                                if (queryListWorks[j].length > 0) {
                                    let ids = [];
                                    queryListWorks[j].forEach(work => {
                                        ids.push(work.staffId);
                                    });
                                    staffIds[i * queryListWorks.length + j] = ids;
                                } else {
                                    staffIds[i * queryListWorks.length + j] = [];
                                }
                            }
                        }
                        console.log('初始化staffIds', staffIds);
                        _this.staffIds = staffIds;
 
                    }
                })
            },
 
            initDate: function () {
 
 
            },
 
            submit: function () {
                console.log(this.staffIds);
                let _this = this;
                let param = {
                    dateTime: MTools.formatDate(_this.dateTime,'yyyy-MM-dd'),
                    works: [],
                };
                for (let i = 0; i < _this.beaWorkForms.length; i++) {
                    for (let j = 0; j < _this.workTimes.length; j++) {
                        var work = new Object();
                        work.paibanCode = MTools.formatDate(_this.beaWorkForms[i].date, 'yyyyMMdd');
                        work.workId = _this.workTimes[j].id;
                        work.staffIds = _this.staffIds[i * _this.workTimes.length + j].join(',');
                        param.works.push(work);
                    }
 
                }
                console.log(param);
                AjaxProxy.requst(
                    {
                        app: _this,
                        data: param,
                        url: basePath + '/admin/beautiWork/ddOrModifyWork',
                        callback: function (data) {
                            _this.$message({
                                message: data.info,
                                type: 'success'
                            });
                        }
                    });
            },
 
            changeTime: function (event) {
                console.log('修改预约时间');
                var _this = this;
 
            },
 
 
        },
        filters: {
            format: function (value, patten) {
                if (!value) return '';
                return MTools.formatDate(value, patten)
            },
        },
 
        updated: function () {
            //兼容微信6.74+ios12的软键盘不回弹bug
            $("input,textarea,select").blur(function () {
                setTimeout(function () {
                    var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
                    window.scrollTo(0, Math.max(scrollHeight - 1, 0));
                }, 50)
            })
        },
    })
 
 
</script>
</body>
</html>