feat: 资产管理修改 2.0
parent
6f85d92020
commit
4467ff700c
|
@ -0,0 +1,14 @@
|
||||||
|
import { request } from '@cmp/cmp-element'
|
||||||
|
import { getSelectPosition } from '@/views/usePostion'
|
||||||
|
|
||||||
|
// 封装原始的 request.get 方法
|
||||||
|
export default function enhancedRequestGet(url: string, config: any = {}) {
|
||||||
|
// 确保config.params对象存在
|
||||||
|
if (!config.params) {
|
||||||
|
config.params = {}
|
||||||
|
}
|
||||||
|
// 添加positionKey到params对象
|
||||||
|
config.params.positionKey = getSelectPosition()
|
||||||
|
// 调用原始的request.get方法
|
||||||
|
return request.get(url, config)
|
||||||
|
}
|
|
@ -3,9 +3,9 @@
|
||||||
*/
|
*/
|
||||||
import { request } from '@cmp/cmp-element'
|
import { request } from '@cmp/cmp-element'
|
||||||
import { wrapperParams } from 'utils'
|
import { wrapperParams } from 'utils'
|
||||||
import { getSelectPosition } from '@/views/usePostion'
|
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
|
||||||
export function getPropertiesByCode(code) {
|
export function getPropertiesByCode(code) {
|
||||||
return request.get('/ims/v1/properties', {
|
return EnhancedRequestGet('/ims/v1/properties', {
|
||||||
params: wrapperParams({ code }),
|
params: wrapperParams({ code }),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ export function getPropertiesByCode(code) {
|
||||||
const baseUrl = '/ams/v1/module'
|
const baseUrl = '/ams/v1/module'
|
||||||
|
|
||||||
export function getModules(params) {
|
export function getModules(params) {
|
||||||
return request.get(`${baseUrl}/collections`, { params })
|
return EnhancedRequestGet(`${baseUrl}/collections`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModule() {
|
export function getModule() {
|
||||||
return request.get(baseUrl)
|
return EnhancedRequestGet(baseUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增模型
|
// 新增模型
|
||||||
|
@ -26,7 +26,7 @@ export function createModule(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModuleDetail(id) {
|
export function getModuleDetail(id) {
|
||||||
return request.get(`${baseUrl}/${id}`)
|
return EnhancedRequestGet(`${baseUrl}/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增分组
|
// 新增分组
|
||||||
|
@ -54,37 +54,37 @@ export function removeModuleGroup(id) {
|
||||||
|
|
||||||
// 获取分组的树
|
// 获取分组的树
|
||||||
export function getGroupTree() {
|
export function getGroupTree() {
|
||||||
return request.get(`${baseUrl}/group`)
|
return EnhancedRequestGet(`${baseUrl}/group`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getGroup() {
|
export function getGroup() {
|
||||||
return request.get(`${baseUrl}/group/list`)
|
return EnhancedRequestGet(`${baseUrl}/group/list`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模型分组采集结构查询
|
// 模型分组采集结构查询
|
||||||
export function getModuleGroupCollections(params) {
|
export function getModuleGroupCollections(params) {
|
||||||
return request.get(`${baseUrl}/group/collections`, { params })
|
return EnhancedRequestGet(`${baseUrl}/group/collections`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModuleGroupRoot() {
|
export function getModuleGroupRoot() {
|
||||||
return request.get(`${baseUrl}/group/roots`)
|
return EnhancedRequestGet(`${baseUrl}/group/roots`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModuleGroupChildren(groupId, params) {
|
export function getModuleGroupChildren(groupId, params) {
|
||||||
return request.get(`${baseUrl}/group/${groupId}/children`, { params: { positionKey: getSelectPosition(), ...params } })
|
return EnhancedRequestGet(`${baseUrl}/group/${groupId}/children`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRootGroups(groupId) {
|
export function getRootGroups(groupId) {
|
||||||
return request.get(`${baseUrl}/group/root/${groupId}`)
|
return EnhancedRequestGet(`${baseUrl}/group/root/${groupId}`)
|
||||||
}
|
}
|
||||||
// 查询模型属性集合
|
// 查询模型属性集合
|
||||||
export function getModulePropertyList(moduleId, params) {
|
export function getModulePropertyList(moduleId, params) {
|
||||||
return request.get(`/ams/v1/module/${moduleId}/list`, { params })
|
return EnhancedRequestGet(`/ams/v1/module/${moduleId}/list`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询模型属性
|
// 查询模型属性
|
||||||
export function getModuleProperties(id, params) {
|
export function getModuleProperties(id, params) {
|
||||||
return request.get(`/ams/v1/module/${id}/properties`, { params })
|
return EnhancedRequestGet(`/ams/v1/module/${id}/properties`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改模型属性
|
// 修改模型属性
|
||||||
|
@ -94,13 +94,13 @@ export function updateModuleProperties(id, data) {
|
||||||
|
|
||||||
// 关联类型分组查询所有
|
// 关联类型分组查询所有
|
||||||
export function getRelationCategories() {
|
export function getRelationCategories() {
|
||||||
return request.get('/ams/v1/relation/category/all')
|
return EnhancedRequestGet('/ams/v1/relation/category/all')
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleRelationUrl = '/ams/v1/module/relation'
|
const moduleRelationUrl = '/ams/v1/module/relation'
|
||||||
// 获取模型关系详情
|
// 获取模型关系详情
|
||||||
export function getModuleRelationDetail(id) {
|
export function getModuleRelationDetail(id) {
|
||||||
return request.get(`${moduleRelationUrl}/${id}`)
|
return EnhancedRequestGet(`${moduleRelationUrl}/${id}`)
|
||||||
}
|
}
|
||||||
// 模型关系新增
|
// 模型关系新增
|
||||||
export function createModuleRelation(data) {
|
export function createModuleRelation(data) {
|
||||||
|
@ -117,20 +117,20 @@ export function deleteModuleRelation(id) {
|
||||||
|
|
||||||
// 获取模型拓扑
|
// 获取模型拓扑
|
||||||
export function getModuleTopo(params) {
|
export function getModuleTopo(params) {
|
||||||
return request.get(`${moduleRelationUrl}/topo`, { params })
|
return EnhancedRequestGet(`${moduleRelationUrl}/topo`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据拓扑,模型数据查询模型关系
|
// 根据拓扑,模型数据查询模型关系
|
||||||
export function getModuleRelation(params) {
|
export function getModuleRelation(params) {
|
||||||
return request.get(`${moduleRelationUrl}/relevancy`, { params })
|
return EnhancedRequestGet(`${moduleRelationUrl}/relevancy`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关联类型分组id查询模型集合
|
// 关联类型分组id查询模型集合
|
||||||
export function getModuleByRelationCategory(id) {
|
export function getModuleByRelationCategory(id) {
|
||||||
return request.get(`${moduleRelationUrl}/${id}/module`)
|
return EnhancedRequestGet(`${moduleRelationUrl}/${id}/module`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关联类型分组id查询模型集合
|
// 关联类型分组id查询模型集合
|
||||||
export function getModuleInstance(params) {
|
export function getModuleInstance(params) {
|
||||||
return request.get(`${moduleRelationUrl}/instances`, { params })
|
return EnhancedRequestGet(`${moduleRelationUrl}/instances`, { params })
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import { request } from '@cmp/cmp-element'
|
import { request } from '@cmp/cmp-element'
|
||||||
|
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
|
||||||
|
|
||||||
const baseUrl = '/ams/v1/collection/templates'
|
const baseUrl = '/ams/v1/collection/templates'
|
||||||
export function getCollectionPlugins(params: Base.IListParams) {
|
export function getCollectionPlugins(params: Base.IListParams) {
|
||||||
return request.get(baseUrl, { params })
|
return EnhancedRequestGet(baseUrl, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCollectionPluginDetail(id: number) {
|
export function getCollectionPluginDetail(id: number) {
|
||||||
return request.get(`${baseUrl}/${id}`)
|
return EnhancedRequestGet(`${baseUrl}/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createCollectionPlugin(params: any) {
|
export function createCollectionPlugin(params: any) {
|
||||||
|
@ -22,7 +23,7 @@ export function removeCollectionPlugin(id: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUser(params: any) {
|
export function getUser(params: any) {
|
||||||
return request.get('/sms/v1/users', {
|
return EnhancedRequestGet('/sms/v1/users', {
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,3 +30,6 @@ export function getRuleByModuleId(moduleId: number, relationCategoryId: number)
|
||||||
params: { relationCategoryId },
|
params: { relationCategoryId },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getSysconfQueryByCode(params) {
|
||||||
|
return request.get('/sms/v1/configs/queryByCode', { params })
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { request } from '@cmp/cmp-element'
|
import { request } from '@cmp/cmp-element'
|
||||||
|
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
|
||||||
const baseUrl = '/ams/v1/property/pool'
|
const baseUrl = '/ams/v1/property/pool'
|
||||||
export function getPool(params: Base.IListParams) {
|
export function getPool(params: Base.IListParams) {
|
||||||
return request.get(baseUrl, { params })
|
return EnhancedRequestGet(baseUrl, { params })
|
||||||
}
|
}
|
||||||
export function getPoolDetail(id: number) {
|
export function getPoolDetail(id: number) {
|
||||||
return request.get(`${baseUrl}/${id}`)
|
return EnhancedRequestGet(`${baseUrl}/${id}`)
|
||||||
}
|
}
|
||||||
export function createPool(params: any) {
|
export function createPool(params: any) {
|
||||||
return request.post(baseUrl, params)
|
return request.post(baseUrl, params)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { request } from '@cmp/cmp-element'
|
import { request } from '@cmp/cmp-element'
|
||||||
|
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
|
||||||
const groupUrl = '/ams/v1/relation/category'
|
const groupUrl = '/ams/v1/relation/category'
|
||||||
export function getGroup() {
|
export function getGroup() {
|
||||||
return request.get(groupUrl, { params: { simple: true } })
|
return EnhancedRequestGet(groupUrl, { params: { simple: true } })
|
||||||
}
|
}
|
||||||
export function getGroupDetail(id: number) {
|
export function getGroupDetail(id: number) {
|
||||||
return request.get(`${groupUrl}/${id}`)
|
return EnhancedRequestGet(`${groupUrl}/${id}`)
|
||||||
}
|
}
|
||||||
export function createGroup(params: any) {
|
export function createGroup(params: any) {
|
||||||
return request.post(groupUrl, params)
|
return request.post(groupUrl, params)
|
||||||
|
@ -18,15 +18,15 @@ export function removeGroup(id: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getModuleRelation(params: any) {
|
export function getModuleRelation(params: any) {
|
||||||
return request.get(`${groupUrl}/${params.id}/module/relations`, { params })
|
return EnhancedRequestGet(`${groupUrl}/${params.id}/module/relations`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = '/ams/v1/relation'
|
const baseUrl = '/ams/v1/relation'
|
||||||
export function getRelation(params: Base.IListParams) {
|
export function getRelation(params: Base.IListParams) {
|
||||||
return request.get(baseUrl, { params })
|
return EnhancedRequestGet(baseUrl, { params })
|
||||||
}
|
}
|
||||||
export function getRelationDetail(id: number) {
|
export function getRelationDetail(id: number) {
|
||||||
return request.get(`${baseUrl}/${id}`)
|
return EnhancedRequestGet(`${baseUrl}/${id}`)
|
||||||
}
|
}
|
||||||
export function createRelation(params: any) {
|
export function createRelation(params: any) {
|
||||||
return request.post(baseUrl, params)
|
return request.post(baseUrl, params)
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
import { request, downloadFile } from '@cmp/cmp-element'
|
import { request, downloadFile } from '@cmp/cmp-element'
|
||||||
|
import EnhancedRequestGet from '@/services/EnhancedRequestGet'
|
||||||
|
|
||||||
const baseUrl = '/ams/v1/instance/topology'
|
const baseUrl = '/ams/v1/instance/topology'
|
||||||
// 获取实例拓扑
|
// 获取实例拓扑
|
||||||
export function getInstanceTopo(params: Object) {
|
export function getInstanceTopo(params: Object) {
|
||||||
return request.get(`${baseUrl}`, { params })
|
return EnhancedRequestGet(`${baseUrl}`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取实例拓扑详情
|
// 获取实例拓扑详情
|
||||||
export function getInstanceTopoDetail(id: Number) {
|
export function getInstanceTopoDetail(id: Number) {
|
||||||
return request.get(`${baseUrl}/${id}`)
|
return EnhancedRequestGet(`${baseUrl}/${id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取拓扑路径
|
// 获取拓扑路径
|
||||||
export function getInstanceTopoPath(params: Object) {
|
export function getInstanceTopoPath(params: Object) {
|
||||||
return request.get(`${baseUrl}/path`, { params })
|
return EnhancedRequestGet(`${baseUrl}/path`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增实例拓扑
|
// 新增实例拓扑
|
||||||
|
@ -23,7 +24,7 @@ export function createInstanceTopo(data: Object) {
|
||||||
|
|
||||||
// 根据起始模型查询最大拓扑层级
|
// 根据起始模型查询最大拓扑层级
|
||||||
export function getTopoMaxLevel(params: Object) {
|
export function getTopoMaxLevel(params: Object) {
|
||||||
return request.get(`${baseUrl}/max/level`, { params })
|
return EnhancedRequestGet(`${baseUrl}/max/level`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新实例拓扑
|
// 更新实例拓扑
|
||||||
|
@ -38,12 +39,12 @@ export function removeInstanceTopo(id: Number) {
|
||||||
|
|
||||||
// 获取查询项以及列表项
|
// 获取查询项以及列表项
|
||||||
export function getResourceListConfigs(id: Number) {
|
export function getResourceListConfigs(id: Number) {
|
||||||
return request.get(`${baseUrl}/${id}/dynamic/item`)
|
return EnhancedRequestGet(`${baseUrl}/${id}/dynamic/item`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询资源列表
|
// 查询资源列表
|
||||||
export function getResource(params: Object) {
|
export function getResource(params: Object) {
|
||||||
return request.get(`${baseUrl}/resource`, { params })
|
return EnhancedRequestGet(`${baseUrl}/resource`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出资源列表
|
// 导出资源列表
|
||||||
|
@ -53,20 +54,20 @@ export function downloadResource(id: Number) {
|
||||||
|
|
||||||
// 根据实例拓扑id查询对应起始模型的实例集合
|
// 根据实例拓扑id查询对应起始模型的实例集合
|
||||||
export function getStartModuleByInstance(id: Number) {
|
export function getStartModuleByInstance(id: Number) {
|
||||||
return request.get(`${baseUrl}/${id}/startmodule/instance`)
|
return EnhancedRequestGet(`${baseUrl}/${id}/startmodule/instance`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询模型实例关系记录
|
// 查询模型实例关系记录
|
||||||
export function getModuleInstanceRelation(instanceId: number, id: number) {
|
export function getModuleInstanceRelation(instanceId: number, id: number) {
|
||||||
return request.get(`${baseUrl}/topo`, { params: { instanceId, id } })
|
return EnhancedRequestGet(`${baseUrl}/topo`, { params: { instanceId, id } })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据实例id查找下一层级实例拓扑
|
// 根据实例id查找下一层级实例拓扑
|
||||||
export function getInstanceNextTopo(params: Object) {
|
export function getInstanceNextTopo(params: Object) {
|
||||||
return request.get(`${baseUrl}/next/topo`, { params })
|
return EnhancedRequestGet(`${baseUrl}/next/topo`, { params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询模型实例拓扑
|
// 查询模型实例拓扑
|
||||||
export function getInstanceTopology(instanceId: number, topoId: number) {
|
export function getInstanceTopology(instanceId: number, topoId: number) {
|
||||||
return request.get(`${baseUrl}/topo/instances/${instanceId}`, { params: { id: topoId } })
|
return EnhancedRequestGet(`${baseUrl}/topo/instances/${instanceId}`, { params: { id: topoId } })
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
<template>
|
||||||
|
<el-card v-if="isLeaderPosition" class="m-b">
|
||||||
|
<el-form>
|
||||||
|
<el-form-item label="所属阵地:">
|
||||||
|
<el-radio-group v-model="selectPostion" @change="SET_SELECTED_POSITION">
|
||||||
|
<el-radio v-for="item in positionList" :key="item.value" :label="item.value">{{ item.name }}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getDictChildren } from '@/services/platform'
|
||||||
|
import { getSysconfQueryByCode } from '@/services'
|
||||||
|
import { ref, onUnmounted } from 'vue'
|
||||||
|
const addStorageEvent = (key, data) => {
|
||||||
|
// 创建一个StorageEvent事件
|
||||||
|
var newStorageEvent = document.createEvent('StorageEvent')
|
||||||
|
const storage = {
|
||||||
|
setItem: function (k, val) {
|
||||||
|
sessionStorage.setItem(k, val)
|
||||||
|
// 初始化创建的事件
|
||||||
|
newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null)
|
||||||
|
// 派发对象
|
||||||
|
window.dispatchEvent(newStorageEvent)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return storage.setItem(key, data)
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
// 是否为主阵地
|
||||||
|
const isLeaderPosition = ref(false)
|
||||||
|
// 子阵地列表
|
||||||
|
const positionList = ref([])
|
||||||
|
// 已选择
|
||||||
|
const value = window.sessionStorage.getItem('selectPostion') || ''
|
||||||
|
const selectPostion = ref(value)
|
||||||
|
const SET_SELECTED_POSITION = () => {
|
||||||
|
addStorageEvent('selectPostion', selectPostion.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function init() {
|
||||||
|
const res = await getSysconfQueryByCode({ code: 'isLeaderPosition' })
|
||||||
|
if (!res.success) return
|
||||||
|
isLeaderPosition.value = res.data.value === 'true'
|
||||||
|
addStorageEvent('isLeaderPosition', res.data.value)
|
||||||
|
if (isLeaderPosition.value) {
|
||||||
|
const res = await getDictChildren({ value: 'POSITION_DATA' })
|
||||||
|
if (!res.success) return
|
||||||
|
positionList.value = [
|
||||||
|
{
|
||||||
|
name: '主中心',
|
||||||
|
value: '',
|
||||||
|
},
|
||||||
|
...res.data,
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
addStorageEvent('selectPostion', '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
onUnmounted(() => {
|
||||||
|
// addStorageEvent('isLeaderPosition', '')
|
||||||
|
// addStorageEvent('selectPostion', '')
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
isLeaderPosition,
|
||||||
|
positionList,
|
||||||
|
selectPostion,
|
||||||
|
SET_SELECTED_POSITION,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
::v-deep {
|
||||||
|
.el-card__body {
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -99,6 +99,7 @@ export default defineComponent({
|
||||||
filterText,
|
filterText,
|
||||||
treeRef,
|
treeRef,
|
||||||
handleNodeClick,
|
handleNodeClick,
|
||||||
|
getData
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="warpper">
|
<div class="warpper">
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<split-pane class="split-pane" :min-percent="10" :default-percent="20" split="vertical">
|
<split-pane class="split-pane" :min-percent="10" :default-percent="20" split="vertical">
|
||||||
<template slot="paneL">
|
<template slot="paneL">
|
||||||
<Tree category="template" @handleNodeClick="handleNodeClick"></Tree>
|
<Tree ref="Tree" category="template" @handleNodeClick="handleNodeClick"></Tree>
|
||||||
</template>
|
</template>
|
||||||
<template slot="paneR">
|
<template slot="paneR">
|
||||||
<List ref="listRef" :currentModuleId="currentModuleId" @handleCreate="handleCreate" @getDetail="getDetail"></List>
|
<List ref="listRef" :currentModuleId="currentModuleId" @handleCreate="handleCreate" @getDetail="getDetail"></List>
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, reactive, toRefs, ref } from 'vue'
|
import { defineComponent, reactive, toRefs, ref, getCurrentInstance } from 'vue'
|
||||||
import SplitPane from 'vue-splitpane'
|
import SplitPane from 'vue-splitpane'
|
||||||
import Tree from '@/views/data-collection/components/Tree.vue'
|
import Tree from '@/views/data-collection/components/Tree.vue'
|
||||||
import List from './List.vue'
|
import List from './List.vue'
|
||||||
|
@ -22,7 +23,8 @@ import AddData from './AddData/index.vue'
|
||||||
import { getCollectionPluginDetail } from 'services/data-collection/plugins'
|
import { getCollectionPluginDetail } from 'services/data-collection/plugins'
|
||||||
import Detail from './detail/index.vue'
|
import Detail from './detail/index.vue'
|
||||||
import { decrypt } from '@cmp/cmp-element'
|
import { decrypt } from '@cmp/cmp-element'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
SplitPane,
|
SplitPane,
|
||||||
|
@ -30,8 +32,14 @@ export default defineComponent({
|
||||||
List,
|
List,
|
||||||
AddData,
|
AddData,
|
||||||
Detail,
|
Detail,
|
||||||
|
AmsPosition,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
const instance = getCurrentInstance()
|
||||||
|
usePostion(() => {
|
||||||
|
if (instance.proxy?.$refs?.Tree) (instance.proxy.$refs.Tree as any).getData()
|
||||||
|
listRef.value.refresh()
|
||||||
|
})
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
currentModuleId: '' as any,
|
currentModuleId: '' as any,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<cb-advance-table ref="tableRef" title="属性列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
<cb-advance-table ref="tableRef" title="属性列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
||||||
<template #action>
|
<template #action v-if="isLeaderPosition">
|
||||||
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #operate="val, record">
|
<template #operate="val, record">
|
||||||
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
<template v-if="isLeaderPosition">
|
||||||
<div class="action-divider"></div>
|
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
||||||
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
<div class="action-divider"></div>
|
||||||
|
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</cb-advance-table>
|
</cb-advance-table>
|
||||||
<AddDialog :dialog="addDialog" v-if="addDialog.visible" @getData="getList"></AddDialog>
|
<AddDialog :dialog="addDialog" v-if="addDialog.visible" @getData="getList"></AddDialog>
|
||||||
|
@ -19,10 +22,13 @@ import { defineComponent, reactive, toRefs, ref } from 'vue'
|
||||||
import AddDialog from './AddDialog.vue'
|
import AddDialog from './AddDialog.vue'
|
||||||
import { columns, searchConfigs } from './config'
|
import { columns, searchConfigs } from './config'
|
||||||
import { useTable } from '@cmp/cmp-element'
|
import { useTable } from '@cmp/cmp-element'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { AddDialog },
|
components: { AddDialog, AmsPosition },
|
||||||
setup() {
|
setup() {
|
||||||
|
const { isLeaderPosition } = usePostion(() => getList())
|
||||||
const { list, total, params, handleDelete, loading, getList } = useTable({
|
const { list, total, params, handleDelete, loading, getList } = useTable({
|
||||||
getService: getPool,
|
getService: getPool,
|
||||||
removeService: removePool,
|
removeService: removePool,
|
||||||
|
@ -54,6 +60,7 @@ export default defineComponent({
|
||||||
getList,
|
getList,
|
||||||
addDialog,
|
addDialog,
|
||||||
handleCreate,
|
handleCreate,
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<!-- 左侧树形目录 -->
|
<!-- 左侧树形目录 -->
|
||||||
<split-pane v-show="!detailVisible" class="cmdb-split" v-on:resize="resize" :min-percent="10" :default-percent="15" split="vertical">
|
<split-pane v-show="!detailVisible" class="cmdb-split" v-on:resize="resize" :min-percent="10" :default-percent="15" split="vertical">
|
||||||
<template slot="paneL">
|
<template slot="paneL">
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
<div class="m-b-sm m-l-xs">配置模型</div>
|
<div class="m-b-sm m-l-xs">配置模型</div>
|
||||||
<!-- 搜索区域 -->
|
<!-- 搜索区域 -->
|
||||||
<cb-table-search :configs="searchConfigs" :onSearch="handleSearch" class="service-search m-b-sm">
|
<cb-table-search :configs="searchConfigs" :onSearch="handleSearch" class="service-search m-b-sm">
|
||||||
<template #operate>
|
<template #operate v-if="isLeaderPosition">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handlCreate()">新增 </el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handlCreate()">新增 </el-button>
|
||||||
</template>
|
</template>
|
||||||
</cb-table-search>
|
</cb-table-search>
|
||||||
|
@ -27,7 +28,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-remark">{{ row.remark || '暂无描述' }}</div>
|
<div class="card-remark">{{ row.remark || '暂无描述' }}</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer" v-if="isLeaderPosition">
|
||||||
<el-button type="text" class="operate" @click.stop="handlCreate(row)"> 编辑 </el-button>
|
<el-button type="text" class="operate" @click.stop="handlCreate(row)"> 编辑 </el-button>
|
||||||
<el-button type="text" class="operate" @click.stop="handleRemove(row)"> 删除 </el-button>
|
<el-button type="text" class="operate" @click.stop="handleRemove(row)"> 删除 </el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,9 +52,12 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
import { getCurrentInstance } from 'vue'
|
||||||
import splitPane from 'vue-splitpane'
|
import splitPane from 'vue-splitpane'
|
||||||
import ModuleDetail from './ModuleDetail.vue'
|
import ModuleDetail from './ModuleDetail.vue'
|
||||||
import { getModules, removeModule } from 'services/cmdb/module'
|
import { getModules, removeModule } from 'services/cmdb/module'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
|
|
||||||
function getSearchConfigs(moduleGroupId, flag) {
|
function getSearchConfigs(moduleGroupId, flag) {
|
||||||
return [
|
return [
|
||||||
|
@ -67,6 +71,7 @@ export default {
|
||||||
Tree: () => import('./side/index'),
|
Tree: () => import('./side/index'),
|
||||||
splitPane,
|
splitPane,
|
||||||
ModuleDetail,
|
ModuleDetail,
|
||||||
|
AmsPosition,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -85,6 +90,16 @@ export default {
|
||||||
activeName: '',
|
activeName: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const instance = getCurrentInstance()
|
||||||
|
const { isLeaderPosition } = usePostion(() => {
|
||||||
|
instance.proxy.getList()
|
||||||
|
instance.proxy.$refs.treeRef.$refs.tree.loadGroups()
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
isLeaderPosition,
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getList() {
|
async getList() {
|
||||||
const res = await getModules(this.params)
|
const res = await getModules(this.params)
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<el-col :span="6" style="width: 286px">
|
<el-col :span="6" style="width: 286px">
|
||||||
<el-card class="group">
|
<el-card class="group">
|
||||||
<div slot="header">
|
<div slot="header">
|
||||||
关系分组
|
关系分组
|
||||||
<el-button class="pull-right button-plus" type="text" @click="handleCreateGroup()" icon="el-icon-plus"></el-button>
|
<el-button v-if="isLeaderPosition" class="pull-right button-plus" type="text" @click="handleCreateGroup()" icon="el-icon-plus"></el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
<span class="custom-tree-node-label">
|
<span class="custom-tree-node-label">
|
||||||
{{ data.name }}
|
{{ data.name }}
|
||||||
</span>
|
</span>
|
||||||
<span class="operate-btns">
|
<span class="operate-btns" v-if="isLeaderPosition">
|
||||||
<dot-dropdown :data="data" @editNode="handleCreateGroup" @deleteNode="handleDelete" />
|
<dot-dropdown :data="data" @editNode="handleCreateGroup" @deleteNode="handleDelete" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,10 +51,15 @@ import DotDropdown from './DotDropdown.vue'
|
||||||
import RelationList from './list.vue'
|
import RelationList from './list.vue'
|
||||||
import { getGroup, createGroup, modifyGroup, removeGroup } from 'services/relation'
|
import { getGroup, createGroup, modifyGroup, removeGroup } from 'services/relation'
|
||||||
import { useDelete } from '@cmp/cmp-element'
|
import { useDelete } from '@cmp/cmp-element'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { DotDropdown, RelationList },
|
components: { DotDropdown, RelationList, AmsPosition },
|
||||||
setup() {
|
setup() {
|
||||||
|
const { isLeaderPosition } = usePostion(() => {
|
||||||
|
getCategoryList()
|
||||||
|
})
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
// 分组管理
|
// 分组管理
|
||||||
const categoryList = ref([])
|
const categoryList = ref([])
|
||||||
|
@ -106,6 +112,7 @@ export default defineComponent({
|
||||||
handleDelete,
|
handleDelete,
|
||||||
saveGroup,
|
saveGroup,
|
||||||
listRef,
|
listRef,
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<cb-advance-table ref="tableRef" title="关联类型" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
<cb-advance-table ref="tableRef" title="关联类型" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
||||||
<template #action>
|
<template #action v-if="isLeaderPosition">
|
||||||
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus" :disabled="!categoryList.length">新增</el-button>
|
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus" :disabled="!categoryList.length">新增</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #operate="val, record">
|
<template #operate="val, record">
|
||||||
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
<template v-if="isLeaderPosition">
|
||||||
<div class="action-divider"></div>
|
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
||||||
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
<div class="action-divider"></div>
|
||||||
|
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</cb-advance-table>
|
</cb-advance-table>
|
||||||
<el-dialog :title="record.id ? '编辑关联类型' : '新增关联类型'" :close-on-click-modal="false" v-if="dialogVisible" :visible.sync="dialogVisible" width="35%">
|
<el-dialog :title="record.id ? '编辑关联类型' : '新增关联类型'" :close-on-click-modal="false" v-if="dialogVisible" :visible.sync="dialogVisible" width="35%">
|
||||||
|
@ -36,7 +38,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getRelation, createRelation, modifyRelation, removeRelation } from 'services/relation'
|
import { getRelation, createRelation, modifyRelation, removeRelation } from 'services/relation'
|
||||||
import { defineComponent, reactive, toRefs, ref } from 'vue'
|
import { defineComponent, reactive, toRefs, ref, inject } from 'vue'
|
||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
import { useTable } from '@cmp/cmp-element'
|
import { useTable } from '@cmp/cmp-element'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
@ -83,6 +85,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
const isLeaderPosition = inject('isLeaderPosition')
|
||||||
const searchConfigs = ref(cloneDeep(searchConfig))
|
const searchConfigs = ref(cloneDeep(searchConfig))
|
||||||
const { list, total, params, handleDelete, loading, getList } = useTable({
|
const { list, total, params, handleDelete, loading, getList } = useTable({
|
||||||
getService: getRelation,
|
getService: getRelation,
|
||||||
|
@ -139,6 +142,7 @@ export default defineComponent({
|
||||||
handleSearch,
|
handleSearch,
|
||||||
formRef,
|
formRef,
|
||||||
save,
|
save,
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<el-card class="leftC" shadow="never">
|
<el-card class="leftC" shadow="never">
|
||||||
<div slot="header" class="side-header">
|
<div slot="header" class="side-header">
|
||||||
<el-input placeholder="输入关键字进行过滤" v-model="filterText" clearable> </el-input>
|
<el-input placeholder="输入关键字进行过滤" v-model="filterText" clearable> </el-input>
|
||||||
<el-tooltip content="添加模型分组">
|
<el-tooltip content="添加模型分组" v-if="isLeaderPosition">
|
||||||
<i class="el-icon-plus cur-point m-l-xs" @click="handleCreateNode({ title: '新增根分组', operateType: 'create', isRoot: true, type: 'group' })"></i>
|
<i class="el-icon-plus cur-point m-l-xs" @click="handleCreateNode({ title: '新增根分组', operateType: 'create', isRoot: true, type: 'group' })"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, ref } from 'vue'
|
import { reactive, toRefs, ref, inject } from 'vue'
|
||||||
import { getRootGroups, removeModuleGroup, removeModule } from 'services/cmdb/module'
|
import { getRootGroups, removeModuleGroup, removeModule } from 'services/cmdb/module'
|
||||||
import { MessageBox, Message } from 'element-ui'
|
import { MessageBox, Message } from 'element-ui'
|
||||||
export default {
|
export default {
|
||||||
|
@ -29,6 +29,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
|
const isLeaderPosition = inject('isLeaderPosition')
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
addData: {
|
addData: {
|
||||||
data: {},
|
data: {},
|
||||||
|
@ -79,6 +80,7 @@ export default {
|
||||||
remove,
|
remove,
|
||||||
updateSuccess,
|
updateSuccess,
|
||||||
tree,
|
tree,
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<split-pane :min-percent="10" :default-percent="15" split="vertical" style="height: calc(100vh - 110px)">
|
<div>
|
||||||
<template slot="paneL">
|
<AmsPosition></AmsPosition>
|
||||||
<!-- <el-button @click="setIsLeaderPosition">设置是否主阵地 {{ isLeaderPosition }}</el-button>
|
<split-pane :min-percent="10" :default-percent="15" split="vertical" style="height: calc(100vh - 110px)">
|
||||||
<el-radio-group v-model="select" @change="SET_SELECTED_POSITION" v-if="isLeaderPosition">
|
<template slot="paneL">
|
||||||
<el-radio v-for="item in ['sma-1', 'ams-2']" :key="item" :label="item">{{ item }}</el-radio>
|
<SideMenu @handleNodeClick="handleNodeClick"></SideMenu>
|
||||||
</el-radio-group> -->
|
</template>
|
||||||
<SideMenu @handleNodeClick="handleNodeClick"></SideMenu>
|
<template slot="paneR">
|
||||||
</template>
|
<RightList ref="listRef"></RightList>
|
||||||
<template slot="paneR">
|
</template>
|
||||||
<RightList ref="listRef"></RightList>
|
</split-pane>
|
||||||
</template>
|
</div>
|
||||||
</split-pane>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, unref } from 'vue'
|
import { defineComponent, ref, unref } from 'vue'
|
||||||
|
@ -18,28 +17,15 @@ import SplitPane from 'vue-splitpane'
|
||||||
import SideMenu from './SideMenu.vue'
|
import SideMenu from './SideMenu.vue'
|
||||||
import RightList from './List.vue'
|
import RightList from './List.vue'
|
||||||
import usePostion from '@/views/usePostion'
|
import usePostion from '@/views/usePostion'
|
||||||
const addStorageEvent = (key, data) => {
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
// 创建一个StorageEvent事件
|
|
||||||
var newStorageEvent = document.createEvent('StorageEvent')
|
|
||||||
const storage = {
|
|
||||||
setItem: function (k, val) {
|
|
||||||
sessionStorage.setItem(k, val)
|
|
||||||
// 初始化创建的事件
|
|
||||||
newStorageEvent.initStorageEvent('setItem', false, false, k, null, val, null, null)
|
|
||||||
// 派发对象
|
|
||||||
window.dispatchEvent(newStorageEvent)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return storage.setItem(key, data)
|
|
||||||
}
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { SplitPane, SideMenu, RightList },
|
components: { SplitPane, SideMenu, RightList, AmsPosition },
|
||||||
setup() {
|
setup() {
|
||||||
// eslint-disable-next-line
|
const lastNode = ref({})
|
||||||
const { isLeaderPosition } = usePostion(() => {
|
usePostion(() => {
|
||||||
handleNodeClick(unref(lastNode))
|
handleNodeClick(unref(lastNode))
|
||||||
})
|
})
|
||||||
const lastNode = ref(null)
|
|
||||||
const listRef = ref()
|
const listRef = ref()
|
||||||
function handleNodeClick(node: any) {
|
function handleNodeClick(node: any) {
|
||||||
lastNode.value = node
|
lastNode.value = node
|
||||||
|
@ -48,22 +34,9 @@ export default defineComponent({
|
||||||
listRef.value.init(node)
|
listRef.value.init(node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const select = ref('')
|
|
||||||
const SET_SELECTED_POSITION = () => {
|
|
||||||
addStorageEvent('selectPostion', unref(select))
|
|
||||||
}
|
|
||||||
const setIsLeaderPosition = () => {
|
|
||||||
const val = Math.random() > 0.5
|
|
||||||
addStorageEvent('isLeaderPosition', val)
|
|
||||||
if (!val) addStorageEvent('selectPostion', '')
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
listRef,
|
listRef,
|
||||||
handleNodeClick,
|
handleNodeClick,
|
||||||
isLeaderPosition,
|
|
||||||
setIsLeaderPosition,
|
|
||||||
select,
|
|
||||||
SET_SELECTED_POSITION,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
||||||
<template #action>
|
<template #action v-if="isLeaderPosition">
|
||||||
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #name="name, record">
|
<template #name="name, record">
|
||||||
<span class="detail-href" @click="getDetail(record.id)">{{ name }}</span>
|
<span class="detail-href" @click="getDetail(record.id)">{{ name }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #operate="val, record">
|
<template #operate="val, record">
|
||||||
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
<template v-if="isLeaderPosition">
|
||||||
<div class="action-divider"></div>
|
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
||||||
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
<div class="action-divider"></div>
|
||||||
|
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</cb-advance-table>
|
</cb-advance-table>
|
||||||
<Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail>
|
<Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail>
|
||||||
|
@ -23,13 +26,17 @@ import { defineComponent, reactive, toRefs } from 'vue'
|
||||||
import { useTable } from '@cmp/cmp-element'
|
import { useTable } from '@cmp/cmp-element'
|
||||||
import { columns, searchConfigs } from './config'
|
import { columns, searchConfigs } from './config'
|
||||||
import { getInstanceTopo, removeInstanceTopo, getInstanceTopoDetail } from 'services/resource'
|
import { getInstanceTopo, removeInstanceTopo, getInstanceTopoDetail } from 'services/resource'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
AddData: () => import('./components/AddData.vue'),
|
AddData: () => import('./components/AddData.vue'),
|
||||||
Detail: () => import('./detail/index.vue'),
|
Detail: () => import('./detail/index.vue'),
|
||||||
|
AmsPosition,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
const { isLeaderPosition } = usePostion(() => getList())
|
||||||
const { list, total, loading, getList, params, handleDelete } = useTable({
|
const { list, total, loading, getList, params, handleDelete } = useTable({
|
||||||
getService: getInstanceTopo,
|
getService: getInstanceTopo,
|
||||||
removeService: removeInstanceTopo,
|
removeService: removeInstanceTopo,
|
||||||
|
@ -81,6 +88,7 @@ export default defineComponent({
|
||||||
handleDelete,
|
handleDelete,
|
||||||
getDetail,
|
getDetail,
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<AmsPosition></AmsPosition>
|
||||||
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
<cb-advance-table title="拓扑列表" :search-configs="searchConfigs" :data="list" :params="params" :columns="columns" :get-list="getList" :total="total" :loading="loading">
|
||||||
<template #action>
|
<template #action v-if="isLeaderPosition">
|
||||||
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
<el-button type="primary" @click="handleCreate()" icon="el-icon-plus">新增</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #name="name, record">
|
<template #name="name, record">
|
||||||
<span class="detail-href" @click="getDetail(record.id)">{{ name }}</span>
|
<span class="detail-href" @click="getDetail(record.id)">{{ name }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #operate="val, record">
|
<template #operate="val, record">
|
||||||
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
<template v-if="isLeaderPosition">
|
||||||
<div class="action-divider"></div>
|
<el-button type="text" @click="handleCreate(record)"><i class="el-icon-edit"></i> 编辑</el-button>
|
||||||
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
<div class="action-divider"></div>
|
||||||
|
<el-button type="text" @click="handleDelete(record)"><i class="el-icon-delete"></i> 删除</el-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</cb-advance-table>
|
</cb-advance-table>
|
||||||
<Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail>
|
<Detail :detail="detail" v-if="visible" @goBack="visible = false"></Detail>
|
||||||
|
@ -23,13 +26,17 @@ import { defineComponent, reactive, toRefs } from 'vue'
|
||||||
import { useTable } from '@cmp/cmp-element'
|
import { useTable } from '@cmp/cmp-element'
|
||||||
import { columns, searchConfigs } from './config'
|
import { columns, searchConfigs } from './config'
|
||||||
import { getInstanceTopo, removeInstanceTopo, getInstanceTopoDetail } from 'services/resource'
|
import { getInstanceTopo, removeInstanceTopo, getInstanceTopoDetail } from 'services/resource'
|
||||||
|
import usePostion from '@/views/usePostion'
|
||||||
|
import AmsPosition from '@/views/AmsPosition.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
AddData: () => import('./components/AddData.vue'),
|
AddData: () => import('./components/AddData.vue'),
|
||||||
Detail: () => import('./detail/index.vue'),
|
Detail: () => import('./detail/index.vue'),
|
||||||
|
AmsPosition,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
const { isLeaderPosition } = usePostion(() => getList())
|
||||||
const { list, total, loading, getList, params, handleDelete } = useTable({
|
const { list, total, loading, getList, params, handleDelete } = useTable({
|
||||||
getService: getInstanceTopo,
|
getService: getInstanceTopo,
|
||||||
removeService: removeInstanceTopo,
|
removeService: removeInstanceTopo,
|
||||||
|
@ -81,6 +88,7 @@ export default defineComponent({
|
||||||
handleDelete,
|
handleDelete,
|
||||||
getDetail,
|
getDetail,
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
isLeaderPosition,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { computed, onMounted, onUnmounted, provide, ref, unref, watch } from 'vu
|
||||||
|
|
||||||
const usePostion = (cb?: Function) => {
|
const usePostion = (cb?: Function) => {
|
||||||
const isLeaderPosition = ref(false)
|
const isLeaderPosition = ref(false)
|
||||||
const selectPostion = ref('')
|
const value = window.sessionStorage.getItem('selectPostion') || ''
|
||||||
|
const selectPostion = ref(value)
|
||||||
provide(
|
provide(
|
||||||
'isLeaderPosition',
|
'isLeaderPosition',
|
||||||
computed(() => unref(isLeaderPosition))
|
computed(() => unref(isLeaderPosition))
|
||||||
|
|
Loading…
Reference in New Issue