1
Surpriseplus
2022-10-10 a6ad430fbe12bd634304abbca659605c32df348c
src/components/navMenu.vue
@@ -16,54 +16,127 @@
          @close="handleClose"
          @select="handleselect"
        >
          <el-submenu index="3" class="faSub">
            <template slot="title">
              <span>{{ $t('synthesis.synthesis') }}</span>
            </template>
            <el-menu-item index="Synthesis">{{
              $t('synthesis.synthesis')
            }}</el-menu-item>
            <el-menu-item index="Thematic">{{
              $t('synthesis.themaic')
            }}</el-menu-item>
            <el-menu-item index="Archive">{{
              $t('synthesis.archive')
            }}</el-menu-item>
          </el-submenu>
          <el-submenu index="1" class="faSub">
            <template slot="title">
              <span>{{ $t("common.confirm") }}</span>
              <span>{{ $t('dataManage.dataManage') }}</span>
            </template>
            <el-menu-item index="catalogueManage">目录管理</el-menu-item>
            <el-menu-item index="dataUpdata">数据上传</el-menu-item>
            <el-menu-item index="metadataManage">元数据管理</el-menu-item>
            <el-menu-item index="dataLoading">数据入库</el-menu-item>
            <el-menu-item index="SpatialData">空间数据管理</el-menu-item>
            <el-menu-item index="versionManage">版本管理</el-menu-item>
            <el-menu-item index="dictionaryManage">字典管理</el-menu-item>
            <el-menu-item index="styleManage">样式管理</el-menu-item>
            <el-menu-item index="catalogueManage">{{
              $t('dataManage.catalogueManage')
            }}</el-menu-item>
            <el-menu-item index="dataUpdata">{{
              $t('dataManage.dataUpdata')
            }}</el-menu-item>
            <el-menu-item index="metadataManage">{{
              $t('dataManage.metadataManage')
            }}</el-menu-item>
            <el-menu-item index="dataLoading">{{
              $t('dataManage.dataLoading')
            }}</el-menu-item>
            <el-menu-item index="SpatialData">{{
              $t('dataManage.SpatialData')
            }}</el-menu-item>
            <el-menu-item index="versionManage">{{
              $t('dataManage.versionManage')
            }}</el-menu-item>
            <el-menu-item index="dictionaryManage">{{
              $t('dataManage.dictionaryManage')
            }}</el-menu-item>
            <el-menu-item index="styleManage">{{
              $t('dataManage.styleManage')
            }}</el-menu-item>
          </el-submenu>
          <el-submenu index="2" class="faSub">
            <template slot="title">
              <span>运维管理</span>
              <span>{{ $t('operatManage.operatManage') }}</span>
            </template>
            <el-menu-item index="userManagement">用户管理</el-menu-item>
            <el-submenu index="2-2">
              <template slot="title">系统配置</template>
              <el-menu-item index="menuSettings">菜单设置</el-menu-item>
              <el-menu-item index="parameterConfiguration"
                >参数配置</el-menu-item
              >
              <el-menu-item index="rests">其他</el-menu-item>
              <template slot="title">{{
                $t('operatManage.systemLayout')
              }}</template>
              <el-menu-item index="menuSettings">{{
                $t('operatManage.menuSettings')
              }}</el-menu-item>
              <el-menu-item index="parameterConfiguration">{{
                $t('operatManage.parameterConfiguration')
              }}</el-menu-item>
              <el-menu-item index="rests">{{
                $t('operatManage.rests')
              }}</el-menu-item>
            </el-submenu>
            <el-menu-item index="authorityManagement">权限管理</el-menu-item>
            <el-menu-item index="safetyManagement">安全管理</el-menu-item>
            <el-menu-item index="authorityManagement">{{
              $t('operatManage.authorityManagement')
            }}</el-menu-item>
            <el-menu-item index="safetyManagement">{{
              $t('operatManage.safetyManagement')
            }}</el-menu-item>
            <el-submenu index="2-5">
              <template slot="title">运行监控</template>
              <el-menu-item index="systemMonitoring">系统监控</el-menu-item>
              <el-menu-item index="logLog">登录日志</el-menu-item>
              <el-menu-item index="operationLog">操作日志</el-menu-item>
              <!-- <el-menu-item index="databaseMonitoring">数据库监控</el-menu-item> -->
              <template slot="title">{{
                $t('operatManage.operationMonitoring')
              }}</template>
              <el-menu-item index="eventlogManage">{{
                $t('operatManage.ResourceLog')
              }}</el-menu-item>
              <el-menu-item index="logLog">{{
                $t('operatManage.logLog')
              }}</el-menu-item>
              <el-menu-item index="operationLog">{{
                $t('operatManage.operationLog')
              }}</el-menu-item>
              <el-menu-item index="databaseMonitoring">{{
                $t('operatManage.databaseMonitoring')
              }}</el-menu-item>
              <el-menu-item index="systemMonitoring">{{
                $t('operatManage.systemMonitoring')
              }}</el-menu-item>
              <el-menu-item index="blackwhiteList"
                >{{ $t('operatManage.blackwhiteList') }}
              </el-menu-item>
              <el-menu-item index="tokentool">{{
                $t('operatManage.tokentool')
              }}</el-menu-item>
            </el-submenu>
          </el-submenu>
          <el-submenu index="3" class="faSub">
          <el-submenu index="4" class="faSub">
            <template slot="title">
              <span>{{ $t("synthesis.synthesis") }}</span>
              <span>{{ $t('userManage.userManage') }}</span>
            </template>
            <el-menu-item index="Synthesis">{{ $t("synthesis.synthesis") }}</el-menu-item>
            <el-menu-item index="Thematic">{{ $t("synthesis.themaic") }}</el-menu-item>
            <el-menu-item index="Archive">{{ $t("synthesis.archive") }}</el-menu-item>
            <el-menu-item index="userInfoManage">{{
              $t('userManage.userInfoManage')
            }}</el-menu-item>
            <el-menu-item index="orgManage">{{
              $t('userManage.orgManage')
            }}</el-menu-item>
            <el-menu-item index="userAuditing">{{
              $t('userManage.userAuditing')
            }}</el-menu-item>
            <el-menu-item index="roleManage">{{
              $t('userManage.roleManage')
            }}</el-menu-item>
            <el-menu-item index="groupManage">{{
              $t('userManage.groupManage')
            }}</el-menu-item>
            <el-menu-item index="authorityManage">{{
              $t('userManage.authorityManage')
            }}</el-menu-item>
            <el-menu-item index="resourceManage">{{
              $t('userManage.resManage')
            }}</el-menu-item>
          </el-submenu>
          <!-- <el-submenu index="4" class="faSub">
            <template slot="title">数据质检</template>
            <el-menu-item index="4-1">数据质检</el-menu-item>
          </el-submenu> -->
          <!-- <el-submenu index="5" class="faSub">
            <template slot="title">数据交换</template>
            <el-menu-item index="5-1">数据分发</el-menu-item>
@@ -79,7 +152,7 @@
      <div class="userInfo">
        <img src="../assets/img/user.png" alt="" />
        <span>admin</span>
        <span>注销</span>
        <span @click="logOut">注销</span>
        &nbsp;
        <span @click="switchLang"> 切换语言</span>
      </div>
@@ -92,46 +165,74 @@
</template>
<script>
import { logout } from '@/api/api';
import { removeToken, getToken } from '@/utils/auth';
export default {
  name: "navMenu",
  name: 'navMenu',
  //import引入的组件需要注入到对象中才能使用
  data() {
    return {
      lang: "en",
      lang: 'en',
    };
  },
  methods: {
    logOut() {
      this.$confirm('确认是否退出登录?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(async () => {
          const data = await logout({ token: getToken() });
          console.log(data);
          if (data.code != 200) {
            return this.$message.error('退出登录失败');
          }
          removeToken();
          this.$router.push('/login');
          this.$message({
            message: '退出登录成功',
            type: 'success',
          });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消',
          });
        });
    },
    handleOpen(key, keyPath) {
      if (
        keyPath[1] != "dataLoading" &&
        keyPath[1] != "2-2" &&
        keyPath[1] != "2-5"
        keyPath[1] != 'dataLoading' &&
        keyPath[1] != '2-2' &&
        keyPath[1] != '2-5'
      )
        this.$router.push(keyPath[1]);
    },
    handleClose(key, keyPath) {
      if (
        keyPath[1] != "dataLoading" &&
        keyPath[1] != "2-5" &&
        keyPath[1] != "2-2"
        keyPath[1] != 'dataLoading' &&
        keyPath[1] != '2-5' &&
        keyPath[1] != '2-2'
      )
        this.$router.push(keyPath[1]);
    },
    handleselect(index) {
      if (index != null) {
        this.$emit("shwoMapView", false);
        this.$emit('shwoMapView', false);
      }
    },
    showChange() {
      this.$emit("shwoMapView", true);
      this.$emit('shwoMapView', true);
    },
    switchLang() {
      if (this.lang == "en") {
      if (this.lang == 'en') {
        this.$i18n.locale = this.lang;
        this.lang = "zh";
        this.lang = 'zh';
      } else {
        this.$i18n.locale = this.lang;
        this.lang = "en";
        this.lang = 'en';
      }
    },
  },