|
@ -10,20 +10,25 @@ |
|
|
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" /> |
|
|
<NsModalFrom ref="modalFormRef" v-bind="nsModalFormConfig" /> |
|
|
<div class="groupContainer"> |
|
|
<div class="groupContainer"> |
|
|
<div class="tree"> |
|
|
<div class="tree"> |
|
|
<ns-tree-api v-bind="tConfig" @select="handleSelect"> |
|
|
<ns-tree-api ref="treeRef" v-bind="tConfig" @select="handleSelect"> |
|
|
<template #title="data"> |
|
|
<template #title="data"> |
|
|
<div class="treeRow"> |
|
|
<div class="treeRow"> |
|
|
<span>{{ data.title }}</span> |
|
|
<div> |
|
|
|
|
|
<ns-icon :name="data.pointType !== '计算节点' ? 'fenzujiedian' : 'jisuanjiedian'" /> |
|
|
|
|
|
<span style="padding-left: 8px">{{ data.pointName }}</span> |
|
|
|
|
|
</div> |
|
|
<a-dropdown> |
|
|
<a-dropdown> |
|
|
<ns-icon name="actionMore" size="14" class="actionMore" /> |
|
|
<ns-icon name="actionMore" size="14" class="actionMore" /> |
|
|
<template #overlay> |
|
|
<template #overlay> |
|
|
<a-menu> |
|
|
<a-menu> |
|
|
<a-menu-item |
|
|
<template v-for="(item, index) in actionList" :key="index"> |
|
|
v-for="(item, index) in actionList" |
|
|
<!-- 全部节点只需要新增子节点 --> |
|
|
:key="index" |
|
|
<a-menu-item |
|
|
@click="item.func(data)"> |
|
|
v-if="data.id !== 'all' || item.key === 'addNodeSon'" |
|
|
<span>{{ item.title }}</span> |
|
|
@click="item.func(data)"> |
|
|
</a-menu-item> |
|
|
<span>{{ item.title }}</span> |
|
|
|
|
|
</a-menu-item> |
|
|
|
|
|
</template> |
|
|
</a-menu> |
|
|
</a-menu> |
|
|
</template> |
|
|
</template> |
|
|
</a-dropdown> |
|
|
</a-dropdown> |
|
@ -45,6 +50,7 @@ |
|
|
import { NsMessage, NsModal } from '/nerv-lib/component'; |
|
|
import { NsMessage, NsModal } from '/nerv-lib/component'; |
|
|
import NsModalFrom from '/@/components/ns-modal-form.vue'; |
|
|
import NsModalFrom from '/@/components/ns-modal-form.vue'; |
|
|
import { group } from '/@/api/deviceManage'; |
|
|
import { group } from '/@/api/deviceManage'; |
|
|
|
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
|
|
|
|
|
|
type opType = 'up' | 'down'; |
|
|
type opType = 'up' | 'down'; |
|
|
const { getParams } = useParams(); |
|
|
const { getParams } = useParams(); |
|
@ -52,6 +58,7 @@ |
|
|
const editDrawerRef = ref(); |
|
|
const editDrawerRef = ref(); |
|
|
const editGroupRef = ref(); |
|
|
const editGroupRef = ref(); |
|
|
const editFormulaRef = ref(); |
|
|
const editFormulaRef = ref(); |
|
|
|
|
|
const treeRef = ref(); |
|
|
const defaultType = ref(true); |
|
|
const defaultType = ref(true); |
|
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!); |
|
|
const config = tableConfig(editDrawerRef, editGroupRef, editFormulaRef); |
|
|
const config = tableConfig(editDrawerRef, editGroupRef, editFormulaRef); |
|
@ -65,6 +72,9 @@ |
|
|
extraModalConfig: { |
|
|
extraModalConfig: { |
|
|
bodyStyle: { paddingBottom: 0 }, |
|
|
bodyStyle: { paddingBottom: 0 }, |
|
|
}, |
|
|
}, |
|
|
|
|
|
success: () => { |
|
|
|
|
|
treeRef.value?.treeReload(); |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
console.log(modalFormRef.value, 'modal'); |
|
|
console.log(modalFormRef.value, 'modal'); |
|
@ -74,30 +84,35 @@ |
|
|
console.log(data); |
|
|
console.log(data); |
|
|
nsModalFormConfig.value.title = '新增'; |
|
|
nsModalFormConfig.value.title = '新增'; |
|
|
nsModalFormConfig.value.data = { |
|
|
nsModalFormConfig.value.data = { |
|
|
pointName: '新增', |
|
|
|
|
|
isCreate: true, |
|
|
isCreate: true, |
|
|
isCreatSon: false, |
|
|
|
|
|
orgId: result, |
|
|
orgId: result, |
|
|
}; |
|
|
}; |
|
|
|
|
|
if (data.id !== 'all') { |
|
|
|
|
|
nsModalFormConfig.value.data.pid = data.id; |
|
|
|
|
|
nsModalFormConfig.value.data.isCreatSon = true; |
|
|
|
|
|
} |
|
|
modalFormRef.value?.toggle(); |
|
|
modalFormRef.value?.toggle(); |
|
|
}; |
|
|
}; |
|
|
const editNode = (data) => { |
|
|
const editNode = (data) => { |
|
|
console.log(data); |
|
|
console.log(data); |
|
|
nsModalFormConfig.value.title = '编辑'; |
|
|
nsModalFormConfig.value.title = '编辑'; |
|
|
nsModalFormConfig.value.data = { pointName: 123 }; |
|
|
nsModalFormConfig.value.data = data; |
|
|
modalFormRef.value?.toggle(); |
|
|
modalFormRef.value?.toggle(); |
|
|
|
|
|
|
|
|
data.value = { pointName: 'qwe' }; |
|
|
|
|
|
}; |
|
|
}; |
|
|
const moveNode = (data, type: opType) => { |
|
|
const moveNode = (data, type: opType) => { |
|
|
console.log(data); |
|
|
console.log(data); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const deleteNode = (a) => { |
|
|
const deleteNode = (record) => { |
|
|
NsModal.confirm({ |
|
|
NsModal.confirm({ |
|
|
|
|
|
centered: true, |
|
|
|
|
|
title: '提示', |
|
|
content: '确定删除吗?', |
|
|
content: '确定删除吗?', |
|
|
onOk: () => { |
|
|
onOk: () => { |
|
|
console.log(a); |
|
|
http.post(group.del, { id: record.id }).then(() => { |
|
|
|
|
|
treeRef.value?.treeReload(); |
|
|
|
|
|
NsMessage.success('删除成功'); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|