@ningboyz/types 1.8.45 → 1.8.47

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@ningboyz/types",
3
3
  "type": "module",
4
- "version": "1.8.45",
4
+ "version": "1.8.47",
5
5
  "private": false,
6
6
  "description": "宁波甬政类型库",
7
7
  "author": "nbyt-syq",
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import { construct, destruct } from "@aximario/json-tree";
2
3
  import _ from "lodash";
3
4
  import { type IBaseResponse, TBaseResponse } from "../base/IBaseResponse";
@@ -175,7 +176,7 @@ export class TDictResponse extends TBaseResponse<IDictResponse> implements IDict
175
176
  return defaultDictPara;
176
177
  }
177
178
  try {
178
- const obj = JSON.parse(dictPara) as TDictResponseDictPara;
179
+ const obj = JSONUtils.parseJSON(dictPara) as TDictResponseDictPara;
179
180
  return _.merge(defaultDictPara, obj);
180
181
  } catch (e) {}
181
182
  return defaultDictPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import { TCore } from "../index.ts";
2
3
  import _ from "lodash";
3
4
  import { TWithEXPDS, TWithMYOA, WithEXPDS, WithMYOA } from "./IUserResponse.ts";
@@ -105,7 +106,7 @@ export class TPartResponse implements IPartResponse {
105
106
  return defaultPathPara;
106
107
  }
107
108
  try {
108
- const obj = JSON.parse(partPara) as TPathResponsePathPara;
109
+ const obj = JSONUtils.parseJSON(partPara) as TPathResponsePathPara;
109
110
  return _.merge(defaultPathPara, obj);
110
111
  } catch (e) {}
111
112
  return defaultPathPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import _ from "lodash";
2
3
  import type { IWldyPageResponse } from "../wldy/IWldyPageResponse";
3
4
  import type { IDictResponse } from "./IDictResponse";
@@ -157,7 +158,7 @@ export class TSysMenuWithCoreResponse implements ISysMenuWithCoreResponse {
157
158
  return defaultMenuPara;
158
159
  }
159
160
  try {
160
- const obj = JSON.parse(menuPara) as TSysMenuWithCoreResponseMenuPara;
161
+ const obj = JSONUtils.parseJSON(menuPara) as TSysMenuWithCoreResponseMenuPara;
161
162
  return _.merge(defaultMenuPara, obj);
162
163
  } catch (e) {}
163
164
  return defaultMenuPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IFlowMainResponse } from "../flow";
3
4
  import { IGamsCnfgResponse } from "../gams";
@@ -339,7 +340,7 @@ export class TSysMenuWithExpdResponse implements ISysMenuWithExpdResponse {
339
340
  return defaultMenuPara;
340
341
  }
341
342
  try {
342
- const obj = JSON.parse(menuPara) as TSysMenuWithExpdResponseMenuPara;
343
+ const obj = JSONUtils.parseJSON(menuPara) as TSysMenuWithExpdResponseMenuPara;
343
344
  return _.merge(defaultMenuPara, obj);
344
345
  } catch (e) { }
345
346
  return defaultMenuPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import _ from "lodash";
2
3
 
3
4
  export interface ISysTravelWithParaResponse {
@@ -130,7 +131,7 @@ export class TSysTravelResponse implements ISysTravelResponse {
130
131
  return result;
131
132
  }
132
133
  try {
133
- const temp = JSON.parse(withPara) as TSysTravelWithParaResponse;
134
+ const temp = JSONUtils.parseJSON(withPara) as TSysTravelWithParaResponse;
134
135
  return _.merge(result, temp);
135
136
  } catch (e: any) {}
136
137
  return result;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import { construct, destruct } from "@aximario/json-tree";
2
3
  import _ from "lodash";
3
4
  import { type IBaseResponse, TBaseResponse } from "../base/IBaseResponse";
@@ -251,7 +252,7 @@ export class TUnitResponse extends TBaseResponse<IUnitResponse> implements IUnit
251
252
  return defaultUnitPara;
252
253
  }
253
254
  try {
254
- const obj = JSON.parse(unitPara) as TUnitResponseElemPara;
255
+ const obj = JSONUtils.parseJSON(unitPara) as TUnitResponseElemPara;
255
256
  return _.merge(defaultUnitPara, obj);
256
257
  } catch (e) {}
257
258
  return defaultUnitPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "./jsonUtils";
1
2
  import _ from "lodash";
2
3
 
3
4
  export interface IWebSocketResponse {
@@ -31,7 +32,7 @@ export class TWebSocketResponse implements IWebSocketResponse {
31
32
  return result;
32
33
  }
33
34
  try {
34
- const temp = JSON.parse(data) as TWebSocketResponse;
35
+ const temp = JSONUtils.parseJSON(data) as TWebSocketResponse;
35
36
  return _.merge(result, temp);
36
37
  } catch (e: any) {
37
38
  console.error(e.message);
@@ -0,0 +1,24 @@
1
+ import _ from "lodash";
2
+
3
+ class JSONUtils {
4
+ /** 空输入、非法 JSON 或解析结果为 null 时抛出统一错误,返回类型兼容原生解析。 */
5
+ public static parseJSON(jsonStr: string | undefined | null): ReturnType<typeof JSON.parse> {
6
+ try {
7
+ if (typeof jsonStr !== "string") {
8
+ throw new TypeError("参数约定内控不正确,请检查!");
9
+ }
10
+ if (_.isEmpty(jsonStr.trim())) {
11
+ return {};
12
+ }
13
+ const result: unknown = JSON.parse(jsonStr);
14
+ if (result === null) {
15
+ throw new TypeError("JSON 解析失败,请");
16
+ }
17
+ return result;
18
+ } catch {
19
+ throw new Error("json转换失败,请检查参数约定");
20
+ }
21
+ }
22
+ }
23
+
24
+ export default JSONUtils;
@@ -211,5 +211,7 @@ export enum TButtonType {
211
211
  /** 导出车单 */
212
212
  exportCar = "exportCar",
213
213
  /** 复制至一般公共预算 */
214
- copyYbMoney = "copyYbMoney"
214
+ copyYbMoney = "copyYbMoney",
215
+ /**清理报告 */
216
+ dataCleaning = "dataCleaning",
215
217
  }
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import type { IFlowNodeResponse } from "./IFlowNodeResponse";
3
4
  import type { IFlowDutyNodeParaConv } from "./IFlowDutyNodeParaConv";
@@ -77,7 +78,7 @@ export class TFlowDutyResponse implements IFlowDutyResponse {
77
78
  return defaultNodePara;
78
79
  }
79
80
  try {
80
- const obj = JSON.parse(nodePara) as IFlowDutyNodeParaConv;
81
+ const obj = JSONUtils.parseJSON(nodePara) as IFlowDutyNodeParaConv;
81
82
  return _.merge(defaultNodePara, obj);
82
83
  } catch (e) {}
83
84
  return defaultNodePara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import type { IDictResponse } from "../core/IDictResponse";
3
4
  import type { IPartResponse } from "../core/IPartResponse";
@@ -513,7 +514,7 @@ export class TFlowNodeResponse implements IFlowNodeResponse {
513
514
  return result;
514
515
  }
515
516
  try {
516
- const temp = JSON.parse(nodePara) as TFlowNodeResponseNodePara;
517
+ const temp = JSONUtils.parseJSON(nodePara) as TFlowNodeResponseNodePara;
517
518
  return _.merge(result, temp);
518
519
  } catch (e: any) {}
519
520
  return result;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import { construct, destruct } from "@aximario/json-tree";
2
3
  import _ from "lodash";
3
4
  import { IElemElemResponse } from "../elem/IElemElemResponse";
@@ -186,7 +187,7 @@ export class TGzjgGzlmResponse implements IGzjgGzlmResponse {
186
187
  return defaultGzlmPara;
187
188
  }
188
189
  try {
189
- const obj = JSON.parse(gzlmPara) as TGzjgGzlmResponseGzlmPara;
190
+ const obj = JSONUtils.parseJSON(gzlmPara) as TGzjgGzlmResponseGzlmPara;
190
191
  return _.merge(defaultGzlmPara, obj);
191
192
  } catch (_e) { }
192
193
  return defaultGzlmPara;
@@ -21,6 +21,8 @@ export interface IGzjgGzlmResponseGzlmPara {
21
21
  titleYearNum: number;
22
22
  /** 标题中启用的当前年度的年份差值并且加上月份的截止 (默认为999表示不启用,0的话标题显示为当前年度,其余值为与当前年度的差值)*/
23
23
  titleYearNumMonth: number;
24
+ /** 是否启用仅管理员可以修改 */
25
+ onlyAdminUse: boolean;
24
26
  }
25
27
 
26
28
  export class TGzjgGzlmResponseGzlmPara implements IGzjgGzlmResponseGzlmPara {
@@ -45,4 +47,6 @@ export class TGzjgGzlmResponseGzlmPara implements IGzjgGzlmResponseGzlmPara {
45
47
  titleYearNum: number = 999;
46
48
  /** 标题中启用的当前年度的年份差值并且加上月份的截止 (默认为999表示不启用,0的话标题显示为当前年度,其余值为与当前年度的差值)*/
47
49
  titleYearNumMonth: number = 999;
50
+ /** 是否启用仅管理员可以修改 */
51
+ onlyAdminUse: boolean = false;
48
52
  }
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import type { IDictResponse } from "../core/IDictResponse";
3
4
  import type { IGzjgBodyLockResponse, TGzjgBodyLockResponse } from "./IGzjgBodyLockResponse";
@@ -252,7 +253,7 @@ export class TGzjgMainResponse implements IGzjgMainResponse {
252
253
  return defaultGzjgPara;
253
254
  }
254
255
  try {
255
- const obj = JSON.parse(gzjgPara) as IGzjgMainResponseGzjgPara;
256
+ const obj = JSONUtils.parseJSON(gzjgPara) as IGzjgMainResponseGzjgPara;
256
257
  return _.merge(defaultGzjgPara, obj);
257
258
  } catch (e) {}
258
259
  return defaultGzjgPara;
package/src/index.ts CHANGED
@@ -123,3 +123,4 @@ export {
123
123
  type IToolDownLoadData,
124
124
  type IWtuiConfig
125
125
  };
126
+ export { default as JSONUtils } from "./core/jsonUtils";
@@ -72,6 +72,7 @@ export interface ITablMainResponse {
72
72
  unitLike: string;
73
73
  unitType: number;
74
74
  taskMain: number;
75
+ taskName: string;
75
76
  unitTypeText: string;
76
77
  ERORMEMO: string;
77
78
  userMain: number;
@@ -85,6 +86,7 @@ export interface ITablMainResponse {
85
86
  // 用户名称
86
87
  commitBy: string;
87
88
  asNormal: number;
89
+ endedDay: number;
88
90
  listData: Array<ITablDataResponse>;
89
91
  listPath: TCore.IPathResponse[];
90
92
  listWZK8: ITablWzk8Response[];
@@ -161,12 +163,16 @@ export class TTablMainResponse implements ITablMainResponse {
161
163
  unitType: number = 0;
162
164
  unitTypeText: string = "";
163
165
  taskMain: number = 0;
166
+ taskName: string = "";
167
+
164
168
  userMain: number = 0;
165
169
  tablMode: number = 0;
166
170
  tablName: string = "";
167
171
  commitID: number = 0;
168
172
  commitBy: string = "";
169
173
  asNormal: number = 0;
174
+ endedDay: number = 0;
175
+
170
176
  listData: Array<ITablDataResponse> = [];
171
177
  listPath: TCore.IPathResponse[] = [];
172
178
  listWZK8: ITablWzk8Response[] = [];
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IWldyDataResponse } from "./IWldyDataResponse";
3
4
  import { TWldyPageParaResponse } from "./IWldyPageParaResponse";
@@ -106,7 +107,7 @@ export class TWldyPageResponse implements IWldyPageResponse {
106
107
  return result;
107
108
  }
108
109
  try {
109
- const temp = JSON.parse(pagePara) as TWldyPageParaResponse;
110
+ const temp = JSONUtils.parseJSON(pagePara) as TWldyPageParaResponse;
110
111
  return _.merge(result, temp);
111
112
  } catch (e) {}
112
113
  return result;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import { construct } from "@aximario/json-tree";
2
3
  import { IBaseResponse, TBaseResponse } from "../base/IBaseResponse";
3
4
  import _ from "lodash";
@@ -90,7 +91,7 @@ export class TViewCtrlResponse extends TBaseResponse<IViewCtrlResponse> implemen
90
91
  return result;
91
92
  }
92
93
  try {
93
- const temp = JSON.parse(withPara) as TViewCtrlResponseWithParaConv;
94
+ const temp = JSONUtils.parseJSON(withPara) as TViewCtrlResponseWithParaConv;
94
95
  return _.merge(result, temp);
95
96
  } catch (e: any) {}
96
97
  return result;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IWtuiFormParaResponse, TWtuiFormParaResponse } from "./IWtuiFormParaResponse";
3
4
  import { IWtuiItemResponse } from "./IWtuiItemResponse";
@@ -83,7 +84,7 @@ export class TWtuiFormResponse implements IWtuiFormResponse {
83
84
  return formParaObj;
84
85
  }
85
86
  try {
86
- const obj = JSON.parse(formPara) as TWtuiFormParaResponse;
87
+ const obj = JSONUtils.parseJSON(formPara) as TWtuiFormParaResponse;
87
88
  const result = _.merge(formParaObj, obj);
88
89
  return result;
89
90
  } catch (e) {}
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IWtuiItemParaResponse, TWtuiItemParaResponse } from "./IWtuiItemParaResponse";
3
4
  import { IDictResponse } from "../core";
@@ -107,7 +108,7 @@ export class TWtuiItemResponse implements IWtuiItemResponse {
107
108
  return itemParaObj;
108
109
  }
109
110
  try {
110
- const obj = JSON.parse(itemPara) as TWtuiItemParaResponse;
111
+ const obj = JSONUtils.parseJSON(itemPara) as TWtuiItemParaResponse;
111
112
  const result = _.merge(itemParaObj, obj);
112
113
  return result;
113
114
  } catch (e) {}
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IWtuiTodoResponseTodoPara, TWtuiTodoResponseTodoPara } from "./IWtuiTodoResponseTodoPara";
3
4
  import { IWtuiTodoResponseWithPara, TWtuiTodoResponseWithPara } from "./IWtuiTodoResponseWithPara";
@@ -83,7 +84,7 @@ export class TWtuiTodoResponse implements IWtuiTodoResponse {
83
84
  return result;
84
85
  }
85
86
  try {
86
- const temp = JSON.parse(withPara) as TWtuiTodoResponseWithPara[];
87
+ const temp = JSONUtils.parseJSON(withPara) as TWtuiTodoResponseWithPara[];
87
88
  return _.merge(result, temp);
88
89
  } catch (e: any) {}
89
90
  return result;
@@ -95,7 +96,7 @@ export class TWtuiTodoResponse implements IWtuiTodoResponse {
95
96
  return result;
96
97
  }
97
98
  try {
98
- const temp = JSON.parse(todoPara) as TWtuiTodoResponseTodoPara;
99
+ const temp = JSONUtils.parseJSON(todoPara) as TWtuiTodoResponseTodoPara;
99
100
  return _.merge(result, temp);
100
101
  } catch (e: any) {}
101
102
  return result;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  import { IUnitResponse } from "../core";
3
4
  import { IWtuiColWidthResponse, TWtuiColWidthResponse } from "./IWtuiColWidthResponse";
@@ -135,7 +136,7 @@ export class TWtuiUserCnfgResponse implements IWtuiUserCnfgResponse {
135
136
  return defaultDictPara;
136
137
  }
137
138
  try {
138
- const obj = JSON.parse(dictPara) as TCnfgPara;
139
+ const obj = JSONUtils.parseJSON(dictPara) as TCnfgPara;
139
140
  return _.merge(defaultDictPara, obj);
140
141
  } catch (e) { }
141
142
  return defaultDictPara;
@@ -1,3 +1,4 @@
1
+ import JSONUtils from "../core/jsonUtils";
1
2
  import _ from "lodash";
2
3
  /* 物资参数约定 */
3
4
  export interface IWzWithParaResponse {
@@ -139,7 +140,7 @@ export class TWzWithParaResponse implements IWzWithParaResponse {
139
140
  return result;
140
141
  }
141
142
  try {
142
- const temp = JSON.parse(withPara) as TWzWithParaResponse;
143
+ const temp = JSONUtils.parseJSON(withPara) as TWzWithParaResponse;
143
144
  return _.merge(result, temp);
144
145
  } catch (e: any) {}
145
146
  return result;
@@ -1,67 +0,0 @@
1
- import _ from "lodash";
2
-
3
- export interface ISyszclbgblbResponse {
4
- whoBuild: number
5
- userIndx: number
6
- zclbIndx: number
7
- dataStat: number
8
- dataHide: number
9
- dataOrdr: number
10
- dataFrom: number
11
- dataDate: number
12
- dataTime: number
13
- createBy: string
14
- createAt: number
15
- updateBy: string
16
- updateAt: number
17
- deleteBy: string
18
- deleteAt: number
19
- queuesBy: number
20
- fromWhoBuild: number
21
- fromUserIndx: number
22
- fromGblbIndx: number
23
- sourceND: number
24
- fromSourceND: number
25
-
26
- zclbTypeText: string
27
- zclbCode: string
28
- zclbName: string
29
- gblbCode: string
30
- gblbName: string
31
- }
32
-
33
- export class TSyszclbgblbResponse implements ISyszclbgblbResponse {
34
- whoBuild: number = 0
35
- userIndx: number = 0
36
- zclbIndx: number = 0
37
- dataStat: number = 0
38
- dataHide: number = 0
39
- dataOrdr: number = 0
40
- dataFrom: number = 0
41
- dataDate: number = 0
42
- dataTime: number = 0
43
- createBy: string = ""
44
- createAt: number = 0
45
- updateBy: string = ""
46
- updateAt: number = 0
47
- deleteBy: string = ""
48
- deleteAt: number = 0
49
- queuesBy: number = 0
50
- fromWhoBuild: number = 0
51
- fromUserIndx: number = 0
52
- fromGblbIndx: number = 0
53
- sourceND: number = 0
54
- fromSourceND: number = 0
55
-
56
- zclbTypeText: string = ""
57
- zclbCode: string = ""
58
- zclbName: string = ""
59
- gblbCode: string = ""
60
- gblbName: string = ""
61
-
62
- constructor(data: any = {}) {
63
- if (data) {
64
- _.merge(this, _.pick(data, Object.keys(this)));
65
- }
66
- }
67
- }
@@ -1,68 +0,0 @@
1
- import _ from "lodash";
2
-
3
- export interface ISyszclbgblb{
4
- whoBuild : number
5
- userIndx : number
6
- zclbIndx : number
7
- dataStat : number
8
- dataHide : number
9
- dataOrdr : number
10
- dataFrom : number
11
- dataDate : number
12
- dataTime : number
13
- createBy : string
14
- createAt : number
15
- updateBy : string
16
- updateAt : number
17
- deleteBy : string
18
- deleteAt : number
19
- queuesBy : number
20
- fromWhoBuild: number
21
- fromUserIndx: number
22
- fromGblbIndx: number
23
- sourceND : number
24
- fromSourceND: number
25
-
26
- zclbTypeText : string
27
- zclbCode: string
28
- zclbName: string
29
- gblbCode: string
30
- gblbName: string
31
-
32
- }
33
-
34
- export class TSyszclbgblb implements ISyszclbgblb{
35
- whoBuild : number = 0
36
- userIndx : number = 0
37
- zclbIndx : number = 0
38
- dataStat : number = 0
39
- dataHide : number = 0
40
- dataOrdr : number = 0
41
- dataFrom : number = 0
42
- dataDate : number = 0
43
- dataTime : number = 0
44
- createBy : string =''
45
- createAt : number = 0
46
- updateBy : string =''
47
- updateAt : number = 0
48
- deleteBy : string =''
49
- deleteAt : number = 0
50
- queuesBy : number = 0
51
- fromWhoBuild: number = 0
52
- fromUserIndx: number = 0
53
- fromGblbIndx: number = 0
54
- sourceND : number = 0
55
- fromSourceND: number = 0
56
-
57
- zclbTypeText : string =""
58
- zclbCode: string =""
59
- zclbName: string =""
60
- gblbCode: string =""
61
- gblbName: string =""
62
-
63
- constructor(data: Partial<ISYSZCLBGBLB> = {}) {
64
- if (data) {
65
- _.merge(this, _.pick(data, Object.keys(this)));
66
- }
67
- }
68
- }
@@ -1,20 +0,0 @@
1
- export const CONST_ITEM_TYPE_TO_数值 = 0; // #数值
2
- export const CONST_ITEM_TYPE_TO_文本 = 1; // #文本
3
- export const CONST_ITEM_TYPE_TO_文本域 = 2; // #备注
4
- export const CONST_ITEM_TYPE_TO_日期 = 3; // #日期
5
- export const CONST_ITEM_TYPE_TO_字典 = 4; // #字典
6
-
7
- export const CONST_VALIDATE_TO_手机号码 = 0; // #整数
8
- export const CONST_VALIDATE_TO_邮箱 = 1; // #文本
9
- export const CONST_VALIDATE_TO_身份证 = 2; // #备注
10
- export const CONST_VALIDATE_TO_自定义 = 3;
11
-
12
- export const CONST_CLEARABLE_TO_不清空 = 0; //不清空
13
- export const CONST_CLEARABLE_TO_清空 = 1; //清空
14
- export const CONST_CLEARABLE_TO_询问 = 2; //询问
15
-
16
- export const CONST_OPERATOR_TO_大于 = 0; //大于
17
- export const CONST_OPERATOR_TO_等于 = 1; //等于
18
- export const CONST_OPERATOR_TO_小于 = 2; //小于
19
- export const CONST_OPERATOR_TO_大于等于 = 3; //大于等于
20
- export const CONST_OPERATOR_TO_小于等于 = 4; //小于等于