remark:'commit'
This commit is contained in:
@@ -9,33 +9,39 @@
|
||||
</div>
|
||||
<a-form layout="inline">
|
||||
<a-form-item>
|
||||
<a-input
|
||||
style="width: 200px"
|
||||
<a-select
|
||||
v-model:value="queryParams.accountType"
|
||||
placeholder="请输入账户类型" />
|
||||
style="width: 200px"
|
||||
placeholder="请输入账户类型">
|
||||
<a-select-option :value="1">全国账户</a-select-option>
|
||||
<a-select-option :value="2">地方账户</a-select-option>
|
||||
<a-select-option :value="3">CCER</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-select
|
||||
ref="select"
|
||||
<a-cascader
|
||||
v-model:value="queryParams.transactionType"
|
||||
multiple
|
||||
style="width: 200px"
|
||||
:options="options"
|
||||
placeholder="请选择交易类型"
|
||||
@focus="focus"
|
||||
@change="handleChange">
|
||||
<a-select-option value="jack">Jack</a-select-option>
|
||||
<a-select-option value="lucy">Lucy</a-select-option>
|
||||
</a-select>
|
||||
suffix-icon="Shopping Around">
|
||||
<template #tagRender="data">
|
||||
<a-tag :key="data.value" color="blue">{{ data.label }}</a-tag>
|
||||
</template>
|
||||
</a-cascader>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-date-picker
|
||||
style="width: 200px"
|
||||
v-model:value="queryParams.transactionDate"
|
||||
v-model:value="queryParams.year"
|
||||
placeholder="请选择账期"
|
||||
picker="year" />
|
||||
picker="year"
|
||||
valueFormat="YYYY" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary">查询</a-button>
|
||||
<a-button html-type="submit" style="margin-left: 6px">重置</a-button>
|
||||
<a-button type="primary" @click="searchTableList">查询</a-button>
|
||||
<a-button html-type="submit" style="margin-left: 6px" @click="reset">重置</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
@@ -110,7 +116,11 @@
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol">
|
||||
<a-form-item ref="name" label="账户类型" name="accountType">
|
||||
<a-input v-model:value="formState.accountType" placeholder="请输入账户类型" />
|
||||
<a-select v-model:value="formState.accountType" placeholder="请输入账户类型">
|
||||
<a-select-option value="1">全国账户</a-select-option>
|
||||
<a-select-option value="2">地方账户</a-select-option>
|
||||
<a-select-option value="3">CCER</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item ref="name" label="交易类型" name="transactionType">
|
||||
<a-cascader
|
||||
@@ -130,17 +140,19 @@
|
||||
<a-form-item ref="name" label="交易对象" name="tradingPartner">
|
||||
<a-input v-model:value="formState.tradingPartner" placeholder="请输入交易对象" />
|
||||
</a-form-item>
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
||||
:headers="headers"
|
||||
@change="handleChange">
|
||||
<a-button>
|
||||
<upload-outlined></upload-outlined>
|
||||
点击上传凭证
|
||||
</a-button>
|
||||
</a-upload>
|
||||
<a-form-item ref="name" label="交易凭证" name="tradingPartner">
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
||||
:headers="headers"
|
||||
@change="handleChange">
|
||||
<a-button>
|
||||
<upload-outlined></upload-outlined>
|
||||
上传
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<template #footer>
|
||||
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
|
||||
@@ -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<number>();
|
||||
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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user