Commit dfe4d84e by caoyanzhi

fix: 修复会员标签-常驻城市编辑保存时,cityId不对的bug

parent d8685fd5
......@@ -1487,7 +1487,7 @@ export default {
*/
getcityData() {
const para = { requestProject: 'member-tag' };
this.axios
return this.axios
.post(`${this.baseUrl}/api-plug/dict-district-tree`, qs.stringify(para))
.then(res => {
if (res.data.errorCode === 0) {
......@@ -1655,6 +1655,27 @@ export default {
return item;
});
},
getCityId(city) {
const [cName, pName] = city.split('-');
const result = { cityId: '', pId: '' };
this.tag010.citySelectOptions.some(province => {
const { provinceName, provinceId, children } = province;
if (pName == provinceName) {
result.pId = provinceId;
if (Array.isArray(children)) {
children.some(city => {
const { cityId, cityName } = city;
if (cName == cityName) {
result.cityId = cityId;
}
return cName == cityName;
})
}
}
return provinceName == province.provinceId;
})
return result;
},
/**
* 将tagValue 替代模板数据的v-model
......@@ -1686,10 +1707,12 @@ export default {
selectVal = tagParams.selectedVal[1].split(',');
selectVal.forEach((item, index) => {
const { cityId, pId } = this.getCityId(item);
this.templateData[i].citySelectedOptions.push({
selected: selectVal[index],
cityName: selectVal[index],
cityId: item
cityId,
pId
});
});
setTimeout(_ => {
......@@ -2146,10 +2169,12 @@ export default {
}
},
mounted() {
// 存在id
if (this.id) {
this._getTagType(this.id);
}
this.getcityData().finally(() => {
// 存在id
if (this.id) {
this._getTagType(this.id);
}
});
},
filters: {
aliasTips(name) {
......
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