规范代码
This commit is contained in:
@@ -230,10 +230,21 @@
|
|||||||
import { log } from 'node:console';
|
import { log } from 'node:console';
|
||||||
|
|
||||||
defineOptions({ name: 'OrderListIndex' });
|
defineOptions({ name: 'OrderListIndex' });
|
||||||
|
const orgId = ref('');
|
||||||
|
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||||
|
orgId.value = result;
|
||||||
|
const dynamicDisabled = computed(() => {
|
||||||
|
return formRef.value?.validateResult && userAuthList.value?.length;
|
||||||
|
});
|
||||||
|
const fetch = (api, params = { orgId }) => {
|
||||||
|
return http.post(api, params);
|
||||||
|
};
|
||||||
const selectTreeDataValue = ref<string>('');
|
const selectTreeDataValue = ref<string>('');
|
||||||
const mainRef = ref();
|
const mainRef = ref();
|
||||||
const data = reactive({});
|
const data = reactive({});
|
||||||
let formData = ref({});
|
let formData = ref({
|
||||||
|
orgId: orgId.value,
|
||||||
|
});
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const unitManagement = ref(false);
|
const unitManagement = ref(false);
|
||||||
@@ -256,15 +267,6 @@
|
|||||||
const casData = ref([]);
|
const casData = ref([]);
|
||||||
const treeData = ref([]);
|
const treeData = ref([]);
|
||||||
const userAuthList = ref([]);
|
const userAuthList = ref([]);
|
||||||
const orgId = ref('');
|
|
||||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
|
||||||
orgId.value = result;
|
|
||||||
const dynamicDisabled = computed(() => {
|
|
||||||
return formRef.value?.validateResult && userAuthList.value?.length;
|
|
||||||
});
|
|
||||||
const fetch = (api, params = { orgId }) => {
|
|
||||||
return http.post(api, params);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 树结构
|
// 树结构
|
||||||
const x = 3;
|
const x = 3;
|
||||||
@@ -476,8 +478,8 @@
|
|||||||
treeNodeAdd.value = false;
|
treeNodeAdd.value = false;
|
||||||
};
|
};
|
||||||
// 获取排放分类树
|
// 获取排放分类树
|
||||||
const getOrgTree = (params?) => {
|
const getOrgTree = () => {
|
||||||
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, params).then((res) => {
|
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, { orgId: orgId.value }).then((res) => {
|
||||||
gData.value = res.data;
|
gData.value = res.data;
|
||||||
// 找到匹配的节点数据
|
// 找到匹配的节点数据
|
||||||
// const selectedNodes = [];
|
// const selectedNodes = [];
|
||||||
|
@@ -165,19 +165,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref,reactive, toRaw } from 'vue';
|
import { ref, toRaw } from 'vue';
|
||||||
import type { UnwrapRef } from 'vue';
|
|
||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
import { Pagination,message,Modal } from 'ant-design-vue';
|
import { Pagination,message,Modal } from 'ant-design-vue';
|
||||||
import { InboxOutlined } from '@ant-design/icons-vue';
|
import type { TreeSelectProps,UploadChangeParam } from 'ant-design-vue';
|
||||||
import type { CascaderProps,TreeSelectProps,UploadChangeParam } from 'ant-design-vue';
|
|
||||||
import { NsMessage } from '/nerv-lib/component';
|
import { NsMessage } from '/nerv-lib/component';
|
||||||
import dayjs, { Dayjs } from 'dayjs';
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { tableColumns } from '../config';
|
import { tableColumns } from '../config';
|
||||||
import { energyConsumption,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
import { energyConsumption,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
|
||||||
import { group } from '/@/api/deviceManage';
|
import { group } from '/@/api/deviceManage';
|
||||||
import { dict } from '/@/api';
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
energyType: 'EnergyConsumption', // 与页面路由name一致缓存才可生效
|
energyType: 'EnergyConsumption', // 与页面路由name一致缓存才可生效
|
||||||
components: {
|
components: {
|
||||||
|
@@ -138,6 +138,7 @@
|
|||||||
quickCalculation,
|
quickCalculation,
|
||||||
carbonEmissionFactorLibrary,
|
carbonEmissionFactorLibrary,
|
||||||
} from '/@/api/carbonEmissionFactorLibrary';
|
} from '/@/api/carbonEmissionFactorLibrary';
|
||||||
|
import { or } from '@vueuse/core';
|
||||||
defineOptions({
|
defineOptions({
|
||||||
energyType: 'quickCalculation', // 与页面路由name一致缓存才可生效
|
energyType: 'quickCalculation', // 与页面路由name一致缓存才可生效
|
||||||
components: {
|
components: {
|
||||||
@@ -249,7 +250,7 @@
|
|||||||
const statsId = ref();
|
const statsId = ref();
|
||||||
// 获取因子分类树数据
|
// 获取因子分类树数据
|
||||||
const getTreeData = () => {
|
const getTreeData = () => {
|
||||||
fetch(quickCalculation.carbonQuickTree).then((res) => {
|
fetch(quickCalculation.carbonQuickTree, { orgId: orgId.value }).then((res) => {
|
||||||
gData.value = res.data;
|
gData.value = res.data;
|
||||||
energyType.value = gData.value[0].children[0].id;
|
energyType.value = gData.value[0].children[0].id;
|
||||||
statsId.value = gData.value[0].children[0].id;
|
statsId.value = gData.value[0].children[0].id;
|
||||||
@@ -366,7 +367,9 @@
|
|||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const labelCol = { span: 6 };
|
const labelCol = { span: 6 };
|
||||||
const wrapperCol = { span: 18 };
|
const wrapperCol = { span: 18 };
|
||||||
const formState = ref({});
|
const formState = ref({
|
||||||
|
orgId: orgId.value,
|
||||||
|
});
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|
||||||
// 定义form表单的必填
|
// 定义form表单的必填
|
||||||
|
@@ -340,7 +340,7 @@
|
|||||||
import { ref, watch, toRaw, defineEmits } from 'vue';
|
import { ref, watch, toRaw, defineEmits } from 'vue';
|
||||||
import { http } from '/nerv-lib/util/http';
|
import { http } from '/nerv-lib/util/http';
|
||||||
import { Pagination, Modal, message } from 'ant-design-vue';
|
import { Pagination, Modal, message } from 'ant-design-vue';
|
||||||
import type { TreeProps, TableColumnsType, UploadChangeParam } from 'ant-design-vue';
|
import type { TreeProps, UploadChangeParam } from 'ant-design-vue';
|
||||||
import {
|
import {
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
PlusCircleOutlined,
|
PlusCircleOutlined,
|
||||||
|
@@ -20,8 +20,7 @@
|
|||||||
:model="formState"
|
:model="formState"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:label-col="labelCol"
|
:label-col="labelCol"
|
||||||
:wrapper-col="wrapperCol"
|
:wrapper-col="wrapperCol">
|
||||||
>
|
|
||||||
<a-form-item ref="name" label="报告名称" name="reportName">
|
<a-form-item ref="name" label="报告名称" name="reportName">
|
||||||
<a-input v-model:value="formState.reportName" placeholder="请输入报告名称" />
|
<a-input v-model:value="formState.reportName" placeholder="请输入报告名称" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -38,7 +37,10 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item ref="name" label="报告范围" name="reportScope">
|
<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-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
const fillInPage = ref(false);
|
const fillInPage = ref(false);
|
||||||
// 新增相关数据
|
// 新增相关数据
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const formState = ref({})
|
const formState = ref({});
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const labelCol = { span: 5 };
|
const labelCol = { span: 5 };
|
||||||
const wrapperCol = { span: 19 };
|
const wrapperCol = { span: 19 };
|
||||||
@@ -80,7 +82,7 @@
|
|||||||
// 关闭新增抽屉
|
// 关闭新增抽屉
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
formState.value = {}
|
formState.value = {};
|
||||||
formRef.value.resetFields();
|
formRef.value.resetFields();
|
||||||
};
|
};
|
||||||
// 点击确定提交
|
// 点击确定提交
|
||||||
@@ -89,15 +91,15 @@
|
|||||||
.validate()
|
.validate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('values', formState, toRaw(formState));
|
console.log('values', formState, toRaw(formState));
|
||||||
formState.value.enterpriseOrgId = orgId.value
|
formState.value.enterpriseOrgId = orgId.value;
|
||||||
formState.value.startTime = formState.value.reportScope[0]
|
formState.value.startTime = formState.value.reportScope[0];
|
||||||
formState.value.endTime = formState.value.reportScope[1]
|
formState.value.endTime = formState.value.reportScope[1];
|
||||||
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
|
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
|
||||||
visible.value = false
|
visible.value = false;
|
||||||
mainRef.value?.nsTableRef.reload();
|
mainRef.value?.nsTableRef.reload();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
console.log('error', error);
|
console.log('error', error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -110,7 +112,7 @@
|
|||||||
title: '数据库',
|
title: '数据库',
|
||||||
api: carbonInventoryCheck.carbonInventoryList,
|
api: carbonInventoryCheck.carbonInventoryList,
|
||||||
params: {
|
params: {
|
||||||
orgId
|
orgId,
|
||||||
},
|
},
|
||||||
headerActions: [
|
headerActions: [
|
||||||
{
|
{
|
||||||
@@ -118,7 +120,7 @@
|
|||||||
name: 'userAdd',
|
name: 'userAdd',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
handle: () => {
|
handle: () => {
|
||||||
visible.value = true
|
visible.value = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -161,10 +163,10 @@
|
|||||||
label: '编辑',
|
label: '编辑',
|
||||||
name: 'userEdit',
|
name: 'userEdit',
|
||||||
handle: (record: any) => {
|
handle: (record: any) => {
|
||||||
visible.value = true
|
visible.value = true;
|
||||||
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
|
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
|
||||||
formState.value = res.data
|
formState.value = res.data;
|
||||||
formState.value.reportScope = [res.data.startTime,res.data.endTime]
|
formState.value.reportScope = [res.data.startTime, res.data.endTime];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -172,17 +174,16 @@
|
|||||||
label: '填报',
|
label: '填报',
|
||||||
name: 'fillIn',
|
name: 'fillIn',
|
||||||
handle: (record: any) => {
|
handle: (record: any) => {
|
||||||
isMainPage.value = false
|
isMainPage.value = false;
|
||||||
fillInPage.value = true
|
fillInPage.value = true;
|
||||||
reportId.value = record.id
|
reportId.value = record.id;
|
||||||
year.value = record.reportYear
|
year.value = record.reportYear;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '下载',
|
label: '下载',
|
||||||
name: 'download',
|
name: 'download',
|
||||||
handle: (record: any) => {
|
handle: (record: any) => {},
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '删除',
|
label: '删除',
|
||||||
@@ -213,7 +214,7 @@
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
valueFormat: 'YYYY',
|
valueFormat: 'YYYY',
|
||||||
placeholder: ['报告年度', '报告年度'],
|
placeholder: ['报告年度', '报告年度'],
|
||||||
picker:"year"
|
picker: 'year',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -223,11 +224,9 @@
|
|||||||
});
|
});
|
||||||
// 填报页点击返回
|
// 填报页点击返回
|
||||||
const updateData = (newDataOne, newDataTwo) => {
|
const updateData = (newDataOne, newDataTwo) => {
|
||||||
isMainPage.value = newDataOne
|
isMainPage.value = newDataOne;
|
||||||
fillInPage.value = newDataTwo
|
fillInPage.value = newDataTwo;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
Reference in New Issue
Block a user