feat: 注册用户信息修改兼容性问题

This commit is contained in:
cgd_mac 2022-02-25 09:03:30 +08:00
parent 3034a1a3b0
commit 9244890936
2 changed files with 318 additions and 295 deletions

View File

@ -20,25 +20,26 @@
<a-input v-decorator="['userId']" /> <a-input v-decorator="['userId']" />
</a-form-item> </a-form-item>
<a-form-item <a-form-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="用户名" <a-input
:labelCol="labelCol" placeholder="请输入用户名"
:wrapperCol="wrapperCol" :disabled="registerDisabled"
has-feedback v-decorator="[
> 'userName',
<a-input placeholder="请输入用户名" :disabled="registerDisabled" v-decorator="['userName', {rules: [{required: true, message: '请输入用户名!'}]}]" /> { rules: [{ required: true, message: '请输入用户名!' }] },
]"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="姓名" <a-input
:labelCol="labelCol" placeholder="请输入姓名"
:wrapperCol="wrapperCol" :disabled="registerDisabled"
has-feedback v-decorator="['name', { rules: [{ required: true, message: '请输入姓名!' }] }]"
> />
<a-input placeholder="请输入姓名" :disabled="registerDisabled" v-decorator="['name', {rules: [{required: true, message: '请输入姓名'}]}]" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
@ -46,24 +47,21 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="身份证" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="身份证" <a-input
:labelCol="labelCol" placeholder="请输入身份证"
:wrapperCol="wrapperCol" v-decorator="[
has-feedback 'idCardNo',
> { rules: [{ required: true, message: '请输入身份证!' }] },
<a-input placeholder="请输入身份证" v-decorator="['idCardNo', {rules: [{required: true, message: '请输入身份证'}]}]" @blur="idCardNoBlur"/> ]"
@blur="idCardNoBlur"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="年龄" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="年龄"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input readOnly v-decorator="['age']" /> <a-input readOnly v-decorator="['age']" />
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -72,12 +70,11 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
label="性别" <a-radio-group
:labelCol="labelCol" readOnly
:wrapperCol="wrapperCol" v-decorator="['sex', { rules: [{ required: true, message: '请选择性别!' }] }]"
> >
<a-radio-group readOnly v-decorator="['sex',{rules: [{ required: true, message: '请选择性别' }]}]" >
<a-radio :value="1"></a-radio> <a-radio :value="1"></a-radio>
<a-radio :value="2"></a-radio> <a-radio :value="2"></a-radio>
</a-radio-group> </a-radio-group>
@ -86,13 +83,12 @@
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="手机号" <a-input
:labelCol="labelCol" :disabled="type == 2"
:wrapperCol="wrapperCol" placeholder="请输入手机号"
has-feedback v-decorator="['phone', { rules: [{ required: true, message: '请输入手机号!' }] }]"
> />
<a-input placeholder="请输入手机号" v-decorator="['phone',{rules: [{ required: true, message: '请输入手机号' }]}]" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
@ -106,8 +102,14 @@
:wrapperCol="{ span: 20 }" :wrapperCol="{ span: 20 }"
has-feedback has-feedback
> >
<a-select style="width: 100%" placeholder="请选择岗位" v-decorator="['jobs',{rules: [{ required: true, message: '请选择岗位' }]}]" > <a-select
<a-select-option v-for="(item,index) in jobsData" :key="index" :value="item.value" >{{ item.name }}</a-select-option> style="width: 100%"
placeholder="请选择岗位"
v-decorator="['jobs', { rules: [{ required: true, message: '请选择岗位!' }] }]"
>
<a-select-option v-for="(item, index) in jobsData" :key="index" :value="item.value">
{{ item.name }}
</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -116,28 +118,38 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="工种" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="工种" <a-select
:labelCol="labelCol" style="width: 100%"
:wrapperCol="wrapperCol" placeholder="请选择工种"
has-feedback v-decorator="['workType', { rules: [{ required: true, message: '请选择工种!' }] }]"
> >
<a-select style="width: 100%" placeholder="请选择工种" v-decorator="['workType',{rules: [{ required: true, message: '请选择工种' }]}]" > <a-select-option
<a-select-option v-for="(item,index) in workTypeData" :key="index" :value="item.value" >{{ item.name }}</a-select-option> v-for="(item, index) in workTypeData"
:key="index"
:value="item.value"
>
{{ item.name }}
</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
label="学历" <a-select
:labelCol="labelCol" style="width: 100%"
:wrapperCol="wrapperCol" placeholder="请选择学历"
has-feedback v-decorator="['degreeId', { rules: [{ required: true, message: '请选择学历!' }] }]"
> >
<a-select style="width: 100%" placeholder="请选择学历" v-decorator="['degreeId',{rules: [{ required: true, message: '请选择学历' }]}]" > <a-select-option
<a-select-option v-for="(item,index) in degreeData" :key="index" :value="item.value" >{{ item.name }}</a-select-option> v-for="(item, index) in degreeData"
:key="index"
:value="item.value"
>
{{ item.name }}
</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-form> </a-form>
@ -146,13 +158,16 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="人员类型" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20 }">
label="人员类型" <a-checkbox-group
:labelCol="{span: 3}" v-decorator="['type', { rules: [{ required: true, message: '请选择人员类型!' }] }]"
:wrapperCol="{span: 20}" >
<a-checkbox
name="type"
v-for="(item, index) in typeData"
:key="index"
:value="item.value"
> >
<a-checkbox-group v-decorator="['type',{rules: [{ required: true, message: '请选择人员类型!' }]}]">
<a-checkbox name="type" v-for="(item,index) in typeData" :key="index" :value="item.value" >
{{ item.name }} {{ item.name }}
</a-checkbox> </a-checkbox>
</a-checkbox-group> </a-checkbox-group>
@ -169,7 +184,17 @@
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
has-feedback has-feedback
> >
<a-input readOnly @click="openOrgTree" v-decorator="['orgName',{rules: [{ required: true, message: '请选择机构' }]}]" /> <a-input
v-if="type == 1"
readOnly
@click="openOrgTree"
v-decorator="['orgName', { rules: [{ required: true, message: '请选择机构!' }] }]"
/>
<a-input
v-else
readOnly
v-decorator="['orgName', { rules: [{ required: true, message: '请选择机构!' }] }]"
/>
</a-form-item> </a-form-item>
<a-form-item style="display: none;"> <a-form-item style="display: none;">
<a-input v-decorator="['orgId']" /> <a-input v-decorator="['orgId']" />
@ -177,7 +202,7 @@
</a-form> </a-form>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24"> <a-row :gutter="24" v-if="type == 1">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item
@ -196,21 +221,15 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="身份证正面" :labelCol="labelCol" :wrapperCol="wrapperCol">
label="身份证正面" <db-upload v-model="fileList" max="1" type="img"></db-upload>
:labelCol="labelCol"
:wrapperCol="wrapperCol">
<db-upload v-model="fileList" max="1" type='img'></db-upload>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="身份证反面" :labelCol="labelCol" :wrapperCol="wrapperCol">
label="身份证反面" <db-upload v-model="fileList2" max="1" type="img"></db-upload>
:labelCol="labelCol"
:wrapperCol="wrapperCol">
<db-upload v-model="fileList2" max="1" type='img'></db-upload>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
@ -220,20 +239,15 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<a-form :form="form"> <a-form :form="form">
<a-form-item <a-form-item label="图像" :labelCol="labelCol" :wrapperCol="wrapperCol">
label="图像" <db-upload v-model="fileList3" max="1" type="img" fileSize="500"></db-upload>
:labelCol="labelCol"
:wrapperCol="wrapperCol">
<db-upload v-model="fileList3" max="1" type='img' fileSize="500"></db-upload>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-col> </a-col>
</a-row> </a-row>
</a-spin> </a-spin>
<org-tree @selectOrg="selectOrg($event)" ref="orgModal" /> <org-tree @selectOrg="selectOrg($event)" ref="orgModal" />
</a-modal> </a-modal>
</template> </template>
@ -247,6 +261,12 @@
OrgTree, OrgTree,
DbUpload DbUpload
}, },
props: {
type: {
type: [String, Number],
default: 1 // 1: 2:
}
},
data () { data () {
return { return {
labelCol: { labelCol: {
@ -286,8 +306,7 @@
this.registerDisabled = true this.registerDisabled = true
setTimeout(() => { setTimeout(() => {
// //
this.form.setFieldsValue( this.form.setFieldsValue({
{
name: record.name, name: record.name,
userName: record.userName, userName: record.userName,
phone: record.phone, phone: record.phone,
@ -295,8 +314,7 @@
orgName: record.orgName, orgName: record.orgName,
id: record.personId, // personId id: record.personId, // personId
userId: record.userId userId: record.userId
} })
)
}, 100) }, 100)
this.confirmLoading = false this.confirmLoading = false
@ -311,16 +329,19 @@
this.registerDisabled = true this.registerDisabled = true
// //
personGet({ id: record.id }).then((res) => { personGet({ id: record.id }).then(res => {
if (res.code === 200) { if (res.code === 200) {
const data = res.data const data = res.data
// //
const type = data.type && data.type.split(',') || [] const type = (data.type && data.type.split(',')) || []
const typeIntArr = [] // const typeIntArr = [] //
type.forEach(item => { type.forEach(item => {
typeIntArr.push(+item) typeIntArr.push(+item)
}) })
this.form.getFieldDecorator('type', { valuePropName: 'checked', initialValue: typeIntArr }) this.form.getFieldDecorator('type', {
valuePropName: 'checked',
initialValue: typeIntArr
})
if (data.idPhotoFace) { if (data.idPhotoFace) {
this.fileList = JSON.parse(data.idPhotoFace) this.fileList = JSON.parse(data.idPhotoFace)
@ -335,8 +356,7 @@
url: data.avatar url: data.avatar
}) })
} }
this.form.setFieldsValue( this.form.setFieldsValue({
{
id: data.id, id: data.id,
userId: data.userId, userId: data.userId,
name: data.name, name: data.name,
@ -351,8 +371,7 @@
orgId: data.orgId, orgId: data.orgId,
orgName: data.orgName, orgName: data.orgName,
planClassHour: data.planClassHour planClassHour: data.planClassHour
} })
)
// //
this.analyzeIdCardNo(data.idCardNo) this.analyzeIdCardNo(data.idCardNo)
} else { } else {
@ -367,25 +386,27 @@
dictionaryDropDown () { dictionaryDropDown () {
this.formLoading = true this.formLoading = true
// //
dictionaryDropDown({ dictionaryCode: '0002' }).then((res) => { dictionaryDropDown({ dictionaryCode: '0002' }).then(res => {
this.jobsData = res.data this.jobsData = res.data
}) })
// //
dictionaryDropDown({ dictionaryCode: '0003' }).then((res) => { dictionaryDropDown({ dictionaryCode: '0003' }).then(res => {
this.workTypeData = res.data this.workTypeData = res.data
}) })
// //
dictionaryDropDown({ dictionaryCode: '0004' }).then((res) => { dictionaryDropDown({ dictionaryCode: '0004' }).then(res => {
this.degreeData = res.data this.degreeData = res.data
}) })
// //
dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => { dictionaryDropDown({ dictionaryCode: '0005' }).then(res => {
this.typeData = res.data this.typeData = res.data
this.formLoading = false this.formLoading = false
}) })
}, },
handleSubmit () { handleSubmit () {
const { form: { validateFields } } = this const {
form: { validateFields }
} = this
this.confirmLoading = true this.confirmLoading = true
const _this = this const _this = this
@ -410,14 +431,14 @@
} else { } else {
_this.addOrUpdate(values) _this.addOrUpdate(values)
} }
} else { } else {
this.confirmLoading = false this.confirmLoading = false
} }
}) })
}, },
addOrUpdate (values) { addOrUpdate (values) {
personAddOrUpdate(values).then((res) => { personAddOrUpdate(values).then(
res => {
this.confirmLoading = false this.confirmLoading = false
if (res.code === 200) { if (res.code === 200) {
this.$message.success('操作成功') this.$message.success('操作成功')
@ -427,9 +448,11 @@
} else { } else {
this.$message.error('操作失败:' + res.msg) this.$message.error('操作失败:' + res.msg)
} }
}, (err) => { },
err => {
this.$message.error(err) this.$message.error(err)
}) }
)
}, },
idCardNoBlur (event) { idCardNoBlur (event) {
const idCardNo = event.target.value const idCardNo = event.target.value

View File

@ -8,7 +8,7 @@
<a-button size="large" style="margin-left: 8px" @click="goHomeHandle">返回登录页</a-button> <a-button size="large" style="margin-left: 8px" @click="goHomeHandle">返回登录页</a-button>
</template> </template>
</a-result> </a-result>
<PersonForm ref="personForm"></PersonForm> <PersonForm ref="personForm" type="2"></PersonForm>
</div> </div>
</template> </template>