Browse Source

fix keepalive

scorpio 2 năm trước cách đây
mục cha
commit
ba67d544f9

+ 28 - 7
src/App.vue

@@ -1,10 +1,15 @@
 <template>
-  <div id="app" class="flex flex-center">
-    <router-view v-slot="{ Component, route }">
-      <keep-alive :include="keepAlive.list">
-        <component :is="Component" :key="route.fullPath" />
-      </keep-alive>
-    </router-view>
+  <div id="app" class="flex flex-center flex-col">
+    <el-main class="single">
+      <div class="wrapper mt-20" v-if="$route.meta.layout === 'empty'">
+        <tips />
+      </div>
+      <router-view v-slot="{ Component, route }">
+        <keep-alive :include="keepAlive.list">
+          <component :is="Component" :key="route.fullPath" />
+        </keep-alive>
+      </router-view>
+    </el-main>
   </div>
 </template>
 
@@ -13,8 +18,12 @@
 // Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
 
 import keepAliveStore from '@/store/keepAlive.js'
+import top from '@/layout/top.vue'
+import router from './router/index.js'
+import tips from '@/layout/tips.vue'
 
 export default {
+  components: { tips, top },
   setup() {
     const keepAlive = keepAliveStore()
     return { keepAlive }
@@ -37,6 +46,7 @@ export default {
     window.addEventListener('scroll', this.menu)
   },
   methods: {
+    router,
     menu() {
       const scroll =
         document.documentElement.scrollTop || document.body.scrollTop
@@ -46,8 +56,19 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 #app {
   background-color: #f6f7f8;
+  overflow: hidden;
+  .single {
+    height: 100%;
+  }
+}
+:deep(.el-main) {
+  --el-main-padding: 0 !important;
+  padding: 0 !important;
+}
+:deep(.el-header) {
+  padding: 0 !important;
 }
 </style>

+ 12 - 6
src/layout/index.vue

@@ -1,11 +1,14 @@
 <template>
-  <div class="full-screen flex flex-justify-start" @scroll="scroll">
+  <div class="flex flex-justify-start full-screen" @scroll="scroll">
     <el-container>
       <el-header class="header">
         <top @openMenu="show = true" />
       </el-header>
       <div class="flex" style="background-color: #f6f7f8">
-        <el-aside style="width: 200px; position: fixed; left: 0" v-if="!mini">
+        <el-aside
+          style="width: 200px; position: fixed; left: 20px"
+          v-if="!mini"
+        >
           <left />
         </el-aside>
         <el-main class="wt-main hide-scrollbar">
@@ -33,7 +36,7 @@
               </div>
             </div>
           </el-popover>
-          <div class="wrapper mb-20">
+          <div class="wrapper">
             <tips />
           </div>
           <div class="wrapper" @scroll="scroll">
@@ -139,8 +142,7 @@ export default {
 
 .wt-main {
   background-color: #f6f7f8;
-  overflow-x: scroll;
-  padding: 20px 0;
+  overflow-x: hidden;
   .mp {
     top: 200px;
     right: 0;
@@ -157,7 +159,7 @@ export default {
   width: 140px;
 }
 .content {
-  overflow-x: scroll;
+  overflow-y: scroll;
   height: calc(100vh - 80px);
 }
 
@@ -165,6 +167,10 @@ export default {
   position: fixed;
 }
 
+:deep(.el-header) {
+  --el-header-height: 80px !important;
+}
+
 :deep(.el-drawer) {
   --el-drawer-bg-color: #f6f7f8;
 }

+ 2 - 2
src/layout/tips.vue

@@ -1,7 +1,7 @@
 \
 <template>
   <div class="full-width flex flex-col">
-    <div class="full-width flex flex-center flex-justify-between">
+    <div class="full-width flex flex-center flex-justify-between mb-20">
       <div class="flex flex-center">
         <el-button
           type="primary"
@@ -33,7 +33,7 @@
       </el-tooltip>
     </div>
     <div
-      class="full-width mt-20"
+      class="full-width mb-20"
       v-if="nav.menus[nav.menus.length - 1].meta.showMsg !== undefined"
     >
       <el-card shadow="hover" style="background-color: #e2eaf5">

+ 9 - 2
src/layout/top.vue

@@ -12,7 +12,7 @@
             circle
             color="#C1C4CB"
             @click="openMenu"
-            v-if="mini"
+            v-if="mini && showMenu"
           />
           <router-link to="/">
             <div class="flex flex-center">
@@ -79,6 +79,12 @@ export default {
     const permission = permissionStore()
     return { nav, user, permission }
   },
+  props: {
+    showMenu: {
+      type: Boolean,
+      default: true
+    }
+  },
   data() {
     return {
       dataType: 'project',
@@ -274,7 +280,7 @@ export default {
 <style lang="scss" scoped>
 .top {
   height: 60px;
-  z-index: 999;
+  z-index: 22;
   top: 0;
   left: 0;
   right: 0;
@@ -316,6 +322,7 @@ export default {
   background: white;
   color: black;
 }
+
 :deep(.el-icon) {
   --color: white !important;
 }

+ 10 - 8
src/views/home/component/dash.vue

@@ -67,14 +67,16 @@
           title="项目结转"
           @click="projectCarry"
         />
-        <base-button
-          class="ml-20 mt-20"
-          type="0"
-          icon="el-icon-folder-checked"
-          title="入库申报"
-          v-if="dataType === 'asset'"
-          @click="projectCarry"
-        />
+        <el-tooltip content="申报的项目必须为已入库并且已经上报的项目">
+          <base-button
+            class="ml-20 mt-20"
+            type="0"
+            icon="el-icon-folder-checked"
+            title="入库申报"
+            v-if="dataType === 'asset'"
+            @click="projectCarry"
+          />
+        </el-tooltip>
       </div>
     </div>
     <avue-crud

+ 4 - 1
src/views/store/detail.vue

@@ -35,7 +35,10 @@
 
 <route>
 {
-name: '项目入库信息'
+name: '项目入库信息',
+meta: {
+  'layout': 'empty'
+  }
 }
 </route>
 

+ 12 - 6
src/views/store/index.vue

@@ -1,13 +1,19 @@
 <template>
-  <el-card shadow="hover">
+  <el-card shadow="hover" class="wrapper">
     <div class="flex flex-center">
       <el-input
         v-model="keyword"
         placeholder="快速搜索"
         prefix-icon="Search"
       ></el-input>
-      <el-button type="primary" class="ml-20">搜 索</el-button>
+      <el-button
+        type="primary"
+        class="ml-20"
+        @click="$router.push('/store/detail')"
+        >搜 索</el-button
+      >
     </div>
+
     <div class="flex flex-justify-start flex-align-start content">
       <avue-crud
         :option="option"
@@ -32,14 +38,14 @@
 </template>
 
 <route>
-{
-name: '入库项目'
-}
+  {
+    name: '入库项目',
+    meta: { 'showMsg' : "填写了”项目实际入库时间“的项目将不在预审管理中显示"}
+  }
 </route>
 
 <script>
 export default {
-  name: 'index',
   data() {
     return {
       keyword: '',

+ 2 - 2
vite.config.js

@@ -57,9 +57,9 @@ export default defineConfig({
     proxy: {
       '/api': {
         // 正式环境地址
-        target: 'https://dev.wutongresearch.club/api',
+        // target: 'https://dev.wutongresearch.club/api',
         // target: 'https://prod.wutongshucloud.com/api',
-        // target: 'http://192.168.31.181:8110',
+        target: 'http://192.168.31.181:8110',
         changeOrigin: true,
         rewrite: path => path.replace(/^\/api/, '')
       }