Browse Source

隐患排查统计

yanghao 1 tuần trước cách đây
mục cha
commit
37d90c1caf

+ 14 - 3
src/config/axios/index.ts

@@ -4,16 +4,27 @@ import { config } from './config'
 
 const { default_headers } = config
 
+const DEFAULT_LANG = 'zh-CN'
+
+const getRequestLang = () => {
+  try {
+    const langStore = JSON.parse(localStorage.getItem('lang') || '{}')
+    const lang = typeof langStore === 'string' ? langStore : langStore?.v
+
+    return typeof lang === 'string' && lang ? lang.replace(/"/g, '') : DEFAULT_LANG
+  } catch {
+    return DEFAULT_LANG
+  }
+}
+
 const request = (option: any) => {
   const { headersType, headers, ...otherOption } = option
 
-  const langStore = JSON.parse(localStorage.getItem('lang') || '{}')
-
   return service({
     ...otherOption,
     headers: {
       'Content-Type': headersType || default_headers,
-      Lang: langStore.v.replace(/"/g, ''),
+      Lang: getRequestLang(),
       ...headers
     }
   })

+ 10 - 4
src/layout/components/Menu/src/components/useRenderMenuItem.tsx

@@ -14,7 +14,7 @@ export const useRenderMenuItem = () =>
     const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
       return routers
         .filter((v) => {
-          console.log('v', v.path)
+          // console.log('v', v.path)
           if (currentSource === 'zhly') {
             return (
               (!v.meta?.hidden &&
@@ -44,17 +44,23 @@ export const useRenderMenuItem = () =>
               !v.meta?.hidden &&
               [
                 'QHSE',
+                'QHSE看板',
                 '计量器具',
-                '仪器检测',
                 '台账管理',
+                '仪器检测',
+                '使用记录',
                 '证书管理',
                 '危险源辨识',
-                '环境因素识别',
                 '事故事件上报',
+                '环境因素识别',
                 '隐患排查',
+                '隐患排查分类',
+                '隐患排查记录',
+                'SOC管理',
                 'SOC卡分析数据源',
                 'SOC卡汇总',
-                'JSA'
+                'JSA',
+                'PTW'
               ].includes(v.meta?.title)
             )
           } else if (currentSource === 'yyhy') {

+ 1 - 1
src/views/Home/Index.vue

@@ -7,7 +7,7 @@ import hsafe from './kb/hsafe.vue'
 import hdeviceStatus from './kb/hdeviceStatus.vue'
 import horderTrend from './kb/horderTrend.vue'
 
-const company = ref('首页123')
+const company = ref('首页')
 
 const wrapperRef = ref<HTMLDivElement>()
 const scale = ref(1)

+ 7 - 13
src/views/Login/Login.vue

@@ -1,12 +1,10 @@
 <template>
   <div
     :class="prefixCls"
-    class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px"
-  >
+    class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px">
     <div class="relative mx-auto h-full flex">
       <div
-        :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden overflow-x-hidden overflow-y-auto`"
-      >
+        :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden overflow-x-hidden overflow-y-auto`">
         <!-- 左上角的 logo + 系统标题 -->
         <div class="relative flex items-center text-white">
           <img alt="" class="mr-10px h-48px w-48px" src="@/assets/imgs/logo.png" />
@@ -17,8 +15,7 @@
           <TransitionGroup
             appear
             enter-active-class="animate__animated animate__bounceInLeft"
-            tag="div"
-          >
+            tag="div">
             <!--            <img key="1" alt="" class="w-350px" src="@/assets/svgs/login-box-bg.svg" />-->
             <!--            <img key="1" alt="" class="w-350px" src="@/assets/imgs/yf.jpg" />-->
             <!--            <div key="2" class="text-3xl text-white">{{ t('login.welcome') }}</div>-->
@@ -29,13 +26,11 @@
         </div>
       </div>
       <div
-        class="relative flex-1 p-30px dark:bg-[var(--login-bg-color)] lt-sm:p-10px overflow-x-hidden overflow-y-auto"
-      >
+        class="relative flex-1 p-30px dark:bg-[var(--login-bg-color)] lt-sm:p-10px overflow-x-hidden overflow-y-auto">
         <!-- 右上角的主题、语言选择 -->
         <div
           class="flex items-center justify-between at-2xl:justify-end at-xl:justify-end"
-          style="color: var(--el-text-color-primary)"
-        >
+          style="color: var(--el-text-color-primary)">
           <div class="flex items-center at-2xl:hidden at-xl:hidden">
             <img alt="" class="mr-10px h-48px w-48px" src="@/assets/imgs/logo.png" />
             <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
@@ -48,8 +43,7 @@
         <!-- 右边的登录界面 -->
         <Transition appear enter-active-class="animate__animated animate__bounceInRight">
           <div
-            class="m-auto h-[calc(100%-60px)] w-[100%] flex items-center 2xl:max-w-500px lg:max-w-500px md:max-w-500px xl:max-w-500px"
-          >
+            class="m-auto h-[calc(100%-60px)] w-[100%] flex items-center 2xl:max-w-500px lg:max-w-500px md:max-w-500px xl:max-w-500px">
             <!-- 账号登录 -->
             <LoginForm class="m-auto h-auto p-20px lt-xl:(rounded-3xl light:bg-white)" />
             <!-- 手机登录 -->
@@ -152,7 +146,7 @@ async function loginWithDingTalk() {
           window.location.href = window.location.href.replace('/login?redirect=', '')
         } else {
           router.push({ path: redirect.value || permissionStore.addRouters[0].path }).then(() => {
-            loading.value.close()
+            loading.value?.close()
           })
         }
       })

+ 14 - 27
src/views/Login/SocialLogin.vue

@@ -1,12 +1,10 @@
 <template>
   <div
     :class="prefixCls"
-    class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px"
-  >
+    class="relative h-[100%] lt-md:px-10px lt-sm:px-10px lt-xl:px-10px lt-xl:px-10px">
     <div class="relative mx-auto h-full flex">
       <div
-        :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden overflow-x-hidden overflow-y-auto`"
-      >
+        :class="`${prefixCls}__left flex-1 bg-gray-500 bg-opacity-20 relative p-30px lt-xl:hidden overflow-x-hidden overflow-y-auto`">
         <!-- 左上角的 logo + 系统标题 -->
         <div class="relative flex items-center text-white">
           <img alt="" class="mr-10px h-48px w-48px" src="@/assets/imgs/logo.png" />
@@ -17,8 +15,7 @@
           <TransitionGroup
             appear
             enter-active-class="animate__animated animate__bounceInLeft"
-            tag="div"
-          >
+            tag="div">
             <img key="1" alt="" class="w-350px" src="@/assets/svgs/login-box-bg.svg" />
             <div key="2" class="text-3xl text-white">{{ t('login.welcome') }}</div>
             <div key="3" class="mt-5 text-14px font-normal text-white">
@@ -28,12 +25,10 @@
         </div>
       </div>
       <div
-        class="relative flex-1 p-30px dark:bg-[var(--login-bg-color)] lt-sm:p-10px overflow-x-hidden overflow-y-auto"
-      >
+        class="relative flex-1 p-30px dark:bg-[var(--login-bg-color)] lt-sm:p-10px overflow-x-hidden overflow-y-auto">
         <!-- 右上角的主题、语言选择 -->
         <div
-          class="flex items-center justify-between text-white at-2xl:justify-end at-xl:justify-end"
-        >
+          class="flex items-center justify-between text-white at-2xl:justify-end at-xl:justify-end">
           <div class="flex items-center at-2xl:hidden at-xl:hidden">
             <img alt="" class="mr-10px h-48px w-48px" src="@/assets/imgs/logo.png" />
             <span class="text-20px font-bold">{{ underlineToHump(appStore.getTitle) }}</span>
@@ -46,8 +41,7 @@
         <!-- 右边的登录界面 -->
         <Transition appear enter-active-class="animate__animated animate__bounceInRight">
           <div
-            class="m-auto h-[calc(100%-60px)] w-[100%] flex items-center at-2xl:max-w-500px at-lg:max-w-500px at-md:max-w-500px at-xl:max-w-500px"
-          >
+            class="m-auto h-[calc(100%-60px)] w-[100%] flex items-center at-2xl:max-w-500px at-lg:max-w-500px at-md:max-w-500px at-xl:max-w-500px">
             <!-- 账号登录 -->
             <el-form
               v-show="getShow"
@@ -57,8 +51,7 @@
               class="login-form"
               label-position="top"
               label-width="120px"
-              size="large"
-            >
+              size="large">
               <el-row style="margin-right: -10px; margin-left: -10px">
                 <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
                   <el-form-item>
@@ -72,8 +65,7 @@
                       :placeholder="t('login.tenantNamePlaceholder')"
                       :prefix-icon="iconHouse"
                       link
-                      type="primary"
-                    />
+                      type="primary" />
                   </el-form-item>
                 </el-col>
                 <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -81,8 +73,7 @@
                     <el-input
                       v-model="loginData.loginForm.username"
                       :placeholder="t('login.usernamePlaceholder')"
-                      :prefix-icon="iconAvatar"
-                    />
+                      :prefix-icon="iconAvatar" />
                   </el-form-item>
                 </el-col>
                 <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -93,8 +84,7 @@
                       :prefix-icon="iconLock"
                       show-password
                       type="password"
-                      @keyup.enter="getCode()"
-                    />
+                      @keyup.enter="getCode()" />
                   </el-form-item>
                 </el-col>
                 <el-col
@@ -104,8 +94,7 @@
                     padding-left: 10px;
                     margin-top: -20px;
                     margin-bottom: -20px;
-                  "
-                >
+                  ">
                   <el-form-item>
                     <el-row justify="space-between" style="width: 100%">
                       <el-col :span="6">
@@ -128,8 +117,7 @@
                       :title="t('login.login')"
                       class="w-[100%]"
                       type="primary"
-                      @click="getCode()"
-                    />
+                      @click="getCode()" />
                   </el-form-item>
                 </el-col>
                 <Verify
@@ -138,8 +126,7 @@
                   :captchaType="captchaType"
                   :imgSize="{ width: '400px', height: '200px' }"
                   mode="pop"
-                  @success="handleLogin"
-                />
+                  @success="handleLogin" />
               </el-row>
             </el-form>
           </div>
@@ -313,7 +300,7 @@ const handleLogin = async (params) => {
     }
   } finally {
     loginLoading.value = false
-    loading.value.close()
+    loading.value?.close()
   }
 }
 

+ 9 - 17
src/views/Login/components/LoginForm.vue

@@ -7,8 +7,7 @@
     class="login-form"
     label-position="top"
     label-width="120px"
-    size="large"
-  >
+    size="large">
     <el-row style="margin-right: -10px; margin-left: -10px">
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
         <el-form-item>
@@ -31,8 +30,7 @@
           <el-input
             v-model="loginData.loginForm.username"
             :placeholder="t('login.usernamePlaceholder')"
-            :prefix-icon="iconAvatar"
-          />
+            :prefix-icon="iconAvatar" />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px; margin-top: 15px">
@@ -43,14 +41,12 @@
             :prefix-icon="iconLock"
             show-password
             type="password"
-            @keyup.enter="getCode()"
-          />
+            @keyup.enter="getCode()" />
         </el-form-item>
       </el-col>
       <el-col
         :span="24"
-        style="padding-right: 10px; padding-left: 10px; margin-top: -10px; margin-bottom: -20px"
-      >
+        style="padding-right: 10px; padding-left: 10px; margin-top: -10px; margin-bottom: -20px">
         <el-form-item>
           <el-row justify="space-between" style="width: 100%">
             <el-col :span="6">
@@ -62,8 +58,7 @@
               <el-link
                 style="float: right"
                 type="primary"
-                @click="setLoginState(LoginStateEnum.RESET_PASSWORD)"
-              >
+                @click="setLoginState(LoginStateEnum.RESET_PASSWORD)">
                 {{ t('login.forgetPassword') }}
               </el-link>
             </el-col>
@@ -77,8 +72,7 @@
             :title="t('login.login')"
             class="w-[100%]"
             type="primary"
-            @click="getCode()"
-          />
+            @click="getCode()" />
         </el-form-item>
       </el-col>
       <Verify
@@ -87,8 +81,7 @@
         :captchaType="captchaType"
         :imgSize="{ width: '400px', height: '200px' }"
         mode="pop"
-        @success="handleLogin"
-      />
+        @success="handleLogin" />
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
         <el-form-item>
           <el-row :gutter="5" justify="space-between" style="width: 100%">
@@ -103,8 +96,7 @@
               <XButton
                 :title="t('login.btnQRCode')"
                 class="w-[100%]"
-                @click="setLoginState(LoginStateEnum.QR_CODE)"
-              />
+                @click="setLoginState(LoginStateEnum.QR_CODE)" />
             </el-col>
             <!--            <el-col :span="12">-->
             <!--              <XButton-->
@@ -287,7 +279,7 @@ const handleLogin = async (params: any) => {
     }
   } finally {
     loginLoading.value = false
-    loading.value.close()
+    loading.value?.close()
   }
 }
 

+ 9 - 17
src/views/Login/components/RegisterForm.vue

@@ -7,8 +7,7 @@
     class="login-form"
     label-position="top"
     label-width="120px"
-    size="large"
-  >
+    size="large">
     <el-row style="margin-right: -10px; margin-left: -10px">
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
         <el-form-item>
@@ -23,8 +22,7 @@
             :prefix-icon="iconHouse"
             link
             type="primary"
-            size="large"
-          />
+            size="large" />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -33,8 +31,7 @@
             v-model="registerData.registerForm.username"
             :placeholder="t('login.username')"
             size="large"
-            :prefix-icon="iconAvatar"
-          />
+            :prefix-icon="iconAvatar" />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -43,8 +40,7 @@
             v-model="registerData.registerForm.nickname"
             placeholder="昵称"
             size="large"
-            :prefix-icon="iconAvatar"
-          />
+            :prefix-icon="iconAvatar" />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -56,8 +52,7 @@
             :placeholder="t('login.password')"
             size="large"
             :prefix-icon="iconLock"
-            show-password
-          />
+            show-password />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -69,8 +64,7 @@
             auto-complete="off"
             :placeholder="t('login.checkPassword')"
             :prefix-icon="iconLock"
-            show-password
-          />
+            show-password />
         </el-form-item>
       </el-col>
       <el-col :span="24" style="padding-right: 10px; padding-left: 10px">
@@ -80,8 +74,7 @@
             :title="t('login.register')"
             class="w-[100%]"
             type="primary"
-            @click="getCode()"
-          />
+            @click="getCode()" />
         </el-form-item>
       </el-col>
       <Verify
@@ -90,8 +83,7 @@
         :captchaType="captchaType"
         :imgSize="{ width: '400px', height: '200px' }"
         mode="pop"
-        @success="handleRegister"
-      />
+        @success="handleRegister" />
     </el-row>
     <XButton :title="t('login.hasUser')" class="w-[100%]" @click="handleBackLogin()" />
   </el-form>
@@ -207,7 +199,7 @@ const handleRegister = async (params: any) => {
     }
   } finally {
     loginLoading.value = false
-    loading.value.close()
+    loading.value?.close()
   }
 }