fix: 分中心数据不可以编辑删除

develop
时启龙 2024-09-27 17:27:33 +08:00
parent 10432f1b8c
commit a95d702a8f
4 changed files with 13 additions and 2 deletions

View File

@ -5,7 +5,7 @@ const CompressPlugin = require('compress-webpack-plugin')
const { getDllPlugins } = require('./utils') const { getDllPlugins } = require('./utils')
const httpType = 'http://' const httpType = 'http://'
const proxyUrl = 'yw.iaserver.online:60006/' // 代理地址设置 const proxyUrl = '101.89.218.38:60006/' // 代理地址设置
exports.getCommonConifg = function ({ devServer, ...other }) { exports.getCommonConifg = function ({ devServer, ...other }) {
return { return {
transpileDependencies: ['@cmp/cmp-core'], transpileDependencies: ['@cmp/cmp-core'],

View File

@ -20,12 +20,15 @@
import { reactive, toRefs, ref, watch, onMounted } from 'vue' import { reactive, toRefs, ref, watch, onMounted } from 'vue'
import { useStore } from '@cmp/cmp-core' import { useStore } from '@cmp/cmp-core'
import { getModuleGroupRoot, getModuleGroupChildren } from 'services/cmdb/module' import { getModuleGroupRoot, getModuleGroupChildren } from 'services/cmdb/module'
import usePosition from '@/views/usePosition'
export default { export default {
setup(props, { emit, root }) { setup(props, { emit, root }) {
const { selectPostion } = usePosition()
const state = reactive({}) const state = reactive({})
const store = useStore() const store = useStore()
function bindEvent() { function bindEvent() {
if (selectPostion.value) return
const doms = document.querySelectorAll('.drag-item') const doms = document.querySelectorAll('.drag-item')
doms.forEach((item) => { doms.forEach((item) => {
// item.setAttribute('draggable', 'true') // item.setAttribute('draggable', 'true')

View File

@ -4,7 +4,7 @@
<TreeMenu @changeAddNode="changeAddNode"></TreeMenu> <TreeMenu @changeAddNode="changeAddNode"></TreeMenu>
</el-aside> </el-aside>
<el-main> <el-main>
<el-alert class="bsm-alert" title="请拖拽左侧模型到拓扑中编辑关联关系" type="warning" show-icon :closable="false"> </el-alert> <el-alert v-if="!selectPostion" class="bsm-alert" title="请拖拽左侧模型到拓扑中编辑关联关系" type="warning" show-icon :closable="false"> </el-alert>
<el-row class="out-container" id="page-container"> <el-row class="out-container" id="page-container">
<el-col :span="24"> <el-col :span="24">
<el-row> <el-row>
@ -50,6 +50,7 @@ import { createNode, mouseNode } from '../utils/topogy'
import { getRelationCategories, getModuleRelationDetail, getModuleTopo, getModuleDetail } from 'services/cmdb/module' import { getRelationCategories, getModuleRelationDetail, getModuleTopo, getModuleDetail } from 'services/cmdb/module'
import GraphTool from '../graph/graphTool.vue' import GraphTool from '../graph/graphTool.vue'
import TreeMenu from './Tree.vue' import TreeMenu from './Tree.vue'
import { getSelectPosition } from '@/views/usePosition'
export default { export default {
components: { components: {
@ -114,6 +115,7 @@ export default {
dialogFormVisible: false, dialogFormVisible: false,
}, },
dragId: '', dragId: '',
selectPostion: getSelectPosition(),
} }
}, },
computed: { computed: {
@ -450,6 +452,7 @@ export default {
}) })
// //
that.graph.on('node:contextmenu', (evt) => { that.graph.on('node:contextmenu', (evt) => {
if (this.selectPostion) return
if (!this.edge && !this.addingEdge) { if (!this.edge && !this.addingEdge) {
evt.preventDefault() evt.preventDefault()
evt.stopPropagation() evt.stopPropagation()
@ -521,6 +524,7 @@ export default {
}) })
// //
that.graph.on('node:click', (evt) => { that.graph.on('node:click', (evt) => {
if (this.selectPostion) return
evt.preventDefault() evt.preventDefault()
evt.stopPropagation() evt.stopPropagation()
const nodeId = evt.item.getModel().id const nodeId = evt.item.getModel().id
@ -550,6 +554,7 @@ export default {
}) })
// //
that.graph.on('edge:click', async (evt) => { that.graph.on('edge:click', async (evt) => {
if (this.selectPostion) return
evt.preventDefault() evt.preventDefault()
evt.stopPropagation() evt.stopPropagation()
const nodeModel = evt.item.getModel(), const nodeModel = evt.item.getModel(),
@ -583,6 +588,7 @@ export default {
}, },
// //
handleTopology(type) { handleTopology(type) {
if (this.selectPostion) return
switch (type) { switch (type) {
case 'add': case 'add':
this.topologyDialog.id = '' this.topologyDialog.id = ''

View File

@ -20,7 +20,9 @@ const usePostion = (cb?: Function) => {
selectPostion, selectPostion,
} }
} }
// 用于单独获取
export const getSelectPosition = () => { export const getSelectPosition = () => {
return window.sessionStorage.getItem('selectPostion') return window.sessionStorage.getItem('selectPostion')
} }
// 用于单独获取自带响应式的值
export default usePostion export default usePostion