|
@@ -6,13 +6,13 @@ import { BaseCard, BaseStep, BaseTable, BasePanel, BaseDatePicker } from './inde
|
|
|
import { useTable } from '@/composables/useTable';
|
|
|
import { inputConfig } from './config';
|
|
|
import { inputHasBorderThemeOverrides } from '../tools/resetTheme';
|
|
|
-import VueDatePicker from '@vuepic/vue-datepicker';
|
|
|
-
|
|
|
|
|
|
import { carbonApi } from '@/api/carbon'
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
-const BASE_RULES = { required: true, trigger: ['blur'], type: 'number' };
|
|
|
+const emit = defineEmits(['on-submit']);
|
|
|
+
|
|
|
+const BASE_RULES = { required: true, type: 'number' };
|
|
|
|
|
|
const message = useMessage();
|
|
|
const { addTable, removeTable, tableData } = useTable();
|
|
@@ -21,14 +21,12 @@ const inpConfig = ref(inputConfig);
|
|
|
|
|
|
const spliceInpData = ref([]);
|
|
|
|
|
|
-const datePickerRef = ref(null);
|
|
|
const disabledMonth = ref(null);
|
|
|
|
|
|
const isVisibleDrawer = defineModel();
|
|
|
const formValue = ref({});
|
|
|
const selectCodeSet = ref({});
|
|
|
const selectValue = ref({});
|
|
|
-const checkedTymcValue = ref([]);
|
|
|
|
|
|
const formRef = ref(null);
|
|
|
const switchCo2State = ref(0);
|
|
@@ -36,11 +34,41 @@ const tabCo2Data = ['泵站和沉砂池逸散的CH₄量(实测)', '泵站和沉
|
|
|
|
|
|
const rules = {
|
|
|
provinceId: [
|
|
|
- { required: true, trigger: 'blur', type: 'number' }
|
|
|
+ { required: true, type: 'number' }
|
|
|
],
|
|
|
- addYearMonth: [
|
|
|
- { required: true, trigger: 'blur', type: 'number' }
|
|
|
- ]
|
|
|
+ wsSjclCh4Clsl: [
|
|
|
+ { required: true, type: 'number' }
|
|
|
+ ],
|
|
|
+ wsSjclCh4JsCod: [{ required: true, type: 'number' }],
|
|
|
+ wsSjclCh4CsCod: [{ required: true, type: 'number' }],
|
|
|
+ wsSjclCh4Tsb: [{ required: true, type: 'number' }],
|
|
|
+ wsSjclCh4Csc: [{ required: true, type: 'number' }],
|
|
|
+
|
|
|
+ wsTdN2oClsl: [{ required: true, type: 'number' }],
|
|
|
+ wsTdN2oJsTn: [{ required: true, type: 'number' }],
|
|
|
+ wsTdN2oCsTn: [{ required: true, type: 'number' }],
|
|
|
+
|
|
|
+ nyyjDlxhZhdl: [{ required: true, type: 'number' }],
|
|
|
+ nyyjDlxhJsbf: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhGfjf: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhTsjf: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhXdj: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhSdcl: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhWncz: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhShq: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+ nyyjDlxhQt: [{validator: (_, val) => (( formValue.value.nyyjDlxhZhdl && !val ) ? new Error() : true)}],
|
|
|
+
|
|
|
+ wnclYyzqZqcl: [{validator: (_, val) => (formValue.value.wnclYyzqChZlfs && !val ? new Error() : true)}],
|
|
|
+ wnclYyzqChZlfs: [{validator: (_, val) => (formValue.value.wnclYyzqZqcl && !val ? new Error() : true)}],
|
|
|
+
|
|
|
+ wnclDdclZycll: [{ required: true, type: 'number' }],
|
|
|
+ wnclDdclClqnd: [{ required: true, type: 'number' }],
|
|
|
+ wnclDdclClhnd: [{ required: true, type: 'number' }],
|
|
|
+
|
|
|
+
|
|
|
+ wnclWnrjByhXhl: [{validator: (_, val) => (formValue.value.wnclWnrjByhHtbl && !val ? new Error() : true)}],
|
|
|
+ wnclWnrjByhHtbl: [{validator: (_, val) => (formValue.value.wnclWnrjByhXhl && !val ? new Error() : true)}],
|
|
|
+
|
|
|
}
|
|
|
|
|
|
const switchTabs = (index) => {
|
|
@@ -63,7 +91,7 @@ const handleAddTableRow = (key) => {
|
|
|
|
|
|
if (key === 'sewageCo2First') {
|
|
|
|
|
|
- const ids = [135]; // 复合碳源
|
|
|
+ const ids = [135];
|
|
|
|
|
|
if (!selectValue.value.tymc) {
|
|
|
return message.warning("请先选择碳源名称");
|
|
@@ -145,7 +173,6 @@ const handleAddTableRow = (key) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (key === 'carbonFirst') {
|
|
|
|
|
|
if (!selectValue.value.gyittOne) {
|
|
@@ -170,7 +197,6 @@ const handleAddTableRow = (key) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (key === 'carbonThird') {
|
|
|
|
|
|
if (!selectValue.value.gyittTwo) {
|
|
@@ -197,7 +223,6 @@ const handleAddTableRow = (key) => {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (key === 'carbonFourth') {
|
|
|
|
|
|
if (!selectValue.value.gyittThree) {
|
|
@@ -210,7 +235,7 @@ const handleAddTableRow = (key) => {
|
|
|
});
|
|
|
|
|
|
option = {
|
|
|
- columns: ['燃料名称', '污泥焚烧或热解的电力利用量', '污泥焚烧或热解热能利用量', '沼气提纯并网的天然气量', '操作'],
|
|
|
+ columns: ['燃料名称', '污泥焚烧或热解电力利用量', '污泥焚烧或热解热能利用量', '沼气提纯并网的天然气量', '操作'],
|
|
|
data: [
|
|
|
{ type: 'name', value: codeSet.dictLabel },
|
|
|
{ type: 'input', value: null, unit: 'kW·h/月' },
|
|
@@ -223,7 +248,9 @@ const handleAddTableRow = (key) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- addTable(key, option);
|
|
|
+ tableData.value[key].isEmpty = false;
|
|
|
+
|
|
|
+ addTable(key, option);
|
|
|
}
|
|
|
|
|
|
// 格式化时间
|
|
@@ -267,16 +294,83 @@ const formatData = () => {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+const validateTableData = () => {
|
|
|
+ let result = true;
|
|
|
+ const whiteList = ['sewageCo2First', 'energySecond', 'carbonFirst', 'carbonThird', 'carbonFourth'];
|
|
|
+ const otherWhiteList = ['energyFirst', 'energySecond',];
|
|
|
+ const onlyWhiteList = ['mudFirst', 'mudSecond', 'carbonSecond',];
|
|
|
+ const tableInnerInpWhiteList = ['sewageCo2First', 'energyFirst', 'energySecond', 'carbonFirst', 'carbonThird', 'carbonFourth']
|
|
|
+
|
|
|
+ Object.keys(tableData.value).forEach(key => {
|
|
|
+ const item = tableData.value[key];
|
|
|
+ console.log( "上", item );
|
|
|
+ if ( !item.length && whiteList.includes(key)) {
|
|
|
+ console.log(item);
|
|
|
+ item.isEmpty = true;
|
|
|
+ result = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( item.length && tableInnerInpWhiteList.includes(key) ) {
|
|
|
+
|
|
|
+ item.forEach(item => {
|
|
|
+ item.data.forEach((child) => {
|
|
|
+ if ( (child.type === 'input' || child.type === 'select') && !child.value && child.value !== 0 ) {
|
|
|
+ child.isEmpty = true;
|
|
|
+ result = false
|
|
|
+ } else {
|
|
|
+ child.isEmpty = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( item.length && otherWhiteList.includes(key) ) {
|
|
|
+ item.forEach(item => {
|
|
|
+ item.data.forEach(child => {
|
|
|
+ if ( child.type === 'input' && !child.value && child.value !== 0 ) {
|
|
|
+ child.isEmpty = true;
|
|
|
+ result = false
|
|
|
+ } else {
|
|
|
+ child.isEmpty = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( onlyWhiteList.includes(key) ) {
|
|
|
+ const { data } = tableData.value[key][0];
|
|
|
+ const isExists = data.filter(({ value }) => value || value === 0).length;
|
|
|
+ if ( isExists && isExists < data.length) {
|
|
|
+ data.forEach(child => {
|
|
|
+ if ( (child.type === 'input' || child.type === 'select') && !child.value && child.value !== 0 ) {
|
|
|
+ child.isEmpty = true;
|
|
|
+ result = false
|
|
|
+ } else {
|
|
|
+ child.isEmpty = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ data.forEach(child => child.isEmpty = false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
const onSubmit = ( e ) => {
|
|
|
e.preventDefault();
|
|
|
+ const isVerifying = !validateTableData();
|
|
|
formRef.value?.validate( async (errors) => {
|
|
|
- const params = formatData();
|
|
|
-
|
|
|
- const data = await carbonApi.postCarbonSmart(params);
|
|
|
- console.log( data );
|
|
|
- message.success("提交成功");
|
|
|
if (!errors) {
|
|
|
- console.log("验证成功");
|
|
|
+ if ( isVerifying ) {
|
|
|
+ return message.error("提交失败, 请检查");
|
|
|
+ }
|
|
|
+ const params = formatData();
|
|
|
+ await carbonApi.postCarbonSmart(params);
|
|
|
+ message.error("提供成功");
|
|
|
+ emit(['on-submit']);
|
|
|
} else {
|
|
|
message.error("提交失败, 请检查");
|
|
|
}
|
|
@@ -299,6 +393,7 @@ const getAllCodeSet = async () => {
|
|
|
yjmcOptions,
|
|
|
gyittOptions,
|
|
|
fireOptions: [
|
|
|
+ { label: '选择', value: "" },
|
|
|
{ label: '半连续-加煤机', value: 0 },
|
|
|
{ label: '半连续-流化床', value: 1 },
|
|
|
{ label: '间歇性-加煤机', value: 2 },
|
|
@@ -306,11 +401,13 @@ const getAllCodeSet = async () => {
|
|
|
{ label: '连续燃烧', value: 4 }
|
|
|
],
|
|
|
reactOptions: [
|
|
|
+ { label: '选择', value: "" },
|
|
|
{ label: '竖井类型', value: 0 },
|
|
|
{ label: '流化床式', value: 1 },
|
|
|
{ label: '回转窑式', value: 2 }
|
|
|
],
|
|
|
scgmOptions: [
|
|
|
+ { label: '选择', value: "" },
|
|
|
{ label: '小型', value: 0 },
|
|
|
{ label: '中型', value: 1 },
|
|
|
{ label: '大型', value: 2 }
|
|
@@ -323,24 +420,10 @@ onMounted(async () => {
|
|
|
getAllCodeSet();
|
|
|
})
|
|
|
|
|
|
-const closeDatePicker = (test) => {
|
|
|
- formValue.value.time = test
|
|
|
- console.log(test);
|
|
|
- console.log(dayjs(test).format('YYYY-MM'));
|
|
|
- // console.log( datePickerRef.value, datePickerRef.value.closeMenu );
|
|
|
- datePickerRef.value.closeMenu();
|
|
|
-}
|
|
|
-
|
|
|
const dateDisabled = (ts) => {
|
|
|
return disabledMonth.value.includes(dayjs(ts).format('YYYY-MM'));
|
|
|
}
|
|
|
|
|
|
-const onAfterdEnter = async () => {
|
|
|
- return
|
|
|
- const { data: month } = await carbonApi.getAllMonth();
|
|
|
- disabledMonth.value = month;
|
|
|
- // disabledMonth.value = month.map(m => dayjs(m, 'YYYY-MM'));
|
|
|
-}
|
|
|
onMounted(async () => {
|
|
|
const { data: month } = await carbonApi.getAllMonth();
|
|
|
disabledMonth.value = month;
|
|
@@ -350,7 +433,7 @@ onMounted(async () => {
|
|
|
|
|
|
<template>
|
|
|
<NDrawer class="drawer-wrapper" placement="right" :width="1220" :close-on-esc="false" v-model:show="isVisibleDrawer"
|
|
|
- :on-after-enter="onAfterdEnter" :auto-focus="false">
|
|
|
+ :auto-focus="false" :mask-closable="false" :block-scroll="false">
|
|
|
<n-drawer-content closable title="新建核算" header-class="drawer-header" body-content-class="drawer-body"
|
|
|
footer-class="drawer-footer">
|
|
|
|
|
@@ -361,13 +444,13 @@ onMounted(async () => {
|
|
|
<BaseStep></BaseStep>
|
|
|
</BaseCard>
|
|
|
|
|
|
- <NForm class="space-y-[12px] from-wrapper" ref="formRef" :model="formValue" :show-feedback="false">
|
|
|
+ <NForm class="space-y-[12px] from-wrapper" ref="formRef" :model="formValue" :show-feedback="false" :rules="rules">
|
|
|
<BaseCard title="基础信息" sub-title="碳排放管理基础信息填写">
|
|
|
<div class="flex space-x-[24px]">
|
|
|
|
|
|
- <NFormItem label="省/直辖市" path="provinceId" label-placement="left" class="w-[343px]" :rule="BASE_RULES">
|
|
|
+ <NFormItem label="省/直辖市" path="provinceId" label-placement="left" class="w-[343px]">
|
|
|
<NSelect v-model:value="formValue.provinceId" :options="selectCodeSet.areaOptions"
|
|
|
- value-field="dictCode" label-field="dictLabel" />
|
|
|
+ value-field="dictCode" label-field="dictLabel" :rule="BASE_RULES"/>
|
|
|
</NFormItem>
|
|
|
|
|
|
<NFormItem label="核算时间" path="addYearMonth" label-placement="left" class="w-[343px]" :rule="BASE_RULES">
|
|
@@ -380,14 +463,14 @@ onMounted(async () => {
|
|
|
</BaseCard>
|
|
|
|
|
|
<BaseCard title="污水处理" sub-title="生化碳排">
|
|
|
- <BasePanel isXScroll title="化石源碳矿化产生的碳排放量">
|
|
|
+ <BasePanel isXScroll required title="化石源碳矿化产生的碳排放量">
|
|
|
<NFormItem label-placement="top" :label="item.label" :path="item.key"
|
|
|
v-for="item, index in inpConfig.sewage.oneBlock" :key="index" :rule="BASE_RULES">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
|
|
|
|
- <BasePanel title="外加碳源矿化产生的化石源CO₂碳排放量">
|
|
|
+ <BasePanel required title="外加碳源矿化产生的化石源CO₂碳排放量">
|
|
|
<template #side>
|
|
|
<div class="flex items-center space-x-[14px]">
|
|
|
<NSelect v-model:value="selectValue.tymc" :options="selectCodeSet.tymcOptions" class="w-[200px]"
|
|
@@ -403,7 +486,7 @@ onMounted(async () => {
|
|
|
@on-remove="(name, index) => removeTable(name, index)"></BaseTable>
|
|
|
</BasePanel>
|
|
|
|
|
|
- <BasePanel isXScroll title="污水收集提升和处理阶段排放的CH₄的CO₂当量">
|
|
|
+ <BasePanel isXScroll required title="污水收集提升和处理阶段排放的CH₄的CO₂当量">
|
|
|
<template #side>
|
|
|
<ul class="tabs space-x-[12px]">
|
|
|
<li v-for="item, index in tabCo2Data"
|
|
@@ -412,28 +495,28 @@ onMounted(async () => {
|
|
|
</ul>
|
|
|
</template>
|
|
|
<NFormItem label-placement="top" :label="item.label" :path="item.key"
|
|
|
- v-for="item, index in inpConfig.sewage.twoBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.sewage.twoBlock" :key="index">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
|
|
|
|
- <BasePanel isXScroll title="污水生物处理脱氮过程排放的N₂O的CO₂当量">
|
|
|
+ <BasePanel isXScroll required title="污水生物处理脱氮过程排放的N₂O的CO₂当量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.sewage.threeBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.sewage.threeBlock" :key="index">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
|
</BaseCard>
|
|
|
|
|
|
<BaseCard title="能源、药剂碳排" sub-title="生化反应碳排">
|
|
|
- <BasePanel isXScroll title="污水厂电力消耗产生的碳排放量">
|
|
|
+ <BasePanel isXScroll required title="污水厂电力消耗产生的碳排放量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.energy.oneBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.energy.oneBlock" :key="index">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
|
|
|
|
- <BasePanel isXScroll title="净购入热力消耗产生的碳排放量">
|
|
|
+ <BasePanel isXScroll required title="净购入热力消耗产生的碳排放量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
v-for="item, index in inpConfig.energy.twoBlock" :key="index" :rule="BASE_RULES">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
@@ -456,7 +539,7 @@ onMounted(async () => {
|
|
|
</BaseTable>
|
|
|
</BasePanel>
|
|
|
|
|
|
- <BasePanel title="污水处理阶段药剂消耗产生的碳排放量">
|
|
|
+ <BasePanel required title="污水处理阶段药剂消耗产生的碳排放量">
|
|
|
<template #side>
|
|
|
<div class="flex items-center space-x-[14px]">
|
|
|
<NSelect v-model:value="selectValue.yjmc" :options="selectCodeSet.yjmcOptions" class="w-[200px]"
|
|
@@ -476,14 +559,14 @@ onMounted(async () => {
|
|
|
<BaseCard title="污泥处理" sub-title="生化反应碳排">
|
|
|
<BasePanel isXScroll title="污泥厌氧消化沼气收集管路无意泄露的CH₄或沼气火炬燃烧不充分导致的碳排放">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.sludge.oneBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.sludge.oneBlock" :key="index" required>
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
|
|
|
|
<BasePanel isXScroll title="单独处理污泥厌氧消化过程产生的碳排放量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.sludge.twoBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.sludge.twoBlock" :key="index">
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
@@ -509,7 +592,7 @@ onMounted(async () => {
|
|
|
|
|
|
<BasePanel isXScroll title="污泥热解碳化或气化过程化石源CO₂碳排放量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.sludge.fiveBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.sludge.fiveBlock" :key="index" required>
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
@@ -540,7 +623,7 @@ onMounted(async () => {
|
|
|
|
|
|
<BasePanel isXScroll title="光伏-替碳量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.carbon.oneBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.carbon.oneBlock" :key="index" required>
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
@@ -585,7 +668,7 @@ onMounted(async () => {
|
|
|
|
|
|
<BasePanel isXScroll title="污泥经过厌氧、好氧或碳化处理后,产生的替碳量">
|
|
|
<NFormItem label-placement="top" :path="item.key" :label="item.label"
|
|
|
- v-for="item, index in inpConfig.carbon.twoBlock" :key="index" :rule="BASE_RULES">
|
|
|
+ v-for="item, index in inpConfig.carbon.twoBlock" :key="index" required>
|
|
|
<BaseNumberInput :unit="item.unit" v-model:value="formValue[item.key]"></BaseNumberInput>
|
|
|
</NFormItem>
|
|
|
</BasePanel>
|
|
@@ -596,7 +679,7 @@ onMounted(async () => {
|
|
|
<template #footer>
|
|
|
<div class="w-full space-x-[8px] flex justify-center">
|
|
|
<button class="btn btn_primary" @click="onSubmit">提交并核算</button>
|
|
|
- <button class="btn btn_default">暂存</button>
|
|
|
+ <!-- <button class="btn btn_default">暂存</button> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
</n-drawer-content>
|