|
|
@@ -12,23 +12,26 @@ import {
|
|
|
import {useStore} from 'zustand';
|
|
|
import {userStore} from '@stores';
|
|
|
import {useEffect, useState} from 'react';
|
|
|
+import {klona} from 'klona/json';
|
|
|
+
|
|
|
+const defaultBtnList = [
|
|
|
+ {
|
|
|
+ title: '收发货',
|
|
|
+ children: [
|
|
|
+ {title: '发货', icon: sendIcon, url: DELIVER_GOODS_PATH},
|
|
|
+ {title: '收货', icon: complateIcon, url: RECEIVE_GOODS_PATH},
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '查询',
|
|
|
+ children: [],
|
|
|
+ },
|
|
|
+];
|
|
|
|
|
|
export function useBtnList() {
|
|
|
const {power} = useStore(userStore);
|
|
|
|
|
|
- const [btnList, setBtnList] = useState([
|
|
|
- {
|
|
|
- title: '收发货',
|
|
|
- children: [
|
|
|
- {title: '发货', icon: sendIcon, url: DELIVER_GOODS_PATH},
|
|
|
- {title: '收货', icon: complateIcon, url: RECEIVE_GOODS_PATH},
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- title: '查询',
|
|
|
- children: [],
|
|
|
- },
|
|
|
- ]);
|
|
|
+ const [btnList, setBtnList] = useState(klona(defaultBtnList));
|
|
|
|
|
|
useEffect(
|
|
|
function () {
|
|
|
@@ -37,8 +40,8 @@ export function useBtnList() {
|
|
|
anomalyContext = /** */ 0x000010,
|
|
|
customerContext = /** */ 0x000100;
|
|
|
|
|
|
- setBtnList(function (prev) {
|
|
|
- const next = [...prev];
|
|
|
+ setBtnList(function () {
|
|
|
+ const next = klona(defaultBtnList);
|
|
|
|
|
|
powerContext & sendContext &&
|
|
|
next[1].children.push({
|