@kengic/uni 0.6.2 → 0.6.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/WMS/Controllers/CommonController/GetLatestApkVersion.ts +28 -28
- package/dist/api/WMS/Controllers/CommonController/index.ts +1 -1
- package/dist/api/WMS/Controllers/LoginController/GetUserInfo.ts +28 -0
- package/dist/api/WMS/Controllers/LoginController/Logout.ts +28 -28
- package/dist/api/WMS/Controllers/LoginController/index.ts +2 -1
- package/dist/api/WMS/Controllers/WhController/ListVO.ts +95 -92
- package/dist/api/WMS/Controllers/WhController/index.ts +1 -1
- package/dist/api/WMS/Controllers/index.ts +3 -3
- package/dist/api/WMS/index.ts +2 -2
- package/dist/api/WMS/models.ts +237 -192
- package/dist/api/api.ts +1 -1
- package/dist/api/def.ts +1 -1
- package/dist/api/index.ts +2 -2
- package/dist/component/KgStation/KgStation.vue +197 -0
- package/dist/component/KgStation/index.hooks.ts +61 -0
- package/dist/component/KgStation/index.store.ts +111 -0
- package/dist/component/KgStation/index.ts +4 -0
- package/dist/component/KgTabBar/KgTabBar.vue +2 -2
- package/dist/component/KgWarehouse/KgWarehouse.vue +47 -30
- package/dist/component/KgWarehouse/index.hooks.ts +24 -1
- package/dist/component/KgWarehouse/index.store.ts +8 -8
- package/dist/component/index.ts +1 -0
- package/dist/service/http-client.ts +4 -0
- package/dist/store/app.store.ts +68 -49
- package/dist/uni/uni-ui/uni-card/uni-card.vue +10 -2
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +22 -17
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +35 -33
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +22 -13
- package/dist/uni/uni-ui/uni-icons/uniicons.css +32 -31
- package/dist/uni/uni-ui/uni-icons/uniicons.ttf +0 -0
- package/dist/uni/uni-ui/uni-icons/uniicons_file.ts +664 -0
- package/dist/uni/uni-ui/uni-icons/uniicons_file_vue.js +649 -0
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +12 -7
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +1 -2
- package/dist/util/kg.ts +33 -7
- package/package.json +5 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { computed, ComputedRef } from 'vue';
|
|
2
|
+
import { IKgStationStore, useKgStationStore, WorkstationDTO, WorkstationAreaDTO } from './index.store';
|
|
3
|
+
import { useKgWarehouse } from '../KgWarehouse';
|
|
4
|
+
|
|
5
|
+
export type IUseKgStation = {
|
|
6
|
+
/**
|
|
7
|
+
* 当前工作区.
|
|
8
|
+
*/
|
|
9
|
+
area: ComputedRef<WorkstationAreaDTO | null>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 当前工作站.
|
|
13
|
+
*/
|
|
14
|
+
station: ComputedRef<WorkstationDTO | null>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 所有工作站.
|
|
18
|
+
*/
|
|
19
|
+
stations: ComputedRef<IKgStationStore['getStations']>;
|
|
20
|
+
|
|
21
|
+
store: IKgStationStore;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function useKgStation(): IUseKgStation {
|
|
25
|
+
const store = useKgStationStore();
|
|
26
|
+
|
|
27
|
+
const kgWarehouse = useKgWarehouse();
|
|
28
|
+
|
|
29
|
+
const station = computed<WorkstationDTO | null>(() => {
|
|
30
|
+
if (!store.getStation) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//region 如果当前工作站(可能来自浏览器的缓存)不在工作站列表中(比如数据库中的工作站有变更), 或者当前工作站不属于当前仓库, 则返回 null, 表示需要重新选择工作站,
|
|
35
|
+
// ----------------------------------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
// 当前工作站编号
|
|
38
|
+
const currentDevcod = store.getStation?.devcod;
|
|
39
|
+
|
|
40
|
+
// 如果 store.getStations 为 undefined, 表示「所有工作站」尚未完成查询,
|
|
41
|
+
if (store.getStations !== undefined && !store.getStations?.find((i) => i.devcod === currentDevcod)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (store.getStation.whId !== kgWarehouse.warehouse.value?.whId) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ----------------------------------------------------------------------------------------------------
|
|
50
|
+
//endregion
|
|
51
|
+
|
|
52
|
+
return store.getStation;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
area: computed(() => station.value?.workstationAreas?.find((i) => i.wrkare === station.value?.hmewrkare) ?? null),
|
|
57
|
+
station: station,
|
|
58
|
+
stations: computed(() => store.getStations),
|
|
59
|
+
store: store,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { defineStore, StoreDefinition } from 'pinia';
|
|
2
|
+
import { toRaw, unref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const LOCAL_STORAGE_KEY = 'KgStation.station';
|
|
5
|
+
|
|
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
|
+
export interface IKgStationState {
|
|
22
|
+
/**
|
|
23
|
+
* 当前工作站.
|
|
24
|
+
*/
|
|
25
|
+
station: WorkstationDTO | null;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 所有工作站.
|
|
29
|
+
*/
|
|
30
|
+
stations: Array<WorkstationDTO> | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface IKgStationGetters {
|
|
34
|
+
getStation: WorkstationDTO | null;
|
|
35
|
+
|
|
36
|
+
getStations: Array<WorkstationDTO> | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface IKgStationActions {
|
|
40
|
+
/**
|
|
41
|
+
* 查询所有工作站.
|
|
42
|
+
*/
|
|
43
|
+
requestStations(): Promise<void>;
|
|
44
|
+
|
|
45
|
+
setStation(station?: WorkstationDTO | null): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type IUseKgStationStore = StoreDefinition<'KgStation', IKgStationState, IKgStationGetters, IKgStationActions>;
|
|
49
|
+
|
|
50
|
+
export type IKgStationStore = ReturnType<IUseKgStationStore>;
|
|
51
|
+
|
|
52
|
+
export const useKgStationStore = defineStore('KgStation', {
|
|
53
|
+
actions: {
|
|
54
|
+
async requestStations(): Promise<void> {
|
|
55
|
+
// 已经有值, 说明已经查询过了, 不做操作,
|
|
56
|
+
if (this.stations) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
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
|
+
];
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
setStation(station?: WorkstationDTO | null): void {
|
|
86
|
+
// 未选择工作站
|
|
87
|
+
if (!station) {
|
|
88
|
+
this.station = null;
|
|
89
|
+
uni.setStorageSync(LOCAL_STORAGE_KEY, null);
|
|
90
|
+
}
|
|
91
|
+
// 有选择工作站
|
|
92
|
+
else {
|
|
93
|
+
this.station = toRaw(unref(station));
|
|
94
|
+
uni.setStorageSync(LOCAL_STORAGE_KEY, this.station);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
getters: {
|
|
99
|
+
getStation(): WorkstationDTO | null {
|
|
100
|
+
return this.station ?? null;
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
getStations(): Array<WorkstationDTO> | undefined {
|
|
104
|
+
return this.stations;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
state: (): IKgStationState => ({
|
|
108
|
+
station: uni.getStorageSync(LOCAL_STORAGE_KEY) || null,
|
|
109
|
+
stations: undefined,
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<text class="text">首页</text>
|
|
6
6
|
</view>
|
|
7
7
|
|
|
8
|
-
<view :class="{ active: page?.route === 'pages/my/
|
|
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
10
|
<text class="text">我的</text>
|
|
11
11
|
</view>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
const page = Kg.getCurrentPage();
|
|
40
40
|
|
|
41
41
|
function goto(path: string) {
|
|
42
|
-
if (path != 'pages/my/
|
|
42
|
+
if (path != 'pages/my/My') {
|
|
43
43
|
uni.redirectTo({ url: '/' + path });
|
|
44
44
|
} else {
|
|
45
45
|
uni.navigateTo({ url: '/' + path });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UniPopup ref="popupRef" :type="'dialog'">
|
|
3
3
|
<UniPopupDialog :before-close="true" title="选择仓库" @confirm="onOk">
|
|
4
|
-
<UniDataCheckbox v-model="
|
|
4
|
+
<UniDataCheckbox v-model="currentWhId" :localdata="warehouseDatas" />
|
|
5
5
|
</UniPopupDialog>
|
|
6
6
|
</UniPopup>
|
|
7
7
|
</template>
|
|
@@ -9,25 +9,30 @@
|
|
|
9
9
|
<script lang="ts" setup>
|
|
10
10
|
import { UniDataCheckbox, UniPopup, UniPopupDialog } from '../../uni';
|
|
11
11
|
import { API } from '../../api';
|
|
12
|
-
import { ref } from 'vue';
|
|
13
|
-
import { WhDTO } from '../../api/WMS/models';
|
|
12
|
+
import { computed, ref } from 'vue';
|
|
13
|
+
import { SysUserWarehouseDTO, WhDTO } from '../../api/WMS/models';
|
|
14
14
|
import { useKgWarehouse } from './index.hooks';
|
|
15
|
+
import { useAppStore } from '../../store/app.store';
|
|
16
|
+
import { Kg } from '../../util';
|
|
15
17
|
|
|
16
18
|
const emit = defineEmits(['ok']);
|
|
17
19
|
|
|
20
|
+
const appStore = useAppStore();
|
|
18
21
|
const kgWarehouse = useKgWarehouse();
|
|
19
22
|
|
|
20
23
|
const popupRef = ref<any>(null);
|
|
21
24
|
/** 当前选择的仓库编号. */
|
|
22
|
-
const
|
|
25
|
+
const currentWhId = ref<string>('');
|
|
23
26
|
/** 仓库列表. */
|
|
24
|
-
|
|
27
|
+
const warehouses = ref<Array<WhDTO>>([]);
|
|
25
28
|
/** 选项列表. */
|
|
26
|
-
const
|
|
29
|
+
const warehouseDatas = ref<Array<{ text: string; value: string }>>([]);
|
|
30
|
+
/** 用户仓库列表. */
|
|
31
|
+
const userWarehouses = computed<Array<SysUserWarehouseDTO>>(() => appStore.getUserWarehouses);
|
|
27
32
|
|
|
28
33
|
/** 确定. */
|
|
29
34
|
function onOk() {
|
|
30
|
-
kgWarehouse.store.setWarehouse(warehouses.find((i) => i.whId ===
|
|
35
|
+
kgWarehouse.store.setWarehouse(warehouses.value.find((i) => i.whId === currentWhId.value));
|
|
31
36
|
popupRef.value?.close();
|
|
32
37
|
emit('ok');
|
|
33
38
|
}
|
|
@@ -35,30 +40,36 @@
|
|
|
35
40
|
/** 打开弹窗. */
|
|
36
41
|
function open() {
|
|
37
42
|
popupRef.value?.open();
|
|
38
|
-
|
|
43
|
+
requestWarehouses();
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/** 查询仓库列表. */
|
|
42
|
-
async function
|
|
47
|
+
async function requestWarehouses(): Promise<void> {
|
|
43
48
|
try {
|
|
44
49
|
const { records } = await API.WMS.WhController.ListVO({ params: { pageNo: 1, pageSize: 999 } });
|
|
45
|
-
warehouses = records ?? []
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
warehouses.value = (records ?? []).filter((i) => {
|
|
51
|
+
// 管理员拥有所有仓库
|
|
52
|
+
if (Kg.isAdminUser()) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return userWarehouses.value?.find((j) => j.wh_id === i.whId);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
warehouseDatas.value = warehouses.value.map((i: WhDTO) => ({
|
|
48
60
|
text: `${i.whDsc ?? ' '} - ${i.whId ?? ' '}`,
|
|
61
|
+
value: i.whId ?? '',
|
|
49
62
|
}));
|
|
50
63
|
|
|
51
|
-
const currentWarehouse = warehouses.find((i) => kgWarehouse.warehouse.value?.whId
|
|
64
|
+
const currentWarehouse = warehouses.value.find((i) => i.whId === kgWarehouse.warehouse.value?.whId) ?? null;
|
|
52
65
|
// 如果当前仓库不为空, 且有效(存在于当前仓库列表中), 则继续使用
|
|
53
66
|
if (currentWarehouse) {
|
|
54
|
-
|
|
67
|
+
currentWhId.value = currentWarehouse.whId ?? '';
|
|
55
68
|
}
|
|
56
69
|
// 否则, 清空当前仓库, 并默认选中第一个仓库
|
|
57
70
|
else {
|
|
58
71
|
kgWarehouse.store.setWarehouse(null);
|
|
59
|
-
|
|
60
|
-
whID.value = warehouses[0].whId ?? '';
|
|
61
|
-
}
|
|
72
|
+
currentWhId.value = warehouses.value[0]?.whId ?? '';
|
|
62
73
|
}
|
|
63
74
|
} catch (e) {
|
|
64
75
|
console.error(e);
|
|
@@ -68,20 +79,26 @@
|
|
|
68
79
|
defineExpose({ open });
|
|
69
80
|
</script>
|
|
70
81
|
|
|
71
|
-
<style scoped
|
|
72
|
-
:deep {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
82
|
+
<style scoped>
|
|
83
|
+
:deep(.uni-popup-dialog) {
|
|
84
|
+
font-size: 13px;
|
|
85
|
+
}
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
:deep(.uni-popup-dialog) .uni-dialog-content {
|
|
88
|
+
padding: 0 6px;
|
|
89
|
+
}
|
|
80
90
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
:deep(.uni-popup-dialog) .uni-dialog-button-group > .uni-dialog-button:first-child {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:deep(.uni-popup-dialog) .uni-dialog-button-group > .uni-dialog-button:last-child {
|
|
96
|
+
border-left-width: 0px !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:deep(.uni-popup-dialog) .uni-label-pointer {
|
|
100
|
+
width: 100%;
|
|
101
|
+
margin: 0 !important;
|
|
102
|
+
padding: 6px 0 !important;
|
|
86
103
|
}
|
|
87
104
|
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, ComputedRef } from 'vue';
|
|
2
2
|
import { IKgWarehouseStore, useKgWarehouseStore } from './index.store';
|
|
3
3
|
import { WhDTO } from '../../api/WMS/models';
|
|
4
|
+
import { useAppStore } from '../../store/app.store';
|
|
4
5
|
|
|
5
6
|
export type IUseKgWarehouse = {
|
|
6
7
|
store: IKgWarehouseStore;
|
|
@@ -10,8 +11,30 @@ export type IUseKgWarehouse = {
|
|
|
10
11
|
|
|
11
12
|
export function useKgWarehouse(): IUseKgWarehouse {
|
|
12
13
|
const store = useKgWarehouseStore();
|
|
14
|
+
const appStore = useAppStore();
|
|
15
|
+
|
|
16
|
+
const warehouse = computed<WhDTO | null>(() => {
|
|
17
|
+
if (!store.getWarehouse) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//region 如果当前仓库(可能来自浏览器的缓存)不在仓库列表中, 比如切换登录用户, 或者用户可访问的仓库发生变更, 则返回 null, 表示需要重新选择仓库
|
|
22
|
+
// ----------------------------------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
// 当前仓库编号
|
|
25
|
+
const currentWarehouseID = store.getWarehouse?.whId;
|
|
26
|
+
|
|
27
|
+
// 如果 userWarehouses 为 undefined, 表示 userWarehouses 数据尚未完成初始化,
|
|
28
|
+
if (appStore.getUserWarehouses !== undefined && !appStore.getUserWarehouses?.find((i) => i.wh_id === currentWarehouseID)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ----------------------------------------------------------------------------------------------------
|
|
33
|
+
//endregion
|
|
34
|
+
|
|
35
|
+
return store.getWarehouse;
|
|
36
|
+
});
|
|
13
37
|
|
|
14
|
-
const warehouse = computed(() => store.getWarehouse);
|
|
15
38
|
|
|
16
39
|
return {
|
|
17
40
|
store,
|
|
@@ -23,14 +23,6 @@ export type IUseKgWarehouseStore = StoreDefinition<
|
|
|
23
23
|
export type IKgWarehouseStore = ReturnType<IUseKgWarehouseStore>;
|
|
24
24
|
|
|
25
25
|
export const useKgWarehouseStore = defineStore('KgWarehouse', {
|
|
26
|
-
state: (): IKgWarehouseState => ({
|
|
27
|
-
warehouse: null,
|
|
28
|
-
}),
|
|
29
|
-
getters: {
|
|
30
|
-
getWarehouse(): WhDTO | null {
|
|
31
|
-
return this.warehouse || uni.getStorageSync(LOCAL_STORAGE_KEY) || null;
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
26
|
actions: {
|
|
35
27
|
setWarehouse(warehouse?: WhDTO | null): void {
|
|
36
28
|
if (!warehouse) {
|
|
@@ -43,4 +35,12 @@ export const useKgWarehouseStore = defineStore('KgWarehouse', {
|
|
|
43
35
|
uni.setStorageSync(LOCAL_STORAGE_KEY, this.warehouse);
|
|
44
36
|
},
|
|
45
37
|
},
|
|
38
|
+
getters: {
|
|
39
|
+
getWarehouse(): WhDTO | null {
|
|
40
|
+
return this.warehouse || null;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
state: (): IKgWarehouseState => ({
|
|
44
|
+
warehouse: uni.getStorageSync(LOCAL_STORAGE_KEY),
|
|
45
|
+
}),
|
|
46
46
|
});
|
package/dist/component/index.ts
CHANGED
|
@@ -11,8 +11,12 @@ uni.addInterceptor('request', {
|
|
|
11
11
|
uni.showLoading({});
|
|
12
12
|
|
|
13
13
|
const appStore = useAppStore();
|
|
14
|
+
|
|
14
15
|
args.header['Authorization'] = appStore.getToken;
|
|
16
|
+
// TODO 支持其他语言
|
|
17
|
+
args.header['Accept-Language'] = 'zh_CN'.replace('_', '-');
|
|
15
18
|
args.header['X-Access-Token'] = appStore.getToken;
|
|
19
|
+
|
|
16
20
|
if (!args.url?.startsWith('http')) {
|
|
17
21
|
args.url = appStore.getApiUrl + args.url;
|
|
18
22
|
}
|
package/dist/store/app.store.ts
CHANGED
|
@@ -1,72 +1,32 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { STORAGE_KEYS } from '../const';
|
|
3
|
-
import { SysUser } from '../api/WMS/models';
|
|
3
|
+
import { SysUser, SysUserWarehouseDTO } from '../api/WMS/models';
|
|
4
4
|
import { API } from '../api';
|
|
5
5
|
|
|
6
6
|
interface IAppState {
|
|
7
7
|
/** 后端接口地址. */
|
|
8
8
|
apiUrl: string;
|
|
9
9
|
|
|
10
|
+
/** 是否取消本次升级. 取消之后, 使用应用期间不会再提示升级, 直到下次重新打开应用才会提示升级. */
|
|
11
|
+
isUpdateCancel: boolean;
|
|
12
|
+
|
|
10
13
|
/** 登录令牌. */
|
|
11
14
|
token: string;
|
|
12
15
|
|
|
13
16
|
/** 当前登录用户. */
|
|
14
17
|
user: SysUser | null;
|
|
15
18
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* 用户仓库.
|
|
21
|
+
*/
|
|
22
|
+
userWarehouses: Array<SysUserWarehouseDTO> | undefined;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export const useAppStore = defineStore('app', {
|
|
21
|
-
state: (): IAppState => ({
|
|
22
|
-
apiUrl: '',
|
|
23
|
-
token: '',
|
|
24
|
-
user: {},
|
|
25
|
-
isUpdateCancel: false,
|
|
26
|
-
}),
|
|
27
|
-
getters: {
|
|
28
|
-
/** 后端接口地址. */
|
|
29
|
-
getApiUrl(state) {
|
|
30
|
-
return state.apiUrl || uni.getStorageSync(STORAGE_KEYS.API_URL);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
/** 登录令牌. */
|
|
34
|
-
getToken(state) {
|
|
35
|
-
return state.token || uni.getStorageSync(STORAGE_KEYS.TOKEN);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
/** 当前登录用户. */
|
|
39
|
-
getUser(state) {
|
|
40
|
-
return state.user || uni.getStorageSync(STORAGE_KEYS.USER);
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/** 是否取消本次升级. */
|
|
44
|
-
getIsUpdateCancel(state) {
|
|
45
|
-
return state.isUpdateCancel;
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
26
|
actions: {
|
|
49
|
-
setApiUrl(apiUrl: string) {
|
|
50
|
-
uni.setStorageSync(STORAGE_KEYS.API_URL, apiUrl);
|
|
51
|
-
this.apiUrl = apiUrl;
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
setToken(token: string) {
|
|
55
|
-
uni.setStorageSync(STORAGE_KEYS.TOKEN, token);
|
|
56
|
-
this.token = token;
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
setUser(user: SysUser | null) {
|
|
60
|
-
uni.setStorageSync(STORAGE_KEYS.USER, user);
|
|
61
|
-
this.user = user;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
setIsUpdateCancel(value: boolean) {
|
|
65
|
-
this.isUpdateCancel = value;
|
|
66
|
-
},
|
|
67
|
-
|
|
68
27
|
/**
|
|
69
28
|
* 退出登录.
|
|
29
|
+
*
|
|
70
30
|
* @param param.isRequest 是否请求后端退出登录接口, 默认为 true.
|
|
71
31
|
*/
|
|
72
32
|
async logout(param: { isRequest?: boolean } = {}) {
|
|
@@ -95,5 +55,64 @@ export const useAppStore = defineStore('app', {
|
|
|
95
55
|
* @param version 最新版本.
|
|
96
56
|
*/
|
|
97
57
|
openKgUpdatePopup(version: string) {},
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 查询用户仓库.
|
|
61
|
+
*/
|
|
62
|
+
async requestUserWarehouses() {
|
|
63
|
+
const { userWarehouses } = await API.WMS.LoginController.GetUserInfo();
|
|
64
|
+
this.userWarehouses = userWarehouses ?? [];
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
setApiUrl(apiUrl: string) {
|
|
68
|
+
uni.setStorageSync(STORAGE_KEYS.API_URL, apiUrl);
|
|
69
|
+
this.apiUrl = apiUrl;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
setIsUpdateCancel(value: boolean) {
|
|
73
|
+
this.isUpdateCancel = value;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
setToken(token: string) {
|
|
77
|
+
uni.setStorageSync(STORAGE_KEYS.TOKEN, token);
|
|
78
|
+
this.token = token;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
setUser(user: SysUser | null) {
|
|
82
|
+
uni.setStorageSync(STORAGE_KEYS.USER, user);
|
|
83
|
+
this.user = user;
|
|
84
|
+
},
|
|
98
85
|
},
|
|
86
|
+
getters: {
|
|
87
|
+
/** 后端接口地址. */
|
|
88
|
+
getApiUrl(state) {
|
|
89
|
+
return state.apiUrl;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/** 是否取消本次升级. */
|
|
93
|
+
getIsUpdateCancel(state) {
|
|
94
|
+
return state.isUpdateCancel;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/** 登录令牌. */
|
|
98
|
+
getToken(state) {
|
|
99
|
+
return state.token;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/** 当前登录用户. */
|
|
103
|
+
getUser(state) {
|
|
104
|
+
return state.user;
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
getUserWarehouses(): Array<SysUserWarehouseDTO> | undefined {
|
|
108
|
+
return this.userWarehouses;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
state: (): IAppState => ({
|
|
112
|
+
apiUrl: uni.getStorageSync(STORAGE_KEYS.API_URL) ?? '',
|
|
113
|
+
isUpdateCancel: false,
|
|
114
|
+
token: uni.getStorageSync(STORAGE_KEYS.TOKEN) ?? '',
|
|
115
|
+
user: uni.getStorageSync(STORAGE_KEYS.USER) ?? {},
|
|
116
|
+
userWarehouses: undefined,
|
|
117
|
+
}),
|
|
99
118
|
});
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
$uni-base-color: #6a6a6a !default;
|
|
135
135
|
$uni-secondary-color: #909399 !default;
|
|
136
136
|
$uni-spacing-sm: 8px !default;
|
|
137
|
-
$uni-border-color:
|
|
137
|
+
$uni-border-color: #e5e5e5;
|
|
138
138
|
$uni-shadow: $uni-shadow-base;
|
|
139
139
|
$uni-card-title: 15px;
|
|
140
140
|
$uni-cart-title-color: $uni-main-color;
|
|
@@ -147,7 +147,14 @@
|
|
|
147
147
|
margin: $uni-card-spacing;
|
|
148
148
|
border-radius: 4px;
|
|
149
149
|
overflow: hidden;
|
|
150
|
-
font-family:
|
|
150
|
+
font-family:
|
|
151
|
+
Helvetica Neue,
|
|
152
|
+
Helvetica,
|
|
153
|
+
PingFang SC,
|
|
154
|
+
Hiragino Sans GB,
|
|
155
|
+
Microsoft YaHei,
|
|
156
|
+
SimSun,
|
|
157
|
+
sans-serif;
|
|
151
158
|
background-color: #fff;
|
|
152
159
|
flex: 1;
|
|
153
160
|
|
|
@@ -174,6 +181,7 @@
|
|
|
174
181
|
align-items: center;
|
|
175
182
|
padding: $uni-card-spacing;
|
|
176
183
|
overflow: hidden;
|
|
184
|
+
background: #fafafa;
|
|
177
185
|
|
|
178
186
|
.uni-card__header-box {
|
|
179
187
|
/* #ifndef APP-NVUE */
|