当时的需求是选择资产组名称,自动带出对应的资产组类别到表单上。所以通过xmSelect的on方法即可获取到当前选中值,下面的EamEquipmentArchives.getAssType()是自己写的根据监听到的资产组名称的值查询资产组类别的方法。
let assetGroupNameAddSelect = xmSelect.render({
el: '#assetsNameAdd',
//监听方法
on: function (data) {
var arr = data.arr;
if (arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
str1 = arr[i].name;
EamEquipmentArchives.getAssType()
}
}
},
autoRow: true,
radio: true,
clickClose: true,
tips: "测试",
//配置搜索
filterable: true,
//配置远程分页
paging: true,
pageRemote: true,
//数据处理
remoteSearch: true,
remoteMethod: function (val, cb, show, pageIndex) {
let ajax = new $ax(Feng.ctxPath + "/eamAssetGroupMaintenance/assetGroupName", function (data) {
console.log(data);
cb(data.records, Math.ceil(data.total / pageSize));
}, function (data) {
// Feng.error("添加失败!")
cb([], 0);
});
ajax.set("pageSize", pageSize);
ajax.set("pageNum", pageIndex);
ajax.start();
}
});