| | |
| | | <select class="form-control floorSelector"> |
| | | <select class="form-control" id = "floorSelector"> |
| | | <option value="">请选择楼栋</option> |
| | | |
| | | |
| | |
| | | floorSelect2Info:{ |
| | | deep: true, |
| | | handler:function(){ |
| | | vc.emit('unitSelect2', "transferFloor" ,vc.component.floorSelect2Info); |
| | | vc.emit('unitSelect2', "transferFloor" ,this.floorSelect2Info); |
| | | } |
| | | } |
| | | }, |
| | |
| | | vc.component._initFloorSelect2(); |
| | | })*/ |
| | | vc.on('floorSelect2','setFloor',function (_param) { |
| | | $(".floorSelector").val(_param.floorId).select2(); |
| | | $("#floorSelector").val(_param.floorId).select2(); |
| | | }); |
| | | }, |
| | | methods: { |
| | |
| | | console.log("调用_initFloorSelect2 方法"); |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () {}; |
| | | $.fn.select2.defaults.set('width', '100%'); |
| | | $('.floorSelector').select2({ |
| | | $('#floorSelector').select2({ |
| | | placeholder: '必填,请选择楼栋', |
| | | ajax: { |
| | | url: "/callComponent/floorSelect2/list", |
| | |
| | | }; |
| | | }, |
| | | processResults: function (data) { |
| | | console.log(data, vc.component._filterFloorData(data.apiFloorDataVoList)); |
| | | console.log(data, this._filterFloorData(data.apiFloorDataVoList)); |
| | | return { |
| | | results: vc.component._filterFloorData(data.apiFloorDataVoList) |
| | | results: this._filterFloorData(data.apiFloorDataVoList) |
| | | }; |
| | | }, |
| | | cache: true |
| | | } |
| | | }); |
| | | $('.floorSelector').on("select2:select", function (evt) { |
| | | $('#floorSelector').on("select2:select", function (evt) { |
| | | //这里是选中触发的事件 |
| | | //evt.params.data 是选中项的信息 |
| | | console.log('select',evt); |
| | |
| | | this.floorSelect2Info.floorName = evt.params.data.text; |
| | | }); |
| | | |
| | | $('.floorSelector').on("select2:unselect", function (evt) { |
| | | $('#floorSelector').on("select2:unselect", function (evt) { |
| | | //这里是取消选中触发的事件 |
| | | //如配置allowClear: true后,触发 |
| | | console.log('unselect',evt) |
| | |
| | | v-show="editMachineInfo.locationTypeCd == '2000' || editMachineInfo.locationTypeCd == '3000' "> |
| | | <label class="col-sm-2 col-form-label">归属楼栋</label> |
| | | <div class="col-sm-10"> |
| | | <!--<vc:create name="floorSelect2" |
| | | <vc:create name="floorSelect2" |
| | | parentModal="editMachineModel" |
| | | |
| | | ></vc:create>--> |
| | | namespace="editMachine" |
| | | ></vc:create> |
| | | </div> |
| | | </div> |
| | | <div class="form-group row" |
| | |
| | | parentModal="editMachineModel" |
| | | callBackListener="editMachine" |
| | | callBackFunction="notify" |
| | | namespace="editMachine" |
| | | ></vc:create> |
| | | </div> |
| | | </div> |
| | |
| | | parentModal="editMachineModel" |
| | | callBackListener="editMachine" |
| | | callBackFunction="notify" |
| | | namespace="editMachine" |
| | | ></vc:create> |
| | | </div> |
| | | </div> |
| | |
| | | <select class="form-control roomSelector"> |
| | | <select class="form-control " id="roomSelector"> |
| | | <option value="">请选择房屋</option> |
| | | |
| | | |
| | |
| | | }); |
| | | vc.on('roomSelect2','setRoom',function (_param) { |
| | | vc.copyObject(_param, vc.component.roomSelect2Info); |
| | | $(".roomSelector").val(_param.roomId).select2(); |
| | | $("#roomSelector").val(_param.roomId).select2(); |
| | | }); |
| | | }, |
| | | methods: { |
| | |
| | | console.log("调用_initRoomSelect2 方法"); |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () {}; |
| | | $.fn.select2.defaults.set('width', '100%'); |
| | | $('.roomSelector').select2({ |
| | | $('#roomSelector').select2({ |
| | | placeholder: '必填,请选择房屋', |
| | | ajax: { |
| | | url: "/callComponent/roomSelect2/listRoom", |
| | |
| | | cache: true |
| | | } |
| | | }); |
| | | $('.roomSelector').on("select2:select", function (evt) { |
| | | $('#roomSelector').on("select2:select", function (evt) { |
| | | //这里是选中触发的事件 |
| | | //evt.params.data 是选中项的信息 |
| | | console.log('select',evt); |
| | |
| | | vc.component.roomSelect2Info.roomNum = evt.params.data.text; |
| | | }); |
| | | |
| | | $('.roomSelector').on("select2:unselect", function (evt) { |
| | | $('#roomSelector').on("select2:unselect", function (evt) { |
| | | //这里是取消选中触发的事件 |
| | | //如配置allowClear: true后,触发 |
| | | console.log('unselect',evt) |
| | |
| | | <select class="form-control unitSelector"> |
| | | <select class="form-control " id="unitSelector"> |
| | | <option value="">请选择单元</option> |
| | | |
| | | |
| | |
| | | console.log("调用_initUnitSelect2 方法"); |
| | | $.fn.modal.Constructor.prototype.enforceFocus = function () {}; |
| | | $.fn.select2.defaults.set('width', '100%'); |
| | | $('.unitSelector').select2({ |
| | | $('#unitSelector').select2({ |
| | | placeholder: '必填,请选择单元', |
| | | ajax: { |
| | | url: "/callComponent/unitSelect2/loadUnits", |
| | |
| | | cache: true |
| | | } |
| | | }); |
| | | $('.unitSelector').on("select2:select", function (evt) { |
| | | $('#unitSelector').on("select2:select", function (evt) { |
| | | //这里是选中触发的事件 |
| | | //evt.params.data 是选中项的信息 |
| | | console.log('select',evt); |
| | |
| | | vc.component.unitSelect2Info.unitName = evt.params.data.text; |
| | | }); |
| | | |
| | | $('.unitSelector').on("select2:unselect", function (evt) { |
| | | $('#unitSelector').on("select2:unselect", function (evt) { |
| | | //这里是取消选中触发的事件 |
| | | //如配置allowClear: true后,触发 |
| | | console.log('unselect',evt) |
| | |
| | | |
| | | String namespace = tag.getAttributeValue("namespace"); |
| | | |
| | | return html.replace("this.", namespace + "_"); |
| | | return html.replace("this.", namespace + "_") |
| | | .replaceAll("(id)+( )*+=+( )*+'", "id='" + namespace + "_") |
| | | .replaceAll("(id)+( )*+=+( )*+\"", "id=\"" + namespace + "_"); |
| | | } |
| | | |
| | | private String dealHtmlJs(IProcessableElementTag tag, String js) { |
| | |
| | | |
| | | String namespace = tag.getAttributeValue("namespace"); |
| | | |
| | | return js.replace("this.", "vc.component."+namespace + "_"); |
| | | return js.replace("this.", "vc.component." + namespace + "_") |
| | | .replaceAll("(\\$)+( )*+(\\()+( )*+\'+#", "\\$('#" + namespace + "_") |
| | | .replaceAll("(\\$)+( )*+(\\()+( )*+\"+#", "\\$(\"#" + namespace + "_"); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String js = "(function (vc, vm) {vc.extends({a:'123'})})"; |
| | | int extPos = js.indexOf("vc.extends"); |
| | | String tmpProTypes = js.substring(extPos); |
| | | int pos = tmpProTypes.indexOf("{") + 1; |
| | | js = js.substring(0, extPos) + tmpProTypes.substring(0, pos).trim() + "\nnamespace:" + DEFAULT_NAMESPACE + ",\n" + tmpProTypes.substring(pos, tmpProTypes.length()); |
| | | int position = js.indexOf("{"); |
| | | String propsJs = "\n$namespace=" + DEFAULT_NAMESPACE + ";\n"; |
| | | js = new StringBuffer(js).insert(position + 1, propsJs).toString(); |
| | | String js = "123$ ( '#av').val()"; |
| | | js = js.replaceAll("(\\$)+( )*+(\\()+( )*+\'+#", "\\$('#abg_"); |
| | | |
| | | System.out.println(js); |
| | | |
| | | } |
| | | } |