@ecip/app
Version:
400 lines (386 loc) • 24.9 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('/router'), require('@angular/forms'), require('rxjs'), require('/core'), require('ng-zorro-antd'), require('@delon/theme'), require('/cache'), require('@ecip/service'), require('/shared')) :
typeof define === 'function' && define.amd ? define('/app', ['exports', '@angular/router', '@angular/forms', 'rxjs', '@angular/core', 'ng-zorro-antd', '@delon/theme', '@delon/cache', '@ecip/service', '@ecip/shared'], factory) :
(factory((global.ecip = global.ecip || {}, global.ecip.app = {}),global.ng.router,global.ng.forms,global.rxjs,global.ng.core,global.ngZorroAntd,global.theme,global.cache,global['1']['0']['0-rc']['3'],global['1']['0']['0-rc']['3']));
}(this, (function (exports,router,forms,rxjs,core,ngZorroAntd,theme,cache,service,shared) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/**
* @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 rxjs.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, [forms.Validators.required], [this.appNameAsyncValidator]],
typeApp: [null, [forms.Validators.required]],
typeAuth: [null, [forms.Validators.required]],
remark: [null, []],
createDate: [null, []],
flagIp: [0, []],
flagLLog: [0, []],
flagLogOpt: [0, []],
status: [1, [forms.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: core.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: ngZorroAntd.NzModalRef },
{ type: ngZorroAntd.NzMessageService },
{ type: theme._HttpClient },
{ type: forms.FormBuilder },
{ type: cache.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: core.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: ngZorroAntd.NzModalRef },
{ type: ngZorroAntd.NzMessageService },
{ type: theme._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: core.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: theme._HttpClient },
{ type: theme.ModalHelper },
{ type: ngZorroAntd.NzMessageService },
{ type: cache.CacheService },
{ type: service.DictService }
];
};
AppAppsComponent.propDecorators = {
st: [{ type: core.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: core.NgModule, args: [{
imports: [router.RouterModule.forChild(routes)],
exports: [router.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: core.NgModule, args: [{
imports: [
shared.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
*/
exports.AppModule = AppModule;
exports.AppRoutingModule = AppRoutingModule;
exports.AppAppsComponent = AppAppsComponent;
exports.AppAppsViewComponent = AppAppsViewComponent;
exports.AppAppsEditComponent = AppAppsEditComponent;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=app.umd.js.map