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

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.
Files changed (32) hide show
  1. package/dist/api/WMS/Controllers/CommonController/GetLatestApkVersion.ts +21 -21
  2. package/dist/api/WMS/Controllers/LoginController/GetUserInfo.ts +21 -21
  3. package/dist/api/WMS/Controllers/LoginController/Logout.ts +21 -21
  4. package/dist/api/WMS/Controllers/LoginController/index.ts +2 -2
  5. package/dist/api/WMS/Controllers/WhController/ListVO.ts +88 -88
  6. package/dist/api/WMS/Controllers/WorkstationController/List.ts +45 -45
  7. package/dist/api/WMS/Controllers/WorkstationController/index.ts +1 -1
  8. package/dist/api/WMS/Controllers/index.ts +4 -4
  9. package/dist/api/WMS/models.ts +342 -318
  10. package/dist/component/KgStation/KgStation.vue +120 -9
  11. package/dist/const/index.vm.ts +10 -0
  12. package/dist/index.css +21 -2
  13. package/dist/service/http-client.ts +106 -62
  14. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +5 -4
  15. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +4 -4
  16. package/dist/uni/uni-ui/uni-easyinput/common.js +1 -0
  17. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +23 -70
  18. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +8 -4
  19. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +4 -4
  20. package/dist/util/kg.ts +66 -14
  21. package/package.json +22 -22
  22. package/script/bump-to.luotao.smartfactory.product.wms.wms--dev-3.2.ts +3 -0
  23. package/script/bump-to.luotao.smartfactory.product.wms.wms--project-kengic-factory.ts +3 -0
  24. package/script/bump-to.ts +38 -0
  25. package/script/bump.ts +35 -0
  26. package/script/copy-to.luotao.smartfactory.product.wms.wms--dev-3.2.ts +3 -0
  27. package/script/copy-to.luotao.smartfactory.product.wms.wms--project-kengic-factory.ts +3 -0
  28. package/script/copy-to.ts +23 -0
  29. package/script/publish.ts +20 -0
  30. package/dist/src/index.d.ts +0 -1
  31. package/dist/uni/uni-ui/README.md +0 -1
  32. package/dist/uni/uni-ui/uni-scss/readme.md +0 -4
@@ -3,54 +3,6 @@
3
3
  <view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
4
4
  <uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc" @click="onClickIcon('prefix')" size="16"></uni-icons>
5
5
  <slot name="left"></slot>
6
- <!-- #ifdef MP-ALIPAY -->
7
- <textarea
8
- :enableNative="enableNative"
9
- v-if="type === 'textarea'"
10
- class="uni-easyinput__content-textarea"
11
- :class="{ 'input-padding': inputBorder }"
12
- :name="name"
13
- :value="val"
14
- :placeholder="placeholder"
15
- :placeholderStyle="placeholderStyle"
16
- :disabled="disabled"
17
- placeholder-class="uni-easyinput__placeholder-class"
18
- :maxlength="inputMaxlength"
19
- :focus="focused"
20
- :autoHeight="autoHeight"
21
- :cursor-spacing="cursorSpacing"
22
- :adjust-position="adjustPosition"
23
- @input="onInput"
24
- @blur="_Blur"
25
- @focus="_Focus"
26
- @confirm="onConfirm"
27
- @keyboardheightchange="onkeyboardheightchange"
28
- ></textarea>
29
- <input
30
- :enableNative="enableNative"
31
- v-else
32
- :type="type === 'password' ? 'text' : type"
33
- class="uni-easyinput__content-input"
34
- :style="inputStyle"
35
- :name="name"
36
- :value="val"
37
- :password="!showPassword && type === 'password'"
38
- :placeholder="placeholder"
39
- :placeholderStyle="placeholderStyle"
40
- placeholder-class="uni-easyinput__placeholder-class"
41
- :disabled="disabled"
42
- :maxlength="inputMaxlength"
43
- :focus="focused"
44
- :confirmType="confirmType"
45
- :cursor-spacing="cursorSpacing"
46
- :adjust-position="adjustPosition"
47
- @focus="_Focus"
48
- @blur="_Blur"
49
- @input="onInput"
50
- @confirm="onConfirm"
51
- @keyboardheightchange="onkeyboardheightchange"
52
- />
53
- <!-- #endif -->
54
6
  <!-- #ifndef MP-ALIPAY -->
55
7
  <textarea
56
8
  v-if="type === 'textarea'"
@@ -60,7 +12,7 @@
60
12
  :value="val"
61
13
  :placeholder="placeholder"
62
14
  :placeholderStyle="placeholderStyle"
63
- :disabled="disabled"
15
+ :disabled="disabled || readonly"
64
16
  placeholder-class="uni-easyinput__placeholder-class"
65
17
  :maxlength="inputMaxlength"
66
18
  :focus="focused"
@@ -84,7 +36,7 @@
84
36
  :placeholder="placeholder"
85
37
  :placeholderStyle="placeholderStyle"
86
38
  placeholder-class="uni-easyinput__placeholder-class"
87
- :disabled="disabled"
39
+ :disabled="disabled || readonly"
88
40
  :maxlength="inputMaxlength"
89
41
  :focus="focused"
90
42
  :confirmType="confirmType"
@@ -98,8 +50,8 @@
98
50
  />
99
51
  <!-- #endif -->
100
52
 
53
+ <!-- 开启密码时显示小眼睛 -->
101
54
  <template v-if="type === 'password' && passwordIcon">
102
- <!-- 开启密码时显示小眼睛 -->
103
55
  <uni-icons
104
56
  v-if="isVal"
105
57
  class="content-clear-icon"
@@ -196,7 +148,7 @@
196
148
 
197
149
  export default {
198
150
  name: 'UniEasyinput',
199
- emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change', 'keyboardheightchange'],
151
+ emits: ['click', 'iconClick', 'update:modelValue', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change', 'keyboardheightchange'],
200
152
  model: {
201
153
  prop: 'modelValue',
202
154
  event: 'update:modelValue',
@@ -248,6 +200,14 @@
248
200
  type: Boolean,
249
201
  default: false,
250
202
  },
203
+
204
+ /**
205
+ * <p>是否只读, 跟 disabled 的区别是: 会显示清空图标.</p>
206
+ */
207
+ readonly: {
208
+ type: Boolean,
209
+ default: false,
210
+ },
251
211
  maxlength: {
252
212
  type: [Number, String],
253
213
  default: 140,
@@ -362,7 +322,7 @@
362
322
  'is-input-border': this.inputBorder,
363
323
  'is-input-error-border': this.inputBorder && this.msg,
364
324
  'is-textarea': this.type === 'textarea',
365
- 'is-disabled': this.disabled,
325
+ 'is-disabled': this.disabled || this.readonly,
366
326
  'is-focused': this.focusShow,
367
327
  });
368
328
  },
@@ -371,7 +331,7 @@
371
331
  const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor;
372
332
  return obj2strStyle({
373
333
  'border-color': borderColor || '#e5e5e5',
374
- 'background-color': this.disabled ? this.styles.disableColor : this.styles.backgroundColor,
334
+ 'background-color': this.disabled || this.readonly ? this.styles.disableColor : this.styles.backgroundColor,
375
335
  });
376
336
  },
377
337
  // input右侧样式
@@ -459,9 +419,6 @@
459
419
  }
460
420
  if (this.errMsg) this.errMsg = '';
461
421
  this.val = value;
462
- // TODO 兼容 vue2
463
- this.$emit('input', value);
464
- // TODO 兼容 vue3
465
422
  this.$emit('update:modelValue', value);
466
423
  },
467
424
 
@@ -527,9 +484,6 @@
527
484
  */
528
485
  onClear(event) {
529
486
  this.val = '';
530
- // TODO 兼容 vue2
531
- this.$emit('input', '');
532
- // TODO 兼容 vue2
533
487
  // TODO 兼容 vue3
534
488
  this.$emit('update:modelValue', '');
535
489
  // 点击叉号触发
@@ -582,7 +536,7 @@
582
536
  position: relative;
583
537
  text-align: left;
584
538
  color: #333;
585
- font-size: 14px;
539
+ font-size: 13px;
586
540
  }
587
541
 
588
542
  .uni-easyinput__content {
@@ -609,7 +563,7 @@
609
563
  overflow: hidden;
610
564
  flex: 1;
611
565
  line-height: 1;
612
- font-size: 14px;
566
+ font-size: 13px;
613
567
  height: 24px;
614
568
  // min-height: 36px;
615
569
 
@@ -621,17 +575,16 @@
621
575
  & ::-ms-clear {
622
576
  display: none;
623
577
  }
624
-
625
- & ::-o-clear {
626
- display: none;
627
- }
628
-
629
578
  /*endif*/
630
579
  }
631
580
 
581
+ :deep(.uni-easyinput__content-input) .uni-input-input {
582
+ padding-bottom: 1px;
583
+ }
584
+
632
585
  .uni-easyinput__placeholder-class {
633
586
  color: #999;
634
- font-size: 12px;
587
+ font-size: 13px;
635
588
  // font-weight: 200;
636
589
  }
637
590
 
@@ -648,7 +601,7 @@
648
601
  overflow: hidden;
649
602
  flex: 1;
650
603
  line-height: 1.5;
651
- font-size: 14px;
604
+ font-size: 13px;
652
605
  margin: 6px;
653
606
  margin-left: 0;
654
607
  height: 80px;
@@ -737,7 +690,7 @@
737
690
 
738
691
  .uni-easyinput__placeholder-class {
739
692
  color: #d5d5d5;
740
- font-size: 12px;
693
+ font-size: 13px;
741
694
  }
742
695
  }
743
696
  </style>
@@ -26,8 +26,8 @@
26
26
  </view>
27
27
  <view class="uni-pagination__num uni-pagination__num-flex-none">
28
28
  <view class="uni-pagination__num-current">
29
- <text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}</text>
30
- <text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
29
+ <text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}&nbsp;</text>
30
+ <text class="uni-pagination__num-current-text is-pc-hide">/&nbsp;{{ maxPage || 0 }}</text>
31
31
  <!-- #ifndef APP-NVUE -->
32
32
  <view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }"
33
33
  class="uni-pagination__num-tag tag--active is-phone-hide" @click.top="selectPage(item, index)">
@@ -341,10 +341,14 @@
341
341
  justify-content: center;
342
342
  align-items: center;
343
343
  text-align: center;
344
- border-radius: 5px;
344
+ border-radius: 3px;
345
345
  // border-width: 1px;
346
346
  // border-style: solid;
347
347
  // border-color: $uni-border-color;
348
+ border: 1px solid #ececec !important;
349
+ border-radius: 3px !important;
350
+ border-bottom: 1px solid #d3d3d3 !important;
351
+ background: #fefefe !important;
348
352
  }
349
353
 
350
354
  .uni-pagination__child-btn {
@@ -387,7 +391,7 @@
387
391
  line-height: 30px;
388
392
  // border: 1px red solid;
389
393
  color: #999;
390
- border-radius: 4px;
394
+ border-radius: 3px;
391
395
  // border-width: 1px;
392
396
  // border-style: solid;
393
397
  // border-color: $uni-border-color;
@@ -122,13 +122,13 @@
122
122
 
123
123
  .segmented-control__item--button--first {
124
124
  border-left-width: 1px;
125
- border-top-left-radius: 5px;
126
- border-bottom-left-radius: 5px;
125
+ border-top-left-radius: 3px;
126
+ border-bottom-left-radius: 3px;
127
127
  }
128
128
 
129
129
  .segmented-control__item--button--last {
130
- border-top-right-radius: 5px;
131
- border-bottom-right-radius: 5px;
130
+ border-top-right-radius: 3px;
131
+ border-bottom-right-radius: 3px;
132
132
  }
133
133
 
134
134
  .segmented-control__item--text {
package/dist/util/kg.ts CHANGED
@@ -4,6 +4,7 @@ import { API } from '../api';
4
4
  import { useKgStation, useKgWarehouse } from '../component';
5
5
  import { useAppStore } from '../store/app.store';
6
6
  import { KG_DYNAMIC_QUERY_OPERATOR } from '../const';
7
+ import dayjs, { Dayjs } from 'dayjs';
7
8
 
8
9
  /**
9
10
  * 通用工具.
@@ -35,9 +36,10 @@ export class Kg {
35
36
  * </li>
36
37
  * </ol>
37
38
  *
39
+ * @param $dayjs.
38
40
  * @param params 请求参数.
39
41
  */
40
- public static parseParams(params?: Record<string, any> | null): any {
42
+ public static parseParams($dayjs: typeof dayjs | null | undefined, params?: Record<string, any> | null): any {
41
43
  let _params = toRaw(unref(params))!;
42
44
 
43
45
  if (!_params || !isObjectLike(_params)) {
@@ -51,8 +53,13 @@ export class Kg {
51
53
  const value = _params[key];
52
54
 
53
55
  switch (true) {
56
+ case !!$dayjs && isArray(value) && value.length === 2 && $dayjs.isDayjs(value[0]) && $dayjs.isDayjs(value[1]): {
57
+ resultParams[key] = value;
58
+ break;
59
+ }
60
+
54
61
  case isObjectLike(value):
55
- resultParams[key] = this.parseParams(value);
62
+ resultParams[key] = this.parseParams($dayjs, value);
56
63
  break;
57
64
 
58
65
  case typeof value === 'string':
@@ -128,7 +135,7 @@ export class Kg {
128
135
  const patch: number = Number(oldVersionSegments[2]);
129
136
 
130
137
  try {
131
- const newVersion = await API.WMS.CommonController.GetLatestApkVersion({}, { timeout: 5 * 1000 });
138
+ const newVersion = await API.WMS.CommonController.GetLatestApkVersion({}, { timeout: 5 * 1000, isSuppressSuccess: true });
132
139
 
133
140
  // 最新版本
134
141
  const newVersionSegments = newVersion.split('.');
@@ -195,11 +202,12 @@ export class Kg {
195
202
  * @param param.params 请求参数.
196
203
  */
197
204
  public static getQueryHeaders(param: {
205
+ $dayjs?: typeof dayjs;
198
206
  dynamicQueryExcludeProperties: Array<string> | null | undefined;
199
207
  dynamicQueryOperatorModel: Record<string, any> | null | undefined;
200
208
  params: Record<string, any> | null | undefined;
201
209
  }) {
202
- const { params, dynamicQueryExcludeProperties, dynamicQueryOperatorModel } = param ?? {};
210
+ const { $dayjs, params, dynamicQueryExcludeProperties, dynamicQueryOperatorModel } = param ?? {};
203
211
 
204
212
  let _params = cloneDeep(toRaw(unref(params ?? {})));
205
213
 
@@ -211,7 +219,8 @@ export class Kg {
211
219
  // 特殊字段, 这些特殊字段的值不做处理, 保持原样
212
220
  const SPECIAL_FIELD_KEYS = ['pageNo', 'pageSize', 'column', 'order'];
213
221
 
214
- const _paramsForWhereSql: Record<string, any> = {};
222
+ const _paramsForQueryWhereSql: Record<string, any> = {};
223
+
215
224
  Object.keys(_params)
216
225
  .sort()
217
226
  .forEach((key) => {
@@ -235,16 +244,59 @@ export class Kg {
235
244
  let operator: string = dynamicQueryOperatorModel?.[key] ?? KG_DYNAMIC_QUERY_OPERATOR.EQ;
236
245
 
237
246
  switch (true) {
247
+ //region 日期范围
248
+ //----------------------------------------------------------------------------------------------------
249
+ case !!$dayjs && isArray(value) && value.length === 2 && $dayjs.isDayjs(value[0]) && $dayjs.isDayjs(value[1]): {
250
+ let _stringValue = '';
251
+
252
+ switch (operator) {
253
+ case 'BETWEEN':
254
+ default: {
255
+ const _leftValue = value[0] as Dayjs;
256
+ const _rightValue = value[1] as Dayjs;
257
+
258
+ // 左侧日期的字符串
259
+ let _leftStringValue = '';
260
+ if (_leftValue && _leftValue.isValid()) {
261
+ _leftStringValue = _leftValue.format('YYYY-MM-DD 00:00:00');
262
+ }
263
+
264
+ // 右侧日期的字符串
265
+ let _rightStringValue = '';
266
+ if (_rightValue && _rightValue.isValid()) {
267
+ _rightStringValue = _rightValue.add(1, 'day').format('YYYY-MM-DD 00:00:00');
268
+ }
269
+
270
+ if (_leftStringValue) {
271
+ _stringValue += `(${_key} >= '${_leftStringValue}')`;
272
+ }
273
+
274
+ if (_rightStringValue) {
275
+ if (_stringValue) {
276
+ _stringValue += ' AND ';
277
+ }
278
+
279
+ _stringValue += `(${_key} < '${_rightStringValue}')`;
280
+ }
281
+ break;
282
+ }
283
+ }
284
+
285
+ _paramsForQueryWhereSql[key] = ` AND ${_stringValue}`;
286
+ break;
287
+ }
288
+ //endregion
289
+
238
290
  // array
239
291
  case Array.isArray(value): {
240
292
  if (value.length === 0) {
241
- _paramsForWhereSql[key] = undefined;
293
+ _paramsForQueryWhereSql[key] = undefined;
242
294
  break;
243
295
  }
244
296
 
245
297
  const _value = value.map((i: any) => `N'${String(i)}'`).join(', ');
246
298
 
247
- _paramsForWhereSql[key] = ` AND (${_key} IN (${_value}))`;
299
+ _paramsForQueryWhereSql[key] = ` AND (${_key} IN (${_value}))`;
248
300
  break;
249
301
  }
250
302
 
@@ -257,7 +309,7 @@ export class Kg {
257
309
  case typeof value === 'string': {
258
310
  // 空白字符
259
311
  if (value.trim() === '') {
260
- _paramsForWhereSql[key] = undefined;
312
+ _paramsForQueryWhereSql[key] = undefined;
261
313
  break;
262
314
  }
263
315
 
@@ -291,7 +343,7 @@ export class Kg {
291
343
  }
292
344
  }
293
345
 
294
- _paramsForWhereSql[key] = _strValue;
346
+ _paramsForQueryWhereSql[key] = _strValue;
295
347
 
296
348
  break;
297
349
  }
@@ -333,7 +385,7 @@ export class Kg {
333
385
  }
334
386
  }
335
387
 
336
- _paramsForWhereSql[key] = _strValue;
388
+ _paramsForQueryWhereSql[key] = _strValue;
337
389
 
338
390
  break;
339
391
  }
@@ -355,14 +407,14 @@ export class Kg {
355
407
  }
356
408
  }
357
409
 
358
- _paramsForWhereSql[key] = _strValue;
410
+ _paramsForQueryWhereSql[key] = _strValue;
359
411
 
360
412
  break;
361
413
  }
362
414
 
363
415
  // null, undefined
364
416
  default: {
365
- _paramsForWhereSql[key] = value;
417
+ _paramsForQueryWhereSql[key] = value;
366
418
 
367
419
  break;
368
420
  }
@@ -370,7 +422,7 @@ export class Kg {
370
422
  });
371
423
 
372
424
  const whereSqlSegment = reduce(
373
- _paramsForWhereSql,
425
+ _paramsForQueryWhereSql,
374
426
  (sql, value) => {
375
427
  if (!value) {
376
428
  return sql;
@@ -383,7 +435,7 @@ export class Kg {
383
435
 
384
436
  //region WHERE
385
437
  // ----------------------------------------------------------------------------------------------------
386
- let whereSql = `WHERE (1 = 1)${whereSqlSegment}`;
438
+ let whereSql = `WHERE (1 = 1)${whereSqlSegment}`.replace('(1 = 1) AND ', '');
387
439
  whereSql = encodeURIComponent(whereSql);
388
440
  //endregion
389
441
 
package/package.json CHANGED
@@ -1,38 +1,36 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.6.3-beta.3",
3
+ "version": "0.6.3-beta.30",
4
4
  "scripts": {
5
- "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
5
+ "build": "npm run use-node && rimraf dist && vue-tsc && vite build",
6
6
  "------ -------------------------------------------": "",
7
- "publish:all:major": "npm run bump-version:major && npm run publish:all",
8
- "publish:all:minor": "npm run bump-version:minor && npm run publish:all",
9
- "publish:all:patch": "npm run bump-version:patch && npm run publish:all",
10
- "publish:all:beta": "npm run bump-version:beta && npm run publish:all",
7
+ "publish:major": "npm run bump:major && tsx script/publish.ts",
8
+ "publish:minor": "npm run bump:minor && tsx script/publish.ts",
9
+ "publish:patch": "npm run bump:patch && tsx script/publish.ts",
10
+ "publish:beta": "npm run bump:beta && tsx script/publish.ts",
11
11
  "--------------------------------------------------": "",
12
- "gen:apis:WMS": "npm run switch-node-version && kengic-pont generate-apis --config kg.config.ts --origin WMS",
12
+ "gen:apis:WMS": "npm run use-node && kengic-pont generate-apis --config kg.config.ts --origin WMS",
13
13
  "- ------------------------------------------------": "",
14
- "copy-to:luotao.smartfactory.product.wms.wms--dev-3.2": "npm run build && node scripts/copy-to.luotao.smartfactory.product.wms.wms--dev-3.2.mjs --experimental-default-type=module",
15
- "copy-to:luotao.wms-pda--focus": "npm run build && node scripts/copy-to.luotao.wms-pda--focus.mjs --experimental-default-type=module",
16
- "----------- --------------------------------------": "",
17
- "bump-to:luotao.smartfactory.product.wms.wms--dev-3.2": "npm run switch-node-version && node scripts/bump-to.luotao.smartfactory.product.wms.wms--dev-3.2.mjs --experimental-default-type=module",
18
- "bump-to:luotao.wms-pda--focus": "npm run switch-node-version && node scripts/bump-to.luotao.wms-pda--focus.mjs --experimental-default-type=module",
14
+ "copy-to:luotao.smartfactory.product.wms.wms--dev-3.2": "npm run build && npx tsx script/copy-to.luotao.smartfactory.product.wms.wms--dev-3.2.ts",
15
+ "bump-to:luotao.smartfactory.product.wms.wms--dev-3.2": "npm run use-node && npx tsx script/bump-to.luotao.smartfactory.product.wms.wms--dev-3.2.ts",
16
+ "copy-to:luotao.smartfactory.product.wms.wms--project-kengic-factory": "npm run build && npx tsx script/copy-to.luotao.smartfactory.product.wms.wms--project-kengic-factory.ts",
17
+ "bump-to:luotao.smartfactory.product.wms.wms--project-kengic-factory": "npm run use-node && npx tsx script/bump-to.luotao.smartfactory.product.wms.wms--project-kengic-factory.ts",
19
18
  "-- -----------------------------------------------": "",
20
19
  "cnpm:sync": "npx cnpm --yes sync @kengic/uni",
21
20
  "--- ----------------------------------------------": "",
22
- "switch-node-version": "nvm use 20.11.0 && corepack enable && corepack prepare pnpm@7.30.5 --activate",
21
+ "use-node": "npm cache clean -f && nvm use 18.20.4 && corepack enable && corepack use pnpm@9.12.1",
23
22
  "---- ---------------------------------------------": "",
24
- "bump-version:major": "npm run switch-node-version && node scripts/bump.mjs major --experimental-default-type=module",
25
- "bump-version:minor": "npm run switch-node-version && node scripts/bump.mjs minor --experimental-default-type=module",
26
- "bump-version:patch": "npm run switch-node-version && node scripts/bump.mjs patch --experimental-default-type=module",
27
- "bump-version:beta": "npm run switch-node-version && node scripts/bump.mjs beta --experimental-default-type=module",
23
+ "bump:major": "npm run use-node && npx tsx script/bump.ts major",
24
+ "bump:minor": "npm run use-node && npx tsx script/bump.ts minor",
25
+ "bump:patch": "npm run use-node && npx tsx script/bump.ts patch",
26
+ "bump:beta": "npm run use-node && npx tsx script/bump.ts beta",
28
27
  "----- --------------------------------------------": "",
29
- "publish:all": "npm run switch-node-version && node scripts/publish.mjs --experimental-default-type=module",
30
- "publish:npm": "npm run switch-node-version && npmrc kengic && npm publish ./ --registry https://registry.npmjs.org/ --access public"
28
+ "publish:npm": "npm run use-node && npmrc kengic && npm publish ./ --registry https://registry.npmjs.org/ --access public"
31
29
  },
32
30
  "dependencies": {
33
31
  "@dcloudio/types": "~3.3.3",
34
32
  "@dcloudio/uni-app": "3.0.0-alpha-3080220230428001",
35
- "@kengic/pont": "1.2.15",
33
+ "@kengic/pont": "1.2.17-beta.1",
36
34
  "@types/lodash-es": "4.17.7",
37
35
  "@types/node": "18.16.3",
38
36
  "@types/semver": "7.3.13",
@@ -42,15 +40,17 @@
42
40
  "@vueuse/shared": "8.9.4",
43
41
  "ant-design-vue": "3.2.20",
44
42
  "chalk": "4.1.2",
43
+ "dayjs": "1.11.10",
45
44
  "less": "4.1.3",
46
45
  "lodash-es": "4.17.21",
47
46
  "pinia": "2.0.35",
48
- "prettier": "3.2.5",
47
+ "prettier": "3.3.3",
49
48
  "rimraf": "~3.0.2",
50
49
  "rollup": "~2.79.1",
51
50
  "sass": "1.62.1",
52
51
  "sass-loader": "10.4.1",
53
- "semver": "7.5.0",
52
+ "semver": "7.5.4",
53
+ "tsx": "3.12.3",
54
54
  "typescript": "4.9.5",
55
55
  "uuid": "~9.0.1",
56
56
  "vite": "4.3.4",
@@ -0,0 +1,3 @@
1
+ import { bumpVersionToProjects } from './bump-to.ts';
2
+
3
+ ['file:///D:/proj/kg/smartfactory.product.wms.wms--dev-3.2/wms-pda'].forEach((projectPath) => bumpVersionToProjects(projectPath, []));
@@ -0,0 +1,3 @@
1
+ import { bumpVersionToProjects } from './bump-to.ts';
2
+
3
+ ['file:///D:/proj/kg/smartfactory.product.wms.wms--project-kengic-factory/wms-pda'].forEach((projectPath) => bumpVersionToProjects(projectPath, []));
@@ -0,0 +1,38 @@
1
+ import fs from 'fs';
2
+ import chalk from 'chalk';
3
+
4
+ /**
5
+ * 更新前端项目中包的版本号.
6
+ * 当我们升级了这些包的版本后, 可以使用该方法快速将新的版本号同步到前端项目中去.
7
+ *
8
+ * @param projectPath 前端项目目录.
9
+ * @param excludes 要排除的包.
10
+ */
11
+ function bumpVersionToProjects(projectPath, excludes = []) {
12
+ // file:///D:/foo/...
13
+ const pkgPath = `${projectPath}/package.json`;
14
+ // D:/foo/...
15
+ const absolutePkgPath = pkgPath.replace('file:///', '');
16
+
17
+ import(pkgPath, { with: { type: 'json' } })
18
+ .then(({ default: projectJSON }) => {
19
+ import('../package.json', { with: { type: 'json' } })
20
+ .then(({ default: packageJSON }) => {
21
+ const { version, name } = packageJSON;
22
+ if (projectJSON.dependencies[name]) {
23
+ projectJSON.dependencies[name] = version;
24
+ }
25
+
26
+ fs.writeFileSync(absolutePkgPath, `${JSON.stringify(projectJSON, null, 4)}\n`, {});
27
+ console.log(chalk.green(`版本更新成功`) + ' | ' + chalk.blue(version) + ' | ' + absolutePkgPath);
28
+ })
29
+ .catch((e) => {
30
+ console.log(e);
31
+ });
32
+ })
33
+ .catch((e) => {
34
+ console.error(e);
35
+ });
36
+ }
37
+
38
+ export { bumpVersionToProjects };
package/script/bump.ts ADDED
@@ -0,0 +1,35 @@
1
+ import fs from 'fs';
2
+ import semver from 'semver';
3
+
4
+ // ----------------------------------------------------------------------------------------------------
5
+ // 自动更新所有包的版本号
6
+ // ----------------------------------------------------------------------------------------------------
7
+
8
+ import('../package.json').then(({ default: json }) => {
9
+ const type = process.argv[2];
10
+ let version = json.version;
11
+
12
+ switch (type) {
13
+ case 'major':
14
+ version = semver.inc(version, 'major');
15
+ break;
16
+ case 'minor':
17
+ version = semver.inc(version, 'minor');
18
+ break;
19
+ case 'patch':
20
+ version = semver.inc(version, 'patch');
21
+ break;
22
+ case 'beta':
23
+ version = semver.inc(version, 'prerelease', 'beta');
24
+ break;
25
+ default:
26
+ throw new Error('INVALID SEMVER TYPE');
27
+ }
28
+
29
+ import('../package.json').then(({ default: json }) => {
30
+ json.version = version;
31
+ fs.writeFileSync('./package.json', `${JSON.stringify(json, null, 4)}\n`, {});
32
+ });
33
+ });
34
+
35
+ export {};
@@ -0,0 +1,3 @@
1
+ import { copyToProject } from './copy-to.ts';
2
+
3
+ ['D:/proj/kg/smartfactory.product.wms.wms--dev-3.2/wms-pda'].forEach((projectPath) => copyToProject(projectPath));
@@ -0,0 +1,3 @@
1
+ import { copyToProject } from './copy-to.ts';
2
+
3
+ ['D:/proj/kg/smartfactory.product.wms.wms--project-kengic-factory/wms-pda'].forEach((projectPath) => copyToProject(projectPath));
@@ -0,0 +1,23 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ /**
5
+ * 开发时, 需要将打包后的文件复制到项目的 node_modules 目录下进行测试.
6
+ *
7
+ * @param projectPath 前端项目目录.
8
+ */
9
+ function copyToProject(projectPath) {
10
+ const cacheDir = path.join(projectPath, '/node_modules/.vite/');
11
+ if (fs.existsSync(cacheDir)) {
12
+ fs.rmSync(cacheDir, { recursive: true, force: true });
13
+ }
14
+
15
+ const dir = path.join(projectPath, '/node_modules/@kengic/uni/dist/');
16
+ if (fs.existsSync(dir)) {
17
+ fs.rmSync(dir, { recursive: true, force: true });
18
+ }
19
+
20
+ fs.cpSync('./dist/', dir, { recursive: true });
21
+ }
22
+
23
+ export { copyToProject };
@@ -0,0 +1,20 @@
1
+ import chalk from 'chalk';
2
+ import { execSync } from 'child_process';
3
+ import { name, version } from '../package.json';
4
+
5
+ /*
6
+ * 使用下面的脚本来简化打包发布流程.
7
+ */
8
+
9
+ const PKGNAME = `${name}@${version}`;
10
+
11
+ execSync('npm cache clean -f', { cwd: './', stdio: 'ignore' });
12
+ execSync('pnpm install', { cwd: './', stdio: 'ignore' });
13
+ console.log(`${chalk.blueBright('INSTALL ')}| ${PKGNAME}`);
14
+
15
+ execSync('npm run build', { cwd: './', stdio: 'ignore' });
16
+ console.log(`${chalk.blueBright(' BUILD ')}| ${PKGNAME}`);
17
+
18
+ execSync('npm run publish:npm', { cwd: './', stdio: 'ignore' });
19
+ console.log(`${chalk.blueBright('PUBLISH ')}| ${PKGNAME}`);
20
+ console.log('');