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
7f839b7a31
  1. 5
      hx-ai-intelligent/src/api/alarmSettings/notificationManagements.ts
  2. 10
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  3. 20
      hx-ai-intelligent/src/router/carbonEmissionManage.ts
  4. 19
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue
  5. 19
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue
  6. 51
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/index.vue
  7. 139
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/index.vue
  8. 22
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/config.ts
  9. 55
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/index.vue
  10. 4
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts
  11. 52
      hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts
  12. 17
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  13. 306
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index copy.vue
  14. 203
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  15. 110
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  16. 283
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts
  17. 115
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  18. 45
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/mock.ts

5
hx-ai-intelligent/src/api/alarmSettings/notificationManagements.ts

@ -0,0 +1,5 @@
export enum notificationManagementApi {
getTableList = '/carbon-smart/api/AlarmContactInformation/selectAlarmContactInformation', //通知管理分页
upData = '/carbon-smart/api/AlarmContactInformation/update', //通知管理 修改
findById = '/carbon-smart/api/AlarmContactInformation/findById', //通知管理 查询详情
}

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

@ -9,11 +9,11 @@ export enum carbonEmissionFactorLibrary {
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate', creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
delTreeNode = '/carbon-smart/api/carbon/emission/type/del', delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
// 单位管理 // 单位管理
dictionaryUnitManagement = '/carbon-smart/api/carbon/emission/factor/dictionaryUnitManagement', dictionaryUnitManagement = '/carbon-smart/client/dict/dictionaryUnitManagement',
findOutermost = '/carbon-smart/api/carbon/emission/factor/findOutermost', findOutermost = '/carbon-smart/client/dict/findOutermost',
createDictionary = '/carbon-smart/api/carbon/emission/factor/createDictionary', createDictionary = '/carbon-smart/client/dict/createDictionary',
updateDictionary = '/carbon-smart/api/carbon/emission/factor/updateDictionary', updateDictionary = '/carbon-smart/client/dict/updateDictionary',
delDictionary = '/carbon-smart/api/carbon/emission/factor/delDictionary', delDictionary = '/carbon-smart/client/dict/delDictionary',
} }
// 碳排管理-碳排统计接口 // 碳排管理-碳排统计接口
export enum energyConsumption { export enum energyConsumption {

20
hx-ai-intelligent/src/router/carbonEmissionManage.ts

@ -45,6 +45,26 @@ const equipment = {
}, },
], ],
}, },
{
path: 'carbonInventoryCheck',
name: 'CarbonInventoryCheck',
meta: { title: '碳盘查', hideChildren: true, icon: 'tanpaiguanli' },
component: Base,
redirect: { name: 'CarbonInventoryCheckIndex' },
children: [
{
path: 'index',
name: 'CarbonInventoryCheckIndex',
// component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
component: () => import('/@/view/carbonEmissionManage/carbonInventoryCheck/index.vue'),
meta: {
title: '碳盘查',
keepAlive: true,
// backApi: [],
},
},
],
},
], ],
}; };
export default equipment; export default equipment;

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

@ -177,6 +177,25 @@
], ],
}, },
}, },
{
label: '是否创建工单',
field: 'createWorkOrder',
component: 'NsRadioGroup',
rules: [
{
required: true,
message: '是否创建工单不能为空',
trigger: 'change',
},
],
componentProps: {
radioType: 'radio',
options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
},
},
], ],
}, },
}, },

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

@ -195,6 +195,25 @@
], ],
}, },
}, },
{
label: '是否创建工单',
field: 'createWorkOrder',
component: 'NsRadioGroup',
rules: [
{
required: true,
message: '是否创建工单不能为空',
trigger: 'change',
},
],
componentProps: {
radioType: 'radio',
options: [
{ label: '是', value: 1 },
{ label: '否', value: 0 },
],
},
},
], ],
}, },
}, },

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

@ -4,21 +4,27 @@
<a-tab-pane key="1" tab="通知管理"> <a-tab-pane key="1" tab="通知管理">
<ns-view-list-table v-bind="notificationConfig" ref="mainRef"> <ns-view-list-table v-bind="notificationConfig" ref="mainRef">
<template #bodyCell="{ record, column }"> <template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'enableRules'"> <template v-if="column.dataIndex === 'enableNotifications'">
<a-switch <a-switch
:checked="record.enableRules === 1 ? true : false" :checked="record.enableNotifications === 1 ? true : false"
:class="{ :class="{
'blue-background': record.enableRules === 1 ? true : false, 'blue-background': record.enableNotifications === 1 ? true : false,
'grey-background': record.enableRules === 1 ? false : true, 'grey-background': record.enableNotifications === 1 ? false : true,
}" }"
@change=" @change="
clickSwitch({ type: 1, enableRules: record.enableRules, record: record }) clickSwitch({ type: 1, enableRules: record.enableRules, record: record })
" /> " />
</template> </template>
<template v-if="column.dataIndex === 'prioritys'">
{{ record.priority ? record.priority.label : '' }}
</template>
<template v-if="column.dataIndex === 'notificationMethod'">
{{ getNotificationMethod(record.notificationMethod) }}
</template>
</template> </template>
</ns-view-list-table> </ns-view-list-table>
<!-- 联系方式 --> <!-- 联系方式 -->
<notificationManagement ref="notificationManagements" @editObject="editObject" /> <notificationManagement ref="notificationManagements" @updNotification="updNotification" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="设备告警" force-render> <a-tab-pane key="2" tab="设备告警" force-render>
<ns-view-list-table <ns-view-list-table
@ -49,7 +55,7 @@
{{ record.repetitions.label }} {{ record.repetitions.label }}
</template> </template>
<template v-if="column.dataIndex === 'prioritys'"> <template v-if="column.dataIndex === 'prioritys'">
{{ record.priority.label }} {{ record.priority ? record.priority.label : '-' }}
</template> </template>
</template> </template>
</ns-view-list-table> </ns-view-list-table>
@ -90,7 +96,7 @@
{{ record.repetitions.label }} {{ record.repetitions.label }}
</template> </template>
<template v-if="column.dataIndex === 'prioritys'"> <template v-if="column.dataIndex === 'prioritys'">
{{ record.priority.label }} {{ record.priority ? record.priority.label : '-' }}
</template> </template>
</template> </template>
</ns-view-list-table> </ns-view-list-table>
@ -124,6 +130,7 @@
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
import { energyAlarms } from '/@/api/alarmSettings/energyAlarm'; import { energyAlarms } from '/@/api/alarmSettings/energyAlarm';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { notificationManagementApi } from '/@/api/alarmSettings/notificationManagements';
export default { export default {
name: 'AlarmSettingsIndex', name: 'AlarmSettingsIndex',
@ -146,6 +153,22 @@
const equipmentAlarm = ref(true); const equipmentAlarm = ref(true);
const energyAlarm = ref(true); const energyAlarm = ref(true);
const notificationConfig = notificationtableConfig(notificationManagements); const notificationConfig = notificationtableConfig(notificationManagements);
//
const getNotificationMethod = (data: any) => {
if (!data) return '';
const methods = [];
const notifications = data.split(',');
notifications.forEach((notification) => {
if (notification === '1') {
methods.push('站内信息');
} else if (notification === '2') {
methods.push('邮件');
}
});
return methods.join('/');
};
// //
const energyAlarmConfig = energyAlarmConfigs( const energyAlarmConfig = energyAlarmConfigs(
editeEnergyAlarm, editeEnergyAlarm,
@ -169,6 +192,10 @@
energyAlarm.value = !energyAlarm.value; energyAlarm.value = !energyAlarm.value;
configureEnergyAlarms.value.show = false; configureEnergyAlarms.value.show = false;
}; };
//
const updNotification = () => {
mainRef.value?.nsTableRef.reload();
};
const clickSwitch = (data: any) => { const clickSwitch = (data: any) => {
NsModal.confirm({ NsModal.confirm({
title: '启用状态', title: '启用状态',
@ -182,12 +209,14 @@
if (data.type === 1) { if (data.type === 1) {
// //
http http
.post(deviceAlarms.addOrUpNewData, { .post(notificationManagementApi.upData, {
id: data.record.id, id: data.record.id,
enableRules: data.record.enableRules === 1 ? 0 : 1, enableNotifications: data.record.enableNotifications === 1 ? 0 : 1,
}) })
.then(() => { .then(() => {
NsMessage.success(data.record.enableRules === 1 ? '通知已关闭' : '通知已启用'); NsMessage.success(
data.record.enableNotifications === 1 ? '通知已关闭' : '通知已启用',
);
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
}); });
} }
@ -232,6 +261,8 @@
equipmentAlarmConfig, equipmentAlarmConfig,
editObject, editObject,
editeEnergyAlarm, editeEnergyAlarm,
updNotification,
getNotificationMethod,
clickSwitch, clickSwitch,
editEquipmentAlarm, editEquipmentAlarm,
notificationManagements, notificationManagements,

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

@ -10,10 +10,10 @@
@close="handleClose"> @close="handleClose">
<div style="width: 100%; overflow: hidden; overflow-y: hidden; height: 100%"> <div style="width: 100%; overflow: hidden; overflow-y: hidden; height: 100%">
<a-form ref="formRef" :model="infoObject" :rules="rules" style="width: 80%"> <a-form ref="formRef" :model="infoObject" :rules="rules" style="width: 80%">
<a-form-item ref="notification" label="通知方式" name="notification"> <a-form-item ref="notificationMethod" label="通知方式" name="notificationMethod">
<a-select <a-select
ref="select" ref="select"
v-model:value="infoObject.notification" v-model:value="infoObject.notificationMethod"
style="width: 100%" style="width: 100%"
mode="multiple" mode="multiple"
:options="devicePointData" :options="devicePointData"
@ -24,34 +24,18 @@
</a-form-item> </a-form-item>
<a-form-item label="启用规则"> <a-form-item label="启用规则">
<a-switch <a-switch
:checked="infoObject.enableRules === 1 ? true : false" :checked="infoObject.enableNotifications === 1 ? true : false"
:class="{ :class="{
'blue-background': infoObject.enableRules === 1 ? true : false, 'blue-background': infoObject.enableNotifications === 1 ? true : false,
'grey-background': infoObject.enableRules === 1 ? false : true, 'grey-background': infoObject.enableNotifications === 1 ? false : true,
}" }"
@click="clickSwitch" /> @click="clickSwitch" />
</a-form-item> </a-form-item>
</a-form> </a-form>
<div style="width: 100%; height: 765px; overflow-y: auto"> <div style="width: 100%; height: 765px; overflow-y: auto">
<div style="margin-bottom: 8px"> <div style="margin-bottom: 8px">
<div style="width: 100%; display: flex; position: relative"> <div style="width: 100%; display: flex; position: relative" class="ns-title-extra-box">
<div <span style="margin-left: 12px; color: #333333">联系人名单</span>
style="
border-width: 0px;
position: absolute;
left: 0px;
top: 5px;
width: 5px;
height: 15px;
background: inherit;
background-color: #2778ff;
border: none;
border-radius: 5px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
"></div>
<span style="margin-left: 24px; color: #333333">联系人名单</span>
</div> </div>
<img <img
style="width: 100%; margin-top: -10px" style="width: 100%; margin-top: -10px"
@ -67,10 +51,10 @@
:pagination="pagination"> :pagination="pagination">
<template #bodyCell="{ record, column }"> <template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'address'"> <template v-if="column.dataIndex === 'address'">
{{ record.userRoleInfos?.[0].deptRoleInfoList }} {{ record?.deptRoleInfoList || record.userRoleInfos?.[0].deptRoleInfoList }}
</template> </template>
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a style="color: rgb(210, 0, 5)" @click="remove(record)">移除</a> <a style="color: #2778ff" @click="remove(record)">移除</a>
</template> </template>
</template> </template>
</a-table> </a-table>
@ -85,12 +69,11 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
// import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
// import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
// import { number } from 'vue-types';
import linkPeople from './linkPeople/index.vue'; import linkPeople from './linkPeople/index.vue';
import { notificationManagementApi } from '/@/api/alarmSettings/notificationManagements';
// import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; import { async } from '@antv/x6/lib/registry/marker/async';
//table //table
const columns = [ const columns = [
@ -125,6 +108,8 @@
title: '部门', title: '部门',
dataIndex: 'address', dataIndex: 'address',
key: 'address', key: 'address',
width: 200,
textEllipsis: true,
}, },
{ {
title: '操作', title: '操作',
@ -160,7 +145,7 @@
dataSource.value.forEach((item) => { dataSource.value.forEach((item) => {
ids.push(item.userId); ids.push(item.userId);
}); });
linkPeoples.value.getData({ id: ids, data: dataSource }); linkPeoples.value.getData({ id: ids, data: dataSource.value });
}; };
// //
const handleCancel = () => { const handleCancel = () => {
@ -173,7 +158,7 @@
}; };
// //
const infoObject = ref({ const infoObject = ref({
enableRules: 0, enableNotifications: 0,
}); });
// //
const filterDevicePoint = (input: string, option: any) => { const filterDevicePoint = (input: string, option: any) => {
@ -181,45 +166,47 @@
}; };
// //
const clickSwitch = () => { const clickSwitch = () => {
if (infoObject.value.enableRules === 1) { if (infoObject.value.enableNotifications === 1) {
infoObject.value.enableRules = 0; infoObject.value.enableNotifications = 0;
} else { } else {
infoObject.value.enableRules = 1; infoObject.value.enableNotifications = 1;
} }
}; };
// //
const devicePointData = ref([ const devicePointData = ref([
{ label: '站内信息', value: 1 }, { label: '站内信息', value: '1' },
{ label: '邮件', value: 2 }, { label: '邮件', value: '2' },
]); ]);
const rules = { const rules = {
notification: [{ required: true, message: '请选择通知方式', trigger: 'change' }], notificationMethod: [{ required: true, message: '请选择通知方式', trigger: 'change' }],
user: [{ required: true, message: '请选择通知人', trigger: 'change' }], user: [{ required: true, message: '请选择通知人', trigger: 'change' }],
}; };
const formRef = ref(); const formRef = ref();
const emit = defineEmits(['editObject']); const emit = defineEmits(['updNotification']);
const toggle = (value: any) => { const toggle = async (value: any) => {
// //
if (value) { if (value) {
// // //
infoObject.value = { await http
enableRules: 0, .post(notificationManagementApi.findById, {
}; id: value.id,
// await http })
// .post(group.queryDeviceGroupTree, { .then((res) => {
// pageNum: 1, infoObject.value = res.data;
// pageSize: 999, if (infoObject.value.notificationMethod) {
// energyType: selectedOptions[0].dicKey, infoObject.value.notificationMethod = infoObject.value.notificationMethod.split(',');
// orgId: orgId.value, } else {
// }) infoObject.value.notificationMethod = [];
// .then((res) => { }
// jdTreeData.value = res.data; dataSource.value = res.data.hxAlarmNotifyUserList;
// }); });
} else { } else {
infoObject.value = { infoObject.value = {
enableRules: 0, enableNotifications: 0,
notificationMethod: [],
}; };
dataSource.value = [];
} }
visible.value = !visible.value; visible.value = !visible.value;
}; };
@ -233,24 +220,36 @@
dataSource.value = [...dataSource.value]; dataSource.value = [...dataSource.value];
}; };
const btnClick = () => { const btnClick = () => {
console.log(infoObject.value); if (dataSource.value.length === 0) {
// NsMessage.warn('请选择联系人');
let obj = {}; return;
obj.selectList = []; }
dataSource.value.forEach((item) => {
obj.selectList.push({
userId: item.userId,
});
});
console.log(obj, '数据');
// //
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
//
let obj = {
id: null,
notificationMethod: null,
hxAlarmNotifyUserList: [],
enableNotifications: 0,
};
obj.notificationMethod = infoObject.value.notificationMethod.toString();
obj.id = infoObject.value.id;
obj.enableNotifications = infoObject.value.enableNotifications;
dataSource.value.forEach((item) => {
obj.hxAlarmNotifyUserList.push({
userId: item.userId,
contactInformationId: infoObject.value.id,
});
});
// //
// http.post(deviceAlarms.addOrUpNewData, infoObject.value).then(() => { http.post(notificationManagementApi.upData, obj).then((res) => {
// NsMessage.success(''); if (res.msg === 'success') {
// visible.value = false; NsMessage.success('操作成功');
// emit('editObject', null); visible.value = false;
// }); emit('updNotification', null);
}
});
}); });
}; };
const handleClose = () => { const handleClose = () => {

22
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/notificationManagement/linkPeople/config.ts

@ -1,22 +0,0 @@
import { department } from '/@/api/origanizemanage';
export const editTreeConfig = (orgId) => ({
selectedKeys: ['0-0'],
defaultExpandAll: true,
api: department.queryDeptTree,
params: { orgId },
resultField: 'data.orgInfos',
fieldNames: { title: 'orgName', key: 'orgId' },
formConfig: {
schemas: [
{
field: 'orgName',
component: 'NsInput',
autoSubmit: true,
componentProps: {
placeholder: '请输入企业名称',
},
},
],
},
});

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

@ -8,9 +8,8 @@
@cancel="handleCancel"> @cancel="handleCancel">
<div class="box"> <div class="box">
<div class="box-left"> <div class="box-left">
<div style="width: 100%; display: flex; position: relative"> <div style="width: 100%; display: flex; position: relative" class="ns-title-extra-box">
<div class="border-card"></div> <span style="margin-left: 12px; color: #333333">联系人名单</span>
<span style="margin-left: 24px; color: #333333">联系人名单</span>
</div> </div>
<img <img
style="width: 100%; height: 2px" style="width: 100%; height: 2px"
@ -31,9 +30,8 @@
/></div> /></div>
</div> </div>
<div class="box-right"> <div class="box-right">
<div style="width: 100%; display: flex; position: relative"> <div style="width: 100%; display: flex; position: relative" class="ns-title-extra-box">
<div class="border-card"></div> <span style="margin-left: 12px; color: #333333">人员列表 </span>
<span style="margin-left: 24px; color: #333333">人员列表 </span>
<a-input-search <a-input-search
v-model:value="realName" v-model:value="realName"
style="margin-bottom: 8px; width: 280px; position: absolute; right: 20px" style="margin-bottom: 8px; width: 280px; position: absolute; right: 20px"
@ -191,6 +189,7 @@
orgId: selectOrgId.value, orgId: selectOrgId.value,
deptId: selectDeptId.value, deptId: selectDeptId.value,
realName: realName.value, realName: realName.value,
userStatus: 0,
}) })
.then((res) => { .then((res) => {
dataSource.value = res.data.records; dataSource.value = res.data.records;
@ -206,7 +205,25 @@
const onSelectChange = (selectedRowKeys: any, selectedRows: any) => { const onSelectChange = (selectedRowKeys: any, selectedRows: any) => {
selectedRowKey.value = selectedRowKeys; selectedRowKey.value = selectedRowKeys;
selectedRow.value = selectedRows; // 使 forEach selectedRows
let newSelectRows = [];
selectedRows.forEach((item, index) => {
if (item) {
newSelectRows.push(item);
}
});
// userId selectedRow.value
selectedRow.value = [
...selectedRow.value,
...newSelectRows.filter(
(newRow: any) =>
!selectedRow.value.some((existingRow) => existingRow.userId === newRow.userId),
),
];
// userId
selectedRow.value = selectedRow.value.filter((existingRow: any) =>
selectedRowKeys.includes(existingRow.userId),
);
}; };
const pagination = ref({ const pagination = ref({
total: 0, total: 0,
@ -252,6 +269,8 @@
pagination.value.current = 1; pagination.value.current = 1;
realName.value = null; realName.value = null;
searchValue.value = ''; searchValue.value = '';
selectDeptId.value = '';
selectOrgId.value = orgId.value;
}; };
const getData = (data: any) => { const getData = (data: any) => {
selectedRow.value = data.data; selectedRow.value = data.data;
@ -265,10 +284,13 @@
const show = ref(false); const show = ref(false);
const handleCancel = () => { const handleCancel = () => {
// //
pagination.value.current = 1;
realName.value = null;
emit('handleCancel', null); emit('handleCancel', null);
show.value = false; show.value = false;
pagination.value.current = 1;
realName.value = null;
searchValue.value = '';
selectDeptId.value = '';
selectOrgId.value = orgId.value;
}; };
watch(searchValue, (value) => { watch(searchValue, (value) => {
const expanded = dataList const expanded = dataList
@ -317,21 +339,6 @@
}); });
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.border-card {
border-width: 0px;
position: absolute;
left: 0px;
top: 5px;
width: 5px;
height: 15px;
background: inherit;
background-color: @primary-color;
border: none;
border-radius: 5px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.box { .box {
width: 100%; width: 100%;
height: 500px; height: 500px;

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

@ -1,9 +1,7 @@
import data from '../notificationManagementMock.json';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { NsMessage } from '/nerv-lib/component'; import { NsMessage } from '/nerv-lib/component';
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
import { ref } from 'vue';
const tableKeyMap = [ const tableKeyMap = [
{ {
title: '序号', title: '序号',
@ -37,7 +35,6 @@ const tableKeyMap = [
dataIndex: 'enableRules', dataIndex: 'enableRules',
}, },
]; ];
const mockData = ref(data.listData);
const doWnload = (url: any) => { const doWnload = (url: any) => {
const a = document.createElement('a'); const a = document.createElement('a');
document.body.appendChild(a); document.body.appendChild(a);
@ -57,7 +54,6 @@ export const equipmentAlarmTableConfig = (
return { return {
title: '告警规则', title: '告警规则',
api: deviceAlarms.getTableList, api: deviceAlarms.getTableList,
value: mockData.value,
headerActions: [ headerActions: [
{ {
label: '新增', label: '新增',

52
hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts

@ -1,7 +1,8 @@
import { dateUtil } from '/nerv-lib/util/date-util'; import { dateUtil } from '/nerv-lib/util/date-util';
import data from '../notificationManagementMock.json';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { notificationManagementApi } from '/@/api/alarmSettings/notificationManagements';
import { ref } from 'vue'; import { ref } from 'vue';
const tableKeyMap = [ const tableKeyMap = [
{ {
title: '序号', title: '序号',
@ -12,43 +13,41 @@ const tableKeyMap = [
}, },
{ {
title: '优先级', title: '优先级',
dataIndex: 'id', dataIndex: 'prioritys',
}, },
{ {
title: '告警类型', title: '告警类型',
dataIndex: 'deviceCode', dataIndex: 'alarmTypeName',
}, },
{ {
title: '告警标题', title: '告警标题',
dataIndex: 'deviceName', dataIndex: 'alarmTitle',
}, },
{ {
title: '错误码', title: '错误码',
dataIndex: 'position', dataIndex: 'errorCode',
}, },
{ {
title: '通知名单', title: '通知名单',
dataIndex: 'position', dataIndex: 'notificationList',
width: 150,
textEllipsis: true, textEllipsis: true,
}, },
{ {
title: '通知方式', title: '通知方式',
dataIndex: 'position', dataIndex: 'notificationMethod',
}, },
{ {
title: '启用通知', title: '启用通知',
dataIndex: 'enableRules', dataIndex: 'enableNotifications',
}, },
]; ];
const mockData = ref(data.listData);
export const notificationtableConfig = (notificationManagements: any) => { export const notificationtableConfig = (notificationManagements: any) => {
return { return {
title: '告警规则', title: '告警规则',
// api: '/carbon_emission/device/getDeviceList', api: notificationManagementApi.getTableList,
value: mockData.value, headerActions: [],
headerActions: [{}],
columns: tableKeyMap, columns: tableKeyMap,
// rowSelection: null, 选择按钮
columnActions: { columnActions: {
title: '操作', title: '操作',
actions: [ actions: [
@ -66,70 +65,75 @@ export const notificationtableConfig = (notificationManagements: any) => {
formConfig: { formConfig: {
schemas: [ schemas: [
{ {
field: 'name', field: 'alarmType',
label: '告警类型', label: '告警类型',
component: 'NsSelect', component: 'NsSelect',
componentProps: { componentProps: {
placeholder: '请选告警类型', placeholder: '请选告警类型',
allowClear: true,
options: [ options: [
{ {
label: '设备告警', label: '设备告警',
value: '1', value: 1,
}, },
{ {
label: '网关告警', label: '网关告警',
value: '2', value: 2,
}, },
{ {
label: '能耗告警', label: '能耗告警',
value: '3', value: 3,
}, },
], ],
}, },
}, },
{ {
field: 'provider', field: 'priority',
label: '告警优先级', label: '告警优先级',
component: 'NsSelect', component: 'NsSelect',
componentProps: { componentProps: {
placeholder: '请选择告警优先级', placeholder: '请选择告警优先级',
allowClear: true,
options: [ options: [
{ {
label: '紧急', label: '紧急',
value: '1', value: 1,
}, },
{ {
label: '重要', label: '重要',
value: '1', value: 2,
}, },
{ {
label: '一般', label: '一般',
value: '2', value: 3,
}, },
], ],
}, },
}, },
{ {
field: 'provider', field: 'alarmTitle',
label: '告警标题', label: '告警标题',
component: 'NsInput', component: 'NsInput',
componentProps: { componentProps: {
allowClear: true,
placeholder: '请输入告警标题关键字', placeholder: '请输入告警标题关键字',
}, },
}, },
{ {
field: 'provider', field: 'errorCode',
label: '错误码', label: '错误码',
component: 'NsInput', component: 'NsInput',
componentProps: { componentProps: {
allowClear: true,
placeholder: '请输入告警错误码', placeholder: '请输入告警错误码',
}, },
}, },
{ {
field: 'payWay', field: 'enableNotifications',
label: '启用状态', label: '启用状态',
component: 'NsSelect', component: 'NsSelect',
componentProps: { componentProps: {
allowClear: true,
placeholder: '请选择启用状态', placeholder: '请选择启用状态',
options: [ options: [
{ {

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

@ -707,16 +707,17 @@
{ {
field: 'emissionProcess', field: 'emissionProcess',
label: '排放环节', label: '排放环节',
component: 'NsSelect', component: 'NsInput',
componentProps: { componentProps: {
allowClear: true, // allowClear: true,
placeholder: '请选择排放环节', placeholder: '请选择排放环节',
options: [ maxLength: 30,
{ // options: [
label: '消费环节', // {
value: 0, // label: '',
} // value: 0,
], // }
// ],
}, },
}, },
{ {

306
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/carbonEmissions/index copy.vue

@ -0,0 +1,306 @@
<template>
<div>
<!-- <a-table
:columns="column"
:data-source="data"
bordered
:pagination="false"
:scroll="{ x: 2000 }">
<template #title>
<a-date-picker v-model:value="selectYear" picker="year" @change="changeYearData" valueFormat="YYYY" />
</template>
</a-table> -->
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
<!-- <a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
style="display: flex;justify-content: center;margin-top: 16px;"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" /> -->
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { http } from '/nerv-lib/util/http';
import { Pagination } from 'ant-design-vue';
import dayjs, { Dayjs } from 'dayjs';
import { carbonEmission } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({
energyType: 'CarbonEmissions', // name
components: {
'a-pagination': Pagination,
},
});
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId } ) => {
return http.post(api, params);
};
const data = ref([]);
const selectYear = ref<Dayjs>(dayjs( new Date().getFullYear().toString()));
const total = ref<number>()
const queryParams = ref({
pageNum: 1,
pageSize: 10,
year: selectYear.value.format('YYYY'),
orgId: orgId.value
})
//
// const changeYearData = () => {
// queryParams.value.year = selectYear.value
// getTableList()
// }
//
const mainRef = ref();
const column: TableColumnsType [] = [
{
title: '排放类型',
dataIndex: 'cnValue',
customCell: (record, rowIndex) => {
if (rowIndex == undefined) {
return {
rowSpan: 0,
colSpan: 0,
};
}
const rowSpan = getRowSpan('cnValue', record, data.value);
if (rowIndex != 0 && data.value[rowIndex - 1].name == record.name) {
return {
rowSpan: 0,
colSpan: 0,
};
}
return {
rowSpan: rowSpan,
};
},
},
{
title: '能源种类',
dataIndex: 'energyType',
},
{
title: '计量单位',
dataIndex: 'unit',
},
{
title: '加权平均',
dataIndex: 'averageFactorValue',
},
{
title: '全年',
dataIndex: 'carbonYearly',
},
{
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',
},
];
const year = ref(selectYear.value.format('YYYY'))
const tableConfig = ref({
title: '碳排统计',
api: carbonEmission.carbonEmissionStatistics,
params: {
orgId,
year
},
columns: [
{
title: '排放类型',
dataIndex: 'cnValue',
customCell: (record, rowIndex) => {
if (rowIndex == undefined) {
return {
rowSpan: 0,
colSpan: 0,
};
}
const rowSpan = getRowSpan('cnValue', record, data.value);
if (rowIndex != 0 && data.value[rowIndex - 1].name == record.name) {
return {
rowSpan: 0,
colSpan: 0,
};
}
return {
rowSpan: rowSpan,
};
},
},
{
title: '能源种类',
dataIndex: 'energyType',
},
{
title: '计量单位',
dataIndex: 'unit',
},
{
title: '加权平均',
dataIndex: 'averageFactorValue',
},
{
title: '全年',
dataIndex: 'carbonYearly',
},
{
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',
},
],
formConfig: {
schemas: [
{
field: 'year',
label: '年份',
component: 'NsDatePicker',
componentProps: {
picker: 'year',
valueFormat: 'YYYY',
defaultValue: selectYear.value.format('YYYY'),
},
},
],
params: {},
},
rowKey: 'id',
});
//
const getRowSpan = (dataIndex: string, record: any, data: any, dependents: string[] = []) => {
let rowSpan = 1;
for (let i = data.indexOf(record) + 1; i < data.length; i++) {
let shouldMerge = true;
for (const dependent of dependents) {
if (data[i][dependent] !== record[dependent]) {
shouldMerge = false;
break;
}
}
if (shouldMerge && data[i][dataIndex] === record[dataIndex]) {
rowSpan++;
} else {
break;
}
}
return rowSpan;
};
//
// const getTableList = () => {
// fetch(carbonEmission.carbonEmissionStatistics , queryParams.value).then((res) => {
// data.value = res.data.records
// total.value = res.data.total
// });
// };
//
// const onChange = (pageNumber: number,size: number) => {
// queryParams.value.pageNum = pageNumber;
// queryParams.value.pageSize = size;
// getTableList()
// };
</script>
<style scoped lang="less">
::v-deep .ant-table-title{
display: flex;
}
::v-deep .ant-table-container{
padding: 0px 16px;
}
</style>
<style scoped>
th.column-money,
td.column-money {
text-align: right !important;
}
</style>

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

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<a-table <!-- <a-table
:columns="tableColumns" :columns="tableColumns"
:data-source="data" :data-source="data"
bordered bordered
@ -26,15 +26,16 @@
<a-button type="primary">凭证下载</a-button> <a-button type="primary">凭证下载</a-button>
</div> </div>
</template> </template>
</a-table> </a-table> -->
<a-pagination <ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500}" />
<!-- <a-pagination
:current="queryParams.pageNum" :current="queryParams.pageNum"
:total="total" :total="total"
:page-size="queryParams.pageSize" :page-size="queryParams.pageSize"
style="display: flex;justify-content: center;margin-top: 16px;" style="display: flex;justify-content: center;margin-top: 16px;"
:show-size-changer="true" :show-size-changer="true"
:show-quick-jumper="true" :show-quick-jumper="true"
@change="onChange" /> @change="onChange" /> -->
<!-- 新增数据库数据 --> <!-- 新增数据库数据 -->
<a-drawer <a-drawer
:width="500" :width="500"
@ -158,6 +159,7 @@
import { Pagination,message,Modal } from 'ant-design-vue'; import { Pagination,message,Modal } from 'ant-design-vue';
import { InboxOutlined } from '@ant-design/icons-vue'; import { InboxOutlined } from '@ant-design/icons-vue';
import type { CascaderProps,TreeSelectProps,UploadChangeParam } from 'ant-design-vue'; import type { CascaderProps,TreeSelectProps,UploadChangeParam } from 'ant-design-vue';
import { NsMessage } from '/nerv-lib/component';
import dayjs, { Dayjs } from 'dayjs'; import dayjs, { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { tableColumns } from '../config'; import { tableColumns } from '../config';
@ -229,19 +231,182 @@
queryParams.value.year = selectYear.value queryParams.value.year = selectYear.value
getTableList() getTableList()
} }
const mainRef = ref();
const year = selectYear.value.format('YYYY')
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: 'unit',
dataIndex: 'unit',
},
{
title: '全年',
dataIndex: 'yearly',
},
{
title: '1月',
dataIndex: 'jan',
// customRender: ({ text, record }) => ({
// children: text,
// attrs: {
// style: record.janFlag === 1 ? 'color: red' : 'color: blue'
// }
// })
},
{
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) => {
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
if(res.data.unit){
res.data.unit = res.data.unit.split(',')
}
formState.value = res.data
});
},
},
{
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',
defaultValue: selectYear.value.format('YYYY'),
},
},
],
params: {},
},
rowKey: 'id',
});
// //
const getTableList = () => { const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => { fetch(energyConsumption.pageList , queryParams.value).then((res) => {
data.value = res.data.records data.value = res.data.records
total.value = res.data.total
}); });
}; };
getTableList()
// //
const onChange = (pageNumber: number,size: number) => { const onChange = (pageNumber: number,size: number) => {
queryParams.value.pageNum = pageNumber; queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size; queryParams.value.pageSize = size;
getTableList() mainRef.value?.nsTableRef.reload();
}; };
// //
const changeRadio = (e) => { const changeRadio = (e) => {
@ -263,23 +428,20 @@
if(formState.value.id){ if(formState.value.id){
fetch(energyConsumption.update , formState.value).then((res) => { fetch(energyConsumption.update , formState.value).then((res) => {
visible.value = false visible.value = false
formState.value = {}
message.success('操作成功!'); message.success('操作成功!');
getTableList() mainRef.value?.nsTableRef.reload();
}); });
}else{ }else{
fetch(energyConsumption.creat , formState.value).then((res) => { fetch(energyConsumption.creat , formState.value).then((res) => {
if(res.data === '新增数据已存在'){ if(res.data === '新增数据已存在'){
visible.value = false visible.value = false
queryParams.value = formState.value NsMessage.warning(res.data);
queryParams.value.pageNum = 1,
queryParams.value.pageSize = 10,
queryParams.value.orgId = orgId.value,
queryParams.value.year = selectYear.value.format('YYYY')
getTableList()
}else{ }else{
visible.value = false visible.value = false
formState.value = {}
message.success('操作成功!'); message.success('操作成功!');
getTableList() mainRef.value?.nsTableRef.reload();
} }
}); });
} }
@ -298,10 +460,10 @@
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT'}).then((res) => { fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT'}).then((res) => {
measurementUnit.value = res.data measurementUnit.value = res.data
measurementUnit.value = measurementUnit.value.map(item => ({ measurementUnit.value = measurementUnit.value.map(item => ({
value: item.cnValue, value: item.id,
label: item.cnValue, label: item.cnValue,
children: item.children ? item.children.map(child => ({ children: item.children ? item.children.map(child => ({
value: child.cnValue, value: child.id,
label: child.cnValue label: child.cnValue
})) : [] })) : []
})); }));
@ -310,10 +472,10 @@
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => { fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {
treeData.value = res.data treeData.value = res.data
treeData.value = treeData.value.map(item => ({ treeData.value = treeData.value.map(item => ({
value: item.pointName, value: item.id,
label: item.pointName, label: item.pointName,
children: item.children ? item.children.map(child => ({ children: item.children ? item.children.map(child => ({
value: child.pointName, value: child.id,
label: child.pointName label: child.pointName
})) : [] })) : []
})); }));
@ -346,7 +508,7 @@
onOk() { onOk() {
fetch(energyConsumption.del , {id : record.id }).then((res) => { fetch(energyConsumption.del , {id : record.id }).then((res) => {
message.success('操作成功!'); message.success('操作成功!');
getTableList() mainRef.value?.nsTableRef.reload();
}); });
}, },
onCancel() { onCancel() {
@ -357,6 +519,7 @@
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
formState.value = {}
formRef.value.resetFields(); formRef.value.resetFields();
}; };
// //

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

@ -39,7 +39,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<a-table <!-- <a-table
:columns="columns" :columns="columns"
:data-source="tableData" :data-source="tableData"
bordered bordered
@ -59,7 +59,8 @@
<a-button type="primary" @click="addNewData">新增</a-button> <a-button type="primary" @click="addNewData">新增</a-button>
</div> </div>
</template> </template>
</a-table> </a-table> -->
<ns-view-list-table v-bind="tableConfig" :model="tableData" ref="mainRef" />
<a-pagination <a-pagination
:current="queryParams.pageNum" :current="queryParams.pageNum"
:total="total" :total="total"
@ -139,6 +140,7 @@
const fetch = (api, params = { orgId } ) => { const fetch = (api, params = { orgId } ) => {
return http.post(api, params); return http.post(api, params);
}; };
const mainRef = ref();
// //
const x = 3; const x = 3;
const y = 2; const y = 2;
@ -209,12 +211,13 @@
autoExpandParent.value = false; autoExpandParent.value = false;
}; };
// //
const energyType = ref()
const onSelect = (selectedKey: string[], info: any) => { const onSelect = (selectedKey: string[], info: any) => {
selectedKeys.value = selectedKey; selectedKeys.value = selectedKey;
if(info.selected){ if(info.selected){
queryParams.value.energyType = info.node.id energyType.value = info.node.id
statsId.value = info.node.id statsId.value = info.node.id
getTableList() mainRef.value?.nsTableRef.reload();
} }
}; };
@ -239,10 +242,9 @@
const getTreeData = () => { const getTreeData = () => {
fetch(quickCalculation.carbonQuickTree).then((res) => { fetch(quickCalculation.carbonQuickTree).then((res) => {
gData.value = res.data gData.value = res.data
debugger energyType.value = gData.value[0].children[0].id
queryParams.value.energyType = gData.value[0].children[0].id
statsId.value = gData.value[0].children[0].id statsId.value = gData.value[0].children[0].id
getTableList() mainRef.value?.nsTableRef.reload();
}); });
}; };
getTreeData() getTreeData()
@ -254,6 +256,90 @@
orgId: orgId.value orgId: orgId.value
}) })
const tableData = ref([]); const tableData = ref([]);
const tableConfig = ref({
title: '排放因子库',
api: quickCalculation.queryCarbonEmissionPage,
params: {
orgId,
energyType
},
headerActions: [
{
label: '新增',
name: 'userAdd',
type: 'primary',
handle: () => {
visible.value = true
getNewTable()
},
},
],
columns: [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '因子值',
dataIndex: 'emissionFactors',
},
{
title: '计量单位',
className: 'carbonEmissionSuffix',
dataIndex: 'carbonEmissionSuffix',
},
{
title: '更新时间',
className: 'updateTime',
dataIndex: 'updateTime',
},
{
title: '启用时间',
className: 'startTime',
dataIndex: 'startTime',
},
{
title: '结束时间',
className: 'endTime',
dataIndex: 'endTime',
},
{
title: '数据来源',
className: 'dataSources',
dataIndex: 'dataSources',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
selectedRowKeys.value = [record.carbonId];
formState.value.id = record.id
formState.value.emissionFactors = record.emissionFactors
formState.value.dateRange = [record.startTime, record.endTime];
formState.value.carbonId = record.carbonId
visible.value = true
getNewTable()
},
},
{
label: '删除',
name: 'userDelete',
dynamicParams: { id: 'id' },
confirm: true,
isReload: true,
api: quickCalculation.del,
},
],
},
rowKey: 'id',
});
// //
const getTableList = () => { const getTableList = () => {
fetch(quickCalculation.queryCarbonEmissionPage,queryParams.value).then((res) => { fetch(quickCalculation.queryCarbonEmissionPage,queryParams.value).then((res) => {
@ -265,7 +351,7 @@
const onChange = (pageNumber: number,size: number) => { const onChange = (pageNumber: number,size: number) => {
queryParams.value.pageNum = pageNumber; queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size; queryParams.value.pageSize = size;
getTableList() mainRef.value?.nsTableRef.reload();
}; };
// / // /
const formRef = ref(); const formRef = ref();
@ -321,14 +407,13 @@
formState.value.startTime = formState.value.dateRange[0] formState.value.startTime = formState.value.dateRange[0]
formState.value.endTime = formState.value.dateRange[1] formState.value.endTime = formState.value.dateRange[1]
console.log('values', formState, toRaw(formState)); console.log('values', formState, toRaw(formState));
debugger
if(formState.value.id){ if(formState.value.id){
fetch(quickCalculation.update,formState.value).then((res) => { fetch(quickCalculation.update,formState.value).then((res) => {
visible.value = false visible.value = false
selectedRowKeys.value = []; selectedRowKeys.value = [];
formState.value = {} formState.value = {}
formRef.value.resetFields(); formRef.value.resetFields();
getTableList() mainRef.value?.nsTableRef.reload();
}); });
}else{ }else{
fetch(quickCalculation.creat,formState.value).then((res) => { fetch(quickCalculation.creat,formState.value).then((res) => {
@ -336,7 +421,7 @@
selectedRowKeys.value = []; selectedRowKeys.value = [];
formState.value = {} formState.value = {}
formRef.value.resetFields(); formRef.value.resetFields();
getTableList() mainRef.value?.nsTableRef.reload();
}); });
} }
}) })
@ -408,6 +493,9 @@
::v-deep .ant-table-container{ ::v-deep .ant-table-container{
padding: 0px 16px; padding: 0px 16px;
} }
:deep(.ns-table-main) {
margin-top: unset !important;
}
.top { .top {
overflow: auto; overflow: auto;
} }

283
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts

@ -0,0 +1,283 @@
import { ref } from 'vue';
import { http } from '/nerv-lib/util';
import { origanizemanage } from '/@/api/origanizemanage';
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
export const formConfig = (disabled) => {
return ref([
{
field: 'fields',
component: 'NsChildForm',
componentProps: {
schemas: [
{
label: '排放源',
field: 'emissionSources',
component: 'NsInput',
componentProps: {
placeholder: '请输入排放源',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入排放源',
},
],
},
{
field: 'emissionType',
label: '排放分类',
component: 'NsCascader',
fieldMap: ['emissionType'],
componentProps: {
placeholder: '请选择排放分类',
api: carbonEmissionFactorLibrary.getCarbonFactorTree,
fieldNames: { label: 'emissionName', value: 'id' },
showSearch: true,
},
rules: [
{
required: true,
message: '请选择排放分类',
},
],
},
{
field: 'emissionGas',
label: '排放气体',
component: 'NsSelect',
componentProps: {
allowClear: true,
placeholder: '请选择排放气体',
options: [
{
label: 'CO2',
value: 'CO2',
},
{
label: 'CO2e',
value: 'CO2e',
},
{
label: 'SF6',
value:'SF6',
},
{
label: 'CH4',
value: 'CH4',
},
{
label: 'PFCs',
value: 'PFCs',
},
{
label: 'HFCs',
value: 'HFCs',
},
],
},
rules: [
{
required: true,
message: '请选择排放气体',
},
],
},
// {
// field: 'emissionProcess',
// label: '排放环节',
// component: 'NsSelectApi',
// componentProps: {
// api: carbonEmissionFactorLibrary.getEmissionProcess,
// params: {
// emissionType: sessionStorage.getItem('checkedTreeNode'),
// },
// resultField: 'data',
// labelField: 'emissionProcess',
// valueField: 'emissionProcess',
// immediate: true,
// autoSelectFirst: false,
// filterOption:false,
// showSearch:true,
// autoClearSearchValue:false
// },
// },
{
label: '排放环节',
field: 'emissionProcess',
component: 'NsInput',
componentProps: {
placeholder: '请输入排放环节',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入排放环节',
},
],
},
{
label: '排放因子',
field: 'emissionFactors',
component: 'NsInputNumber',
componentProps: {
placeholder: '请输入排放因子值',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入排放因子值',
trigger: 'change',
},
],
},
{
field: 'carbonEmissionPrefix',
label: '碳排前缀',
component: 'NsSelect',
componentProps: {
disabled: true,
allowClear: true,
defaultValue: 't',
placeholder: '请选择碳排前缀',
options: [
{
label: 'g',
value: 'g',
},
{
label: 'kg',
value: 'kg',
},
{
label: 't',
value: 't',
},
],
},
rules: [
{
required: true,
message: '请选择碳排前缀',
},
],
},
{
label: '碳排后缀',
field: 'carbonEmissionSuffix',
component: 'NsInput',
componentProps: {
placeholder: '请输入碳排后缀',
maxLength: 20,
},
rules: [
{
required: true,
message: '请输入碳排后缀',
},
],
},
{
label: '已引用数',
field: 'numberOfReferences',
component: 'NsInput',
componentProps: {
defaultValue: 10,
disabled: true,
maxLength: 20,
},
},
{
label: '参考文献',
field: 'reference',
component: 'NsTextarea',
componentProps: {
placeholder: '请输入参考文献',
maxLength: 20,
},
},
],
},
},
]);
};
const options = ref([]);
const getUserPerList = (transform, params = {}) => {
return http.post(origanizemanage.queryUserPerList, { ...params }).then((res) => {
return res.data?.map((item) => {
item = { ...item, ...transform(item) };
return item;
});
});
};
export const formConfig2 = (casData: any) => {
return ref([
{
field: 'information',
component: 'NsCascader',
componentProps: {
placeholder: '请选择',
displayRender: ({ labels, selectedOptions }: any) => {
console.log(labels, selectedOptions);
casData.value = selectedOptions.map(({ label, value }) => {
return { label, value };
});
return labels.join('/');
},
loadData: (selectedOptions, options) => {
console.log(selectedOptions, options, 'selectedOptions, options');
const targetOption = selectedOptions[selectedOptions.length - 1];
let transForm, params;
// load options lazily
if (!selectedOptions.length) {
transForm = (data) => {
data['label'] = data.orgName;
data['value'] = data.orgId;
data['isLeaf'] = false;
data['level'] = 1;
return data;
};
getUserPerList(transForm).then((res) => {
options.value = [...res];
});
}
const id = targetOption?.value;
const level = targetOption?.level;
if (targetOption) {
targetOption.loading = true;
}
if (level === 1) {
transForm = (data) => {
data['label'] = data.deptName;
data['value'] = data.deptId;
data['isLeaf'] = false;
data['level'] = 2;
return data;
};
params = { orgId: id };
} else if (level === 2) {
transForm = (data) => {
data['label'] = data.roleName;
data['value'] = data.roleId;
data['level'] = 3;
return data;
};
params = { deptId: id };
}
if (targetOption) {
getUserPerList(transForm, { ...params }).then((res) => {
targetOption.loading = false;
targetOption.children = [...res];
});
}
},
},
},
]);
};

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

@ -0,0 +1,115 @@
<template>
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" />
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { http } from '/nerv-lib/util/http';
import { carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
const tableConfig = ref({
title: '数据库',
api: carbonEmissionFactorLibrary.getTableList,
params: {
orgId
},
headerActions: [
{
label: '新增',
name: 'userAdd',
type: 'primary',
handle: () => {
},
},
],
columns: [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '企业名称',
dataIndex: 'emissionSources',
},
{
title: '报告名称',
dataIndex: 'emissionTypeColumn',
},
{
title: '报告年度',
dataIndex: 'emissionGas',
},
{
title: '适用标准',
dataIndex: 'emissionProcess',
},
{
title: '更新人',
dataIndex: 'emissionFactors',
},
{
title: '更新时间',
dataIndex: 'emissionFactorUnits',
},
],
columnActions: {
title: '操作',
actions: [
{
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
},
},
{
label: '填报',
name: 'fillIn',
handle: (record: any) => {
},
},
{
label: '下载',
name: 'download',
handle: (record: any) => {
},
},
{
label: '删除',
name: 'userDelete',
dynamicParams: { ids: 'id[]' },
confirm: true,
isReload: true,
api: carbonEmissionFactorLibrary.del,
},
],
},
formConfig: {
schemas: [
{
field: 'emissionSources',
label: '报告名称',
component: 'NsInput',
componentProps: {
placeholder: '请输入报告名称',
maxLength: 30,
},
},
],
params: {},
},
rowKey: 'id',
});
</script>
<style lang="less" scoped>
</style>

45
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/mock.ts

@ -0,0 +1,45 @@
import { ref } from 'vue';
import { origanizemanage } from '/@/api/origanizemanage';
import { http } from '/nerv-lib/saas';
export const mockData = ref([
{
id: 3,
zhanghao: 'axb',
name: '张三',
sex: '男',
phone: '123456789',
email: '1234567889',
relation: '1',
role: '1',
status: '1',
},
]);
export const mockData2 = ref([
{
information: '铁路局1/产品部1/产品总监1',
},
]);
export const treeData = ref([
{
title: '铁路总局',
key: '0-0',
children: [
{ title: '济阳站', key: '0-0-0' },
{ title: '临沂站', key: '0-0-1' },
],
},
]);
export const treeData2 = [
{
title: '全部',
key: '0-0',
children: [
{ title: '产品部', key: '0-0-0' },
{ title: '运维部', key: '0-0-1' },
],
},
];
Loading…
Cancel
Save