Commit 48f3a8f6 by 冒粤蓉

fix

1 parent edf52f87
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
label-width="135px" label-width="135px"
:inline="true" :inline="true"
> >
<el-form-item class="special-shop-input" label="特约店名称:" prop="specialShop"> <el-form-item class="special-shop-input" label="特约店名称:" prop="specialShopName">
<el-cascader <el-cascader
:key="refresh"
ref="specialShopCascader" ref="specialShopCascader"
v-model="form.specialShopName" v-model="form.specialShopName"
:value="form.specialShopName" :value="form.specialShopName"
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
filterable filterable
@change="handleSpecialShopChange" @change="handleSpecialShopChange"
size="small" size="small"
clearable
:disabled="readonlyStatus" :disabled="readonlyStatus"
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
...@@ -121,13 +123,13 @@ import mapService from 'utils/mapService.js' ...@@ -121,13 +123,13 @@ import mapService from 'utils/mapService.js'
export default { export default {
components: { fenceMap }, components: { fenceMap },
data() { data() {
let checkSpecialShop = (rule, vaule, cb)=>{ let checkSpecialShop = (rule, value, cb)=>{
if(this.form.specialShopId == ""){ if(!this.form.specialShopName){
cb(new Error('请选择特约店')) cb(new Error('请选择特约店'))
}else{ }else{
cb(); cb();
}
} }
}
let checkLng = (rule, vaule, cb)=>{ let checkLng = (rule, vaule, cb)=>{
if(this.form.shapeType == 1 && !/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/.test(this.form.lng)){ if(this.form.shapeType == 1 && !/^(\+|-)?(?:180(?:(?:\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\.[0-9]{1,6})?))$/.test(this.form.lng)){
...@@ -166,6 +168,7 @@ export default { ...@@ -166,6 +168,7 @@ export default {
} }
return { return {
refresh: new Date().getTime(),
btn_size: 'small', btn_size: 'small',
configForm: {}, configForm: {},
mapData: [], mapData: [],
...@@ -176,7 +179,7 @@ export default { ...@@ -176,7 +179,7 @@ export default {
specialShopDefaultProps: { specialShopDefaultProps: {
children: 'children', children: 'children',
label: 'label', label: 'label',
value: 'code' value: 'code',
}, },
readonlyStatus: false, readonlyStatus: false,
form: { form: {
...@@ -227,9 +230,9 @@ export default { ...@@ -227,9 +230,9 @@ export default {
msgtel: '' msgtel: ''
}, },
rules: { rules: {
specialShop: [ specialShopName: [
{required: true, validator: checkSpecialShop, trigger: 'change'} {required: true, validator: checkSpecialShop, trigger: 'change'}
], ],
fenceName: [ fenceName: [
{required: true, message: '请输入特约店线路名称', trigger: 'blur'}, {required: true, message: '请输入特约店线路名称', trigger: 'blur'},
{pattern: /^\S{2,200}$/, message: '至少2字', trigger: 'blur' }, {pattern: /^\S{2,200}$/, message: '至少2字', trigger: 'blur' },
...@@ -346,10 +349,18 @@ export default { ...@@ -346,10 +349,18 @@ export default {
}, },
handleSpecialShopChange(val) { handleSpecialShopChange(val) {
// 特约店级联选项 // 特约店级联选项
this.form.specialShopName = val[1];
if(val && val.length > 1) { if(val && val.length > 1) {
const thisNodes = this.$refs['specialShopCascader'].getCheckedNodes()[0]; this.$nextTick(()=> {
this.form.specialShopId = thisNodes.data.id; this.refresh = new Date().getTime();
this.form.specialShopCode = thisNodes.data.code; const thisNodes = this.$refs['specialShopCascader'].getCheckedNodes()[0];
if(thisNodes && thisNodes.data) {
const { data } = thisNodes;
this.form.specialShopId = data.id;
this.form.specialShopCode = data.code;
this.form.specialShopName = data.label;
}
})
} }
}, },
updateFence(){ updateFence(){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!