This commit is contained in:
fks-yangshouda
2024-07-09 17:35:59 +08:00
9 changed files with 94 additions and 25 deletions

View File

@@ -48,6 +48,15 @@
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) {
// // padding-top: 80px !important;
// }

View File

@@ -9,4 +9,5 @@ export enum device {
export enum group {
queryDeviceGroupTree = `${BASE_URL}/deviceGroup/queryDeviceGroupTree`, // 左侧树
creatOrUpdate = `${BASE_URL}/deviceGroup/creatOrUpdate`, // 左侧树节点新增编辑
del = `${BASE_URL}/deviceGroup/del`, // 左侧树节点新增编辑
}

View File

@@ -1,13 +1,14 @@
<template>
<ns-modal
ref="modalRef"
centered
v-bind="extraModalConfig"
destroyOnClose
v-model:visible="visible"
:title="title"
:okButtonProps="buttonProps"
@ok="handleOk">
<ns-form ref="formRef" :schemas="schemas" :model="formData" formLayout="formVertical" />
<ns-form ref="formRef" :schemas="schemas" :model="formData" formLayout="vertical" />
</ns-modal>
</template>
@@ -21,6 +22,7 @@
api: string | object | Function;
data?: object;
extraModalConfig?: object;
success?: Function;
};
const route = useRoute();
const { httpRequest } = useApi();
@@ -59,14 +61,15 @@
formRef.value
.triggerSubmit()
.then((data: any) => {
const { api } = props;
const { api, success } = props;
const requestConfig: HttpRequestConfig = { method: 'POST' };
const { params } = route;
httpRequest({ api, params: data, pathParams: params, requestConfig })
.then(() => {
.then((res) => {
NsMessage.success('操作成功', 1, () => {
toggle();
success && success(res);
});
})
.finally(() => {

View 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

View 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

View File

@@ -62,7 +62,12 @@ const mockData = ref(data.listData);
export const formSchema = [
{
field: 'isCreate',
component: 'NsInput',
component: 'NsCheck',
show: false,
},
{
field: 'isCreatSon',
component: 'NsCheck',
show: false,
},
{
@@ -71,7 +76,12 @@ export const formSchema = [
show: false,
},
{
field: 'isCreatSon',
field: 'id',
component: 'NsInput',
show: false,
},
{
field: 'pid',
component: 'NsInput',
show: false,
},
@@ -95,10 +105,10 @@ export const formSchema = [
component: 'NsSelectApi',
componentProps: {
placeholder: '请选择节点类型(必填)',
api: dict,
params: { dicKey: 'COUNT_POINT' },
api: () => dict({ params: { dicKey: 'COUNT_POINT' } }),
// params: { dicKey: 'COUNT_POINT' },
immediate: true,
resultField: 'data.COUNT_POINT',
// resultField: 'data.COUNT_POINT',
labelField: 'cnValue',
valueField: 'cnValue',
},
@@ -118,6 +128,7 @@ export const treeConfig = (orgId) => {
title: '能耗分组',
},
params: { orgId },
showLine: { showLeafIcon: false },
api: group.queryDeviceGroupTree,
// api: () => {
// return new Promise((resolve) => {
@@ -127,7 +138,7 @@ export const treeConfig = (orgId) => {
// });
// },
transform: (data) => {
return [{ title: '全部', key: 'all', selectable: false, children: data }];
return [{ pointName: '全部', id: 'all', selectable: false, children: data }];
},
formConfig: {
schemas: [

View File

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

View File

@@ -26,6 +26,7 @@
</div>
<a-drawer
:width="500"
title=" "
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
@@ -545,7 +546,8 @@
{
label: '新增',
name: 'userAdd',
type: 'primary',
style: { marginBottom: '16px' },
// type: 'primary',
handle: () => {
addformvisible.value = true;
},
@@ -644,6 +646,9 @@
:deep(.ns-table-main) {
border-top: 0;
padding: 0;
.drawerTable {
margin-top: 16px;
}
}
}
</style>