提交 d2a097ac 编写于 作者: JunZai's avatar JunZai

update

上级 343461aa
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"test": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "less"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/test",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
"output": "/assets/"
}
],
"styles": [
"src/styles.less"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "test:build",
"host": "0.0.0.0",
"port": 8100,
"proxyConfig": "./proxy.config.json"
},
"configurations": {
"production": {
"browserTarget": "test:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "test:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.less"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "test:serve"
},
"configurations": {
"production": {
"devServerTarget": "test:serve:production"
}
}
}
}
}
},
"defaultProject": "test"
}
\ No newline at end of file
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
\ No newline at end of file
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
\ No newline at end of file
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to test!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/test'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
此差异已折叠。
{
"name": "test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"font-awesome": "^4.7.0",
"ng-zorro-antd": "^8.1.2",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.1",
"@angular/cli": "~8.2.1",
"@angular/compiler-cli": "~8.2.0",
"@angular/language-service": "~8.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
{
"/": {
"target": "http://127.0.0.1:8080/${app.getCodeName()}"
}
}
\ No newline at end of file
<router-outlet></router-outlet>
\ No newline at end of file
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'test'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('test');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to test!');
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.less']
})
export class AppComponent {
title = 'test';
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { HttpInterceptorService } from './../global/http/http-interceptor';
registerLocaleData(zh);
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NgZorroAntdModule,
FormsModule,
HttpClientModule,
BrowserAnimationsModule
],
providers: [{ provide: NZ_I18N, useValue: zh_CN }, { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true }],
bootstrap: [AppComponent]
})
export class AppModule { }
<nz-checkbox-group [ngModel]="items" [nzDisabled]="disabled" (ngModelChange)="onValueChange()" [ngStyle]="{width: width + 'px'}"></nz-checkbox-group>
\ No newline at end of file
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppCheckboxList } from './app-checkbox-list';
@NgModule({
imports: [
NzCheckboxModule,
CommonModule,
FormsModule,
],
declarations: [AppCheckboxList],
exports: [AppCheckboxList]
})
export class AppCheckboxListModule { }
import { CodeList } from '@global/service/codelist/CodeList';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-checkbox-list',
templateUrl: './app-checkbox-list.html',
styleUrls: ['./app-checkbox-list.less']
})
export class AppCheckboxList implements OnInit {
constructor(private $codelist: CodeList) { }
/**
* 值项
*
* @memberof AppCheckboxList
*/
@Input()
set value(val) {
if (val && this.items.length > 0) {
if (Object.is(this.mode, 'num')) {
let num: number = parseInt(val, 10);
this.items.forEach((item: any) => {
if ((num & item.value) == item.value) {
item.checked = true;
}
});
} else if (!this.mode || Object.is(this.mode, 'str')) {
let datas: any[] = val.split(this.separator ? this.separator : ';');
datas.forEach(data => {
let item = this.items.find((obj) => (obj.value == data));
if (item) {
item.checked = true;
}
});
}
}
}
/**
* 是否禁用
*
* @type {boolean}
* @memberof AppCheckboxList
*/
@Input() public disabled: boolean = false;
/**
* 代码表标识
*
* @type {string}
* @memberof AppCheckboxList
*/
@Input() public codeListId: string;
/**
* 值项
*
* @type {*}
* @memberof AppCheckboxList
*/
public itemValue: any = null;
/**
* 代码表项集合
*
* @type {any[]}
* @memberof AppCheckboxList
*/
public items: any[] = [];
/**
* 宽度
*
* @type {*}
* @memberof AppCheckboxList
*/
@Input() public width: any;
/**
* 模式(数字或者字符串)
*
* @type {*}
* @memberof AppCheckboxList
*/
@Input() mode: any;
/**
* 分隔符
*
* @type {*}
* @memberof AppCheckBox
*/
@Input() separator: any;
/**
* 表单项之变化事件
*
* @memberof AppCheckboxList
*/
@Output() public onFormItemValueChange: EventEmitter<any> = new EventEmitter<any>();
/**
* 生命周期
*
* @memberof AppCheckboxList
*/
public ngOnInit(): void {
if (this.codeListId) {
let datas = this.$codelist.getCodeListItems(this.codeListId);
if (!datas) {
return;
}
datas = JSON.parse(JSON.stringify(datas));
this.items = datas.map(data => {
return { ...data, checked: false };
});
}
}
/**
* 值变化
*
* @param {*} $event
* @memberof AppCheckboxList
*/
public onValueChange() {
let data = null;
if (Object.is(this.mode, 'num')) {
this.items.forEach(item => {
if (!item.checked) {
return;
}
data = 0 | parseInt(item.value, 10);
});
} else if (!this.mode || Object.is(this.mode, 'str')) {
let datas: any[] = [];
this.items.forEach(item => {
if (!item.checked) {
return;
}
datas.push(item.value);
});
data = datas.join(this.separator ? this.separator : ';');
}
console.log(data);
this.onFormItemValueChange.emit(data);
}
}
<nz-date-picker [ngModel]="value" [nzShowTime]="isShowTime" [nzDisabled]="disabled" [nzPlaceHolder]="placeholder" (ngModelChange)="onValueChange($event)" [nzFormat]="valFormat" [ngStyle]="{width: width + 'px'}"></nz-date-picker>
\ No newline at end of file
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppDatePicker } from './app-date-picker';
@NgModule({
imports: [
NzDatePickerModule,
CommonModule,
FormsModule,
],
declarations: [AppDatePicker],
exports: [AppDatePicker]
})
export class AppDatePickerModule { }
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-date-picker',
templateUrl: './app-date-picker.html',
styleUrls: ['./app-date-picker.less']
})
export class AppDatePicker implements OnInit {
/**
* 值项
*
* @memberof AppDatePicker
*/
@Input() public value: any;
/**
* 提示语
*
* @type {string}
* @memberof AppDatePicker
*/
@Input() public placeholder: string = '请选择';
/**
* 是否禁用
*
* @type {boolean}
* @memberof AppDatePicker
*/
@Input() public disabled: boolean;
/**
* 宽度
*
* @type {*}
* @memberof AppDatePicker
*/
@Input() public width: any;
/**
* 值格式
*
* @type {string}
* @memberof AppDatePicker
*/
@Input()
set format(val: string) {
this.valFormat = val;
if (this.valFormat.indexOf('HH') > 0) {
this.isShowTime = true;
}
}
/**
* 显示值格式
*
* @type {string}
* @memberof AppDatePicker
*/
public valFormat: string = 'yyyy-MM-dd';
/**
* 是否可选择时间
*
* @type {boolean}
* @memberof AppDatePicker
*/
public isShowTime: boolean = false;
/**
* 表单项之变化事件
*
* @memberof AppDatePicker
*/
@Output() public onFormItemValueChange: EventEmitter<any> = new EventEmitter<any>();
/**
* 生命周期
*
* @memberof AppDatePicker
*/
public ngOnInit(): void {
}
/**
* 值变化
*
* @param {*} $event
* @memberof AppDatePicker
*/
public onValueChange($event: any) {
let val = this.formatValue($event);
this.onFormItemValueChange.emit(val);
}
/**
* 处理值
*
* @param {Date} date
* @memberof AppDatePicker
*/
public formatValue(date: Date) {
if (!date) {
return null;
}
let data: string = this.valFormat;
let obj: any = {
yyyy: date.getFullYear(),
MM: this.AppendVal(date.getMonth() + 1),
dd: this.AppendVal(date.getDate()),
HH: this.AppendVal(date.getHours()),
mm: this.AppendVal(date.getMinutes()),
ss: this.AppendVal(date.getSeconds())
};
let keys = Object.keys(obj);
keys.forEach(key => {
let val = obj[key];
data = data.replace(key, val);
});
return data;
}
/**
* 值追加
*
* @param {number} val
* @returns
* @memberof AppDatePicker
*/
public AppendVal(val: number) {
return (val < 10 ? '0' + val : val);
}
}
<nz-radio-group [(ngModel)]="itemValue" (ngModelChange)="onValueChange($event)" [ngStyle]="{width: width + 'px'}">
<label nz-radio *ngFor="let item of items" [nzDisabled]="disabled" [nzValue]="item.value">{{ item.text }}</label>
</nz-radio-group>
\ No newline at end of file
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppRadio } from './app-radio';
@NgModule({
imports: [
NzRadioModule,
CommonModule,
FormsModule,
],
declarations: [AppRadio],
exports: [AppRadio]
})
export class AppRadioModule { }
import { CodeList } from '@global/service/codelist/CodeList';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-radio',
templateUrl: './app-radio.html',
styleUrls: ['./app-radio.less']
})
export class AppRadio implements OnInit {
constructor(private $codelist: CodeList) { }
/**
* 值项
*
* @memberof AppRadio
*/
@Input()
set value(val) {
this.itemValue = val;
}
/**
* 是否禁用
*
* @type {boolean}
* @memberof AppRadio
*/
@Input() public disabled: boolean = false;
/**
* 代码表标识
*
* @type {string}
* @memberof AppRadio
*/
@Input() public codeListId: string;
/**
* 值项
*
* @type {*}
* @memberof AppRadio
*/
public itemValue: any = null;
/**
* 代码表项集合
*
* @type {any[]}
* @memberof AppRadio
*/
public items: any[] = [];
/**
* 宽度
*
* @type {*}
* @memberof AppRadio
*/
@Input() public width: any;
/**
* 表单项之变化事件
*
* @memberof AppRadio
*/
@Output() public onFormItemValueChange: EventEmitter<any> = new EventEmitter<any>();
/**
* 生命周期
*
* @memberof AppRadio
*/
public ngOnInit(): void {
if (this.codeListId) {
this.items = this.$codelist.getCodeListItems(this.codeListId);
}
}
/**
* 值变化
*
* @param {*} $event
* @memberof AppRadio
*/
public onValueChange($event) {
this.onFormItemValueChange.emit($event);
}
}
<nz-select nzAllowClear [nzPlaceHolder]="placeholder" [ngModel]="itemValue" (ngModelChange)="onValueChange($event)" [ngStyle]="{width: width + 'px'}">
<nz-option *ngFor="let item of items" [nzLabel]="item.text" [nzValue]="item.value"></nz-option>
</nz-select>
\ No newline at end of file
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppSelect } from './app-select';
@NgModule({
imports: [
NzSelectModule,
CommonModule,
FormsModule,
],
declarations: [AppSelect],
exports: [AppSelect]
})
export class AppSelectModule { }
import { CodeList } from '@global/service/codelist/CodeList';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-select',
templateUrl: './app-select.html',
styleUrls: ['./app-select.less']
})
export class AppSelect implements OnInit {
constructor(private $codelist: CodeList) { }
/**
* 值项
*
* @memberof AppSelect
*/
@Input()
set value(val) {
this.itemValue = val;
}
/**
* 提示语
*
* @type {string}
* @memberof AppSelect
*/
@Input() public placeholder: string = '请选择';
/**
* 是否禁用
*
* @type {boolean}
* @memberof AppSelect
*/
@Input() public disabled: boolean = false;
/**
* 代码表标识
*
* @type {string}
* @memberof AppSelect
*/
@Input() public codeListId: string;
/**
* 值项
*
* @type {*}
* @memberof AppSelect
*/
public itemValue: any = null;
/**
* 代码表项集合
*
* @type {any[]}
* @memberof AppSelect
*/
public items: any[] = [];
/**
* 宽度
*
* @type {*}
* @memberof AppDatePicker
*/
@Input() public width: any;
/**
* 表单项之变化事件
*
* @memberof AppSelect
*/
@Output() public onFormItemValueChange: EventEmitter<any> = new EventEmitter<any>();
/**
* 生命周期
*
* @memberof AppSelect
*/
public ngOnInit(): void {
if (this.codeListId) {
this.items = this.$codelist.getCodeListItems(this.codeListId);
}
}
/**
* 值变化
*
* @param {*} $event
* @memberof AppSelect
*/
public onValueChange($event) {
this.onFormItemValueChange.emit($event);
}
}
<nz-time-picker [ngModel]="itemValue" [nzDisabled]="disabled" [nzPlaceHolder]="placeholder" (ngModelChange)="onValueChange($event)" [nzFormat]="format" [ngStyle]="{width: width + 'px'}"></nz-time-picker>
\ No newline at end of file
import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { AppTimePicker } from './app-time-picker';
@NgModule({
imports: [
NzTimePickerModule,
CommonModule,
FormsModule,
],
declarations: [AppTimePicker],
exports: [AppTimePicker]
})
export class AppTimePickerModule { }
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-time-picker',
templateUrl: './app-time-picker.html',
styleUrls: ['./app-time-picker.less']
})
export class AppTimePicker implements OnInit {
/**
* 值项
*
* @memberof AppTimePicker
*/
@Input()
set value(val) {
if (!val) {
this.itemValue = null;
return;
}
let data = 'HH:mm:ss';
data = data.replace(this.format, val).replace('HH', '12').replace('mm', '32').replace('ss', '15');
let date = '2019/09/01 ' + data;
this.itemValue = new Date(date);
}
/**
* 提示语
*
* @type {string}
* @memberof AppTimePicker
*/
@Input() public placeholder: string = '请选择';
/**
* 是否禁用
*
* @type {boolean}
* @memberof AppTimePicker
*/
@Input() public disabled: boolean = false;
/**
* 值格式
*
* @type {string}
* @memberof AppTimePicker
*/
@Input() public format: string = 'HH:mm:ss';
/**
* 值项
*
* @type {Date}
* @memberof AppTimePicker
*/
public itemValue: Date = null;
/**
* 宽度
*
* @type {*}
* @memberof AppDatePicker
*/
@Input() public width: any;
/**
* 表单项之变化事件
*
* @memberof AppTimePicker
*/
@Output() public onFormItemValueChange: EventEmitter<any> = new EventEmitter<any>();
/**
* 生命周期
*
* @memberof AppTimePicker
*/
public ngOnInit(): void {
}
/**
* 值变化
*
* @param {*} $event
* @memberof AppTimePicker
*/
public onValueChange($event: any) {
let val = this.formatValue($event);
this.onFormItemValueChange.emit(val);
}
/**
* 处理值
*
* @param {Date} date
* @memberof AppTimePicker
*/
public formatValue(date: Date) {
if (!date) {
return null;
}
let data: string = this.format;
let obj: any = {
HH: this.AppendVal(date.getHours()),
mm: this.AppendVal(date.getMinutes()),
ss: this.AppendVal(date.getSeconds())
};
let keys = Object.keys(obj);
keys.forEach(key => {
let val = obj[key];
data = data.replace(key, val);
});
return data;
}
/**
* 值追加
*
* @param {number} val
* @returns
* @memberof AppTimePicker
*/
public AppendVal(val: number) {
return (val < 10 ? '0' + val : val);
}
}
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { ShareModule } from '@share/share.module';
import { Login } from './login.page';
@NgModule({
imports: [
RouterModule.forChild([{ path: '', component: Login }])
],
exports: [
RouterModule
]
})
export class LoginRouteModule { }
@NgModule({
imports: [
NgZorroAntdModule,
CommonModule,
FormsModule,
ShareModule,
LoginRouteModule,
],
declarations: [Login]
})
export class LoginModule { }
<div class="app-login-view">
<img class="login-bg" src="/assets/img/login_bg.png"/>
<div class="login-container">
<div class="login-title">登 录</div>
<form nz-form class="login-form">
<nz-form-item>
<nz-input-group [nzPrefix]="prefixIconUser">
<input type="text" name="loginname" [(ngModel)]="loginname" nz-input placeholder="用户名" />
</nz-input-group>
<ng-template #prefixIconUser>
<i nz-icon nzType="user" nzTheme="outline"></i>
</ng-template>
</nz-form-item>
<nz-form-item>
<nz-input-group [nzPrefix]="prefixIconPwd">
<input type="password" name="password" [(ngModel)]="password" nz-input placeholder="密码" />
</nz-input-group>
<ng-template #prefixIconPwd>
<i nz-icon nzType="key" nzTheme="outline"></i>
</ng-template>
</nz-form-item>
</form>
<div class="form-submit">
<button nz-button (click)="handleSubmit()" nzType="primary" [nzBlock]="true">登录</button>
</div>
</div>
</div>
\ No newline at end of file
.app-login-view {
height: 100%;
width: 100%;
position: relative;
.login-bg {
height: 100%;
width: 100%;
}
.login-container {
width: 500px;
height: 400px;
position: absolute;
z-index: 1;
background: #fff;
top: calc((100% - 400px) / 2);
left: calc((100% - 500px) / 2);
border-radius: 10px;
.login-title {
font-size: 28px;
text-align: center;
margin: 40px 0;
color: #5584ff;
}
.login-form {
width: 380px;
margin: 0 auto;
.ivu-form-item {
margin-bottom: 36px;
.ivu-input-group {
height: 44px;
font-size: 30px;
.ivu-input {
height: 44px;
font-size: 18px;
}
.ivu-input-icon {
height: 44px;
line-height: 44px;
}
}
}
}
.form-submit {
width: 380px;
margin: 0 auto;
padding-top: 16px;
.ivu-btn {
font-size: 18px;
padding: 10px;
}
}
}
}
\ No newline at end of file
import { Router, ActivatedRoute, Params } from '@angular/router';
import { AppEnvironment } from '@environments/AppEnvironment';
import { Component, OnInit } from '@angular/core';
import { Http } from '@global/http/http';
import { NzNotificationService } from 'ng-zorro-antd/notification';
import { Observable } from 'rxjs';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
styleUrls: ['./login.page.less']
})
export class Login implements OnInit {
/**
* 构造方法
* @param {Http} $http
* @param {NzNotificationService} $notice
* @memberof Login
*/
constructor(private $http: Http, private $notice: NzNotificationService, private $avtiveRoute: ActivatedRoute, private $router: Router) { }
/**
* 登录用户名
*
* @private
* @type {string}
* @memberof Login
*/
private loginname: string = '';
/**
* 密码
*
* @private
* @type {string}
* @memberof Login
*/
private password: string = '';
/**
* 生命周期
*
* @memberof Login
*/
ngOnInit(): void {
}
/**
* 登录
*
* @memberof Login
*/
public handleSubmit() {
if (!this.loginname) {
this.$notice.error('错误', '用户名不能为空!');
}
if (!this.password) {
this.$notice.error('错误', '密码不能为空!');
}
let param: any = {
loginname: this.loginname,
password: this.password
};
this.$http.post(AppEnvironment.RemoteLogin, param).then((response: any) => {
this.$notice.success('', '登录成功');
const data = response;
localStorage.setItem(AppEnvironment.AppName + '-token', data.token);
localStorage.setItem(AppEnvironment.AppName + '-user', JSON.stringify(data.user));
let queryParams: any = this.$avtiveRoute.snapshot.queryParams;
if (queryParams && queryParams.RU) {
window.location.href = queryParams.RU;
} else {
this.$router.navigate(['']);
}
}).catch((error: any) => {
this.$notice.error('错误', '登录失败!');
});
}
}
import { SearchViewEngine } from './search-view-engine';
/**
* 实体图表视图界面引擎
*
* @export
* @class ChartViewEngine
* @extends {SearchViewEngine}
*/
export default class ChartViewEngine extends SearchViewEngine {
/**
* 图表对象
*
* @type {*}
* @memberof ChartViewEngine
*/
public chart: any;
/**
* 图表初始化
*
* @param {*} options
* @memberof ChartViewEngine
*/
public init(options: any): void {
this.chart = options.chart;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof ChartViewEngine
*/
public load(opts: any = {}): void {
super.load(opts);
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (!this.getSearchForm() && this.isLoadDefault) {
const tag = this.getChart().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: _srfparentdata });
}
this.isLoadDefault = true;
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof ChartViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'chart')) {
this.chartEvent(eventName, args);
}
}
/**
* 图表事件
*
* @param {string} eventName
* @param {*} args
* @memberof ChartViewEngine
*/
public chartEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'beforeload')) {
this.dataCtrlBeforeLoad(args)
}
}
/**
* 搜索表单加载完成
*
* @memberof ChartViewEngine
*/
public onSearchFormLoad(): void {
super.onSearchFormLoad();
if (this.getChart() && this.isLoadDefault) {
const tag = this.getChart().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: {} });
}
this.isLoadDefault = true;
}
/**
* 获取图表
*
* @returns {*}
* @memberof ChartViewEngine
*/
public getChart(): any {
return this.chart;
}
}
\ No newline at end of file
import ChartViewEngine from './chart-view-engine';
/**
* 实体图表视图(部件视图)界面引擎
*
* @export
* @class ChartView9Engine
* @extends {ChartViewEngine}
*/
export default class ChartView9Engine extends ChartViewEngine {
}
\ No newline at end of file
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class DataViewEngine
* @extends {MDViewEngine}
*/
export default class DataViewEngine extends MDViewEngine {
/**
* 表格部件
*
* @type {*}
* @memberof DataViewEngine
*/
protected dataView: any;
/**
* Creates an instance of DataViewEngine.
* @memberof DataViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof DataViewEngine
*/
public init(options: any = {}): void {
this.dataView = options.dataview;
super.init(options);
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof DataViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'dataview')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof DataViewEngine
*/
public getMDCtrl(): any {
return this.dataView;
}
/**
* 删除操作
*
* @returns {void}
* @memberof DataViewEngine
*/
public doRemove(): void {
let selectedData = this.getMDCtrl() && this.getMDCtrl().getSelection();
if (!selectedData || selectedData == null || selectedData.length === 0) {
return;
}
let dataInfo = '';
selectedData.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (selectedData.length < 5) {
dataInfo = dataInfo + '共' + selectedData.length + '条数据';
} else {
dataInfo = dataInfo + '...' + '共' + selectedData.length + '条数据';
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
// 询问框
this.view.$Modal.confirm({
title:'警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk:() => {
this.removeData(null);
},
onCancel: () => {
}
});
}
/**
* 删除
*
* @param {*} [arg={}]
* @returns {void}
* @memberof DataViewEngine
*/
public removeData(arg: any = {}): void {
if (!arg) {
arg = {};
}
// if (this.getParentMode()) {
// Object.assign(arg, this.getParentMode());
// }
// if (this.getParentData()) {
// Object.assign(arg, this.getParentData());
// }
if (!arg.srfkeys) {
// 获取要删除的数据集合
const selectedData: Array<any> = this.getMDCtrl() && this.getMDCtrl().getSelection();
if (!selectedData || selectedData == null || selectedData.length === 0) {
return;
}
let keys = '';
selectedData.forEach((record) => {
let key = record.srfkey;
if (!Object.is(keys, '')) {
keys += ';';
}
keys += key;
});
arg.srfkeys = keys;
}
const grid: any = this.getMDCtrl();
if (grid) {
grid.remove(arg);
}
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 编辑视图引擎
*
* @export
* @class EditViewEngine
* @extends {ViewEngine}
*/
export default class EditViewEngine extends ViewEngine {
/**
* 表单部件
*
* @protected
* @type {*}
* @memberof EditViewEngine
*/
protected form: any;
/**
* 父健为当前健
*
* @protected
* @type {string}
* @memberof EditViewEngine
*/
protected p2k: string = '';
/**
* 初始化编辑视图引擎
*
* @param {*} [options={}]
* @memberof EditViewEngine
*/
public init(options: any = {}): void {
this.form = options.form;
this.p2k = options.p2k;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof EditViewEngine
*/
public load(opts: any = {}): void {
super.load(opts);
if (this.getForm() && this.isLoadDefault) {
const tag = this.getForm().name;
const data: any = {};
let srfkey: string = this.viewdata.srfkey;
let srfkeys: string = this.viewdata.srfkeys;
let srfsourcekey: string = this.viewdata.srfsourcekey;
let action: string = '';
const hasSrfParentKey = this.viewdata.srfparentdata
&& this.viewdata.srfparentdata.srfparentkey
&& !Object.is(this.viewdata.srfparentdata.srfparentkey, '');
if (Object.is(this.p2k, '1') && hasSrfParentKey) {
srfkey = this.viewdata.srfparentdata.srfparentkey;
}
if (srfkey && !Object.is(srfkey, '')) {
Object.assign(data, this.viewdata.srfparentdata);
action = 'load';
} else {
Object.assign(data, { srfparentdata: this.viewdata.srfparentdata });
Object.assign(data, { srfsourcekey: srfsourcekey, srfkeys: srfkeys });
action = 'loaddraft';
}
Object.assign(data, { srfkey: srfkey });
this.setViewState2({ tag: tag, action: action, viewdata: data });
}
this.isLoadDefault = true;
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof EditViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'form')) {
this.formEvent(eventName, args);
}
}
/**
* 表单事件
*
* @param {string} eventName
* @param {*} args
* @memberof EditViewEngine
*/
public formEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'load')) {
this.onFormLoad(args);
}
if (Object.is(eventName, 'save')) {
this.onFormSave(args);
}
}
/**
* 表单加载完成
*
* @param {*} args
* @memberof EditViewEngine
*/
public onFormLoad(arg: any): void {
this.view.model.dataInfo = Object.is(arg.srfuf, '1') ? arg.srfmajortext : '新建';
// this.setTabCaption(this.view.model.dataInfo);
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
}
/**
* 表单保存完成
*
* @param {*} args
* @memberof EditViewEngine
*/
public onFormSave(arg: any): void {
const newdata: boolean = !Object.is(arg.srfuf, '1');
this.calcToolbarItemState(newdata);
}
/**
* 处理实体界面行为
*
* @param {string} tag
* @param {string} [actionmode]
* @returns {void}
* @memberof EditViewEngine
*/
public doSysUIAction(tag: string, actionmode?: string): void {
// if (Object.is(tag, 'Help')) {
// this.doHelp();
// return;
// }
// if (Object.is(tag, 'SaveAndStart')) {
// this.doSaveAndStart();
// return;
// }
// if (Object.is(tag, 'SaveAndExit')) {
// this.doSaveAndExit();
// return;
// }
// if (Object.is(tag, 'SaveAndNew')) {
// this.doSaveAndNew();
// return;
// }
if (Object.is(tag, 'Save')) {
this.doSave();
return;
}
// if (Object.is(tag, 'Print')) {
// this.doPrint();
// return;
// }
// if (Object.is(tag, 'Copy')) {
// this.doCopy();
// return;
// }
// if (Object.is(tag, 'RemoveAndExit')) {
// this.doRemoveAndExit();
// return;
// }
// if (Object.is(tag, 'Refresh')) {
// this.doRefresh();
// return;
// }
// if (Object.is(tag, 'New')) {
// this.doNew();
// return;
// }
// if (Object.is(tag, 'FirstRecord')) {
// this.doMoveToRecord('first');
// return;
// }
// if (Object.is(tag, 'PrevRecord')) {
// this.doMoveToRecord('prev');
// return;
// }
// if (Object.is(tag, 'NextRecord')) {
// this.doMoveToRecord('next');
// return;
// }
// if (Object.is(tag, 'LastRecord')) {
// this.doMoveToRecord('last');
// return;
// }
// if (Object.is(tag, 'Exit') || Object.is(tag, 'Close')) {
// this.doExit();
// return;
// }
super.doSysUIAction(tag, actionmode);
}
/**
* 编辑界面_保存操作
*
* @memberof IBizEditViewController
*/
public doSave(): void {
// this.afterformsaveaction = '';
this.saveData({});
}
/**
* 保存视图数据
*
* @param {*} [arg={}]
* @memberof EditViewEngine
*/
public saveData(arg: any = {}): void {
if (this.getForm()) {
const tag = this.getForm().name;
this.setViewState2({ tag: tag, action: 'save', viewdata: arg });
}
}
/**
* 获取表单对象
*
* @returns {*}
* @memberof EditViewEngine
*/
public getForm(): any {
return this.form;
}
/**
* 设置分页标题
*
* @memberof EditViewEngine
*/
public setTabCaption(info: string): void {
let viewdata: any = this.view.model;
let viewParam = this.view.$store.getters['viewaction/getAppView'](this.view.viewtag);
if (viewdata && viewParam && info && !Object.is(info, '') && this.view.$tabPageExp) {
this.view.$tabPageExp.setCurPageCaption(`${viewParam.viewmodule}_${viewParam.viewname}`.toLocaleLowerCase(), viewdata.srfCaption, info);
}
}
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
* 实体编辑视图(左右关系)界面引擎
*
* @export
* @class EditView2Engine
* @extends {EditViewEngine}
*/
export default class EditView2Engine extends EditViewEngine {
/**
* 数据关系栏
*
* @protected
* @type {*}
* @memberof EditView2Engine
*/
protected drBar: any;
/**
* Creates an instance of EditView2Engine.
*
* @memberof EditView2Engine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} [options={}]
* @memberof EditView2Engine
*/
public init(options: any = {}): void {
this.drBar = options.drbar;
super.init(options);
}
/**
* 部件加载
*
* @param {*} [opts={}]
* @memberof EditView2Engine
*/
public load(opts: any = {}): void {
if (this.getDRBar()) {
const viewdata = this.viewdata;
const tag = this.getDRBar().name;
Object.assign(viewdata, {});
this.setViewState2({ tag: tag, action: 'load', viewdata: viewdata });
}
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof EditView2Engine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'drbar')) {
this.drbarEvent(eventName, args);
}
}
/**
* 数据关系栏事件
*
* @param {string} eventName
* @param {any[]} args
* @memberof EditView2Engine
*/
public drbarEvent(eventName: string, args: any[]): void {
if (Object.is(eventName, 'selectionchange')) {
this.drBarSelectionChange(args);
}
if (Object.is(eventName, 'load')) {
this.drBarLoad(args);
}
}
/**
* 关系部件加载完成
*
* @param {any[]} args
* @memberof EditView2Engine
*/
public drBarLoad(args: any[]): void {
super.load();
}
/**
* 数据关系栏选中
*
* @param {any[]} args
* @memberof EditView2Engine
*/
public drBarSelectionChange(args: any[]): void {
const item = args[0];
if (!item || Object.keys(item).length === 0) {
return;
}
this.view.selection = {};
Object.assign(this.view.selection, JSON.parse(JSON.stringify(item)));
}
/**
* 表单加载完成
*
* @param {*} [arg={}]
* @memberof EditView2Engine
*/
public onFormLoad(arg: any = {}): void {
super.onFormLoad(arg);
if (this.getDRBar()) {
const viewdata = this.viewdata;
const tag = this.getDRBar().name;
Object.assign(viewdata, { srfkey: Object.is(arg.srfkey, '') ? '' : arg.srfkey });
this.setViewState2({ tag: tag, action: 'state', viewdata: viewdata });
}
}
/**
* 表单保存完成
*
* @param {*} [arg={}]
* @memberof EditView2Engine
*/
public onFormSave(arg: any = {}): void {
super.onFormSave(arg);
if (this.getDRBar()) {
const viewdata = this.viewdata;
const tag = this.getDRBar().name;
Object.assign(viewdata, { srfkey: Object.is(arg.srfkey, '') ? '' : arg.srfkey });
this.setViewState2({ tag: tag, action: 'state', viewdata: viewdata });
}
}
/**
* 获取关系
*
* @returns {*}
* @memberof EditView2Engine
*/
public getDRBar(): any {
return this.drBar;
}
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
* 实体编辑视图(分页关系)界面引擎
*
* @export
* @class EditView3Engine
* @extends {EditViewEngine}
*/
export default class EditView3Engine extends EditViewEngine {
/**
* 数据关系栏
*
* @protected
* @type {*}
* @memberof EditView3Engine
*/
protected drTab: any;
/**
* Creates an instance of EditView3Engine.
*
* @memberof EditView3Engine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} [options={}]
* @memberof EditView3Engine
*/
public init(options: any = {}): void {
this.drTab = options.drtab;
super.init(options);
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof EditView3Engine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'drtab')) {
this.drTabEvent(eventName, args);
}
}
/**
* 数据关系栏事件
*
* @param {string} eventName
* @param {any[]} args
* @memberof EditView3Engine
*/
public drTabEvent(eventName: string, args: any[]): void {
if (Object.is(eventName, 'selectionchange')) {
this.drTabSelectionChange(args);
}
}
/**
* 数据关系栏选中
*
* @param {any[]} args
* @memberof EditView3Engine
*/
public drTabSelectionChange(args: any[]): void {
const item = args[0];
if (!item || Object.keys(item).length === 0) {
return;
}
this.view.selection = {};
Object.assign(this.view.selection, JSON.parse(JSON.stringify(item)));
}
/**
* 表单加载完成
*
* @param {*} [arg={}]
* @memberof EditView3Engine
*/
public onFormLoad(arg: any = {}): void {
super.onFormLoad(arg);
if (this.getDrTab()) {
const viewdata = this.viewdata;
const tag = this.getDrTab().name;
Object.assign(viewdata, { srfkey: Object.is(arg.srfkey, '') ? '' : arg.srfkey });
this.setViewState2({ tag: tag, action: 'state', viewdata: viewdata });
}
}
/**
* 表单保存完成
*
* @param {*} [arg={}]
* @memberof EditView3Engine
*/
public onFormSave(arg: any = {}): void {
super.onFormSave(arg);
if (this.getDrTab()) {
const viewdata = this.viewdata;
const tag = this.getDrTab().name;
Object.assign(viewdata, { srfkey: Object.is(arg.srfkey, '') ? '' : arg.srfkey });
this.setViewState2({ tag: tag, action: 'state', viewdata: viewdata });
}
}
/**
* 获取关系
*
* @returns {*}
* @memberof EditView3Engine
*/
public getDrTab(): any {
return this.drTab;
}
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
*
*
* @export
* @class EditView9Engine
* @extends {EditViewEngine}
*/
export default class EditView9Engine extends EditViewEngine {
}
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridViewEngine
* @extends {MDViewEngine}
*/
export default class FormPickupDataViewEngine extends MDViewEngine {
/**
* 数据视图部件
*
* @type {*}
* @memberof FormPickupDataViewEngine
*/
protected dataview: any;
/**
* Creates an instance of GridViewEngine.
* @memberof GridViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof GridViewEngine
*/
public init(options: any = {}): void {
this.dataview = options.dataview;
super.init(options);
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof GridViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'dataview')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof GridViewEngine
*/
public getMDCtrl(): any {
return this.dataview;
}
}
\ No newline at end of file
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridViewEngine
* @extends {MDViewEngine}
*/
export default class GridViewEngine extends MDViewEngine {
/**
* 表格部件
*
* @type {*}
* @memberof GridViewEngine
*/
protected grid: any;
/**
* Creates an instance of GridViewEngine.
* @memberof GridViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof GridViewEngine
*/
public init(options: any = {}): void {
this.grid = options.grid;
super.init(options);
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof GridViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'grid')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof GridViewEngine
*/
public getMDCtrl(): any {
return this.grid;
}
/**
* 事件处理
*
* @param {string} eventName
* @param {*} args
* @memberof GridViewEngine
*/
public MDCtrlEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'rowdblclick') && this.gridRowAllowActive(2)) {
this.doEdit(args);
return;
}
if (Object.is(eventName, 'selectionchange')) {
this.selectionChange(args);
if (this.gridRowAllowActive(1)) {
this.doEdit(args);
}
return;
}
super.MDCtrlEvent(eventName, args);
}
/**
* 表格是否被允许激活
*
* @param {number} mode
* @returns {boolean}
* @memberof GridViewEngine
*/
public gridRowAllowActive(mode: number): boolean {
return this.view.gridRowActiveMode === mode ? true : false;
}
}
\ No newline at end of file
import GridViewEngine from './grid-view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridView8Engine
* @extends {GridViewEngine}
*/
export default class GridView8Engine extends GridViewEngine {
/**
* 表格部件
*
* @type {*}
* @memberof GridView8Engine
*/
protected grid: any;
/**
* 表格部件
*
* @protected
* @type {*}
* @memberof Grid8ViewEngine
*/
protected totalgrid: any;
/**
* 选中数据集
*
* @protected
* @type {any[]}
* @memberof Grid8ViewEngine
*/
public selections: any[] = [];
/**
* 选中数据集
*
* @protected
* @type {any[]}
* @memberof Grid8ViewEngine
*/
public selections2: any[] = [];
/**
* Creates an instance of GridView8Engine.
* @memberof GridView8Engine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof GridView8Engine
*/
public init(options: any = {}): void {
this.grid = options.grid;
this.totalgrid = options.totalgrid;
super.init(options);
}
/**
* 引擎加载
*
* @memberof MDViewEngine
*/
public load(): void {
super.load();
this.load2();
}
/**
* 加载
*
* @memberof Grid8ViewEngine
*/
public load2(): void {
const srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : {};
if (this.getMDCtrl2()) {
const tag = this.getMDCtrl2().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: srfparentdata });
}
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof GridView8Engine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'totalgrid')) {
this.MD2Event(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof GridView8Engine
*/
public getMDCtrl(): any {
return this.grid;
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof GridView8Engine
*/
public getMDCtrl2(): any {
return this.totalgrid;
}
/**
* 删除
*
* @param {*} [arg={}]
* @returns {void}
* @memberof GridView8Engine
*/
public removeData(items: any[] = []): void {
let arg: any = {};
// 获取要删除的数据集合
if (!items || items == null || items.length === 0) {
return;
}
let keys = '';
items.forEach((item) => {
let key = item.srfkey;
if (!Object.is(keys, '')) {
keys += ';';
}
keys += key;
});
arg.srfkeys = keys;
const grid: any = this.getMDCtrl();
if (grid) {
grid.remove(arg);
}
}
/**
* 添加数据
*
* @param {any[]} [items=[]]
* @memberof Grid8ViewEngine
*/
public addBatchData(items: any[] = []): void {
let arg: any = {};
// 获取要添加的数据集合
if (!items || items == null || items.length === 0) {
return;
}
let keys = '';
items.forEach((item) => {
let key = item.srfkey;
if (!Object.is(keys, '')) {
keys += ';';
}
keys += key;
});
arg.srfkeys = keys;
const grid: any = this.getMDCtrl();
if (grid) {
grid.addBatchData(arg);
}
}
/**
*
*
* @param {string} eventName
* @param {*} [args={}]
* @memberof GridView8Engine
*/
public MDEvent(eventName: string, args: any = {}): void {
if (Object.is(eventName, 'rowclick')) {
// this.***()
}
if (Object.is(eventName, 'rowdblclick')) {
// this.doEdit(args);
}
if (Object.is(eventName, 'selectionchange')) {
// this.***()
this.selectionChange(args);
}
if (Object.is(eventName, 'remove')) {
this.load2();
}
}
/**
*
*
* @param {string} eventName
* @param {*} [args={}]
* @memberof GridView8Engine
*/
public MD2Event(eventName: string, args: any = {}): void {
if (Object.is(eventName, 'rowclick')) {
// this.***()
}
if (Object.is(eventName, 'rowdblclick')) {
// this.doEdit(args);
}
if (Object.is(eventName, 'selectionchange')) {
// this.***()
this.selectionChange2(args);
}
}
/**
* 选中变化
*
* @param {any[]} args
* @memberof GridView8Engine
*/
public selectionChange(args: any[]): void {
this.selections = [...args];
}
/**
* 选中变化
*
* @param {any[]} args
* @memberof GridView8Engine
*/
public selectionChange2(args: any[]): void {
this.selections2 = [...args];
}
/**
* 移动数据
*
* @memberof Grid8ViewEngine
*/
public moveData() {
this.addBatchData(this.selections2);
}
/**
* 移动数据
*
* @memberof Grid8ViewEngine
*/
public moveData2() {
this.removeData(this.selections);
}
/**
* 移动全部数据
*
* @memberof Grid8ViewEngine
*/
public moveAllData() {
if (this.getMDCtrl2()) {
var items: any[] = this.getMDCtrl2().getDatas();
this.addBatchData(items);
}
}
/**
* 移动全部数据
*
* @memberof Grid8ViewEngine
*/
public moveAllData2() {
if (this.getMDCtrl()) {
var items: any[] = this.getMDCtrl().getDatas();
this.removeData(items);
}
}
}
import GridViewEngine from './grid-view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridView9Engine
* @extends {GridViewEngine}
*/
export default class GridView9Engine extends GridViewEngine {
/**
* Creates an instance of GridView9Engine.
* @memberof GridView9Engine
*/
constructor() {
super();
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
*
*
* @export
* @class HtmlViewEngine
* @extends {ViewEngine}
*/
export default class HtmlViewEngine extends ViewEngine {
}
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class ListViewEngine
* @extends {MDViewEngine}
*/
export default class ListViewEngine extends MDViewEngine {
/**
* 表格部件
*
* @type {*}
* @memberof ListViewEngine
*/
protected list: any;
/**
* Creates an instance of ListViewEngine.
* @memberof ListViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof ListViewEngine
*/
public init(options: any = {}): void {
this.list = options.list;
super.init(options);
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof ListViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'list')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof ListViewEngine
*/
public getMDCtrl(): any {
return this.list;
}
/**
* 删除操作
*
* @returns {void}
* @memberof ListViewEngine
*/
public doRemove(): void {
let selectedData = this.getMDCtrl() && this.getMDCtrl().getSelection();
if (!selectedData || selectedData == null || selectedData.length === 0) {
return;
}
let dataInfo = '';
selectedData.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (selectedData.length < 5) {
dataInfo = dataInfo + '共' + selectedData.length + '条数据';
} else {
dataInfo = dataInfo + '...' + '共' + selectedData.length + '条数据';
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
// 询问框
this.view.$Modal.confirm({
title:'警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk:() => {
this.removeData(null);
},
onCancel: () => {
}
});
}
/**
* 删除
*
* @param {*} [arg={}]
* @returns {void}
* @memberof ListViewEngine
*/
public removeData(arg: any = {}): void {
if (!arg) {
arg = {};
}
// if (this.getParentMode()) {
// Object.assign(arg, this.getParentMode());
// }
// if (this.getParentData()) {
// Object.assign(arg, this.getParentData());
// }
if (!arg.srfkeys) {
// 获取要删除的数据集合
const selectedData: Array<any> = this.getMDCtrl() && this.getMDCtrl().getSelection();
if (!selectedData || selectedData == null || selectedData.length === 0) {
return;
}
let keys = '';
selectedData.forEach((record) => {
let key = record.srfkey;
if (!Object.is(keys, '')) {
keys += ';';
}
keys += key;
});
arg.srfkeys = keys;
}
const grid: any = this.getMDCtrl();
if (grid) {
grid.remove(arg);
}
}
}
\ No newline at end of file
此差异已折叠。
import ViewEngine from './view-engine';
/**
* 实体选择视图
*
* @export
* @class MPickupViewEngine
* @extends {ViewEngine}
*/
export default class MPickupViewEngine extends ViewEngine {
/**
* 选择视图面板
*
* @type {*}
* @memberof MPickupViewEngine
*/
public pickupViewPanel: any = null;
/**
* Creates an instance of MPickupViewEngine.
*
* @memberof MPickupViewEngine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} options
* @memberof MPickupViewEngine
*/
public init(options: any): void {
this.pickupViewPanel = options.pickupviewpanel;
if (options.view.viewdata && options.view.viewdata.selectedData && Array.isArray(options.view.viewdata.selectedData)) {
options.view.viewSelections = [...options.view.viewdata.selectedData];
delete options.view.viewdata.selectedData;
}
super.init(options);
}
/**
* 引擎加载
*
* @memberof MPickupViewEngine
*/
public load(): void {
super.load();
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getPickupViewPanel()) {
const tag = this.getPickupViewPanel().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: _srfparentdata });
}
}
/**
* 引擎事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof MPickupViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(eventName, 'selectionchange')) {
this.onSelectionChange(ctrlName, args);
}
if (Object.is(eventName, 'load')) {
this.onLoad(ctrlName, args);
}
if (Object.is(eventName, 'activated')) {
this.onSelectionChange(ctrlName, args);
this.view.onCLickRight();
}
}
/**
* 值选中变化
*
* @param {string} ctrlName 选择视图面板名称
* @param {any[]} args 选中数据
* @memberof MPickupViewEngine
*/
public onSelectionChange(ctrlName: string, args: any[]): void {
this.view.containerModel[`view_${ctrlName}`].selections = [...JSON.parse(JSON.stringify(args))];
Object.values(this.view.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
});
const _disbaled: boolean = this.view.containerModel[`view_${ctrlName}`].selections.length > 0 ? true : false;
this.view.containerModel.view_rightbtn = _disbaled;
}
/**
* 视图加载完成
*
* @param {string} ctrlName 选择视图面板名称
* @param {any[]} args 选中数据
* @memberof MPickupViewEngine
*/
public onLoad(ctrlName: string, args: any[]): void {
this.view.containerModel[`view_${ctrlName}`].datas = [...JSON.parse(JSON.stringify(args))];
}
/**
* 获取选择视图面板
*
* @returns {*}
* @memberof MPickupViewEngine
*/
public getPickupViewPanel(): any {
return this.pickupViewPanel;
}
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
* 实体选项操作视图界面引擎
*
* @export
* @class OptionViewEngine
* @extends {EditViewEngine}
*/
export default class OptionViewEngine extends EditViewEngine {
/**
* Creates an instance of OptionViewEngine.
* 创建 OptionViewEngine 实例对象
*
* @memberof OptionViewEngine
*/
constructor() {
super();
}
}
\ No newline at end of file
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridViewEngine
* @extends {MDViewEngine}
*/
export default class PickupDataViewEngine extends MDViewEngine {
/**
* 数据视图部件
*
* @type {*}
* @memberof FormPickupDataViewEngine
*/
protected dataview: any;
/**
* Creates an instance of GridViewEngine.
* @memberof GridViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof GridViewEngine
*/
public init(options: any = {}): void {
this.dataview = options.dataview;
super.init(options);
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof GridViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'dataview')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof GridViewEngine
*/
public getMDCtrl(): any {
return this.dataview;
}
}
\ No newline at end of file
import GridViewEngine from './grid-view-engine';
/**
* 实体选择表格视图(部件视图)界面引擎
*
* @export
* @class PickupGridViewEngine
* @extends {GridViewEngine}
*/
export default class PickupGridViewEngine extends GridViewEngine {
/**
* Creates an instance of PickupGridViewEngine.
*
*
* @memberof PickupGridViewEngine
*/
constructor() {
super();
}
/**
* 选中激活数据
*
* @param {string} eventName
* @param {*} args
* @memberof PickupGridViewEngine
*/
public MDCtrlEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'rowdblclick') && this.gridRowAllowActive(2)) {
this.view.$emit('viewdatasactivated', args);
return ;
}
super.MDCtrlEvent(eventName, args);
}
}
\ No newline at end of file
import TreeViewEngine from './tree-view-engine';
/**
* 实体选择树视图(部件视图)界面引擎
*
* @export
* @class PickupTreeViewEngine
* @extends {TreeViewEngine}
*/
export default class PickupTreeViewEngine extends TreeViewEngine {
/**
* 部件加载完
*
* @param {*} args
* @memberof PickupTreeViewEngine
*/
public onLoad(args: any): void {
super.onLoad(args);
if (this.view) {
this.view.$emit('viewload', args);
}
}
/**
* 选中处理
*
* @param {any[]} args
* @memberof PickupTreeViewEngine
*/
public onSelectionChange(args: any[]): void {
super.onSelectionChange(args);
if (this.view) {
this.view.$emit('viewdataschange', args);
}
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 实体选择视图
*
* @export
* @class PickupViewEngine
* @extends {ViewEngine}
*/
export default class PickupViewEngine extends ViewEngine {
/**
* 选择视图面板
*
* @type {*}
* @memberof PickupViewEngine
*/
public pickupViewPanel: any = null;
/**
* Creates an instance of PickupViewEngine.
*
* @memberof PickupViewEngine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} options
* @memberof PickupViewEngine
*/
public init(options: any): void {
this.pickupViewPanel = options.pickupviewpanel;
super.init(options);
}
/**
* 引擎加载
*
* @memberof PickupViewEngine
*/
public load(): void {
this.view.viewSelections = [];
super.load();
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getPickupViewPanel()) {
const tag = this.getPickupViewPanel().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: _srfparentdata });
}
}
/**
*
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof PickupViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(eventName, 'selectionchange')) {
this.onSelectionChange(args);
}
if (Object.is(eventName, 'activated')) {
this.view.$emit('viewdatasactivated', args);
}
}
/**
* 值选中变化
*
* @param {any[]} args
* @memberof PickupViewEngine
*/
public onSelectionChange(args: any[]): void {
this.view.viewSelections = [];
this.view.viewSelections = [...args]
const _disabled: boolean = this.view.viewSelections.length > 0 ? false : true;
this.view.containerModel.view_okbtn.disabled = _disabled;
}
/**
* 获取选择视图面板
*
* @returns {*}
* @memberof PickupViewEngine
*/
public getPickupViewPanel(): any {
return this.pickupViewPanel;
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 搜索视图引擎
*
* @export
* @class SearchViewEngine
* @extends {ViewEngine}
*/
export class SearchViewEngine extends ViewEngine {
/**
* 表单部件
*
* @protected
* @type {*}
* @memberof SearchViewEngine
*/
protected searchForm: any;
/**
* 初始化
*
* @param {*} options
* @memberof SearchViewEngine
*/
public init(options: any): void {
this.searchForm = options.searchform;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof SearchViewEngine
*/
public load(opts: any = {}): void {
super.load(opts);
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getSearchForm()) {
const tag = this.getSearchForm().name;
this.setViewState2({ tag: tag, action: 'loaddraft', viewdata: _srfparentdata });
}
}
/**
* 事件处理
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof SearchViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'searchform')) {
this.searchFormEvent(eventName, args);
}
}
/**
* 搜索表单事件
*
* @param {string} eventName
* @param {*} [args={}]
* @memberof SearchViewEngine
*/
public searchFormEvent(eventName: string, args: any = {}): void {
if (Object.is(eventName, 'load')) {
this.onSearchFormLoad(args);
}
}
/**
* 搜索表单加载完成
*
* @param {*} [args={}]
* @memberof SearchViewEngine
*/
public onSearchFormLoad(args: any = {}): void {
}
/**
* 数据部件加载之前
*
* @param {*} [arg={}]
* @memberof SearchViewEngine
*/
public dataCtrlBeforeLoad(arg: any = {}): void {
if (this.viewdata.srfparentdata && Object.keys(this.viewdata.srfparentdata).length > 0) {
Object.assign(arg, { srfparentdata: this.viewdata.srfparentdata });
}
if (this.getSearchForm()) {
Object.assign(arg, this.getSearchForm().getData());
}
if (this.view && !this.view.isExpandSearchForm) {
Object.assign(arg, { query: this.view.query });
}
}
/**
* 获取搜索表单
*
* @returns {*}
* @memberof SearchViewEngine
*/
public getSearchForm(): any {
return this.searchForm;
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 实体选择视图
*
* @export
* @class TabExpViewEngine
* @extends {ViewEngine}
*/
export default class TabExpViewEngine extends ViewEngine {
/**
* Creates an instance of TabExpViewEngine.
*
* @memberof TabExpViewEngine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} options
* @memberof TabExpViewEngine
*/
public init(options: any): void {
super.init(options);
}
/**
* 引擎加载
*
* @memberof TabExpViewEngine
*/
public load(): void {
super.load();
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.viewdata.srfkey && !Object.is(this.viewdata.srfkey, '')) {
Object.assign(_srfparentdata.srfparentdata, { srfparentkey: this.viewdata.srfkey });
}
Object.values(this.view.containerModel).forEach((_item: any) => {
if (!Object.is(_item.type, 'TABEXPPANEL')) {
return;
}
this.setViewState2({ tag: _item.name, action: 'load', viewdata: _srfparentdata });
});
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 实体树导航视图界面引擎
*
* @export
* @class TreeExpView
* @extends {ViewEngine}
*/
export default class TreeExpView extends ViewEngine {
/**
* 选择视图面板
*
* @type {*}
* @memberof TreeExpView
*/
public treeExpBar: any = null;
/**
* Creates an instance of TreeExpView.
*
* @memberof TreeExpView
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} options
* @memberof TreeExpView
*/
public init(options: any): void {
this.treeExpBar = options.treeexpbar;
super.init(options);
}
/**
* 引擎加载
*
* @memberof TreeExpView
*/
public load(): void {
super.load();
if (this.viewdata.srfkey && !this.viewdata.srfparentkey) {
if (!this.viewdata.srfparentdata) {
this.viewdata.srfparentdata = {};
}
Object.assign(this.viewdata.srfparentdata, { srfparentkey: this.viewdata.srfkey });
}
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getTreeExpBar() && this.isLoadDefault) {
const tag = this.getTreeExpBar().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: _srfparentdata });
} else {
this.isLoadDefault = true;
}
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof TreeExpView
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'treeexpbar')) {
this.treeExpBarEvent(eventName, args);
}
}
/**
* 树导航事件
*
* @param {string} eventName
* @param {*} args
* @memberof TreeExpView
*/
public treeExpBarEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'load')) {
this.view.$emit('viewload', args);
}
if (Object.is(eventName, 'selectionchange')) {
this.view.$emit('viewdataschange', args);
}
if (Object.is(eventName, 'activated')) {
this.view.$emit('viewdatasactivated', args);
}
}
/**
* 获取部件对象那
*
* @returns {*}
* @memberof TreeExpView
*/
public getTreeExpBar(): any {
return this.treeExpBar;
}
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 实体树视图界面引擎
*
* @export
* @class TreeViewEngine
* @extends {ViewEngine}
*/
export default class TreeViewEngine extends ViewEngine {
/**
* 树部件对象
*
* @type {*}
* @memberof TreeViewEngine
*/
public tree: any;
/**
* Creates an instance of TreeViewEngine.
*
* @memberof TreeViewEngine
*/
constructor() {
super();
}
/**
* 初始化引擎
*
* @param {*} options
* @memberof PickupViewEngine
*/
public init(options: any): void {
this.tree = options.tree;
super.init(options);
}
/**
* 引擎加载
*
* @memberof TreeViewEngine
*/
public load(): void {
super.load();
const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getTreeView() && this.isLoadDefault) {
const tag = this.getTreeView().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: _srfparentdata });
} else {
this.isLoadDefault = true;
}
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof TreeViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(eventName, 'load')) {
this.onLoad(args);
}
if (Object.is(eventName, 'selectionchange')) {
this.onSelectionChange(args);
}
}
/**
* 部件加载完
*
* @param {*} args
* @memberof TreeViewEngine
*/
public onLoad(args: any): void { }
/**
* 选中处理
*
* @param {any[]} args
* @memberof TreeViewEngine
*/
public onSelectionChange(args: any[]): void { }
/**
*
*获取树视图部件
* @returns {*}
* @memberof TreeViewEngine
*/
public getTreeView(): any {
return this.tree;
}
}
\ No newline at end of file
import TreeViewEngine from './tree-view-engine';
/**
*
*
* @export
* @class TreeView9Engine
* @extends {TreeViewEngine}
*/
export default class TreeView9Engine extends TreeViewEngine {
}
\ No newline at end of file
import { Util } from '@global/util/util';
/**
*
*
* @export
* @class ViewEngine
*/
export default class ViewEngine {
/**
* 视图部件对象
*
* @protected
* @type {*}
* @memberof ViewEngine
*/
protected view: any = null;
/**
* 引擎参数
*
* @type {*}
* @memberof ViewEngine
*/
protected opt: any = {};
/**
*
*
* @type {*}
* @memberof ViewEngine
*/
protected methods: any = {};
/**
* 视图数据
*
* @type {*}
* @memberof ViewEngine
*/
public viewdata: any = {};
/**
* 是否默认记载
*
* @type {boolean}
* @memberof ViewEngine
*/
public isLoadDefault: boolean = true;
/**
* Creates an instance of ViewEngine.
* @memberof ViewEngine
*/
constructor(private $util?: Util) { }
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof ViewEngine
*/
public init(options: any = {}): void {
this.opt = options;
this.methods = options.methods;
this.view = options.view;
this.isLoadDefault = options.isLoadDefault;
const hasviewdata: boolean = this.view.viewdata ? true : false;
if (hasviewdata) {
try {
Object.assign(this.viewdata, JSON.parse(this.view.viewdata));
} catch (error) {
console.log(error);
}
} else {
// const _viewdata: any = {};
const router = this.view.$route;
// if (router && router.params && router.params[router.name]) {
// Object.assign(_viewdata, this.$util.formatMatrixParse2(router.params[router.name]));
// }
Object.assign(this.viewdata, router.snapshot.params);
}
if (this.view.srfparentdata && this.viewdata.srfparentdata) {
Object.assign(this.view.srfparentdata, this.viewdata.srfparentdata);
}
this.load();
}
/**
* 设置视图数据
*
* @param {string} viewdata
* @memberof ViewEngine
*/
public setViewData(viewdata: string): void {
this.viewdata = {};
try {
Object.assign(this.viewdata, JSON.parse(viewdata));
} catch (error) {
console.log(error);
}
if (this.view.srfparentdata && this.viewdata.srfparentdata) {
Object.assign(this.view.srfparentdata, this.viewdata.srfparentdata);
}
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof ViewEngine
*/
public load(opts: any = {}): void {
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof ViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
}
/**
* 处理界面行为
*
* @param {string} tag
* @param {string} [actionmode]
* @memberof ViewEngine
*/
public doSysUIAction(tag: string, actionmode?: string): void {
if (Object.is(actionmode, 'FRONT')) {
if (this.methods.front) {
this.methods.front(tag);
}
}
}
/**
* 处理工作流界面行为
*
* @param {string} tag
* @param {string} [actionmode]
* @memberof ViewEngine
*/
public doSysWFUIAction(tag: string, actionmode?: string): void {
if (Object.is(actionmode, 'WFFRONT')) {
if (this.methods.wfFront) {
this.methods.wfFront(tag);
}
}
}
/**
* 是否为方法
*
* @protected
* @param {*} func
* @returns {boolean}
* @memberof ViewEngine
*/
protected isFunc(func: any): boolean {
return func instanceof Function;
}
/**
* 父数据参数模式
*
* @param {{ tag: string, action: string, viewdata: any }} { tag, action, viewdata }
* @memberof ViewEngine
*/
public setViewState2({ tag, action, viewdata }: { tag: string, action: string, viewdata: any }): void {
this.view.viewState.next({ tag: tag, action: action, data: viewdata });
}
/**
* 计算工具栏状态
*
* @param {boolean} state
* @param {*} [dataaccaction]
* @memberof ViewEngine
*/
public calcToolbarItemState(state: boolean, dataaccaction?: any) {
const _this: any = this;
if (!_this.view.toolBarModels || Object.keys(_this.view.toolBarModels).length === 0) {
return;
}
for (const key in _this.view.toolBarModels) {
if (!_this.view.toolBarModels.hasOwnProperty(key)) {
return;
}
const _item = _this.view.toolBarModels[key];
if (_item.uiaction && (Object.is(_item.uiaction.target, 'SINGLEKEY') || Object.is(_item.uiaction.target, 'MULTIKEY'))) {
_item.disabled = state;
}
}
}
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
* 实体工作流操作视图界面引擎
*
* @export
* @class WFActionViewEngine
* @extends {EditViewEngine}
*/
export default class WFActionViewEngine extends EditViewEngine {
}
\ No newline at end of file
import GridViewEngine from './grid-view-engine';
/**
* 实体工作流表格视图界面引擎
*
* @export
* @class WFGridViewEngine
* @extends {GridViewEngine}
*/
export default class WFGridViewEngine extends GridViewEngine {
}
\ No newline at end of file
import EditViewEngine from './edit-view-engine';
/**
* 实体工作流启动视图界面引擎
*
* @export
* @class WFStartViewEngine
* @extends {EditViewEngine}
*/
export default class WFStartViewEngine extends EditViewEngine {
}
\ No newline at end of file
import ViewEngine from './view-engine';
/**
* 视图引擎基础
*
* @export
* @class GridViewEngine
*/
export default class WizardViewEngine extends ViewEngine {
/**
* 向导面板部件
*
* @protected
* @type {*}
* @memberof EditViewEngine
*/
protected wizardpanel: any;
/**
* 初始化编辑视图引擎
*
* @param {*} [options={}]
* @memberof EditViewEngine
*/
public init(options: any = {}): void {
this.wizardpanel = options.wizardpanel;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof EditViewEngine
*/
public load(opts: any = {}): void {
super.load(opts);
// const _srfparentdata = this.viewdata.srfparentdata ? { srfparentdata: this.viewdata.srfparentdata } : { srfparentdata: {} };
if (this.getWizardPanel()) {
const tag = this.getWizardPanel().name;
this.setViewState2({ tag: tag, action: 'load', viewdata: this.viewdata });
}
}
/**
* 部件事件机制
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof ViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'wizardpanel')) {
this.wizardPanelEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 事件处理
*
* @param {string} eventName
* @param {any[]} args
* @memberof MDViewEngine
*/
public wizardPanelEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'finish')) {
this.onfinish(args);
}
}
/**
* 完成
*
* @param {*} args
* @memberof WizardViewEngine
*/
public onfinish(args: any): void {
this.view.$emit('viewdataschange', [args]);
this.view.$emit('close', null);
}
/**
* 获取向导面板
*
* @returns {*}
* @memberof WizardViewEngine
*/
public getWizardPanel(): any {
return this.wizardpanel;
}
}
\ No newline at end of file
export const environment = {
production: true
};
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
import { AppEnvironment } from '@environments/AppEnvironment';
import { Injectable } from '@angular/core';
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse, HttpHeaders } from "@angular/common/http";
import { Observable, of } from 'rxjs';
import { catchError, mergeMap } from 'rxjs/operators';
import { Router } from '@angular/router';
@Injectable()
export class HttpInterceptorService implements HttpInterceptor {
constructor(private $router: Router) {
}
/**
* 实现接口
*
* @param {HttpRequest<any>} req
* @param {HttpHandler} next
* @returns {Observable<HttpEvent<any>>}
* @memberof HttpInterceptorService
*/
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
let authReq = req;
let author = '';
let url = req.url
if (window.localStorage.getItem(AppEnvironment.AppName + '-token')) {
const token = window.localStorage.getItem(AppEnvironment.AppName + '-token');
author = `Bearer ${token}`;
}
if (!req.url.startsWith('https://') && !req.url.startsWith('http://')) {
url = AppEnvironment.BaseUrl + url;
}
authReq = req.clone({
url: url,
headers: new HttpHeaders({
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': author
})
});
return next.handle(authReq).pipe(
mergeMap((event: any) => {
return Observable.create(observer => observer.next(event));
}),
catchError((res: HttpResponse<any>) => {
return this.handleError(res);
})
);
}
/**
* 错误处理
*
* @param {HttpResponse<any>} event
* @returns {Observable<any>}
* @memberof HttpInterceptorService
*/
public handleError(event: HttpResponse<any>): Observable<any> {
if (event.status === 401) {
this.goLogin();
}
return of(event);
}
/**
* 跳转登录页
*
* @memberof HttpInterceptorService
*/
public goLogin() {
const curUrl = decodeURIComponent(window.location.href);
this.$router.navigate(['login'], { queryParams: { RU: curUrl } });
}
}
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { AppEnvironment } from '../../environments/AppEnvironment';
import { NzNotificationService } from 'ng-zorro-antd/notification';
import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class Http {
/**
* 状态信息
*
* @private
* @static
* @memberof Http
*/
private codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
202: '一个请求已经进入后台排队(异步任务)。',
204: '删除数据成功。',
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '用户没有权限(令牌、用户名、密码错误)。',
403: '用户得到授权,但是访问是被禁止的。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
500: '服务器发生错误,请检查服务器。',
502: '网关错误。',
503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。',
};
/**
* Creates an instance of Http.
* @param {HttpClient} http
* @memberof Http
*/
constructor(private http: HttpClient, private Notification: NzNotificationService) { }
/**
* 有加载动画的POST请求
*
* @param {string} url 请求地址
* @param {*} [params={}] 请求参数
* @returns {Observable<any>}
* @memberof Http
*/
public post(url: string, params: any = {}, showBusyIndicator?: boolean, serialnumber?: number): Promise<any> {
return this.results(url, params);
}
/**
* 发送http请求
*
* @private
* @param {string} url
* @param {*} [params={}]
* @returns {Promise<any>}
* @memberof Http
*/
private results(url: string, params: any = {}): Promise<any> {
return new Promise((resolve, reject) => {
this.http.post(url, params).subscribe(
(response: any) => {
resolve(response);
},
(response) => {
const errorText = this.codeMessage[response.status] || response.statusText;
this.Notification.error('', `请求错误 ${response.status}: ${errorText}`);
reject(response);
const error: any = new Error(errorText);
error.name = response.status;
error.response = response;
throw error;
}
);
});
}
/**
* GET请求
*
* @param {string} url 请求地址
* @returns
* @memberof Http
*/
public get(url: string, params?: any, showBusyIndicator?: boolean): Promise<any> {
return new Promise((resolve, reject) => {
this.http.get(url).subscribe(
(response: any) => {
resolve(response);
},
(response) => {
reject(response);
}
);
});
}
/**
* 格式化http请求数据
*
* @private
* @param {*} [opt={}]
* @returns {HttpParams}
* @memberof Http
*/
private transformationOpt(opt: any = {}): HttpParams {
const params: any = {};
// 获取srfloginkey
const loginkey: string | null = window.localStorage.getItem('srfloginkey');
if (loginkey) {
params.srfloginkey = loginkey;
}
// 添加appdata数据
// const srfappdata: string = this.App.getAppData();
// if (srfappdata) {
// params.srfappdata = srfappdata;
// }
Object.assign(params, opt);
const keys: string[] = Object.keys(params);
keys.forEach((key: string) => {
params[key] = this.recursionToString(params[key]);
});
return new HttpParams({ 'fromObject': params });
}
/**
* 递归转换对象为字符串
*
* @param {*} val
* @returns {string}
* @memberof Http
*/
public recursionToString(val: any): string {
if (val && !Object.is(val, '')) {
if (val instanceof Array) {
val.forEach((item: any) => {
item = this.recursionToString(item);
});
return JSON.stringify(val);
}
if (val instanceof Object) {
const childKeys: string[] = Object.keys(val);
childKeys.forEach((childKey: string) => {
val[childKey] = this.recursionToString(val[childKey]);
});
return JSON.stringify(val);
}
}
return val;
}
/**
*
*
* @returns {Promise<any>}
* @memberof Http
*/
public mask() {
// return this.Loading.mask();
}
/**
*
*
* @returns {Promise<any>}
* @memberof Http
*/
public unmask() {
// return this.Loading.unmask();
}
}
\ No newline at end of file
/**
* jsonp跨域请求
*
* @export
* @class Jsonp
*/
export default class Jsonp {
/**
* 请求超时时长
*
* @type {number}
* @memberof Jsonp
*/
public time: number = 60000;
/**
* Creates an instance of Jsonp.
* @param {number} [time]
* @memberof Jsonp
*/
constructor(time?: number) {
if (time) {
this.time = time;
}
}
/**
* 请求入口
*
* @param {string} url
* @param {*} [params={}]
* @returns {Promise<any>}
* @memberof Jsonp
*/
public jsonp(url: string, params: any = {}): Promise<any> {
return new Promise((resolve, reject) => {
if (typeof url !== 'string') {
throw new Error('[url] is not string.')
}
let callbackQuery = params.callbackQuery || 'callback'
let callbackName = params.callbackName || 'jsonp_' + this.randomStr();
params[callbackQuery] = callbackName;
delete params.callbackQuery;
delete params.callbackName;
let queryStrs: any[] = [];
Object.keys(params).forEach((queryName) => {
queryStrs = queryStrs.concat(this.formatParams(queryName, params[queryName]))
})
let queryStr = this.flatten(queryStrs).join('&');
const _window: any = window;
let headNode: any = document.querySelector('head');
let paddingScript: any = document.createElement('script');
let onError = () => {
removeErrorListener()
clearTimeout(timeoutTimer)
reject({
status: 400,
statusText: 'Bad Request'
})
}
let removeErrorListener = () => {
paddingScript.removeEventListener('error', onError);
}
let timeoutTimer = setTimeout(() => {
removeErrorListener()
headNode.removeChild(paddingScript)
delete _window[callbackName]
reject({ statusText: 'Request Timeout', status: 408 })
}, this.time);
_window[callbackName] = (json: any) => {
clearTimeout(timeoutTimer)
removeErrorListener()
headNode.removeChild(paddingScript)
resolve(json)
delete _window[callbackName]
}
paddingScript.addEventListener('error', onError);
paddingScript.src = url + (/\?/.test(url) ? '&' : '?') + queryStr;
headNode.appendChild(paddingScript);
});
}
/**
* 随机数
*
* @returns
* @memberof Jsonp
*/
public randomStr(): string {
return (Math.floor(Math.random() * 100000) * Date.now()).toString(16);
}
/**
* 格式化参数
*
* @param {string} queryName
* @param {*} value
* @returns
* @memberof Jsonp
*/
public formatParams(queryName: string, value: any): any[] {
queryName = queryName.replace(/=/g, '');
let result: any[] = [];
switch (value.constructor) {
case String:
case Number:
case Boolean:
result.push(encodeURIComponent(queryName) + '=' + encodeURIComponent(value));
break;
case Array:
value.forEach((item: any) => {
result = result.concat(this.formatParams(queryName + '[]=', item));
})
break;
case Object:
Object.keys(value).forEach((key: string) => {
let item = value[key];
result = result.concat(this.formatParams(queryName + '[' + key + ']', item));
})
break;
}
return result;
}
/**
*
*
* @param {*} array
* @returns
* @memberof Jsonp
*/
flatten(array: any[]): any[] {
let querys: string[] = [];
array.forEach((item: any) => {
if (typeof item === 'string') {
querys.push(item);
} else {
querys = querys.concat(this.flatten(item));
}
});
return querys;
}
}
\ No newline at end of file
/**
*
*
* @interface ViewState
*/
interface ViewState {
/**
* 部件标识
*
* @type {string}
* @memberof ViewState
*/
tag: string;
/**
* 触发行为
*
* @type {('load' | 'save' | 'remove')}
* @memberof ViewState
*/
action: 'load' | 'save' | 'remove' | 'autoload' | 'loaddraft' | string;
/**
* 数据
*
* @type {*}
* @memberof ViewState
*/
data?: any;
}
\ No newline at end of file
import { FormDetailModel } from './form-detail';
/**
* 按钮模型
*
* @export
* @class FormButtonModel
* @extends {FormDetailModel}
*/
export class FormButtonModel extends FormDetailModel {
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
此差异已折叠。
import { FormDetailModel } from './form-detail';
/**
* 数据关系界面模型
*
* @export
* @class FormDRUIPartModel
* @extends {FormDetailModel}
*/
export class FormDRUIPartModel extends FormDetailModel {
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
import { FormDetailModel } from './form-detail';
/**
* 分组面板模型
*
* @export
* @class FormGroupPanelModel
* @extends {FormDetailModel}
*/
export class FormGroupPanelModel extends FormDetailModel {
/**
* 实体界面行为组
*
* @type {*}
* @memberof FormGroupPanelModel
*/
public uiActionGroup: any = {};
/**
* Creates an instance of FormGroupPanelModel.
* 创建 FormGroupPanelModel 实例
*
* @param {*} [opts={}]
* @memberof FormGroupPanelModel
*/
constructor(opts: any = {}) {
super(opts);
Object.assign(this.uiActionGroup, opts.uiActionGroup);
}
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册