@@ -299,6 +276,7 @@ import { request } from "../../../../shared/utils/request";
const router = useRouter();
const route = useRoute();
+// 组件挂载时获取数据
const yhzDetail = ref({}); // 养护站详情数据
const INIT_FORM = reactive({
event: {
@@ -323,10 +301,6 @@ const INIT_FORM = reactive({
inputManpower: null, // 投入人力
inputFunds: null, // 投入资金
inputEquipment: null, // 投入设备
- snowMeltingAgent: null, // 融雪剂
- sandbags: null, // 麻袋
- antiSlipSand: null, // 防滑沙
- antiSlipChains: null, // 防滑链
createTime: "", // 创建时间
updateTime: "", // 更新时间
},
@@ -338,6 +312,7 @@ const INIT_FORM = reactive({
createTime: "", // 创建时间
updateTime: "", // 更新时间
},
+ yhzMaterialList: [], // 养护站物资列表
photos: [],
});
const form = reactive({ ...INIT_FORM });
@@ -379,6 +354,12 @@ const onClickLeft = () => {
});
};
+// 打开添加物资弹窗
+const handleOpenAddMaterial = () => {
+ console.log("打开添加物资弹窗");
+}
+
+
const handleAdd = () => {
console.log("form", toRaw(form));
};
@@ -460,6 +441,11 @@ const handleDelete = (file) => {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
+.add-wzbtn {
+ width: calc(100% - 32px);
+ margin: 10px 16px;
+}
+
.add-btn {
position: fixed;
bottom: 20px;
diff --git a/packages/screen/src/component/MenuBar/index.js b/packages/screen/src/component/MenuBar/index.js
index 66f508b..2ba4b32 100644
--- a/packages/screen/src/component/MenuBar/index.js
+++ b/packages/screen/src/component/MenuBar/index.js
@@ -1,4 +1,4 @@
-import { h, ref, onMounted, reactive, watch, toRaw, nextTick } from "vue";
+import { h, ref, onMounted, reactive, watch, toRaw, nextTick, onUnmounted } from "vue";
import { request } from "@/utils/request";
import { Search } from "@element-plus/icons-vue";
import { useRoute, useRouter } from 'vue-router'
@@ -29,7 +29,6 @@ const getMenuList = async () => {
export default () => {
// 点击菜单处理
- const router = useRouter();
const handleMenuClick = (menu) => {
console.log('menu', menu)
if (menu.path) {
@@ -39,18 +38,31 @@ export default () => {
}
};
- onMounted(async () => {
- await getMenuList();
- const firstMenuItem = menuList.value[0]?.children?.[0];
- if (firstMenuItem) {
- handleMenuClick(firstMenuItem);
+ const router = useRouter();
+ const tokenRef = ref(localStorage.getItem('token'));
+ watch(tokenRef, async (newVal) => {
+ if (newVal) {
+ await getMenuList();
+ const firstMenuItem = menuList.value[0]?.children?.[0];
+ if (firstMenuItem) {
+ handleMenuClick(firstMenuItem);
+ }
}
- })
+ }, { immediate: true });
+ const handleStorageChange = (e) => {
+ if (e.key === 'token') {
+ tokenRef.value = e.newValue;
+ }
+ };
+ onMounted(() => {
+ window.addEventListener('storage', handleStorageChange);
+ });
+ onUnmounted(() => {
+ window.removeEventListener('storage', handleStorageChange);
+ });
return {
menuList,
handleMenuClick,
-
-
}
};
\ No newline at end of file
diff --git a/packages/screen/src/utils/request.js b/packages/screen/src/utils/request.js
index 14dac79..51ae450 100644
--- a/packages/screen/src/utils/request.js
+++ b/packages/screen/src/utils/request.js
@@ -8,8 +8,8 @@ const service = axios.create({
// 请求拦截器
service.interceptors.request.use(config => {
// 暂时先写死token 实际项目中再调整token的获取位置
- const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjE5ODY2ODgzMjY1MjAwNTc4NTcsImFjY291bnQiOiJieHp0IiwidXVpZCI6Ijc5Zjk5NWE0LTAyNGEtNDA3My04YjVhLTIxNGI4MDBmNmQ1YyIsInJlbWVtYmVyTWUiOnRydWUsImV4cGlyYXRpb25EYXRlIjoxNzYyODUxOTg2OTI1LCJvdGhlcnMiOm51bGwsInN1YiI6IjE5ODY2ODgzMjY1MjAwNTc4NTciLCJpYXQiOjE3NjI4MjMxODYsImV4cCI6MTc2Mjg1MTk4Nn0.nZziqdUarLN1uRfs1pBRrBt-HxqBOGJy67HwaAbIiY7uSv-q9kzfiec7Djd1jkV_OnzhW3jN8h-pl8ILCFl0HA'
- // const token = localStorage.getItem('token');
+ // const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjE5ODY2ODgzMjY1MjAwNTc4NTcsImFjY291bnQiOiJieHp0IiwidXVpZCI6Ijc5Zjk5NWE0LTAyNGEtNDA3My04YjVhLTIxNGI4MDBmNmQ1YyIsInJlbWVtYmVyTWUiOnRydWUsImV4cGlyYXRpb25EYXRlIjoxNzYyODUxOTg2OTI1LCJvdGhlcnMiOm51bGwsInN1YiI6IjE5ODY2ODgzMjY1MjAwNTc4NTciLCJpYXQiOjE3NjI4MjMxODYsImV4cCI6MTc2Mjg1MTk4Nn0.nZziqdUarLN1uRfs1pBRrBt-HxqBOGJy67HwaAbIiY7uSv-q9kzfiec7Djd1jkV_OnzhW3jN8h-pl8ILCFl0HA'
+ const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `${token}`;
}
diff --git a/packages/screen/src/views/Home.vue b/packages/screen/src/views/Home.vue
index a099b55..2a1280a 100644
--- a/packages/screen/src/views/Home.vue
+++ b/packages/screen/src/views/Home.vue
@@ -1,101 +1,18 @@
-
-
-
-
-
-
-
左侧图表1
-
-
-
左侧图表2
-
-
-
-
-
-
-
-
右侧图表1
-
-
-
右侧图表2
-
-
-
-
+
-