From ff0741b691798457581b972e5b0778242728f433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Fri, 3 Nov 2023 18:25:06 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E6=A0=87=E5=87=86=E5=8C=96=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 3 - src/api/businessSupport.js | 8 +- src/components/MindMap.vue | 39 +- src/components/layouts/TabLayout.vue | 2 +- src/components/tools/setting.js | 2 +- src/permission.js | 3 + .../StandardizationActivityPage.vue | 355 ++++++++++-------- 7 files changed, 243 insertions(+), 169 deletions(-) diff --git a/src/App.vue b/src/App.vue index 92fc6c01..2686ee24 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,7 +17,6 @@ import '@/utils/warterMark' // 引入自定义icon import '@/assets/icon/iconfont.less' import Vue from 'vue' -import { updatePageHeight } from './components/tools/setting.js' moment.locale('zh-cn') @@ -102,8 +101,6 @@ export default { window.open(href, '_blank') } - updatePageHeight() - } } diff --git a/src/api/businessSupport.js b/src/api/businessSupport.js index 3e63267f..7890103c 100644 --- a/src/api/businessSupport.js +++ b/src/api/businessSupport.js @@ -9,9 +9,15 @@ const setOrCancelTop = (params) => getAction('/laws/library/lawsProblemLibrary/i // 回答库详情-删除回答 const deleteAnswer = (params) => postAction('/laws/library/lawsProblemLibrary/deleteAnswer', params) +// 标准化活动-树形图 +const queryTreeList = (params) => getAction('/laws/standardization/lawsStandardization/queryTreeList', params) + export { getQuizById, answerQuiz, setOrCancelTop, - deleteAnswer + deleteAnswer, + + // 标准化活动 + queryTreeList } diff --git a/src/components/MindMap.vue b/src/components/MindMap.vue index abe42bbf..a3d26365 100644 --- a/src/components/MindMap.vue +++ b/src/components/MindMap.vue @@ -91,22 +91,24 @@ export default { return { data: {}, graph: null, - loadEnd: false + loadEnd: false, + selectedNodeId: null, + lastQueryId: null } }, watch: { mapData: { handler () { + console.log(this.mapData) this.data = JSON.parse(JSON.stringify(this.mapData)) - if (this.loadEnd) { + if (this.loadEnd && this.data.id) { this.initMindMap() } }, - deep: true, - immediate: true + deep: true }, loadEnd () { - if (this.loadEnd) { + if (this.loadEnd && this.data.id) { this.initMindMap() } } @@ -118,8 +120,13 @@ export default { }, methods: { initMindMap () { + if (this.graph) { + this.graph.destroy() + this.graph = null + } G6.registerNode('tree-node', { drawShape: (cfg, group) => { + console.log('自定义节点了',cfg) const nodeColorIndex = cfg.depth % NODE_COLOR.length const nodeStyle = NODE_COLOR[nodeColorIndex] // 节点整体的内容 @@ -186,13 +193,13 @@ export default { nodeContainer.attr({ x: 0, y: 0, - width: this.nodeWidth + this.expendCollapseIconR + NODE_ICON_MARGIN, + width: this.nodeWidth + this.expendCollapseIconR + NODE_ICON_MARGIN + this.expendCollapseIconR, height: this.nodeHeight }) return nodeContainer }, setState (name, value, item) { - console.log(item) + console.log(name, value) const group = item.getContainer() const nodeDom = group.get('children') const nodeBox = nodeDom[1] @@ -272,13 +279,27 @@ export default { }, handleSelectedNode (event) { const { item } = event + if (this.selectedNodeId && this.selectedNodeId !== item._cfg.id) { + this.graph.findById(this.selectedNodeId).getModel().selected = false + this.graph.setItemState(this.selectedNodeId, 'selected', false) + } item.getModel().selected = !item.getModel().selected - this.graph.setItemState(item, 'selected', item.getModel().selected) - this.graph.refreshItem(item) + this.graph.setItemState(item._cfg.id, 'selected', item.getModel().selected) + this.selectedNodeId = item._cfg.id + this.graph.refreshItem(item._cfg.id) this.graph.layout() }, + /** + * 查询,定位高亮 + * @param nodeId + */ searchNode (nodeId) { const item = this.graph.findById(nodeId) + this.graph.setItemState(nodeId, 'selected', true) + if (this.lastQueryId) { + this.graph.setItemState(this.lastQueryId, 'selected', false) + } + this.lastQueryId = nodeId const matrix = item.get('group').getMatrix() const point = { x: matrix[6], diff --git a/src/components/layouts/TabLayout.vue b/src/components/layouts/TabLayout.vue index 024925d5..aea32806 100644 --- a/src/components/layouts/TabLayout.vue +++ b/src/components/layouts/TabLayout.vue @@ -21,7 +21,7 @@ -
+
diff --git a/src/components/tools/setting.js b/src/components/tools/setting.js index bfb0e093..4ebf472a 100644 --- a/src/components/tools/setting.js +++ b/src/components/tools/setting.js @@ -104,7 +104,7 @@ const updatePageHeight = () => { const obj = { 'primary-color': '#D52C26', 'user-info-height': isEmbedded ? '0px' : '59px', // 用户信息的高度 - 'breadcrumb-height': isEmbedded ? '12px' : '45px' // 面包屑的高度 + 'breadcrumb-height': isEmbedded ? '0px' : '45px' // 面包屑的高度 } // 计算表格竖向滚动条使用 const storeObj = Object.assign(obj, { diff --git a/src/permission.js b/src/permission.js index 678e038b..73825db5 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,6 +7,7 @@ import { ACCESS_TOKEN, OAUTH2_LOGIN_PAGE_PATH, UI_CACHE_DB_DICT_DATA, USER_INFO, import { generateIndexRouter, isOAuth2AppEnv, findFirstRoute, welcome } from '@/utils/util' import { getSSOUserInfo } from './api/api' import { isCanLookDetail } from './api/enterpriseStandardLibraryApi' +import { updatePageHeight } from './components/tools/setting' NProgress.configure({ showSpinner: false }) // NProgress Configuration @@ -33,6 +34,8 @@ router.beforeEach(async (to, from, next) => { if (!isEmbedded && window.frames.length !== parent.frames.length) { store.commit('SET_IS_EMBEDDED', true) } + // 更新页面高度 + updatePageHeight() NProgress.start() // start progress bar if (Vue.ls.get(ACCESS_TOKEN)) { /* has token */ diff --git a/src/views/businessSupport/standardizationActivity/StandardizationActivityPage.vue b/src/views/businessSupport/standardizationActivity/StandardizationActivityPage.vue index ccd1391c..f7398a24 100644 --- a/src/views/businessSupport/standardizationActivity/StandardizationActivityPage.vue +++ b/src/views/businessSupport/standardizationActivity/StandardizationActivityPage.vue @@ -1,174 +1,96 @@