xuziqiang
4 months ago
18 changed files with 1277 additions and 198 deletions
@ -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', //通知管理 查询详情
|
|||
} |
@ -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: '请输入企业名称', |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
}); |
@ -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> |
@ -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]; |
|||
}); |
|||
} |
|||
}, |
|||
}, |
|||
}, |
|||
]); |
|||
}; |
@ -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> |
@ -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…
Reference in new issue