50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<template>
<j-modal
:confirmLoading="confirmLoading"
:title="title"
:width="1200"
:visible="visible"
:maskClosable="false"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<!-- 主表单区域 -->
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="12">
|
9c110e9a
wxy
未检人员列表、详情、新增、编辑
|
18
19
20
21
22
23
24
25
26
27
28
29
|
<a-form-model-item label="户号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="householdNum">
<a-input v-model="model.householdNum" placeholder="请输入户号"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="人员编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number">
<a-input v-model="model.number" placeholder="请输入人员编号"></a-input>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
30
31
32
33
34
35
36
37
38
|
<a-form-model-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input v-model="model.name" placeholder="请输入姓名"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gender">
<j-dict-select-tag v-model="model.gender" dictCode="sex" placeholder="请选择性别" />
</a-form-model-item>
</a-col>
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
39
40
41
42
43
|
<a-col :span="12">
<a-form-model-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="identity">
<a-input v-model="model.identity" placeholder="请输入身份证号"></a-input>
</a-form-model-item>
</a-col>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
44
|
<a-col :span="12">
|
62156ef2
wxy
数据分析
|
45
46
|
<a-form-model-item label="学校名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="schoolName">
<a-input v-model="model.schoolName" placeholder="请输入学校名称"></a-input>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
47
48
49
|
</a-form-model-item>
</a-col>
<a-col :span="12">
|
62156ef2
wxy
数据分析
|
50
51
|
<a-form-model-item label="入学年份" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startYear">
<a-input v-model="model.startYear" placeholder="请输入入学年份"></a-input>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
52
53
|
</a-form-model-item>
</a-col>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
54
55
56
57
58
59
|
<a-col :span="12">
<a-form-model-item label="是否失学" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="school">
<j-dict-select-tag v-model="model.school" dictCode="school_status" placeholder="请选择是否失学" />
</a-form-model-item>
</a-col>
<a-col :span="12">
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
60
61
62
63
64
65
66
67
68
|
<a-form-model-item label="监护人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="guardian">
<a-input v-model="model.guardian" placeholder="请输入监护人"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="监护人关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="relation">
<a-input v-model="model.relation" placeholder="请输入监护人关系"></a-input>
</a-form-model-item>
</a-col>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
69
|
<a-col :span="12">
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
70
71
|
<a-form-model-item label="家庭住址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address">
<a-textarea v-model="model.address" placeholder="请输入家庭住址" :rows="1"></a-textarea>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
72
73
74
|
</a-form-model-item>
</a-col>
<a-col :span="12">
|
62156ef2
wxy
数据分析
|
75
|
<a-form-model-item label="特殊原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="specialReason">
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
76
77
78
79
80
|
<a-textarea v-model="model.specialReason" placeholder="请输入特殊原因" :rows="1"></a-textarea>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="重点关注原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reason">
|
0c19b627
wxy
未成年人新增修改
|
81
82
83
84
85
|
<j-multi-select-tag
v-model="model.reason"
dictCode="attention_reason"
placeholder="请选择重点关注原因">
</j-multi-select-tag>
|
62156ef2
wxy
数据分析
|
86
87
88
|
</a-form-model-item>
</a-col>
<a-col :span="12">
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
89
|
<a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
90
|
<a-textarea v-model="model.remark" placeholder="请输入备注" :rows="1"></a-textarea>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
91
92
93
94
95
96
|
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
<!-- 子表单区域 -->
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
97
|
<a-tabs activeKey="1" type="card">
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
98
99
|
<a-tab-pane tab="家庭成员" key="1" :forceRender="true">
<j-editable-table
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
100
|
class="main_table"
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
101
102
103
104
|
ref="editableTable"
:loading="familyLoading"
sticky :columns="columns"
:dataSource="dataSource"
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
105
|
:maxHeight="192"
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
106
107
108
|
:rowNumber="true"
:rowSelection="true"
:actionButton="true" />
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
109
|
</a-tab-pane>
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
110
111
112
113
114
115
116
117
118
119
|
</a-tabs>
</a-spin>
</j-modal>
</template>
<script>
import { getAction, httpAction } from '@/api/manage'
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormModelAndTables } from '@/utils/JEditableTableUtil'
import JEditableTable from '@/components/jeecg/JEditableTable'
import JDate from '@/components/jeecg/JDate'
|
62156ef2
wxy
数据分析
|
120
|
import { GetAge } from '@/utils/util'
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
121
122
123
124
125
126
127
128
129
130
|
export default {
name: 'MinorModal',
components: {
JEditableTable, JDate
},
data() {
return {
confirmLoading: false,
title: '',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
131
132
133
134
135
|
visible: false,
disableSubmit: false,
model: {},
labelCol: {
xs: { span: 24 },
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
136
|
sm: { span: 5 }
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
137
138
139
|
},
wrapperCol: {
xs: { span: 24 },
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
140
|
sm: { span: 19 }
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
141
142
143
144
145
146
147
148
149
150
|
},
labelCol2: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 }
},
validatorRules: {
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
151
152
153
154
155
156
|
householdNum: [{ required: true, message: '请输入户号' }],
name: [{ required: true, message: '请输入姓名' }],
gender: [{ required: true, message: '请选择性别' }],
identity: [{ required: true, validator: this.validateIdCard }],
relation: [{ required: true, message: '请输入监护人关系' }],
guardian: [{ required: true, message: '请输入监护人' }]
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
157
158
159
160
161
162
163
164
165
166
167
168
169
|
},
url: {
add: '/sys/minor/add',
edit: '/sys/minor/edit',
queryById: '/sys/minor/queryById',
familys: '/sys/minor/queryFamilyByMainId'
},
familyLoading: false,
dataSource: [],
columns: [
{
title: '户号',
key: 'householdNum',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
170
|
width: '230px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
171
|
type: FormTypes.input,
|
62156ef2
wxy
数据分析
|
172
|
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
173
|
placeholder: '请输入',
|
62156ef2
wxy
数据分析
|
174
175
176
177
178
|
validateRules: [{ required: true, message: '${title}不能为空' }]
},
{
title: '人员编号',
key: 'number',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
179
|
width: '230px',
|
62156ef2
wxy
数据分析
|
180
|
type: FormTypes.input,
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
181
|
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
182
|
placeholder: '请输入',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
183
184
185
186
|
},
{
title: '姓名',
key: 'name',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
187
|
width: '100px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
188
189
|
type: FormTypes.input,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
190
|
placeholder: '请输入',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
191
192
193
194
195
|
validateRules: [{ required: true, message: '${title}不能为空' }]
},
{
title: '身份证号',
key: 'identity',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
196
|
width: '190px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
197
198
|
type: FormTypes.input,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
199
|
placeholder: '请输入',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
200
|
validateRules: [{
|
62156ef2
wxy
数据分析
|
201
|
// pattern: '/(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{7}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)/',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
202
|
pattern: '^\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])$',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
203
204
205
206
|
message: '${title}格式不正确'
}]
},
{
|
62156ef2
wxy
数据分析
|
207
208
|
title: '与户主的关系',
key: 'relation',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
209
|
width: '120px',
|
62156ef2
wxy
数据分析
|
210
211
|
type: FormTypes.input,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
212
|
placeholder: '请输入',
|
62156ef2
wxy
数据分析
|
213
214
215
216
217
218
219
220
|
validateRules: [{ required: true, message: '${title}不能为空' }]
},
{
title: '行政区划',
key: 'division',
width: '180px',
type: FormTypes.input,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
221
|
placeholder: '请输入',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
222
223
|
},
{
|
62156ef2
wxy
数据分析
|
224
225
|
title: '现住址',
key: 'address',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
226
|
width: '200px',
|
62156ef2
wxy
数据分析
|
227
228
|
type: FormTypes.input_pop,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
229
|
placeholder: '请输入'
|
62156ef2
wxy
数据分析
|
230
231
|
},
{
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
232
233
|
title: '是否犯罪',
key: 'crime',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
234
|
width: '100px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
235
236
237
|
type: FormTypes.select,
options: [],
dictCode: 'is_crime',
|
0c19b627
wxy
未成年人新增修改
|
238
|
placeholder: '请选择',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
239
240
241
242
|
},
{
title: '犯罪原因',
key: 'reason',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
243
|
width: '200px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
244
245
|
type: FormTypes.input_pop,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
246
|
placeholder: '请输入'
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
247
248
249
250
|
},
{
title: '其他参考信息',
key: 'other',
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
251
|
width: '200px',
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
252
253
|
type: FormTypes.input_pop,
defaultValue: '',
|
0c19b627
wxy
未成年人新增修改
|
254
|
placeholder: '请输入'
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
}
]
}
},
props: {
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
computed: {
formDisabled() {
return this.disabled
}
},
created() {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model))
},
methods: {
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
277
278
|
getAgeByIdentity(identity) {
return GetAge(identity)
|
62156ef2
wxy
数据分析
|
279
|
},
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
280
|
validateIdCard(rule, value, callback) {
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
281
|
console.log(value)
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
282
283
284
285
286
287
|
if (undefined == value || null == value || '' == value) {
callback('请输入正确的公民身份号码!')
} else if (!value || new RegExp(/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{7}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/).test(value)) {
callback()
} else {
callback('请输入正确的公民身份号码!')
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
288
289
290
291
292
293
294
295
296
297
|
}
},
// 获取所有的editableTable实例
getAllTable() {
return Promise.all([
getRefPromise(this, 'editableTable')
])
},
add() {
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
298
|
this.dataSource = []
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
299
300
301
302
303
304
305
306
307
308
309
|
// 默认新增一条数据
this.getAllTable().then(editableTables => {
editableTables[0].add()
})
this.edit({})
},
edit(record) {
this.model = Object.assign({}, record)
this.visible = true
// 加载子表数据
|
9c110e9a
wxy
未检人员列表、详情、新增、编辑
|
310
311
|
if (this.model.householdNum) {
let params = { householdNum: this.model.householdNum }
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
312
313
314
315
316
317
318
|
this.requestTableData(this.url.familys, params)
}
},
/** 查询某个tab的数据 */
requestTableData(url, params) {
this.familyLoading = true
getAction(url, params).then(res => {
|
62156ef2
wxy
数据分析
|
319
|
console.log(this.dataSource)
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
320
|
this.dataSource = res.result || []
|
62156ef2
wxy
数据分析
|
321
|
console.log(this.dataSource)
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
}).finally(() => {
this.familyLoading = false
})
},
handleCancel() {
this.close()
},
close() {
this.visible = false
this.getAllTable().then(editableTables => {
editableTables[0].initialize()
})
this.$emit('close')
this.$refs.form.resetFields()
},
handleOk() {
this.validateFields()
},
/** 触发表单验证 */
validateFields() {
this.getAllTable().then(tables => {
/** 一次性验证主表和所有的次表 */
return validateFormModelAndTables(this.$refs.form, this.model, tables)
}).then(allValues => {
let formData = this.classifyIntoFormData(allValues)
// 发起请求
return this.requestAddOrEdit(formData)
}).catch(e => {
if (e.error === VALIDATE_NO_PASSED) {
// 如果有未通过表单验证的子表,就自动跳转到它所在的tab
this.activeKey = e.index == null ? this.activeKey : (e.index + 1).toString()
} else {
console.error(e)
}
})
},
/** 整理成formData */
classifyIntoFormData(allValues) {
let MinorPage = Object.assign(this.model, allValues.formValue)
return {
...MinorPage, // 展开
familyList: allValues.tablesValue[0].values
}
},
/** 发起新增或修改的请求 */
requestAddOrEdit(formData) {
let url = this.url.add, method = 'post'
if (this.model.id) {
url = this.url.edit
method = 'put'
}
this.confirmLoading = true
httpAction(url, formData, method).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
</script>
<style scoped>
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
391
392
393
394
395
396
397
398
399
|
.ant-form-item {
margin-bottom: 10px;
}
</style>
<style>
.main_table .input-table .thead {
overflow-y: auto;
}
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
400
|
|
106c9657
lifengge
修改未检人员页面,含新增、编辑、查...
|
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
.main_table .input-table .thead .tr {
overflow-y: auto;
}
.main_table .input-table .scroll-view {
overflow-y: auto;
scrollbar-width: thin;
}
/* 设置滚动条的样式 */
.main_table .input-table .scroll-view::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/* 滚动槽 */
.main_table .input-table .scroll-view::-webkit-scrollbar-track {
background: #f5f5f5;
}
/* 滚动条滑块 */
.main_table .input-table .scroll-view::-webkit-scrollbar-thumb {
background: #dedede;
-webkit-box-shadow: none;
}
.main_table .ant-row-flex {
margin-top: -55px;
flex-flow: row-reverse;
}
.main_table .ant-row-flex .action-button {
margin-bottom: 20px;
}
|
50565778
wxy
新增未成年人、户籍信息、特殊学校、...
|
435
|
</style>
|