Browse Source

Merge branch 'temp' of http://123.60.103.97:3000/xuziqiang/SaaS-lib into temp

deploy-dev
xuziqiang 4 months ago
parent
commit
c085f51cd1
  1. 7
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  2. 100
      hx-ai-intelligent/src/components/ns-steps.vue
  3. 6
      hx-ai-intelligent/src/icon/baocun.svg
  4. 6
      hx-ai-intelligent/src/icon/bianji.svg
  5. 19
      hx-ai-intelligent/src/router/alarmManagement.ts
  6. 265
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue
  7. 6
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue
  8. 36
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue
  9. 294
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
  10. 44
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
  11. 6
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue
  12. 33
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts
  13. 25
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts
  14. 22
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue
  15. 42
      hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue
  16. 29
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue
  17. 234
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue
  18. 108
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/notificationManagementMock.json
  19. 124
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue
  20. 158
      hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts
  21. 56
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  22. 21
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  23. 22
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  24. 398
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  25. 96
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

7
hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts

@ -36,3 +36,10 @@ export enum quickCalculation {
export enum carbonEmission {
carbonEmissionStatistics = '/carbon-smart/api/carbon/energy/correlation/carbonEmissionStatistics',
}
// 碳盘查接口
export enum carbonInventoryCheck {
carbonInventoryList = '/carbon-smart/api/carbon/report/carbonInventoryList',
createOrUpdate = '/carbon-smart/api/carbon/report/createOrUpdate',
findById = '/carbon-smart/api/carbon/report/findById',
delete = '/carbon-smart/api/carbon/report/delete',
}

100
hx-ai-intelligent/src/components/ns-steps.vue

@ -3,40 +3,17 @@
<template v-for="(item, index) in dataSource" :key="index">
<a-step>
<template #icon>
<img :style="{ width: item.status === '2' ? '19px' : '20px' }" :src="getSrc(item)" />
<ns-icon size="20" :name="item.src" />
</template>
<template #description>
<div
style="
width: 400px;
min-height: 0px;
background-color: #f8fafc;
margin-left: 20px;
border-radius: 4px; /* 设置圆角半径 */
padding: 12px;
">
<div style="width: 100%; height: 30px; display: flex; position: relative">
<a-tag
style="width: 60px; height: 20px; text-align: center"
:color="getColor(item)"
>{{ getStatus(item) }}</a-tag
>
<div
style="
position: absolute;
left: 35%;
top: -2px;
transform: translateX(-50%);
color: #3a3a3a;
"
>{{ item.name }}</div
>
<div style="position: absolute; right: 10px; top: -2px; color: #ff7602"
>2024-03-11 11:30:06</div
>
<div class="card">
<div class="card-title">
<a-tag class="card-title-tag" :color="item.color">{{ item.statusName }}</a-tag>
<div class="name">{{ item.name }}</div>
<div class="time">{{ item.time }}</div>
</div>
<div style="width: 100%; color: #3a3a3a; height: 25px; overflow: auto">
工单已完成并通过验收</div
{{ item.desc }}</div
>
</div>
</template>
@ -53,37 +30,6 @@
size: any;
};
const props = withDefaults(defineProps<Props>(), {});
const getColor = (item: any) => {
switch (item.status) {
case '0':
return '#ff7602';
case '1':
return '#00a1e6';
case '2':
return '#04d919';
case '3':
return '#d9001b';
case '4':
return '#a6a6a6';
}
};
const getSrc = (item: any) => {
return '../../../../src/icon/status-' + item.status + '.svg';
};
const getStatus = (item: any) => {
switch (item.status) {
case '0':
return '待处理';
case '1':
return '处理中';
case '2':
return '已完成';
case '3':
return '超时';
case '4':
return '已关闭';
}
};
const { dataSource } = toRefs(props);
const { size } = toRefs(props);
@ -94,6 +40,38 @@
margin-left: 20px;
margin-top: 10px;
}
.card {
width: 400px;
min-height: 0px;
background-color: #f8fafc;
margin-left: 20px;
border-radius: 4px; /* 设置圆角半径 */
padding: 12px;
.card-title {
width: 100%;
height: 30px;
display: flex;
position: relative;
.card-title-tag {
width: 60px;
height: 20px;
text-align: center;
}
}
}
.name {
position: absolute;
left: 35%;
top: -2px;
transform: translateX(-50%);
color: #3a3a3a;
}
.time {
position: absolute;
right: 10px;
top: -2px;
color: #ff7602;
}
:deep(.ant-steps-item-tail) {
position: absolute !important;
top: -10px !important;

6
hx-ai-intelligent/src/icon/baocun.svg

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="20px" height="20px" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1 0 0 1 -320 -9 )">
<path d="M 5.72142857421875 4.29571427734375 L 5.72142857421875 0.0171428515625 L 10 0.0171428515625 L 10 4.29571427734375 L 5.72142857421875 4.29571427734375 Z M 14.564285722656251 0.3028571484375 L 19.84 5.57857142578125 C 19.9828571484375 5.57857142578125 19.9828571484375 5.864285703125001 20 6.0071428515625005 L 20 19.27 C 19.9828571484375 19.69857142578125 19.697142871093753 19.98428572265625 19.27 20 L 0.73 20 C 0.30142857421874997 19.98428572265625 0.015714277343749916 19.6985714453125 0 19.27 L 0 0.73 C 0.015714277343749916 0.30142857421874997 0.30142855468749996 0.015714277343749916 0.73 0.015714277343749916 L 4.29571427734375 0.015714277343749916 L 4.29571427734375 5.72142857421875 L 11.42571427734375 5.72142857421875 L 11.42571427734375 0.0171428515625 L 13.992857148437501 0.0171428515625 C 14.135714296875001 0.0171428515625 14.421428574218751 0.16 14.564285722656251 0.3028571484375 Z M 4.29571427734375 15.70428572265625 L 15.70428572265625 15.704285722656248 L 15.70428572265625 10 L 4.29571427734375 10 L 4.29571427734375 15.70428572265625 Z " fill-rule="nonzero" fill="#ff7602" stroke="none" transform="matrix(1 0 0 1 320 9 )" />
</g>
</svg>

6
hx-ai-intelligent/src/icon/bianji.svg

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="20px" height="20px" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1 0 0 1 -320 -9 )">
<path d="M 17.482232142857143 6.05310267857143 L 7.481830357142856 16.053526785714283 L 3.946339285714287 12.518035714285713 L 13.946741071428567 2.5176116071428565 L 17.482232142857143 6.05310267857143 Z M 2.8571428571428568 17.142857142857142 L 2.8571428571428568 13.607142857142856 L 6.392857142857144 17.142857142857142 L 2.8571428571428568 17.142857142857142 Z M 18.013392857142858 0.4017857142857143 L 19.598214285714285 1.9866071428571428 C 20.133928571428573 2.5223214285714284 20.133928571428573 3.3995535714285703 19.598214285714285 3.937500000000002 L 18.55357142857143 4.982142857142853 L 15.017857142857142 1.4464285714285705 L 16.062499999999996 0.4017857142857143 C 16.598214285714285 -0.13392857142857142 17.47544642857143 -0.13392857142857142 18.013392857142858 0.4017857142857143 Z M 0 15.714285714285714 L 1.4285714285714284 15.714285714285714 L 1.4285714285714284 18.571428571424978 L 1.4285714285714284 20 L 0 20 L 0 15.714285714285714 Z M 18.571428571428573 20 L 1.4285714285714284 20 L 1.4285714285714284 18.571428571428573 L 18.571428571428573 18.571428571428573 L 18.571428571428573 20 Z M 20 15.714285714285714 L 20 20 L 18.571428571428573 20 L 18.571428571428573 15.714285714285714 L 20 15.714285714285714 Z " fill-rule="nonzero" fill="#ff7602" stroke="none" transform="matrix(1 0 0 1 320 9 )" />
</g>
</svg>

19
hx-ai-intelligent/src/router/alarmManagement.ts

@ -43,6 +43,25 @@ const alarmManagement = {
},
],
},
// {
// path: 'gatewayAlarm',
// name: 'GatewayAlarm',
// meta: { title: '网关告警', hideChildren: true, icon: 'gaojingguanli' },
// component: Base,
// redirect: { name: 'GatewayAlarmIndex' },
// children: [
// {
// path: 'index',
// name: 'GatewayAlarmIndex',
// component: () => import('/@/view/alarmManagement/gatewayAlarm/index.vue'),
// meta: {
// title: '网关告警',
// keepAlive: false,
// // backApi: [],
// },
// },
// ],
// },
{
path: 'alarmSettings',
name: 'AlarmSettings',

265
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue

@ -8,9 +8,50 @@
:cancel="handleClose"
placement="right"
@close="handleClose">
<ns-form ref="formRef" :schemas="schemas" :model="infoObject" formLayout="vertical" />
<div style="margin-left: 52px">
应用规则:
<a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item name="alarmTitle" label="告警标题">
<ns-input allowClear v-model:value="infoObject.alarmTitle" placeholder="请输入告警标题" />
</a-form-item>
<a-form-item label="告警频率" name="alarmFrequency">
<a-select
v-model:value="infoObject.alarmFrequency"
placeholder="请选择告警频率"
style="width: 100%"
allowClear
:options="alarmFrequencyData" />
</a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数">
<ns-input-number v-model:value="infoObject.repetitions" placeholder="请输入重复次数" />
</a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="intervalDuration" label="间隔时长">
<ns-input-number
style="width: 60%"
v-model:value="infoObject.intervalDuration"
placeholder="请输入间隔时长" />
<a-select
v-model:value="infoObject.intervalDurationUnit"
placeholder="请选择间隔时长单位"
style="width: 40%"
allowClear
:options="intervalDurationUnitData" />
</a-form-item>
<a-form-item label="优先级" name="priority">
<a-select
v-model:value="infoObject.priority"
placeholder="请选择优先级"
style="width: 100%"
allowClear
:options="priorityData" />
</a-form-item>
<a-form-item label="监测频率" name="monitorFrequency">
<a-select
v-model:value="infoObject.monitorFrequency"
placeholder="请选择监测频率"
style="width: 100%"
allowClear
:options="monitorFrequencyData" />
</a-form-item>
<a-form-item label="启用规则">
<a-switch
:checked="infoObject?.enableRules === 1 ? true : false"
:class="{
@ -19,7 +60,14 @@
}"
style="margin-left: 6px"
@change="changeSwitch" />
</div>
</a-form-item>
<a-form-item label="是否创建工单" name="createWorkOrder">
<a-radio-group v-model:value="infoObject.createWorkOrder">
<a-radio value="1"> </a-radio>
<a-radio value="0"> </a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</ns-drawer>
</template>
<script lang="ts" setup>
@ -31,69 +79,16 @@
const visible = ref(false);
//
const infoObject = ref({
alarmTitle: null,
alarmFrequency: null,
priority: null,
monitorFrequency: null,
createWorkOrder: null,
enableRules: 0,
});
const formRef = ref();
const emit = defineEmits(['editObject']);
const toggle = (value: any) => {
//
if (value) {
infoObject.value = value;
} else {
infoObject.value = {
enableRules: 0,
};
}
visible.value = !visible.value;
};
const schemas = [
{
field: 'basicInfo',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
schemas: [
{
field: 'alarmTitle',
label: '告警标题',
component: 'NsInput',
rules: [
{
required: true,
message: '告警标题不能为空',
trigger: 'change',
validator: (rules: any, alarmTitle: any, cbfn: any) => {
if (alarmTitle && alarmTitle.trim() !== '') {
cbfn();
} else {
cbfn('告警标题不能为空');
}
},
},
],
componentProps: {
placeholder: '请输入告警标题',
maxLength: 20,
},
},
{
field: 'repetitions',
label: '重复次数',
rules: [
{
required: true,
message: '重复次数不能为空',
trigger: 'change',
},
],
component: 'NsSelect',
componentProps: {
allowClear: true,
placeholder: '请选择重复次数',
options: [
const alarmFrequencyData = ref([
{
label: '单次',
value: 1,
@ -106,24 +101,8 @@
label: '累计',
value: 3,
},
],
},
},
{
field: 'priority',
label: '优先级',
component: 'NsSelect',
rules: [
{
required: true,
message: '优先级不能为空',
trigger: 'change',
},
],
componentProps: {
allowClear: true,
placeholder: '请选择优先级',
options: [
]);
const priorityData = ref([
{
label: '紧急',
value: 1,
@ -136,24 +115,22 @@
label: '一般',
value: 3,
},
],
},
]);
const intervalDurationUnitData = ref([
{
label: '分',
value: 1,
},
{
field: 'monitorFrequency',
label: '监测频率',
component: 'NsSelect',
rules: [
label: '时',
value: 2,
},
{
required: true,
message: '监测频率不能为空',
trigger: 'change',
label: '天',
value: 3,
},
],
componentProps: {
allowClear: true,
placeholder: '请选择优先级',
options: [
]);
const monitorFrequencyData = ref([
{
label: '小时',
value: 1,
@ -174,32 +151,75 @@
label: '年度',
value: 5,
},
],
},
},
{
label: '是否创建工单',
field: 'createWorkOrder',
component: 'NsRadioGroup',
rules: [
]);
const rules = {
alarmTitle: [
{
required: true,
message: '是否创建工单不能为空',
message: '请输入告警标题',
trigger: 'change',
validator: (rules: any, alarmTitle: any, cbfn: any) => {
if (alarmTitle && alarmTitle.trim() !== '') {
cbfn();
} else {
cbfn('告警标题不能为空');
}
},
},
],
componentProps: {
radioType: 'radio',
options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
alarmFrequency: [{ required: true, message: '请选择告警频率', trigger: 'change' }],
intervalDuration: [
{
required: true,
message: '请输入正确的间隔时长',
trigger: 'change',
validator: (rules: any, intervalDuration: any, cbfn: any) => {
if (intervalDuration && intervalDuration > 0) {
cbfn();
} else {
cbfn('请输入正确的间隔时长');
}
if (!infoObject.value.intervalDurationUnit) {
cbfn('请选择间隔时长单位');
}
},
},
],
repetitions: [
{
required: true,
message: '请输入正确的重复次数',
trigger: 'change',
validator: (rules: any, repetitions: any, cbfn: any) => {
if (repetitions && repetitions > 0) {
cbfn();
} else {
cbfn('请输入正确的重复次数');
}
},
},
];
],
createWorkOrder: [{ required: true, message: '请选择是否创建工单', trigger: 'change' }],
monitorFrequency: [{ required: true, message: '请选择监测频率', trigger: 'change' }],
priority: [{ required: true, message: '请选择优先级', trigger: 'change' }],
monitorTimeUnit: [{ required: true, message: '请选择监测时长单位', trigger: 'change' }],
};
const toggle = (value: any) => {
//
if (value) {
infoObject.value = value;
} else {
infoObject.value = {
alarmTitle: null,
alarmFrequency: null,
priority: null,
monitorFrequency: null,
createWorkOrder: null,
enableRules: 0,
};
}
visible.value = !visible.value;
};
//
const changeSwitch = () => {
switch (infoObject.value.enableRules) {
@ -213,9 +233,16 @@
};
const btnClick = () => {
//
formRef.value.triggerSubmit().then(() => {
formRef.value.validate().then(() => {
let data = { ...infoObject.value };
data.createWorkOrder = Number(data.createWorkOrder);
if (data.alarmFrequency !== 2) {
data.repetitions = null;
data.intervalDuration = null;
data.intervalDurationUnit = null;
}
//
http.post(energyAlarms.addOrUpNewData, infoObject.value).then(() => {
http.post(energyAlarms.addOrUpNewData, data).then(() => {
emit('editObject', null);
if (infoObject.value.id) {
NsMessage.success('告警编辑成功');
@ -228,8 +255,13 @@
};
const handleClose = () => {
//
formRef.value.formElRef.clearValidate();
formRef.value.resetFields();
infoObject.value = {
alarmTitle: null,
alarmFrequency: null,
priority: null,
monitorFrequency: null,
createWorkOrder: null,
enableRules: 0,
};
visible.value = false;
@ -269,4 +301,9 @@
.grey-background.ant-switch .ant-switch-handle {
background-color: grey !important;
}
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;
width: 23%;
}
</style>

6
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/configureDeviceAlarms.vue

@ -204,7 +204,7 @@
title: value.errorCode,
schemas: [
{
field: 'deviceName',
field: 'deviceId',
label: '设备名称',
component: 'nsSelectApi',
componentProps: {
@ -231,7 +231,7 @@
label: '设备点位',
component: 'nsSelectApi',
dynamicParams: {
id: 'deviceName', //
id: 'deviceId', //
},
componentProps: {
api: device.queryDevicePoint,
@ -240,7 +240,7 @@
placeholder: '请选择设备点位',
labelField: 'code',
valueField: 'id',
dependency: 'deviceName',
dependency: 'deviceId',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.code.toLowerCase().indexOf(input.toLowerCase()) >= 0;

36
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue

@ -40,9 +40,9 @@
@change="selectDeviceType"
placeholder="请选择设备类型" />
</a-form-item>
<a-form-item label="设备名称" name="deviceName">
<a-form-item label="设备名称" name="deviceId">
<a-select
v-model:value="infoObject.deviceName"
v-model:value="infoObject.deviceId"
:disabled="!(infoObject && infoObject.deviceType && infoObject.deviceType.length > 0)"
style="width: 100%"
:autoClearSearchValue="true"
@ -61,7 +61,7 @@
show-search
placeholder="请选择设备点位"
style="width: 100%"
:disabled="!infoObject?.deviceName"
:disabled="!infoObject?.deviceId"
:options="devicePointData"
:filter-option="filterDevicePoint" />
</a-form-item>
@ -167,7 +167,7 @@
deviceType: [],
devicePoint: null,
valueType: null,
deviceName: null,
deviceId: null,
enableRules: 0,
alarmList: [{ logic: null, num: null, isDelete: 0 }],
});
@ -190,14 +190,14 @@
//
getDevicePage({
orgId: orgId.value,
code: selectedOptions[selectedOptions.length - 1].code,
deviceCode: selectedOptions[selectedOptions.length - 1].code,
pageNum: 1,
pageSize: 999,
});
};
//
const selectDevice = () => {
getDevicePoint({ id: infoObject.value.deviceName });
getDevicePoint({ id: infoObject.value.deviceId });
};
//
const getDevicePage = (value: any) => {
@ -258,17 +258,22 @@
const emit = defineEmits(['editObject']);
// id
function findParentIds(tree: any, targetId: number, result: any) {
function findParentIds(tree: any[], targetId: number, result: number[]): boolean {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.id === targetId)) {
result.unshift(item.id); // id
findParentIds(tree, item.id, result); // id
break; // 退
return true; //
}
//
if (findParentIds(item.children, targetId, result)) {
result.unshift(item.id); // id
return true;
}
}
}
return false; //
}
//
const findNodeById = (nodes: any, id: any) => {
for (let node of nodes) {
@ -305,7 +310,6 @@
siteDataTree.value = res.data.linkList;
}
});
//
if (value) {
//
@ -316,9 +320,13 @@
let selectDevice = ref([Number(infoObject.value.deviceType)]);
findNodeById(deviceTypeTreeData.value, Number(infoObject.value.deviceType));
//
getDevicePoint({ id: infoObject.value.deviceName });
getDevicePoint({ id: infoObject.value.deviceId });
//
findParentIds(deviceTypeTreeData.value, infoObject.value.deviceType, selectDevice.value);
findParentIds(
deviceTypeTreeData.value,
Number(infoObject.value.deviceType),
selectDevice.value,
);
//
if (
infoObject.value.hxAlarmRuleLogicList &&
@ -344,7 +352,7 @@
deviceType: [],
devicePoint: null,
valueType: null,
deviceName: null,
deviceId: null,
enableRules: 0,
alarmList: [{ logic: null, num: null, isDelete: 0 }],
};
@ -357,7 +365,7 @@
site: [{ required: true, message: '请选择站点', trigger: 'change' }],
deviceType: [{ required: true, message: '请选择设备类型', trigger: 'change' }],
enableRules: [{ required: true, message: '请选择启用规则', trigger: 'change' }],
deviceName: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
deviceId: [{ required: true, message: '请选择设备名称', trigger: 'change' }],
devicePoint: [{ required: true, message: '请选择设备点位', trigger: 'change' }],
valueType: [{ required: true, message: '请选择取值类型', trigger: 'change' }],
ruleType: [{ required: true, message: '请选择规则类型', trigger: 'change' }],

294
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue

@ -8,9 +8,56 @@
:cancel="handleClose"
placement="right"
@close="handleClose">
<ns-form ref="formRef" :schemas="schemas" :model="infoObject" formLayout="vertical" />
<div style="margin-left: 52px">
应用规则:
<a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item name="alarmTitle" label="告警标题">
<ns-input allowClear v-model:value="infoObject.alarmTitle" placeholder="请输入告警标题" />
</a-form-item>
<a-form-item label="告警频率" name="alarmFrequency">
<a-select
v-model:value="infoObject.alarmFrequency"
placeholder="请选择告警频率"
style="width: 100%"
allowClear
:options="alarmFrequencyData" />
</a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="repetitions" label="重复次数">
<ns-input-number v-model:value="infoObject.repetitions" placeholder="请输入重复次数" />
</a-form-item>
<a-form-item v-if="infoObject.alarmFrequency === 2" name="intervalDuration" label="间隔时长">
<ns-input-number
style="width: 60%"
v-model:value="infoObject.intervalDuration"
placeholder="请输入间隔时长" />
<a-select
v-model:value="infoObject.intervalDurationUnit"
placeholder="请选择间隔时长单位"
style="width: 40%"
allowClear
:options="intervalDurationUnitData" />
</a-form-item>
<a-form-item name="monitorTime" label="监测时长">
<ns-input-number
allowClear
v-model:value="infoObject.monitorTime"
placeholder="请输入监测时长" />
</a-form-item>
<a-form-item label="监测时长单位" name="monitorTimeUnit">
<a-select
v-model:value="infoObject.monitorTimeUnit"
placeholder="请选择监测时长单位"
style="width: 100%"
allowClear
:options="monitorTimeUnitData" />
</a-form-item>
<a-form-item label="优先级" name="priority">
<a-select
v-model:value="infoObject.priority"
placeholder="请选择优先级"
style="width: 100%"
allowClear
:options="priorityData" />
</a-form-item>
<a-form-item label="启用规则">
<a-switch
:checked="infoObject?.enableRules === 1 ? true : false"
:class="{
@ -19,7 +66,14 @@
}"
style="margin-left: 6px"
@change="changeSwitch" />
</div>
</a-form-item>
<a-form-item label="是否创建工单" name="createWorkOrder">
<a-radio-group v-model:value="infoObject.createWorkOrder">
<a-radio value="1"> </a-radio>
<a-radio value="0"> </a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</ns-drawer>
</template>
<script lang="ts" setup>
@ -32,72 +86,17 @@
//
const infoObject = ref({
id: null,
accountNo: null,
alarmTitle: null,
alarmFrequency: null,
monitorTime: null,
monitorTimeUnit: null,
priority: null,
createWorkOrder: null,
enableRules: 0,
});
const formRef = ref();
const emit = defineEmits(['editObject']);
const toggle = (value: any) => {
//
if (value) {
infoObject.value = value;
} else {
infoObject.value = {
id: null,
accountNo: null,
enableRules: 0,
};
}
visible.value = !visible.value;
};
const schemas = [
{
field: 'basicInfo',
label: '',
displayFormItem: false,
class: 'ns-form-item-full',
component: 'NsChildForm',
componentProps: {
schemas: [
{
field: 'alarmTitle',
label: '告警标题',
component: 'NsInput',
rules: [
{
required: true,
message: '告警标题不能为空',
trigger: 'change',
validator: (rules: any, alarmTitle: any, cbfn: any) => {
if (alarmTitle && alarmTitle.trim() !== '') {
cbfn();
} else {
cbfn('告警标题不能为空');
}
},
},
],
componentProps: {
placeholder: '请输入告警标题',
maxLength: 20,
},
},
{
field: 'repetitions',
label: '重复次数',
rules: [
{
required: true,
message: '重复次数不能为空',
trigger: 'change',
},
],
component: 'NsSelect',
componentProps: {
allowClear: true,
placeholder: '请选择重复次数',
options: [
const alarmFrequencyData = ref([
{
label: '单次',
value: 1,
@ -110,46 +109,22 @@
label: '累计',
value: 3,
},
],
},
},
]);
const monitorTimeUnitData = ref([
{
field: 'monitorTime',
label: '检测时长',
component: 'NsInputNumber',
rules: [
{
required: true,
validator: (rules: any, value: any, cbfn: any) => {
if (value && /^[0-9]*$/.test(value)) {
cbfn();
} else {
cbfn('请输入正确的监测时长');
}
},
trigger: 'change',
},
],
componentProps: {
placeholder: '请输入监测时长',
// maxLength: 30,
},
label: '分',
value: 1,
},
{
field: 'monitorTimeUnit',
label: '监测时长单位',
component: 'NsSelect',
rules: [
label: '时',
value: 2,
},
{
required: true,
message: '监测时长单位不能为空',
trigger: 'change',
label: '天',
value: 3,
},
],
componentProps: {
allowClear: true,
placeholder: '请选择监测时长单位',
options: [
]);
const intervalDurationUnitData = ref([
{
label: '分',
value: 1,
@ -162,24 +137,8 @@
label: '天',
value: 3,
},
],
},
},
{
field: 'priority',
label: '优先级',
component: 'NsSelect',
rules: [
{
required: true,
message: '优先级不能为空',
trigger: 'change',
},
],
componentProps: {
allowClear: true,
placeholder: '请选择优先级',
options: [
]);
const priorityData = ref([
{
label: '紧急',
value: 1,
@ -192,32 +151,83 @@
label: '一般',
value: 3,
},
],
]);
const toggle = (value: any) => {
//
if (value) {
infoObject.value = value;
} else {
infoObject.value = {
id: null,
accountNo: null,
enableRules: 0,
};
}
visible.value = !visible.value;
};
//
const rules = {
alarmTitle: [
{
required: true,
message: '请输入告警标题',
trigger: 'change',
validator: (rules: any, alarmTitle: any, cbfn: any) => {
if (alarmTitle && alarmTitle.trim() !== '') {
cbfn();
} else {
cbfn('告警标题不能为空');
}
},
},
{
label: '是否创建工单',
field: 'createWorkOrder',
component: 'NsRadioGroup',
rules: [
],
alarmFrequency: [{ required: true, message: '请选择告警频率', trigger: 'change' }],
monitorTime: [
{
required: true,
message: '是否创建工单不能为空',
message: '请输入正确的监测时长',
trigger: 'change',
validator: (rules: any, monitorTime: any, cbfn: any) => {
if (monitorTime && monitorTime > 0) {
cbfn();
} else {
cbfn('请输入正确的监测时长');
}
},
},
],
componentProps: {
radioType: 'radio',
options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
intervalDuration: [
{
required: true,
message: '请输入正确的间隔时长',
trigger: 'change',
validator: (rules: any, monitorTime: any, cbfn: any) => {
if (monitorTime && monitorTime > 0) {
cbfn();
} else {
cbfn('请输入正确的间隔时长');
}
},
},
],
repetitions: [
{
required: true,
message: '请输入正确的重复次数',
trigger: 'change',
validator: (rules: any, repetitions: any, cbfn: any) => {
if (repetitions && repetitions > 0) {
cbfn();
} else {
cbfn('请输入正确的重复次数');
}
},
},
];
],
createWorkOrder: [{ required: true, message: '请选择是否创建工单', trigger: 'change' }],
priority: [{ required: true, message: '请选择优先级', trigger: 'change' }],
monitorTimeUnit: [{ required: true, message: '请选择监测时长单位', trigger: 'change' }],
};
//
const changeSwitch = () => {
switch (infoObject.value.enableRules) {
@ -231,9 +241,16 @@
};
const btnClick = () => {
//
formRef.value.triggerSubmit().then(() => {
formRef.value.validate().then(() => {
//
http.post(deviceAlarms.addOrUpNewData, infoObject.value).then(() => {
let data = { ...infoObject.value };
data.createWorkOrder = Number(data.createWorkOrder);
if (data.alarmFrequency !== 2) {
data.repetitions = null;
data.intervalDuration = null;
data.intervalDurationUnit = null;
}
http.post(deviceAlarms.addOrUpNewData, data).then(() => {
if (infoObject.value.id) {
NsMessage.success('告警编辑成功');
} else {
@ -246,7 +263,7 @@
};
const handleClose = () => {
//
formRef.value.formElRef.clearValidate();
formRef.value.resetFields();
visible.value = false;
};
defineExpose({
@ -284,4 +301,9 @@
.grey-background.ant-switch .ant-switch-handle {
background-color: grey !important;
}
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;
width: 23%;
}
</style>

44
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue

@ -48,14 +48,26 @@
{{
record.monitorTime && record.monitorTimeUnit
? record.monitorTime + '' + record.monitorTimeUnit.label
: '-'
: ''
}}
</template>
<template v-if="column.dataIndex === 'repetition'">
{{ record.repetitions.label }}
</template>
<template v-if="column.dataIndex === 'prioritys'">
{{ record.priority ? record.priority.label : '-' }}
{{ record.priority ? record.priority.label : '' }}
</template>
<template v-if="column.dataIndex === 'alarmFrequency'">
{{ record.alarmFrequency ? record.alarmFrequency.label : '' }}
</template>
<template v-if="column.dataIndex === 'repetitions'">
{{
record.repetitions && record.alarmFrequency.value === 2 ? record.repetitions : ''
}}
</template>
<template v-if="column.dataIndex === 'interval'">
{{
record.intervalDuration && record.alarmFrequency.value === 2
? record.intervalDuration + '' + record.intervalDurationUnit.label
: ''
}}
</template>
</template>
</ns-view-list-table>
@ -89,14 +101,26 @@
clickSwitch({ type: 3, enableRules: record.enableRules, record: record })
" />
</template>
<template v-if="column.dataIndex === 'monitorFrequencys'">
<template v-if="column.dataIndex === 'monitorFrequency'">
{{ record.monitorFrequency.label }}
</template>
<template v-if="column.dataIndex === 'rep'">
{{ record.repetitions.label }}
<template v-if="column.dataIndex === 'alarmFrequency'">
{{ record.alarmFrequency ? record.alarmFrequency.label : '' }}
</template>
<template v-if="column.dataIndex === 'prioritys'">
{{ record.priority ? record.priority.label : '-' }}
<template v-if="column.dataIndex === 'priority'">
{{ record.priority ? record.priority.label : '' }}
</template>
<template v-if="column.dataIndex === 'repetitions'">
{{
record.repetitions && record.alarmFrequency.value === 2 ? record.repetitions : ''
}}
</template>
<template v-if="column.dataIndex === 'interval'">
{{
record.intervalDuration && record.alarmFrequency.value === 2
? record.intervalDuration + '' + record.intervalDurationUnit.label
: ''
}}
</template>
</template>
</ns-view-list-table>

6
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue

@ -1,8 +1,8 @@
<template>
<a-modal
<ns-modal
v-model:visible="show"
width="1100px"
style="top: 50%; transform: translateY(-50%); overflow-y: hidden"
style="overflow-y: hidden"
title="添加联系人"
@ok="handleOk"
@cancel="handleCancel">
@ -65,7 +65,7 @@
</div>
</div>
</div>
</a-modal>
</ns-modal>
</template>
<script lang="ts">

33
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts

@ -12,7 +12,7 @@ const tableKeyMap = [
},
{
title: '优先级',
dataIndex: 'prioritys',
dataIndex: 'priority',
},
{
title: '告警标题',
@ -23,12 +23,20 @@ const tableKeyMap = [
dataIndex: 'errorCode',
},
{
title: '告警频率',
dataIndex: 'alarmFrequency',
},
{
title: '重复次数',
dataIndex: 'rep',
dataIndex: 'repetitions',
},
{
title: '频率间隔',
dataIndex: 'interval',
},
{
title: '监测时长',
dataIndex: 'monitorFrequencys',
dataIndex: 'monitorFrequency',
},
{
title: '是否启用',
@ -99,9 +107,24 @@ export const energyAlarmConfigs = (
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
const obj = { ...data };
obj.monitorFrequency = data.monitorFrequency.value;
obj.priority = data.priority.value;
obj.repetitions = data.repetitions.value;
if (obj.alarmFrequency) {
obj.alarmFrequency = data.alarmFrequency.value;
}
if (obj.intervalDurationUnit) {
obj.intervalDurationUnit = data.intervalDurationUnit.value;
}
if (obj.monitorFrequency) {
obj.monitorFrequency = data.monitorFrequency.value;
}
if (obj.createWorkOrder) {
obj.createWorkOrder = data.createWorkOrder + '';
}
if (obj.alarmFrequency !== 2) {
obj.repetitions = null;
obj.intervalDuration = null;
obj.intervalDurationUnit = null;
}
editeEnergyAlarm.value.toggle(obj);
},
},

25
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts

@ -23,8 +23,16 @@ const tableKeyMap = [
dataIndex: 'errorCode',
},
{
title: '告警频率',
dataIndex: 'alarmFrequency',
},
{
title: '重复次数',
dataIndex: 'repetition',
dataIndex: 'repetitions',
},
{
title: '频率间隔',
dataIndex: 'interval',
},
{
title: '监测时长',
@ -101,7 +109,20 @@ export const equipmentAlarmTableConfig = (
handle: (data: any) => {
const obj = { ...data };
obj.priority = data.priority.value;
obj.repetitions = data.repetitions.value;
if (obj.alarmFrequency) {
obj.alarmFrequency = data.alarmFrequency.value;
}
if (obj.intervalDurationUnit) {
obj.intervalDurationUnit = data.intervalDurationUnit.value;
}
if (obj.createWorkOrder) {
obj.createWorkOrder = data.createWorkOrder + '';
}
if (obj.alarmFrequency !== 2) {
obj.repetitions = null;
obj.intervalDuration = null;
obj.intervalDurationUnit = null;
}
obj.monitorTimeUnit = data.monitorTimeUnit.value;
editEquipmentAlarm.value.toggle(obj);
},

22
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/look.vue

@ -10,15 +10,7 @@
@close="handleClose">
<div style="width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden">
<!-- top -->
<div
style="
width: 100%;
height: 35px;
display: flex;
position: relative;
font-size: 16px;
border-bottom: 1px solid #2778ff; /* 设置底部边框为1像素实线,并指定颜色 */
">
<div class="box">
<div class="card"></div>
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px">
告警编号20230310001
@ -201,7 +193,7 @@
itemStyle: {
normal: {
barBorderRadius: 0,
color: '#6395F9',
color: '#2778FF',
},
},
symbol: 'circle', //
@ -227,13 +219,21 @@
});
</script>
<style scoped lang="less">
.box {
width: 100%;
height: 35px;
display: flex;
position: relative;
font-size: @font-size-base;
border-bottom: 1px solid @primary-color;
}
.card {
position: absolute;
left: 0px;
top: 0px;
width: 5px;
height: 35px;
background-color: #2778ff;
background-color: @primary-color;
}
:deep(.ant-descriptions-item-label) {
width: 25%;

42
hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue

@ -19,12 +19,19 @@
placeholder="请选择设备点位"
style="width: 85%"
:options="statusOptions"
:disabled="showEdit"
:filter-option="filterDevicePoint" />
<ns-icon
size="20"
@click="() => (showEdit = !showEdit)"
style="margin-left: 20px"
:name="showEdit ? 'bianji' : 'baocun'" />
</a-form-item>
<a-form-item label="备注" name="desc">
<a-textarea
v-model:value="infoObject.desc"
placeholder="请输入异常描述"
:disabled="showEdit"
style="width: 85%"
:autoSize="{ minRows: 4, maxRows: 4 }" />
</a-form-item>
@ -53,6 +60,7 @@
setup() {
const visible = ref(false);
const showEdit = ref(true);
const infoObject = ref({});
const statusOptions = ref([
{ value: '0', label: '待处理' },
@ -62,11 +70,11 @@
{ value: '4', label: '已关闭' },
]);
const logList = ref([
{ name: '李四', status: '2' },
{ name: '王五', status: '4' },
{ name: '王五', status: '3' },
{ name: '王五', status: '1' },
{ name: '赵六', status: '0' },
{ name: '李四', status: '2', time: '2024-03-10 10:00:00', desc: '完成' },
{ name: '王五', status: '4', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '3', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '1', time: '2024-03-10 10:00:00', desc: '创建工单' },
{ name: '赵六', status: '0', time: '2024-03-10 10:00:00' },
]);
const config = ref({
size: logList.value.length,
@ -79,9 +87,26 @@
console.log('btnClick');
};
const toggle = (data) => {
console.log(data, 'data');
infoObject.value = logList.value[0];
console.log(infoObject.value, 'infoObject.value');
infoObject.value = { ...logList.value[0] };
let statusMap = {
0: '待处理',
1: '处理中',
2: '已完成',
3: '超时',
4: '已关闭',
};
let colorMap = {
0: '#ff7602',
1: '#00a1e6',
2: '#04d919',
3: '#d9001b',
4: '#a6a6a6',
};
logList.value.forEach((item) => {
item.statusName = statusMap[item.status];
item.color = colorMap[item.status];
item.src = 'status-' + item.status;
});
visible.value = true;
};
const createOrder = () => {
@ -112,6 +137,7 @@
};
return {
infoObject,
showEdit,
statusOptions,
btnClick,
createOrder,

29
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/index.vue

@ -0,0 +1,29 @@
<template>
<ns-view-list-table v-bind="config" ref="mainRef" />
<!-- 详情页面 -->
<Look ref="look" />
<!-- 状态页面 -->
<Status ref="status" />
</template>
<script lang="ts">
import { notificationtableConfig } from './ts/config';
import Look from './look.vue';
import Status from './status.vue';
import { ref } from 'vue';
export default {
name: 'EquipmentAlarmIndex',
components: { Look, Status },
setup() {
const look = ref(null);
const status = ref(null);
const config = notificationtableConfig(look, status);
return {
config,
look,
status,
};
},
};
</script>

234
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/look.vue

@ -0,0 +1,234 @@
<template>
<ns-drawer
v-model:visible="visible"
width="520"
:title="' '"
:footer-style="{ textAlign: 'right' }"
:ok="btnClick"
:cancel="handleClose"
placement="right"
@close="handleClose">
<div style="width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden">
<!-- top -->
<div class="box">
<div class="card"></div>
<div style="left: 25px; position: absolute; height: 35px; line-height: 35px">
告警编号20230310001
</div>
<div style="right: 20px; position: absolute; height: 35px; line-height: 35px">
2024-03-10 15:08:10
</div>
</div>
<!-- center -->
<div style="width: 100%; height: 400px">
<div style="width: 100%; height: 100%" ref="graphChart"></div>
</div>
<!-- bottom -->
<div style="width: 100%; margin-top: 10px">
<a-descriptions :column="1" bordered>
<a-descriptions-item label="优先级">紧急</a-descriptions-item>
<a-descriptions-item label="状态">新告警</a-descriptions-item>
<a-descriptions-item label="错误码">C003</a-descriptions-item>
<a-descriptions-item label="告警描述">网关心跳包丢失</a-descriptions-item>
<a-descriptions-item label="设备信息">1号网关_Di23j596_0001 </a-descriptions-item>
<a-descriptions-item label="重复次数"> 0 </a-descriptions-item>
</a-descriptions>
</div>
</div>
<template #footer>
<a-button type="primary" @click="handleClose">确定</a-button>
</template>
</ns-drawer>
</template>
<script lang="ts" setup>
defineOptions({
name: 'look', // name
});
import { ref } from 'vue';
import * as echarts from 'echarts';
let chartInstance: echarts.ECharts | null = null;
const graphChart = ref(null);
const visible = ref(false);
const handleClose = () => {
visible.value = false;
};
const btnClick = () => {
console.log('btnClick');
handleClose();
};
const toggle = (data: any) => {
console.log(data, 'data');
visible.value = true;
setTimeout(() => {
getChatr();
}, 500);
};
const getChatr = () => {
let dayData = [];
let energyAlarm = [];
// Extend data for 30 days
for (let i = 1; i < 9; i++) {
dayData.push('10:' + i * 9 + ':00');
energyAlarm.push(Math.floor(Math.random() * 2));
}
if (chartInstance) {
chartInstance.dispose();
}
chartInstance = echarts.init(graphChart.value);
const option = {
// title: {
// text: '/ 30',
// textStyle: {
// fontSize: 16,
// fontWeight: 'normal',
// color: '#aaaaaa',
// },
// left: '1%',
// top: '2%',
// },
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
formatter: function (params: any) {
let res = params[0].marker + ' ' + params[0].seriesName + ' : ' + params[0].data;
return res;
},
},
grid: {
left: '10%', //
right: '4%', //
top: '6%',
borderWidth: 0,
y2: 60, //
},
legend: [
{
show: false,
top: 5,
left: 'center', //
textStyle: {
color: 'rgb(89, 89, 89)',
fontSize: '14',
fontWeight: 'normal',
}, //
data: ['状态'],
itemGap: 30, //
},
],
calculable: true,
xAxis: [
{
type: 'category',
splitLine: {
show: false,
},
axisTick: {
show: true,
},
splitArea: {
show: false,
},
axisLabel: {
show: true, // X
color: 'rgb(89, 89, 89)', // X
fontSize: 12, // X
interval: 0, //
formatter: function (value) {
// X
return value;
},
},
data: dayData,
},
],
yAxis: [
{
type: 'value',
shwo: false,
splitLine: {
show: true,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitArea: {
show: false,
},
axisLabel: {
show: true, //
formatter: function (value) {
return value;
},
},
interval: 1, // Y 1
},
],
dataZoom: [
{
height: 12,
start: 0,
end: 100,
handleSize: '300%', //
bottom: 15,
},
],
series: [
{
name: '状态',
type: 'line',
itemStyle: {
normal: {
barBorderRadius: 0,
color: '#2778FF',
},
},
symbol: 'circle', //
symbolSize: 8,
// label: {
// show: true,
// color: 'rgb(89, 89, 89)',
// position: 'top',
// top: '10',
// formatter: function (value) {
// return Number(energyAlarm[value.dataIndex]) ;
// },
// },
data: energyAlarm,
},
],
};
chartInstance = echarts.init(graphChart.value);
chartInstance.setOption(option);
};
defineExpose({
toggle,
});
</script>
<style scoped lang="less">
.box {
width: 100%;
height: 35px;
display: flex;
position: relative;
font-size: @font-size-base;
border-bottom: 1px solid @primary-color;
}
.card {
position: absolute;
left: 0px;
top: 0px;
width: 5px;
height: 35px;
background-color: @primary-color;
}
:deep(.ant-descriptions-item-label) {
width: 25%;
}
</style>

108
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/notificationManagementMock.json

@ -0,0 +1,108 @@
{
"listData":[
{
"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 commodo1",
"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,
"priority": "1",
"alarmTitle": "电压异常告警",
"errorCode": "A001",
"monitorTime":"1",
"repetitions":"1",
"monitorTimeUnit": "分",
"enableRules": "1",
"isUse":true
} , {
"id": "d5",
"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 commodo2",
"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,
"priority": "1",
"alarmTitle": "电压异常告警",
"errorCode": "A001",
"monitorTime":"1",
"repetitions":"1",
"monitorTimeUnit": "分",
"enableRules": "0",
"isUse":true
}
]
}

124
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue

@ -0,0 +1,124 @@
<template>
<ns-drawer
v-model:visible="visible"
width="550"
:title="' '"
:footer-style="{ textAlign: 'right' }"
:ok="btnClick"
:cancel="handleClose"
placement="right"
@close="handleClose">
<a-tabs>
<a-tab-pane key="1" tab="更新状态">
<div style="width: 100%; padding: 24px">
<a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item ref="status" label="当前状态" name="status">
<a-select
v-model:value="infoObject.status"
show-search
placeholder="请选择设备点位"
style="width: 85%"
:options="statusOptions"
:disabled="true"
:filter-option="filterDevicePoint" />
</a-form-item>
<a-form-item label="备注" name="desc">
<a-textarea
v-model:value="infoObject.desc"
placeholder="请输入异常描述"
:disabled="true"
style="width: 85%"
:autoSize="{ minRows: 4, maxRows: 4 }" />
</a-form-item>
</a-form>
</div>
</a-tab-pane>
<a-tab-pane key="2" tab="状态流程">
<NsSteps v-bind="config" />
</a-tab-pane>
</a-tabs>
<template #footer>
<a-button type="primary" @click="btnClick">确定</a-button>
</template>
</ns-drawer>
</template>
<script>
import { defineComponent } from 'vue';
import { ref, createVNode } from 'vue';
import NsSteps from '/@/components/ns-steps.vue';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
export default defineComponent({
components: { NsSteps },
setup() {
const visible = ref(false);
const infoObject = ref({});
const statusOptions = ref([
{ value: '0', label: '待处理' },
{ value: '1', label: '处理中' },
{ value: '2', label: '已完成' },
{ value: '3', label: '超时' },
{ value: '4', label: '已关闭' },
]);
const logList = ref([
{ name: '李四', status: '2', time: '2024-03-10 10:00:00', desc: '完成' },
{ name: '王五', status: '4', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '3', time: '2024-03-10 10:00:00' },
{ name: '王五', status: '1', time: '2024-03-10 10:00:00', desc: '创建工单' },
{ name: '赵六', status: '0', time: '2024-03-10 10:00:00' },
]);
const config = ref({
size: logList.value.length,
dataSource: logList.value,
});
const handleClose = () => {
visible.value = false;
};
const btnClick = () => {
visible.value = false;
};
const toggle = (data) => {
infoObject.value = { ...logList.value[0] };
let statusMap = {
0: '待处理',
1: '处理中',
2: '已完成',
3: '超时',
4: '已关闭',
};
let colorMap = {
0: '#ff7602',
1: '#00a1e6',
2: '#04d919',
3: '#d9001b',
4: '#a6a6a6',
};
logList.value.forEach((item) => {
item.statusName = statusMap[item.status];
item.color = colorMap[item.status];
item.src = 'status-' + item.status;
});
visible.value = true;
};
return {
infoObject,
statusOptions,
btnClick,
visible,
logList,
config,
handleClose,
toggle,
};
},
});
</script>
<style scoped lang="less">
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;
width: 17%;
}
</style>

158
hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts

@ -0,0 +1,158 @@
import { dateUtil } from '/nerv-lib/util/date-util';
import data from '../notificationManagementMock.json';
import { http } from '/nerv-lib/util';
import { ref } from 'vue';
const tableKeyMap = [
{
title: '序号',
dataIndex: 'address',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '告警编号',
dataIndex: 'id',
},
{
title: '告警描述',
dataIndex: 'deviceCode',
},
{
title: '优先级',
dataIndex: 'deviceName',
},
{
title: '状态',
dataIndex: 'position',
},
{
title: '错误码',
dataIndex: 'position',
textEllipsis: true,
},
{
title: '设备信息',
dataIndex: 'position',
},
{
title: '更新时间',
dataIndex: 'enableRules',
},
{
title: '断网时长',
dataIndex: 'enableRules',
},
];
const mockData = ref(data.listData);
export const notificationtableConfig = (look: any, status: any) => {
return {
title: '告警记录',
// api: '/carbon_emission/device/getDeviceList',
value: mockData.value,
headerActions: [{}],
columns: tableKeyMap,
// rowSelection: null, 选择按钮
columnActions: {
title: '操作',
actions: [
{
label: '详情',
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
console.log(look.value);
look.value.toggle(data);
},
},
{
label: '状态',
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
status.value.toggle(data);
},
},
],
},
formConfig: {
schemas: [
{
field: 'name',
label: '告警类型',
component: 'NsSelect',
defaultValue: '2',
componentProps: {
placeholder: '请选择告警优先级',
disabled: true,
options: [
{
label: '紧急',
value: '1',
},
{
label: '重要',
value: '2',
},
{
label: '一般',
value: '3',
},
],
},
},
{
field: 'provider',
label: '状态',
component: 'NsSelect',
componentProps: {
placeholder: '请选择状态',
options: [
{
label: '待处理',
value: '1',
},
{
label: '处理中',
value: '2',
},
{
label: '已完成',
value: '3',
},
{
label: '超时',
value: '4',
},
{
label: '关闭',
value: '5',
},
],
},
},
{
field: 'provider',
label: '错误码',
component: 'NsInput',
componentProps: {
placeholder: '请输入告警错误码',
},
},
{
field: 'createTime',
label: '生产日期',
component: 'NsRangePicker',
fieldMap: ['manufactureBeginDate', 'manufactureEndDate'],
componentProps: {
valueFormat: 'YYYY-MM-DD',
placeholder: ['开始日期', '结束日期'],
},
},
],
},
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};
};

56
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue

@ -5,7 +5,7 @@
<div class="left">
<div class="top">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><span>排放分类</span></div>
<div class="ns-form-title"><div class="title">排放分类</div></div>
<div style="padding: 0 16px !important;width: 100%;">
<a-row>
<a-col :span="24" style="margin-bottom: 16px;">
@ -562,6 +562,7 @@
});
opMap.value.fuc = (formData: any) => {
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
debugger
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
mainRef.value?.nsTableRef.reload();
visible.value = false;
@ -665,14 +666,22 @@
handle: (record: any) => {
userAuthList.value.splice(0);
setTimeout(() => {
console.log(record.id);
const measurementUnit = ref([])
http.post(carbonEmissionFactorLibrary.getCarbonFactorTree,{}).then((res) => {
measurementUnit.value = res.data
http.post(carbonEmissionFactorLibrary.findById,{ id: record.id } ).then((res) => {
if (res.data.emissionType) {
let selectDevice = ref([Number(res.data.emissionType)]);
findParentIds(measurementUnit.value, res.data.emissionType, selectDevice.value);
res.data.emissionType = selectDevice
}
formData.value = res.data;
});
});
}, 10);
opMap.value.type = 'edit';
opMap.value.fuc = (formData: any) => {
formData.emissionType = formData.emissionType[formData.emissionType.length - 1]
return http.post(carbonEmissionFactorLibrary.creatOrUpdate, formData).then(() => {
mainRef.value?.nsTableRef.reload();
visible.value = false;
@ -790,6 +799,27 @@
// pagination: { defaultPageSize: 10 },
rowKey: 'id',
});
function findParentIds(tree: any, targetId: number, result: any) {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.id === Number(targetId))) {
result.unshift(item.id); // id
findParentIds(tree, item.id, result); // id
break; // 退
}else{
for(let childsItem of item.children){
if(childsItem.children && childsItem.children.length > 0){
if (childsItem.children.some((child: any) => child.id === Number(targetId))) {
result.unshift(childsItem.id); // id
findParentIds(tree, childsItem.id, result); // id
break; // 退
}
}
}
}
}
}
}
//
const unitExpandedKeys = ref<string[]>();
@ -977,6 +1007,26 @@
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
.title{
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778FF;
}
.treeRow {
display: flex;
justify-content: space-between;

21
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -363,9 +363,11 @@
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
// if(res.data.unit){
// res.data.unit = res.data.unit.split(',')
// }
if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
res.data.unit = selectDevice
}
formState.value = res.data
});
},
@ -398,6 +400,18 @@
},
rowKey: 'id',
});
// id
function findParentIds(tree: any, targetId: number, result: any) {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.value === targetId)) {
result.unshift(item.value); // id
findParentIds(tree, item.value, result); // id
break; // 退
}
}
}
}
//
const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => {
@ -473,6 +487,7 @@
label: child.cnValue
})) : []
}));
debugger
});
//
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {

22
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -3,7 +3,7 @@
<div class="left">
<div class="top">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><span>因子分类</span></div>
<div class="ns-form-title"><div class="title">因子分类</div></div>
<div style="padding: 0 16px !important;width: 100%;">
<a-row>
<a-col :span="24" style="margin-bottom: 16px;">
@ -507,6 +507,26 @@
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
.title{
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778FF;
}
::v-deep .ant-table-title{
display: flex;
height: 100%;

398
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue

@ -1,10 +1,406 @@
<template>
<div class="main">
<div class="left">
<div class="top">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><div class="title">2024年济阳站碳盘查报告</div></div>
<div style="padding: 0 16px !important;width: 100%;">
<a-row>
<a-col :span="24" style="margin-bottom: 16px;">
<a-input-search v-model:value="searchValue" style="margin-bottom: 8px" placeholder="请输入关键词" />
</a-col>
</a-row>
</div>
</a-form>
<a-tree
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:tree-data="gData"
:height="233"
show-line
style="padding: 0 16px !important;"
@expand="onExpand"
>
<template #title="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substring(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ title.substring(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
</a-tree>
</div>
<div class="bottom">
<a-form style="width: 100%;margin: 0 auto;">
<div class="ns-form-title"><div class="title">报告相关</div></div>
<div class="button" style="padding: 0 16px !important;">
<div class="changePage">排放统计</div>
<div class="changePage">碳排流向</div>
</div>
</a-form>
</div>
</div>
<div class="right">
<div class="ns-table-title ns-title-extra-box">排放源</div>
<div class="mainLeft"></div>
<div class="mainRight">
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500}" />
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue';
import type { TreeProps } from 'ant-design-vue';
import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId } ) => {
return http.post(api, params);
};
//
const x = 3;
const y = 2;
const z = 1;
const genData: TreeProps['treeData'] = [];
const generateData = (_level: number, _preKey?: string, _tns?: TreeProps['treeData']) => {
const preKey = _preKey || '0';
const tns = _tns || genData;
const children = [];
for (let i = 0; i < x; i++) {
const key = `${preKey}-${i}`;
tns.push({ title: key, key });
if (i < y) {
children.push(key);
}
}
if (_level < 0) {
return tns;
}
const level = _level - 1;
children.forEach((key, index) => {
tns[index].children = [];
return generateData(level, key, tns[index].children);
});
};
generateData(z);
const dataList: TreeProps['treeData'] = [];
const generateList = (data: TreeProps['treeData']) => {
for (let i = 0; i < data.length; i++) {
const node = data[i];
const key = node.key;
dataList.push({ key, title: key });
if (node.children) {
generateList(node.children);
}
}
};
generateList(genData);
const getParentKey = (
key: string | number,
tree: TreeProps['treeData'],
): string | number | undefined => {
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.children) {
if (node.children.some(item => item.key === key)) {
parentKey = node.key;
} else if (getParentKey(key, node.children)) {
parentKey = getParentKey(key, node.children);
}
}
}
return parentKey;
};
const expandedKeys = ref<(string | number)[]>([]);
const searchValue = ref<string>('');
const autoExpandParent = ref<boolean>(true);
const gData = ref<TreeProps['treeData']>(genData);
const onExpand = (keys: string[]) => {
expandedKeys.value = keys;
autoExpandParent.value = false;
};
watch(searchValue, value => {
const expanded = dataList
.map((item: TreeProps['treeData'][number]) => {
if (item.title.indexOf(value) > -1) {
return getParentKey(item.key, gData.value);
}
return null;
})
.filter((item, i, self) => item && self.indexOf(item) === i);
expandedKeys.value = expanded;
searchValue.value = value;
autoExpandParent.value = true;
});
//
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
})
const tableConfig = ref({
title: '能耗统计',
api: energyConsumption.pageList,
params: queryParams.value,
headerActions: [
{
label: '新增',
name: 'userAdd',
type: 'primary',
handle: () => {
getDictList()
visible.value = true
},
},
{
label: '导入',
type: 'primary',
name: 'userImport',
handle: () => {},
},
{
label: '导出',
type: 'primary',
name: 'userExports',
},
{
label: '模板下载',
type: 'primary',
name: 'userExports',
},
{
label: '上传凭证',
type: 'primary',
handle: () => {
openUpload.value = true;
},
},
{
label: '凭证下载',
type: 'primary',
name: 'userExports',
},
],
columns: [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '能源种类',
dataIndex: 'energyType',
},
{
title: '计量单位',
className: 'unitName',
dataIndex: 'unitName',
},
{
title: '全年',
dataIndex: 'yearly',
},
{
title: '1月',
dataIndex: 'jan',
},
{
title: '2月',
dataIndex: 'feb',
},
{
title: '3月',
dataIndex: 'mar',
},
{
title: '4月',
dataIndex: 'apr',
},
{
title: '5月',
dataIndex: 'may',
},
{
title: '6月',
dataIndex: 'jun',
},
{
title: '7月',
dataIndex: 'jul',
},
{
title: '8月',
dataIndex: 'aug',
},
{
title: '9月',
dataIndex: 'sep',
},
{
title: '10月',
dataIndex: 'oct',
},
{
title: '11月',
dataIndex: 'nov',
},
{
title: '12月',
dataIndex: 'dec',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
},
},
{
label: '删除',
name: 'userDelete',
dynamicParams: { id: 'id' },
confirm: true,
isReload: true,
api: energyConsumption.del,
},
],
},
formConfig: {
schemas: [
{
field: 'year',
label: '年份',
component: 'NsDatePicker',
componentProps: {
picker: 'year',
valueFormat: 'YYYY',
},
},
],
params: {},
},
rowKey: 'id',
});
</script>
<style lang="less" scoped>
.main {
background-color: @ns-content-bg;
display: flex;
height: 100%;
}
.left {
width: 300px;
margin-right: @ns-gap;
min-width: fit-content;
> div {
background-color: @white;
flex: 1;
}
display: flex;
flex-direction: column;
.top{
position: relative;
height: 80%;
.ns-form-title{
font-weight: bold;
user-select: text;
padding: 16px;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
.title{
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778FF;
}
}
.bottom{
position: relative;
height: 20%;
.ns-form-title{
font-weight: bold;
user-select: text;
padding: 16px;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
}
.title{
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778FF;
}
.changePage{
height: 3vh;
display: flex;
align-items: center;
}
}
}
.right {
flex: 1;
min-width: 0;
height: 100%;
padding: @ns-gap;
background-color: @white;
border-radius: @ns-border-radius;
box-shadow: @ns-content-box-shadow;
.ns-table-title {
text-align: left;
font-size: 16px;
font-weight: bold;
user-select: text;
width: 100%;
margin-bottom: @ns-gap;
}
}
</style>

96
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

@ -5,7 +5,7 @@
</div>
<!-- 填报页 -->
<div v-if="fillInPage">
<fillIn />
</div>
<!-- 新增报告弹窗 -->
<a-drawer
@ -22,24 +22,23 @@
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item ref="name" label="报告名称" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入报告名称" />
<a-form-item ref="name" label="报告名称" name="reportName">
<a-input v-model:value="formState.reportName" placeholder="请输入报告名称" />
</a-form-item>
<a-form-item ref="name" label="报告年度" name="energyType">
<a-date-picker v-model:value="value5" picker="year" />
<a-form-item ref="name" label="报告年度" name="reportYear">
<a-date-picker v-model:value="formState.reportYear" picker="year" valueFormat="YYYY" />
</a-form-item>
<a-form-item ref="name" label="适用标准" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入适用标准" />
<a-form-item ref="name" label="适用标准" name="genericStandard">
<a-input v-model:value="formState.genericStandard" placeholder="请输入适用标准" />
</a-form-item>
<a-form-item label="报告周期" name="emissionType" :required="isRequired">
<a-select v-model:value="formState.emissionType" placeholder="请选择排放类型">
<a-select-option v-for="(item, index) in emissionTypeDic" :key="index" :value="item.id">
{{ item.cnValue }}
</a-select-option>
<a-form-item label="报告周期" name="reportPeriod">
<a-select v-model:value="formState.reportPeriod" placeholder="请选择排放类型">
<a-select-option value="1">年度</a-select-option>
<a-select-option value="2">月度</a-select-option>
</a-select>
</a-form-item>
<a-form-item ref="name" label="适用标准" name="energyType">
<a-range-picker v-model:value="value4" picker="month" />
<a-form-item ref="name" label="报告范围" name="reportScope">
<a-range-picker v-model:value="formState.reportScope" picker="month" valueFormat="YYYY-MM" />
</a-form-item>
</a-form>
<template #footer>
@ -50,9 +49,10 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { ref,toRaw } from 'vue';
import { http } from '/nerv-lib/util/http';
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue';
defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
@ -61,8 +61,8 @@
return http.post(api, params);
};
//
const isMainPage = ref(false);
const fillInPage = ref(true);
const isMainPage = ref(true);
const fillInPage = ref(false);
//
const visible = ref(false);
const formState = ref({})
@ -71,8 +71,11 @@
const wrapperCol = { span: 19 };
// form
const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }]
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],
reportYear: [{ required: true, message: '请选择报告年度', trigger: 'change' }],
genericStandard: [{ required: true, message: '请输入适用标准', trigger: 'change' }],
reportPeriod: [{ required: true, message: '请选择排放类型', trigger: 'change' }],
reportScope: [{ required: true, message: '请选择报告范围', trigger: 'change' }],
};
//
const onClose = () => {
@ -80,10 +83,30 @@
formState.value = {}
formRef.value.resetFields();
};
//
const onSubmit = () => {
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
formState.value.enterpriseOrgId = orgId.value
formState.value.startTime = formState.value.reportScope[0]
formState.value.endTime = formState.value.reportScope[1]
fetch(carbonInventoryCheck.createOrUpdate,formState.value).then((res) => {
visible.value = false
mainRef.value?.nsTableRef.reload();
});
})
.catch(error => {
console.log('error', error);
});
};
//
const data = ref([]);
const mainRef = ref();
const tableConfig = ref({
title: '数据库',
api: carbonEmissionFactorLibrary.getTableList,
api: carbonInventoryCheck.carbonInventoryList,
params: {
orgId
},
@ -106,27 +129,27 @@
},
{
title: '企业名称',
dataIndex: 'emissionSources',
dataIndex: 'enterpriseName',
},
{
title: '报告名称',
dataIndex: 'emissionTypeColumn',
dataIndex: 'reportName',
},
{
title: '报告年度',
dataIndex: 'emissionGas',
dataIndex: 'reportYear',
},
{
title: '适用标准',
dataIndex: 'emissionProcess',
dataIndex: 'genericStandard',
},
{
title: '更新人',
dataIndex: 'emissionFactors',
dataIndex: 'updateUser',
},
{
title: '更新时间',
dataIndex: 'emissionFactorUnits',
dataIndex: 'updateTime',
},
],
columnActions: {
@ -137,6 +160,10 @@
name: 'userEdit',
handle: (record: any) => {
visible.value = true
fetch(carbonInventoryCheck.findById,{id:record.id}).then((res) => {
formState.value = res.data
formState.value.reportScope = [res.data.startTime,res.data.endTime]
});
},
},
{
@ -156,17 +183,17 @@
{
label: '删除',
name: 'userDelete',
dynamicParams: { ids: 'id[]' },
dynamicParams: { id: 'id' },
confirm: true,
isReload: true,
api: carbonEmissionFactorLibrary.del,
api: carbonInventoryCheck.delete,
},
],
},
formConfig: {
schemas: [
{
field: 'emissionSources',
field: 'reportName',
label: '报告名称',
component: 'NsInput',
componentProps: {
@ -175,13 +202,14 @@
},
},
{
field: 'createTime1',
label: '采购日期',
field: 'reportYear',
label: '报告年度',
component: 'NsRangePicker',
fieldMap: ['purchaseBeginDate', 'purchaseEndDate'],
fieldMap: ['startYear', 'endYear'],
componentProps: {
valueFormat: 'YYYY-MM-DD',
valueFormat: 'YYYY',
placeholder: ['报告年度', '报告年度'],
picker:"year"
},
},
],

Loading…
Cancel
Save