@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
276 lines • 14.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var data_source_helper_1 = require("../../service/data-source.helper");
var core_1 = require("@angular/core");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var ng_zorro_antd_1 = require("ng-zorro-antd");
var common_1 = require("@angular/common");
var moment = require("moment");
var def = {
data: null,
showOperations: true,
fields: {
id: {
label: 'id',
hidden: true,
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
payOrderId: {
label: '订单编号',
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
fullRoomName: {
label: '所属房产',
sort: { enabled: false },
query: {},
filter: { enabled: false }
},
userName: {
label: '业主姓名',
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
outPayKind: {
label: '支付类型',
sort: { enabled: true },
query: {},
filter: { enabled: false },
dataTemplateEnabled: true,
},
payAmount: {
label: '支付金额',
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
paySuccess: {
label: '支付状态',
sort: { enabled: true },
query: {},
filter: { enabled: false },
dataTemplateEnabled: true,
},
payTime: {
label: '支付时间',
sort: { enabled: true, value: 'descend' },
query: {},
filter: { enabled: false },
dataTemplateEnabled: true,
},
}
};
var PropertyTransactionRecordComponent = /** @class */ (function () {
function PropertyTransactionRecordComponent(injector, dataSourceHelper, userStorageService, _message, datePipe, confirmServ) {
var _this = this;
this.injector = injector;
this.dataSourceHelper = dataSourceHelper;
this.userStorageService = userStorageService;
this._message = _message;
this.datePipe = datePipe;
this.confirmServ = confirmServ;
this.openPayKinds = [];
this.communityOptions = [];
this.newArray = function (len) {
var result = [];
for (var i = 0; i < len; i++) {
result.push(i);
}
return result;
};
this._startValueChange = function () {
if (_this.listView.params.payTimeFrom > _this.listView.params.payTimeTo) {
_this.listView.params.payTimeTo = null;
}
};
this._endValueChange = function () {
if (_this.listView.params.payTimeFrom > _this.listView.params.payTimeTo) {
_this.listView.params.payTimeFrom = null;
}
};
this._disabledStartDate = function (startValue) {
if (!startValue || !_this.listView.params.payTimeTo) {
return false;
}
// if (startValue.getTime() < this.listView.params.payTimeTo.getTime() - 31 * 24 * 60 * 60 * 1000) {
// return true;
// }
return startValue.getTime() > _this.listView.params.payTimeTo.getTime();
};
this._disabledEndDate = function (endValue) {
if (!endValue || !_this.listView.params.payTimeFrom) {
return false;
}
// if (endValue.getTime() > this.listView.params.payTimeFrom.getTime() + 31 * 24 * 60 * 60 * 1000) {
// return true;
// }
return endValue.getTime() < _this.listView.params.payTimeFrom.getTime();
};
this.dataSource = this.dataSourceHelper.propertyFeeOrder;
this.exportExcelDataSource = this.dataSourceHelper.propertyOrdersHistoryExportExcel;
this.openPayKindDataSource = this.dataSourceHelper.openPayKindProviderSettings;
this.generateFileStoragesDataSource = this.dataSourceHelper.generateFileStorages;
this.communityDataSource = this.dataSourceHelper.communities;
this.openPayKindDataSource.findList({
size: 9999
}, true).subscribe(function (res) {
_this.openPayKinds = res.body;
});
}
PropertyTransactionRecordComponent.prototype.ngOnInit = function () {
var _this = this;
this.listView = new ngx_webapp_fx_1.ListView(def, this.injector);
this.listView.params.payTimeFrom = this.listView.params.payTimeFrom || null;
this.listView.params.payTimeTo = this.listView.params.payTimeTo || null;
this.communityGroupId = this.userStorageService.getCurrentOffice().id;
this.communityDataSource.findList({
communityGroupId: this.communityGroupId
}, true).subscribe(function (res) {
_this.communityOptions = res.body;
});
this.loadAll();
};
PropertyTransactionRecordComponent.prototype.loadAll = function () {
var _this = this;
this.dataSource.findList({
communityGroupId: this.communityGroupId,
page: this.listView.pageIndex - 1,
size: this.listView.pageSize,
keywords: this.listView.params.searchQuery,
query: this.listView.params.queryString,
sort: this.listView.sortValueToQueryStatement,
startPayTime: this.convertLocalDateTimeToServer(this.listView.params.payTimeFrom),
endPayTime: this.convertLocalDateTimeToServer(this.listView.params.payTimeTo),
}).subscribe(function (res) {
_this.listView.data = res.body;
_this.listView.setTotal(res.headers);
});
};
PropertyTransactionRecordComponent.prototype.exportExcel = function () {
var _self = this;
_self.confirmServ.confirm({
title: '您确定要导出物业缴费订单记录?',
showConfirmLoading: true,
onOk: function () {
return new Promise(function (resolve) {
_self.exportExcelDataSource.findList({
communityGroupId: _self.communityGroupId,
keywords: _self.listView.params.searchQuery,
query: _self.listView.params.queryString,
startPayTime: _self.convertLocalDateTimeToServer(_self.listView.params.payTimeFrom),
endPayTime: _self.convertLocalDateTimeToServer(_self.listView.params.payTimeTo),
}).subscribe(function (success) {
_self.getDownLoadUrl(success.body.fileKey, resolve);
}, function (error) {
_self._message.error('导出报表失败');
resolve();
});
});
},
});
};
PropertyTransactionRecordComponent.prototype.getDownLoadUrl = function (fileKey, resolve) {
var _this = this;
var t = setInterval(function () {
_this.generateFileStoragesDataSource.findOne(fileKey).subscribe(function (success) {
if (success.body.status === 'DONE') {
_this._message.success('导出报表成功');
clearInterval(t);
resolve();
window.location.href = success.body.downLoadUrl;
}
else if (success.body.status === 'ERROR') {
_this._message.error('导出报表失败');
clearInterval(t);
resolve();
}
}, function (error) {
_this._message.error('导出报表失败');
clearInterval(t);
resolve();
});
}, 1000);
};
PropertyTransactionRecordComponent.prototype.search = function (e) {
this.listView.params.searchQuery = e;
this.loadAll();
};
PropertyTransactionRecordComponent.prototype.convertLocalDateTimeToServer = function (date) {
if (date) {
return this.datePipe.transform(date, 'yyyy-MM-ddTHH:mm:ss');
}
else {
return null;
}
};
// 顶部查询
// 顶部查询
PropertyTransactionRecordComponent.prototype.filter =
// 顶部查询
function () {
var result = [];
if (this.listView.params.outPayKind) {
result[result.length] = 'outPayKind' + '=' + this.listView.params.outPayKind;
}
if (this.listView.params.communityId) {
result[result.length] = 'communityId=' + this.listView.params.communityId;
}
var str = '';
for (var i = 0; i < result.length; i++) {
if (str !== '') {
str += ',';
}
str += '"' + result[i] + '"';
}
if (str !== '') {
str = '{"op":"AND","simpleStatements":[' + str + ']}';
}
this.listView.params.queryString = encodeURI(str);
this.loadAll();
};
PropertyTransactionRecordComponent.prototype.formateValue = function (val) {
if (this.openPayKinds) {
for (var i = 0; i < this.openPayKinds.length; i++) {
if (val === this.openPayKinds[i].kind) {
return this.openPayKinds[i].name;
}
}
}
return val;
};
Object.defineProperty(PropertyTransactionRecordComponent.prototype, "_isSameDay", {
get: function () {
return this.listView.params.payTimeFrom && this.listView.params.payTimeTo && moment(this.listView.params.payTimeFrom).isSame(this.listView.params.payTimeTo, 'day');
},
enumerable: true,
configurable: true
});
PropertyTransactionRecordComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-property-transaction-record',
template: "<zx-header-block [title]=\"'\u7F34\u8D39\u8BB0\u5F55'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\"><p>\u67E5\u770B\u7269\u4E1A\u7F34\u8D39\u8BA2\u5355\u8BB0\u5F55</p></zx-header-block><zx-content-block><ng-template #operations><button nz-button [nzType]=\"'primary'\" (click)=\"exportExcel()\"><span>\u8BA2\u5355\u5BFC\u51FA</span></button></ng-template><ng-template #extra><nz-select style=\"width: 150px;\" [(ngModel)]=\"listView.params.communityId\" [nzPlaceHolder]=\"'\u5C0F\u533A'\" [nzSize]=\"'large'\" (ngModelChange)=\"filter()\" nzAllowClear><nz-option *ngFor=\"let option of communityOptions\" [nzLabel]=\"option.name\" [nzValue]=\"option.id\"></nz-option></nz-select> <nz-datepicker [(ngModel)]=\"listView.params.payTimeFrom\" (ngModelChange)=\"listView.params.payTimeFrom=$event;_startValueChange()\" [nzDisabledDate]=\"_disabledStartDate\" [nzFormat]=\"'YYYY-MM-DD'\" [nzPlaceHolder]=\"'\u5F00\u59CB\u65F6\u95F4'\" [nzSize]=\"'large'\" (ngModelChange)=\"loadAll()\"></nz-datepicker> <nz-datepicker [(ngModel)]=\"listView.params.payTimeTo\" (ngModelChange)=\"listView.params.payTimeTo=$event;_endValueChange()\" [nzDisabledDate]=\"_disabledEndDate\" [nzFormat]=\"'YYYY-MM-DD'\" [nzPlaceHolder]=\"'\u7ED3\u675F\u65F6\u95F4'\" [nzSize]=\"'large'\" (ngModelChange)=\"loadAll()\"></nz-datepicker> <nz-select style=\"width: 150px;\" [nzSize]=\"'large'\" [nzPlaceHolder]=\"'\u652F\u4ED8\u7C7B\u578B'\" [(ngModel)]=\"listView.params.outPayKind\" (ngModelChange)=\"filter()\" nzAllowClear><nz-option *ngFor=\"let option of openPayKinds\" [nzLabel]=\"option.name\" [nzValue]=\"option.kind\"></nz-option></nz-select> <nz-input [nzType]=\"'search'\" [(ngModel)]=\"listView.params.searchQuery\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u68C0\u7D22\u5173\u952E\u5B57'\" style=\"width: 300px;vertical-align: top;\" (nzOnSearch)=\"search($event)\" [nzSize]=\"'large'\"></nz-input></ng-template><ng-template #content><zx-list-view [listView]=\"listView\" (loadData)=\"loadAll()\"><ng-template #dataColumn let-dataRow=\"dataRow\" let-field=\"field\" let-value=\"value\"><div *ngIf=\"field.name == 'payTime'\"><span>{{dataRow.payTime | date:'yyyy-MM-dd HH:mm:ss'}}</span></div><div *ngIf=\"field.name == 'outPayKind'\"><span>{{formateValue(dataRow.outPayKind)}}</span></div><div *ngIf=\"field.name == 'paySuccess'\"><span>{{dataRow.paySuccess ? '\u652F\u4ED8\u6210\u529F' : '\u652F\u4ED8\u5931\u8D25'}}</span></div></ng-template><ng-template #dataOperations let-dataRow=\"dataRow\"><div><a [routerLink]=\"['../property-transaction-record', dataRow.id ]\">\u8BE6\u60C5</a></div></ng-template></zx-list-view></ng-template></zx-content-block>",
styles: [
"\n :host ::ng-deep .operations{\n width:88px !important;\n }\n :host ::ng-deep .extra{\n width:calc(100% - 88px) !important;\n }\n :host ::ng-deep nz-cascader{\n display:inline-block;\n width:250px;\n text-align: left;\n }\n "
]
},] },
];
/** @nocollapse */
PropertyTransactionRecordComponent.ctorParameters = function () { return [
{ type: core_1.Injector, },
{ type: data_source_helper_1.DataSourceHelper, },
{ type: ngx_webapp_fx_1.UserStorageService, },
{ type: ng_zorro_antd_1.NzMessageService, },
{ type: common_1.DatePipe, },
{ type: ng_zorro_antd_1.NzModalService, },
]; };
PropertyTransactionRecordComponent.propDecorators = {
"listControl": [{ type: core_1.ViewChild, args: ['list',] },],
};
return PropertyTransactionRecordComponent;
}());
exports.PropertyTransactionRecordComponent = PropertyTransactionRecordComponent;
//# sourceMappingURL=property-transaction-record.component.js.map