Prechádzať zdrojové kódy

开发账号增加清除缓存功能按钮

cfort 2 rokov pred
rodič
commit
6645ddb4ca

+ 58 - 0
src/api/platform/system/cache.js

@@ -0,0 +1,58 @@
+import request from '@/utils/request'
+import { PLATFORM_URL, FORM_URL, OAUTH2_URL } from '@/api/baseUrl'
+
+/**
+ * 清除平台缓存
+ * @param {*} params
+ */
+// export function cleanPlatformCache(params) {
+export const cleanPlatformCache = (params) => {
+    return request({
+        url: PLATFORM_URL() + '/platform/cache/system/flushAll',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}
+
+/**
+ * 清除表单缓存
+ * @param {*} params
+ */
+// export function cleanFormCache(params) {
+export const cleanFormCache = (params) => {
+    return request({
+        url: FORM_URL() + '/form/cache/system/flushAll',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}
+
+/**
+ * 清除认证缓存
+ * @param {*} params
+ */
+// export function cleanOauthCache(params) {
+export const cleanOauthCache = (params) => {
+    return request({
+        url: OAUTH2_URL() + '/oauth/cache/system/flushAll',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}
+
+/**
+ * 清除办公缓存
+ * @param {*} params
+ */
+// export function cleanOfficeCache(params) {
+export const cleanOfficeCache = (params) => {
+    return request({
+        url: FORM_URL() + '/office/cache/system/flushAll',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
+}

+ 3 - 3
src/business/platform/file/attachment/index.vue

@@ -190,7 +190,7 @@ export default {
         }
     },
     data () {
-        console.log(this.value)
+        // console.log(this.value)
         return {
             fileList: [],
             targetExt: false,
@@ -358,8 +358,8 @@ export default {
         },
         updateSort ({ to, from, item, clone, oldIndex, newlndex }) {
             // console.log(to, from, item, clone, oldIndex, newlndex)
-            console.log(this.value)
-            console.log(this.sortList)
+            // console.log(this.value)
+            // console.log(this.sortList)
         }
     }
 }

+ 56 - 0
src/layout/header-aside/components/header-clean-cache/index.vue

@@ -0,0 +1,56 @@
+
+<template>
+    <el-tooltip effect="dark" :content="cache[type] ? `清除${cache[type].name }缓存`: ''" placement="bottom">
+        <el-button type="text" class="ibps-mr btn-text can-hover" @click="cleanCache()">
+            <ibps-icon :name="cache[type] ? cache[type].icon : 'drupail'" style="font-size: 18px;" />
+        </el-button>
+    </el-tooltip>
+</template>
+<script>
+    import { cleanFormCache, cleanPlatformCache, cleanOauthCache, cleanOfficeCache } from '@/api/platform/system/cache'
+    const cache = {
+        platform: {
+            name: '平台',
+            api: cleanPlatformCache,
+            icon: 'eercast'
+        },
+        form: {
+            name: '表单',
+            api: cleanFormCache,
+            icon: 'connectdevelop'
+        },
+        oauth: {
+            name: '认证',
+            api: cleanOauthCache,
+            icon: 'empire'
+        },
+        office: {
+            name: '办公',
+            api: cleanOfficeCache,
+            icon: 'drupail'
+        }
+    }
+    export default {
+        props: {
+            type: {
+                type: String,
+                default: ''
+            }
+        },
+        data () {
+            return {
+                cache
+            }
+        },
+        methods: {
+            cleanCache () {
+                if (!this.type || !this.cache[this.type] || !this.cache[this.type].api) {
+                    return
+                }
+                this.cache[this.type].api().then(() => {
+                    this.$message.success(`清除${this.cache[this.type].name}缓存成功!`)
+                })
+            }
+        }
+    }
+</script>

+ 10 - 2
src/layout/header-aside/layout.vue

@@ -94,6 +94,9 @@
                     <ibps-header-fullscreen />
                     <ibps-header-tenant /> -->
 
+                    <ibps-header-clean-cache v-if="isSuper && account === 'jinyuan'" type="platform" />
+                    <ibps-header-clean-cache v-if="isSuper && account === 'jinyuan'" type="form"/>
+
                     <span style="font-size: 12px; cursor: pointer;" @click="goToMain()">首页</span>
                     <span style="margin: 0 10px;">|</span>
                     <ibps-header-message />
@@ -192,6 +195,7 @@
     import IbpsHeaderUser from './components/header-user'
     import IbpsHeaderErrorLog from './components/header-error-log'
     import IbpsHeaderBaseUrl from './components/header-base-url'
+    import IbpsHeaderCleanCache from './components/header-clean-cache'
     // import IbpsHeaderDownload from './components/header-download'
     // import IbpsNotifyMonitor from '@/business/platform/socket/notify-monitor'
     import { mapState, mapGetters, mapActions } from 'vuex'
@@ -220,17 +224,21 @@
             IbpsHeaderMessage,
             IbpsHeaderUser,
             IbpsHeaderErrorLog,
-            IbpsHeaderBaseUrl
+            IbpsHeaderBaseUrl,
+            IbpsHeaderCleanCache
             // IbpsHeaderDownload,
             // IbpsNotifyMonitor
         },
         mixins: [mixinSearch, mixinLock],
         data() {
+            const {isSuper, account} = this.$store.getters
             return {
                 // [侧边栏宽度] 正常状态
                 asideWidth: '200px',
                 // [侧边栏宽度] 折叠状态
-                asideWidthCollapse: '65px'
+                asideWidthCollapse: '65px',
+                isSuper,
+                account
             }
         },
         // watch: {