ce4c83ff
wxy
初始提交
|
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
|
<template>
<div class="baseinfo">
<form class="baseinfo-box" @submit='commit'>
<div class="list-input">
<span>开始时间</span>
<div class="datebox">
<picker class="time" v-model="startTime" mode='time' :value='startTime' @change="pickerConfirm($event,'time')">
<div hover-class='hover' :class="{unset:startTime==''}">{{startTime || '选择时间'}}</div>
</picker>
<picker class="date" v-model="startDate" mode='date' :value='startDate' @change="pickerConfirm($event,'date')">
<div hover-class='hover' :class="{unset:startDate==''}">{{startDate || '选择日期'}}</div>
</picker>
</div>
</div>
<div class="list-input">
<span>结束时间</span>
<div class="datebox">
<picker class="time" v-model="endTime" mode='time' :value='endTime' @change="pickerConfirm2($event,'time')">
<div hover-class='hover' :class="{unset:endTime==''}">{{endTime || '选择时间'}}</div>
</picker>
<picker class="date" v-model="endDate" mode='date' :value='endDate' @change="pickerConfirm2($event,'date')">
<div hover-class='hover' :class="{unset:endDate==''}">{{endDate || '选择日期'}}</div>
</picker>
</div>
</div>
<div class="list-input">
<span>请假事由</span>
<!--<input placeholder="请输入请假事由" v-model="cause" name='cause' :value="cause" @input='cause=service.Input($event)' placeholder-style='color:#9B9B9B'>-->
</div>
<div class="longtext">
<textarea placeholder="请输入请假事由" v-model="cause" name='cause' :value="cause" ></textarea>
</div>
<div class="list-input">
<span>审批人</span>
<input name="" value="lawPrincipal" v-model="lawPrincipal" readonly disabled>
</div>
<div class='commit'>
<button form-type='submit' hover-class='fade' :disabled='commiting' bindtap='submit'>提交</button>
</div>
<!--<div class='commit'>-->
<!--<div @click='submit1'>订阅消息</div>-->
<!--</div>-->
</form>
</div>
</template>
<script>
export default {
data() {
return {
startDate: '',
startTime: '',
endDate: '',
endTime: '',
cause: '',
lawPrincipal: '',
approverId : '',
commiting: false
}
},
methods: {
commit(e){
if(this.commiting) return
console.log(`${this.startDate} ${this.startTime}:00`)
let inputs = this.service.filter(e.mp.detail.value)
if(!this.service.checkEmptyInput([this.startDate,this.startTime,this.startDate,this.endTime,this.cause],['开始日期','开始时间','结束日期','结束时间','请假事由'])){
return
}
if(!this.service.checkBadWords([this.cause],['请假事由'])){
return
}
wx.showModal({
title:'',
content:'确定要提交吗?',
success: res => {
if(res.confirm){
this.execCommit(e)
}
}
})
},
execCommit(e){
console.log(this.approverId)
this.commiting = true
const startDate=this.startDate+' '+this.startTime+':00'
const endDate=this.endDate + ' '+this.endTime+':00'
wx.showLoading({ title: '正在提交' })
wx.request({
url: this.rootUrl + 'leave/add',
method: 'POST',
header: { 'content-type': 'application/x-www-form-urlencoded' },
data: {
startDate: startDate ,
endDate:endDate ,
cause: this.cause,
Approver_id: this.approverId,
sessionID: wx.getStorageSync('sessionID')
},
success: res => {
console.log(res)
if (res.statusCode == '500') {
this.service.getUnionId(this.rootAvatar, this.rootUrl).then(res => this.submit_exec(content))
} else {
wx.hideLoading()
if (res.data === 1) {
wx.showModal({
title: '提交成功',
content: '',
showCancel: false
})
this.text = ''
wx.hideLoading()
this.toHomelist()
} else {
wx.showToast({ title: '提交失败', icon: 'none' })
}
this.commiting = false
}
}
})
},
//回到首页
toHomelist: function () {
wx.navigateBack({
url: '../leaveList/main'
// delta: 1
})
// wx.redirectTo({ url: '../leaveList/main?Refresh=true' })
// const pages = getCurrentPages()
// pages[pages.length -2 ].onload()
// pages[pages.length -2 ].refresh()
},
pickerConfirm(e, s) {
switch (s) {
case 'time': this.startTime = e.mp.detail.value;break
case 'date': this.startDate = e.mp.detail.value;break
}
},
pickerConfirm2(e, s) {
switch (s) {
case 'time': this.endTime = e.mp.detail.value;break
case 'date': this.endDate = e.mp.detail.value;break
}
},
// submit1 (){
// wx.requestSubscribeMessage({
// tmplIds: ['N7I9WVwRXIRzAUOG6aVK7_Zo2EVJFCKBYhqsWip-T8g'],
// success (res) {
// if (res['N7I9WVwRXIRzAUOG6aVK7_Zo2EVJFCKBYhqsWip-T8g'] === 'accept'){
// wx.showToast({
// title: '订阅OK!',
// duration: 1000,
// success(data) {
// console.log(res)
// }
// })
// }
// },
// fail (res) {
// console.log(res)
// }
// })
// },
loadArticles () {
this.getlaw()
},
getlaw(){
wx.showLoading({ title: '正在加载' })
wx.request({
url: this.rootUrl + 'leave/getLawPrincipal',
method: 'get',
header: { 'content-type': 'application/x-www-form-urlencoded' },
data: {
sessionID: wx.getStorageSync('sessionID')
},
success: res => {
if (res.statusCode == '500') {
// this.service.getUnionId(this.rootAvatar, this.rootUrl).then(res => this.submit_exec(content))
} else {
console.log(res.data)
this.lawPrincipal = res.data.name
this.approverId = res.data.liid
console.log(this.lawPrincipal)
wx.hideLoading()
}
}
})
}
},
onLoad(){
this.getlaw()
},
onShow() {
this.loadArticles()
},
onUnload(){
this.lawPrincipal = ''
this.approverId = ''
this.loaded = false
this.startTime = ''
this.startDate = ''
this.endTime = ''
this.endDate = ''
}
}
</script>
<style lang="stylus" scoped>
.baseinfo
position absolute
Height_Width(100%)
Background()
.baseinfo-box
Background()
div
text-align right
.datebox
margin-right 0 !important
width 100%
.date
float right
width 180rpx
.time
float right
width 120rpx
.longtext
margin-top -25rpx
width 100%
padding 25rpx
box-sizing border-box
background-color #fff
border-bottom 1rpx solid #eee
textarea
width 100%
height 170rpx
padding 10rpx
box-sizing border-box
background-color #eee
border-radius 10rpx
font-size 30rpx
line-height 50rpx
text-align left !important
</style>
|