Kaynağa Gözat

Merge branch 'master' of http://182.92.126.35:3000/hrx/vent-forewarn-micro

lxh 1 yıl önce
ebeveyn
işleme
6f3614c42d

+ 1 - 2
src/layouts/default/header/MultipleHeader.vue

@@ -5,8 +5,7 @@
     v-if="getIsShowPlaceholderDom"
   ></div>
   <div :style="getWrapStyle" :class="getClass">
-    <!-- <LayoutHeader v-if="getShowInsetHeaderRef" /> -->
-    <LayoutHeader />
+    <LayoutHeader v-if="getShowInsetHeaderRef" />
     <MultipleTabs v-if="getShowTabs" :key="tabStore.getLastDragEndIndex" />
   </div>
 </template>

+ 1 - 1
src/layouts/default/header/index.vue

@@ -32,7 +32,7 @@
     <!-- menu-end -->
 
     <!-- action  -->
-    <div :class="`${prefixCls}-action`">
+    <div :class="`${prefixCls}-action`" style="display: none">
       <UserDropDown :theme="getHeaderTheme" />
       <!-- <AppSearch v-if="getShowSearch" :class="`${prefixCls}-action__item `" /> -->
 

+ 18 - 11
src/router/guard/permissionGuard.ts

@@ -8,6 +8,7 @@ import { useUserStoreWithOut } from '@/store/modules/user';
 import { PAGE_NOT_FOUND_ROUTE } from '@/router/routes/basic';
 
 import { RootRoute } from '@/router/routes';
+import { getToken } from '@/utils/auth';
 
 const LOGIN_PATH = PageEnum.BASE_LOGIN;
 
@@ -55,19 +56,25 @@ export function createPermissionGuard(router: Router) {
         next();
         return;
       }
+      // 自动登录
+      const userStore = useUserStoreWithOut();
+      await userStore.autoLogin();
+      next(to.path);
 
       // redirect login page
-      const redirectData: { path: string; replace: boolean; query?: Recordable<string> } = {
-        path: LOGIN_PATH,
-        replace: true,
-      };
-      if (to.path) {
-        redirectData.query = {
-          ...redirectData.query,
-          redirect: to.path,
-        };
-      }
-      next(redirectData);
+
+      // const redirectData: { path: string; replace: boolean; query?: Recordable<string> } = {
+      //   path: LOGIN_PATH,
+      //   replace: true,
+      // };
+      // if (to.path) {
+      //   redirectData.query = {
+      //     ...redirectData.query,
+      //     redirect: to.path,
+      //   };
+      // }
+      // next(redirectData);
+
       return;
     }
 

+ 3 - 2
src/router/index.ts

@@ -1,7 +1,7 @@
 import type { RouteRecordRaw } from 'vue-router';
 import type { App } from 'vue';
 
-import { createRouter, createWebHashHistory } from 'vue-router';
+import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
 import { basicRoutes } from './routes';
 
 // 白名单应该包含基本静态路由
@@ -17,7 +17,8 @@ getRouteNames(basicRoutes);
 // 创建一个可以被 Vue 应用程序使用的路由实例
 export const router = createRouter({
   // 创建一个 hash 历史记录。
-  history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH),
+  // history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH),
+  history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH),
   // 应该添加到路由的初始路由列表。
   routes: basicRoutes as unknown as RouteRecordRaw[],
   // 是否应该禁止尾部斜杠。默认为假

+ 1 - 1
src/router/routes/vent/dust.ts

@@ -22,7 +22,7 @@ const dust: AppRouteModule = {
       // component: () => import('@/views/vent/dust/home/index.vue'),
       component: () => import('@/views/vent/dust/dustHome/index.vue'),
     },
-    
+
     {
       path: 'dust-warnAnalysis',
       name: 'dustWarnAnalysis',

+ 4 - 4
src/settings/projectSetting.ts

@@ -64,7 +64,7 @@ const setting: ProjectConfig = {
     // Fixed at the top
     fixed: true,
     // Whether to show top
-    show: true,
+    show: false,
     // theme
     theme: ThemeEnum.LIGHT,
     // Whether to enable the lock screen function
@@ -77,7 +77,7 @@ const setting: ProjectConfig = {
     showNotice: true,
     // Whether to display the menu search
     showSearch: true,
-    showApi: true,
+    showApi: false,
   },
 
   // Menu configuration
@@ -96,9 +96,9 @@ const setting: ProjectConfig = {
     // Only limited to the opening of the left menu, the mouse has a drag bar on the right side of the menu
     canDrag: false,
     // Whether to show no dom
-    show: true, // 菜单显示或隐藏
+    show: false, // 菜单显示或隐藏
     // Whether to show dom
-    hidden: false,
+    hidden: true,
     // Menu width
     menuWidth: 210,
     // Menu mode

+ 20 - 0
src/store/modules/user.ts

@@ -101,6 +101,26 @@ export const useUserStore = defineStore({
         return Promise.reject(error);
       }
     },
+
+    async autoLogin() {
+      try {
+        const loginParams = {
+          username: 'admin',
+          password: '123456',
+          captcha: '1234',
+          checkKey: new Date().getTime(),
+          remember_me: true,
+        };
+        const data = await loginApi(loginParams);
+        const { token } = data;
+        this.setToken(token);
+        const userInfo = data['userInfo'];
+        this.setUserInfo(userInfo);
+      } catch (error) {
+        return Promise.reject(error);
+      }
+    },
+
     async afterLoginAction(goHome?: boolean, userInfo?): Promise<GetUserInfoModel | null> {
       if (!this.getToken) return null;
       // get user info

+ 1 - 1
src/utils/http/axios/Axios.ts

@@ -225,7 +225,7 @@ export class VAxios {
     return new Promise((resolve, reject) => {
       this.axiosInstance
         .request<any, AxiosResponse<Result>>(conf)
-        .then((res: AxiosResponse<Result>) => {
+        .then(async (res: AxiosResponse<Result>) => {
           if (transformResponseHook && isFunction(transformResponseHook)) {
             try {
               const ret = transformResponseHook(res, opt);

+ 6 - 3
src/utils/http/axios/index.ts

@@ -23,6 +23,7 @@ import { router } from '@/router';
 import signMd5Utils from '@/utils/encryption/signMd5Utils';
 
 const globSetting = useGlobSetting();
+
 const urlPrefix = globSetting.urlPrefix;
 const { createMessage, createErrorModal, createSuccessModal } = useMessage();
 
@@ -78,11 +79,13 @@ const transform: AxiosTransform = {
     // 在此处根据自己项目的实际情况对不同的code执行不同的操作
     // 如果不希望中断当前请求,请return数据,否则直接抛出异常即可
     let timeoutMsg = '';
+    debugger;
     switch (code) {
       case ResultEnum.TIMEOUT:
         timeoutMsg = t('sys.api.timeoutMessage');
         const userStore = useUserStoreWithOut();
-        userStore.logout(true);
+        userStore.autoLogin().then(() => {});
+        // userStore.logout(true);
         break;
       default:
         if (message) {
@@ -243,7 +246,7 @@ const transform: AxiosTransform = {
   },
 };
 
-function createAxios(opt?: Partial<CreateAxiosOptions>) {
+async function createAxios(opt?: Partial<CreateAxiosOptions>) {
   return new VAxios(
     // 深度合并
     deepMerge(
@@ -296,7 +299,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
     ),
   );
 }
-export const defHttp = createAxios();
+export const defHttp = await createAxios();
 
 // other api url
 // export const otherHttp = createAxios({

+ 287 - 268
src/views/vent/common/danelBd.vue

@@ -1,7 +1,10 @@
 <template>
   <div class="dane-bd">
-    <div v-if="moduleNames" class="dane-title"
-      :style="{ 'margin-bottom': contentStyle.contentH == '0px' ? '0px' : '3px' }">
+    <div
+      v-if="moduleNames"
+      class="dane-title"
+      :style="{ 'margin-bottom': contentStyle.contentH == '0px' ? '0px' : '3px' }"
+    >
       <div :class="commonTitle == 'selected' ? 'common-navL' : 'common-navL1'">
         <img src="../../../assets/images/fire/firehome/title-2.png" alt="" />
         <span>{{ moduleNames }}</span>
@@ -17,13 +20,27 @@
       <div :class="commonTitle == 'selected' ? 'common-navR' : 'common-navR1'">
         <!-- 下拉框 -->
         <div class="common-navR-select" v-if="commonTitle == 'selected'">
-          <Select style="width: 140px" :options="selectLists" size="small" placeholder="请选择" v-model:value="selectVal"
-            allowClear  @change="changeSelect"/>
+          <Select
+            style="width: 140px"
+            :options="selectLists"
+            size="small"
+            placeholder="请选择"
+            v-model:value="selectVal"
+            allowClear
+            @change="changeSelect"
+          />
         </div>
         <!-- 日期组件 -->
         <div class="common-navR-date" v-if="commonTitle == 'datePikers'">
-          <RangePicker size="small" style="width: 100%" :show-time="{ format: 'HH:mm' }" format="YYYY-MM-DD HH:mm"
-            :placeholder="['开始时间', '结束时间']" @change="onChange" @ok="onOk" />
+          <RangePicker
+            size="small"
+            style="width: 100%"
+            :show-time="{ format: 'HH:mm' }"
+            format="YYYY-MM-DD HH:mm"
+            :placeholder="['开始时间', '结束时间']"
+            @change="onChange"
+            @ok="onOk"
+          />
         </div>
         <!-- 开关组件 -->
         <div class="common-navR-switch" v-if="commonTitle == 'switchs'">
@@ -33,7 +50,11 @@
         </div>
       </div>
     </div>
-    <div v-if="contentStyle.contentH != '0px'" class="dane-content" :style="{ height: contentStyle.contentH }">
+    <div
+      v-if="contentStyle.contentH != '0px'"
+      class="dane-content"
+      :style="{ height: contentStyle.contentH }"
+    >
       <div class="t-line"></div>
       <slot></slot>
     </div>
@@ -41,303 +62,301 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, defineProps, watch,defineEmits } from 'vue';
-import { Select, RangePicker, Switch } from 'ant-design-vue';
-import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons-vue';
-
-let props = defineProps({
-  //标题
-  moduleName: {
-    type: String,
-    default: '',
-  },
-  //样式
-  contentStyle: {
-    type: Object,
-    default: () => {
-      return {
-        contentH: '0px',
-      };
+  import { ref, reactive, defineProps, watch, defineEmits } from 'vue';
+  import { Select, RangePicker, Switch } from 'ant-design-vue';
+  import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons-vue';
+
+  let props = defineProps({
+    //标题
+    moduleName: {
+      type: String,
+      default: '',
     },
-  },
-
-  commonTitle: {
-    type: String,
-    default: '',
-  },
-  //下拉列表数据
-  selectList: {
-    type: Array,
-    default: () => {
-      return [];
+    //样式
+    contentStyle: {
+      type: Object,
+      default: () => {
+        return {
+          contentH: '0px',
+        };
+      },
     },
-  },
-  moduleSelect: {
-    type: Array,
-    default: () => {
-      return [];
+
+    commonTitle: {
+      type: String,
+      default: '',
     },
-  },
-  selectValue:{
-    type:String,
-    default:()=>{
-      return ''
-    }
+    //下拉列表数据
+    selectList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    moduleSelect: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    selectValue: {
+      type: String,
+      default: () => {
+        return '';
+      },
+    },
+  });
+  const emit = defineEmits(['changeSelect']);
+
+  let moduleNames = ref('');
+  let selectVal = ref('');
+  let selectLists = ref<any[]>([]);
+
+  let checked = ref(false);
+
+  let moduleIndex = ref(false);
+
+  let moduleSelects = ref<any[]>([]);
+
+  //模块选项弹窗状态切换
+  function toggleModule() {
+    moduleIndex.value = !moduleIndex.value;
   }
-});
-const emit = defineEmits(['changeSelect']);
-
-let moduleNames = ref('');
-let selectVal = ref('');
-let selectLists = ref<any[]>([]);
-
-let checked = ref(false);
-
-let moduleIndex = ref(false);
-
-let moduleSelects = ref<any[]>([]);
-
-//模块选项弹窗状态切换
-function toggleModule() {
-  moduleIndex.value = !moduleIndex.value;
-}
-//切换模块选项名称
-function toggleModuleName(item) {
-  moduleNames.value = item.label;
-  moduleIndex.value = false;
-}
-
-//切换时间选项
-function onChange(value, dateString) {
-  console.log('Selected Time: ', value);
-  console.log('Formatted Selected Time: ', dateString);
-}
-function onOk(val) {
-  console.log('onOk: ', val);
-}
-
-//下拉框选项切换
-function changeSelect(val){
-  console.log(val,moduleNames, '下拉框选项切换---')
-  emit('changeSelect', {label:moduleNames.value,value:val})
-}
-
-watch(
-  () => props.selectList,
-  (newV, oldV) => {
-    console.log(newV, '下拉列表------');
-    if (newV.length != 0) {
-      selectLists.value = newV;
-      console.log(selectLists.value, '====----')
-      selectVal.value = props.selectValue
-    }
-  },
-  { immediate: true, deep: true },
-);
-watch(
-  () => props.moduleName,
-  (newM, oldM) => {
-    moduleNames.value = newM;
-  },
-  { immediate: true },
-);
-watch(
-  () => props.moduleSelect,
-  (newS, oldS) => {
-    console.log(newS, 'newS--------');
-    moduleSelects.value = newS;
-  },
-  { immediate: true, deep: true },
-);
+  //切换模块选项名称
+  function toggleModuleName(item) {
+    moduleNames.value = item.label;
+    moduleIndex.value = false;
+  }
+
+  //切换时间选项
+  function onChange(value, dateString) {
+    console.log('Selected Time: ', value);
+    console.log('Formatted Selected Time: ', dateString);
+  }
+  function onOk(val) {
+    console.log('onOk: ', val);
+  }
+
+  //下拉框选项切换
+  function changeSelect(val) {
+    console.log(val, moduleNames, '下拉框选项切换---');
+    emit('changeSelect', { label: moduleNames.value, value: val });
+  }
+
+  watch(
+    () => props.selectList,
+    (newV, oldV) => {
+      console.log(newV, '下拉列表------');
+      if (newV.length != 0) {
+        selectLists.value = newV;
+        console.log(selectLists.value, '====----');
+        selectVal.value = props.selectValue;
+      }
+    },
+    { immediate: true, deep: true },
+  );
+  watch(
+    () => props.moduleName,
+    (newM, oldM) => {
+      moduleNames.value = newM;
+    },
+    { immediate: true },
+  );
+  watch(
+    () => props.moduleSelect,
+    (newS, oldS) => {
+      console.log(newS, 'newS--------');
+      moduleSelects.value = newS;
+    },
+    { immediate: true, deep: true },
+  );
 </script>
 
 <style scoped lang="less">
-.dane-bd {
-  position: relative;
-  width: 100%;
-  height: 100%;
-
-  .dane-title {
-    display: flex;
-    box-sizing: border-box;
-    align-items: center;
-    justify-content: space-between;
+  .dane-bd {
+    position: relative;
     width: 100%;
-    // height: 43px;
-    height: 32px;
-    padding: 0 10px;
-    background: url('../../../assets/images/fire/firehome/title-1.png') no-repeat center;
-    background-size: 100% 100%;
+    height: 100%;
 
-    .common-navL {
+    .dane-title {
       display: flex;
-      position: relative;
+      box-sizing: border-box;
       align-items: center;
-      width: 70%;
+      justify-content: space-between;
+      width: 100%;
+      // height: 43px;
+      height: 32px;
+      padding: 0 10px;
+      background: url('../../../assets/images/fire/firehome/title-1.png') no-repeat center;
+      background-size: 100% 100%;
+
+      .common-navL {
+        display: flex;
+        position: relative;
+        align-items: center;
+        width: 70%;
 
-      img {
-        width: 18px;
-        height: 18px;
+        img {
+          width: 18px;
+          height: 18px;
+        }
+
+        span {
+          margin-left: 10px;
+          color: #a1dff8;
+          font-size: 16px;
+        }
       }
 
-      span {
-        margin-left: 10px;
-        color: #a1dff8;
-        font-size: 16px;
+      .common-navL1 {
+        display: flex;
+        position: relative;
+        align-items: center;
+        width: 50%;
+
+        img {
+          width: 18px;
+          height: 18px;
+        }
+
+        span {
+          margin-left: 10px;
+          color: #a1dff8;
+          font-size: 16px;
+        }
       }
-    }
 
-    .common-navL1 {
-      display: flex;
-      position: relative;
-      align-items: center;
-      width: 50%;
+      .module-select {
+        display: flex;
+        position: absolute;
+        z-index: 9999;
+        top: 33px;
+        left: 16px;
+        box-sizing: border-box;
+        flex-direction: column;
+        justify-content: flex-start;
+        width: 214px;
+        height: 136px;
+        padding: 10px;
+        overflow-y: auto;
+        border: 1px solid rgb(15 63 88);
+        border-radius: 10px;
+        background-color: #fff;
+
+        .select-box {
+          width: 100%;
+          height: 28px;
+          color: #000;
+          line-height: 28px;
+          text-align: center;
+          cursor: pointer;
+
+          &:hover {
+            background-color: rgb(161 223 248 / 20%);
+          }
+        }
+      }
 
-      img {
-        width: 18px;
-        height: 18px;
+      .common-navR {
+        display: flex;
+        align-items: center;
+        justify-content: flex-end;
+        width: 30%;
       }
 
-      span {
-        margin-left: 10px;
-        color: #a1dff8;
-        font-size: 16px;
+      .common-navR1 {
+        display: flex;
+        align-items: center;
+        justify-content: flex-end;
+        width: 50%;
+      }
+
+      .common-navR-switch {
+        display: flex;
+        align-items: center;
+        justify-content: space-around;
+        width: 90%;
+
+        .status-text {
+          color: #1fb3f7;
+          font-size: 14px;
+        }
+
+        .status-text1 {
+          color: #a1dff8;
+          font-size: 14px;
+        }
       }
     }
 
-    .module-select {
-      display: flex;
-      position: absolute;
-      z-index: 9999;
-      top: 33px;
-      left: 16px;
+    .dane-content {
+      position: relative;
       box-sizing: border-box;
-      flex-direction: column;
-      justify-content: flex-start;
-      width: 214px;
-      height: 136px;
+      width: 100%;
       padding: 10px;
-      overflow-y: auto;
-      border: 1px solid rgb(15 63 88);
-      border-radius: 10px;
-      background-color: #fff;
+      background: url('../../../assets/images/fire/firehome/title-3.png') no-repeat center;
+      background-size: 100% 100%;
 
-      .select-box {
+      .t-line {
+        position: absolute;
+        top: 0;
+        left: 0;
         width: 100%;
-        height: 28px;
-        color: #000;
-        line-height: 28px;
-        text-align: center;
-        cursor: pointer;
-
-        &:hover {
-          background-color: rgb(161 223 248 / 20%);
-        }
+        padding: 10px 15px;
+        background: url('../../../assets/images/fire/firehome/title-4.png') no-repeat center;
+        background-size: 100% 100%;
       }
     }
+  }
 
-    .common-navR {
-      display: flex;
-      align-items: center;
-      justify-content: flex-end;
-      width: 30%;
-    }
+  :deep(.vMonitor-select-selector) {
+    height: 22px !important;
+    border: none !important;
+    background-color: rgb(15 64 88) !important;
+    color: #a1dff8 !important;
+  }
 
-    .common-navR1 {
-      display: flex;
-      align-items: center;
-      justify-content: flex-end;
-      width: 50%;
-    }
+  :deep(.vMonitor-select-selection-placeholder) {
+    color: #a1dff8 !important;
+  }
 
-    .common-navR-switch {
-      display: flex;
-      align-items: center;
-      justify-content: space-around;
-      width: 90%;
+  :deep(.vMonitor-select-arrow) {
+    color: #a1dff8 !important;
+  }
 
-      .status-text {
-        color: #1fb3f7;
-        font-size: 14px;
-      }
+  :deep(.vMonitor-picker) {
+    border: none !important;
+    background-color: rgb(15 64 88) !important;
+    box-shadow: none;
+    color: #a1dff8 !important;
+  }
 
-      .status-text1 {
-        color: #a1dff8;
-        font-size: 14px;
-      }
-    }
+  :deep(.vMonitor-picker-input > input) {
+    color: #a1dff8 !important;
+    text-align: center !important;
   }
 
-  .dane-content {
-    position: relative;
-    box-sizing: border-box;
-    width: 100%;
-    padding: 10px;
-    background: url('../../../assets/images/fire/firehome/title-3.png') no-repeat center;
-    background-size: 100% 100%;
-
-    .t-line {
-      position: absolute;
-      top: 0;
-      left: 0;
-      width: 100%;
-      padding: 10px 15px;
-      background: url('../../../assets/images/fire/firehome/title-4.png') no-repeat center;
-      background-size: 100% 100%;
+  :deep(.vMonitor-picker-separator) {
+    color: #a1dff8 !important;
+  }
 
+  :deep(.vMonitor-picker-active-bar) {
+    display: none !important;
+  }
 
-    }
+  :deep(.vMonitor-picker-suffix) {
+    color: #a1dff8 !important;
+  }
+
+  :deep(.vMonitor-switch) {
+    min-width: 48px !important;
+  }
+
+  :deep(.vMonitor-switch-checked) {
+    background-color: rgb(15 64 89) !important;
+  }
+
+  :deep(.vMonitor-switch-handle::before) {
+    background-color: rgb(33 179 247) !important;
   }
-}
-
-:deep(.vMonitor-select-selector) {
-  height: 22px !important;
-  border: none !important;
-  background-color: rgb(15 64 88) !important;
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-select-selection-placeholder) {
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-select-arrow) {
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-picker) {
-  border: none !important;
-  background-color: rgb(15 64 88) !important;
-  box-shadow: none;
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-picker-input > input) {
-  color: #a1dff8 !important;
-  text-align: center !important;
-}
-
-:deep(.vMonitor-picker-separator) {
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-picker-active-bar) {
-  display: none !important;
-}
-
-:deep(.vMonitor-picker-suffix) {
-  color: #a1dff8 !important;
-}
-
-:deep(.vMonitor-switch) {
-  min-width: 48px !important;
-}
-
-:deep(.vMonitor-switch-checked) {
-  background-color: rgb(15 64 89) !important;
-}
-
-:deep(.vMonitor-switch-handle::before) {
-  background-color: rgb(33 179 247) !important;
-}
 </style>