| | |
| | | unitId: '-1', |
| | | unitNum: '', |
| | | unitName: '', |
| | | unitSelector: {} |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | deep: true, |
| | | handler: function () { |
| | | vc.emit($props.callBackListener, $props.callBackFunction, this.unitSelect2Info); |
| | | console.log('是否执行 watch',$props.callBackListener, $props.callBackFunction, this.unitSelect2Info); |
| | | console.log('是否执行 watch', $props.callBackListener, $props.callBackFunction, this.unitSelect2Info); |
| | | vc.emit($namespace, 'roomSelect2', "transferRoom", this.unitSelect2Info); |
| | | } |
| | | } |
| | |
| | | }); |
| | | vc.on('unitSelect2', 'setUnit', function (_param) { |
| | | vc.copyObject(_param, this.unitSelect2Info); |
| | | $(".unitSelector").val(_param.unitId).select2(); |
| | | /* $(".unitSelector").val(_param.unitId).select2();*/ |
| | | var option = new Option(_param.unitNum, _param.unitId, true, true); |
| | | this.unitSelect2Info.unitSelector.append(option); |
| | | }); |
| | | vc.on('unitSelect2', 'clearUnit', function (_param) { |
| | | this.unitSelect2Info = { |
| | | units: [], |
| | | floorId: '-1', |
| | | unitId: '-1', |
| | | unitNum: '', |
| | | unitName: '', |
| | | unitSelector: {} |
| | | }; |
| | | }); |
| | | }, |
| | | methods: { |
| | |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () { |
| | | }; |
| | | $.fn.select2.defaults.set('width', '100%'); |
| | | $('#unitSelector').select2({ |
| | | this.unitSelect2Info.unitSelector = $('#unitSelector').select2({ |
| | | placeholder: '必填,请选择单元', |
| | | allowClear: true,//允许清空 |
| | | escapeMarkup: function (markup) { |
| | | return markup; |
| | | }, // 自定义格式化防止xss注入 |
| | | ajax: { |
| | | url: "/callComponent/unitSelect2/loadUnits", |
| | | dataType: 'json', |
| | |
| | | $('#unitSelector').on("select2:unselect", function (evt) { |
| | | //这里是取消选中触发的事件 |
| | | //如配置allowClear: true后,触发 |
| | | console.log('unselect', evt) |
| | | console.log('unselect', evt); |
| | | this.unitSelect2Info.unitId = '-1'; |
| | | this.unitSelect2Info.unitName = ''; |
| | | |
| | | }); |
| | | }, |