@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
119 lines • 6.48 kB
JavaScript
;
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 message_template_dialog_component_1 = require("./message-template-dialog.component");
var ng_zorro_antd_1 = require("ng-zorro-antd");
var router_1 = require("@angular/router");
var def = {
data: null,
showOperations: true,
fields: {
id: {
label: 'id',
hidden: true,
sort: { enabled: false },
query: {},
filter: { enabled: false }
},
title: {
label: '模版标题',
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
templateId: {
label: '模版ID',
sort: { enabled: true },
query: {},
filter: { enabled: false }
},
primaryIndustry: {
label: '行业',
sort: { enabled: true },
query: {},
filter: { enabled: false },
dataTemplateEnabled: true
}
}
};
var MessageTemplateComponent = /** @class */ (function () {
function MessageTemplateComponent(injector, confirmServ, dataSourceHelper, activateRoute, _message) {
this.injector = injector;
this.confirmServ = confirmServ;
this.dataSourceHelper = dataSourceHelper;
this.activateRoute = activateRoute;
this._message = _message;
this.dataSource = this.dataSourceHelper.templateMessages;
this.templateMessagesSyncFromWeixinDataSource = this.dataSourceHelper.templateMessagesSyncFromWeixin;
}
MessageTemplateComponent.prototype.ngOnInit = function () {
this.id = this.activateRoute.snapshot.params['id'];
this.listView = new ngx_webapp_fx_1.ListView(def, this.injector);
this.loadAll();
};
MessageTemplateComponent.prototype.loadAll = function () {
var _this = this;
this.dataSource.findList({
officalId: this.id,
page: this.listView.pageIndex - 1,
size: this.listView.pageSize,
sort: this.listView.sortValueToQueryStatement
}).subscribe(function (res) {
_this.listView.data = res.body;
_this.listView.setTotal(res.headers);
});
};
MessageTemplateComponent.prototype.insert = function (id, templateIdShort) {
this.messageTemplateDialog.loadAll(id, templateIdShort);
};
MessageTemplateComponent.prototype.delete = function (dataRow) {
var _self = this;
this.confirmServ.confirm({
title: '您确定要删除此内容?',
onOk: function () {
_self.dataSource.delete(dataRow.id).subscribe(function (success) {
_self.loadAll();
});
},
});
};
MessageTemplateComponent.prototype.synchronizationTemplate = function () {
var _self = this;
this.confirmServ.confirm({
title: '您确定要同步模板?',
onOk: function () {
_self.templateMessagesSyncFromWeixinDataSource.create(null, { officalId: _self.id }).subscribe(function (success) {
_self._message.success('同步成功');
_self.loadAll();
}, function (error) {
_self._message.error('同步失败');
});
},
});
};
MessageTemplateComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-message-template',
template: "<zx-header-block [title]=\"'\u6A21\u7248\u6D88\u606F\u8BBE\u7F6E'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\"><p>\u516C\u4F17\u53F7\u6A21\u7248\u6D88\u606F\u4FE1\u606F\u7BA1\u7406</p></zx-header-block><zx-content-block><ng-template #operations><button nz-button [nzType]=\"'primary'\" [routerLink]=\"['../../template']\"><span>\u6DFB\u52A0\u6A21\u677F</span></button> <button nz-button [nzType]=\"'primary'\" (click)=\"synchronizationTemplate()\"><span>\u540C\u6B65\u6A21\u677F</span></button></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 == 'primaryIndustry'\"><span>{{dataRow.primaryIndustry}}</span> <span *ngIf=\"dataRow.primaryIndustry && dataRow.deputyIndustry\">--</span> <span>{{dataRow.deputyIndustry}}</span></div></ng-template><ng-template #dataOperations let-dataRow=\"dataRow\"><div class=\"operation\"><a [routerLink]=\"['../../message', dataRow.templateIdShort]\">\u6D88\u606F\u5217\u8868</a> <a (click)=\"insert(dataRow.id, dataRow.templateIdShort)\">\u65B0\u5EFA\u6D88\u606F</a> <a (click)=\"delete(dataRow)\" style=\"color:#FF0000\">\u5220\u9664</a></div></ng-template></zx-list-view></ng-template></zx-content-block><zx-message-template-dialog #messageTemplateDialog></zx-message-template-dialog>",
styles: [
"\n :host .operation > a{\n padding: 0 5px;\n }\n :host .operation > a::after{\n content: \"|\";\n padding-left: 15px;\n color: #999;\n vertical-align: text-bottom;\n }\n :host .operation > a:last-child::after{\n content:\"\";\n }\n :host ::ng-deep .ant-table-thead > tr > th:nth-child(5) {\n width: 25%;\n }\n "
]
},] },
];
/** @nocollapse */
MessageTemplateComponent.ctorParameters = function () { return [
{ type: core_1.Injector, },
{ type: ng_zorro_antd_1.NzModalService, },
{ type: data_source_helper_1.DataSourceHelper, },
{ type: router_1.ActivatedRoute, },
{ type: ng_zorro_antd_1.NzMessageService, },
]; };
MessageTemplateComponent.propDecorators = {
"messageTemplateDialog": [{ type: core_1.ViewChild, args: ['messageTemplateDialog',] },],
};
return MessageTemplateComponent;
}());
exports.MessageTemplateComponent = MessageTemplateComponent;
//# sourceMappingURL=message-template.component.js.map