Files
MaxKey/maxkey-web-frontend/maxkey-web-app/src/app/entity/BaseEntity.ts

45 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-05-02 10:54:21 +08:00
/*
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
2022-05-26 17:13:39 +08:00
*
2022-05-02 10:54:21 +08:00
* 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
2022-05-26 17:13:39 +08:00
*
2022-05-02 10:54:21 +08:00
* http://www.apache.org/licenses/LICENSE-2.0
2022-05-26 17:13:39 +08:00
*
2022-05-02 10:54:21 +08:00
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2022-04-23 10:08:40 +08:00
export class BaseEntity {
id!: String;
instId!: String;
instName!: String;
sortIndex!: Number;
status!: Number;
description!: String;
switch_status: boolean = false;
2022-05-26 17:13:39 +08:00
str_status!: String;
2022-04-23 10:08:40 +08:00
constructor() {
this.status = 1;
}
init(data: any): void {
Object.assign(this, data);
if (this.status == 1) {
this.switch_status = true;
2022-05-26 17:13:39 +08:00
this.str_status = `${this.status}`;
2022-04-23 10:08:40 +08:00
}
}
trans(): void {
if (this.switch_status) {
this.status = 1;
} else {
this.status = 0;
}
}
}