|
@@ -103,7 +103,7 @@ let componentOprObj = {
|
|
|
//初始默认radio
|
|
|
initRadio: function () {
|
|
|
let that = repositoryGljObj, me = componentOprObj;
|
|
|
- //$('#searchGlj').val('');//恢复搜索文本
|
|
|
+ $('#gljSearchKeyword').val('');//恢复搜索文本
|
|
|
//初始化组成物列表
|
|
|
me.selectedList = [].concat(that.currentComponent);
|
|
|
//默认radio所有工料机
|
|
@@ -120,39 +120,52 @@ let componentOprObj = {
|
|
|
that.sortGlj(me.showGljList);
|
|
|
}
|
|
|
},
|
|
|
+ filterDatasAndShow: function () {
|
|
|
+ let me = componentOprObj, re = repositoryGljObj;
|
|
|
+ let materialArr = [202, 203, 204];//混凝土、砂浆、配合比, 201普通材料
|
|
|
+ let val = $("input[name='glj']:checked").val();
|
|
|
+ me.radiosSelected = val;
|
|
|
+ //选择改变,数据重新筛选显示
|
|
|
+ me.showGljList = [];
|
|
|
+ if(me.radiosSelected === 'allGljs'){
|
|
|
+ me.setShowGljList(re.stdGljList);
|
|
|
+ me.setShowGljList(re.complementaryGljList);
|
|
|
+ }
|
|
|
+ else if(me.radiosSelected === 'stdGljs'){
|
|
|
+ me.setShowGljList(re.stdGljList);
|
|
|
+ }
|
|
|
+ else if(me.radiosSelected === 'complementaryGljs'){
|
|
|
+ me.setShowGljList(re.complementaryGljList);
|
|
|
+ }
|
|
|
+ //搜索匹配
|
|
|
+ let searchStr = $('#gljSearchKeyword').val();
|
|
|
+ if(searchStr && searchStr.trim() != ''){
|
|
|
+ let reg = new RegExp(searchStr);
|
|
|
+ me.showGljList = _.filter(me.showGljList, function (data) {
|
|
|
+ return reg.test(data.code) || reg.test(data.name);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ re.sortGlj(me.showGljList);
|
|
|
+ //重新显示
|
|
|
+ me.showGljItems(me.showGljList, me.gljCurTypeId);
|
|
|
+ //切换radio后更新cache
|
|
|
+ if (me.currentOprParent = 1) {
|
|
|
+ if(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
|
|
|
+ me.currentCache = me.getParentCache(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ me.currentCache = [];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ me.currentCache = me.getCache();
|
|
|
+ }
|
|
|
+ },
|
|
|
//监听radios选择事件
|
|
|
radiosChange: function () {
|
|
|
let me = componentOprObj, re = repositoryGljObj;
|
|
|
let materialArr = [202, 203, 204];//混凝土、砂浆、配合比, 201普通材料
|
|
|
$('.glj-radio').change(function () {
|
|
|
- let val = $("input[name='glj']:checked").val();
|
|
|
- me.radiosSelected = val;
|
|
|
- //选择改变,数据重新筛选显示
|
|
|
- me.showGljList = [];
|
|
|
- if(me.radiosSelected === 'allGljs'){
|
|
|
- me.setShowGljList(re.stdGljList);
|
|
|
- me.setShowGljList(re.complementaryGljList);
|
|
|
- }
|
|
|
- else if(me.radiosSelected === 'stdGljs'){
|
|
|
- me.setShowGljList(re.stdGljList);
|
|
|
- }
|
|
|
- else if(me.radiosSelected === 'complementaryGljs'){
|
|
|
- me.setShowGljList(re.complementaryGljList);
|
|
|
- }
|
|
|
- re.sortGlj(me.showGljList);
|
|
|
- //重新显示
|
|
|
- me.showGljItems(me.showGljList, me.gljCurTypeId);
|
|
|
- //切换radio后更新cache
|
|
|
- if (me.currentOprParent = 1) {
|
|
|
- if(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]){
|
|
|
- me.currentCache = me.getParentCache(re.parentNodeIds["_pNodeId_" + me.gljCurTypeId]);
|
|
|
- }
|
|
|
- else{
|
|
|
- me.currentCache = [];
|
|
|
- }
|
|
|
- } else {
|
|
|
- me.currentCache = me.getCache();
|
|
|
- }
|
|
|
+ me.filterDatasAndShow();
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -257,4 +270,15 @@ let componentTypeTreeOprObj = {
|
|
|
}
|
|
|
me.showGljItems(me.showGljList, gljTypeId);
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+$(document).ready(function () {
|
|
|
+ $('#gljSearchKeyword').change(function () {
|
|
|
+ componentOprObj.filterDatasAndShow();
|
|
|
+ });
|
|
|
+ $('#gljSearchKeyword').bind('keypress', function (e) {
|
|
|
+ if(e.keyCode === 13){
|
|
|
+ $(this).blur();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|