feat: 分组管理
This commit is contained in:
@@ -48,6 +48,15 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// :deep(.ant-menu-item),
|
||||||
|
// :deep(.ant-menu-submenu-title) {
|
||||||
|
// &:not(.ant-menu-item-selected) {
|
||||||
|
// // &:not(.ant-menu-item-active) {
|
||||||
|
// .anticon {
|
||||||
|
// color: rgb(141, 150, 163);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// :deep(.ns-content) {
|
// :deep(.ns-content) {
|
||||||
// // padding-top: 80px !important;
|
// // padding-top: 80px !important;
|
||||||
// }
|
// }
|
||||||
|
@@ -8,4 +8,5 @@ export enum device {
|
|||||||
export enum group {
|
export enum group {
|
||||||
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`, // 左侧树
|
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`, // 左侧树
|
||||||
creatOrUpdate = `${BASE_URL}/deviceGroup/creatOrUpdate`, // 左侧树节点新增编辑
|
creatOrUpdate = `${BASE_URL}/deviceGroup/creatOrUpdate`, // 左侧树节点新增编辑
|
||||||
|
del = `${BASE_URL}/deviceGroup/del`, // 左侧树节点新增编辑
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ns-modal
|
<ns-modal
|
||||||
ref="modalRef"
|
ref="modalRef"
|
||||||
|
centered
|
||||||
v-bind="extraModalConfig"
|
v-bind="extraModalConfig"
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
v-model:visible="visible"
|
v-model:visible="visible"
|
||||||
:title="title"
|
:title="title"
|
||||||
:okButtonProps="buttonProps"
|
:okButtonProps="buttonProps"
|
||||||
@ok="handleOk">
|
@ok="handleOk">
|
||||||
<ns-form ref="formRef" :schemas="schemas" :model="formData" formLayout="formVertical" />
|
<ns-form ref="formRef" :schemas="schemas" :model="formData" formLayout="vertical" />
|
||||||
</ns-modal>
|
</ns-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
api: string | object | Function;
|
api: string | object | Function;
|
||||||
data?: object;
|
data?: object;
|
||||||
extraModalConfig?: object;
|
extraModalConfig?: object;
|
||||||
|
success?: Function;
|
||||||
};
|
};
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { httpRequest } = useApi();
|
const { httpRequest } = useApi();
|
||||||
@@ -59,14 +61,15 @@
|
|||||||
formRef.value
|
formRef.value
|
||||||
.triggerSubmit()
|
.triggerSubmit()
|
||||||
.then((data: any) => {
|
.then((data: any) => {
|
||||||
const { api } = props;
|
const { api, success } = props;
|
||||||
const requestConfig: HttpRequestConfig = { method: 'POST' };
|
const requestConfig: HttpRequestConfig = { method: 'POST' };
|
||||||
const { params } = route;
|
const { params } = route;
|
||||||
|
|
||||||
httpRequest({ api, params: data, pathParams: params, requestConfig })
|
httpRequest({ api, params: data, pathParams: params, requestConfig })
|
||||||
.then(() => {
|
.then((res) => {
|
||||||
NsMessage.success('操作成功', 1, () => {
|
NsMessage.success('操作成功', 1, () => {
|
||||||
toggle();
|
toggle();
|
||||||
|
success && success(res);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
10
hx-ai-intelligent/src/icon/fenzujiedian.svg
Normal file
10
hx-ai-intelligent/src/icon/fenzujiedian.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="8.98974609375" height="8.14453125" viewBox="0 0 8.98974609375 8.14453125" fill="none">
|
||||||
|
<path d="M7.93101 4.53462L6.23624 4.53462L5.52032 3.46466L6.49265 1.79796L5.44381 0L3.32621 0L2.27236 1.79796L3.29704 3.54617L2.62652 4.54987L1.05875 4.54987L0 6.34726L1.05875 8.1452L3.17144 8.1452L4.06128 6.62695L4.93729 6.62695L5.81886 8.13029L7.93102 8.13029L8.98978 6.33258L7.93101 4.53462ZM3.19734 4.59392L3.8643 3.59569L5.00553 3.59569L5.73168 4.68208L4.88461 6.1274L4.09644 6.1274L3.19734 4.59392Z" fill="url(#linear_fill_60_2513)" >
|
||||||
|
</path>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="linear_fill_60_2513" x1="4.494873046875" y1="0" x2="4.494873046875" y2="8.14453125" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#4DACE6" />
|
||||||
|
<stop offset="1" stop-color="#2A93D5" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 888 B |
10
hx-ai-intelligent/src/icon/jisuanjiedian.svg
Normal file
10
hx-ai-intelligent/src/icon/jisuanjiedian.svg
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="9.1005859375" height="9.099609375" viewBox="0 0 9.1005859375 9.099609375" fill="none">
|
||||||
|
<path d="M7.01762 4.69157L2.30136 4.69157C2.04227 4.66303 1.84615 4.44409 1.84615 4.18343C1.84615 3.92276 2.04227 3.70384 2.30136 3.67525L7.01762 3.67525C7.27673 3.70384 7.47285 3.92276 7.47285 4.18343C7.47285 4.44409 7.27673 4.66303 7.01762 4.69157ZM7.01762 6.69587L2.30136 6.69587C2.04227 6.6673 1.84615 6.44837 1.84615 6.18771C1.84615 5.92704 2.04227 5.70809 2.30136 5.67952L7.01762 5.67952C7.27673 5.70809 7.47285 5.92704 7.47285 6.18771C7.47285 6.44837 7.27673 6.6673 7.01762 6.69587ZM9.09498 8.33346L9.09498 1.98149C9.09498 1.21918 8.46167 1.27564 8.46167 1.27564L4.88941 1.27564C4.77006 1.27634 4.65399 1.23653 4.56021 1.16271C4.56021 1.16271 4.40816 0.880585 4.12926 0.428757C3.87605 -0.0795288 3.54708 0.00531769 3.54708 0.00531769L0.785301 0.00531769C0 0.00531769 0 0.824379 0 0.824379L0 8.27722C0 9.2087 0.633301 9.09628 0.633301 9.09628L8.53744 9.09628C9.19643 9.09547 9.09498 8.33345 9.09498 8.33345L9.09498 8.33346Z" fill="url(#linear_fill_60_2485)" >
|
||||||
|
</path>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="linear_fill_60_2485" x1="4.55029296875" y1="0" x2="4.55029296875" y2="9.099609375" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#4DACE6" />
|
||||||
|
<stop offset="1" stop-color="#2A93D5" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
@@ -62,7 +62,12 @@ const mockData = ref(data.listData);
|
|||||||
export const formSchema = [
|
export const formSchema = [
|
||||||
{
|
{
|
||||||
field: 'isCreate',
|
field: 'isCreate',
|
||||||
component: 'NsInput',
|
component: 'NsCheck',
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'isCreatSon',
|
||||||
|
component: 'NsCheck',
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -71,7 +76,12 @@ export const formSchema = [
|
|||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'isCreatSon',
|
field: 'id',
|
||||||
|
component: 'NsInput',
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'pid',
|
||||||
component: 'NsInput',
|
component: 'NsInput',
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
@@ -95,10 +105,10 @@ export const formSchema = [
|
|||||||
component: 'NsSelectApi',
|
component: 'NsSelectApi',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '请选择节点类型(必填)',
|
placeholder: '请选择节点类型(必填)',
|
||||||
api: dict,
|
api: () => dict({ params: { dicKey: 'COUNT_POINT' } }),
|
||||||
params: { dicKey: 'COUNT_POINT' },
|
// params: { dicKey: 'COUNT_POINT' },
|
||||||
immediate: true,
|
immediate: true,
|
||||||
resultField: 'data.COUNT_POINT',
|
// resultField: 'data.COUNT_POINT',
|
||||||
labelField: 'cnValue',
|
labelField: 'cnValue',
|
||||||
valueField: 'cnValue',
|
valueField: 'cnValue',
|
||||||
},
|
},
|
||||||
@@ -118,6 +128,7 @@ export const treeConfig = (orgId) => {
|
|||||||
title: '能耗分组',
|
title: '能耗分组',
|
||||||
},
|
},
|
||||||
params: { orgId },
|
params: { orgId },
|
||||||
|
showLine: { showLeafIcon: false },
|
||||||
api: group.queryDeviceGroupTree,
|
api: group.queryDeviceGroupTree,
|
||||||
// api: () => {
|
// api: () => {
|
||||||
// return new Promise((resolve) => {
|
// return new Promise((resolve) => {
|
||||||
@@ -127,7 +138,7 @@ export const treeConfig = (orgId) => {
|
|||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
transform: (data) => {
|
transform: (data) => {
|
||||||
return [{ title: '全部', key: 'all', selectable: false, children: data }];
|
return [{ pointName: '全部', id: 'all', selectable: false, children: data }];
|
||||||
},
|
},
|
||||||
formConfig: {
|
formConfig: {
|
||||||
schemas: [
|
schemas: [
|
||||||
|
@@ -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>
|
||||||
|
<template v-for="(item, index) in actionList" :key="index">
|
||||||
|
<!-- 全部节点只需要新增子节点 -->
|
||||||
<a-menu-item
|
<a-menu-item
|
||||||
v-for="(item, index) in actionList"
|
v-if="data.id !== 'all' || item.key === 'addNodeSon'"
|
||||||
:key="index"
|
|
||||||
@click="item.func(data)">
|
@click="item.func(data)">
|
||||||
<span>{{ item.title }}</span>
|
<span>{{ item.title }}</span>
|
||||||
</a-menu-item>
|
</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('删除成功');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:width="500"
|
:width="500"
|
||||||
|
title=" "
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:body-style="{ paddingBottom: '80px' }"
|
:body-style="{ paddingBottom: '80px' }"
|
||||||
:footer-style="{ textAlign: 'right' }"
|
:footer-style="{ textAlign: 'right' }"
|
||||||
@@ -545,7 +546,8 @@
|
|||||||
{
|
{
|
||||||
label: '新增',
|
label: '新增',
|
||||||
name: 'userAdd',
|
name: 'userAdd',
|
||||||
type: 'primary',
|
style: { marginBottom: '16px' },
|
||||||
|
// type: 'primary',
|
||||||
handle: () => {
|
handle: () => {
|
||||||
addformvisible.value = true;
|
addformvisible.value = true;
|
||||||
},
|
},
|
||||||
@@ -644,6 +646,9 @@
|
|||||||
:deep(.ns-table-main) {
|
:deep(.ns-table-main) {
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
.drawerTable {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -105,6 +105,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
getData();
|
getData();
|
||||||
|
const treeReload = (params) => {
|
||||||
|
getData(params);
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ treeReload });
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@gap: 16px;
|
@gap: 16px;
|
||||||
|
Reference in New Issue
Block a user