规范代码

This commit is contained in:
fks-xuxinyue
2024-07-25 15:19:41 +08:00
parent 6478070bd8
commit 61dcbfeacd
5 changed files with 53 additions and 52 deletions

View File

@@ -20,8 +20,7 @@
:model="formState"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="报告名称" name="reportName">
<a-input v-model:value="formState.reportName" placeholder="请输入报告名称" />
</a-form-item>
@@ -38,7 +37,10 @@
</a-select>
</a-form-item>
<a-form-item ref="name" label="报告范围" name="reportScope">
<a-range-picker v-model:value="formState.reportScope" picker="month" valueFormat="YYYY-MM" />
<a-range-picker
v-model:value="formState.reportScope"
picker="month"
valueFormat="YYYY-MM" />
</a-form-item>
</a-form>
<template #footer>
@@ -49,7 +51,7 @@
</template>
<script lang="ts" setup>
import { ref,toRaw } from 'vue';
import { ref, toRaw } from 'vue';
import { http } from '/nerv-lib/util/http';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue';
@@ -65,7 +67,7 @@
const fillInPage = ref(false);
// 新增相关数据
const visible = ref(false);
const formState = ref({})
const formState = ref({});
const formRef = ref();
const labelCol = { span: 5 };
const wrapperCol = { span: 19 };
@@ -80,7 +82,7 @@
// 关闭新增抽屉
const onClose = () => {
visible.value = false;
formState.value = {}
formState.value = {};
formRef.value.resetFields();
};
// 点击确定提交
@@ -89,15 +91,15 @@
.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
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 => {
.catch((error) => {
console.log('error', error);
});
};
@@ -110,7 +112,7 @@
title: '数据库',
api: carbonInventoryCheck.carbonInventoryList,
params: {
orgId
orgId,
},
headerActions: [
{
@@ -118,7 +120,7 @@
name: 'userAdd',
type: 'primary',
handle: () => {
visible.value = true
visible.value = true;
},
},
],
@@ -161,10 +163,10 @@
label: '编辑',
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]
visible.value = true;
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
formState.value = res.data;
formState.value.reportScope = [res.data.startTime, res.data.endTime];
});
},
},
@@ -172,17 +174,16 @@
label: '填报',
name: 'fillIn',
handle: (record: any) => {
isMainPage.value = false
fillInPage.value = true
reportId.value = record.id
year.value = record.reportYear
isMainPage.value = false;
fillInPage.value = true;
reportId.value = record.id;
year.value = record.reportYear;
},
},
{
label: '下载',
name: 'download',
handle: (record: any) => {
},
handle: (record: any) => {},
},
{
label: '删除',
@@ -213,7 +214,7 @@
componentProps: {
valueFormat: 'YYYY',
placeholder: ['报告年度', '报告年度'],
picker:"year"
picker: 'year',
},
},
],
@@ -222,12 +223,10 @@
rowKey: 'id',
});
// 填报页点击返回
const updateData = (newDataOne,newDataTwo) => {
isMainPage.value = newDataOne
fillInPage.value = newDataTwo
const updateData = (newDataOne, newDataTwo) => {
isMainPage.value = newDataOne;
fillInPage.value = newDataTwo;
};
</script>
<style lang="less" scoped>
</style>
<style lang="less" scoped></style>