UNPKG

@ecip/application

Version:
473 lines (464 loc) 23.1 kB
import { __spread } from 'tslib'; import { SharedModule } from '@ecip/shared'; import '@delon/abc'; import { FormBuilder, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; import { Component, ViewChild, NgModule } from '@angular/core'; import { NzModalRef, NzMessageService } from 'ng-zorro-antd'; import { _HttpClient, MenuService, ModalHelper } from '@delon/theme'; import { CacheService } from '@delon/cache'; import { DictService } from '@ecip/service'; import { Router, RouterModule } from '@angular/router'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ApplicationAppsEditComponent = /** @class */ (function () { function ApplicationAppsEditComponent(modal, msgSrv, http, fb, cacheService) { var _this = this; this.modal = modal; this.msgSrv = msgSrv; this.http = http; this.fb = fb; this.cacheService = cacheService; this.record = {}; this.stateList = this.cacheService.get("api/dict/type/enableState"); this.typeAppList = this.cacheService.get("api/dict/type/typeApp"); this.authTypeList = this.cacheService.get("api/dict/type/authType"); this.appNameAsyncValidator = (/** * @param {?} control * @return {?} */ function (control) { return Observable.create((/** * @param {?} observer * @return {?} */ function (observer) { if (!control.value) { observer.next(null); observer.complete(); return; } _this.http.get("api/v1/sysrRegisterApp/checkAppName", { appName: control.value, appId: _this.record.appId }).subscribe((/** * @param {?} res * @return {?} */ function (res) { if (res.valid === true) { observer.next(null); } else { observer.next({ error: true, duplicated: true }); } observer.complete(); })); })); }); } /** * @return {?} */ ApplicationAppsEditComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.typeAppList.subscribe((/** * @param {?} res * @return {?} */ function (res) { if (res) { _this.typeApp = res[0]; } })); this.authTypeList.subscribe((/** * @param {?} res * @return {?} */ function (res) { if (res) { _this.typeAuth = res[0]; } })); this.form = this.fb.group({ appId: [null, []], appName: [null, [Validators.required], [this.appNameAsyncValidator]], typeApp: [this.typeApp ? this.typeApp.value : '', [Validators.required]], typeAuth: [this.typeAuth ? this.typeAuth.value : '', [Validators.required]], remark: [null, []], createDate: [null, []], flagIp: [0, []], flagLLog: [0, []], flagLogOpt: [0, []], status: [1, [Validators.required]], }); if (!this.record.appId) { return; } this.http.get("api/v1/sysrRegisterApp/" + this.record.appId).subscribe((/** * @param {?} res * @return {?} */ function (res) { _this.form.patchValue(res); _this.i = res; })); }; /** * @param {?} c1 * @param {?} c2 * @return {?} */ ApplicationAppsEditComponent.prototype.compareNumStr = /** * @param {?} c1 * @param {?} c2 * @return {?} */ function (c1, c2) { return c1 == c2; }; /** * @return {?} */ ApplicationAppsEditComponent.prototype.submit = /** * @return {?} */ function () { var _this = this; for (var i in this.form.controls) { this.form.controls[i].markAsDirty(); this.form.controls[i].updateValueAndValidity(); } if (this.form.invalid) return; if (!this.record.appId) { //新增 this.http.post("api/v1/sysrRegisterApp", this.form.value).subscribe((/** * @param {?} res * @return {?} */ function (res) { _this.msgSrv.success('保存成功'); _this.modal.close(true); })); return; } //修改 this.http.put("api/v1/sysrRegisterApp/" + this.record.appId, this.form.value).subscribe((/** * @param {?} res * @return {?} */ function (res) { _this.msgSrv.success('保存成功'); _this.modal.close(true); })); }; /** * @return {?} */ ApplicationAppsEditComponent.prototype.close = /** * @return {?} */ function () { this.modal.destroy(); }; ApplicationAppsEditComponent.decorators = [ { type: Component, args: [{ selector: 'app-application-apps-edit', template: "<div class=\"modal-header\">\r\n <div *ngIf=\"!record.appId\" class=\"modal-title\">\u65B0\u589E\u5E94\u7528\u4FE1\u606F</div>\r\n <div *ngIf=\"record.appId\" class=\"modal-title\">\u7F16\u8F91\u5E94\u7528\u4FE1\u606F</div>\r\n</div>\r\n<!--<nz-spin *ngIf=\"!i && !record.id\" class=\"modal-spin\"></nz-spin>-->\r\n<form *ngIf=\"!record.appId || record.appId && i\" nz-form [formGroup]=\"form\" (ngSubmit)=\"submit()\">\r\n <div nz-row>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzRequired nzFor=\"appName\">\u5E94\u7528\u540D</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <input nz-input formControlName=\"appName\">\r\n <nz-form-explain *ngIf=\"form.get('appName').dirty && form.get('appName').errors\">\r\n \u7CFB\u7EDF\u540D\u4E0D\u5408\u6CD5\uFF08\u4E0D\u53EF\u4E3A\u7A7A\u6216\u91CD\u540D\uFF09\r\n </nz-form-explain>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n\r\n </div>\r\n <div nz-row>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzRequired nzFor=\"typeApp\">\u5E94\u7528\u7CFB\u7EDF\u7C7B\u578B</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <nz-select [compareWith]=\"compareNumStr\" nzAllowClear formControlName=\"typeApp\">\r\n <nz-option *ngFor=\"let typeApp of typeAppList | async\" [nzValue]=\"typeApp.value\" [nzLabel]=\"typeApp.label\"></nz-option>\r\n </nz-select>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzFor=\"flagIp\">\u5B89\u5168\u6027IP\u542F\u7528\u6807\u8BB0</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <nz-radio-group formControlName=\"flagIp\">\r\n <label nz-radio *ngFor=\"let state of stateList | async\" [nzValue]=\"state.value\">{{state.label}}</label>\r\n </nz-radio-group>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n </div>\r\n\r\n <div nz-row>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzRequired nzFor=\"typeAuth\">\u8BA4\u8BC1\u65B9\u5F0F</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <nz-select [compareWith]=\"compareNumStr\" nzAllowClear formControlName=\"typeAuth\">\r\n <nz-option *ngFor=\"let authType of authTypeList | async\" [nzValue]=\"authType.value\" [nzLabel]=\"authType.label\"></nz-option>\r\n </nz-select>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzFor=\"flagLLog\">\u767B\u5F55\u65E5\u5FD7\u542F\u7528\u6807\u8BB0</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <nz-radio-group formControlName=\"flagLLog\">\r\n <label nz-radio *ngFor=\"let state of stateList | async\" [nzValue]=\"state.value\">{{state.label}}</label>\r\n </nz-radio-group>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n </div>\r\n\r\n <div nz-row>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzFor=\"remark\">\u5907\u6CE8\u8BF4\u660E</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <input nz-input formControlName=\"remark\">\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzFor=\"flagLogOpt\">\u64CD\u4F5C\u65E5\u5FD7\u542F\u7528\u6807\u8BB0</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <nz-radio-group formControlName=\"flagLogOpt\">\r\n <label nz-radio *ngFor=\"let state of stateList | async\" [nzValue]=\"state.value\">{{state.label}}</label>\r\n </nz-radio-group>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n </div>\r\n\r\n <div nz-row>\r\n <div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzRequired nzFor=\"status\">\u542F\u7528\u72B6\u6001</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\">\r\n <nz-radio-group formControlName=\"status\">\r\n <label nz-radio *ngFor=\"let state of stateList | async\" [nzValue]=\"state.value\">{{state.label}}</label>\r\n </nz-radio-group>\r\n <nz-form-explain *ngIf=\"form.get('status').dirty && form.get('status').errors\">\r\n \u8BF7\u9009\u62E9\u542F\u7528\u72B6\u6001\r\n </nz-form-explain>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>\r\n </div>\r\n\r\n <div class=\"modal-footer\">\r\n <button nz-button type=\"button\" (click)=\"close()\">\u5173\u95ED</button>\r\n <button nz-button type=\"submit\" [disabled]=\"!form.valid\" nzType=\"primary\" [nzLoading]=\"http.loading\">\u4FDD\u5B58</button>\r\n </div>\r\n</form>\r\n\r\n" }] } ]; /** @nocollapse */ ApplicationAppsEditComponent.ctorParameters = function () { return [ { type: NzModalRef }, { type: NzMessageService }, { type: _HttpClient }, { type: FormBuilder }, { type: CacheService } ]; }; return ApplicationAppsEditComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ApplicationAppsViewComponent = /** @class */ (function () { function ApplicationAppsViewComponent(modal, msgSrv, http) { this.modal = modal; this.msgSrv = msgSrv; this.http = http; this.record = {}; } /** * @return {?} */ ApplicationAppsViewComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.http.get("api/v1/sysrRegisterApp/" + this.record.appId).subscribe((/** * @param {?} res * @return {?} */ function (res) { return _this.i = res; })); }; /** * @return {?} */ ApplicationAppsViewComponent.prototype.close = /** * @return {?} */ function () { this.modal.destroy(); }; ApplicationAppsViewComponent.decorators = [ { type: Component, args: [{ selector: 'app-application-apps-view', template: "<div class=\"modal-header\">\r\n <div class=\"modal-title\">\u67E5\u770B {{ record.appId }} \u4FE1\u606F</div>\r\n</div>\r\n<nz-spin *ngIf=\"!i\" class=\"modal-spin\"></nz-spin>\r\n<sv-container *ngIf=\"i\">\r\n <sv label=\"\u7CFB\u7EDFID\">{{ i.appId}}</sv>\r\n <sv label=\"\u7CFB\u7EDF\u540D\u79F0\">{{ i.appName }}</sv>\r\n <sv label=\"\u7248\u672C\u53F7\">{{ i.rsvn }}</sv>\r\n <sv label=\"\u7CFB\u7EDF\u7C7B\u578B\">{{i.typeApp | dictLabel : \"typeApp\" | async}}</sv>\r\n <sv label=\"\u8BA4\u8BC1\u65B9\u5F0F\">{{i.typeAuth | dictLabel : \"authType\" | async}}</sv>\r\n <sv label=\"\u5907\u6CE8\u8BF4\u660E\">{{i.remark}}</sv>\r\n <sv label=\"\u6CE8\u518C\u65E5\u671F\">{{i.createDate}}</sv>\r\n <sv label=\"\u5B89\u5168\u6027IP\u542F\u7528\u6807\u8BB0\">{{i.flagIpText}}</sv>\r\n <sv label=\"\u767B\u9646\u65E5\u5FD7\u542F\u7528\u6807\u8BB0\">{{i.flagLLogText}}</sv>\r\n <sv label=\"\u64CD\u4F5C\u65E5\u5FD7\u542F\u7528\u6807\u8BB0\">{{i.flagLogOptText}}</sv>\r\n <sv label=\"\u542F\u7528\u72B6\u6001\">{{i.statusText}}</sv>\r\n</sv-container>\r\n<div class=\"modal-footer\">\r\n <button nz-button type=\"button\" (click)=\"close()\">\u5173\u95ED</button>\r\n</div>" }] } ]; /** @nocollapse */ ApplicationAppsViewComponent.ctorParameters = function () { return [ { type: NzModalRef }, { type: NzMessageService }, { type: _HttpClient } ]; }; return ApplicationAppsViewComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ApplicationAppsComponent = /** @class */ (function () { function ApplicationAppsComponent(http, modal, msgSrv, cacheService, dictService, menuSrv, router) { var _this = this; this.http = http; this.modal = modal; this.msgSrv = msgSrv; this.cacheService = cacheService; this.dictService = dictService; this.menuSrv = menuSrv; this.router = router; this.url = "api/v1/sysrRegisterApp/list"; // navigationSubscription; this.searchSchema = { properties: { //搜索属性设置 appName: { type: 'string', title: '系统名称' } } }; this.columns = [ { title: '系统ID', index: 'appId' }, { title: '系统名称', index: 'appName' }, { title: '版本号', index: 'rsvn' }, { title: '系统类型', render: 'typeApp' }, { title: '认证方式', render: 'typeAuth' }, { title: '备注说明', index: 'remark' }, { title: '注册日期', type: 'date', index: 'createDate' }, { title: '安全性IP启用标记', index: 'flagIpText' }, { title: '登录日志启用标记', index: 'flagLLogText' }, { title: '操作日志启用标记', index: 'flagLogOptText' }, { title: '启用状态', index: 'statusText' }, { title: '操作', width: '100px', buttons: [ { text: '查看', type: 'static', component: ApplicationAppsViewComponent, click: 'reload', acl: { ability: ['apps:view'] } }, { text: '', children: [ { text: '编辑', type: 'static', component: ApplicationAppsEditComponent, click: 'reload', acl: { ability: ['apps:edit'] } }, { text: '删除', type: 'del', click: (/** * @param {?} item * @return {?} */ function (item) { //删除 _this.http.delete("api/v1/sysrRegisterApp/" + item.appId).subscribe((/** * @param {?} res * @return {?} */ function (res) { _this.msgSrv.success('删除成功'); _this.st.reload(); })); }), acl: { ability: ['apps:remove'] } }, ], }, ] } ]; // this.navigationSubscription = this.router.events.subscribe((event: any) => { // if (event instanceof NavigationEnd) { // setTimeout(() => { // this.sf.reset(true); // }, 100); // } // }); } // _onReuseInit() { // this.navigationSubscription = this.router.events.subscribe((event: any) => { // if (event instanceof NavigationEnd) { // setTimeout(() => { // this.sf.reset(true); // }, 100); // } // }); // } // _onReuseDestroy() { // if (this.navigationSubscription) { // this.navigationSubscription.unsubscribe(); // } // } // _onReuseInit() { // this.navigationSubscription = this.router.events.subscribe((event: any) => { // if (event instanceof NavigationEnd) { // setTimeout(() => { // this.sf.reset(true); // }, 100); // } // }); // } // _onReuseDestroy() { // if (this.navigationSubscription) { // this.navigationSubscription.unsubscribe(); // } // } /** * @return {?} */ ApplicationAppsComponent.prototype.ngOnDestroy = // _onReuseInit() { // this.navigationSubscription = this.router.events.subscribe((event: any) => { // if (event instanceof NavigationEnd) { // setTimeout(() => { // this.sf.reset(true); // }, 100); // } // }); // } // _onReuseDestroy() { // if (this.navigationSubscription) { // this.navigationSubscription.unsubscribe(); // } // } /** * @return {?} */ function () { // if (this.navigationSubscription) { // this.navigationSubscription.unsubscribe(); // } }; /** * @return {?} */ ApplicationAppsComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; // 新增 // 新增 /** * @return {?} */ ApplicationAppsComponent.prototype.add = // 新增 /** * @return {?} */ function () { var _this = this; this.modal .createStatic(ApplicationAppsEditComponent, {}) .subscribe((/** * @return {?} */ function () { return _this.st.reload(); })); }; ApplicationAppsComponent.decorators = [ { type: Component, args: [{ selector: 'app-application-apps', template: "<page-header [action]=\"phPhAction\">\r\n <ng-template #phPhAction>\r\n <button acl [acl-ability]=\"'apps:add'\" (click)=\"add()\" nz-button nzType=\"primary\">\u65B0\u5EFA</button>\r\n </ng-template>\r\n</page-header>\r\n<nz-card>\r\n <sf mode=\"search\" [schema]=\"searchSchema\" (formSubmit)=\"st.reset($event)\" (formReset)=\"st.reset($event)\"></sf>\r\n <st #st [data]=\"url\" [columns]=\"columns\">\r\n <ng-template st-row=\"typeApp\" let-item let-index=\"index\">\r\n {{item.typeApp | dictLabel:'typeApp' | async}}\r\n <!--{{dictService.dictLabel('typeApp', item.typeApp) | async}}-->\r\n </ng-template>\r\n <ng-template st-row=\"typeAuth\" let-item let-index=\"index\">{{item.typeAuth | dictLabel:'authType' | async}}</ng-template>\r\n </st>\r\n</nz-card>\r\n" }] } ]; /** @nocollapse */ ApplicationAppsComponent.ctorParameters = function () { return [ { type: _HttpClient }, { type: ModalHelper }, { type: NzMessageService }, { type: CacheService }, { type: DictService }, { type: MenuService }, { type: Router } ]; }; ApplicationAppsComponent.propDecorators = { st: [{ type: ViewChild, args: ['st',] }] }; return ApplicationAppsComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var routes = [ { path: 'apps', component: ApplicationAppsComponent } ]; var ApplicationRoutingModule = /** @class */ (function () { function ApplicationRoutingModule() { } ApplicationRoutingModule.decorators = [ { type: NgModule, args: [{ imports: [RouterModule.forChild(routes)], exports: [RouterModule] },] } ]; return ApplicationRoutingModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var COMPONENTS = [ ApplicationAppsComponent ]; /** @type {?} */ var COMPONENTS_NOROUNT = [ ApplicationAppsViewComponent, ApplicationAppsEditComponent ]; var ApplicationModule = /** @class */ (function () { function ApplicationModule() { } ApplicationModule.decorators = [ { type: NgModule, args: [{ imports: [ SharedModule, ApplicationRoutingModule ], declarations: __spread(COMPONENTS, COMPONENTS_NOROUNT), entryComponents: COMPONENTS_NOROUNT },] } ]; return ApplicationModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { ApplicationModule, ApplicationRoutingModule, ApplicationAppsComponent, ApplicationAppsViewComponent, ApplicationAppsEditComponent }; //# sourceMappingURL=application.js.map