根据文档优化
This commit is contained in:
@@ -1294,7 +1294,10 @@
|
||||
NsMessage.warn('请选择因子');
|
||||
return;
|
||||
} else {
|
||||
if (newTableData.value[0].emissionFactorUnits === carbonEmission.value) {
|
||||
if (
|
||||
setFactorRef.value?.nsTableRef.tableState.selectedRows.emissionFactorUnits ===
|
||||
carbonEmission.value
|
||||
) {
|
||||
newTableData.value = setFactorRef.value?.nsTableRef.tableState.selectedRows;
|
||||
selectedRowKeysEdit.value = setFactorRef.value?.nsTableRef.tableState.selectedRowKeys;
|
||||
editFormState.value.emissionFactors = newTableData.value[0].emissionFactors;
|
||||
@@ -1906,4 +1909,23 @@
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
:deep(.ns-table-container) {
|
||||
background: white;
|
||||
}
|
||||
:deep(.ns-part-tree) {
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
|
||||
}
|
||||
:deep(.ns-table-search) {
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
|
||||
}
|
||||
:deep(.ns-table-main) {
|
||||
margin-top: 20px !important;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 1);
|
||||
box-shadow: 0px 2px 20px rgb(69 123 234 / 20%);
|
||||
}
|
||||
</style>
|
||||
|
@@ -74,11 +74,12 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, toRaw, watch, nextTick } from 'vue';
|
||||
import { ref, toRaw, watch, nextTick, createVNode, defineComponent } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
|
||||
import fillIn from './fillInPage/index.vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
defineOptions({ name: 'CarbonInventoryCheck' });
|
||||
const orgId = ref('');
|
||||
@@ -145,7 +146,6 @@
|
||||
const spinning = ref(false);
|
||||
// 点击确定提交
|
||||
const onSubmit = () => {
|
||||
spinning.value = true;
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
@@ -153,11 +153,38 @@
|
||||
formState.value.orgId = 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();
|
||||
spinning.value = false;
|
||||
});
|
||||
if (
|
||||
oldStartTime.value === formState.value.startTime &&
|
||||
oldEndTime.value === formState.value.endTime
|
||||
) {
|
||||
spinning.value = true;
|
||||
fetch(carbonInventoryCheck.createOrUpdate, formState.value).then((res) => {
|
||||
visible.value = false;
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
spinning.value = false;
|
||||
});
|
||||
} else {
|
||||
Modal.confirm({
|
||||
title: '修改日期后会导致数据丢失是否保留数据?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
onOk() {
|
||||
spinning.value = true;
|
||||
fetch(carbonInventoryCheck.createOrUpdate, formState.value)
|
||||
.then((res) => {
|
||||
visible.value = false;
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
spinning.value = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
message.error(error ? error : '保存失败!');
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
class: 'test',
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
@@ -171,6 +198,8 @@
|
||||
const endTime = ref();
|
||||
const standard = ref();
|
||||
const year = ref();
|
||||
const oldStartTime = ref();
|
||||
const oldEndTime = ref();
|
||||
const tableConfig = ref({
|
||||
title: '数据库',
|
||||
api: carbonInventoryCheck.carbonInventoryList,
|
||||
@@ -240,6 +269,10 @@
|
||||
fetch(carbonInventoryCheck.findById, { id: record.id }).then((res) => {
|
||||
formState.value = res.data;
|
||||
formState.value.reportScope = [res.data.startTime, res.data.endTime];
|
||||
formState.value.oldStartTime = res.data.startTime;
|
||||
formState.value.oldEndTime = res.data.endTime;
|
||||
oldStartTime.value = res.data.startTime;
|
||||
oldEndTime.value = res.data.endTime;
|
||||
});
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user