Browse Source

1.修改 设备管理 - 分组管理 页面

2.修改 监控中心 - 能耗监测 初始化时间bug
temp
fks-yangshouda 3 months ago
parent
commit
30a76a5cc3
  1. 81
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  2. 47
      hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue
  3. 18
      hx-ai-intelligent/src/view/equipmentManage/group/index.vue
  4. 18
      hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue

81
hx-ai-intelligent/src/view/equipmentManage/group/config.ts

@ -48,16 +48,17 @@ const tableCarbonKeyMap = [
// textEllipsis: true, // textEllipsis: true,
textNumber: 5, textNumber: 5,
}, },
{ {
title: '设备名称', title: '设备id',
dataIndex: 'deviceInfoCode',
textNumber: 10, textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
}, },
{ {
title: '设备id', title: '设备编号',
dataIndex: 'deviceInfoCode',
textNumber: 10, textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
}, },
{ {
textNumber: 5, textNumber: 5,
@ -77,14 +78,22 @@ const tableCarbonKeyMap = [
{ {
title: '分组名称', title: '分组名称',
textNumber: 10, textNumber: 10,
dataIndex: 'deviceNameType', dataIndex: 'pointName',
}, },
{ {
textNumber: 5, textNumber: 5,
title: '设备状态', title: '设备状态',
dataIndex: 'status', dataIndex: 'status',
customRender: ({ value }) => { customRender: ({ value }) => {
return value === '0' ? '启用' : '停用'; if (value) {
if (value === '0') {
return '启用';
} else if (value === '1') {
return '停用';
}
} else {
return '';
}
}, },
}, },
]; ];
@ -219,7 +228,7 @@ export const editCalTreeConfig = (orgId) => ({
], ],
}, },
}); });
export const treeConfig = (orgId) => { export const treeConfig = (orgId, editCarbonEquipmentRef, tableRef) => {
return { return {
defaultExpandAll: true, defaultExpandAll: true,
header: { header: {
@ -233,6 +242,8 @@ export const treeConfig = (orgId) => {
return [{ pointName: '全部', id: 'all', selectable: false, children: data }]; return [{ pointName: '全部', id: 'all', selectable: false, children: data }];
}, },
formConfig: { formConfig: {
callList: true, // 刷新列表
// defaultSelection: true, //树默认选择第一个
schemas: [ schemas: [
{ {
field: 'energyType', field: 'energyType',
@ -248,6 +259,12 @@ export const treeConfig = (orgId) => {
valueField: 'dicKey', valueField: 'dicKey',
placeholder: '请选择能耗种类', placeholder: '请选择能耗种类',
autoSelectFirst: true, autoSelectFirst: true,
onSelect: async (cur, record) => {
editCarbonEquipmentRef.value.changeEnergyType(cur);
tableRef.value?.nsTableRef.clearCheck();
tableRef.value?.nsTableRef.reload();
// value.value = cur;
},
}, },
}, },
{ {
@ -402,12 +419,12 @@ export const tableConfigCal = (
label: '编辑', label: '编辑',
name: 'GroupPointEdit', name: 'GroupPointEdit',
type: 'primary', type: 'primary',
handle: (a, b) => { handle: async (a, b) => {
if (isCarbon) { // if (isCarbon) {
editCarbonEquipmentRef.value.toggle(); editCarbonEquipmentRef.value.toggle();
} else { // } else {
el.value.toggle(); // el.value.toggle();
} // }
}, },
}, },
{ {
@ -656,7 +673,7 @@ export const tableConfigCal = (
}; };
}; };
export const editCarbonEquipmentConfig = (orgId) => { export const editCarbonEquipmentConfig = (orgId, props) => {
return ref({ return ref({
title: '设备信息', title: '设备信息',
api: device.queryDevicePage, api: device.queryDevicePage,
@ -674,22 +691,6 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: { formConfig: {
schemas: [ schemas: [
{ {
field: 'energyType',
label: '',
component: 'NsSelectApi',
autoSubmit: true,
componentProps: {
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
// params: { dicKey: 'ENERGY_TYPE' },
immediate: true,
// resultField: 'data.ENERGY_TYPE',
labelField: 'cnValue',
valueField: 'dicKey',
placeholder: '请选择能耗种类',
autoSelectFirst: true,
},
},
{
field: 'deviceType', field: 'deviceType',
label: '设备名称', label: '设备名称',
component: 'NsInput', component: 'NsInput',
@ -743,6 +744,26 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: { formConfig: {
schemas: [ schemas: [
{ {
field: 'energyType',
label: '',
component: 'NsSelectApi',
// autoSubmit: true,
defaultValue: props.params.energyType,
componentProps: {
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
// params: { dicKey: 'ENERGY_TYPE' },
immediate: true,
// resultField: 'data.ENERGY_TYPE',
labelField: 'cnValue',
valueField: 'dicKey',
placeholder: '请选择能耗种类',
// autoSelectFirst: true,
},
dynamicDisabled: (data: any) => {
return props.params.energyType !== 'CARBON_EMISSIONS';
},
},
{
field: 'areas', field: 'areas',
label: '设备区域', label: '设备区域',
component: 'NsCascader', component: 'NsCascader',

47
hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue

@ -28,6 +28,7 @@
<a-select <a-select
placeholder="请选择" placeholder="请选择"
style="width: 200px" style="width: 200px"
v-model:value="linkOrgId"
:options="linkList" :options="linkList"
:field-names="{ label: 'orgName', value: 'orgId' }" :field-names="{ label: 'orgName', value: 'orgId' }"
@change="handleChange" /> @change="handleChange" />
@ -44,33 +45,46 @@
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { group, device } from '/@/api/deviceManage'; import { group, device } from '/@/api/deviceManage';
const orgId = ref(''); const orgId = ref('');
const key = ref(Date.now()); const key = ref(Date.now());
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result; orgId.value = result;
const linkOrgId = ref('');
// const selectOrgId = ref(orgId.value); // const selectOrgId = ref(orgId.value);
const props = defineProps({ params: Object });
const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!); const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!);
let config = editCarbonEquipmentConfig(orgId.value); linkOrgId.value = linkList[0].orgId;
let config = editCarbonEquipmentConfig(orgId.value, props);
const visible = ref(false); const visible = ref(false);
const carbonEquipment = ref(); const carbonEquipment = ref();
// defineOptions({ // defineOptions({
// name: 'LedgerIndex', // name // name: 'LedgerIndex', // name
// }); // });
const changeEnergyType = (val) => {
props.params.energyType = val;
config = editCarbonEquipmentConfig(linkOrgId.value, props);
key.value = Date.now();
};
const handleChange = (value: string) => { const handleChange = (value: string) => {
// selectOrgId.value = value; // selectOrgId.value = value;
config = editCarbonEquipmentConfig(value); config = editCarbonEquipmentConfig(value, props);
debugger;
key.value = Date.now(); key.value = Date.now();
// carbonEquipment.value?.nsTableRef.reload(); // carbonEquipment.value?.nsTableRef.reload();
// carbonEquipment.value?.nsTableRef.treeReload(); // carbonEquipment.value?.nsTableRef.treeReload();
}; };
const props = defineProps({ params: Object });
const emit = defineEmits(['sure']); const emit = defineEmits(['sure']);
const toggle = () => { const toggle = (val) => {
if (val) {
config = editCarbonEquipmentConfig(linkOrgId.value, props);
key.value = Date.now();
}
visible.value = !visible.value; visible.value = !visible.value;
// clearData(); // clearData();
// visible.value && getData(currentId.value); // visible.value && getData(currentId.value);
@ -93,14 +107,35 @@
deviceInfoCode: selectedRowKeys[i], deviceInfoCode: selectedRowKeys[i],
}); });
} }
if (props.params.energyType && props.params.energyType == 'CARBON_EMISSIONS') {
http.post(group.addCarbonDevice, params).then(() => { http.post(group.addCarbonDevice, params).then(() => {
emit('sure'); emit('sure');
NsMessage.success('操作成功'); NsMessage.success('操作成功');
toggle(); toggle(null);
}); });
} else if (props.params.energyType && props.params.energyType != 'CARBON_EMISSIONS') {
// if (!currentId.value) {
// NsMessage.warn('');
// return;
// }
http
.post(group.saveComputeList, {
energyType: props.params.energyType,
orgId: props.params?.orgId,
hxDeviceGroupId: props.params?.hxDeviceGroupId,
saveOrgId: linkOrgId.value,
saveDeviceInfoCodes: selectedRowKeys,
})
.then(() => {
emit('sure');
NsMessage.success('操作成功');
toggle(null);
});
}
}; };
defineExpose({ defineExpose({
toggle, toggle,
changeEnergyType,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

18
hx-ai-intelligent/src/view/equipmentManage/group/index.vue

@ -54,7 +54,7 @@
v-show="!defaultType && isCarbon" v-show="!defaultType && isCarbon"
class="table" class="table"
v-bind="configCarbon" v-bind="configCarbon"
ref="tableCalRef" /> ref="tableCalRef2" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -80,6 +80,7 @@
const modalFormRef = ref(); const modalFormRef = ref();
const tableRef = ref(); const tableRef = ref();
const tableCalRef = ref(); const tableCalRef = ref();
const tableCalRef2 = ref();
const editDrawerRef = ref(); const editDrawerRef = ref();
const editDrawerCalRef = ref(); const editDrawerCalRef = ref();
const editGroupRef = ref(); const editGroupRef = ref();
@ -89,7 +90,7 @@
const treeRef = ref(); const treeRef = ref();
const defaultType = ref(true); const defaultType = ref(true);
const isCarbon = ref(true); const isCarbon = ref(false);
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
const defaultParams = ref({ const defaultParams = ref({
orgId: result, orgId: result,
@ -119,7 +120,7 @@
setFactorRef, setFactorRef,
); );
const tConfig = treeConfig(result); const tConfig = treeConfig(result, editCarbonEquipmentRef, tableRef);
const nsModalFormConfig = ref({ const nsModalFormConfig = ref({
api: group.creatOrUpdate, api: group.creatOrUpdate,
data: {}, data: {},
@ -219,6 +220,7 @@
// //
tableRef.value?.nsTableRef.clearCheck(); tableRef.value?.nsTableRef.clearCheck();
tableCalRef.value?.nsTableRef.clearCheck(); tableCalRef.value?.nsTableRef.clearCheck();
tableCalRef2.value?.nsTableRef.clearCheck();
const { const {
node: { pointType, id, energyType }, node: { pointType, id, energyType },
} = record; } = record;
@ -226,20 +228,24 @@
defaultParams.value.id = id; defaultParams.value.id = id;
defaultParams.value.hxDeviceGroupId = id; defaultParams.value.hxDeviceGroupId = id;
defaultType.value = pointType === 'GROUPING_NODE'; defaultType.value = pointType === 'GROUPING_NODE';
defaultType.value
? tableRef.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
if (energyType == 'CARBON_EMISSIONS') { if (energyType == 'CARBON_EMISSIONS') {
isCarbon.value = true; isCarbon.value = true;
} else { } else {
isCarbon.value = false; isCarbon.value = false;
} }
defaultType.value
? tableRef.value?.nsTableRef.reload()
: isCarbon.value
? tableCalRef2.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
}; };
const handleOk = () => { const handleOk = () => {
defaultType.value defaultType.value
? tableRef.value?.nsTableRef.reload() ? tableRef.value?.nsTableRef.reload()
: isCarbon.value
? tableCalRef2.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload(); : tableCalRef.value?.nsTableRef.reload();
}; };
</script> </script>

18
hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue

@ -340,12 +340,26 @@
// //
const today = new Date(); const today = new Date();
const year = today.getFullYear(); const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // getMonth() 0-11 const month = Number(String(today.getMonth() + 1).padStart(2, '0')); // getMonth() 0-11
const day = String(today.getDate()).padStart(2, '0'); const day = Number(String(today.getDate()).padStart(2, '0'));
if (dateTypeValue.value == 'month') {
startTime = year + '-' + month + '-01';
//
const date = new Date(year, month, 1);
//
// date.setDate(date.getDate() - 1);
endTime = date.toISOString().split('T')[0];
// endTime = endDate.value + '-01';
} else if (dateTypeValue.value == 'year') {
startTime = year + '-01-01';
endTime = year + '-12-31';
} else {
startTime = year + '-' + month + '-' + day; startTime = year + '-' + month + '-' + day;
endTime = year + '-' + month + '-' + day; endTime = year + '-' + month + '-' + day;
} }
}
// //
http http

Loading…
Cancel
Save