Commit 028cc576 by 胡悦

添加特约店

1 parent 078e5c52
......@@ -14,7 +14,10 @@ const API = {
}
// 公共接口
const COMMON_API = {
PROVINCE_LIST: '/publiccenter/basic/province/list'
PROVINCE_LIST: '/publiccenter/basic/province/list',
DICTDATA_TYPE: '/publiccenter/dict/data/type',
ORGINIZA_SIMPLELIST: '/usercenter/organization/simplelist',
ORGINIZA_SIMPLEROOT: '/usercenter/organization/simpleroot'
}
// 特约店接口
const SPECIALSHOP_API = {
......
......@@ -7,4 +7,22 @@ function getProvinceList (params) {
return request(params, url)
}
export { getProvinceList }
// 获取字典详情
function dictInfo (params) {
const url = `${DICT_API.DICTDATA_TYPE}/${params}`
return request({}, url)
}
// 获取第一级组织列表树
function getSimpleRoot (params) {
const url = COMMON_API.ORGINIZA_SIMPLEROOT
return request(params, url)
}
// 获取组织列表树
function getSimpleList (params) {
const url = COMMON_API.ORGINIZA_SIMPLELIST
return request(params, url)
}
export { getProvinceList, dictInfo, getSimpleRoot, getSimpleList }
......@@ -92,8 +92,8 @@ const MOCK_CONFIG_URL = 'https://oss-config.test.glsx.com.cn/mock/60a371eafb9c10
let baseFlag = true
const getBaseUrl = () => {
return new Promise((resolve, reject) => {
// let BASE_URL = store.state.baseURL
let BASE_URL = 'https://oss-config.test.glsx.com.cn/mock/60a75fe7fb9c105681999abe/trialrun'
let BASE_URL = store.state.baseURL
// let BASE_URL = 'https://oss-config.test.glsx.com.cn/mock/60a75fe7fb9c105681999abe/trialrun'
if (!BASE_URL && baseFlag) {
baseFlag = false
instance({
......
......@@ -11,33 +11,82 @@
<el-form-item label="特约店名称:">
<el-input
v-model="shopForm.shopName"
:size="btn_size"
placeholder="请输入特约店名称"
></el-input>
</el-form-item>
<el-form-item label="特约店编码:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
Placeholder="请输入特约店编码"
></el-input>
</el-form-item>
<el-form-item label="特约店级别:">
<el-radio-group v-model="shopForm.shopLevel">
<el-radio label="">一级店</el-radio>
<el-radio label="">二级店</el-radio>
<el-radio label="1">一级店</el-radio>
<el-radio label="2">二级店</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<h2>特约店围栏配置</h2>
<el-divider></el-divider>
<el-form
ref="configForm"
:model="configForm"
label-width="130px"
:inline="true"
>
<el-form-item label="特约店围栏名称:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
Placeholder="请输入特约店编码"
></el-input>
</el-form-item>
<el-form-item label="特约店围栏名称:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
Placeholder="请输入特约店编码"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:size="btn_size"
>更新围栏</el-button>
</el-form-item>
<el-form-item label="经度:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
></el-input>
</el-form-item>
<el-form-item label="纬度:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
></el-input>
</el-form-item>
<el-form-item label="特约店详细地址:">
<el-input
v-model="shopForm.shopCode"
:size="btn_size"
></el-input>
</el-form-item>
</el-form>
<div class="ibox-content" style="height: 500px; padding:0 20px;z-index: 100">
<fence-map
:mapData="mapData"
@onUpdateMapData="updateMapData"
ref="fenceMap"
>
</fence-map>
</div>
<div
class="ibox-content"
style="height: 500px; padding:0 20px;z-index: 100"
>
<fence-map
:mapData="mapData"
@onUpdateMapData="updateMapData"
ref="fenceMap"
>
</fence-map>
</div>
</div>
</template>
......@@ -48,6 +97,7 @@ export default {
data() {
return {
shopForm: {},
configForm: {},
mapData: []
}
},
......@@ -56,94 +106,94 @@ export default {
},
methods: {
init() {
this.fenceId = this.$route.query.id
if(typeof this.fenceId != 'undefined'){
this.getFenceDetail(this.fenceId);
this.getFenceSnsList(this.fenceId);
}else{
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// if(res.returnCode == 0){
// this.form.fenceNo = res.data.fenceNo;
this.fenceId = this.$route.query.id
if (typeof this.fenceId != 'undefined') {
this.getFenceDetail(this.fenceId);
this.getFenceSnsList(this.fenceId);
} else {
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// if(res.returnCode == 0){
// this.form.fenceNo = res.data.fenceNo;
// this.$refs.fenceMap.initFence({
// fenceType: 'circle'
// });
// }
// });
// this.$refs.fenceMap.initFence({
// fenceType: 'circle'
// });
// }
// });
// this.restainFenceName = undefined;
}
// this.restainFenceName = undefined;
}
},
getFenceDetail(id){
MONITOR_SERVICE.getFenceDetailById({id: id}).then((res)=>{
if(res.returnCode == 0){
const form = this.form;
const data = res.data;
for(let key in data){
form[key] = data[key]
}
this.form.dateRange = [form.startTime, form.endTime];
this.areaCode = form.areaCode
this.restainFenceName = form.electricFenceName;
this.form.msgtel = data.telNumbers
if(form.shapeType === 2){
this.mapData = {
fenceType: 'circle',
lng: form.lng,
lat: form.lat,
radius: form.radius,
}
}else if(form.shapeType === 3){
this.mapData = {
fenceType: 'area',
areaCode: this.form.areaCode
}
}else if(form.shapeType === 5){
if(data.lnglat){
this.polygonPath = data.lnglat.split('|').map((item)=>{
return [item.split(',')[0], item.split(',')[1]]
})
}
getFenceDetail(id) {
MONITOR_SERVICE.getFenceDetailById({ id: id }).then((res) => {
if (res.returnCode == 0) {
const form = this.form;
const data = res.data;
for (let key in data) {
form[key] = data[key]
}
this.form.dateRange = [form.startTime, form.endTime];
this.areaCode = form.areaCode
this.restainFenceName = form.electricFenceName;
this.form.msgtel = data.telNumbers
console.log(this.polygonPath)
this.mapData = {
fenceType: 'polygon',
polygonPath: this.polygonPath
}
}
this.$refs.fenceMap.initFence(this.mapData);
}
});
},
getFenceSnsList(id,cur){
let params = {};
if(this.currentPage>this.maxPage){
return;
}
if(cur){
params.currentPage =cur;
params.pageSize = this.pageSize;
}else{
params.currentPage =this.currentPage;
params.pageSize = this.pageSize;
}
params.id=id;
MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
if(res.draw == 0){
this.tableData = this.tableData.concat(res.data);
this.maxPage = Math.ceil(res.recordsTotal/this.pageSize);
this.$refs.userList.reset(res.data);
}
});
},
if (form.shapeType === 2) {
this.mapData = {
fenceType: 'circle',
lng: form.lng,
lat: form.lat,
radius: form.radius,
}
} else if (form.shapeType === 3) {
this.mapData = {
fenceType: 'area',
areaCode: this.form.areaCode
}
} else if (form.shapeType === 5) {
if (data.lnglat) {
this.polygonPath = data.lnglat.split('|').map((item) => {
return [item.split(',')[0], item.split(',')[1]]
})
}
console.log(this.polygonPath)
this.mapData = {
fenceType: 'polygon',
polygonPath: this.polygonPath
}
}
this.$refs.fenceMap.initFence(this.mapData);
}
});
},
getFenceSnsList(id, cur) {
let params = {};
if (this.currentPage > this.maxPage) {
return;
}
if (cur) {
params.currentPage = cur;
params.pageSize = this.pageSize;
} else {
params.currentPage = this.currentPage;
params.pageSize = this.pageSize;
}
params.id = id;
MONITOR_SERVICE.getFenceSnsList(params).then((res) => {
if (res.draw == 0) {
this.tableData = this.tableData.concat(res.data);
this.maxPage = Math.ceil(res.recordsTotal / this.pageSize);
this.$refs.userList.reset(res.data);
}
});
},
updateMapData() {
}
......
......@@ -6,8 +6,52 @@
:formModel="searchForm"
:formList="shopFormList"
>
<slot name="self">
<el-select
v-model="searchForm.area"
placeholder="请选择"
@change="change('area', searchForm.area)"
clearable
>
<el-option
v-for="item in areaList"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
<el-select
v-model="searchForm.province"
placeholder="请选择"
@change="change('province', searchForm.province)"
clearable
>
<el-option
v-for="item in provinceList"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
<el-select
v-model="searchForm.city"
placeholder="请选择"
clearable
>
<el-option
v-for="item in cityList"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
</slot>
<slot name="form-slot">
<el-button
style="margin-left: 20px;"
type="primary"
:size="btn_size"
icon="el-icon-search"
......@@ -17,6 +61,7 @@
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="reset"
>重置</el-button>
</slot>
</search-form>
......@@ -66,6 +111,7 @@
<script>
import { getList } from 'services/specialshop'
import { getSimpleRoot, getSimpleList } from 'services/common'
export default {
data() {
return {
......@@ -151,10 +197,22 @@ export default {
type: 'default',
pType: 'export'
}
]
],
areaList: [],
provinceList: [],
cityList: []
}
},
mounted() {
getSimpleRoot({}).then(res => {
console.log(res)
this.areaList = res.data
})
},
methods: {
reset() {
this.searchForm = {}
},
btnClick(pType, scope) {
console.log(pType)
switch (pType) {
......@@ -162,13 +220,31 @@ export default {
this.$router.push({ name: 'addShop' })
break
}
},
change(name, val) {
console.log(name, val)
if (name == 'province' && this.searchForm.city) this.searchForm.city = ''
if (name == 'area') {
if (this.searchForm.province) this.searchForm.province = ''
if (this.searchForm.city) this.searchForm.city = ''
}
getSimpleList({ rootId: val }).then(res => {
if (name == 'area') this.provinceList = res.data
else this.cityList = res.data
})
}
},
}
</script>
<style>
.vehicle .el-form .el-input__inner {
width: 300px;
<style scope>
.search-form .el-form-item {
max-width: none !important;
}
.el-select {
width: auto;
}
.vehicle .el-form .el-select .el-input {
width: 150px;
}
</style>
\ No newline at end of file
......@@ -195,7 +195,6 @@ export default {
}
],
tableOption: {
width: 300,
btnList: [
{
name: '编辑',
......@@ -401,7 +400,7 @@ export default {
}
</script>
<style>
<style scope>
.vehicle .el-form .el-input__inner {
width: 300px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!