Commit 48f3a8f6 by 冒粤蓉

fix

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