| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- (function(vc) {
- vc.extends({
- data: {
- roomCreateFeeAddInfo: {
- feeTypeCds:[],
- feeConfigs:[],
- locationTypeCd: '',
- locationObjId: '',
- floorId: '',
- floorNum: '',
- floorName: '',
- unitId: '',
- unitName: '',
- roomId: '',
- feeTypeCd:'',
- configId:'',
- billType:'',
- roomState:''
- }
- },
- _initMethod: function() {
- vc.getDict('pay_fee_config',"fee_type_cd",function(_data){
- vc.component.roomCreateFeeAddInfo.feeTypeCds = _data;
- });
- },
- _initEvent: function() {
- vc.on('roomCreateFeeAdd', 'openRoomCreateFeeAddModal',
- function() {
- $('#roomCreateFeeAddModel').modal('show');
- });
- vc.on("roomCreateFeeAdd", "notify", function (_param) {
- if (_param.hasOwnProperty("floorId")) {
- vc.component.roomCreateFeeAddInfo.floorId = _param.floorId;
- }
- if (_param.hasOwnProperty("unitId")) {
- vc.component.roomCreateFeeAddInfo.unitId = _param.unitId;
- }
- if (_param.hasOwnProperty("roomId")) {
- vc.component.roomCreateFeeAddInfo.roomId = _param.roomId;
- }
- });
- },
- methods: {
- roomCreateFeeAddValidate() {
- return vc.validate.validate({
- roomCreateFeeAddInfo: vc.component.roomCreateFeeAddInfo
- },
- {
- 'roomCreateFeeAddInfo.locationTypeCd': [{
- limit: "required",
- param: "",
- errInfo: "收费范围不能为空"
- },
- {
- limit: "num",
- param: "",
- errInfo: "收费范围格式错误"
- },
- ],
- 'roomCreateFeeAddInfo.locationObjId': [{
- limit: "required",
- param: "",
- errInfo: "收费对象不能为空"
- }
- ],
- 'roomCreateFeeAddInfo.feeTypeCd': [{
- limit: "required",
- param: "",
- errInfo: "费用类型不能为空"
- }
- ],
- 'roomCreateFeeAddInfo.configId': [{
- limit: "required",
- param: "",
- errInfo: "费用项目不能为空"
- }
- ],
- 'roomCreateFeeAddInfo.billType': [{
- limit: "required",
- param: "",
- errInfo: "出账类型不能为空"
- }
- ],
- 'roomCreateFeeAddInfo.roomState': [{
- limit: "required",
- param: "",
- errInfo: "出账类型不能为空"
- }
- ]
- });
- },
- saveRoomCreateFeeInfo: function() {
- vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
- if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '1000') { //大门时直接写 小区ID
- vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.communityId;
- } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '2000') {
- vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.unitId;
- } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '3000') {
- vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.roomId;
- } else if (vc.component.roomCreateFeeAddInfo.locationTypeCd == '4000') {
- vc.component.roomCreateFeeAddInfo.locationObjId = vc.component.roomCreateFeeAddInfo.floorId;
- } else {
- vc.toast("收费范围错误");
- return;
- }
- if (!vc.component.roomCreateFeeAddValidate()) {
- vc.toast(vc.validate.errInfo);
- return;
- }
- vc.component.roomCreateFeeAddInfo.communityId = vc.getCurrentCommunity().communityId;
- vc.http.post('roomCreateFeeAdd', 'save', JSON.stringify(vc.component.roomCreateFeeAddInfo), {
- emulateJSON: true
- },
- function(json, res) {
- //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
- if (res.status == 200) {
- //关闭model
- $('#roomCreateFeeAddModel').modal('hide');
- vc.component.clearAddFeeConfigInfo();
- vc.toast("创建收费成功,总共["+res.totalRoom+"]房屋,成功["+res.successRoom+"],失败["+res.errorRoom+"]",8000);
- return;
- }
- vc.message(json);
- },
- function(errInfo, error) {
- console.log('请求失败处理');
- vc.message(errInfo);
- });
- },
- clearAddFeeConfigInfo: function() {
- var _feeTypeCds = vc.component.roomCreateFeeAddInfo.feeTypeCds;
- vc.component.roomCreateFeeAddInfo = {
- feeConfigs:[],
- locationTypeCd: '',
- locationObjId: '',
- floorId: '',
- floorNum: '',
- floorName: '',
- unitId: '',
- unitName: '',
- roomId: '',
- feeTypeCd:'',
- configId:'',
- billType:''
- };
- vc.component.roomCreateFeeAddInfo.feeTypeCds = _feeTypeCds;
- },
- _changeFeeTypeCd:function(_feeTypeCd){
- var param = {
- params: {
- page:1,
- row:20,
- communityId:vc.getCurrentCommunity().communityId,
- feeTypeCd:_feeTypeCd,
- isDefault:'F'
- }
- };
- //发送get请求
- vc.http.get('roomCreateFeeAdd', 'list', param,
- function(json, res) {
- var _feeConfigManageInfo = JSON.parse(json);
- vc.component.roomCreateFeeAddInfo.feeConfigs = _feeConfigManageInfo.feeConfigs;
- },
- function(errInfo, error) {
- console.log('请求失败处理');
- });
- }
- }
- });
- })(window.vc);
|