diff --git a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts index 247efed..5961d52 100644 --- a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts +++ b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts @@ -60,9 +60,13 @@ export enum carbonInventoryCheck { // 碳排流向 carbonFlowDirection = '/carbon-smart/api/carbon/inventory/carbonFlowDirection', } -// 碳资产-详情 -export enum carbonAssetsDetail { +// 碳资产 +export enum carbonAssets { + // 全部 + carbonAssets = '/carbon-smart/api/carbon/trade/details/carbonAssets', + // 详情 carbonDetailsList = '/carbon-smart/api/carbon/trade/details/carbonDetailsList', createOrUpdate = '/carbon-smart/api/carbon/trade/details/createOrUpdate', delete = '/carbon-smart/api/carbon/trade/details/delete', + quotaStatistics = '/carbon-smart/api/carbon/trade/details/quotaStatistics', } diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue index 28267ba..fe1f4ed 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue @@ -9,33 +9,39 @@ - + style="width: 200px" + placeholder="请输入账户类型"> + 全国账户 + 地方账户 + CCER + - - Jack - Lucy - + suffix-icon="Shopping Around"> + + {{ data.label }} + + + picker="year" + valueFormat="YYYY" /> - 查询 - 重置 + 查询 + 重置 @@ -110,7 +116,11 @@ :label-col="labelCol" :wrapper-col="wrapperCol"> - + + 全国账户 + 地方账户 + CCER + - - - - 点击上传凭证 - - + + + + + 上传 + + + 取消 @@ -155,13 +167,19 @@ import { UploadOutlined } from '@ant-design/icons-vue'; import type { UploadChangeParam } from 'ant-design-vue'; import { Pagination, Modal, message } from 'ant-design-vue'; - import { carbonAssetsDetail } from '/@/api/carbonEmissionFactorLibrary'; + import { carbonAssets, carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary'; defineOptions({ - energyType: 'carbonAssetsDetail', // 与页面路由name一致缓存才可生效 + energyType: 'carbonAssets', // 与页面路由name一致缓存才可生效 components: { 'a-pagination': Pagination, }, }); + // 父组件id + const props = defineProps({ + parentId: { + type: Number, + }, + }); const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); orgId.value = result; @@ -174,14 +192,20 @@ selectedRowKeys.value = selectedKeys; }; const total = ref(); + const thisYear = ref(new Date().getFullYear().toString()); const queryParams = ref({ pageNum: 1, pageSize: 10, orgId: orgId.value, + accountType: props.parentId, + year: thisYear.value, }); + const searchTableList = () => { + getDetailList(); + }; // 获取左侧列表数据 const getDetailList = () => { - fetch(carbonAssetsDetail.carbonDetailsList, queryParams.value).then((res) => { + fetch(carbonAssets.carbonDetailsList, queryParams.value).then((res) => { data.value = res.data.records; }); }; @@ -239,11 +263,39 @@ }, ]; const data = ref([]); + const reset = () => { + queryParams.value = { + pageNum: 1, + pageSize: 10, + orgId: orgId.value, + year: new Date().getFullYear(), + }; + getDetailList(); + }; const editData = (record) => { + getDictList(); visible.value = true; formState.value.id = record.id; - formState.value = record; + setTimeout(() => { + let selectDevice = ref([Number(record.transactionType)]); + findParentIds(options.value, record.transactionType, selectDevice.value); + record.transactionType = selectDevice; + formState.value.transactionType = record.transactionType; + formState.value = record; + }, 500); }; + // 定义一个递归函数来查找每一级的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 delData = (record) => { Modal.confirm({ title: '警告', @@ -252,7 +304,7 @@ okType: 'primary', cancelText: '取消', onOk() { - fetch(carbonAssetsDetail.delete, { id: record.id }).then((res) => { + fetch(carbonAssets.delete, { id: record.id }).then((res) => { message.success('操作成功!'); getDetailList(); }); @@ -270,55 +322,48 @@ }; // 新增相关数据 const visible = ref(false); - const formState = ref({}); + const formState = ref({ + orgId: orgId.value, + }); const formRef = ref(); const labelCol = { span: 5 }; const wrapperCol = { span: 19 }; - const options: CascaderProps['options'] = [ - { - value: 'zhejiang', - label: 'Zhejiang', - children: [ - { - value: 'hangzhou', - label: 'Hangzhou', - children: [ - { - value: 'xihu', - label: 'West Lake', - }, - ], - }, - ], - }, - { - value: 'jiangsu', - label: 'Jiangsu', - children: [ - { - value: 'nanjing', - label: 'Nanjing', - children: [ - { - value: 'zhonghuamen', - label: 'Zhong Hua Men', - }, - ], - }, - ], - }, - ]; + const options = ref([]); + // 获取字典值 + const getDictList = () => { + fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'TRANSACTION_TYPE' }).then( + (res) => { + options.value = res.data; + options.value = options.value.map((item) => ({ + value: item.id, + label: item.cnValue, + children: item.children + ? item.children.map((child) => ({ + value: child.id, + label: child.cnValue, + })) + : [], + })); + }, + ); + }; + getDictList(); // 点击新增 const addDetail = () => { visible.value = true; + getDictList(); }; const onSubmit = () => { formRef.value .validate() .then(() => { console.log('values', formState, toRaw(formState)); - fetch(carbonAssetsDetail.createOrUpdate, formState.value).then((res) => { + if (formState.value.transactionType) { + formState.value.transactionType = formState.value.transactionType.join(',').split(',')[1]; + } + fetch(carbonAssets.createOrUpdate, formState.value).then((res) => { message.success('操作成功!'); + visible.value = false; getDetailList(); }); }) @@ -342,36 +387,28 @@ formRef.value.resetFields(); }; // 统计表格 + const getTotalTable = () => { + fetch(carbonAssets.quotaStatistics, queryParams.value).then((res) => { + totalData.value = res.data; + }); + }; + getTotalTable(); const totalColumns = [ { title: '统计类型', - dataIndex: 'name', + dataIndex: 'statisticType', }, { title: '小计', - dataIndex: 'name', + dataIndex: 'subtotal', }, { title: '合计', - dataIndex: 'name', + dataIndex: 'amountTo', }, ]; - const totalData = [ - { - key: '1', - total: '0', - name: 'John', - money: '¥300,000.00', - address: 'New York No. 1 Lake Park', - }, - { - key: '2', - name: 'Jim', - money: '¥1,256,000.00', - address: 'London No. 1 Lake Park', - }, - ]; + const totalData = ref([]); // 点击返回 const emit = defineEmits(['change-data']); const changeParentData = () => { diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue index be634e7..aeda327 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue @@ -1,15 +1,15 @@ - + 全国碳账户估值(CNY) - 300,000.00 + {{nationwide.valuation}} - 75,000.00 + {{nationwide.opening}} 期初余额(tCO2) - 20,000.00 + {{nationwide.income}} 增加(tCO2) @@ -34,7 +34,7 @@ - 20,000.00 + {{nationwide.expenditure}} 减少(tCO2) @@ -42,20 +42,24 @@ - 75,000.00 + {{nationwide.period}} 期末余额(tCO2) - + 地方碳账户估值(CNY) - 300,000.00 + {{place.valuation}} @@ -64,12 +68,12 @@ - 75,000.00 + {{place.opening}} 期初余额(tCO2) - 20,000.00 + {{place.income}} 增加(tCO2) @@ -77,7 +81,7 @@ - 20,000.00 + {{place.expenditure}} 减少(tCO2) @@ -85,20 +89,24 @@ - 75,000.00 + {{place.period}} 期末余额(tCO2) - + CCER资产估值(CNY) - 300,000.00 + {{ccer.valuation}} @@ -107,12 +115,12 @@ - 75,000.00 + {{ccer.opening}} 期初余额(tCO2) - 20,000.00 + {{ccer.income}} 增加(tCO2) @@ -120,7 +128,7 @@ - 20,000.00 + {{ccer.expenditure}} 减少(tCO2) @@ -128,18 +136,18 @@ - 75,000.00 + {{ccer.period}} 期末余额(tCO2) - + 全国碳账户估值(CNY) - 300,000.00 + {{whole.whole}} - 300,000.00 + {{whole.nationwide}} 全国碳账户资产估值 - 300,000.00 + {{whole.place}} 地方碳账户资产估值 - 300,000.00 + {{whole.ccer}} CCER碳资产估值 - + diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue index 242995d..f49bd40 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue @@ -129,7 +129,7 @@ + + \ No newline at end of file diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue new file mode 100644 index 0000000..cdb76b7 --- /dev/null +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue @@ -0,0 +1,358 @@ + + + + + 统计数据 + 新增节点 + + + + + 月 + 年 + + + + + + + + + + + + + 详情 + + + + + + + + + + + + + Some contents... + Some contents... + Some contents... + + 取消 + 确定 + + + + + + + diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue index ae4e8c1..6d88cc1 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue @@ -3,7 +3,9 @@ - + + + @@ -13,6 +15,7 @@
Some contents...