pull/1/head^2
parent
2594c97ec2
commit
70d54bcfa5
14 changed files with 513 additions and 445 deletions
@ -0,0 +1,33 @@ |
||||
import request from "utils/axios.js"; |
||||
// table
|
||||
const getByPage = (params) => { |
||||
return request.postJson("/oil-user/oilCompanyInfo/getByPage", params); |
||||
}; |
||||
|
||||
//详情
|
||||
const getCompanyAccountRecord = (params) => { |
||||
return request.postJson( |
||||
"oil-finance/oilCompanyAccountRecord/getCompanyAccountRecord", |
||||
params |
||||
); |
||||
}; |
||||
//启禁用
|
||||
const update = (params) => { |
||||
return request.postJson("oil-user/oilCompanyInfo/update", params); |
||||
}; |
||||
//企业负责人 远程搜索
|
||||
const liekQuery = (query) => { |
||||
return request.get(`/oil-user/sysCustomerInfo/liekQuery/${query}`); |
||||
}; |
||||
//保存
|
||||
const save = (params) => { |
||||
return request.postJson("/oil-user/oilCompanyInfo/save", params); |
||||
}; |
||||
|
||||
export default { |
||||
getByPage, |
||||
getCompanyAccountRecord, |
||||
update, |
||||
liekQuery, |
||||
save, |
||||
}; |
@ -0,0 +1,209 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="controlWindows.addInfo.title" |
||||
width="50%" |
||||
:visible.sync="controlWindows.add" |
||||
@opened="openDrawer" |
||||
:before-close="closeWindow" |
||||
> |
||||
<div class="add"> |
||||
<el-form ref="form" :rules="rules" :model="form" label-width="100px"> |
||||
<el-row :gutter="2"> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业名称" prop="name"> |
||||
<el-input v-model="form.name" placeholder="企业名称" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业简称" prop="abbreviaName"> |
||||
<el-input |
||||
v-model="form.abbreviaName" |
||||
placeholder="企业简称" |
||||
clearable |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="公司级别" prop="parentMark"> |
||||
<el-select v-model="form.parentMark" placeholder="请选择"> |
||||
<el-option label="主体公司" :value="0" /> |
||||
<el-option label="分公司" :value="1" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col v-if="form.parentMark === 1" :span="12"> |
||||
<el-form-item label="上级公司" prop="parentId"> |
||||
<!-- 企业名称 --> |
||||
<autocomplete |
||||
class="mr20" |
||||
:params="form" |
||||
:config="configAutocomplete" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业性质" prop="companyNature"> |
||||
<el-select v-model="form.companyNature" placeholder="请选择"> |
||||
<el-option |
||||
v-for="(item, index) in companyNatureTypeEnum" |
||||
:key="index" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="账户类型" prop="companyType"> |
||||
<el-select v-model="form.companyType" placeholder="请选择"> |
||||
<el-option label="油批账户" :value="4" /> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="企业负责人" prop="businessLeader"> |
||||
<!-- 企业名称 --> |
||||
<autocomplete |
||||
class="mr20" |
||||
:params="form" |
||||
:config="configAutocompleteLeader" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="公司对接类型" prop="companyDockType"> |
||||
<el-select v-model="form.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="closeWindow">取消</el-button> |
||||
<el-button type="primary" @click="submit">提交</el-button> |
||||
</el-col> |
||||
</el-form> |
||||
</div> |
||||
</el-dialog> |
||||
</template> |
||||
<script> |
||||
import serve from "api/customerManagement/companyManagement.js"; |
||||
import commonServe from "api/common.js"; |
||||
|
||||
import autocomplete from "components/autocomplete/index.vue"; |
||||
export default { |
||||
components: { |
||||
autocomplete, |
||||
}, |
||||
props: { |
||||
controlWindows: Object, |
||||
companyNatureTypeEnum: Array, |
||||
}, |
||||
data() { |
||||
let validatorParentId = (rule, value, callback) => { |
||||
if (this.form.parentId) callback(); |
||||
else callback("请选择企业"); |
||||
}; |
||||
return { |
||||
configAutocomplete: { |
||||
serveTarget: commonServe.getRefineryCompanyList, |
||||
autocompleteKey: "name", |
||||
labelKey: "name", |
||||
valueKey: "id", |
||||
placeholder: "企业名称", |
||||
querykey: "parentId", |
||||
}, |
||||
configAutocompleteLeader: { |
||||
serveTarget: serve.liekQuery, |
||||
labelKey: "nickName", |
||||
valueKey: "id", |
||||
placeholder: "企业负责人", |
||||
querykey: "businessLeader", |
||||
}, |
||||
form: {}, |
||||
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" }, |
||||
], |
||||
parentId: [ |
||||
{ required: true, validator: validatorParentId, trigger: "change" }, |
||||
], |
||||
companyNature: [ |
||||
{ required: true, message: "请选择企业性质", trigger: "change" }, |
||||
], |
||||
companyType: [ |
||||
{ required: true, message: "请选择账户类型", trigger: "change" }, |
||||
], |
||||
}, |
||||
}; |
||||
}, |
||||
created() {}, |
||||
methods: { |
||||
openDrawer() { |
||||
let { id } = this.controlWindows.addInfo; |
||||
if (id) { |
||||
//回显 |
||||
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo)); |
||||
} |
||||
}, |
||||
|
||||
submit() { |
||||
this.$refs["form"].validate((valid) => { |
||||
if (valid) { |
||||
this.judgeInterface(this.form).then((res) => { |
||||
if (res.code === 20000) { |
||||
this.$message.success(res.msg); |
||||
this.closeWindow(); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
}, |
||||
judgeInterface(form) { |
||||
let { id } = this.controlWindows.addInfo; |
||||
if (id) return serve.update(form); |
||||
else return serve.save(form); |
||||
}, |
||||
|
||||
closeWindow() { |
||||
this.$emit("closeWindow"); |
||||
this.form = {}; |
||||
this.controlWindows.addInfo = {}; |
||||
this.$nextTick(() => { |
||||
this.$refs.form.clearValidate(); |
||||
this.controlWindows.add = false; |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.add { |
||||
padding: 20px; |
||||
.el-input, |
||||
.el-select, |
||||
.el-textarea, |
||||
.el-autocomplete { |
||||
width: 230px; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue