Commit 54cd76aa authored by zhanglw's avatar zhanglw

添加api

parent 8697e18e
......@@ -2,6 +2,7 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
VUE_APP_BASE_API = 'https://eladmin.vip'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'wss://eladmin.vip'
VUE_APP_BASE_API = 'http://192.168.3.23:7001'
VUE_APP_WS_API = 'ws://192.168.3.23:7001'
import request from '@/utils/request'
export const HttpReq = {
// 后台管理接口列表
backstageApi: {
// 上传营业执照图片
uploadBusinessLicense: function(data) {
return request({
url: '/api/bsw/users/updateBusinessLicense',
method: 'POST',
data: data
}).then((res) => {
return res
})
},
// 获取行政区划
findAreaByCodeAndType: function(param) {
return request({
url: '/api/bsw/users/findAreaByCodeAndType',
method: 'get',
params: param
})
}
}
}
......@@ -2,22 +2,144 @@
<!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="cancelView" :visible="visible" :title="title" width="860px">
<el-form ref="formViewRef" :model="formData" :rules="rules" :status-icon="true" label-width="240px">
<el-form-item label="标识设置:" class="form-cell" prop="rank">
<div class="cell-box">
<el-radio-group v-model="formData.rank" size="mini">
<el-radio v-for="item in dict.supplier_rank" :key="item.value" :label="item.value">
{{ item.label }}
</el-radio>
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="企业名称:" class="form-cell" prop="name">
<div class="cell-box">
<el-input v-model="formData.name" class="cell-input" />
<el-input v-model="formData.name" placeholder="请输入企业名称" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="企业联系人:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入联系人" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="企业联系人手机号:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入手机号" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="企业地址:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入地址" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="企业邮箱:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入邮箱" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="营业执照:" class="form-cell">
<div class="cell-box">
<el-input v-model="formData.picFileName" style="width:160px;" placeholder="请上传图片" disabled />
<input type="file" name="image" @change="excelImport($event)">
</div>
<el-image v-show="formData.picFileName" :src="formData.picFileName?imgSrcStart+'/businessLicense/'+formData.picFileName:''" :preview-src-list="[imgSrcStart+'/businessLicense/'+formData.picFileName]" style="width: 300px;">
<div slot="placeholder" class="image-slot">加载中<span class="dot">...</span></div>
</el-image>
</el-form-item>
<el-form-item label="统一社会信用代码:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入18位统一社会信用代码" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="纳税人识别号:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入纳税人识别号" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="所属行业:" class="form-cell" prop="hy">
<div class="cell-box">
<el-select v-model="formData.hy" placeholder="无" class="cell-input">
<el-select v-model="formData.hy" placeholder="无" class="cell-select">
<el-option v-for="item in dict.industry_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="营业执照:" class="form-cell">
<el-form-item label="登记机关:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.photo" style="width:160px;" placeholder="请上传营业执照" disabled />
<input type="file" name="image" @change="excelImport($event)">
<el-input v-model="formData.xxxxx" placeholder="请输入登记机关" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="法定代表人:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="请输入法定代表人" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="经营状态:" class="form-cell" prop="zt">
<div class="cell-box">
<el-select v-model="formData.zt" placeholder="无" class="cell-select">
<el-option v-for="item in dict.business_status" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="成立日期:" class="form-cell" prop="zt">
<div class="cell-box">
<el-date-picker v-model="formData.date" type="date" placeholder="请选择日期" />
</div>
</el-form-item>
<el-form-item label="经营期限:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="审核/年检日期:" class="form-cell" prop="zt">
<div class="cell-box">
<el-date-picker v-model="formData.date" type="date" placeholder="请选择日期" />
</div>
</el-form-item>
<el-form-item label="企业类型:" class="form-cell" prop="lx">
<div class="cell-box">
<el-select v-model="formData.lx" placeholder="无" class="cell-select">
<el-option v-for="item in dict.company_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
</el-form-item>
<el-form-item label="注册资本:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.xxxxx" type="number" placeholder="请输入数字" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="注册地址:" class="form-cell" prop="lx">
<div class="cell-box">
<el-select v-model="formData.province" placeholder="省" style="width: 120px" @change="findAreaByCodeAndType(formData.province,2, 'cityOpts')">
<el-option v-for="item in provinceOpts" :key="item.id" :label="item.name" :value="item.code" />
</el-select>
<el-select v-model="formData.city" placeholder="市" style="width: 160px" @change="findAreaByCodeAndType(formData.city,3, 'countyOpts')">
<el-option v-for="item in cityOpts" :key="item.id" :label="item.name" :value="item.code" />
</el-select>
<el-select v-model="formData.county" placeholder="区/县" style="width: 160px">
<el-option v-for="item in countyOpts" :key="item.id" :label="item.name" :value="item.code" />
</el-select>
</div>
<div class="cell-box">
<el-input v-model="formData.xxxxx" placeholder="详细地址(例如:和平路北大街106号)" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="经营范围:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.textarea" type="textarea" placeholder="请输入文本内容" maxlength="1000" :autosize="{ minRows: 4, maxRows: 6}" show-word-limit resize="none" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="企业介绍:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.textarea" type="textarea" placeholder="请输入文本内容" maxlength="1000" :autosize="{ minRows: 4, maxRows: 6}" show-word-limit resize="none" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="主营产品:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.textarea" type="textarea" placeholder="请输入文本内容" maxlength="1000" :autosize="{ minRows: 4, maxRows: 6}" show-word-limit resize="none" class="cell-input" />
</div>
</el-form-item>
<el-form-item label="业务范围:" class="form-cell" prop="xxxxx">
<div class="cell-box">
<el-input v-model="formData.textarea" type="textarea" placeholder="请输入文本内容" maxlength="1000" :autosize="{ minRows: 4, maxRows: 6}" show-word-limit resize="none" class="cell-input" />
</div>
</el-form-item>
</el-form>
......@@ -28,14 +150,24 @@
</el-dialog>
</template>
<script>
import { HttpReq } from '@/api/common.js'
export default {
dicts: ['industry_type'],
dicts: ['industry_type', 'supplier_rank', 'company_type', 'business_status'],
data() {
return {
imgSrcStart: process.env.VUE_APP_BASE_API,
visible: false,
title: '客户信息',
provinceOpts: [],
cityOpts: [],
countyOpts: [],
formData: {
rank: '1',
picFileName: '',
province: null,
city: null,
county: null,
name: ''
},
rules: {
......@@ -45,6 +177,7 @@ export default {
},
mounted() {
this.$nextTick(() => {
this.findAreaByCodeAndType(0, 1, 'provinceOpts')
this.loadData()
})
},
......@@ -54,6 +187,8 @@ export default {
},
hideView() {
this.$refs.formViewRef.resetFields()
this.cityOpts = []
this.countyOpts = []
this.visible = false
},
cancelView() {
......@@ -62,14 +197,40 @@ export default {
submitForm() {
this.$refs.formViewRef.validate(valid => {
if (valid) {
console.log(this.formData)
}
})
},
excelImport(event) {
const file = event.target.files[0]
const formData = new FormData()
formData.append('files', file)
formData.append('businessLicense', file)
HttpReq.backstageApi.uploadBusinessLicense(formData).then((res) => {
this.$nextTick(() => {
this.formData.picFileName = res.businessLicense
this.$notify({
title: '上传成功!',
type: 'success',
duration: 2500
})
})
})
},
findAreaByCodeAndType(code, type, optsName) {
switch (optsName) {
case 'provinceOpts':
case 'cityOpts':
this.formData.city = null
this.formData.county = null
break
case 'countyOpts':
this.formData.county = null
}
HttpReq.backstageApi.findAreaByCodeAndType({
code, type
}).then((res) => {
this[optsName] = res
})
},
loadData() {
......@@ -84,6 +245,9 @@ export default {
.cell-input {
width: 420px;
}
.cell-select {
width: 220px;
}
>>>.el-input__inner {
border: 1px solid rgba(100, 100, 100, 0.1);
border-bottom: 1px solid rgba(100, 100, 100, 0.2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment