温度监测修改上报状态

This commit is contained in:
曹磊 2024-12-11 11:13:29 +08:00
parent 618e68875f
commit b63375f441
2 changed files with 28 additions and 3 deletions

View File

@ -5,6 +5,7 @@ enum Api {
companylist = '/heating/thermalcompany/list',
heatsourcelist = '/heating/heatsource/list',
heatsourcestationlist = '/heating/heatsourcestation/list',
updateType = '/heating/heatanalysis/updateType',
}
/**
@ -22,3 +23,11 @@ export const heatsourcelist = (params) =>
export const heatsourcestationlist = (params) =>
defHttp.get({url: Api.heatsourcestationlist, params});
/**
*
* @param params
*/
export const updateType = (params) => {
return defHttp.post({url: Api.updateType, params});
}

View File

@ -110,8 +110,7 @@
<!--引用表格-->
<BasicTable @register="registerTable" :rowClassName="tableRowClassName">
<template #reportType="{ record }">
<span v-if="record.reportType == 1">上报</span>
<a-tag v-else color="purple">模拟</a-tag>
<a-switch v-model:checked="record.reportType" :checked-value="1" :un-checked-value="2" checked-children="上报" un-checked-children="模拟" @change="editReportType(record)"/>
</template>
<template #isExtract="{ record }">
<a-tag v-if="record.isExtract == 1" color="green" style="cursor:pointer" @click="showExtract(record)"></a-tag>
@ -133,13 +132,16 @@ import {ref, reactive, onMounted} from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './Heatanalysis.data';
import { list, companylist, heatsourcelist, heatsourcestationlist } from './Heatanalysis.api';
import { list, companylist, heatsourcelist, heatsourcestationlist , updateType} from './Heatanalysis.api';
import StationExtractModal from './components/extract/StationExtractModal.vue';
import StationExtractedModal from './components/extracted/StationExtractedModal.vue';
import {saveOrUpdate} from "@/views/heating/heatanalysis/Heatanalysis.api";
import {useMessage} from "@/hooks/web/useMessage";
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerModalExtracted = ref();
const { createMessage } = useMessage();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
@ -184,6 +186,20 @@ function tableRowClassName(record){
return '';
}
function editReportType(record){
console.log(record.reportType);
const model = reactive<Record<string, any>>({
id: record.id,
reportType: record.reportType
})
updateType(model).then((res) => {
if (res.success) {
createMessage.success(res.message);
} else {
createMessage.warning(res.message);
}
})
}
/**
* 成功回调