zjk
2026-07-31 8665daa7aa863f96d0d8f27c167edae1efc38022
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 集群版对接中台时仍允许本地维护的页面:账号管理、系统配置、首页、操作日志。
const localModulePaths = [
  '/index',
  '/visitor/dashboard',
  '/visitor/account',
  '/visitor/system/config',
  '/visitor/record/operation-log'
]
 
export default {
  computed: {
    // 目的:读取集群版对接中台开关,供页面统一判断运行模式。
    isMiddlePlatformMode() {
      return this.$store.getters.middlePlatformEnabled
    },
    // 目的:判断当前路由是否进入中台只读态,白名单页面仍允许本地维护。
    isMiddlePlatformReadonly() {
      if (!this.isMiddlePlatformMode || !this.$route) {
        return false
      }
      // 非白名单页面进入只读态,页面层隐藏写操作,后端拦截器负责兜底防绕过。
      return !localModulePaths.some(path => this.$route.path === path || this.$route.path.indexOf(path + '/') === 0)
    }
  },
  methods: {
    // 目的:提示中台只读限制,作为隐藏按钮之外的统一兜底反馈。
    denyMiddlePlatformWrite(message) {
      this.$modal.msgWarning(message || '集群版对接中台时,当前模块仅支持查询和导出')
    }
  }
}