@kengic/uni 0.6.3-beta.1 → 0.6.3-beta.3

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.
@@ -14,14 +14,7 @@ export class GetLatestApkVersionQuery {}
14
14
  * @param option 请求选项.
15
15
  */
16
16
  export function GetLatestApkVersion(config?: IRequestConfig<GetLatestApkVersionQuery, {}>, option?: IRequestOptions): Promise<string> {
17
- return httpClient().request(
18
- {
19
- method: GetLatestApkVersion.method,
20
- url: `${option?.mock ? '/mock' : ''}${GetLatestApkVersion.url}`,
21
- ...(config ?? {}),
22
- },
23
- option,
24
- );
17
+ return httpClient().request({ method: GetLatestApkVersion.method, url: GetLatestApkVersion.url, ...(config ?? {}) }, option);
25
18
  }
26
19
 
27
20
  GetLatestApkVersion.method = 'GET' as const;
@@ -14,14 +14,7 @@ export class GetUserInfoQuery {}
14
14
  * @param option 请求选项.
15
15
  */
16
16
  export function GetUserInfo(config?: IRequestConfig<GetUserInfoQuery, {}>, option?: IRequestOptions): Promise<Record<any, any>> {
17
- return httpClient().request(
18
- {
19
- method: GetUserInfo.method,
20
- url: `${option?.mock ? '/mock' : ''}${GetUserInfo.url}`,
21
- ...(config ?? {}),
22
- },
23
- option,
24
- );
17
+ return httpClient().request({ method: GetUserInfo.method, url: GetUserInfo.url, ...(config ?? {}) }, option);
25
18
  }
26
19
 
27
20
  GetUserInfo.method = 'GET' as const;
@@ -14,14 +14,7 @@ export class LogoutQuery {}
14
14
  * @param option 请求选项.
15
15
  */
16
16
  export function Logout(config?: IRequestConfig<LogoutQuery, {}>, option?: IRequestOptions): Promise<Record<any, any>> {
17
- return httpClient().request(
18
- {
19
- method: Logout.method,
20
- url: `${option?.mock ? '/mock' : ''}${Logout.url}`,
21
- ...(config ?? {}),
22
- },
23
- option,
24
- );
17
+ return httpClient().request({ method: Logout.method, url: Logout.url, ...(config ?? {}) }, option);
25
18
  }
26
19
 
27
20
  Logout.method = 'GET' as const;
@@ -81,14 +81,7 @@ wh-分页列表查询VO
81
81
  * @param option 请求选项.
82
82
  */
83
83
  export function ListVO(config?: IRequestConfig<ListVOQuery, {}>, option?: IRequestOptions): Promise<DEF.WMS.IPage<DEF.WMS.WhDTO>> {
84
- return httpClient().request(
85
- {
86
- method: ListVO.method,
87
- url: `${option?.mock ? '/mock' : ''}${ListVO.url}`,
88
- ...(config ?? {}),
89
- },
90
- option,
91
- );
84
+ return httpClient().request({ method: ListVO.method, url: ListVO.url, ...(config ?? {}) }, option);
92
85
  }
93
86
 
94
87
  ListVO.method = 'GET' as const;
@@ -0,0 +1,45 @@
1
+ // noinspection ES6UnusedImports
2
+
3
+ import { httpClient, IRequestConfig, IRequestOptions } from '../../../../service';
4
+ import * as DEF from '../../../def';
5
+ import { keys } from '../../models';
6
+
7
+ /** 请求参数. */
8
+ export class ListQuery {
9
+ /** 排序字段. */
10
+ public column?: string | null;
11
+ /** 排序方式. */
12
+ public order?: 'asc' | 'desc' | null;
13
+ /** 当前页数. */
14
+ public pageNo?: number | null;
15
+ /** 每页条数. */
16
+ public pageSize?: number | null;
17
+
18
+ public constructor(obj?: ListQuery) {
19
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
20
+ switch (key) {
21
+ case 'column':
22
+ case 'order':
23
+ case 'pageNo':
24
+ case 'pageSize':
25
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
26
+ break;
27
+ default:
28
+ break;
29
+ }
30
+ });
31
+ }
32
+ }
33
+
34
+ /**
35
+ * 工作站-分页列表查询
36
+ *
37
+ * @param config 请求配置.
38
+ * @param option 请求选项.
39
+ */
40
+ export function List(config?: IRequestConfig<ListQuery, {}>, option?: IRequestOptions): Promise<DEF.WMS.IPage<DEF.WMS.WorkstationDTO>> {
41
+ return httpClient().request({ method: List.method, url: List.url, ...(config ?? {}) }, option);
42
+ }
43
+
44
+ List.method = 'GET' as const;
45
+ List.url = '/workstation/workstation/list';
@@ -0,0 +1 @@
1
+ export { List, ListQuery } from './List';
@@ -1,3 +1,4 @@
1
1
  export * as CommonController from './CommonController';
2
2
  export * as LoginController from './LoginController';
3
3
  export * as WhController from './WhController';
4
+ export * as WorkstationController from './WorkstationController';
@@ -222,6 +222,87 @@ export class WhDTO {
222
222
  }
223
223
  }
224
224
 
225
+ /** 工作站区域数据传输对象 */
226
+ export class WorkstationAreaDTO {
227
+ /** 主键 */
228
+ public id?: string | null;
229
+ /** 创建日期 */
230
+ public insDt?: string | null;
231
+ /** 创建用户 */
232
+ public insUsrId?: string | null;
233
+ /** 修改日期 */
234
+ public modUsrId?: string | null;
235
+ /** 修改用户 */
236
+ public moddte?: string | null;
237
+ /** 仓库 */
238
+ public whId?: string | null;
239
+ /** 工作区 */
240
+ public wrkare?: string | null;
241
+ /** 工作区描述 */
242
+ public wrkareDsc?: string | null;
243
+
244
+ public constructor(obj?: WorkstationAreaDTO) {
245
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
246
+ switch (key) {
247
+ case 'id':
248
+ case 'insDt':
249
+ case 'insUsrId':
250
+ case 'modUsrId':
251
+ case 'moddte':
252
+ case 'whId':
253
+ case 'wrkare':
254
+ case 'wrkareDsc':
255
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
256
+ break;
257
+ default:
258
+ break;
259
+ }
260
+ });
261
+ }
262
+ }
263
+
264
+ /** 工作站数据传输对象 */
265
+ export class WorkstationDTO {
266
+ /** 工作站 */
267
+ public devcod?: string | null;
268
+ /** 主工作区 */
269
+ public hmewrkare?: string | null;
270
+ /** 主键 */
271
+ public id?: string | null;
272
+ /** 创建日期 */
273
+ public insDt?: string | null;
274
+ /** 创建用户 */
275
+ public insUsrId?: string | null;
276
+ /** 修改日期 */
277
+ public modUsrId?: string | null;
278
+ /** 修改用户 */
279
+ public moddte?: string | null;
280
+ /** 仓库 */
281
+ public whId?: string | null;
282
+ /** 工作站与工作区域关系 */
283
+ public workstationAreas?: Array<WorkstationAreaDTO> | null;
284
+
285
+ public constructor(obj?: WorkstationDTO) {
286
+ keys(obj ?? {}).forEach((key: PropertyKey) => {
287
+ switch (key) {
288
+ case 'devcod':
289
+ case 'hmewrkare':
290
+ case 'id':
291
+ case 'insDt':
292
+ case 'insUsrId':
293
+ case 'modUsrId':
294
+ case 'moddte':
295
+ case 'whId':
296
+ case 'workstationAreas':
297
+ Reflect.set(this, key, Reflect.get(obj ?? {}, key));
298
+ break;
299
+ default:
300
+ break;
301
+ }
302
+ });
303
+ }
304
+ }
305
+
225
306
  /**
226
307
  * 获取对象的属性名数组.
227
308
  * @param obj 对象.
@@ -21,7 +21,8 @@
21
21
  import { UniDataSelect, UniPopup, UniPopupDialog } from '../../uni';
22
22
  import { computed, ref, watch } from 'vue';
23
23
  import { useKgStation } from './index.hooks';
24
- import { WorkstationDTO } from './index.store';
24
+ import { WorkstationDTO } from '../../api/WMS/models';
25
+ import { API } from '../../api';
25
26
 
26
27
  const emit = defineEmits(['ok']);
27
28
 
@@ -43,9 +44,7 @@
43
44
  /**
44
45
  * 工作站下拉列表.
45
46
  */
46
- const stationDatas = computed<Array<{ value: string; text: string }>>(() =>
47
- stations.value.map((i) => ({ text: i.devcodDsc ?? '', value: i.devcod ?? '' })),
48
- );
47
+ const stationDatas = computed<Array<{ value: string; text: string }>>(() => stations.value.map((i) => ({ text: i.devcod ?? '', value: i.devcod ?? '' })));
49
48
 
50
49
  /**
51
50
  * 工作区下拉列表.
@@ -55,8 +54,8 @@
55
54
  stations.value
56
55
  .find((i) => i.devcod === currentDevcod.value)
57
56
  ?.workstationAreas?.map((i) => ({
58
- text: i.wrkare ?? '',
59
- value: i.wrkareDsc ?? '',
57
+ text: i.wrkareDsc ?? i.wrkare ?? '',
58
+ value: i.wrkare ?? '',
60
59
  })) ?? [],
61
60
  );
62
61
 
@@ -70,10 +69,12 @@
70
69
  if (!value) {
71
70
  currentHmewrkare.value = '';
72
71
  } else {
72
+ console.log('11', value, currentDevcod.value);
73
73
  // 当「当前选择的工作站编号」变更时, 选择它的默认的工作区,
74
74
  const currentStation = stations.value.find((i) => i.devcod === currentDevcod.value);
75
75
  if (currentStation) {
76
76
  currentHmewrkare.value = currentStation.hmewrkare ?? '';
77
+ console.log('22', currentHmewrkare.value);
77
78
  }
78
79
  }
79
80
  });
@@ -120,29 +121,7 @@
120
121
  */
121
122
  async function requestStations(): Promise<void> {
122
123
  try {
123
- // TODO 调用接口获取所有工作站
124
- stations.value = [
125
- {
126
- whId: 'WMD1',
127
- devcod: 'AAA',
128
- devcodDsc: 'AAA',
129
- hmewrkare: 'A111',
130
- workstationAreas: [
131
- { wrkare: 'A111', wrkareDsc: 'A111' },
132
- { wrkare: 'A222', wrkareDsc: 'A222' },
133
- ],
134
- },
135
- {
136
- whId: 'WMD1',
137
- devcod: 'BBB',
138
- devcodDsc: 'BBB',
139
- hmewrkare: 'B222',
140
- workstationAreas: [
141
- { wrkare: 'B111', wrkareDsc: 'B111' },
142
- { wrkare: 'B222', wrkareDsc: 'B222' },
143
- ],
144
- },
145
- ];
124
+ stations.value = (await API.WMS.WorkstationController.List({ params: { pageNo: 1, pageSize: 999 } }))?.records ?? [];
146
125
  } catch (e) {
147
126
  console.error(e);
148
127
  }
@@ -176,7 +155,7 @@
176
155
  :deep(.uni-popup-dialog) .uni-dialog-content > .row {
177
156
  display: flex;
178
157
  align-items: center;
179
- margin-bottom: 6px;
158
+ margin-bottom: 3px;
180
159
  width: 100%;
181
160
  }
182
161
 
@@ -1,6 +1,7 @@
1
1
  import { computed, ComputedRef } from 'vue';
2
- import { IKgStationStore, useKgStationStore, WorkstationDTO, WorkstationAreaDTO } from './index.store';
2
+ import { IKgStationStore, useKgStationStore } from './index.store';
3
3
  import { useKgWarehouse } from '../KgWarehouse';
4
+ import { WorkstationAreaDTO, WorkstationDTO } from '../../api/WMS/models';
4
5
 
5
6
  export type IUseKgStation = {
6
7
  /**
@@ -1,23 +1,10 @@
1
1
  import { defineStore, StoreDefinition } from 'pinia';
2
2
  import { toRaw, unref } from 'vue';
3
+ import { API } from '../../api';
4
+ import { WorkstationDTO } from '../../api/WMS/models';
3
5
 
4
6
  const LOCAL_STORAGE_KEY = 'KgStation.station';
5
7
 
6
- export type WorkstationDTO = {
7
- id?: string;
8
- whId?: string;
9
- devcod?: string;
10
- devcodDsc?: string;
11
- hmewrkare?: string;
12
- workstationAreas?: Array<WorkstationAreaDTO>;
13
- };
14
-
15
- export type WorkstationAreaDTO = {
16
- id?: string;
17
- whId?: string;
18
- wrkare?: string;
19
- wrkareDsc?: string;
20
- };
21
8
  export interface IKgStationState {
22
9
  /**
23
10
  * 当前工作站.
@@ -57,29 +44,7 @@ export const useKgStationStore = defineStore('KgStation', {
57
44
  return;
58
45
  }
59
46
 
60
- // TODO 调用接口获取所有工作站
61
- this.stations = [
62
- {
63
- whId: 'WMD1',
64
- devcod: 'AAA',
65
- devcodDsc: 'AAA',
66
- hmewrkare: 'A111',
67
- workstationAreas: [
68
- { wrkare: 'A111', wrkareDsc: 'A111' },
69
- { wrkare: 'A222', wrkareDsc: 'A222' },
70
- ],
71
- },
72
- {
73
- whId: 'WMD1',
74
- devcod: 'BBB',
75
- devcodDsc: 'BBB',
76
- hmewrkare: 'B222',
77
- workstationAreas: [
78
- { wrkare: 'B111', wrkareDsc: 'B111' },
79
- { wrkare: 'B222', wrkareDsc: 'B222' },
80
- ],
81
- },
82
- ];
47
+ this.stations = (await API.WMS.WorkstationController.List({ params: { pageNo: 1, pageSize: 999 } }))?.records ?? [];
83
48
  },
84
49
 
85
50
  setStation(station?: WorkstationDTO | null): void {
package/dist/index.css CHANGED
@@ -6,6 +6,11 @@ uni-button {
6
6
  padding-bottom: 50px !important;
7
7
  }
8
8
 
9
+ .uni-simple-toast__text {
10
+ padding: 6.5px 12px 9.5px 12px;
11
+ border-radius: 4px;
12
+ }
13
+
9
14
  /* #ifdef H5 */
10
15
 
11
16
  .uni-nav-bar-text {
@@ -74,8 +74,10 @@ type IRequestOptions = Omit<UniApp.RequestOptions, 'url'> & {
74
74
  /** 是否处理请求结果. */
75
75
  isTransformResponse?: boolean;
76
76
 
77
- /** 是否使用模拟数据. */
78
- mock?: boolean;
77
+ /**
78
+ * <p>模拟数据. 如果不为 undefined 则不会发起请求, 而是直接返回该模拟数据.</p>
79
+ */
80
+ mock?: any;
79
81
  };
80
82
 
81
83
  /** 请求参数. */
@@ -143,6 +145,11 @@ const _httpClient: IHttpClient = {
143
145
  },
144
146
  options?: IRequestOptions,
145
147
  ) {
148
+ // 使用模拟数据, 直接返回模拟数据,
149
+ if (options?.mock !== undefined) {
150
+ return new Promise((resolve) => resolve(options?.mock));
151
+ }
152
+
146
153
  const { method, url, params, data } = config;
147
154
 
148
155
  return new Promise<T>((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.6.3-beta.1",
3
+ "version": "0.6.3-beta.3",
4
4
  "scripts": {
5
5
  "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
6
6
  "------ -------------------------------------------": "",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@dcloudio/types": "~3.3.3",
34
34
  "@dcloudio/uni-app": "3.0.0-alpha-3080220230428001",
35
- "@kengic/pont": "1.2.14",
35
+ "@kengic/pont": "1.2.15",
36
36
  "@types/lodash-es": "4.17.7",
37
37
  "@types/node": "18.16.3",
38
38
  "@types/semver": "7.3.13",