//此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
|
let extension = {
|
components: {//动态扩充组件或组件路径
|
//表单header、content、footer对应位置扩充的组件
|
gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
|
gridBody: '',
|
gridFooter: '',
|
//弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
|
modelHeader: '',
|
modelBody: '',
|
modelFooter: ''
|
},
|
buttons: { view: [], box: [], detail: [] },//扩展的按钮
|
methods: {//事件扩展
|
onInit() {
|
// this.editFormOptions.forEach(x => {
|
// x.forEach(z => {
|
// if (z.field == 'selection_carId') {
|
// z.onChange = (column, row, tableData) => {
|
// this.selectChange(column);
|
// console.log(JSON.stringify(column));
|
// //也可以select选择后从后台加载需要的数据
|
// // this.http.post("xxx?参数="+row.ProductName,{},true).then(result=>{
|
// // // row.xxx=result.xxx
|
// // })
|
// }
|
// }
|
|
// })
|
|
// })
|
|
let materiel_modelno = this.getOption("selection_carId");
|
let confignameselect = this.getOption("selection_zcId");
|
let manufacturerselect = this.getOption("selection_zc_manufacturer");
|
|
materiel_modelno.onChange = (val, options) => {
|
let params = {
|
MainData: { "materielId": val },
|
}
|
this.editFormFields.selection_zcId = '';
|
this.editFormFields.selection_zc_manufacturer = '';
|
confignameselect.data = [];
|
manufacturerselect.data = [];
|
this.http.post("api/Dt_materiel_zc_info/GetZCInfoByMateriel", params, "").then(x => {
|
confignameselect.data = x.data;
|
});
|
};
|
|
confignameselect.onChange = (val, options) => {
|
let params = {
|
MainData: { "materielId": this.editFormFields.selection_carId, 'materielModel': val },
|
}
|
manufacturerselect.data = [];
|
this.editFormFields.selection_zc_manufacturer = '';
|
this.http.post("api/Dt_materiel_zc_info/GetManufacturerByMateriel", params, "").then(x => {
|
manufacturerselect.data = x.data;
|
});
|
};
|
}, selectChange(row) {
|
//找到第二个下拉框选项
|
let col;
|
this.editFormOptions.forEach(x => {
|
let s = x.find(r => r.field == 'selection_zcId');
|
if (null != s) {
|
col = s;
|
return;
|
}
|
});
|
|
let url = 'api/Dt_materiel_zc_info/GetZCInfoByMateriel';
|
let params = {
|
MainData: { "materielId": row },
|
}
|
//从后台返回第二个下拉框满足条件的数据
|
this.http.post(url, params, false).then((keys) => {
|
//keys只返回第二个下拉框的key值,用于下面的判断,返回的下拉框key选项显示,没有返回的隐藏
|
// keys = ['1', '2'];
|
|
col.bind.data.forEach((item) => {
|
//注意:第二个下拉框选项,在下拉框绑定页面,配置的字典sql需要将全部数据源返回
|
//如果返回的数据源有几十W,请考虑用弹出框选择数据,不要用下拉框
|
if (keys.indexOf(item.key) != -1) {
|
item.hidden = false;
|
} else {
|
item.hidden = true;
|
}
|
});
|
});
|
},
|
getOption(field) {
|
let option;
|
this.editFormOptions.forEach(x => {
|
let col = x.find(r => r.field == field);
|
if (null != col) {
|
option = col;
|
return;
|
}
|
});
|
return option;
|
}, modelOpenAfter(row) {
|
let isEDIT = this.currentAction == this.const.ADD;
|
this.editFormOptions.forEach(item => {
|
item.forEach(x => {
|
if (x.field == "selection_zc_manufacturer" || x.field == "selection_carId" || x.field == "selection_zcId" || x.field == "selection_standard_type") {
|
x.disabled = !isEDIT;
|
}
|
});
|
})
|
}
|
}
|
};
|
export default extension;
|