Commit c2d30b63 by 匡雅琴

Merge branch 'feat_v2.1.1' into huy_dev_v2.3.0

2 parents 4dea41b8 eb85530f
......@@ -20,7 +20,7 @@
.header-text {
font-size: 16px;
color: #333333;
font-weight: 500;
font-weight: 600;
}
.el-button--primary.is-plain {
......
<template>
<div>
<div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" inline="true" class="province">
<el-select :size="size" v-model="provinceForm.provinceName" clearable placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-select size="small" v-model="provinceForm.provinceName" clearable placeholder="选择省份" :style="{ width: defaultWidth }" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select>
<el-select :size="size" v-model="provinceForm.cityName" clearable placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-select size="small" v-model="provinceForm.cityName" clearable placeholder="选择市" :style="{ width: defaultWidth }" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select>
<el-select v-if="subdistrict == 3" :size="size" v-model="provinceForm.townName" clearable placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable placeholder="选择区" :style="{ width: defaultWidth }" @change="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select>
</el-form>
......@@ -15,57 +15,124 @@
</template>
<script>
let map
export default {
name: 'Province',
name: 'GLProvince',
props: {
// 省市级别,2--只显示省市,3--显示省市区,默认只显示省市
subdistrict: {
type: Number,
default: 2
},
// 省市下拉组件宽度
defaultWidth: {
type: String,
default: '150px'
},
// 组件是否展示,默认展示
provinceView: {
type: Boolean,
default: true
}
},
data() {
return {
// 所有数据
AllData: [],
// 城市列表
cityList: [{ adcode: '', name: '全部' }],
// 地区列表
townList: [{ adcode: '', name: '全部' }],
provinceForm: {
provinceName: '', // 省值
cityName: '', // 市值
// 省份名称
provinceName: '',
// 城市名称
cityName: '',
// 地区名称
townName: '',
// 省份代码
provinceCode: '',
// 城市代码
cityCode: '',
// 地区代码
townCode: ''
}
}
},
mounted() {
this.mapInit()
},
mounted() {},
methods: {
/*
* @params:传入的为一个key-value的对象
1、keywords --查询关键字,只支持单个关键词语搜索关键词支持:行政区名称、citycode、adcode
列如:this.provinceList({keywords: '山东省'}),这样就可以筛选出山东省下的市、区信息
2、subdistrict --设置显示下级行政区级数,0:不返回下级行政区;1:返回下一级行政区;2:返回下两级行政区;3:返回下三级行政区;
不传的话默认为2,可以在组件中穿,也可以在调用方法的时候传,如果需要展示省市组件,传值最小为2
3、page --最外层的districts最多会返回20个数据,若超过限制,请用page请求下一页数据。
例如page=2;page=3。默认page=1
4、extensions --控制行政区信息中返回行政区边界坐标点; 可选值:base、all;
base:不返回行政区边界坐标点;(默认)
all:只返回当前查询district的边界值,不返回子节点的边界值;目前不能返回乡镇/街道级别的边界值
5、filter -- 按照指定行政区划进行过滤,填入后则只返回该省/直辖市信息,需填入adcode,为了保证数据的正确,强烈建议填入此参数
6、callback -- callback值是用户定义的函数名称,此参数只在output=JSON时有效
7、output --返回数据格式类型,可选值:JSON,XML(默认JSON)
* @return:返回的是一个promise对象,如果不需要展示组件,只需要获取值,可以直接调用方法,异步获取返回值
列如:
const p = this.$refs.provinceForm.provinceList({xxxx(可传值,传值可参考上文params描述) })
p.then(r => {
// r 为返回结果
console.log(r)
})
**/
// 获取省市信息
provinceList(params = {}) {
params ? (params.subdistrict ? '' : (params.subdistrict = this.subdistrict)) : (params.subdistrict = this.subdistrict)
let data = ''
for (let key in params) {
data += '&' + key + '=' + params[key]
}
let path = `https://restapi.amap.com/v3/config/district?key=d22348363c34c266f772ae9b635eef2a`
path = path + data
const pro = fetch(path).then(res => {
return res.json()
})
if (this.provinceView) {
pro.then(r => {
this.AllData = r.districts[0].districts
})
}
return pro
},
// 省市回显
init(province, city) {
init(province, city, town) {
this.provinceForm = {
provinceName: province,
cityName: city
cityName: city,
townName: town
}
// this.mapInit(province, city)
if (province) {
this.AllData.map(item => {
if (item.name.indexOf(province) != -1) {
this.provinceForm.provinceName = item.name
this.cityList = item.districtList
this.cityList = item.districts
this.provinceForm.provinceCode = item.adcode
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
}
})
if (city) {
this.cityList.map(itm => {
if (itm.name.indexOf(city) != -1) {
this.provinceForm.cityCode = itm.adcode
this.provinceForm.cityName = itm.name
this.townList = itm.districts
if (town) {
this.townList.map(itmx => {
if (itmx.name.indexOf(town) != -1) {
this.provinceForm.townCode = itmx.adcode
this.provinceForm.townName = itmx.name
}
})
}
}
})
}
}
})
}
......@@ -73,49 +140,19 @@ export default {
// 选择省
selectProvince(val) {
this.provinceForm.cityName = ''
this.cityList = val.districtList
this.provinceForm.townName = ''
this.cityList = val.districts
this.$emit('selectProvince', val.name, val.adcode)
},
// 选择市
selectCity(val) {
this.provinceForm.townName = ''
this.townList = val.districtList
this.townList = val.districts
this.$emit('selectCity', val.name, val.adcode)
},
// 选择区
selectTown(val) {
this.$emit('selectTown', val.name, val.adcode)
},
mapInit() {
map = new AMap.Map('district', {
resizeEnable: true
})
AMap.plugin(['AMap.DistrictSearch'], () => {
var opts = {
subdistrict: this.subdistrict, //返回下一级行政区
level: 'city', //查询的范围
showbiz: true //查询行政级别为 市
}
var districtSearch = new AMap.DistrictSearch(opts)
districtSearch.search('中国', (status, result) => {
this.AllData = result.districtList[0].districtList
// if (provinceName) {
// this.AllData.map(item => {
// if (item.name.indexOf(provinceName) != -1) {
// this.provinceForm.provinceName = item.name
// this.cityList = item.districtList
// this.provinceForm.provinceCode = item.adcode
// this.cityList.map(itm => {
// if (itm.name.indexOf(cityName) != -1) {
// this.provinceForm.cityCode = itm.adcode
// this.provinceForm.cityName = itm.name
// }
// })
// }
// })
// }
})
})
}
}
}
......
......@@ -285,7 +285,7 @@ export default {
// }, 100)
// return
// }
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
if (this.accountAddForm.residentPhone) {
const result = reg.test(this.accountAddForm.residentPhone)
if (!result) {
......@@ -412,7 +412,8 @@ export default {
this.findMerchantDetail()
this.getCarbrandTree()
this.findAllDictData('business_type')
// this.$refs.baseInfoForm.brandList()
this.$refs.baseInfoForm.brandList()
// 1
}
}
</script>
......
......@@ -180,7 +180,7 @@ export default {
}
}
const validatePhoneTwo = (rule, value, callback) => {
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
if (value == '' || value == undefined || value == null) {
callback()
} else {
......@@ -213,7 +213,8 @@ export default {
provinceName: '',
cityCode: '',
cityName: '',
isFirstBrand: false
isFirstBrand: false,
addressData: {}
}
},
watch: {
......@@ -296,11 +297,28 @@ export default {
let lnglat = this.$refs.mapForm.lnglat
this.accountAddForm.lat = lnglat.lat
this.accountAddForm.lng = lnglat.lng
var fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
var fullAddress = ''
var provincecode = ''
if (this.$refs.mapForm.geocoderAddress.addressComponent) {
fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
provincecode = this.$refs.mapForm.geocoderAddress.adcode
this.addressData.fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
this.addressData.provincecode = this.$refs.mapForm.geocoderAddress.adcode
} else {
fullAddress = this.addressData.fullAddress
provincecode = this.addressData.provincecode
}
// 获取省市
var provincecode = this.$refs.mapForm.geocoderAddress.adcode
var province = fullAddress.province
var city = fullAddress.city ? fullAddress.city : fullAddress.district
var province = ''
var city = ''
if (fullAddress) {
province = fullAddress.province
city = fullAddress.city ? fullAddress.city : fullAddress.district
} else {
province = this.accountAddForm.provinceName
city = this.accountAddForm.cityName
provincecode = this.accountAddForm.cityCode
}
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == province)
if (municipality) {
......@@ -335,6 +353,7 @@ export default {
this.$set(this.accountAddForm, 'merchantAddress', '')
// 强制更新 merchantAddress
this.$forceUpdate()
this.accountAddForm.cityName = ''
this.accountAddForm.provinceName = provinceName
this.accountAddForm.provinceCode = provinceCode
},
......@@ -398,6 +417,7 @@ export default {
},
mounted() {
this.$refs.provinceForm.provinceList()
this.getUserInfo()
}
}
......
......@@ -350,7 +350,7 @@ export default {
},
//将后台返回数据中数值为空的字段全部替换为“-”
formateNullFieldData(initialData) {
const isEmpty = function (val) {
const isEmpty = function(val) {
if (!String(val) || String(val) === 'null') {
return '-'
}
......@@ -358,7 +358,7 @@ export default {
}
var that = this
if (initialData instanceof Array) {
initialData.forEach(function (val, key, array) {
initialData.forEach(function(val, key, array) {
array[key] = that.formateNullFieldData(val)
})
} else if (initialData instanceof Object) {
......@@ -664,7 +664,7 @@ export default {
padding-left: 2px;
padding-bottom: 10px;
.mainTitleWrap {
height: 32px;
// height: 32px;
display: flex;
.mainTitle {
background-color: #f4f6fc;
......@@ -684,8 +684,9 @@ export default {
margin: 20px 10px 0;
.subTitleWrap {
height: 40px;
// height: 40px;
display: flex;
flex-wrap: wrap;
background-color: #f4f6fc;
.subTitle {
padding: 0px 5px;
......
......@@ -301,7 +301,7 @@ export default {
// }, 100)
// return
// }
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
if (this.accountAddForm.residentPhone) {
const result = reg.test(this.accountAddForm.residentPhone)
if (!result) {
......
......@@ -73,7 +73,7 @@ export default {
{
label: '关联的企业微信',
prop: 'entmicroName',
width: '140',
width: '200',
line: 1,
formatter: cellValue => {
return cellValue.entmicroName ? cellValue.entmicroName : '-'
......@@ -99,7 +99,7 @@ export default {
{
label: '上级商户',
prop: 'parentMerchant',
width: '180',
width: '200',
line: 1,
formatter: cellValue => {
return cellValue.parentMerchant ? cellValue.parentMerchant : '-'
......@@ -401,7 +401,7 @@ export default {
<style scoped lang="scss">
.follow-form {
margin-top: 20px;
margin-top: 10px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 10px;
......
......@@ -64,7 +64,7 @@ export default {
},
data() {
const validatePhoneTwo = (rule, value, callback) => {
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
if (value == '' || value == undefined || value == null) {
callback()
} else {
......@@ -96,10 +96,12 @@ export default {
isFirstBrand: false,
baseFormRules: {
residentPhone: [{ validator: validatePhoneTwo, trigger: 'blur' }]
}
},
addressData: {}
}
},
mounted() {
this.$refs.provinceForm.provinceList()
this.getUserInfo()
},
methods: {
......@@ -180,18 +182,34 @@ export default {
let lnglat = this.$refs.mapForm.lnglat
this.infoForm.lat = lnglat.lat
this.infoForm.lng = lnglat.lng
var fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
var fullAddress = ''
var provincecode = ''
if (this.$refs.mapForm.geocoderAddress.addressComponent) {
fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
provincecode = this.$refs.mapForm.geocoderAddress.adcode
this.addressData.fullAddress = this.$refs.mapForm.geocoderAddress.addressComponent
this.addressData.provincecode = this.$refs.mapForm.geocoderAddress.adcode
} else {
fullAddress = this.addressData.fullAddress
provincecode = this.addressData.provincecode
}
// 获取省市
var provincecode = this.$refs.mapForm.geocoderAddress.adcode
var province = fullAddress.province
var city = fullAddress.city ? fullAddress.city : fullAddress.district
var province = ''
var city = ''
if (fullAddress) {
province = fullAddress.province
city = fullAddress.city ? fullAddress.city : fullAddress.district
} else {
province = this.infoForm.provinceName
city = this.infoForm.cityName
provincecode = this.infoForm.cityCode
}
const municipalities = ['北京市', '天津市', '上海市', '重庆市']
var municipality = municipalities.find(item => item == province)
if (municipality) {
city = city.slice(0, 2) + '城区'
if (municipality === '重庆市') {
provincecode = provincecode.slice(0, 4)
console.log(provincecode)
provincecode == 5001 ? (city = city.slice(0, 2) + '城区') : (city = city.slice(0, 2) + '郊县')
}
}
......@@ -212,6 +230,7 @@ export default {
// 获取省
selectProvince(provinceName, provinceCode) {
this.infoForm.merchantAddress = ''
this.infoForm.cityName = ''
this.infoForm.provinceName = provinceName
this.infoForm.provinceCode = provinceCode
},
......@@ -227,7 +246,7 @@ export default {
},
handleSave() {
const params = this.infoForm
const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
const reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/
if (params.residentPhone) {
const result = reg.test(params.residentPhone)
if (!result) {
......
......@@ -89,7 +89,7 @@ export default {
})
},
changeMerchantProTree() {
if (!this.powerDataArray.length) {
if (!this.powerDataArray.length) {
return []
} else if (this.powerDataArray.length > 0 && this.powerDataArray[this.currentIndex].products.length == 0) {
return []
......@@ -171,8 +171,9 @@ export default {
padding-left: 2px;
padding-bottom: 10px;
.mainTitleWrap {
height: 32px;
// height: 32px;
display: flex;
flex-wrap: wrap;
.mainTitle {
background-color: #f4f6fc;
......@@ -193,8 +194,9 @@ export default {
margin: 20px 10px 0;
.subTitleWrap {
height: 40px;
// height: 40px;
display: flex;
flex-wrap: wrap;
background-color: #f4f6fc;
.subTitle {
background-color: #f4f6fc;
......
......@@ -154,14 +154,14 @@ export default {
{
label: '员工姓名',
prop: 'staffName',
width: '100',
width: '200',
line: 1
},
{
label: '员工企微号',
prop: 'entmicroName',
line: 1,
width: '120',
width: '200',
formatter: cellValue => {
return cellValue.entmicroName || '-'
}
......@@ -178,12 +178,12 @@ export default {
{
label: '登录手机号',
prop: 'staffPhone',
width: '130'
width: '200'
},
{
label: '所属门店',
prop: 'merchantName',
width: '300',
width: '350',
line: 1
},
{
......@@ -201,7 +201,7 @@ export default {
label: '更新时间',
prop: 'updatedTime',
line: 1,
minWidth: '180'
minWidth: '200'
},
{
label: '启用开关',
......
......@@ -85,24 +85,19 @@ export default {
},
{
label: '部门',
prop: 'departmentName',
width: 120,
line: 1
prop: 'departmentName'
},
{
label: '跟进专员类型',
prop: 'followerTypeName',
minWidth: 150
prop: 'followerTypeName'
},
{
label: '手机号',
prop: 'staffPhone',
minWidth: 150
prop: 'staffPhone'
},
{
label: '首次开通时间',
prop: 'followerCreatedTime',
minWidth: 150
prop: 'followerCreatedTime'
},
{
label: '是否有外部联系人权限',
......@@ -317,7 +312,7 @@ export default {
}
.follow-form {
min-height: calc(100% - 200px);
margin-top: 20px;
margin-top: 10px;
background: #ffffff;
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
padding: 20px;
......
......@@ -93,12 +93,12 @@ export default {
{
label: '角色名称',
prop: 'roleName',
minWidth: '200'
minWidth: '250'
},
{
label: '角色号',
prop: 'roleCode',
minWidth: '200'
minWidth: '220'
},
{
label: '状态',
......@@ -108,12 +108,12 @@ export default {
{
label: '创建时间',
prop: 'createdTime',
width: '180'
minWidth: '180'
},
{
label: '更新时间',
prop: 'updatedTime',
width: '180',
minWidth: '180',
formatter: val => {
if (!val.updatedTime) {
return '--'
......@@ -297,7 +297,7 @@ export default {
let accountLevel = session.accountLevel
console.log(accountLevel)
if (accountLevel != 4) {
this.tableParams.tableColumns.splice(2, 0, { label: '所属商户名', prop: 'merchantName', width: '300', line: 1 })
this.tableParams.tableColumns.splice(2, 0, { label: '所属商户名', prop: 'merchantName', width: '340', line: 1 })
this.getMerchantName()
let idx = this.searchFormData.findIndex(item => item.name == 'merchantId')
this.searchFormData[idx].isHide = false
......
......@@ -290,6 +290,7 @@ export default {
padding: 10px;
.menu_line_two {
display: flex;
flex-wrap: wrap;
align-items: center;
.line_element_two {
// width: 111px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!