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 httpType = 'http://'
const proxyUrl = 'yw.iaserver.online:60006/' // 代理地址设置
const proxyUrl = '101.89.218.38:60006/' // 代理地址设置
exports.getCommonConifg = function ({ devServer, ...other }) {
return {
transpileDependencies: ['@cmp/cmp-core'],

View File

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

View File

@ -4,7 +4,7 @@
<TreeMenu @changeAddNode="changeAddNode"></TreeMenu>
</el-aside>
<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-col :span="24">
<el-row>
@ -50,6 +50,7 @@ import { createNode, mouseNode } from '../utils/topogy'
import { getRelationCategories, getModuleRelationDetail, getModuleTopo, getModuleDetail } from 'services/cmdb/module'
import GraphTool from '../graph/graphTool.vue'
import TreeMenu from './Tree.vue'
import { getSelectPosition } from '@/views/usePosition'
export default {
components: {
@ -114,6 +115,7 @@ export default {
dialogFormVisible: false,
},
dragId: '',
selectPostion: getSelectPosition(),
}
},
computed: {
@ -450,6 +452,7 @@ export default {
})
//
that.graph.on('node:contextmenu', (evt) => {
if (this.selectPostion) return
if (!this.edge && !this.addingEdge) {
evt.preventDefault()
evt.stopPropagation()
@ -521,6 +524,7 @@ export default {
})
//
that.graph.on('node:click', (evt) => {
if (this.selectPostion) return
evt.preventDefault()
evt.stopPropagation()
const nodeId = evt.item.getModel().id
@ -550,6 +554,7 @@ export default {
})
//
that.graph.on('edge:click', async (evt) => {
if (this.selectPostion) return
evt.preventDefault()
evt.stopPropagation()
const nodeModel = evt.item.getModel(),
@ -583,6 +588,7 @@ export default {
},
//
handleTopology(type) {
if (this.selectPostion) return
switch (type) {
case 'add':
this.topologyDialog.id = ''

View File

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