Commit 5a10b476 authored by 每天都要敲代码's avatar 每天都要敲代码

瞬时热量接口调用完成

parent 21138bfa
......@@ -23,12 +23,12 @@ const count = 100
for (let i = 0; i < count; i++) {
List.push(
Mock.mock({
id: "@increment()",
'name|1': Mock.mock(['东部供热站', '行政区供热站', '福宛里供热站']),
'type|1-4': 1,
'type|1': Mock.mock(['热', '光', '电','机械']),
'used|100-3000': 1,
date: Mock.mock('@date("yyyy/MM/dd")') + ' 0:00:00'
allowPagingId: "@increment()",
'supplyName|1': Mock.mock(['东部供热站', '行政区供热站', '福宛里供热站']),
'energyType|1-4': 1,
'energyType|1': Mock.mock(['热', '光', '电','机械']),
'record|100-3000': 1,
recordDate: Mock.mock('@date("yyyy/MM/dd")') + ' 0:00:00'
})
)
}
......@@ -43,11 +43,11 @@ export default {
*/
getEnergyList: config => {
//limit默认是10,因为分页器默认也是一页10个
const { name, page = 1, limit = 10 } = param2Obj(config.url)
const { supplyName, page = 1, limit = 10 } = param2Obj(config.url)
const mockList = List.filter(energy => {
//如果name存在会,根据name筛选数据
if (name && energy.name.indexOf(name) === -1) return false
if (supplyName && energy.supplyName.indexOf(supplyName) === -1) return false
return true
})
//分页
......@@ -66,17 +66,17 @@ export default {
* @return {*}
*/
deleteEnergy: config => {
const { id } = param2Obj(config.url)
const { allowPagingId} = param2Obj(config.url)
// console.log("前端传来的id:"+id);
if (!id) {
if (!allowPagingId) {
return {
code: -999,
message: '参数不正确'
}
} else {
List = List.filter(item => item.id != id)
List = List.filter(item => item.allowPagingId != allowPagingId)
console.log(List);
return {
code: 200,
......@@ -91,14 +91,14 @@ export default {
* @return {{code: number, data: {message: string}}}
*/
createEnery: config => {
const { name, type, used, date } = JSON.parse(config.body)
const { supplyName, energyType, record, recordDate } = JSON.parse(config.body)
List.unshift({
id:Mock.mock('@increment()'),
name:name,
type:type,
used:used,
date:date
allowPagingId:Mock.mock('@increment()'),
supplyName:supplyName,
energyType:energyType,
record:record,
recordDate:recordDate
})
return {
code: 200,
......@@ -109,14 +109,14 @@ export default {
},
updateEnergy: config => {
const { id, name, type, used, date } = JSON.parse(config.body)
const type_num = parseInt(type)
const { allowPagingId, supplyName, energyType, record, recordDate } = JSON.parse(config.body)
const energyType_num = parseInt(energyType)
List.some(e => {
if (e.id === id) {
e.name = name
e.type = type
e.used = used
e.date = date
if (e.allowPagingId === allowPagingId) {
e.supplyName = supplyName
e.energyType = energyType
e.record = record
e.recordDate = recordDate
return true
}
})
......
import http from './http'
//能源消耗
export const postEnergyManage = params => {
return http.post(`/api/manage/sheduling/EnergyManage`, params).then(res => res).catch(function (error) {
return http.post(`/api/energy/getData`, params).then(res => res).catch(function (error) {
console.log(error);
})
}
// 瞬时热量-获取列表
export const postInstantHeat = params => {
return http.post(`api/Scheduling/BizInstantaneousHeat/Get`).then(res => res).catch(function (error) {
console.log(error);
})
}
// 瞬时热量-新增修改
export const postInstantHeatUpdate = params => {
return http.post(`api/Scheduling/BizInstantaneousHeat/Update`).then(res => res).catch(function (error) {
console.log(error);
})
}
export const postSecAbsTUc = params => {
return http.post(`/api/analysis/external/SecAbsTUc`, params).then(res => res).catch(function (error) {
console.log(error);
})
}
export const postEnergyManageSave = params => {
return http.post(`/api/energy/Save`, params).then(res => res).catch(function (error) {
console.log(error);
})
}
......@@ -23,8 +23,8 @@ import http from './api/http'
import store from './store'
import $ from 'jquery'
// import {WebControl} from '@/assets/script/video/web-control.esm.min.js'
import "@/api/mock.js"
import api from '@/api/api'
// import "@/api/mock.js"
// import api from '@/api/api'
const app = createApp(App)
......@@ -36,7 +36,7 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component('Notification', Notification)
app.config.globalProperties.http = http;
app.config.globalProperties.$api = api;
// app.config.globalProperties.$api = api;
//将element-plus注册成全局可用组件库
app.use(store)
.use(ElementPlus)
......
......@@ -218,7 +218,7 @@
justify-content: center;
}
.span-text {}
// .span-text {}
</style>
<script setup>
......
......@@ -2,23 +2,21 @@
<div class="contentBlock">
<div class="contentBlockInn">
<el-card class="card-contianer">
<div class="card-header">
<span>瞬时热量对比配置</span>
</div>
<div class="card-header">
<span>瞬时热量对比配置</span>
</div>
<el-form ref="formRef" :data="formData" :model="formModel" label-width="auto">
<table cellpadding="0" cellspacing="1" >
<table cellpadding="0" cellspacing="1">
<tr>
<th style="width: 25%">计划名称:</th>
<td style="width: 60%; margin:0; padding: 0">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<el-input style="width: 80%" v-model="formModel.planName"></el-input>
<el-input style="width: 80%" v-model="List.planName"></el-input>
</td>
</tr>
</table>
</td>
</tr>
......@@ -28,12 +26,11 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<el-input style="width: 80%" v-model="formModel.diffPercentage"></el-input>
<el-input style="width: 80%" v-model="List.diffPercentage"></el-input>
</td>
</tr>
</table>
</td>
</tr>
......@@ -43,16 +40,11 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<el-form>
<el-input style="width: 80%" v-model="formModel.timeoutMin"></el-input>
</el-form>
<el-input style="width: 80%" v-model="List.timeoutMin"></el-input>
</td>
</tr>
</table>
</td>
</tr>
......@@ -62,12 +54,11 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<el-input style="width: 80%" v-model="formModel.tempRegulation"></el-input>
<el-input style="width: 80%" v-model="List.tempRegulation"></el-input>
</td>
</tr>
</table>
</td>
</tr>
......@@ -77,9 +68,9 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left">
<el-input style="width: 80%" type="textarea" rows="6" v-model="formModel.description"></el-input>
<el-input style="width: 80%" type="textarea" rows="6"
v-model="List.description"></el-input>
</td>
</tr>
</table>
</td>
......@@ -88,10 +79,9 @@
</table>
<div class="btngrounp">
<el-button type="primary">保存</el-button>
<el-button type="primary" style="margin: 0 0 0 5px">关闭</el-button>
<el-button type="primary" @click="onSave">保存</el-button>
<el-button type="primary" style="margin: 0 0 0 5px" @click="onCancel">关闭</el-button>
</div>
</el-form>
</el-card>
</div>
......@@ -100,28 +90,59 @@
</template>
<script setup>
import { ref, reactive, onMounted, onUnmounted } from "vue";
const formModel = reactive({
planId: '',
planName: '瞬时热量偏差',
diffPercentage: '10',
timeoutMin: '10',
tempRegulation: '1',
description: '"预测瞬时热量"与集团"瞬时热量"进行对比,偏差10%(可变),超过10分钟(可变),对下发温度进行+-温度调节(温度可调)'
})
import { postInstantHeat,postInstantHeatUpdate} from "@/api/scheduling"
import { toRaw } from "@vue/reactivity";
import { ElMessage } from "element-plus";
import http from "../../api/http";
const loading = ref(false)
const List=ref([
{
"planId": "",
"planName":"",
"diffPercentage":"",
"timeoutMin":"",
"tempRegulation":"",
"description":"",
"isActive":''
}
])
const getInstanceHeat = async () => {
loading.value = true
const data = await postInstantHeat();
console.log(data);
List.value = data.data[0]
loading.value = false
}
const onSave = async() => {
// await postInstantHeatUpdate(List.value)
// ElMessage.success('修改成功')
http.post("/api/Scheduling/BizInstantaneousHeat/Update",{...List.value},false).then((result)=>{
}).catch((error)=>{
console.log(error)
})
getInstanceHeat()
}
onMounted(() => {
getInstanceHeat()
})
</script>
<style lang="less" scoped>
.card-contianer {
background-color: #DFE8F6;
background-color: #DFE8F6;
}
.card-header {
text-align: center;
font-weight: 700;
font-size: 28px;
margin-bottom:10px;
margin-bottom: 10px;
}
.btngrounp {
margin-top: 10px;
text-align: center;
......@@ -140,7 +161,7 @@ td {
font-size: 14px;
margin: 0;
padding: 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment