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,
textNumber: 5,
},
{
title: '设备名称',
title: '设备id',
dataIndex: 'deviceInfoCode',
textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
},
{
title: '设备id',
dataIndex: 'deviceInfoCode',
title: '设备编号',
textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
},
{
textNumber: 5,
@ -77,14 +78,22 @@ const tableCarbonKeyMap = [
{
title: '分组名称',
textNumber: 10,
dataIndex: 'deviceNameType',
dataIndex: 'pointName',
},
{
textNumber: 5,
title: '设备状态',
dataIndex: 'status',
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 {
defaultExpandAll: true,
header: {
@ -233,6 +242,8 @@ export const treeConfig = (orgId) => {
return [{ pointName: '全部', id: 'all', selectable: false, children: data }];
},
formConfig: {
callList: true, // 刷新列表
// defaultSelection: true, //树默认选择第一个
schemas: [
{
field: 'energyType',
@ -248,6 +259,12 @@ export const treeConfig = (orgId) => {
valueField: 'dicKey',
placeholder: '请选择能耗种类',
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: '编辑',
name: 'GroupPointEdit',
type: 'primary',
handle: (a, b) => {
if (isCarbon) {
handle: async (a, b) => {
// if (isCarbon) {
editCarbonEquipmentRef.value.toggle();
} else {
el.value.toggle();
}
// } else {
// el.value.toggle();
// }
},
},
{
@ -656,7 +673,7 @@ export const tableConfigCal = (
};
};
export const editCarbonEquipmentConfig = (orgId) => {
export const editCarbonEquipmentConfig = (orgId, props) => {
return ref({
title: '设备信息',
api: device.queryDevicePage,
@ -674,22 +691,6 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: {
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',
label: '设备名称',
component: 'NsInput',
@ -743,6 +744,26 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: {
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',
label: '设备区域',
component: 'NsCascader',

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

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

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

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

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

@ -340,12 +340,26 @@
//
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // getMonth() 0-11
const day = String(today.getDate()).padStart(2, '0');
const month = Number(String(today.getMonth() + 1).padStart(2, '0')); // getMonth() 0-11
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;
endTime = year + '-' + month + '-' + day;
}
}
//
http

Loading…
Cancel
Save