Commit ce5c1425 authored by xuke's avatar xuke

能源消耗接口-第二次提交

parent 80ee880d
...@@ -6,10 +6,20 @@ export const postEnergyManage = params => { ...@@ -6,10 +6,20 @@ export const postEnergyManage = params => {
}) })
} }
// 能源消耗-删除 // 能源消耗-删除
// export const postEnergyDel = EnergyId => {
// return http.post(`/api/energy/Delete`,{params:{EnergyId}}).then(res => res).catch(function (error) {
// console.log(error);
// })
// }
export const postEnergyDel = params => { export const postEnergyDel = params => {
return http.post('/api/energy/getData', { return http.post(`/api/energy/Delete`, params).then(res => res).catch(function (error) {
params:{params} console.log(error);
}).then(res => res).catch(function (error) { })
}
// 能源消耗-修改
export const postEnergyUpdate = params => {
return http.post(`/api/energy/Save`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
...@@ -24,14 +34,14 @@ export const postInstantHeat = params => { ...@@ -24,14 +34,14 @@ export const postInstantHeat = params => {
// 瞬时热量-新增修改 // 瞬时热量-新增修改
export const postInstantHeatUpdate = params => { export const postInstantHeatUpdate = params => {
return http.post(`api/Scheduling/BizInstantaneousHeat/Update`,params).then(res => res).catch(function (error) { return http.post(`api/Scheduling/BizInstantaneousHeat/Update`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
// 参数设置 // 参数设置
export const postConfigBoilerUpdate = params => { export const postConfigBoilerUpdate = params => {
return http.post(`api/configboiler/Save`,params).then(res => res).catch(function (error) { return http.post(`api/configboiler/Save`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
...@@ -59,11 +69,11 @@ export const alterWeatherMagData = params => { // 添加或修改气象干预数 ...@@ -59,11 +69,11 @@ export const alterWeatherMagData = params => { // 添加或修改气象干预数
return http.post(`/api/cusweather/SaveAll`, params) return http.post(`/api/cusweather/SaveAll`, params)
} }
export const getTransfer = param =>{ // 获取换热站列表 export const getTransfer = param => { // 获取换热站列表
return http.post(`/api/cusweather/getTransferIds?id=${param}`,param) return http.post(`/api/cusweather/getTransferIds?id=${param}`, param)
} }
export const getAnnualParam = ()=>{ // 获取年度参数列表 export const getAnnualParam = () => { // 获取年度参数列表
return http.post('/api/Scheduling/BizHeatSet/Get') return http.post('/api/Scheduling/BizHeatSet/Get')
} }
...@@ -71,16 +81,16 @@ export const alterAnnualParam = params => { // 修改年度参数 ...@@ -71,16 +81,16 @@ export const alterAnnualParam = params => { // 修改年度参数
return http.post('/api/Scheduling/BizHeatSet/Update', params) return http.post('/api/Scheduling/BizHeatSet/Update', params)
} }
export const addAnnualParam = params =>{ // 新增年度参数 export const addAnnualParam = params => { // 新增年度参数
return http.post('/api/Scheduling/BizHeatSet/Add',params) return http.post('/api/Scheduling/BizHeatSet/Add', params)
} }
export const deleteAnnualParam = params =>{ // 删除年度参数 export const deleteAnnualParam = params => { // 删除年度参数
// console.log("地址:",`/api/Scheduling/BizHeatSet/Delete?Id=${params}`) // console.log("地址:",`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
return http.post(`/api/Scheduling/BizHeatSet/Delete?Id=${params}`) return http.post(`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
} }
export const getPhenomenon = ()=>{ // 获取数据列表————天气工况 export const getPhenomenon = () => { // 获取数据列表————天气工况
return http.post('/api/Scheduling/WeatherCondition/Get') return http.post('/api/Scheduling/WeatherCondition/Get')
} }
...@@ -88,6 +98,6 @@ export const alterPhenomenon = params => { // 修改数据————天气工 ...@@ -88,6 +98,6 @@ export const alterPhenomenon = params => { // 修改数据————天气工
return http.post('/api/Scheduling/WeatherCondition/Update', params) return http.post('/api/Scheduling/WeatherCondition/Update', params)
} }
export const deletePhenomenon = params =>{ // 删除数据————天气工况 export const deletePhenomenon = params => { // 删除数据————天气工况
return http.post(`/api/Scheduling/WeatherCondition/Delete?Id=${params}`) return http.post(`/api/Scheduling/WeatherCondition/Delete?Id=${params}`)
} }
...@@ -5,19 +5,12 @@ import axios from 'axios' ...@@ -5,19 +5,12 @@ import axios from 'axios'
import { Search, Document } from "@element-plus/icons-vue" import { Search, Document } from "@element-plus/icons-vue"
import { postEnergyManage, postSecAbsTUc, postEnergyManageSave, postEnergyDel } from "@/api/scheduling" import { postEnergyManage, postSecAbsTUc, postEnergyManageSave, postEnergyDel } from "@/api/scheduling"
import http from '../../api/http' import http from '../../api/http'
// const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const tableData = ref([{}]) const tableData = ref([{}])
const formEnergy = reactive({}) const formEnergy = reactive({})
const energyForm = ref() const energyForm = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const getEnergyData = async () => { const getEnergyData = async () => {
// const data = await proxy.$api.getEnergyData(config)
// const data = await postSecAbsTUc(config)
// console.log(data);
// const data = postEnergyManage(tableData.energyType=["0","1","2","3","4"])
// console.log(data);
// const data = await postEnergyManageSave(formEnergy.value)
await http.post("/api/energy/getData", tableData.energyType = ["0", "1", "2", "3", "4"]).then(res => { await http.post("/api/energy/getData", tableData.energyType = ["0", "1", "2", "3", "4"]).then(res => {
console.log("res:", res); console.log("res:", res);
tableData.value = res.data tableData.value = res.data
...@@ -112,38 +105,42 @@ const handleChange = (page) => { ...@@ -112,38 +105,42 @@ const handleChange = (page) => {
// 删除 // 删除
// const handleDelete = async (row) => { // const handleDelete = async (row) => {
// // console.log(row.energyId); // // console.log(row.energyId);
// // const energyId = row.energyId // console.log('"'+row.energyId+'"');
// await ElMessageBox.confirm("你确定要删除吗?", { // await ElMessageBox.confirm("你确定要删除吗?", {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// cancelButtonText: '取消', // cancelButtonText: '取消',
// type: 'warning', // type: 'warning',
// confirmButtonClass: 'ExitConfirmButton' // confirmButtonClass: 'ExitConfirmButton'
// }) // }).then(async () => {
// // await postEnergyDel('"'+row.energyId+'"')
// await postEnergyDel(row.energyId) // await postEnergyDel({EnergyId:row.energyId})
// ElMessage({ // ElMessage({
// type:'success',message:'删除成功' // type: 'success', message: '删除成功'
// }) // })
// getEnergyData() // getEnergyData()
// })
// } // }
// 删除 // 删除
const handleDelete = async (row) => { // const handleDelete = async (row) => {
await ElMessageBox.confirm("你确定要删除吗?", { // console.log(row.energyId);
confirmButtonText: '确定', // console.log('"' + row.energyId + '"');
cancelButtonText: '取消', // let EnergyId = row.energyId
type: 'warning', // await ElMessageBox.confirm("你确定要删除吗?", {
confirmButtonClass: 'ExitConfirmButton' // confirmButtonText: '确定',
}) // cancelButtonText: '取消',
await http.post("api/energy/Delete", params:{EnergyId:row.energyId}, false).then(res => { // type: 'warning',
console.log(res); // confirmButtonClass: 'ExitConfirmButton'
}).then(res => { // })
ElMessage({ // await http.post("api/energy/Delete?EnergyId="+'"'+row.energyId +'"',false ).then(res => {
type: 'success', message: '删除成功' // console.log(res);
}) // }).then(res => {
getEnergyData() // ElMessage({
}) // type: 'success', message: '删除成功'
} // })
// getEnergyData()
// })
// }
// 新增 // 新增
...@@ -184,8 +181,19 @@ const onSubmit = () => { ...@@ -184,8 +181,19 @@ const onSubmit = () => {
formEnergy.recordDate = /^\d{4}-\d{2}-\d{2}$/.test(formEnergy.recordDate) ? formEnergy.recordDate : timeFormat(formEnergy.recordDate) formEnergy.recordDate = /^\d{4}-\d{2}-\d{2}$/.test(formEnergy.recordDate) ? formEnergy.recordDate : timeFormat(formEnergy.recordDate)
if (action.value === 'add') { if (action.value === 'add') {
// res = await proxy.$api.addEnergy(formEnergy) // res = await proxy.$api.addEnergy(formEnergy)
res = postEnergyManageSave(formEnergy) // res =await postEnergyManageSave(formEnergy.value)
// console.log(res);
await http.post("api/energy/Save",formEnergy.value , false).then(res => {
console.log(res); console.log(res);
}).then(res => {
ElMessage({
type: 'success', message: '新增成功'
})
getEnergyData()
})
if (res) { if (res) {
...@@ -195,7 +203,9 @@ const onSubmit = () => { ...@@ -195,7 +203,9 @@ const onSubmit = () => {
} }
} else { } else {
// res = await proxy.$api.editEnergy(formEnergy) // res = await proxy.$api.editEnergy(formEnergy)
// proxy.$refs['energyForm'].resetFields() res = postEnergyManageSave(formEnergy.value)
console.log(res);
proxy.$refs['energyForm'].resetFields()
dialogVisible.value = false dialogVisible.value = false
getEnergyData() getEnergyData()
......
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