@kengic/uni 0.7.14-beta.2 → 0.7.14-beta.4

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.
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <UniPopup ref="popupRef$" :type="'bottom'" class="kg-locale-selector">
3
+ <UniCard :isFull="true" :title="'选择语言'">
4
+ <view>
5
+ <view class="body">
6
+ <view v-for="item in KG.LOCALE_DATA_LIST" :key="item.code" class="item">{{ item.text }}</view>
7
+ <UniDataCheckbox v-model="currentLocale$" :localdata="localeDataList$" />
8
+ </view>
9
+ <view class="buttons">
10
+ <button class="btn btn-cancel" @tap.stop="onCancel()">取消</button>
11
+ <button :type="'primary' as any" class="btn btn-ok" @tap.stop="onOk">确认</button>
12
+ </view>
13
+ </view>
14
+ </UniCard>
15
+ </UniPopup>
16
+ </template>
17
+
18
+ <!--语言选择-->
19
+ <script lang="ts" setup>
20
+ import { UniDataCheckbox, UniPopup } from '../../uni-ui';
21
+ import { ref } from 'vue';
22
+ import { KG } from '../../model';
23
+
24
+ const emit = defineEmits(['ok']);
25
+
26
+ //region DATA
27
+ //----------------------------------------------------------------------------------------------------
28
+ const popupRef$ = ref<any>(null);
29
+
30
+ /**
31
+ * 当前选择的语言.
32
+ */
33
+ const currentLocale$ = ref<string>('');
34
+
35
+ /**
36
+ * 语言数据列表.
37
+ */
38
+ const localeDataList$ = ref<Array<{ text: string; value: string }>>([]);
39
+ //----------------------------------------------------------------------------------------------------
40
+ //endregion
41
+
42
+ //region FUNCTION
43
+ //----------------------------------------------------------------------------------------------------
44
+ /**
45
+ * 语言选择--取消.
46
+ */
47
+ function onCancel() {
48
+ popupRef$.value?.close();
49
+ }
50
+
51
+ /**
52
+ * 语言选择--确定.
53
+ */
54
+ function onOk() {
55
+ console.log('currentLocale$', currentLocale$.value);
56
+ popupRef$.value?.close();
57
+ }
58
+
59
+ /**
60
+ * 打开弹窗.
61
+ */
62
+ function open() {
63
+ popupRef$.value?.open();
64
+ }
65
+ //----------------------------------------------------------------------------------------------------
66
+ //endregion
67
+
68
+ defineExpose({ open });
69
+ </script>
70
+
71
+ <style>
72
+ .kg-locale-selector :deep(.uni-card) {
73
+ margin: 0 2px 1px 1px !important;
74
+ box-shadow: none !important;
75
+ border-radius: 3px !important;
76
+ border-left-width: 1px !important;
77
+ padding: 0px !important;
78
+ }
79
+
80
+ .kg-locale-selector :deep(.uni-card) .uni-card__header {
81
+ }
82
+
83
+ .kg-locale-selector :deep(.uni-card) .uni-card__content {
84
+ padding: 0px !important;
85
+ }
86
+
87
+ .kg-locale-selector :deep(.uni-card) .buttons {
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: space-between;
91
+ }
92
+
93
+ .kg-locale-selector :deep(.uni-card) .buttons uni-button {
94
+ flex: 1;
95
+ }
96
+
97
+ .kg-locale-selector :deep(.uni-card) .buttons uni-button + uni-button {
98
+ margin-left: 1px;
99
+ }
100
+ </style>
@@ -0,0 +1 @@
1
+ export { default as KgLocaleSelector } from './KgLocaleSelector.vue';
@@ -17,7 +17,7 @@
17
17
  import { computed, ref } from 'vue';
18
18
  import { UniIcons, UniNavBar } from '../../uni-ui';
19
19
  import { KgUtil } from '../../util';
20
- import { KgUpdatePopup } from '../KgUpdatePopup';
20
+ import { KgUpdatePopup } from '../KgUpdateNotice';
21
21
 
22
22
  /**
23
23
  * 顶部标题栏.
@@ -18,10 +18,11 @@
18
18
  </view>
19
19
  </template>
20
20
 
21
+ <!--升级提示-->
21
22
  <script lang="ts" name="KgUpdatePopup" setup>
22
23
  import { computed, onMounted, onUnmounted, PropType, ref } from 'vue';
23
24
  import { UniPopup, UniPopupDialog } from '../../uni-ui';
24
- import { useAppStore } from '../../store/app.store';
25
+ import { useAppStore } from '../../config/app.store';
25
26
  import { KgUtil } from '../../util';
26
27
 
27
28
  /**
@@ -0,0 +1,6 @@
1
+ import { default as KgUpdateNotice } from './KgUpdateNotice.vue';
2
+
3
+ /** @deprecated 已废弃, 请使用 {@link KgUpdateNotice} */
4
+ const KgUpdatePopup = KgUpdateNotice;
5
+
6
+ export { KgUpdateNotice, KgUpdatePopup };
@@ -1,18 +1,19 @@
1
1
  <template>
2
2
  <UniPopup ref="popupRef" :type="'dialog'">
3
3
  <UniPopupDialog :before-close="true" title="选择仓库" @confirm="onOk">
4
- <UniDataCheckbox v-model="currentWhId" :localdata="warehouseDatas" />
4
+ <UniDataCheckbox v-model="currentWhId$" :localdata="warehouseDataList$" />
5
5
  </UniPopupDialog>
6
6
  </UniPopup>
7
7
  </template>
8
8
 
9
+ <!--仓库选择-->
9
10
  <script lang="ts" setup>
10
11
  import { UniDataCheckbox, UniPopup, UniPopupDialog } from '../../uni-ui';
11
12
  import { API } from '../../api';
12
13
  import { computed, ref } from 'vue';
13
14
  import { SysUserWarehouseDTO, WarehouseDTO } from '../../api/WMS/models';
14
15
  import { useKgWarehouse } from './index.hooks';
15
- import { useAppStore } from '../../store/app.store';
16
+ import { useAppStore } from '../../config/app.store';
16
17
  import { KgUtil } from '../../util';
17
18
 
18
19
  const emit = defineEmits(['ok']);
@@ -21,18 +22,30 @@
21
22
  const kgWarehouse = useKgWarehouse();
22
23
 
23
24
  const popupRef = ref<any>(null);
24
- /** 当前选择的仓库编号. */
25
- const currentWhId = ref<string>('');
26
- /** 仓库列表. */
27
- const warehouses = ref<Array<WarehouseDTO>>([]);
28
- /** 选项列表. */
29
- const warehouseDatas = ref<Array<{ text: string; value: string }>>([]);
30
- /** 用户仓库列表. */
25
+
26
+ /**
27
+ * 当前选择的仓库编号.
28
+ */
29
+ const currentWhId$ = ref<string>('');
30
+
31
+ /**
32
+ * 仓库列表.
33
+ **/
34
+ const warehouseList$ = ref<Array<WarehouseDTO>>([]);
35
+
36
+ /**
37
+ * 选项列表.
38
+ */
39
+ const warehouseDataList$ = ref<Array<{ text: string; value: string }>>([]);
40
+
41
+ /**
42
+ * 用户仓库列表.
43
+ */
31
44
  const userWarehouses = computed<Array<SysUserWarehouseDTO> | undefined>(() => appStore.getUserWarehouses);
32
45
 
33
46
  /** 确定. */
34
47
  function onOk() {
35
- kgWarehouse.store.setWarehouse(warehouses.value.find((i) => i.whId === currentWhId.value));
48
+ kgWarehouse.store.setWarehouse(warehouseList$.value.find((i) => i.whId === currentWhId$.value));
36
49
  popupRef.value?.close();
37
50
  emit('ok');
38
51
  }
@@ -47,7 +60,7 @@
47
60
  async function requestWarehouses(): Promise<void> {
48
61
  try {
49
62
  const { records } = await API.WMS.WarehouseController.ListVO({ params: { pageNo: 1, pageSize: 999 } });
50
- warehouses.value = (records ?? []).filter((i) => {
63
+ warehouseList$.value = (records ?? []).filter((i) => {
51
64
  // 管理员拥有所有仓库
52
65
  if (KgUtil.isAdminUser()) {
53
66
  return true;
@@ -56,20 +69,20 @@
56
69
  return userWarehouses.value?.find((j) => j.wh_id === i.whId);
57
70
  });
58
71
 
59
- warehouseDatas.value = warehouses.value.map((i: WarehouseDTO) => ({
72
+ warehouseDataList$.value = warehouseList$.value.map((i: WarehouseDTO) => ({
60
73
  text: `${i.whDsc ?? ' '} - ${i.whId ?? ' '}`,
61
74
  value: i.whId ?? '',
62
75
  }));
63
76
 
64
- const currentWarehouse = warehouses.value.find((i) => i.whId === kgWarehouse.warehouse.value?.whId) ?? null;
77
+ const currentWarehouse = warehouseList$.value.find((i) => i.whId === kgWarehouse.warehouse.value?.whId) ?? null;
65
78
  // 如果当前仓库不为空, 且有效(存在于当前仓库列表中), 则继续使用
66
79
  if (currentWarehouse) {
67
- currentWhId.value = currentWarehouse.whId ?? '';
80
+ currentWhId$.value = currentWarehouse.whId ?? '';
68
81
  }
69
82
  // 否则, 清空当前仓库, 并默认选中第一个仓库
70
83
  else {
71
84
  kgWarehouse.store.setWarehouse(null);
72
- currentWhId.value = warehouses.value[0]?.whId ?? '';
85
+ currentWhId$.value = warehouseList$.value[0]?.whId ?? '';
73
86
  }
74
87
  } catch (e) {
75
88
  console.error(e);
@@ -1,7 +1,7 @@
1
1
  import { computed, ComputedRef } from 'vue';
2
2
  import { IKgWarehouseStore, useKgWarehouseStore } from './index.store';
3
3
  import { WarehouseDTO } from '../../api/WMS/models';
4
- import { useAppStore } from '../../store/app.store';
4
+ import { useAppStore } from '../../config/app.store';
5
5
 
6
6
  export type IUseKgWarehouse = {
7
7
  store: IKgWarehouseStore;
@@ -35,7 +35,6 @@ export function useKgWarehouse(): IUseKgWarehouse {
35
35
  return store.getWarehouse;
36
36
  });
37
37
 
38
-
39
38
  return {
40
39
  store,
41
40
  warehouse,
@@ -0,0 +1,9 @@
1
+ import { default as KgWarehouseSelector } from './KgWarehouseSelector.vue';
2
+
3
+ /** @deprecated 已废弃, 请使用 {@link KgWarehouseSelector} */
4
+ const KgWarehouse = KgWarehouseSelector;
5
+
6
+ export { KgWarehouseSelector, KgWarehouse };
7
+
8
+ export * from './index.hooks';
9
+ export * from './index.store';
@@ -27,6 +27,7 @@
27
27
  </UniPopup>
28
28
  </template>
29
29
 
30
+ <!--工作站过工作区选择-->
30
31
  <script lang="ts" setup>
31
32
  import { UniDataSelect, UniEasyinput, UniPopup, UniPopupDialog } from '../../uni-ui';
32
33
  import { computed, nextTick, ref, watch } from 'vue';
@@ -64,9 +65,7 @@
64
65
  /**
65
66
  * 工作站下拉列表.
66
67
  */
67
- const stationDatas = computed<Array<{ text: string; value: string }>>(() =>
68
- stations.value.map((i) => ({ text: i.devcodDsc ?? i.devcod ?? '', value: i.devcod ?? '' })),
69
- );
68
+ const stationDatas = computed<Array<{ text: string; value: string }>>(() => stations.value.map((i) => ({ text: i.devcodDsc ?? i.devcod ?? '', value: i.devcod ?? '' })));
70
69
 
71
70
  /**
72
71
  * 工作区下拉列表.
@@ -1,6 +1,6 @@
1
1
  import { computed, ComputedRef } from 'vue';
2
2
  import { IKgStationStore, useKgStationStore } from './index.store';
3
- import { useKgWarehouse } from '../KgWarehouse';
3
+ import { useKgWarehouse } from '../KgWarehouseSelector';
4
4
  import { WorkstationAreaDTO, WorkstationDTO } from '../../api/WMS/models';
5
5
 
6
6
  export type IUseKgStation = {
@@ -0,0 +1,9 @@
1
+ import { default as KgWorkStationSelector } from './KgWorkStationSelector.vue';
2
+
3
+ /** @deprecated 已废弃, 请使用 {@link KgWorkStationSelector} */
4
+ const KgStation = KgWorkStationSelector;
5
+
6
+ export { KgWorkStationSelector, KgStation };
7
+
8
+ export * from './index.hooks';
9
+ export * from './index.store';
@@ -1,5 +1,6 @@
1
+ export * from './KgLocaleSelector';
1
2
  export * from './KgNavBar';
2
- export * from './KgStation';
3
3
  export * from './KgTabBar';
4
- export * from './KgUpdatePopup';
5
- export * from './KgWarehouse';
4
+ export * from './KgUpdateNotice';
5
+ export * from './KgWarehouseSelector';
6
+ export * from './KgWorkStationSelector';
@@ -25,6 +25,7 @@ interface IAppState {
25
25
  userWarehouses: Array<SysUserWarehouseDTO> | undefined;
26
26
  }
27
27
 
28
+ // TODO LT 移到 config.store.ts 中去
28
29
  export const useAppStore = defineStore('app', {
29
30
  actions: {
30
31
  /**
package/config/index.ts CHANGED
@@ -14,5 +14,7 @@ const setup = kgConfig;
14
14
  //----------------------------------------------------------------------------------------------------
15
15
  //endregion
16
16
 
17
- export * from './config.hooks';
18
17
  export { kgConfig, setup };
18
+
19
+ export * from './config.hooks';
20
+ export * from './config.store';
package/index.ts CHANGED
@@ -3,6 +3,5 @@ export * from './component';
3
3
  export * from './config';
4
4
  export * from './model';
5
5
  export * from './service';
6
- export * from './store/app.store';
7
6
  export * from './uni-ui';
8
7
  export * from './util';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.7.14-beta.2",
3
+ "version": "0.7.14-beta.4",
4
4
  "scripts": {
5
5
  "postinstall": "node bin/postinstall.mjs"
6
6
  },
package/page/KgPageMy.vue CHANGED
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view class="my">
3
3
  <UniList class="uni-list--setting">
4
- <UniListItem link title="语言" :right-text="localeRightText$$" @click="$LocalePopup$open" />
4
+ <UniListItem link title="语言" :right-text="localeRightText$$" @click="openKgLocaleSelector" />
5
5
  <UniListItem link title="仓库" :right-text="warehouseRightText$$" @click="openKgWarehouse" />
6
6
  <UniListItem link title="工作站 - 工作区" :right-text="stationRightText$$" @click="openKgStation" />
7
7
  <UniListItem link title="后端服务地址" :right-text="apiUrl" />
@@ -15,35 +15,21 @@
15
15
  </UniList>
16
16
  </view>
17
17
 
18
- <UniPopup ref="localePopupRef$" :type="'bottom'" class="my--uni-popup--locale">
19
- <UniCard :isFull="true" :title="'语言'">
20
- <view>
21
- <view class="body">
22
- <view v-for="item in KG.LOCALE_DATA_LIST" :key="item.code" class="item">{{ item.text }}</view>
23
- </view>
24
- <view class="buttons">
25
- <button class="btn btn-cancel" @tap.stop="$LocalePopup$cancel()">取消</button>
26
- <button :type="'primary' as any" class="btn btn-ok" @tap.stop="$LocalePopup$ok">确认</button>
27
- </view>
28
- </view>
29
- </UniCard>
30
- </UniPopup>
31
-
32
- <KgWarehouse ref="kgWarehouseRef$"></KgWarehouse>
33
- <KgStation ref="kgStationRef$"></KgStation>
18
+ <KgLocaleSelector ref="kgLocaleSelectorRef$" />
19
+ <KgWarehouseSelector ref="kgWarehouseRef$" />
20
+ <KgWorkStationSelector ref="kgStationRef$" />
34
21
  <!--#ifdef APP-PLUS-->
35
- <KgUpdatePopup />
22
+ <KgUpdateNotice />
36
23
  <!--#endif-->
37
24
  <KgTabBar />
38
25
  </template>
39
26
 
40
27
  <script setup lang="ts">
41
28
  import { computed, ref } from 'vue';
42
- import { useAppStore } from '../store/app.store';
43
- import { KgStation, KgTabBar, KgUpdatePopup, KgWarehouse, useKgStation, useKgWarehouse } from '../component';
44
- import { UniCard, UniList, UniListItem, UniPopup } from '../uni-ui';
29
+ import { useAppStore } from '../config/app.store';
30
+ import { KgTabBar, KgUpdateNotice, KgWarehouseSelector, KgWorkStationSelector, useKgStation, useKgWarehouse } from '../component';
31
+ import { UniList, UniListItem } from '../uni-ui';
45
32
  import { KgUtil } from '../util';
46
- import { KG } from '../model';
47
33
 
48
34
  const appStore = useAppStore();
49
35
  const kgWarehouse = useKgWarehouse();
@@ -53,7 +39,7 @@
53
39
  // ----------------------------------------------------------------------------------------------------
54
40
  const kgWarehouseRef$ = ref<any>(null);
55
41
  const kgStationRef$ = ref<any>(null);
56
- const localePopupRef$ = ref<any>(null);
42
+ const kgLocaleSelectorRef$ = ref<any>(null);
57
43
 
58
44
  /**
59
45
  * 语言的右侧文本.
@@ -98,35 +84,21 @@
98
84
  }
99
85
 
100
86
  /**
101
- * 语言选择弹窗--打开.
87
+ * 打开「语言选择」.
102
88
  */
103
- function $LocalePopup$open() {
104
- localePopupRef$.value?.open();
89
+ function openKgLocaleSelector() {
90
+ kgLocaleSelectorRef$.value?.open();
105
91
  }
106
92
 
107
93
  /**
108
- * 语言选择弹窗--取消.
109
- */
110
- function $LocalePopup$cancel() {
111
- localePopupRef$.value?.close();
112
- }
113
-
114
- /**
115
- * 语言选择弹窗--确定.
116
- */
117
- function $LocalePopup$ok() {
118
- localePopupRef$.value?.close();
119
- }
120
-
121
- /**
122
- * 打开仓库选择弹窗.
94
+ * 打开「仓库选择」.
123
95
  */
124
96
  function openKgWarehouse() {
125
97
  kgWarehouseRef$.value?.open();
126
98
  }
127
99
 
128
100
  /**
129
- * 打开工作站选择弹窗.
101
+ * 打开「工作站工作区选择」.
130
102
  */
131
103
  function openKgStation() {
132
104
  kgStationRef$.value?.open();
@@ -176,33 +148,4 @@
176
148
  .my :deep .uni-list-item__content-title {
177
149
  font-size: 13px;
178
150
  }
179
-
180
- .my--uni-popup--locale :deep(.uni-card) {
181
- margin: 0 2px 1px 1px !important;
182
- box-shadow: none !important;
183
- border-radius: 3px !important;
184
- border-left-width: 1px !important;
185
- padding: 0px !important;
186
- }
187
-
188
- .my--uni-popup--locale :deep(.uni-card) .uni-card__header {
189
- }
190
-
191
- .my--uni-popup--locale :deep(.uni-card) .uni-card__content {
192
- padding: 0px !important;
193
- }
194
-
195
- .my--uni-popup--locale :deep(.uni-card) .buttons {
196
- display: flex;
197
- align-items: center;
198
- justify-content: space-between;
199
- }
200
-
201
- .my--uni-popup--locale :deep(.uni-card) .buttons uni-button {
202
- flex: 1;
203
- }
204
-
205
- .my--uni-popup--locale :deep(.uni-card) .buttons uni-button + uni-button {
206
- margin-left: 1px;
207
- }
208
151
  </style>
@@ -1,7 +1,7 @@
1
- import { useAppStore } from '../store/app.store';
1
+ import { useAppStore } from '../config/app.store';
2
2
  import { KgUtil } from '../util';
3
- import { useKgWarehouse } from '../component/KgWarehouse/index.hooks';
4
- import { useKgStation } from '../component/KgStation';
3
+ import { useKgWarehouse } from '../component/KgWarehouseSelector/index.hooks';
4
+ import { useKgStation } from '../component/KgWorkStationSelector';
5
5
  import { isNil } from 'lodash-es';
6
6
  import dayjs from 'dayjs';
7
7
  import { KG } from '../model';
@@ -305,8 +305,6 @@ const _httpClient: IHttpClient = {
305
305
  break;
306
306
 
307
307
  case 401:
308
- // store.dispatch('logout');
309
-
310
308
  reject(response);
311
309
  break;
312
310
 
package/util/kg.util.ts CHANGED
@@ -2,7 +2,7 @@ import { cloneDeep, isArray, isNil, isObjectLike, reduce } from 'lodash-es';
2
2
  import { toRaw, unref } from 'vue';
3
3
  import { API } from '../api';
4
4
  import { useKgStation, useKgWarehouse } from '../component';
5
- import { useAppStore } from '../store/app.store';
5
+ import { useAppStore } from '../config/app.store';
6
6
  import dayjs, { Dayjs } from 'dayjs';
7
7
  import { KG } from '../model';
8
8
 
@@ -1,4 +0,0 @@
1
- export { default as KgStation } from './KgStation.vue';
2
-
3
- export * from './index.hooks';
4
- export * from './index.store';
@@ -1 +0,0 @@
1
- export { default as KgUpdatePopup } from './KgUpdatePopup.vue';
@@ -1,4 +0,0 @@
1
- export { default as KgWarehouse } from './KgWarehouse.vue';
2
-
3
- export * from './index.hooks';
4
- export * from './index.store';