pull/1/head
parent
31deda59a9
commit
b41b738cbb
2 changed files with 241 additions and 9 deletions
@ -0,0 +1,219 @@ |
||||
<template> |
||||
<div> |
||||
<el-row> |
||||
<el-form ref="form" :rules="rules" :model="updateOilCompanyInfo" label-width="100px" :size="$store.getters.size"> |
||||
<el-row :gutter="gridNum.row.gutter"> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业名称" prop="name"> |
||||
<el-input v-model="updateOilCompanyInfo.name" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业简称" prop="abbreviaName"> |
||||
<el-input v-model="updateOilCompanyInfo.abbreviaName" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="公司级别" prop="parentMark"> |
||||
<el-select v-model="updateOilCompanyInfo.parentMark" placeholder="请选择"> |
||||
<el-option label="主体公司" :value="0" /> |
||||
<el-option label="分公司" :value="1" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col v-if="updateOilCompanyInfo.parentMark === 1" :span="12"> |
||||
<el-form-item label="上级公司" prop="parentId"> |
||||
<el-select v-model="updateOilCompanyInfo.parentId" remote filterable :remote-method="companyOrginQuery" style="width: 100%" placeholder="请输入公司名称"> |
||||
<el-option |
||||
v-for="item in queryCompanyList" |
||||
:key="item.id" |
||||
:label="item.name" |
||||
:value="item.id" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业性质" prop="companyNature"> |
||||
<el-select v-model="updateOilCompanyInfo.companyNature" placeholder="请选择"> |
||||
<el-option label="零售客户" :value="0" /> |
||||
<el-option label="外请客户" :value="1" /> |
||||
<el-option label="渠道客户" :value="2" /> |
||||
<el-option label="存量客户" :value="3" /> |
||||
<el-option label="批发客户" :value="4" /> |
||||
<el-option label="LNG客户" :value="5" /> |
||||
<el-option label="推广业务" :value="6" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="账户类型" prop="companyType"> |
||||
<el-select v-model="updateOilCompanyInfo.companyType" :disabled="updateOilCompanyInfo.auditMark === 1 ? true : false" placeholder="请选择"> |
||||
<el-option label="柴油账户" value="0" /> |
||||
<el-option label="LNG账户" value="2" /> |
||||
<el-option label="汽油账户" value="1" /> |
||||
<el-option label="尿素账户" value="3" /> |
||||
<el-option label="油批账户" value="4" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业负责人" prop="businessLeader"> |
||||
<el-select |
||||
v-model="updateOilCompanyInfo.businessLeader" |
||||
clearable |
||||
filterable |
||||
remote |
||||
reserve-keyword |
||||
placeholder="企业负责人姓名或联系方式" |
||||
:remote-method="userRemoteMethod" |
||||
> |
||||
<el-option |
||||
v-for="item in userList" |
||||
:key="item.id" |
||||
:label="item.phone+'('+(item.nickName?item.nickName+'-':'')+item.userCode+')'" |
||||
:value="item.id" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="公司对接类型" prop="companyDockType"> |
||||
<el-select v-model="updateOilCompanyInfo.companyDockType" placeholder="请选择"> |
||||
<el-option label="对接客户" :value="0" /> |
||||
<el-option label="平台客户" :value="1" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-col :span="24" style="text-align: right"> |
||||
<el-button @click="close">取消</el-button> |
||||
<el-button |
||||
type="primary" |
||||
@click="submit" |
||||
>提交</el-button> |
||||
</el-col> |
||||
</el-form> |
||||
</el-row> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import oilCompanyInfoApi from '@/api/customerManagement/oilCompanyInfo' |
||||
import sysCustomerInfoApi from '@/api/user/sysCustomerInfo' |
||||
export default { |
||||
props: { |
||||
oilCompanyInfo: { |
||||
type: Object, |
||||
default() { |
||||
|
||||
} |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
queryCompanyList: [], // 企业列表 |
||||
|
||||
updateOilCompanyInfo: { |
||||
id: undefined, |
||||
name: undefined, |
||||
abbreviaName: undefined, |
||||
parentMark: undefined, |
||||
parentId: undefined, |
||||
companyNature: undefined, |
||||
updateSource: 'WEBM', |
||||
businessLeader: '' |
||||
}, |
||||
userList: [], |
||||
rules: { |
||||
name: [ |
||||
{ required: true, message: '请输入企业名称', trigger: 'blur' }, |
||||
{ min: 3, max: 50, message: '长度在 3 到 50 个字符', trigger: 'blur' } |
||||
], |
||||
abbreviaName: [ |
||||
{ min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' } |
||||
], |
||||
parentMark: [ |
||||
{ required: true, message: '请选择是否主体公司', trigger: 'change' } |
||||
], |
||||
companyNature: [ |
||||
{ required: true, message: '请选择企业性质', trigger: 'change' } |
||||
], |
||||
companyType: [ |
||||
{ required: true, message: '请选择账户类型', trigger: 'change' } |
||||
], |
||||
parentId: [ |
||||
{ required: true, message: '请选择上级公司', trigger: 'change' } |
||||
] |
||||
}, |
||||
gridNum: { |
||||
row: { |
||||
gutter: 2 |
||||
}, |
||||
cols: { |
||||
xs: 24, |
||||
sm: 24, |
||||
md: 12, |
||||
lg: 12, |
||||
xl: 6 |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
created() { |
||||
this.updateOilCompanyInfo = { ...this.oilCompanyInfo } |
||||
console.log('修改值') |
||||
console.log(this.updateOilCompanyInfo) |
||||
|
||||
sysCustomerInfoApi.getByBusinessLeader(this.updateOilCompanyInfo.businessLeader).then(res => { |
||||
if (res && res.data != null) { |
||||
this.userList = [res.data] |
||||
} else { |
||||
this.userList = [] |
||||
} |
||||
}) |
||||
|
||||
if (this.oilCompanyInfo.parentMark === 1) { |
||||
oilCompanyInfoApi.getLikeByName({ 'id': this.updateOilCompanyInfo.parentId }).then(res => { |
||||
this.queryCompanyList = res.data |
||||
}) |
||||
} |
||||
}, |
||||
methods: { |
||||
companyOrginQuery(value) { // 远程搜索 |
||||
if (value) { |
||||
oilCompanyInfoApi.getLikeByNameAndId({ name: value, id: this.updateOilCompanyInfo.id }).then(res => { |
||||
this.queryCompanyList = res.data |
||||
}) |
||||
} |
||||
}, |
||||
userRemoteMethod(value) { // 远程搜索 |
||||
if (value) { |
||||
sysCustomerInfoApi.liekQuery(value).then(res => { |
||||
this.userList = res.data |
||||
}) |
||||
} |
||||
}, |
||||
submit() { |
||||
this.$refs['form'].validate((valid) => { |
||||
if (valid) { |
||||
this.update(this.updateOilCompanyInfo) |
||||
} |
||||
}) |
||||
}, |
||||
update() { |
||||
if (this.updateOilCompanyInfo.parentMark === 0) { |
||||
this.updateOilCompanyInfo.parentId = 0 |
||||
} |
||||
// 更新 |
||||
oilCompanyInfoApi.update(this.updateOilCompanyInfo).then(res => { |
||||
this.$message.success(res.msg) |
||||
this.$emit('closeDialog') |
||||
this.$emit('getByPage') |
||||
}) |
||||
}, |
||||
close() { |
||||
this.$emit('closeDialog') |
||||
} |
||||
} |
||||
} |
||||
</script> |
Loading…
Reference in new issue