allen 2 年之前
父節點
當前提交
fe300a6f6a

+ 2 - 1
package.json

@@ -60,7 +60,8 @@
     "vue-router": "3.4.9",
     "vuedraggable": "2.24.3",
     "vuex": "3.6.0",
-    "vcolorpicker": "^1.1.0"
+    "vcolorpicker": "^1.1.0",
+    "v-contextmenu": "^2.9.0"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",

+ 6 - 12
public/config.js

@@ -127,7 +127,7 @@ window.global = {
 			{
 				code: 'entcls',
 				icon: 'book',
-				name: window.USER_ROLE_LANGUAGE[window.USER_ROLE].ENT_CLS,
+				name: '实体类',
 				link: '/mng/class',
 				children: [],
 			},
@@ -142,7 +142,7 @@ window.global = {
 			{
 				code: 'ent',
 				icon: 'database',
-				name: window.USER_ROLE_LANGUAGE[window.USER_ROLE].ENT,
+				name: '实体',
 				link: '/mng/class/unknow/entity_v2',
 				children: [],
 			},
@@ -167,14 +167,12 @@ window.global = {
 			{
 				code: 'graph_visual',
 				icon: 'dot-chart',
-				name: window.USER_ROLE_LANGUAGE[window.USER_ROLE].GRAPH_VIEW,
+				name: '图谱可视化',
 				link: '/',
 				children: [
 					{
 						code: 'entcls_visual',
-						name:
-							window.USER_ROLE_LANGUAGE[window.USER_ROLE]
-								.ENT_CLS_VIEW,
+						name: '实体类可视化',
 						link: '/sta/entity_class_view',
 					},
                     // {
@@ -186,9 +184,7 @@ window.global = {
 					// },
 					{
 						code: 'ent_visual',
-						name:
-							window.USER_ROLE_LANGUAGE[window.USER_ROLE]
-								.ENT_VIEW,
+						name: '实体可视化',
 						link: '/sta',
 					},
                     {
@@ -214,9 +210,7 @@ window.global = {
 					{
 						code: 'graph_sta_cal',
 						icon: 'bar-chart',
-						name:
-							window.USER_ROLE_LANGUAGE[window.USER_ROLE]
-								.GRAPH_DATA_STA,
+						name: '图谱数据统计',
 						link: '/sta/data/entcls',
 						children: [],
 					},

+ 28 - 0
src/App copy.vue

@@ -0,0 +1,28 @@
+<template>
+  <div id="app">
+    <router-view />
+    <theme-picker />
+  </div>
+</template>
+
+<script>
+import ThemePicker from "@/components/ThemePicker";
+
+export default {
+  name: "App",
+  components: { ThemePicker },
+    metaInfo() {
+        return {
+            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
+            titleTemplate: title => {
+                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
+            }
+        }
+    }
+};
+</script>
+<style scoped>
+#app .theme-picker {
+  display: none;
+}
+</style>

+ 50 - 19
src/App.vue

@@ -1,28 +1,59 @@
 <template>
-  <div id="app">
-    <router-view />
-    <theme-picker />
-  </div>
+  <a-config-provider :locale="zh_CN">
+      <div id="app" class="flex-col">
+          <navibar class="menu-shi"></navibar>
+          <div class="app-body flex-row app_beijing">
+              <div class="container-width">
+                  <router-view/>
+              </div>
+          </div>
+      </div>
+  </a-config-provider>
 </template>
-
 <script>
-import ThemePicker from "@/components/ThemePicker";
+import navibar from '@/views/knowledge/common/navibar'
+
+import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
+import 'moment/locale/zh-cn';
 
 export default {
-  name: "App",
-  components: { ThemePicker },
-    metaInfo() {
-        return {
-            title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
-            titleTemplate: title => {
-                return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
-            }
-        }
+  components: {
+    navibar
+  },
+  data() {
+    return {
+      zh_CN,
     }
-};
+  }
+}
 </script>
 <style scoped>
-#app .theme-picker {
-  display: none;
-}
+  #app {
+      position: absolute;
+      top: 0;
+      left: 0;
+      right: 0;
+      bottom: 0;
+      background-color: #f5f7fa;
+  }
+
+  .app-body {
+      height: calc(100% - 50px);
+      overflow: scroll;
+      overflow-y: hidden;
+  }
+
+  .container-width {
+      top: 62px;
+      height: 100%;
+  }
+
+  .menu-shi {
+      background-color: white;
+      box-shadow: 0 2px 8px #c8ebdf82;
+      border: 0;
+      text-align: center;
+  }
+
+
 </style>

+ 23 - 2
src/main.js

@@ -41,9 +41,12 @@ import VueMeta from 'vue-meta'
 import DictData from '@/components/DictData'
 
 // knowledge 知识图谱新增 start 以后可以整合到plugin里
-import eventBus from "./plugins/eventBus";
-import modalManager from "./plugins/modalManager";
+import eventBus from "./plugins/knowledge/eventBus";
+import modalManager from "./plugins/knowledge/modalManager";
+import formValidateFields from "./plugins/knowledge/formValidateFields";
 import modalList from "@/views/knowledge/index";
+import "v-contextmenu/dist/index.css";
+import '../public/config'
 // knowledge 知识图谱新增 end
 
 // 全局方法挂载
@@ -72,6 +75,7 @@ Vue.use(eventBus);
 Vue.use(modalManager, {
   modals: modalList
 });
+Vue.use(formValidateFields);
 Vue.use(VueMeta)
 DictData.install()
 
@@ -91,6 +95,23 @@ Vue.use(Antd);
 
 Vue.config.productionTip = false
 
+// knowledge add start
+Vue.prototype.$checkSpecialChar = function (value) {
+  const pattern = /[`~!@#$^&*()=|{}':;',[\].<>《》/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ]/g
+  const matchList = value.match(pattern)
+  const uniqueMatchList = []
+  if (matchList) {
+    matchList.map(v => {
+      uniqueMatchList.indexOf(v) === -1 ? uniqueMatchList.push(v) : null
+    })
+  }
+  return uniqueMatchList
+}
+const menuList = window.global.const.menuList
+Vue.prototype.menus = menuList
+// knowledge add end
+
+
 new Vue({
   el: '#app',
   router,

+ 0 - 0
src/plugins/eventBus.js → src/plugins/knowledge/eventBus.js


+ 20 - 0
src/plugins/knowledge/formValidateFields.js

@@ -0,0 +1,20 @@
+// 重写表单验证
+export default {
+  install (Vue) {
+    Vue.prototype.$formValidateFields = function (form) {
+      var vm = this
+      return new Promise(function (resolve) {
+        vm[form].validateFieldsAndScroll((err, values) => {
+          if (!err) {
+            resolve(values)
+          } else {
+            // resolve(err)
+            var e = new Error()
+            e.err = err
+            throw(e)
+          }
+        })
+      })
+    }
+  }
+}

+ 0 - 0
src/plugins/modalManager.js → src/plugins/knowledge/modalManager.js


+ 153 - 0
src/views/knowledge/common/navibar.vue

@@ -0,0 +1,153 @@
+<template>
+  <div class="p-re">
+    <div class="logo">
+      <router-link to="/">
+        <img :src="logoSrc" style="height:40px;" />
+      </router-link>
+    </div>
+    <div class="nav-header" style="margin: 0 auto">
+      <a-menu
+        class="nav-bar"
+        mode="horizontal"
+        theme="light"
+        :defaultSelectedKeys="active"
+        v-model="active"
+      >
+        <template v-for="item in menuList">
+          <a-menu-item :key="item.code" class="menu-shi-ti"
+                       v-if="!item.children || item.children.length==0 ">
+            <a v-if="item.link.indexOf('http')>-1" :href="item.link" target="_blank">
+              <a-icon :type="item.icon" />
+              <span class="menu-shi-zi">{{ item.name }}</span>
+            </a>
+            <router-link v-else :to="item.link ? item.link.replace('/#', '') : ''">
+              <a-icon :type="item.icon" />
+              <span class="menu-shi-zi">{{ item.name }}</span>
+            </router-link>
+          </a-menu-item>
+          <a-sub-menu :key="item.code" v-if="!!item.children && item.children.length>0">
+            <span slot="title" class="submenu-title-wrapper">
+              <a-icon :type="item.icon" />{{ item.name }}</span>
+            <a-menu-item :key="v.code" v-for="v in item.children">
+              <a v-if="v.link.indexOf('http')>-1" :href="v.link" target="_blank">
+                <span class="menu-shi-zi">{{ v.name }}</span>
+              </a>
+              <router-link v-else :to="v.link ? v.link.replace('/#', '') : ''">
+                <span class="menu-shi-zi">{{ v.name }}</span>
+              </router-link>
+            </a-menu-item>
+          </a-sub-menu>
+        </template>
+      </a-menu>
+    </div>
+    <a-dropdown class="logout">
+      <a class="ant-dropdown-link" href="#">
+        {{ username }}
+        <a-icon type="down" />
+      </a>
+      <a-menu slot="overlay">
+        <a-menu-item>
+          <a href="javascript:;" @click="logout">退出登录</a>
+        </a-menu-item>
+      </a-menu>
+    </a-dropdown>
+  </div>
+</template>
+
+<script>
+var logoSrc = "";
+// var version = window.global.const.version;
+var version = "base"
+if (version === "base") {
+  logoSrc = require("../../../../public/logo-base.svg");
+} else if (version === "bf") {
+  logoSrc = require("../../../../public/logo-bf.svg");
+}
+// const api = require('@/api/index')
+export default {
+  name: "Navibar",
+  data() {
+    return {
+      logoSrc,
+      active: [],
+      menuList: this.menus,
+      username: this.login_username,
+      hideText: false
+    };
+  },
+  watch: {
+    "$route.path": function(newPath, oldPath) {
+      if (this.$route.meta.code) {
+        this.active = [this.$route.meta.code];
+      }
+    }
+  },
+  created() {
+    // api.login.Mlogin().then(data => {
+    //   if (data) {
+    //     this.username = data.name || data.username
+    //     Vue.prototype.login_username = this.username
+    //     Vue.prototype.menus = data.menus
+    //     this.menuList = data.menus
+    //   } else {
+    //     // 返回登录页
+    //     window.location.href = 'http://10.10.12.85:2004/graph/#/mng/class'
+    //   }
+    // })
+    this.$nextTick(() => {
+      // ant-menu-vertical
+      const width = document.getElementsByTagName("body")[0].offsetWidth;
+      const userWidth = 85 + 20;
+      const logoWidth = 215 + 20 + 20;
+      const navWidth = document.getElementsByClassName("nav-header")[0];
+      navWidth.style.width = width - userWidth - logoWidth + "px";
+      window.onresize = function() {
+        let resizeWidth = document.getElementsByTagName("body")[0].offsetWidth;
+        navWidth.style.width = resizeWidth - userWidth - logoWidth + "px";
+      };
+    });
+  },
+  methods: {
+    logout() {
+      try {
+        var elemIF = document.createElement("iframe");
+        elemIF.src = window.global.logOutUrl();
+        elemIF.style.display = "none";
+        document.body.appendChild(elemIF);
+
+      } catch (e) {
+        alert(e);
+      }
+      window.location.href = window.global.logOutUrl();
+      localStorage.removeItem("localDatat");
+    }
+  }
+};
+</script>
+
+<style scoped>
+.menu-shi-ti {
+  min-height: 60px;
+}
+
+.ant-menu-horizontal {
+  line-height: 60px;
+}
+
+.logo {
+  width: 215px;
+  padding: 10px;
+  position: absolute;
+  left: 20px;
+}
+
+.p-re {
+  position: relative;
+}
+
+.logout {
+  position: absolute;
+  right: 20px;
+  top: 18px;
+}
+</style>

+ 1 - 1
src/views/knowledge/graphClass/entityClass.vue

@@ -151,7 +151,7 @@ import { getEntityClass, getFlowId } from "@/api/graph/entityClass"
         //  权限控制
         GOTO_NEURAL_BTN: true,
         // 版本控制
-        version: window.global.const.version,
+        version: 'base',
 
         panes,
         paneRouteMap, // 匹配tab路由