【修改】修改企业管理员问题
This commit is contained in:
@@ -8,17 +8,17 @@
|
||||
<a-row>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入用户账号" v-model="queryParam.name" :maxLength='50'></a-input>
|
||||
<a-input placeholder="请输入用户账号" v-model="queryParam.username" :maxLength='50'></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入用户姓名" v-model="queryParam.companyName" :maxLength='50'></a-input>
|
||||
<a-input placeholder="请输入用户姓名" v-model="queryParam.name" :maxLength='50'></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<a-form-item label="企业名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入企业名称" v-model="queryParam.phone" :maxLength='11'></a-input>
|
||||
<a-input placeholder="请输入企业名称" v-model="queryParam.companyName" :maxLength='11'></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
@@ -49,7 +49,6 @@
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:scroll="{x: 1500}"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
@@ -120,33 +119,27 @@ export default {
|
||||
}, {
|
||||
title: '用户账号',
|
||||
align: 'center',
|
||||
width: 280,
|
||||
dataIndex: 'username',
|
||||
scopedSlots: {customRender: 'text'}
|
||||
}, {
|
||||
title: '用户姓名',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
dataIndex: 'name'
|
||||
}, {
|
||||
title: '企业名称',
|
||||
align: 'center',
|
||||
width: 280,
|
||||
dataIndex: 'companyName',
|
||||
scopedSlots: {customRender: 'text'}
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
width: 150,
|
||||
dataIndex: 'status'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 160,
|
||||
scopedSlots: {customRender: 'action'}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
@@ -22,23 +21,19 @@
|
||||
<a-row :gutter="24">
|
||||
<a-col :xl="24" :sm="24">
|
||||
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<select-contacts :selected-company="selectedCompany"
|
||||
placeholder="请选择"
|
||||
v-decorator="['companyContactId',validatorRules.companyContactId]"
|
||||
:maxLength='50'
|
||||
:init-contacts="selectPerson"
|
||||
@change="changeContact"
|
||||
ref="selectPerson"
|
||||
@ok="addContactsOk"></select-contacts>
|
||||
<a-input placeholder="请输入用户姓名"
|
||||
@change="event => event.target.value = event.target.value.trim()" :maxLength="50"
|
||||
v-decorator="['name',validatorRules.name]"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="24">
|
||||
<a-col :xl="24" :sm="24">
|
||||
<a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入用户账号"
|
||||
@change="event => event.target.value = event.target.value.trim()" :maxLength="50"
|
||||
v-decorator="['username']"></a-input>
|
||||
v-decorator="['username',validatorRules.username]"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -48,7 +43,7 @@
|
||||
<a-input placeholder="请输入手机号"
|
||||
@change="(e) => {e.target.value = e.target.value.replace(/[^0-9]/g,'')}"
|
||||
:maxLength="11"
|
||||
v-decorator="['phone']"></a-input>
|
||||
v-decorator="['phone',validatorRules.phone]"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -61,15 +56,14 @@
|
||||
import pick from 'lodash.pick'
|
||||
import { httpAction } from '@api/manage'
|
||||
import CompanySelect from '@comp/company/CompanySelect'
|
||||
import SelectContacts from '@comp/company/SelectContacts'
|
||||
import {getRSAPublicKey} from '@api/login'
|
||||
import {JSEncrypt} from 'jsencrypt'
|
||||
import {phoneReg} from '@/utils/validate'
|
||||
|
||||
export default {
|
||||
name: 'CompanyAdminModule',
|
||||
components:{
|
||||
CompanySelect,
|
||||
SelectContacts
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -81,7 +75,6 @@ export default {
|
||||
c:'',// 加密公钥
|
||||
model: {},
|
||||
selectedCompany:null,// 选择的公司
|
||||
selectPerson:null, // 回显的公司人员
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 }
|
||||
@@ -99,12 +92,20 @@ export default {
|
||||
sm: { span: 21 }
|
||||
},
|
||||
validatorRules: {
|
||||
companyName: {
|
||||
rules: [{ required: true, validator: this.checkCompanyName }],
|
||||
companyId: {
|
||||
rules: [{ required: true, message: '请选择公司' }],
|
||||
validateTrigger: 'change'
|
||||
},
|
||||
name: {
|
||||
rules: [{ required: true, message: '请输入用户姓名' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
companyAddress: {
|
||||
rules: [{ required: true, message: '请输入公司地址' }],
|
||||
username: {
|
||||
rules: [{ required: true, message: '请输入用户账号' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
phone: {
|
||||
rules: [{ required: true, validator: this.validatePhone }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
},
|
||||
@@ -122,9 +123,16 @@ export default {
|
||||
this.form.resetFields()
|
||||
this.getRSAPublicKeyFunc()
|
||||
this.model = Object.assign({}, record)
|
||||
// 回显企业
|
||||
this.model.companyId = {
|
||||
id:this.model.companyId,
|
||||
companyName:this.model.companyName
|
||||
}
|
||||
// 回显姓名
|
||||
this.selectedCompany = this.model.companyId
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model))
|
||||
this.form.setFieldsValue(pick(this.model,'username','phone','companyId','name'))
|
||||
})
|
||||
},
|
||||
/**
|
||||
@@ -134,18 +142,7 @@ export default {
|
||||
this.selectedCompany = value
|
||||
console.log(value,'选择公司')
|
||||
},
|
||||
/**
|
||||
* 选择公司人员
|
||||
* */
|
||||
changeContact(val){
|
||||
console.log(val,'选择人员')
|
||||
},
|
||||
/**
|
||||
* 选择人员后的回调
|
||||
* */
|
||||
addContactsOk(){
|
||||
this.$refs.selectPerson.getContactsList()
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取公钥
|
||||
* */
|
||||
@@ -157,6 +154,7 @@ export default {
|
||||
close() {
|
||||
this.$emit('close')
|
||||
this.visible = false
|
||||
this.selectedCompany = null
|
||||
},
|
||||
handleOk: function () {
|
||||
if (this.confirmLoading) {
|
||||
@@ -176,7 +174,7 @@ export default {
|
||||
}
|
||||
const formData = Object.assign(this.model, values)
|
||||
formData.companyName = this.selectedCompany.companyName
|
||||
formData.companyId = this.selectedCompany.companyId
|
||||
formData.companyId = this.selectedCompany.id
|
||||
let encrypt = new JSEncrypt()
|
||||
encrypt.setPublicKey(this.rsaPublicKey)
|
||||
formData.phone = encrypt.encrypt(values.phone)
|
||||
@@ -202,6 +200,20 @@ export default {
|
||||
handleCancel() {
|
||||
this.close()
|
||||
},
|
||||
/**
|
||||
* 手机号校验
|
||||
* */
|
||||
validatePhone(rule,value,callback){
|
||||
if(!value){
|
||||
callback(new Error('请输入手机号'))
|
||||
}
|
||||
|
||||
if(value && phoneReg(value)) {
|
||||
callback()
|
||||
}else {
|
||||
callback(new Error('手机号格式不正确'))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user