Skip to content

Commit

Permalink
fix 级联菜单回显问题 (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuan-meng authored and hjzheng committed Aug 24, 2018
1 parent c15d305 commit c7ea327
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/components/goods-selector/GoodsSelectorController.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ export default class GoodsSelectorCtrl {
.then(res => {
this.propsPidList = res.data || [];
this.formModel.propsPid = this.propsPid;
this.propsPid = null;
})
.catch(res => {
if (!this.tips || !this.tips.element) {
Expand All @@ -566,6 +567,7 @@ export default class GoodsSelectorCtrl {
if (this.formModel.propsPid && itemIndex !== -1) {
this.propsVidList = this.propsPidList[itemIndex].values;
this.formModel.propsVid = cloneDeep(this.propsVid);
this.propsPid = null;
} else {
this.propsVidList = [];
this.formModel.propsVid = undefined;
Expand Down Expand Up @@ -704,20 +706,21 @@ export default class GoodsSelectorCtrl {
// tab 切换时 form 表单处理
handleForm(dateRangeModel, formModel) {
this.dateRange = cloneDeep(dateRangeModel);
const categoriesId = this.formModel.categoriesId;
const propsPid = this.formModel.propsPid;
for (let attr in formModel) {
if (formModel.hasOwnProperty(attr)) {
if (attr !== 'propsPid' && attr !== 'propsVid') {
this.formModel[attr] = cloneDeep(formModel[attr]);
}
}
}
this.categoriesId = cloneDeep(formModel.categoriesId);
this.propsPid = cloneDeep(formModel.propsPid);
this.propsVid = cloneDeep(formModel.propsVid);
if (this.categoriesId === formModel.categoriesId) {
this.propsPid = formModel.propsPid;
if (categoriesId === formModel.categoriesId) {
this.formModel.propsPid = this.propsPid;
}
if (this.categoriesId === formModel.categoriesId && this.propsPid === formModel.propsPid) {
this.propsVid = formModel.propsVid;
if (propsPid === formModel.propsPid) {
this.formModel.propsVid = this.propsVid;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/goods-selector/constant.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// export const apiPrefix = '/shuyun-searchapi/1.0';
export const apiPrefix = '/api';
export const apiPrefix = '/shuyun-searchapi/1.0';
export const getExceedSelectedNumberMsg = function(number) {
return `<span>最多允许选择${number}条数据</span>`;
};

0 comments on commit c7ea327

Please sign in to comment.