| | |
| | | unitSelect2Info:{ |
| | | deep: true, |
| | | handler:function(){ |
| | | vc.emit($props.callBackListener,$props.callBackFunction,vc.component.unitSelect2Info); |
| | | vc.emit('roomSelect2', "transferRoom" ,vc.component.unitSelect2Info); |
| | | vc.emit($props.callBackListener, $props.callBackFunction, this.unitSelect2Info); |
| | | vc.emit($namespace, 'roomSelect2', "transferRoom", this.unitSelect2Info); |
| | | } |
| | | } |
| | | }, |
| | | _initMethod:function(){ |
| | | vc.component._initUnitSelect2(); |
| | | this._initUnitSelect2(); |
| | | }, |
| | | _initEvent:function(){ |
| | | //监听 modal 打开 |
| | | /* $('#'+$props.parentModal).on('show.bs.modal', function () { |
| | | vc.component._initUnitSelect2(); |
| | | this._initUnitSelect2(); |
| | | })*/ |
| | | vc.on('unitSelect2', "transferFloor",function (_param) { |
| | | vc.copyObject(_param, vc.component.unitSelect2Info); |
| | | vc.copyObject(_param, this.unitSelect2Info); |
| | | }); |
| | | vc.on('unitSelect2','setUnit',function (_param) { |
| | | vc.copyObject(_param, vc.component.unitSelect2Info); |
| | | vc.copyObject(_param, this.unitSelect2Info); |
| | | $(".unitSelector").val(_param.unitId).select2(); |
| | | }); |
| | | }, |
| | | methods: { |
| | | _initUnitSelect2: function () { |
| | | console.log("调用_initUnitSelect2 方法"); |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () {}; |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () { |
| | | }; |
| | | $.fn.select2.defaults.set('width', '100%'); |
| | | $('#unitSelector').select2({ |
| | | placeholder: '必填,请选择单元', |
| | |
| | | unitNum: _term, |
| | | page: 1, |
| | | row:10, |
| | | floorId:vc.component.unitSelect2Info.floorId, |
| | | floorId: this.unitSelect2Info.floorId, |
| | | communityId:vc.getCurrentCommunity().communityId |
| | | }; |
| | | }, |
| | | processResults: function (data) { |
| | | console.log(data, vc.component._filterUnitData(data)); |
| | | console.log(data, this._filterUnitData(data)); |
| | | return { |
| | | results: vc.component._filterUnitData(data) |
| | | results: this._filterUnitData(data) |
| | | }; |
| | | }, |
| | | cache: true |
| | |
| | | //这里是选中触发的事件 |
| | | //evt.params.data 是选中项的信息 |
| | | console.log('select',evt); |
| | | vc.component.unitSelect2Info.unitId = evt.params.data.id; |
| | | vc.component.unitSelect2Info.unitName = evt.params.data.text; |
| | | this.unitSelect2Info.unitId = evt.params.data.id; |
| | | this.unitSelect2Info.unitName = evt.params.data.text; |
| | | }); |
| | | |
| | | $('#unitSelector').on("select2:unselect", function (evt) { |