EmDetails.vue
10.1 KB
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
253
254
<template>
<div>
<a-card>
<h3 style="font-weight: bold;">基本信息</h3>
<a-form-model ref="ruleForm" :model="form" :rules="rules">
<a-row>
<a-col :span="8">
<a-form-model-item ref="staffId" label="员工Id">
<a-input :disabled="true" style="width: 250px" v-model="form.staffId" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item ref="creatTime" label="创建时间">
<a-date-picker v-model="form.creatTime" format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="职工类型" ref="staffType" prop="staffType">
<a-select v-model="form.staffType" style="width: 250px;" placeholder="请选择">
<a-select-option v-for="(item,i) in provinceData" :key="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-model-item ref="name" label="姓名" prop="name">
<a-input style="width: 250px;" v-model="form.name" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="部门" ref="department" prop="department">
<a-select v-model="form.department" style="width: 250px;" placeholder="请选择">
<a-select-option v-for="(item,i) in departData" :key="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-row>
<a-col :span="10">享受补贴:是</a-col>
<a-col :span="10"> 充值比例:80%</a-col>
</a-row>
<a-row>
<a-col :span="10">是否自结:是</a-col>
<a-col :span="10"> 使用app:是</a-col>
</a-row>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-model-item ref="idCard" label="身份证号码" prop="idCard">
<a-input style="width: 250px;" v-model="form.idCard" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="入职日期">
<a-date-picker v-model="form.entryTime" :disabled-date="disabledStartDate" show-time
format="YYYY-MM-DD HH:mm:ss" placeholder="Start" @openChange="handleStartOpenChange" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="离职日期">
<a-date-picker v-model="form.qurtTime" :disabled-date="disabledEndDate" show-time
format="YYYY-MM-DD HH:mm:ss" placeholder="End" :open="endOpen"
@openChange="handleEndOpenChange" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-card>
<a-card>
<h3 style="font-weight: bold;">账户信息</h3>
<a-form-model>
<a-row>
<a-col :span="8">
<a-form-model-item label="补贴账户余额(元)">
<a-input :disabled="true" style="width: 250px" v-model="form.subPrice" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="充值账户余额(元)">
<a-input :disabled="true" style="width: 250px" v-model="form.rechPrice" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-card>
<a-card>
<h3 style="font-weight: bold;">绑定卡信息</h3>
<a-form-model>
<a-row>
<a-col :span="8">
<a-form-model-item label="卡号">
<a-input :disabled="true" style="width: 250px" v-model="form.cardNumber" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-card>
<div style="float: right; margin:20px;">
<a-button @click="$router.back(-1)">
返回
</a-button>
<a-button type="primary" style="margin-left: 10px;" @click="onSubmit">
保存
</a-button>
</div>
</div>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { httpAction } from '@/api/manage'
import moment from "moment"
// import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
name: "",
// mixins: [JeecgListMixin],
components: {
},
created() {
// if (this.$route.query.id) {
this.getList()
// }
},
data() {
return {
form: {
staffId: "",
creatTime: "",
staffType: "",
name: "",
department: "",
idCard: "",
entryTime: "",
qurtTime: "",
subPrice: "",
rechPrice: "",
cardNumber: "",
},
provinceData: [
{ id: 1, name: "在职" },
{ id: 2, name: "离职" }
],
departData: [{ id: 1, name: "技术" },
{ id: 2, name: "产品" }],
rules: {
staffType: [
{ required: true, message: '请选择职工类型', trigger: 'change' },
],
department: [
{ required: true, message: '请选择部门', trigger: 'change' },
],
name: [
{ required: true, message: '请输入姓名', trigger: 'blur' },
],
idCard: [
{ required: true, message: '请输入身份证号码', trigger: 'blur' },
],
},
endOpen: false,
url: {
detail: "/staff/info",
add: "/staff/add"
},
}
},
computed: {
},
methods: {
disabledStartDate(startValue) {
const endValue = this.form.qurtTime;
if (!startValue || !endValue) {
return false;
}
return startValue.valueOf() > endValue.valueOf();
},
disabledEndDate(endValue) {
const startValue = this.form.entryTime;
if (!endValue || !startValue) {
return false;
}
return startValue.valueOf() >= endValue.valueOf();
},
handleStartOpenChange(open) {
if (!open) {
this.endOpen = true;
}
},
handleEndOpenChange(open) {
this.endOpen = open;
},
onSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
console.log(this.form)
let httpurl = this.url.add
let method = 'post'
this.form.entryTime = moment(this.form.entryTime).format("YYYY-MM-DD HH:mm:ss")
this.form.creatTime = moment(this.form.entryTime).format("YYYY-MM-DD HH:mm:ss")
this.form.qurtTime = moment(this.form.entryTime).format("YYYY-MM-DD HH:mm:ss")
httpAction(httpurl, this.form, method).then((res) => {
if (res.success) {
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
getList() {
let httpurl = this.url.detail
let method = 'get'
httpAction(httpurl, { id: this.$route.query.id }, method).then((res) => {
if (res.success) {
this.form = res.result
this.form.entryTime = moment(res.result.entryTime).format("YYYY-MM-DD HH:mm:ss")
this.form.creatTime = moment(res.result.creatTime).format("YYYY-MM-DD HH:mm:ss")
this.form.qurtTime = moment(res.result.qurtTime).format("YYYY-MM-DD HH:mm:ss")
} else {
this.$message.warning(res.message);
}
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>