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
<template>
<div class="per_edit">
<a-form-model ref="form" :model="formData" :rules="rules" class="from-table">
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">姓 名</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="unitName">
<a-input v-model="formData.personName" placeholder="姓 名" style="width:360px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">民 族</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="nation">
<para-select v-model="formData.nation" :typeId="11" :width="180" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">职 称</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="title">
<para-multi-select :width="180" v-model="formData.title" :typeId="7" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">专 业</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="spec">
<cascader-select v-model="formData.spec" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">学 位</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="degree">
<para-select v-model="formData.degree" :width="180" :typeId="9" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">职 务</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="duty">
<a-input v-model="formData.duty" placeholder="职 务" :maxLength="30" style="width:360px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">邮 箱</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="email">
<a-input v-model="formData.email" placeholder="邮 箱" style="width:360px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div>通讯地址</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="address">
<a-input v-model="formData.address" placeholder="通讯地址" style="width:360px" />
</a-form-model-item>
</a-col>
</a-row>
<a-row type="flex">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div>主要研究领域</div>
</div>
</a-col>
<a-col :span="20">
<div class="special-middle">
<div>
<a-form-model-item prop="mainResearchAreas">
<a-textarea placeholder="主要研究领域" v-model="formData.mainResearchAreas" :maxLength="300" style="width: 360px; height: 80px; margin-top: 4px" />
</a-form-model-item>
</div>
</div>
</a-col>
</a-row>
</a-form-model>
</div>
</template>
<script>
import { isEmptyParams, checkEmail, checkPhone, checkIdentitytionId, personBirthday, personGender } from "@/views/utils/common"
import cascaderSelect from '@/views/components/common/cascaderSelect'
export default {
name: "infoEdit",
components: {
cascaderSelect
},
data () {
return {
rules: {
personName: [{ required: true, message: '*', trigger: 'blur' },],
nation: [{ required: true, message: '*', trigger: 'change' }],
title: [{ required: true, message: '*', trigger: 'change' }],
spec: [{ required: true, message: '*', trigger: 'change' }],
degree: [{ required: true, message: '*', trigger: 'change' }],
duty: [{ required: true, message: '*', trigger: 'blur' }],
telephone: [{ required: true, message: '*', trigger: 'blur' },],
fax: [{ required: true, message: '*', trigger: 'blur' },],
email: [
{ required: true, message: '*', trigger: 'blur' },
{ required: true, validator: checkEmail, trigger: 'blur' }
],
address: [{ required: false, message: '*', trigger: 'blur' },],
mainResearchAreas: [{ required: false, message: '*', trigger: 'blur' },],
},
}
},
props: {
formData: {
type: Object,
default: () => {
return null
}
},
},
created () {
},
methods: {
submit () {
this.$refs.form.validate(valid => {
if (valid) {
this.$emit('load', true)
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.person.updatePerson(par).then(({ data = {} }) => {
if (data) {
this.$message.success('成功!')
this.$emit('sub', true)
}
this.$emit('load', false)
}).catch(() => { this.$emit('load', false) })
} else {
this.$message.error('信息未填写完全!')
return false
}
});
},
}
}
</script>
<style scoped lang="less">
</style>