@ecip/app
Version:
348 lines (339 loc) • 20.7 kB
JavaScript
import { __spread } from 'tslib';
import { RouterModule } from '@angular/router';
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, ModalHelper } from '@delon/theme';
import { CacheService } from '@delon/cache';
import { DictService } from '@ecip/service';
import { SharedModule } from '@ecip/shared';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var AppAppsEditComponent = /** @class */ (function () {
function AppAppsEditComponent(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 = function (control) {
return Observable.create(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(function (res) {
if (res.valid === true) {
observer.next(null);
}
else {
observer.next({ error: true, duplicated: true });
}
observer.complete();
});
});
};
}
/**
* @return {?}
*/
AppAppsEditComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
var _this = this;
this.form = this.fb.group({
appId: [null, []],
appName: [null, [Validators.required], [this.appNameAsyncValidator]],
typeApp: [null, [Validators.required]],
typeAuth: [null, [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(function (res) {
_this.form.patchValue(res);
_this.i = res;
});
};
/**
* @param {?} c1
* @param {?} c2
* @return {?}
*/
AppAppsEditComponent.prototype.compareNumStr = /**
* @param {?} c1
* @param {?} c2
* @return {?}
*/
function (c1, c2) {
return c1 == c2;
};
/**
* @return {?}
*/
AppAppsEditComponent.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(function (res) {
_this.msgSrv.success('保存成功');
_this.modal.close(true);
});
return;
}
//修改
this.http.put("api/v1/sysrRegisterApp/" + this.record.appId, this.form.value).subscribe(function (res) {
_this.msgSrv.success('保存成功');
_this.modal.close(true);
});
};
/**
* @return {?}
*/
AppAppsEditComponent.prototype.close = /**
* @return {?}
*/
function () {
this.modal.destroy();
};
AppAppsEditComponent.decorators = [
{ type: Component, args: [{
selector: 'app-app-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 <!--<div nz-col nzSpan=\"12\">\r\n <nz-form-item>\r\n <nz-form-label nzXs=\"24\" nzSm=\"7\" nzRequired nzFor=\"rsvn\">\u7248\u672C\u53F7</nz-form-label>\r\n <nz-form-control nzXs=\"24\" nzSm=\"12\" nzMd=\"10\" nzHasFeedback>\r\n <input nz-input formControlName=\"rsvn\">\r\n <nz-form-explain *ngIf=\"form.get('rsvn').dirty && form.get('rsvn').errors\">\r\n \u8BF7\u8F93\u5165\u7CFB\u7EDF\u7248\u672C\u53F7\r\n </nz-form-explain>\r\n </nz-form-control>\r\n </nz-form-item>\r\n </div>-->\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 nzValue=\"1\" nzLabel=\"web\u5E94\u7528\"></nz-option>-->\r\n <!--<nz-option nzValue=\"2\" nzLabel=\"Restful API\u63A5\u53E3\"></nz-option>-->\r\n <!--<nz-option nzValue=\"3\" nzLabel=\"\u62A5\u8868\u7CFB\u7EDF\"></nz-option>-->\r\n <!--<nz-option nzValue=\"4\" nzLabel=\"\u5916\u90E8\u94FE\u63A5\u5E94\u7528\"></nz-option>-->\r\n <!--<nz-option nzValue=\"0\" nzLabel=\"\u5176\u4ED6\u901A\u7528\"></nz-option>-->\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 [nzValue]=\"1\">\u542F\u7528</label>-->\r\n <!--<label nz-radio [nzValue]=\"0\">\u672A\u542F\u7528</label>-->\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 nzValue=\"1\" nzLabel=\"Cookie-Session\"></nz-option>-->\r\n <!--<nz-option nzValue=\"2\" nzLabel=\"JWT Token\"></nz-option>-->\r\n <!--<nz-option nzValue=\"3\" nzLabel=\"OAuth \u8BA4\u8BC1\"></nz-option>-->\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 [nzValue]=\"1\">\u542F\u7528</label>-->\r\n <!--<label nz-radio [nzValue]=\"0\">\u672A\u542F\u7528</label>-->\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 [nzValue]=\"1\">\u542F\u7528</label>-->\r\n <!--<label nz-radio [nzValue]=\"0\">\u672A\u542F\u7528</label>-->\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 [nzValue]=\"1\">\u542F\u7528</label>-->\r\n <!--<label nz-radio [nzValue]=\"0\">\u672A\u542F\u7528</label>-->\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 */
AppAppsEditComponent.ctorParameters = function () { return [
{ type: NzModalRef },
{ type: NzMessageService },
{ type: _HttpClient },
{ type: FormBuilder },
{ type: CacheService }
]; };
return AppAppsEditComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var AppAppsViewComponent = /** @class */ (function () {
function AppAppsViewComponent(modal, msgSrv, http) {
this.modal = modal;
this.msgSrv = msgSrv;
this.http = http;
this.record = {};
}
/**
* @return {?}
*/
AppAppsViewComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
var _this = this;
this.http.get("api/v1/sysrRegisterApp/" + this.record.appId).subscribe(function (res) { return _this.i = res; });
};
/**
* @return {?}
*/
AppAppsViewComponent.prototype.close = /**
* @return {?}
*/
function () {
this.modal.destroy();
};
AppAppsViewComponent.decorators = [
{ type: Component, args: [{
selector: 'app-app-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 */
AppAppsViewComponent.ctorParameters = function () { return [
{ type: NzModalRef },
{ type: NzMessageService },
{ type: _HttpClient }
]; };
return AppAppsViewComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var AppAppsComponent = /** @class */ (function () {
function AppAppsComponent(http, modal, msgSrv, cacheService, dictService) {
var _this = this;
this.http = http;
this.modal = modal;
this.msgSrv = msgSrv;
this.cacheService = cacheService;
this.dictService = dictService;
this.url = "api/v1/sysrRegisterApp/list";
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: AppAppsViewComponent, click: 'reload', acl: { ability: ['apps:view'] } },
{
text: '',
children: [
{ text: '编辑', type: 'static', component: AppAppsEditComponent, click: 'reload', acl: { ability: ['apps:edit'] } },
{ text: '删除', type: 'del', click: function (item) {
//删除
//删除
_this.http.delete("api/v1/sysrRegisterApp/" + item.appId).subscribe(function (res) {
_this.msgSrv.success('删除成功');
_this.st.reload();
});
},
acl: { ability: ['apps:remove'] }
},
],
},
]
}
];
}
/**
* @return {?}
*/
AppAppsComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () { };
// 新增
/**
* @return {?}
*/
AppAppsComponent.prototype.add = /**
* @return {?}
*/
function () {
var _this = this;
this.modal
.createStatic(AppAppsEditComponent, {})
.subscribe(function () { return _this.st.reload(); });
};
AppAppsComponent.decorators = [
{ type: Component, args: [{
selector: 'app-app-apps',
template: "<page-header [action]=\"phAction\">\r\n <ng-template #phAction>\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 */
AppAppsComponent.ctorParameters = function () { return [
{ type: _HttpClient },
{ type: ModalHelper },
{ type: NzMessageService },
{ type: CacheService },
{ type: DictService }
]; };
AppAppsComponent.propDecorators = {
st: [{ type: ViewChild, args: ['st',] }]
};
return AppAppsComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/** @type {?} */
var routes = [
{ path: 'apps', component: AppAppsComponent }
];
var AppRoutingModule = /** @class */ (function () {
function AppRoutingModule() {
}
AppRoutingModule.decorators = [
{ type: NgModule, args: [{
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
},] }
];
return AppRoutingModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/** @type {?} */
var COMPONENTS = [
AppAppsComponent
];
/** @type {?} */
var COMPONENTS_NOROUNT = [
AppAppsViewComponent,
AppAppsEditComponent
];
var AppModule = /** @class */ (function () {
function AppModule() {
}
AppModule.decorators = [
{ type: NgModule, args: [{
imports: [
SharedModule,
AppRoutingModule
],
declarations: __spread(COMPONENTS, COMPONENTS_NOROUNT),
entryComponents: COMPONENTS_NOROUNT
},] }
];
return AppModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
export { AppModule, AppRoutingModule, AppAppsComponent, AppAppsViewComponent, AppAppsEditComponent };
//# sourceMappingURL=app.js.map