feat: 查询补充

This commit is contained in:
xuziqiang
2024-07-15 15:53:54 +08:00
parent 0681836c02
commit 32d1a633b1
8 changed files with 112 additions and 529 deletions

View File

@@ -1,8 +1,9 @@
import { NsSelect } from './../../../../../lib/component/form/select/index';
import { dateUtil } from '/nerv-lib/util/date-util';
import data from './mock.json';
import { http } from '/nerv-lib/util';
import { ref } from 'vue';
import { group } from '/@/api/deviceManage';
import { device, group } from '/@/api/deviceManage';
import { dict } from '/@/api';
import { origanizemanage } from '/@/api/origanizemanage';
const tableCalKeyMap = [
@@ -122,7 +123,7 @@ export const formSchema = [
immediate: true,
// resultField: 'data.COUNT_POINT',
labelField: 'cnValue',
valueField: 'cnValue',
valueField: 'dicKey',
},
rules: [
{
@@ -198,7 +199,7 @@ export const treeConfig = (orgId) => {
immediate: true,
// resultField: 'data.ENERGY_TYPE',
labelField: 'cnValue',
valueField: 'cnValue',
valueField: 'dicKey',
placeholder: '请选择能耗种类',
autoSelectFirst: true,
},
@@ -303,9 +304,22 @@ export const tableConfig = (el, elGroup, elFormula, defaultParams) => {
schemas: [
{
field: 'orgName',
component: 'NsInput',
component: 'NsSelectApi',
defaultParams: defaultParams.value,
componentProps: {
placeholder: '请选择公司',
mode: 'multiple',
api: group.dropGroupFilter,
resultField: 'data',
params: { filterField: 'ORG' },
labelField: 'orgName',
valueField: 'orgId',
filterOption: (input: string, option: any) => {
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
showSearch: true,
dropdownReload: true,
allowClear: true,
},
},
{
@@ -433,11 +447,23 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
formConfig: {
schemas: [
{
field: 'name',
label: '公司',
component: 'NsInput',
field: 'orgIds',
component: 'NsSelectApi',
defaultParams: defaultParams.value,
componentProps: {
placeholder: '请选择公司',
mode: 'multiple',
api: group.dropGroupInfoFilter,
resultField: 'data',
params: { filterField: 'ORG' },
labelField: 'orgName',
valueField: 'orgId',
filterOption: (input: string, option: any) => {
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
showSearch: true,
dropdownReload: true,
allowClear: true,
},
},
{
@@ -455,17 +481,40 @@ export const tableConfigCal = (el, elGroup, elFormula, defaultParams) => {
},
},
{
field: 'provider',
component: 'NsInput',
field: 'deviceStatus',
component: 'NsSelectApi',
componentProps: {
placeholder: '请输入设备状态',
placeholder: '请选择设备状态',
api: () => dict({ params: { dicKey: 'DEVICE_STATUS' } }),
immediate: true,
labelField: 'cnValue',
valueField: 'dicKey',
},
},
{
field: 'deviceNameType',
component: 'NsInput',
component: 'NsSelectApi',
defaultParams: defaultParams.value,
componentProps: {
placeholder: '请输入设备型号',
placeholder: '请选择设备型号',
mode: 'multiple',
api: (params: any) => {
return http.post(group.dropGroupInfoFilter, params).then((res: any) => {
const result = [...new Set(res.data)];
return { data: result };
});
},
resultField: 'data',
params: { filterField: 'DEVICE_TYPE' },
// labelField: 'orgName',
// valueField: 'orgId',
filterOption: (input: string, option: any) => {
return option.deviceName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
showSearch: true,
dropdownReload: true,
allowClear: true,
},
},
{

View File

@@ -104,7 +104,7 @@
item['key'] = item.id.toString();
return item;
});
targetKeys.value = res.data.linkGroups?.map((item) => {
targetKeys.value = res.data.linkDeviceInfos?.map((item) => {
return item.id.toString();
});
});

View File

@@ -7,6 +7,7 @@
:cancel="() => (visible = false)"
placement="right">
<ns-form
ref="editGroupRef"
:schemas="schemas(inputDisabled)"
:model="model"
formLayout="vertical"
@@ -15,7 +16,7 @@
<template #addonAfter="data">
<template v-if="data.field === 'groupName'">
<div class="iconOP">
<EditOutlined v-if="inputDisabled" @click="() => (inputDisabled = false)" />
<EditOutlined v-if="inputDisabled" @click="editGroup" />
<CheckOutlined v-else @click="op" />
</div>
</template>
@@ -53,6 +54,7 @@
const emit = defineEmits(['sure']);
const props = defineProps({ params: Object });
const visible = ref(false);
const editGroupRef = ref();
const model = ref({});
const inputDisabled = ref(true);
const selectedRowKeys = ref([]);
@@ -63,6 +65,7 @@
};
const startCararcter = 65;
// 点击新增按钮新增分组
const addGroup = () => {
opType = true;
getCode();
@@ -71,19 +74,30 @@
model.value = { groupName: '' };
// if(mockDataSource.value.length)
};
const op = () => {
inputDisabled.value = !inputDisabled.value;
add();
};
//新增
const editGroup = () => {
if (!selectedRowKeys.value?.length) {
NsMessage.warn('请先选择需要编辑的分组');
return;
}
inputDisabled.value = false;
};
//点击对钩按钮处理保存逻辑
const add = () => {
const finalParams = { ...props.params, ...model.value };
if (opType) {
delete finalParams.id;
}
http.post(group.saveComputeGroup, finalParams).then(() => {
getTableData();
NsMessage.success('操作成功');
editGroupRef.value.triggerSubmit().then(() => {
http.post(group.saveComputeGroup, finalParams).then(() => {
getTableData();
NsMessage.success('操作成功');
});
});
};

View File

@@ -16,7 +16,14 @@
<template #title="data">
<div class="treeRow">
<div>
<ns-icon :name="data.pointType !== '计算节点' ? 'fenzujiedian' : 'jisuanjiedian'" />
<ns-icon
:name="
data?.id === 'all'
? 'common'
: data.pointType === 'GROUPING_NODE'
? 'fenzujiedian'
: 'jisuanjiedian'
" />
<span style="padding-left: 8px">{{ data.pointName }}</span>
</div>
<a-dropdown>
@@ -64,7 +71,12 @@
const treeRef = ref();
const defaultType = ref(true);
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
const defaultParams = ref({ orgId: result, energyType: '用电量', id: '', hxDeviceGroupId: '' });
const defaultParams = ref({
orgId: result,
energyType: 'ELECTRICITY_USAGE',
id: '',
hxDeviceGroupId: '',
});
const config = tableConfig(editDrawerRef, editGroupRef, editFormulaRef, defaultParams);
const configCal = tableConfigCal(editDrawerCalRef, editGroupRef, editFormulaRef, defaultParams);
@@ -165,7 +177,7 @@
defaultParams.value.energyType = energyType;
defaultParams.value.id = id;
defaultParams.value.hxDeviceGroupId = id;
defaultType.value = pointType === '分组节点';
defaultType.value = pointType === 'GROUPING_NODE';
defaultType.value
? tableRef.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
@@ -215,9 +227,16 @@
}
}
.treeRow {
.common-style {
display: flex;
justify-content: space-between;
align-items: center;
}
.treeRow {
.common-style;
> div:first-child {
.common-style;
}
}
</style>

View File

@@ -1,506 +0,0 @@
{
"data":[
{
"title": "家居照明",
"key": "1",
"children": [
{
"title": "灯泡",
"key": "1-1",
"children": [
{
"title": "LED灯泡",
"key": "1-1-1",
"children": [
{
"title": "E27 LED灯泡",
"key": "1-1-1-1",
"attr": {
"瓦特": "7W",
"光通量": "500lm",
"色温": "2700K"
}
},
{
"title": "E14 小灯泡",
"key": "1-1-1-2",
"attr": {
"瓦特": "4W",
"光通量": "250lm",
"色温": "6500K"
}
}
]
},
{
"title": "节能灯",
"key": "1-1-2",
"children": [
{
"title": "E27 节能灯泡",
"key": "1-1-2-1",
"attr": {
"瓦特": "11W",
"光通量": "800lm",
"色温": "6500K"
}
}
]
}
]
},
{
"title": "灯具",
"key": "1-2",
"children": [
{
"title": "吊灯",
"key": "1-2-1",
"children": [
{
"title": "水晶吊灯",
"key": "1-2-1-1",
"attr": {
"尺寸": "Φ60cm",
"适用面积": "15-20㎡"
}
},
{
"title": "现代简约吊灯",
"key": "1-2-1-2",
"attr": {
"尺寸": "Φ52cm",
"适用面积": "10-15㎡"
}
}
]
},
{
"title": "台灯",
"key": "1-2-2",
"children": [
{
"title": "护眼台灯",
"key": "1-2-2-1",
"attr": {
"瓦特": "18W",
"调光调色": "是"
}
},
{
"title": "折叠臂台灯",
"key": "1-2-2-2",
"attr": {
"瓦特": "14W",
"调光调色": "否"
}
}
]
}
]
},
{
"title": "开关插座",
"key": "1-3",
"children": [
{
"title": "智能开关",
"key": "1-3-1",
"children": [
{
"title": "触控式智能开关",
"key": "1-3-1-1",
"attr": {
"控制方式": "触控/远程",
"兼容性": "ZigBee/WiFi"
}
}
]
},
{
"title": "插座",
"key": "1-3-2",
"children": [
{
"title": "多功能插座",
"key": "1-3-2-1",
"attr": {
"插孔类型": "2/3插",
"USB接口": "有"
}
}
]
}
]
}
]
},
{
"title": "电梯",
"key": "3",
"children": [
{
"title": "扶梯",
"key": "301"
},
{
"title": "直梯",
"key": "302"
}
]
},
{
"title": "冷源源",
"key": "4",
"children": [
{
"title": "通风及空调设备",
"key": "5",
"children": [
{
"title": "组合式空调机组",
"key": "501"
},
{
"title": "新风机组",
"key": "502"
},
{
"title": "精密空调",
"key": "503"
},
{
"title": "风机盘管",
"key": "504"
},
{
"title": "VAV",
"key": "505"
},
{
"title": "室外多联机",
"key": "506"
},
{
"title": "风幕机",
"key": "507"
},
{
"title": "球喷",
"key": "508"
},
{
"title": "送风机",
"key": "509"
},
{
"title": "排风机",
"key": "510"
},
{
"title": "排风兼排烟机",
"key": "511"
},
{
"title": "通风机",
"key": "512"
},
{
"title": "风阀",
"key": "513"
},
{
"title": "风柱式空调",
"key": "514"
}
]
}
]
},
{
"title": "照明",
"key": "6",
"children": [
{
"title": "多功能传感器",
"key": "701"
},
{
"title": "照度传感器",
"key": "702"
},
{
"title": "噪声传感器",
"key": "703"
}
]
}
],
"dataSource":[
{
"id": "d4",
"isDel": "0",
"officesId": "84",
"deviceCode": "37430200143",
"deviceName": "地听测试电表",
"category": "1",
"type": "1001",
"energyCount": "1",
"serialNumber": "69",
"pidCode": null,
"brand": "",
"types": "",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": "84566",
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "cupidatat nisi ea ad",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": null,
"children": null,
"devicePointList": null,
"insertUser": null
},
{
"id": "d1",
"isDel": "0",
"officesId": "84",
"deviceCode": "37430200144",
"deviceName": "地听测试2",
"category": "1",
"type": "1001",
"energyCount": "1",
"serialNumber": "69",
"pidCode": null,
"brand": "",
"types": "",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": "84566",
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "802",
"ip": "10.5.36.0",
"port": "6000",
"com": "",
"slaveAddress": "123测试",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": "2024-02-28 11:26:58",
"children": null,
"devicePointList": null,
"insertUser": null
},
{
"id": "d2",
"isDel": "0",
"officesId": "84",
"deviceCode": "1235623",
"deviceName": "测试设备2",
"category": "1",
"type": "1001",
"energyCount": "是",
"serialNumber": "69",
"pidCode": null,
"brand": "",
"types": "",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": null,
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "cupidatat nisi ea ad",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": "2024-02-28 11:31:57",
"children": null,
"devicePointList": null,
"insertUser": null
},
{
"id": "d7",
"isDel": "0",
"officesId": "",
"deviceCode": "0213",
"deviceName": "测试",
"category": "1",
"type": "1001",
"energyCount": "1",
"serialNumber": "",
"pidCode": null,
"brand": "6da085e5-956d-4000-bd3c-ebb01a9c99a1",
"types": "d7a8aede-b821-4ff2-953d-601a20e5a948",
"manufacturer": "",
"contacts": "",
"phonenumber": null,
"position": "",
"activeState": "",
"measurementDirection": "",
"deviceMagnification": null,
"deviceAccuracy": null,
"frequency": "",
"standardFrequency": "",
"deviceHead": "",
"constructor": "",
"voltageType": "",
"pt": null,
"ct": null,
"communicationProtocol": "",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "1",
"multiplicationAdjustment": "1",
"accessMethod": "",
"replacementFrequency": "0",
"dataDetail": "",
"insertTime": "2024-03-14 20:01:53",
"children": null,
"devicePointList": null,
"insertUser": ""
},
{
"id": "d3",
"isDel": "0",
"officesId": "84",
"deviceCode": "81",
"deviceName": "设备名称1111",
"category": "1",
"type": "1001",
"energyCount": "1",
"serialNumber": "69",
"pidCode": null,
"brand": "6da085e5-956d-4000-bd3c-ebb01a9c99a1",
"types": "d7a8aede-b821-4ff2-953d-601a20e5a948",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": "84566",
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "cupidatat nisi ea ad",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": "2024-03-15 17:34:24",
"children": null,
"devicePointList": null,
"insertUser": null
},
{
"id": "d43fdfff_02_0001",
"isDel": "0",
"officesId": "843fdffff213d2d3",
"deviceCode": "00037430200143",
"deviceName": "应感者酸严",
"category": "1",
"type": "1001",
"energyCount": "esse consequat",
"serialNumber": "69",
"pidCode": null,
"brand": "",
"types": "",
"manufacturer": "elit non in",
"contacts": "ad reprehenderit",
"phonenumber": "34",
"position": "in esse commodo",
"activeState": "1",
"measurementDirection": "1",
"deviceMagnification": 62,
"deviceAccuracy": "89",
"frequency": "anim consequat irure",
"standardFrequency": "ut elit",
"deviceHead": "pariatur ex velit",
"constructor": "84566",
"voltageType": "cillum aliquip reprehenderit",
"pt": 61,
"ct": 64,
"communicationProtocol": "cupidatat nisi ea ad",
"ip": "",
"port": "",
"com": "",
"slaveAddress": "",
"dlt": "",
"conversionIdentifier": "48",
"multiplicationAdjustment": "1",
"accessMethod": "1",
"replacementFrequency": "0",
"dataDetail": "sit",
"insertTime": "2024-04-29 11:12:43",
"children": null,
"devicePointList": null,
"insertUser": null
}
]
}