@ningboyz/types 1.1.162 → 1.1.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ningboyz/types",
3
- "version": "1.1.162",
3
+ "version": "1.1.164",
4
4
  "private": false,
5
5
  "description": "宁波甬政类型库",
6
6
  "author": "nbyt-syq",
@@ -3,12 +3,14 @@ import { ICnfg } from "./ICnfg";
3
3
 
4
4
  export function DCnfg(cnfg: ICnfg) {
5
5
  return function (target: any, _propertyKey: string) {
6
- const listCnfg = Reflect.get(target, "listCnfg") as ICnfg[];
7
- if (_.isNil(listCnfg)) {
8
- Reflect.set(target, "listCnfg", [cnfg]);
9
- } else {
10
- listCnfg.push(cnfg);
11
- Reflect.set(target, "listCnfg", listCnfg);
6
+ if (!_.isNil(target)) {
7
+ const listCnfg = Reflect.get(target, "listCnfg") as ICnfg[];
8
+ if (_.isNil(listCnfg)) {
9
+ Reflect.set(target, "listCnfg", [cnfg]);
10
+ } else {
11
+ listCnfg.push(cnfg);
12
+ Reflect.set(target, "listCnfg", listCnfg);
13
+ }
12
14
  }
13
15
  };
14
16
  }
@@ -1,4 +1,6 @@
1
- import { TElem } from "../..";
1
+ import _ from "lodash";
2
+ import { TElem, TYzpz } from "../..";
3
+ import { IYzpzTypeResponseConf } from "./IYzpzTypeResponseConf";
2
4
 
3
5
  export interface IYzpzTypeResponse {
4
6
  whoBuild: number;
@@ -42,6 +44,8 @@ export interface IYzpzTypeResponse {
42
44
  laidFlat: number;
43
45
  inCommon: number;
44
46
  itemSize: number;
47
+ typePara: string;
48
+ typeParaConf: IYzpzTypeResponseConf;
45
49
  listElem: TElem.IElemElemResponse[];
46
50
  }
47
51
 
@@ -87,5 +91,19 @@ export class TYzpzTypeResponse implements IYzpzTypeResponse {
87
91
  laidFlat: number = 0;
88
92
  inCommon: number = 0;
89
93
  itemSize: number = 0;
94
+ typePara: string = "";
95
+ typeParaConf: TYzpz.IYzpzTypeResponseConf = new TYzpz.TYzpzTypeResponseConf();
90
96
  listElem: TElem.IElemElemResponse[] = [];
97
+
98
+ static parseJson(typePara: string) {
99
+ const defaultTypePara = new TYzpz.TYzpzTypeResponseConf();
100
+ if (_.isEmpty(typePara)) {
101
+ return defaultTypePara;
102
+ }
103
+ try {
104
+ const obj = JSON.parse(typePara) as TYzpz.TYzpzTypeResponseConf;
105
+ return _.merge(defaultTypePara, obj);
106
+ } catch (e) {}
107
+ return defaultTypePara;
108
+ }
91
109
  }
@@ -1,3 +1,4 @@
1
+ import _ from "lodash";
1
2
  import { Ddecorators } from "../..";
2
3
  import { DFormType } from "../decorators";
3
4
 
@@ -6,9 +7,10 @@ export interface IYzpzTypeResponseConf {
6
7
  }
7
8
 
8
9
  export class TYzpzTypeResponseConf implements IYzpzTypeResponseConf {
9
-
10
- constructor(value: TYzpzTypeResponseConf) {
11
- Object.assign(this, value);
10
+ constructor(value?: TYzpzTypeResponseConf) {
11
+ if (!_.isNil(value)) {
12
+ Object.assign(this, value);
13
+ }
12
14
  }
13
15
 
14
16
  @Ddecorators.DCnfg({