@kengic/uni 0.7.14-beta.8 → 0.7.14

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 (31) hide show
  1. package/component/KgApiUil/KgApiUil.vue +146 -0
  2. package/component/KgApiUil/index.ts +1 -0
  3. package/component/{KgLocaleSelector/KgLocaleSelector.vue → KgLocale/KgLocale.vue} +36 -15
  4. package/component/KgLocale/index.ts +1 -0
  5. package/component/KgNavBar/KgNavBar.vue +6 -3
  6. package/component/KgTabBar/KgTabBar.vue +29 -15
  7. package/component/{KgUpdateNotice/KgUpdateNotice.vue → KgUpdate/KgUpdate.vue} +2 -2
  8. package/component/KgUpdate/index.ts +6 -0
  9. package/component/{KgWarehouseSelector/KgWarehouseSelector.vue → KgWarehouse/KgWarehouse.vue} +12 -2
  10. package/component/KgWarehouse/index.ts +6 -0
  11. package/component/{KgWorkStationSelector/KgWorkStationSelector.vue → KgWorkStation/KgWorkStation.vue} +11 -9
  12. package/component/{KgWorkStationSelector → KgWorkStation}/index.hooks.ts +1 -1
  13. package/component/KgWorkStation/index.ts +9 -0
  14. package/component/index.ts +5 -4
  15. package/config/app.store.ts +1 -1
  16. package/config/config.store.ts +115 -42
  17. package/config/index.ts +30 -12
  18. package/index.css +58 -9
  19. package/package.json +2 -2
  20. package/page/KgPageIndex.vue +28 -0
  21. package/page/KgPageMy.vue +29 -19
  22. package/service/http-client.ts +14 -12
  23. package/uni-ui/uni-popup/i18n/en.json +2 -2
  24. package/util/kg.util.ts +4 -2
  25. package/component/KgLocaleSelector/index.ts +0 -1
  26. package/component/KgUpdateNotice/index.ts +0 -6
  27. package/component/KgWarehouseSelector/index.ts +0 -9
  28. package/component/KgWorkStationSelector/index.ts +0 -9
  29. /package/component/{KgWarehouseSelector → KgWarehouse}/index.hooks.ts +0 -0
  30. /package/component/{KgWarehouseSelector → KgWarehouse}/index.store.ts +0 -0
  31. /package/component/{KgWorkStationSelector → KgWorkStation}/index.store.ts +0 -0
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <UniPopup ref="popupRef$" :isMaskClick="false" class="kg-api-url" type="bottom">
3
+ <UniCard :isFull="true" class="popupCard" :title="kg.t('pda.KgApiUil.Title', {}, '配置后端服务地址')">
4
+ <view>
5
+ <view class="body">
6
+ <UniEasyinput v-model="apiUrl$" :clearSize="24" :disabled="isRequestDoing$" :focus="true" placeholder="http://127.0.0.1:8080/" trim></UniEasyinput>
7
+ </view>
8
+ <view class="buttons">
9
+ <button :disabled="isRequestDoing$" :type="'default' as any" class="btn btn-cancel" @tap.stop="onCancel()">{{ kg.t('kg.cancel02', {}, '取消') }}</button>
10
+ <button :disabled="isRequestDoing$" :type="'primary' as any" class="btn btn-ok" @tap.stop="onOk">{{ kg.t('kg.ok', {}, '确认') }}{{ isRequestDoing$ ? ' ...' : '' }}</button>
11
+ </view>
12
+ </view>
13
+ </UniCard>
14
+ </UniPopup>
15
+ </template>
16
+
17
+ <!--配置后端服务地址-->
18
+ <script lang="ts" name="KgApiUil" setup>
19
+ import { UniCard, UniEasyinput, UniPopup } from '../../uni-ui';
20
+ import { ref } from 'vue';
21
+ import { useAppStore, useKg } from '../../config';
22
+ import { KG } from '../../model';
23
+
24
+ const kg = useKg();
25
+ const appStore = useAppStore();
26
+
27
+ //region DATA
28
+ //----------------------------------------------------------------------------------------------------
29
+ const apiUrl$ = ref<string>('');
30
+ const popupRef$ = ref<any>(null);
31
+ const isRequestDoing$ = ref<boolean>(false);
32
+ //----------------------------------------------------------------------------------------------------
33
+ //endregion
34
+
35
+ //region FUNCTION
36
+ //----------------------------------------------------------------------------------------------------
37
+ function open() {
38
+ let storeApiUrl = uni.getStorageSync(KG.STORAGE_KEY__API_URL);
39
+ if (storeApiUrl != '' || storeApiUrl != null) {
40
+ apiUrl$.value = storeApiUrl;
41
+ }
42
+
43
+ popupRef$.value?.open();
44
+ }
45
+
46
+ function onCancel() {
47
+ popupRef$.value?.close();
48
+ }
49
+
50
+ async function onOk() {
51
+ isRequestDoing$.value = true;
52
+
53
+ try {
54
+ appStore.setApiUrl(apiUrl$.value!);
55
+
56
+ await kg.requestVarConfigDescriptionList();
57
+
58
+ uni.showToast({ icon: 'none', title: kg.t('pda.KgApiUil.SuccessMessage', {}, '配置成功') });
59
+
60
+ uni.showModal({
61
+ title: kg.t('kg.tip02', {}, '提示'),
62
+ content: kg.t('pda.KgApiUil.RelaunchContent', {}, '翻译加载成功, 需要重启应用.'),
63
+ confirmText: kg.t('pda.KgApiUil.RelaunchOkText', {}, '立即重启'),
64
+ showCancel: false,
65
+ success: function (result) {
66
+ if (result.confirm) {
67
+ kg.setLocale(kg.locale);
68
+
69
+ /* #ifdef H5 */
70
+ window.location.reload();
71
+ /* #endif */
72
+
73
+ /* #ifdef APP-PLUS */
74
+ popupRef$.value?.close();
75
+ /* #endif */
76
+ }
77
+ },
78
+ });
79
+ } finally {
80
+ isRequestDoing$.value = false;
81
+ }
82
+ }
83
+ //----------------------------------------------------------------------------------------------------
84
+ //endregion
85
+
86
+ defineExpose({ open });
87
+ </script>
88
+
89
+ <style>
90
+ .kg-api-url :deep .uni-card {
91
+ margin: 0 2px 1px 1px !important;
92
+ box-shadow: none !important;
93
+ border-radius: 3px !important;
94
+ border-left-width: 1px !important;
95
+ padding: 0px !important;
96
+ }
97
+
98
+ .kg-api-url :deep .uni-card .uni-card__header {
99
+ }
100
+
101
+ .kg-api-url :deep .uni-card .uni-card__content {
102
+ padding: 0px !important;
103
+ }
104
+
105
+ .kg-api-url :deep .uni-card .uni-card__content .body {
106
+ padding: 1px;
107
+ }
108
+
109
+ .kg-api-url :deep .uni-card .uni-card__content .body .uni-easyinput .uniui-clear {
110
+ width: 32px;
111
+ height: 32px;
112
+ padding: 0;
113
+ margin: 0;
114
+ background: #dcdfe6;
115
+ border-radius: 0 2px 2px 0;
116
+ }
117
+
118
+ .kg-api-url :deep .uni-card .uni-card__content .body .uni-easyinput .uniui-clear:before {
119
+ color: #fff;
120
+ content: '\e66c' !important;
121
+ font-size: 12px !important;
122
+ }
123
+
124
+ .kg-api-url :deep .uni-card .uni-card__content .body .uni-easyinput .uni-easyinput__content {
125
+ line-height: 32px !important;
126
+ }
127
+
128
+ .kg-api-url :deep .uni-card .uni-card__content .body .uni-easyinput .uni-easyinput__content .uni-easyinput__content-input {
129
+ height: 32px !important;
130
+ }
131
+
132
+ .kg-api-url :deep .uni-card .uni-card__content .buttons {
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: space-between;
136
+ padding: 0px 1px 1px 1px;
137
+ }
138
+
139
+ .kg-api-url :deep .uni-card .uni-card__content .buttons uni-button {
140
+ flex: 1;
141
+ }
142
+
143
+ .kg-api-url :deep .uni-card .uni-card__content .buttons uni-button + uni-button {
144
+ margin-left: 1px;
145
+ }
146
+ </style>
@@ -0,0 +1 @@
1
+ export { default as KgApiUil } from './KgApiUil.vue';
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <UniPopup ref="popupRef$" :type="'bottom'" class="kg-locale-selector">
3
- <UniCard :isFull="true" :title="'选择语言'">
2
+ <UniPopup ref="popupRef$" :type="'bottom'" class="kg-locale">
3
+ <UniCard :isFull="true" :title="kg.t('pda.KgLocale.Language', {}, '选择语言')">
4
4
  <view>
5
5
  <view class="body">
6
6
  <UniDataCheckbox v-model="currentLocale$" :localdata="localeDataList$$" />
7
7
  </view>
8
8
  <view class="buttons">
9
- <button class="btn btn-cancel" @tap.stop="onCancel()">取消</button>
10
- <button :type="'primary' as any" class="btn btn-ok" @tap.stop="onOk">确认</button>
9
+ <button class="btn btn-cancel" @tap.stop="onCancel()">{{ kg.t('kg.cancel02', {}, '取消') }}</button>
10
+ <button :type="'primary' as any" class="btn btn-ok" @tap.stop="onOk">{{ kg.t('kg.ok', {}, '确认') }}</button>
11
11
  </view>
12
12
  </view>
13
13
  </UniCard>
@@ -54,8 +54,29 @@
54
54
  * 确定.
55
55
  */
56
56
  function onOk() {
57
- kg.setLocale(currentLocale$.value);
58
- popupRef$.value?.close();
57
+ if (kg.locale === currentLocale$.value) {
58
+ popupRef$.value?.close();
59
+ } else {
60
+ uni.showModal({
61
+ title: kg.t('kg.tip02', {}, '提示'),
62
+ content: kg.t('pda.KgLocale.RelaunchContent', {}, '语言切换成功, 需要重启应用.'),
63
+ confirmText: kg.t('pda.KgLocale.RelaunchOkText', {}, '立即重启'),
64
+ showCancel: false,
65
+ success: function (result) {
66
+ if (result.confirm) {
67
+ kg.setLocale(currentLocale$.value);
68
+
69
+ /* #ifdef H5 */
70
+ window.location.reload();
71
+ /* #endif */
72
+
73
+ /* #ifdef APP-PLUS */
74
+ popupRef$.value?.close();
75
+ /* #endif */
76
+ }
77
+ },
78
+ });
79
+ }
59
80
  }
60
81
 
61
82
  /**
@@ -73,7 +94,7 @@
73
94
  </script>
74
95
 
75
96
  <style>
76
- .kg-locale-selector :deep(.uni-card) {
97
+ .kg-locale :deep(.uni-card) {
77
98
  margin: 0 2px 1px 1px !important;
78
99
  box-shadow: none !important;
79
100
  border-radius: 3px !important;
@@ -81,38 +102,38 @@
81
102
  padding: 0px !important;
82
103
  }
83
104
 
84
- .kg-locale-selector :deep(.uni-card) .uni-card__header {
105
+ .kg-locale :deep(.uni-card) .uni-card__header {
85
106
  }
86
107
 
87
- .kg-locale-selector :deep(.uni-card) .uni-card__content {
108
+ .kg-locale :deep(.uni-card) .uni-card__content {
88
109
  padding: 0px !important;
89
110
  }
90
111
 
91
- .kg-locale-selector :deep(.uni-card) .body {
112
+ .kg-locale :deep(.uni-card) .body {
92
113
  border-bottom: 1px solid #eeeeee;
93
114
  margin-bottom: 1px;
94
115
  }
95
116
 
96
- .kg-locale-selector :deep(.uni-card) .body .uni-data-checklist .checklist-group {
117
+ .kg-locale :deep(.uni-card) .body .uni-data-checklist .checklist-group {
97
118
  flex-direction: column;
98
119
  }
99
120
 
100
- .kg-locale-selector :deep(.uni-card) .body .uni-data-checklist .checklist-group .checklist-box {
121
+ .kg-locale :deep(.uni-card) .body .uni-data-checklist .checklist-group .checklist-box {
101
122
  margin: 0;
102
123
  padding: 12px;
103
124
  }
104
125
 
105
- .kg-locale-selector :deep(.uni-card) .buttons {
126
+ .kg-locale :deep(.uni-card) .buttons {
106
127
  display: flex;
107
128
  align-items: center;
108
129
  justify-content: space-between;
109
130
  }
110
131
 
111
- .kg-locale-selector :deep(.uni-card) .buttons uni-button {
132
+ .kg-locale :deep(.uni-card) .buttons uni-button {
112
133
  flex: 1;
113
134
  }
114
135
 
115
- .kg-locale-selector :deep(.uni-card) .buttons uni-button + uni-button {
136
+ .kg-locale :deep(.uni-card) .buttons uni-button + uni-button {
116
137
  margin-left: 1px;
117
138
  }
118
139
  </style>
@@ -0,0 +1 @@
1
+ export { default as KgLocale } from './KgLocale.vue';
@@ -9,7 +9,7 @@
9
9
  </UniNavBar>
10
10
 
11
11
  <!--#ifdef APP-PLUS-->
12
- <KgUpdateNotice v-if="isCustomNavigationBar" />
12
+ <KgUpdate v-if="isCustomNavigationBar" />
13
13
  <!--#endif-->
14
14
  </template>
15
15
 
@@ -18,7 +18,10 @@
18
18
  import { computed, ref } from 'vue';
19
19
  import { UniIcons, UniNavBar } from '../../uni-ui';
20
20
  import { KgUtil } from '../../util';
21
- import { KgUpdateNotice } from '../KgUpdateNotice';
21
+ import { KgUpdate } from '../KgUpdate';
22
+ import { useKg } from '../../config';
23
+
24
+ const kg = useKg();
22
25
 
23
26
  //region DATA
24
27
  // ----------------------------------------------------------------------------------------------------
@@ -33,7 +36,7 @@
33
36
  * 回到首页.
34
37
  */
35
38
  function gotoHomePage() {
36
- uni.redirectTo({ url: '/pages/home/index' });
39
+ uni.redirectTo({ url: `/${kg.homePagePath}` });
37
40
  }
38
41
 
39
42
  //endregion
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <view :id="ID" ref="ref01" class="kg-tab-bar">
3
- <view :class="{ active: page?.route === 'pages/home/index' }" class="item" @tap.stop="goto('pages/home/index')">
2
+ <view :id='ID' ref='ref01' class='kg-tab-bar'>
3
+ <view :class="{ active: page?.route === kg.homePagePath }" class="item" @tap.stop="goto(kg.homePagePath)">
4
4
  <UniIcons :type="'home'" size="24"></UniIcons>
5
- <text class="text">首页</text>
5
+ <text class="text">{{ kg.t('pda.KgTabBar.Home', {}, '首页') }}</text>
6
6
  </view>
7
7
 
8
8
  <view :class="{ active: page?.route === 'pages/my/My' }" class="item" @tap.stop="goto('pages/my/My')">
9
9
  <UniIcons :type="'person'" size="24"></UniIcons>
10
- <text class="text">我的</text>
10
+ <text class="text">{{ kg.t('pda.KgTabBar.My', {}, '我的') }}</text>
11
11
  </view>
12
12
  </view>
13
13
  </template>
@@ -18,23 +18,22 @@
18
18
  import { UniIcons } from '../../uni-ui';
19
19
  import { KgUtil } from '../../util';
20
20
  import { v4 as uuid } from 'uuid';
21
+ import { useKg } from '../../config';
21
22
 
23
+ const kg = useKg();
24
+
25
+ //region DATA
26
+ //----------------------------------------------------------------------------------------------------
22
27
  const ID = `KgTabBar${uuid().replace(/-/g, '')}`;
23
28
 
24
29
  const ref01 = ref<any>(null);
25
30
 
26
- onMounted(() => {
27
- /* #ifdef H5 */
28
- ref01.value?.$el?.previousElementSibling?.classList?.add('kg-tab-bar--sibling');
29
- /* #endif */
30
-
31
- /* #ifdef APP-PLUS */
32
- KgUtil.eval(`document.querySelector('#${ID}').previousElementSibling.classList.add('kg-tab-bar--sibling');`);
33
- /* #endif */
34
- });
35
-
36
31
  const page = KgUtil.getCurrentPage();
32
+ //----------------------------------------------------------------------------------------------------
33
+ //endregion
37
34
 
35
+ //region FUNCTION
36
+ //----------------------------------------------------------------------------------------------------
38
37
  function goto(path: string) {
39
38
  if (path != 'pages/my/My') {
40
39
  uni.redirectTo({ url: '/' + path });
@@ -42,6 +41,22 @@
42
41
  uni.navigateTo({ url: '/' + path });
43
42
  }
44
43
  }
44
+ //----------------------------------------------------------------------------------------------------
45
+ //endregion
46
+
47
+ //region LIFECYCLE
48
+ //----------------------------------------------------------------------------------------------------
49
+ onMounted(() => {
50
+ /* #ifdef H5 */
51
+ ref01.value?.$el?.previousElementSibling?.classList?.add('kg-tab-bar--sibling');
52
+ /* #endif */
53
+
54
+ /* #ifdef APP-PLUS */
55
+ KgUtil.eval(`document.querySelector('#${ID}').previousElementSibling.classList.add('kg-tab-bar--sibling');`);
56
+ /* #endif */
57
+ });
58
+ //----------------------------------------------------------------------------------------------------
59
+ //endregion
45
60
  </script>
46
61
 
47
62
  <style>
@@ -79,5 +94,4 @@
79
94
  font-size: 12px;
80
95
  line-height: 1;
81
96
  }
82
-
83
97
  </style>
@@ -19,7 +19,7 @@
19
19
  </template>
20
20
 
21
21
  <!--升级提示-->
22
- <script lang="ts" name="KgUpdateNotice" setup>
22
+ <script lang="ts" name="KgUpdate" setup>
23
23
  import { computed, onMounted, onUnmounted, PropType, ref } from 'vue';
24
24
  import { UniPopup, UniPopupDialog } from '../../uni-ui';
25
25
  import { useAppStore } from '../../config';
@@ -140,7 +140,7 @@
140
140
 
141
141
  unsubscribe.value = appStore.$onAction(async ({ name, args }) => {
142
142
  switch (name) {
143
- case 'openKgUpdateNotice':
143
+ case 'openKgUpdate':
144
144
  version.value = args[0];
145
145
  popupRef$.value?.open();
146
146
  break;
@@ -0,0 +1,6 @@
1
+ import { default as KgUpdate } from './KgUpdate.vue';
2
+
3
+ /** @deprecated 已废弃, 请使用 {@link KgUpdate} */
4
+ const KgUpdatePopup = KgUpdate;
5
+
6
+ export { KgUpdate, KgUpdatePopup };
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <UniPopup ref="popupRef$" :type="'dialog'">
3
- <UniPopupDialog :before-close="true" title="选择仓库" @confirm="onOk">
3
+ <UniPopupDialog :before-close="true" :title="kg.t('pda.KgWarehouse.Title', {}, '选择仓库')" :type="'info'" @confirm="onOk">
4
4
  <UniDataCheckbox v-model="currentWhId$" :localdata="warehouseDataList$" />
5
5
  </UniPopupDialog>
6
6
  </UniPopup>
@@ -15,12 +15,16 @@
15
15
  import { useKgWarehouse } from './index.hooks';
16
16
  import { useAppStore } from '../../config/app.store';
17
17
  import { KgUtil } from '../../util';
18
+ import { useKg } from '../../config';
18
19
 
19
20
  const emit = defineEmits(['ok']);
20
21
 
21
- const appStore = useAppStore();
22
+ const kg = useKg();
22
23
  const kgWarehouse = useKgWarehouse();
24
+ const appStore = useAppStore();
23
25
 
26
+ //region DATA
27
+ //----------------------------------------------------------------------------------------------------
24
28
  const popupRef$ = ref<any>(null);
25
29
 
26
30
  /**
@@ -42,7 +46,11 @@
42
46
  * 用户仓库列表.
43
47
  */
44
48
  const userWarehouses = computed<Array<SysUserWarehouseDTO> | undefined>(() => appStore.getUserWarehouses);
49
+ //----------------------------------------------------------------------------------------------------
50
+ //endregion
45
51
 
52
+ //region FUNCTION
53
+ //----------------------------------------------------------------------------------------------------
46
54
  /** 确定. */
47
55
  function onOk() {
48
56
  kgWarehouse.store.setWarehouse(warehouseList$.value.find((i) => i.whId === currentWhId$.value));
@@ -88,6 +96,8 @@
88
96
  console.error(e);
89
97
  }
90
98
  }
99
+ //----------------------------------------------------------------------------------------------------
100
+ //endregion
91
101
 
92
102
  defineExpose({ open });
93
103
  </script>
@@ -0,0 +1,6 @@
1
+ import { default as KgWarehouse } from './KgWarehouse.vue';
2
+
3
+ export { KgWarehouse };
4
+
5
+ export * from './index.hooks';
6
+ export * from './index.store';
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <UniPopup ref="popupRef$" :type="'dialog'">
3
- <UniPopupDialog :before-close="true" title="选择工作站" @close="onClose" @confirm="onOk">
3
+ <UniPopupDialog :before-close="true" :type="'info'" :title="kg.t('pda.KgWorkStation.Title', {}, '选择工作站')" @close="onClose" @confirm="onOk">
4
4
  <div class="row">
5
- <div class="label">工作站:</div>
5
+ <div class="label">{{ kg.t('pda.KgWorkStation.WorkStation', {}, '工作站') }}:</div>
6
6
  <div class="value devcod">
7
7
  <UniEasyinput
8
8
  v-model="devcodInputValue"
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
  </div>
20
20
  <div class="row">
21
- <div class="label">工作区:</div>
21
+ <div class="label">{{ kg.t('pda.KgWorkStation.WorkArea', {}, '工作区') }}:</div>
22
22
  <div class="value">
23
23
  <UniDataSelect :localdata="areaDatas" v-model="currentHmewrkare" :clear="true" />
24
24
  </div>
@@ -27,17 +27,19 @@
27
27
  </UniPopup>
28
28
  </template>
29
29
 
30
- <!--工作站过工作区选择-->
30
+ <!--工作站工作区选择-->
31
31
  <script lang="ts" setup>
32
32
  import { UniDataSelect, UniEasyinput, UniPopup, UniPopupDialog } from '../../uni-ui';
33
33
  import { computed, nextTick, ref, watch } from 'vue';
34
34
  import { useKgStation } from './index.hooks';
35
35
  import { WorkstationDTO } from '../../api/WMS/models';
36
36
  import { API } from '../../api';
37
+ import { useKg } from '../../config';
37
38
 
38
39
  const emit = defineEmits(['ok']);
39
40
 
40
- const kgStation = useKgStation();
41
+ const kg = useKg();
42
+ const kgWorkStation = useKgStation();
41
43
 
42
44
  //region DATA
43
45
  // ----------------------------------------------------------------------------------------------------
@@ -177,9 +179,9 @@
177
179
  const currentStation = stations.value.find((i) => i.devcod === currentDevcod.value);
178
180
  if (currentStation) {
179
181
  currentStation.hmewrkare = currentHmewrkare.value;
180
- kgStation.store.setStation(currentStation);
182
+ kgWorkStation.store.setStation(currentStation);
181
183
  } else {
182
- kgStation.store.setStation(null);
184
+ kgWorkStation.store.setStation(null);
183
185
  }
184
186
 
185
187
  popupRef$.value?.close();
@@ -190,8 +192,8 @@
190
192
  function open() {
191
193
  popupRef$.value?.open();
192
194
 
193
- currentDevcod.value = kgStation.station.value?.devcod ?? '';
194
- currentHmewrkare.value = kgStation.station.value?.hmewrkare ?? '';
195
+ currentDevcod.value = kgWorkStation.station.value?.devcod ?? '';
196
+ currentHmewrkare.value = kgWorkStation.station.value?.hmewrkare ?? '';
195
197
 
196
198
  requestStations();
197
199
  }
@@ -1,6 +1,6 @@
1
1
  import { computed, ComputedRef } from 'vue';
2
2
  import { IKgStationStore, useKgStationStore } from './index.store';
3
- import { useKgWarehouse } from '../KgWarehouseSelector';
3
+ import { useKgWarehouse } from '../KgWarehouse';
4
4
  import { WorkstationAreaDTO, WorkstationDTO } from '../../api/WMS/models';
5
5
 
6
6
  export type IUseKgStation = {
@@ -0,0 +1,9 @@
1
+ import { default as KgWorkStation } from './KgWorkStation.vue';
2
+
3
+ /** @deprecated 已废弃, 请使用 {@link KgWorkStation} */
4
+ const KgStation = KgWorkStation;
5
+
6
+ export { KgWorkStation, KgStation };
7
+
8
+ export * from './index.hooks';
9
+ export * from './index.store';
@@ -1,6 +1,7 @@
1
- export * from './KgLocaleSelector';
1
+ export * from './KgApiUil';
2
+ export * from './KgLocale';
2
3
  export * from './KgNavBar';
3
4
  export * from './KgTabBar';
4
- export * from './KgUpdateNotice';
5
- export * from './KgWarehouseSelector';
6
- export * from './KgWorkStationSelector';
5
+ export * from './KgUpdate';
6
+ export * from './KgWarehouse';
7
+ export * from './KgWorkStation';
@@ -55,7 +55,7 @@ export const useAppStore = defineStore('app', {
55
55
  * 打开更新弹窗.
56
56
  * @param version 最新版本.
57
57
  */
58
- openKgUpdateNotice(version: string) {},
58
+ openKgUpdate(version: string) {},
59
59
 
60
60
  /**
61
61
  * 查询用户仓库.
@@ -4,10 +4,11 @@ import { computed, ref } from 'vue';
4
4
  import { API } from '../api';
5
5
  import { DescriptionDTO, VarConfigDescription } from '../api/WMS/models';
6
6
  import { KG, KgStoreDefinition } from '../model';
7
+ import { useKg } from './config.hooks';
7
8
 
8
9
  //region GETTERS 类型定义
9
10
  //----------------------------------------------------------------------------------------------------
10
- export interface IUseKgStoreGetters {
11
+ interface IUseKgStoreGetters {
11
12
  /**
12
13
  * 默认语言.
13
14
  */
@@ -18,6 +19,16 @@ export interface IUseKgStoreGetters {
18
19
  */
19
20
  getDescription: (param: { codeName: string | null | undefined; codeValue: string | null | undefined }) => DescriptionDTO | null;
20
21
 
22
+ /**
23
+ * 首页路径. 默认为 'pages/home/index'.
24
+ */
25
+ homePagePath: string;
26
+
27
+ /**
28
+ * 是否正在请求翻译数据.
29
+ */
30
+ isRequestVarConfigDescriptionListDoing: boolean;
31
+
21
32
  /**
22
33
  * 当前语言.
23
34
  */
@@ -27,6 +38,11 @@ export interface IUseKgStoreGetters {
27
38
  * 当前语言名称.
28
39
  */
29
40
  localeText: string;
41
+
42
+ /**
43
+ * 登录页面路径. 默认为 'pages/login/Login'.
44
+ */
45
+ loginPagePath: string;
30
46
  }
31
47
 
32
48
  //----------------------------------------------------------------------------------------------------
@@ -34,13 +50,11 @@ export interface IUseKgStoreGetters {
34
50
 
35
51
  //region ACTIONS 类型定义
36
52
  //----------------------------------------------------------------------------------------------------
37
- export interface IUseKgStoreActions {
53
+ interface IUseKgStoreActions {
38
54
  /**
39
- * 请求某组变量描述数据.
40
- *
41
- * @param param.fid 界面标识.
55
+ * 请求翻译数据.
42
56
  */
43
- requestVarConfigDescriptionList(param: { fid: string | null | undefined }): Promise<void>;
57
+ requestVarConfigDescriptionList(): Promise<void>;
44
58
 
45
59
  /**
46
60
  * 设置默认语言.
@@ -53,9 +67,16 @@ export interface IUseKgStoreActions {
53
67
  * 设置某组描述的数据.
54
68
  *
55
69
  * @param param.codeName 描述组名.
56
- * @param param.descriptions 描述数据.
70
+ * @param param.descriptionList 描述数据列表.
71
+ */
72
+ setDescriptionList(param: { codeName: string | null | undefined; descriptionList: Array<DescriptionDTO> }): void;
73
+
74
+ /**
75
+ * 设置首页路径.
76
+ *
77
+ * @param value 首页路径.
57
78
  */
58
- setDescriptionList(param: { codeName: string | null | undefined; descriptions: Array<DescriptionDTO> }): void;
79
+ setHomePagePath(value?: string | null): void;
59
80
 
60
81
  /**
61
82
  * 设置当前语言.
@@ -64,6 +85,13 @@ export interface IUseKgStoreActions {
64
85
  */
65
86
  setLocale(value?: string | null): void;
66
87
 
88
+ /**
89
+ * 设置登录页面路径.
90
+ *
91
+ * @param value 登录页面路径.
92
+ */
93
+ setLoginPagePath(value?: string | null): void;
94
+
67
95
  /**
68
96
  * 翻译.
69
97
  *
@@ -78,7 +106,7 @@ export interface IUseKgStoreActions {
78
106
  //endregion
79
107
 
80
108
  // @ts-ignore
81
- export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreActions> = defineStore('Kg', () => {
109
+ const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreActions> = defineStore('Kg', () => {
82
110
  //region DATA
83
111
  //----------------------------------------------------------------------------------------------------
84
112
  //----------------------------------------------------------------------------------------------------
@@ -88,6 +116,9 @@ export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreAction
88
116
  //----------------------------------------------------------------------------------------------------
89
117
  const descriptionRecord$ = ref<Record<string, Record<string, DescriptionDTO>>>({});
90
118
  const defaultLocale$ = ref<string>(KG.LOCALE.ZH_CN);
119
+ const homePagePath$ = ref<string>('pages/home/index');
120
+ const loginPagePath$ = ref<string>('pages/login/Login');
121
+ const isRequestVarConfigDescriptionListDoing$ = ref<boolean>(false);
91
122
  const locale$ = ref<string>('');
92
123
  //----------------------------------------------------------------------------------------------------
93
124
  //endregion
@@ -104,6 +135,9 @@ export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreAction
104
135
  });
105
136
 
106
137
  const defaultLocale$$ = computed<string>(() => defaultLocale$.value);
138
+ const homePagePath$$ = computed<string>(() => homePagePath$.value);
139
+ const loginPagePath$$ = computed<string>(() => loginPagePath$.value);
140
+ const isRequestVarConfigDescriptionListDoing$$ = computed<boolean>(() => isRequestVarConfigDescriptionListDoing$.value);
107
141
 
108
142
  const locale$$ = computed<string>(() => {
109
143
  // 如果属性有值, 表示用户已通过语言选择弹窗选择了某个语言,
@@ -125,9 +159,7 @@ export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreAction
125
159
  });
126
160
 
127
161
  const localeText$$ = computed<string>(() => {
128
- // TODO LT
129
- return '|' + uni.getLocale() + '|' + locale$.value + '|' + uni.getStorageSync(KG.STORAGE_KEY__LOCALE) + '|';
130
- // return KG.LOCALE_DATA_LIST.find((i) => i.code === locale$$.value)?.text ?? '';
162
+ return KG.LOCALE_DATA_LIST.find((i) => i.code === locale$$.value)?.text ?? '';
131
163
  });
132
164
 
133
165
  //----------------------------------------------------------------------------------------------------
@@ -135,53 +167,84 @@ export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreAction
135
167
 
136
168
  //region ACTIONS
137
169
  //----------------------------------------------------------------------------------------------------
138
- async function requestVarConfigDescriptionList(param: { fid: string | null | undefined }): Promise<void> {
139
- if (!param.fid) {
140
- return;
170
+ async function requestVarConfigDescriptionList(): Promise<void> {
171
+ const kg = useKg();
172
+
173
+ try {
174
+ isRequestVarConfigDescriptionListDoing$.value = true;
175
+
176
+ const [varConfigDescriptionList01, varConfigDescriptionList02] = await Promise.all([
177
+ API.WMS.VarConfigDescriptionController.ListByFormId({ data: new VarConfigDescription({ frm_id: KG.DESCRIPTION_KEY__KG }) }),
178
+ API.WMS.VarConfigDescriptionController.ListByFormId({ data: new VarConfigDescription({ frm_id: KG.DESCRIPTION_KEY__WEB }) }),
179
+ ]);
180
+
181
+ setDescriptionList({
182
+ codeName: KG.DESCRIPTION_KEY__KG,
183
+ descriptionList: varConfigDescriptionList01.map(
184
+ (i) =>
185
+ new DescriptionDTO({
186
+ codnam: KG.DESCRIPTION_KEY__KG,
187
+ codval: i.var_nam,
188
+ id: KgCoreUtil.uuid(),
189
+ lngDsc: i.var_text,
190
+ localeId: i.locale_id,
191
+ shortDsc: i.var_text,
192
+ }),
193
+ ),
194
+ });
195
+
196
+ setDescriptionList({
197
+ codeName: KG.DESCRIPTION_KEY__WEB,
198
+ descriptionList: varConfigDescriptionList02.map(
199
+ (i) =>
200
+ new DescriptionDTO({
201
+ codnam: KG.DESCRIPTION_KEY__WEB,
202
+ codval: i.var_nam,
203
+ id: KgCoreUtil.uuid(),
204
+ lngDsc: i.var_text,
205
+ localeId: i.locale_id,
206
+ shortDsc: i.var_text,
207
+ }),
208
+ ),
209
+ });
210
+ } catch (e) {
211
+ setTimeout(() => uni.showToast({ icon: 'none', title: kg.t('pda.kg.requestVarConfigDescriptionList.ErrorMessage', {}, '请求翻译数据失败') }));
212
+ throw e;
213
+ } finally {
214
+ isRequestVarConfigDescriptionListDoing$.value = false;
141
215
  }
142
-
143
- const varConfigDescriptionList = (await API.WMS.VarConfigDescriptionController.ListByFormId({ data: new VarConfigDescription({ frm_id: param.fid }) }).catch(() => [])) ?? [];
144
-
145
- setDescriptionList({
146
- codeName: param.fid,
147
- descriptions: varConfigDescriptionList.map(
148
- (i) =>
149
- new DescriptionDTO({
150
- codnam: param.fid,
151
- codval: i.var_nam,
152
- id: KgCoreUtil.uuid(),
153
- lngDsc: i.var_text,
154
- localeId: i.locale_id,
155
- shortDsc: i.var_text,
156
- }),
157
- ),
158
- });
159
216
  }
160
217
 
161
218
  function setDefaultLocale(value?: string | null): void {
162
219
  defaultLocale$.value = value ?? KG.LOCALE.ZH_CN;
163
220
  }
164
221
 
165
- function setDescriptionList(param: { codeName: string | null | undefined; descriptions: Array<DescriptionDTO> }): void {
166
- const { codeName, descriptions } = param ?? {};
167
- if (!codeName) {
222
+ function setDescriptionList(param: { codeName: string | null | undefined; descriptionList: Array<DescriptionDTO> }): void {
223
+ if (!param?.codeName) {
168
224
  return;
169
225
  }
170
226
 
171
- let codeNameMap = descriptionRecord$.value[codeName];
172
- if (!codeNameMap) {
173
- codeNameMap = {};
174
-
175
- descriptionRecord$.value[codeName] = codeNameMap;
227
+ let codeNameRecord = descriptionRecord$.value[param?.codeName];
228
+ if (!codeNameRecord) {
229
+ codeNameRecord = {};
230
+ descriptionRecord$.value[param?.codeName] = codeNameRecord;
176
231
  }
177
232
 
178
- for (let description of descriptions) {
233
+ for (let description of param?.descriptionList) {
179
234
  if (description.codval) {
180
- codeNameMap[description.codval] = description;
235
+ codeNameRecord[description.codval] = description;
181
236
  }
182
237
  }
183
238
  }
184
239
 
240
+ function setHomePagePath(value?: string | null) {
241
+ homePagePath$.value = value ?? 'pages/home/index';
242
+ }
243
+
244
+ function setLoginPagePath(value?: string | null) {
245
+ loginPagePath$.value = value ?? 'pages/login/Login';
246
+ }
247
+
185
248
  function setLocale(value?: string | null): void {
186
249
  if (!value) {
187
250
  return;
@@ -242,13 +305,23 @@ export const useKgStore: KgStoreDefinition<IUseKgStoreGetters, IUseKgStoreAction
242
305
  defaultLocale$: defaultLocale$,
243
306
  descriptionRecord$: descriptionRecord$,
244
307
  getDescription: getDescription$$,
308
+ homePagePath: homePagePath$$,
309
+ homePagePath$: homePagePath$,
310
+ isRequestVarConfigDescriptionListDoing: isRequestVarConfigDescriptionListDoing$$,
311
+ isRequestVarConfigDescriptionListDoing$: isRequestVarConfigDescriptionListDoing$,
245
312
  locale: locale$$,
246
313
  locale$: locale$,
247
314
  localeText: localeText$$,
315
+ loginPagePath: loginPagePath$$,
316
+ loginPagePath$: loginPagePath$,
248
317
  requestVarConfigDescriptionList: requestVarConfigDescriptionList,
249
318
  setDefaultLocale: setDefaultLocale,
250
319
  setDescriptionList: setDescriptionList,
320
+ setHomePagePath: setHomePagePath,
251
321
  setLocale: setLocale,
322
+ setLoginPagePath: setLoginPagePath,
252
323
  t: t,
253
324
  };
254
325
  });
326
+
327
+ export { type IUseKgStoreGetters, type IUseKgStoreActions, useKgStore };
package/config/index.ts CHANGED
@@ -2,8 +2,6 @@ import { IKgLocale } from '@kengic/core.core';
2
2
  import { useKg } from './config.hooks';
3
3
  import { App } from 'vue';
4
4
  import { KgUtil } from '../util';
5
- import { debounce } from 'lodash-es';
6
- import { KG } from '../model';
7
5
 
8
6
  //region 配置
9
7
  //----------------------------------------------------------------------------------------------------
@@ -23,10 +21,20 @@ type IKgConfigParameter = {
23
21
  */
24
22
  app: App;
25
23
 
24
+ /**
25
+ * 首页路径. 默认为 'pages/home/index'.
26
+ */
27
+ homePagePath?: string;
28
+
26
29
  /**
27
30
  * 是否请求翻译数据. 默认为 true.
28
31
  */
29
32
  isRequestDescriptionList?: boolean;
33
+
34
+ /**
35
+ * 登录页面路径. 默认为 'pages/login/Login'.
36
+ */
37
+ loginPagePath?: string;
30
38
  };
31
39
 
32
40
  /**
@@ -39,28 +47,38 @@ async function kgConfig(param?: IKgConfigParameter): Promise<void> {
39
47
 
40
48
  kg.setDefaultLocale(param?.$i18n$DefaultLocale);
41
49
  kg.setLocale(kg.locale);
50
+ kg.setHomePagePath(param?.homePagePath);
51
+ kg.setLoginPagePath(param?.loginPagePath);
42
52
 
43
53
  //region 请求翻译数据,
44
54
  //----------------------------------------------------------------------------------------------------
45
55
  if (param?.isRequestDescriptionList !== false) {
46
- await Promise.all([kg.requestVarConfigDescriptionList({ fid: KG.DESCRIPTION_KEY__KG }), kg.requestVarConfigDescriptionList({ fid: KG.DESCRIPTION_KEY__WEB })]);
56
+ try {
57
+ await kg.requestVarConfigDescriptionList();
58
+ } catch (e) {
59
+ }
47
60
  }
48
61
  //----------------------------------------------------------------------------------------------------
49
62
  //endregion
50
63
 
51
64
  //region 翻译页面顶部标题
52
65
  //----------------------------------------------------------------------------------------------------
53
- const created = debounce(
54
- function () {
55
- const navigationBarTitleText = KgUtil.getCurrentPage()?.$vm?.$page?.meta?.navigationBar?.titleText ?? '';
56
- if (navigationBarTitleText) {
57
- uni.setNavigationBarTitle({ title: kg.t(navigationBarTitleText) });
66
+ param?.app?.mixin({
67
+ beforeCreate: () => {
68
+ // 翻译之后通过一个属性标记完成, 避免重复翻译,
69
+ const isTranslate = KgUtil.getCurrentPage()?.$vm?.$page?.meta?.navigationBar?.isTranslate ?? false;
70
+
71
+ if (!isTranslate) {
72
+ const navigationBarTitleText = KgUtil.getCurrentPage()?.$vm?.$page?.meta?.navigationBar?.titleText ?? '';
73
+ if (navigationBarTitleText) {
74
+ uni.setNavigationBarTitle({ title: kg.t(navigationBarTitleText) });
75
+ if (KgUtil.getCurrentPage()?.$vm?.$page?.meta?.navigationBar) {
76
+ KgUtil.getCurrentPage()!.$vm.$page.meta.navigationBar.isTranslate = true;
77
+ }
78
+ }
58
79
  }
59
80
  },
60
- 500,
61
- { leading: true, trailing: false },
62
- );
63
- param?.app?.mixin({ created: created });
81
+ });
64
82
  //----------------------------------------------------------------------------------------------------
65
83
  //endregion
66
84
  }
package/index.css CHANGED
@@ -1,22 +1,37 @@
1
- uni-button {
1
+ :deep uni-button {
2
2
  border-radius: 3px !important;
3
+ font-size: 16px;
3
4
  }
4
5
 
5
- uni-button:after {
6
+ :deep uni-button:after {
6
7
  border-radius: 6px !important;
7
8
  }
8
9
 
9
- .kg-tab-bar--sibling {
10
- padding-bottom: 50px !important;
10
+ :deep .uni-mask {
11
+ background: #00000040 !important;
12
+ }
13
+
14
+ :deep .uni-modal {
15
+ border-radius: 4px;
16
+ border: 1px solid #666;
17
+ box-shadow:
18
+ 0 3px 6px -4px #0000001f,
19
+ 0 6px 16px #00000014,
20
+ 0 9px 28px 8px #0000000d !important;
21
+ }
22
+
23
+ :deep .uni-modal .uni-modal__ft {
24
+ line-height: 39px;
25
+ font-size: 16px;
11
26
  }
12
27
 
13
- :deep(uni-toast) {
28
+ :deep uni-toast {
14
29
  display: flex;
15
30
  align-items: center;
16
31
  justify-content: center;
17
32
  }
18
33
 
19
- :deep(uni-toast) .uni-sample-toast {
34
+ :deep uni-toast .uni-sample-toast {
20
35
  max-width: calc(100% - 6px);
21
36
  position: relative;
22
37
  top: initial;
@@ -24,20 +39,54 @@ uni-button:after {
24
39
  transform: translate(0, 0);
25
40
  }
26
41
 
27
- :deep(uni-toast) .uni-sample-toast .uni-simple-toast__text {
42
+ :deep uni-toast .uni-sample-toast .uni-simple-toast__text {
28
43
  padding: 7px 8px 9px 8px;
29
44
  border-radius: 4px;
30
45
  background-color: rgba(17, 17, 17, 0.9);
31
46
  }
32
47
 
33
- :deep(.uni-datetime-picker--btn) {
48
+ :deep .uni-datetime-picker--btn {
34
49
  letter-spacing: 0px !important;
35
50
  }
36
51
 
37
- :deep(.uni-calendar__button-text) {
52
+ :deep .uni-calendar__button-text {
38
53
  letter-spacing: 0px !important;
39
54
  }
40
55
 
56
+ :deep .uni-popup uni-view[name='mask'] {
57
+ transition: none !important;
58
+ background: #00000040 !important;
59
+ }
60
+
61
+ :deep .uni-popup uni-view[name='content'] {
62
+ transition: none !important;
63
+ }
64
+
65
+ :deep .uni-dialog-button {
66
+ height: 39px !important;
67
+ }
68
+
69
+ :deep .uni-popup__wrapper .uni-popup-dialog {
70
+ border: 1px solid #666;
71
+ box-shadow:
72
+ 0 3px 6px -4px #0000001f,
73
+ 0 6px 16px #00000014,
74
+ 0 9px 28px 8px #0000000d !important;
75
+ }
76
+
77
+ :deep .uni-popup__wrapper .uni-popup-dialog .uni-dialog-title-text.uni-popup__info {
78
+ color: #3a3a3a;
79
+ }
80
+
81
+ :deep .uni-dialog-title {
82
+ height: 39px !important;
83
+ line-height: 39px !important;
84
+ }
85
+
86
+ .kg-tab-bar--sibling {
87
+ padding-bottom: 50px !important;
88
+ }
89
+
41
90
  /* region H5 */
42
91
  /* ---------------------------------------------------------------------------------------------------- */
43
92
  /* #ifdef H5 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/uni",
3
- "version": "0.7.14-beta.8",
3
+ "version": "0.7.14",
4
4
  "scripts": {
5
5
  "postinstall": "node bin/postinstall.mjs"
6
6
  },
@@ -18,7 +18,7 @@
18
18
  "@dcloudio/uni-i18n": "3.0.0-alpha-3080220230428001",
19
19
  "@dcloudio/uni-stacktracey": "3.0.0-alpha-3080220230428001",
20
20
  "@dcloudio/vite-plugin-uni": "3.0.0-alpha-3080220230428001",
21
- "@kengic/core.core": "0.0.2-beta.1",
21
+ "@kengic/core.core": "0.0.2",
22
22
  "@kengic/pont": "2.1.2",
23
23
  "@types/lodash-es": "4.17.12",
24
24
  "@types/node": "18.16.3",
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <view></view>
3
+ </template>
4
+
5
+ <!--入口页面-->
6
+ <script setup lang="ts">
7
+ import { watch } from 'vue';
8
+ import { useKg } from '../config';
9
+
10
+ const kg = useKg();
11
+
12
+ //region WATCH
13
+ //----------------------------------------------------------------------------------------------------
14
+ // 等待翻译数据请求完成之后, 再跳转到真正的首页,
15
+ watch(
16
+ () => kg.isRequestVarConfigDescriptionListDoing,
17
+ (isRequestVarConfigDescriptionListDoing) => {
18
+ if (!isRequestVarConfigDescriptionListDoing) {
19
+ uni.reLaunch({ url: `/${kg.homePagePath}` });
20
+ }
21
+ },
22
+ { immediate: true },
23
+ );
24
+ //----------------------------------------------------------------------------------------------------
25
+ //endregion
26
+ </script>
27
+
28
+ <style></style>
package/page/KgPageMy.vue CHANGED
@@ -1,33 +1,35 @@
1
1
  <template>
2
2
  <view class="my">
3
3
  <UniList class="uni-list--setting">
4
- <UniListItem link title="语言" :right-text="kg.localeText" @click="openKgLocaleSelector" />
5
- <UniListItem link title="仓库" :right-text="warehouseRightText$$" @click="openKgWarehouse" />
6
- <UniListItem link title="工作站 - 工作区" :right-text="stationRightText$$" @click="openKgStation" />
7
- <UniListItem link title="后端地址" :right-text="apiUrl" />
4
+ <UniListItem :right-text="kg.localeText" :title="kg.t('pda.KgPageMy.Language', {}, '语言')" link @click="openKgLocale" />
5
+ <UniListItem :right-text="warehouseRightText$$" :title="kg.t('pda.KgPageMy.Warehouse', {}, '仓库')" link @click="openKgWarehouse" />
6
+ <UniListItem :right-text="stationRightText$$" :title="kg.t('pda.KgPageMy.WorkStation', {}, '工作站 - 工作区')" link @click="openKgWorkStation" />
7
+ <UniListItem :right-text="apiUrl" :title="kg.t('pda.KgPageMy.ApiUrl', {}, '后端地址')" link @click="openKgApiUil" />
8
8
 
9
9
  <!--#ifdef APP-PLUS-->
10
- <UniListItem link title="当前版本" :right-text="currentVersion" @click="checkForUpdate" />
11
- <UniListItem class="list-item--check-for-update" clickable title="检查更新" @click="checkForUpdate" />
10
+ <UniListItem :right-text="currentVersion" :title="kg.t('pda.KgPageMy.CurrentVersion', {}, '当前版本')" link @click="checkForUpdate" />
11
+ <UniListItem :title="kg.t('pda.KgPageMy.CheckForUpdate', {}, '检查更新')" class="list-item--check-for-update" clickable @click="checkForUpdate" />
12
12
  <!--#endif-->
13
13
 
14
- <UniListItem class="list-item--logout" clickable title="退出系统" @click="logout" />
14
+ <UniListItem :title="kg.t('pda.KgPageMy.Exit', {}, '退出系统')" class="list-item--logout" clickable @click="logout" />
15
15
  </UniList>
16
16
  </view>
17
17
 
18
- <KgLocaleSelector ref="kgLocaleSelectorRef$" />
19
- <KgWarehouseSelector ref="kgWarehouseRef$" />
20
- <KgWorkStationSelector ref="kgStationRef$" />
18
+ <KgLocale ref="kgLocaleRef$" />
19
+ <KgApiUil ref="kgApiUilRef$" />
20
+ <KgWarehouse ref="kgWarehouseRef$" />
21
+ <KgWorkStation ref="kgWorkStationRef$" />
21
22
  <!--#ifdef APP-PLUS-->
22
- <KgUpdateNotice />
23
+ <KgUpdate />
23
24
  <!--#endif-->
24
25
  <KgTabBar />
25
26
  </template>
26
27
 
28
+ <!--我的-->
27
29
  <script setup lang="ts">
28
30
  import { computed, ref } from 'vue';
29
31
  import { useAppStore, useKg } from '../config';
30
- import { KgLocaleSelector, KgTabBar, KgUpdateNotice, KgWarehouseSelector, KgWorkStationSelector, useKgStation, useKgWarehouse } from '../component';
32
+ import { KgApiUil, KgLocale, KgTabBar, KgUpdate, KgWarehouse, KgWorkStation, useKgStation, useKgWarehouse } from '../component';
31
33
  import { UniList, UniListItem } from '../uni-ui';
32
34
  import { KgUtil } from '../util';
33
35
 
@@ -39,9 +41,10 @@
39
41
 
40
42
  //region DATA
41
43
  // ----------------------------------------------------------------------------------------------------
44
+ const kgLocaleRef$ = ref<any>(null);
45
+ const kgApiUilRef$ = ref<any>(null);
42
46
  const kgWarehouseRef$ = ref<any>(null);
43
- const kgStationRef$ = ref<any>(null);
44
- const kgLocaleSelectorRef$ = ref<any>(null);
47
+ const kgWorkStationRef$ = ref<any>(null);
45
48
 
46
49
  /**
47
50
  * 仓库的右侧文本.
@@ -71,7 +74,7 @@
71
74
  */
72
75
  function logout() {
73
76
  uni.showModal({
74
- title: '是否退出系统 ?',
77
+ title: kg.t('pda.KgPageMy.ExitTitle', {}, '是否退出系统 ?'),
75
78
  success: function (res) {
76
79
  if (res.confirm) {
77
80
  appStore.logout();
@@ -83,8 +86,15 @@
83
86
  /**
84
87
  * 打开「语言选择」.
85
88
  */
86
- function openKgLocaleSelector() {
87
- kgLocaleSelectorRef$.value?.open();
89
+ function openKgLocale() {
90
+ kgLocaleRef$.value?.open();
91
+ }
92
+
93
+ /**
94
+ * 打开「配置后端服务地址」.
95
+ */
96
+ function openKgApiUil() {
97
+ kgApiUilRef$.value?.open();
88
98
  }
89
99
 
90
100
  /**
@@ -97,8 +107,8 @@
97
107
  /**
98
108
  * 打开「工作站工作区选择」.
99
109
  */
100
- function openKgStation() {
101
- kgStationRef$.value?.open();
110
+ function openKgWorkStation() {
111
+ kgWorkStationRef$.value?.open();
102
112
  }
103
113
 
104
114
  const apiUrl = computed<string>(() => appStore.getApiUrl ?? '');
@@ -1,7 +1,7 @@
1
1
  import { useAppStore } from '../config/app.store';
2
2
  import { KgUtil } from '../util';
3
- import { useKgWarehouse } from '../component/KgWarehouseSelector/index.hooks';
4
- import { useKgStation } from '../component/KgWorkStationSelector';
3
+ import { useKgWarehouse } from '../component/KgWarehouse/index.hooks';
4
+ import { useKgStation } from '../component/KgWorkStation';
5
5
  import { isNil } from 'lodash-es';
6
6
  import dayjs from 'dayjs';
7
7
  import { KG } from '../model';
@@ -20,7 +20,6 @@ uni.addInterceptor('request', {
20
20
  const appStore = useAppStore();
21
21
 
22
22
  args.header['Authorization'] = appStore.getToken;
23
- // TODO LT 支持其他语言
24
23
  if (!args.header['Accept-Language']) {
25
24
  args.header['Accept-Language'] = kg.locale?.replace('_', '-');
26
25
  }
@@ -147,14 +146,17 @@ function handleSuccess<T = any>(response: UniApp.RequestSuccessCallbackResult &
147
146
  * @param isSuppressError 是否不显示错误消息提示.
148
147
  */
149
148
  function handleError<T = any>(response: UniApp.RequestSuccessCallbackResult, resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, isSuppressError: boolean) {
150
- // @ts-ignore
151
- if (response.errMsg === 'request:fail') {
152
- return;
153
- }
154
-
155
149
  if (!isSuppressError) {
156
- // @ts-ignore
157
- const message = (response.data as any)?.message || response?.errMsg || '请求出错';
150
+ const message = (() => {
151
+ let _message = (response.data as any)?.message || response?.errMsg || '请求出错';
152
+
153
+ if (_message === 'request:fail') {
154
+ _message = '请求出错';
155
+ }
156
+
157
+ return _message;
158
+ })();
159
+
158
160
  uni.showToast({ duration: 3000, icon: 'none', title: message });
159
161
  }
160
162
 
@@ -320,8 +322,8 @@ const _httpClient: IHttpClient = {
320
322
  break;
321
323
  }
322
324
  },
323
- fail(err) {
324
- handleError<T>(err as any, resolve, reject, options?.isSuppressError ?? false);
325
+ fail(e) {
326
+ handleError<T>(e as any, resolve, reject, options?.isSuppressError ?? false);
325
327
  },
326
328
  });
327
329
  });
@@ -1,6 +1,6 @@
1
1
  {
2
- "uni-popup.cancel": "cancel",
3
- "uni-popup.ok": "ok",
2
+ "uni-popup.cancel": "CANCEL",
3
+ "uni-popup.ok": "OK",
4
4
  "uni-popup.placeholder": "pleace enter",
5
5
  "uni-popup.title": "Hint",
6
6
  "uni-popup.shareTitle": "Share to"
package/util/kg.util.ts CHANGED
@@ -5,6 +5,7 @@ import { useKgStation, useKgWarehouse } from '../component';
5
5
  import { useAppStore } from '../config/app.store';
6
6
  import dayjs, { Dayjs } from 'dayjs';
7
7
  import { KG } from '../model';
8
+ import { useKg } from '../config';
8
9
 
9
10
  /**
10
11
  * 通用工具.
@@ -118,6 +119,7 @@ class KgUtil {
118
119
  public static async checkForUpdate(isShowToast: boolean = true, isRespectCancel: boolean = false): Promise<boolean> {
119
120
  // #ifdef APP-PLUS
120
121
 
122
+ const kg = useKg();
121
123
  const appStore = useAppStore();
122
124
 
123
125
  if (!appStore.getToken) {
@@ -145,13 +147,13 @@ class KgUtil {
145
147
 
146
148
  // 有新版本
147
149
  if (_major > major || (_major == major && _minor > minor) || (_major == major && _minor == minor && _patch > patch)) {
148
- appStore.openKgUpdateNotice(newVersion);
150
+ appStore.openKgUpdate(newVersion);
149
151
  return true;
150
152
  }
151
153
  // 无新版本
152
154
  else {
153
155
  if (isShowToast) {
154
- uni.showToast({ title: '已是最新版本', icon: 'none' });
156
+ uni.showToast({ icon: 'none', title: kg.t('pda.kg.AlreadyTheLatestVersion', {}, '已是最新版本') });
155
157
  }
156
158
  return false;
157
159
  }
@@ -1 +0,0 @@
1
- export { default as KgLocaleSelector } from './KgLocaleSelector.vue';
@@ -1,6 +0,0 @@
1
- import { default as KgUpdateNotice } from './KgUpdateNotice.vue';
2
-
3
- /** @deprecated 已废弃, 请使用 {@link KgUpdateNotice} */
4
- const KgUpdatePopup = KgUpdateNotice;
5
-
6
- export { KgUpdateNotice, KgUpdatePopup };
@@ -1,9 +0,0 @@
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';
@@ -1,9 +0,0 @@
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';