Commit f23fbc1f authored by jiaxu.yan's avatar jiaxu.yan

Merge branch 'master' of http://gitlab.91isoft.com:90/hikvision/web-project

# Conflicts:
#	src/api/scheduling.js
parents 7f7e528b 4211ac20
/*
整个项目api的统一管理
*/
import request from "./request";
// 请求首页左侧的表格的数据
export default{
getEnergyData(params) {
return request({
url:'/home/getEnergyData',
method:"get",
data:params
})
},
deleteEnergy(params) {
return request({
url:'/home/deleteEnergy',
method:"get",
data:params
})
},
addEnergy(params) {
return request({
url:'/home/AddEnergy',
method:"get",
data:params
})
},
editEnergy(params) {
return request({
url: '/home/editEnergy',
method: 'get',
data: params
})
},
}
import Mock from 'mockjs'
import energyApi from './mockData/energy'
// 1.拦截的路径 2.拦截的方法 3.制造出的假数据
// Mock.mock('/api/home/getEnergyData','get',energyApi.getEnergyList)
Mock.mock(/home\/getEnergyData/,"get", energyApi.getEnergyList)
Mock.mock(/home\/deleteEnergy/,"get", energyApi.deleteEnergy)
Mock.mock(/home\/AddEnergy/,"get", energyApi.createEnery)
Mock.mock(/home\/editEnergy/,"get", energyApi.updateEnergy)
\ No newline at end of file
import Mock from 'mockjs'
import { ref } from 'vue'
// get请求从config.url获取参数,post从config.body中获取参数
function param2Obj(url) {
const search = url.split('?')[1]
if (!search) {
return {}
}
return JSON.parse(
'{"' +
decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
)
}
let List = []
const count = 100
for (let i = 0; i < count; i++) {
List.push(
Mock.mock({
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'
})
)
}
export default {
/**
* 获取列表
* 要带参数 name, page, limt; name可以不填, page,limit有默认值。
* @param name, page, limit
* @return {{code: number, count: number, data: *[]}}
*/
getEnergyList: config => {
//limit默认是10,因为分页器默认也是一页10个
const { supplyName, page = 1, limit = 10 } = param2Obj(config.url)
const mockList = List.filter(energy => {
//如果name存在会,根据name筛选数据
if (supplyName && energy.supplyName.indexOf(supplyName) === -1) return false
return true
})
//分页
const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
return {
code: 200,
data: {
list: pageList,
count: mockList.length, //数据总条数需要返回
}
}
},
/**
* 删除
* @param id
* @return {*}
*/
deleteEnergy: config => {
const { allowPagingId} = param2Obj(config.url)
// console.log("前端传来的id:"+id);
if (!allowPagingId) {
return {
code: -999,
message: '参数不正确'
}
} else {
List = List.filter(item => item.allowPagingId != allowPagingId)
console.log(List);
return {
code: 200,
message: '删除成功'
}
}
},
/**
* 增加
* @param name, type, used, date
* @return {{code: number, data: {message: string}}}
*/
createEnery: config => {
const { supplyName, energyType, record, recordDate } = JSON.parse(config.body)
List.unshift({
allowPagingId:Mock.mock('@increment()'),
supplyName:supplyName,
energyType:energyType,
record:record,
recordDate:recordDate
})
return {
code: 200,
data: {
message: '添加成功'
}
}
},
updateEnergy: config => {
const { allowPagingId, supplyName, energyType, record, recordDate } = JSON.parse(config.body)
const energyType_num = parseInt(energyType)
List.some(e => {
if (e.allowPagingId === allowPagingId) {
e.supplyName = supplyName
e.energyType = energyType
e.record = record
e.recordDate = recordDate
return true
}
})
return {
code: 200,
data: {
message: '编辑成功'
}
}
}
}
\ No newline at end of file
import axios from 'axios';
import {ElMessage} from 'element-plus';
import config from '../config/index';
const service = axios.create({
baseURL:config.baseApi,
});
const NETWORK_ERROR = '网络错误...';
// 添加请求拦截器
service.interceptors.request.use(function (config) {
// 在发送请求之前做些什么
return config;
}, function (error) {
// 对请求错误做些什么
return Promise.reject(error);
});
// 添加响应拦截器
service.interceptors.response.use(
(res) => {
// console.log(res);
const {code,data,msg}= res.data;
if(code === 200) {
return data;
}else {
ElMessage.error(msg || NETWORK_ERROR);
return Promise.reject(msg || NETWORK_ERROR);
}
}
);
function request(options) {
options.method = options.method || "get";
// 关于get请求参数的调整
if(options.method.toLowerCase()==='get') {
options.params = options.data;
}
//对mock的开关做处理
let isMock = config.mock;
if(typeof options.mock !== "undefined") {
isMock = options.mock;
}
// 针对环境做一个处理
if(config.env === 'prod') {
// 不能mock
service,defaults.baseURL = config.baseApi;
}else {
service.defaults.baseURL = isMock ? config.mockApi : config.baseApi
}
return service(options);
}
export default request;
\ No newline at end of file
import http from './http' import http from './http'
//能源消耗-获取 //能源消耗-获取
export const postEnergyManage = params => { export const postEnergyManage = params => {
return http.post(`/api/energy/getData`, params).then(res => res).catch(function (error) { return http.post(`/api/energy/getData`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
// 能源消耗-删除 // 能源消耗-删除
// export const postEnergyDel = EnergyId => { // export const postEnergyDel = EnergyId => {
...@@ -27,95 +27,102 @@ export const postEnergyUpdate = params => { ...@@ -27,95 +27,102 @@ export const postEnergyUpdate = params => {
// 瞬时热量-获取列表 // 瞬时热量-获取列表
export const postInstantHeat = params => { export const postInstantHeat = params => {
return http.post(`api/Scheduling/BizInstantaneousHeat/Get`).then(res => res).catch(function (error) { return http.post(`api/Scheduling/BizInstantaneousHeat/Get`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
// 瞬时热量-新增修改
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);
}) })
} }
export const postSecAbsTUc = params => { export const postSecAbsTUc = params => {
return http.post(`/api/analysis/external/SecAbsTUc`, params).then(res => res).catch(function (error) { return http.post(`/api/analysis/external/SecAbsTUc`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
export const postEnergyManageSave = params => { export const postEnergyManageSave = params => {
return http.post(`/api/energy/Save`, params).then(res => res).catch(function (error) { return http.post(`/api/energy/Save`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
// export const postEnergyManageSave = params => {
// return http.post(`/api/energy/Save`, params).then(res => res).catch(function (error) {
// console.log(error);
// })
// }
export const getWeatherMagData = () => { // 获取气象干预数据 export const getWeatherMagData = () => { // 获取气象干预数据
return http.get(`/api/cusweather/getData`) return http.get(`/api/cusweather/getData`)
} }
export const alterWeatherMagData = params => { // 添加或修改气象干预数据/重新绑定换热站 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')
} }
export const alterAnnualParam = params => { // 修改年度参数 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')
} }
export const addPhenomenon = params => { // 新增数据————天气工况 export const addPhenomenon = params => { // 新增数据————天气工况
return http.post('/api/Scheduling/WeatherCondition/Add', params) return http.post('/api/Scheduling/WeatherCondition/Add', params)
} }
export const alterPhenomenon = params => { // 修改数据————天气工况 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}`)
} }
export const getWind = () => { // 获取数据列表————风力配置 export const getWind = () => { // 获取数据列表————风力配置
return http.post('/api/Scheduling/WindConfiguration/Get') return http.post('/api/Scheduling/WindConfiguration/Get')
} }
export const addWind = params => { // 新增数据————风力配置 export const addWind = params => { // 新增数据————风力配置
return http.post('/api/Scheduling/WindConfiguration/Add', params) return http.post('/api/Scheduling/WindConfiguration/Add', params)
} }
export const alterWind = params => { // 修改数据————风力配置 export const alterWind = params => { // 修改数据————风力配置
return http.post('/api/Scheduling/WindConfiguration/Update',params) return http.post('/api/Scheduling/WindConfiguration/Update', params)
} }
export const deleteWind = params => { // 删除数据————风力配置 export const deleteWind = params => { // 删除数据————风力配置
return http.post(`/api/Scheduling/WindConfiguration/Delete?Id=${params}`) return http.post(`/api/Scheduling/WindConfiguration/Delete?Id=${params}`)
} }
...@@ -19,76 +19,76 @@ import http from './http' ...@@ -19,76 +19,76 @@ import http from './http'
export const postServicCenterList = params => { export const postServicCenterList = params => {
var url = "/api/gis/home/ServicCenterList"; var url = "/api/gis/home/ServicCenterList";
return http.post(url).then(res => res).catch(function (error) { return http.post(url).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//Gis获取供热站列表 //Gis获取供热站列表
export const postSupplylist = params => { export const postSupplylist = params => {
return http.post(`/api/gis/home/supplylist`, params).then(res => res).catch(function (error) { return http.post(`/api/gis/home/supplylist`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//Gis获取换热站列表 //Gis获取换热站列表
export const postTransferList = params => { export const postTransferList = params => {
return http.post(`/api/gis/home/TransferList`, params).then(res => res).catch(function (error) { return http.post(`/api/gis/home/TransferList`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取室外温度 //获取室外温度
export const getForecast = params => { export const getForecast = params => {
return http.get(`/api/weather/Forecast`).then(res => res).catch(function (error) { return http.get(`/api/weather/Forecast`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取实时数据接口 //获取实时数据接口
export const postGYPipeReal = params => { export const postGYPipeReal = params => {
return http.post(`/api/gis/GYPipeReal`).then(res => res).catch(function (error) { return http.post(`/api/gis/GYPipeReal`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取换热站工况数据接口1 -- 阀门开度 //获取换热站工况数据接口1 -- 阀门开度
export const postGYTransferValue = params => { export const postGYTransferValue = params => {
return http.post(`/api/gis/GYTransferValue`).then(res => res).catch(function (error) { return http.post(`/api/gis/GYTransferValue`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取换热站工况数据接口2 -- 热单耗 //获取换热站工况数据接口2 -- 热单耗
export const postGYTransferHeatUC = params => { export const postGYTransferHeatUC = params => {
return http.post(`/api/gis/GYTransferHeatUC`, params).then(res => res).catch(function (error) { return http.post(`/api/gis/GYTransferHeatUC`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取智慧调控面积 //获取智慧调控面积
export const postAreaList = params => { export const postAreaList = params => {
return http.post(`/api/gis/home/area`, params).then(res => res).catch(function (error) { return http.post(`/api/gis/home/area`, params).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取前12小时一次补水量曲线 //获取前12小时一次补水量曲线
export const postGYSupplyWater = params => { export const postGYSupplyWater = params => {
return http.post(`/api/gis/GYSupplyWater`).then(res => res).catch(function (error) { return http.post(`/api/gis/GYSupplyWater`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//获取换热站机组一网电调阀开度分布 //获取换热站机组一网电调阀开度分布
export const postTransferOpenValue = params => { export const postTransferOpenValue = params => {
return http.post(`/api/gis/TransferOpenValue`).then(res => res).catch(function (error) { return http.post(`/api/gis/TransferOpenValue`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
//供热站度日热耗偏移量接口 //供热站度日热耗偏移量接口
export const postGYSupplyHeatUCDeviation = params => { export const postGYSupplyHeatUCDeviation = params => {
return http.post(`/api/gis/GYSupplyHeatUCDeviation`).then(res => res).catch(function (error) { return http.post(`/api/gis/GYSupplyHeatUCDeviation`).then(res => res).catch(function (error) {
console.log(error); console.log(error);
}) })
} }
\ No newline at end of file
const env = import.meta.env.MODE || "prod";
const EnvConfig = {
development:{
baseApi:"/api",
mockApi:"https://apifoxmock.com/m1/4068509-0-default/api/home/getTable"
},
test:{
baseApi:"//test.future.com/api",
mockApi:"https://apifoxmock.com/m1/4068509-0-default/api/home/getTable"
},
prod:{
baseApi:"//future.com/api",
mockApi:"https://apifoxmock.com/m1/4068509-0-default/api/home/getTable"
}
};
export default {
env,
...EnvConfig[env],
//mock
mock:false,
}
\ No newline at end of file
...@@ -131,8 +131,8 @@ function resetInput() { ...@@ -131,8 +131,8 @@ function resetInput() {
<el-input clearable v-model="searchKey"/> <el-input clearable v-model="searchKey"/>
</el-col> </el-col>
</el-row> </el-row>
<el-button type="primary" class="add-search-btn" @click="handleAdd">新增</el-button>
<el-button type="primary" class="add-search-btn" @click="handleSearch">查询</el-button> <el-button type="primary" class="add-search-btn" @click="handleSearch">查询</el-button>
<el-button type="primary" class="add-search-btn" @click="handleAdd">新增</el-button>
</div> </div>
<div class="table-wrapper"> <div class="table-wrapper">
<el-table <el-table
......
...@@ -3,29 +3,31 @@ import { ref, onMounted, getCurrentInstance, reactive, nextTick } from 'vue' ...@@ -3,29 +3,31 @@ import { ref, onMounted, getCurrentInstance, reactive, nextTick } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import axios from 'axios' 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, postEnergyDel, postEnergyUpdate } 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 = ref({
"updateNullFields": "",
"supplyId": "",
"energyType": "",
"record": "",
"recordDate": ""
})
const energyForm = ref() const energyForm = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const getEnergyData = async () => { const getEnergyData = async () => {
await http.post("/api/energy/getData", tableData.energyType = ["0", "1", "2", "3", "4"]).then(res => { await http.post("/api/energy/getData", config.supplyType).then(res => {
console.log("res:", res); console.log("res:", res);
tableData.value = res.data tableData.value = res.data
}).catch(err => { }).catch(err => {
console.log(error) console.log(error)
}) })
ElMessage.success('查询成功') ElMessage.success('获取数据成功')
console.log("tableData:", tableData.value);
// config.total = data.count
} }
const tableLabel = reactive([ const tableLabel = reactive([
{ {
prop: 'allowPagingId', prop: 'allowPagingId',
...@@ -58,15 +60,15 @@ const formInline = reactive({ ...@@ -58,15 +60,15 @@ const formInline = reactive({
}) })
const config = reactive({ const config = reactive({
total: 0, supplyType: ["0","1","2","3","4"],
page: 1,
supplyName: "",
}) })
const handleSearch = () => { const handleSearch = () => {
config.supplyName, config.supplyType = formInline.keyWord
config.supplyType = [`${config.supplyType}`]
getEnergyData(), getEnergyData(),
config.supplyName = '' tableData.energyType = '',
ElMessage.success('获取数据成功')
} }
const timeFormat = (time) => { const timeFormat = (time) => {
...@@ -92,20 +94,15 @@ const rules = reactive({ ...@@ -92,20 +94,15 @@ const rules = reactive({
recordDate: [{ required: true, message: "日期是必选项" }] recordDate: [{ required: true, message: "日期是必选项" }]
}) })
// // const handleChange = (page) => {
// config.page = page,
// getEnergyData()
// }
const handleChange = (page) => {
config.page = page,
getEnergyData()
}
// 删除 // 删除
// const handleDelete = async (row) => { // const handleDelete = async (row) => {
// // console.log(row.energyId); // // console.log(row.energyId);
// console.log('"'+row.energyId+'"'); // console.log('"' + row.energyId + '"');
// await ElMessageBox.confirm("你确定要删除吗?", { // await ElMessageBox.confirm("你确定要删除吗?", {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// cancelButtonText: '取消', // cancelButtonText: '取消',
...@@ -113,7 +110,7 @@ const handleChange = (page) => { ...@@ -113,7 +110,7 @@ const handleChange = (page) => {
// confirmButtonClass: 'ExitConfirmButton' // confirmButtonClass: 'ExitConfirmButton'
// }).then(async () => { // }).then(async () => {
// // await postEnergyDel('"'+row.energyId+'"') // // await postEnergyDel('"'+row.energyId+'"')
// await postEnergyDel({EnergyId:row.energyId}) // await postEnergyDel({ EnergyId: row.energyId })
// ElMessage({ // ElMessage({
// type: 'success', message: '删除成功' // type: 'success', message: '删除成功'
// }) // })
...@@ -122,25 +119,24 @@ const handleChange = (page) => { ...@@ -122,25 +119,24 @@ const handleChange = (page) => {
// } // }
// 删除 // 删除
// const handleDelete = async (row) => { const handleDelete = async (row) => {
// console.log(row.energyId); console.log(row.energyId);
// console.log('"' + row.energyId + '"'); console.log('"' + row.energyId + '"');
// let EnergyId = row.energyId let EnergyId = row.energyId
// await ElMessageBox.confirm("你确定要删除吗?", { await ElMessageBox.confirm("你确定要删除吗?", {
// confirmButtonText: '确定', confirmButtonText: '确定',
// cancelButtonText: '取消', cancelButtonText: '取消',
// type: 'warning', type: 'warning',
// confirmButtonClass: 'ExitConfirmButton' confirmButtonClass: 'ExitConfirmButton'
// }) })
// await http.post("api/energy/Delete?EnergyId="+'"'+row.energyId +'"',false ).then(res => { await http.post("api/energy/Delete", EnergyId = '"' + row.energyId + '"', false).then(res => {
// console.log(res); }).then(res => {
// }).then(res => { ElMessage({
// ElMessage({ type: 'success', message: '删除成功'
// type: 'success', message: '删除成功' })
// }) getEnergyData()
// getEnergyData() })
// }) }
// }
// 新增 // 新增
...@@ -148,17 +144,17 @@ const action = ref('add') ...@@ -148,17 +144,17 @@ const action = ref('add')
const handleClose = () => { const handleClose = () => {
dialogVisible.value = false dialogVisible.value = false
// proxy.$ref['energyForm'].resetFields() proxy.$ref['energyForm'].resetFields()
} }
const handleCancel = () => { const handleCancel = () => {
dialogVisible.value = false dialogVisible.value = false
// proxy.$ref['energyForm'].resetFields() proxy.$ref['energyForm'].resetFields()
} }
const handleAdd = () => { const handleAdd = () => {
action.value = "add", action.value = "add",
dialogVisible.value = true; dialogVisible.value = true;
// proxy.$refs['energyForm'].resetFields() proxy.$refs['energyForm'].resetFields()
formEnergy.supplyName = '', formEnergy.supplyName = '',
formEnergy.energyType = '' formEnergy.energyType = ''
...@@ -168,43 +164,32 @@ const handleEdit = (val) => { ...@@ -168,43 +164,32 @@ const handleEdit = (val) => {
action.value = "edit" action.value = "edit"
dialogVisible.value = true dialogVisible.value = true
nextTick(() => { nextTick(() => {
Object.assign(formEnergy, { ...val }) Object.assign(formEnergy.value, { ...val })
}) })
} }
const onSubmit = () => { const onSubmit = () => {
energyForm.value.validate(async (valid) => { energyForm.value.validate(async (valid) => {
if (valid) { if (valid) {
let res = null; let res = null;
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) await http.post("api/energy/Save", { ...formEnergy.value }, false).then(res => {
// res =await postEnergyManageSave(formEnergy.value)
// console.log(res);
await http.post("api/energy/Save",formEnergy.value , false).then(res => {
console.log(res);
}).then(res => { }).then(res => {
ElMessage({ ElMessage({
type: 'success', message: '新增成功' type: 'success', message: '新增成功'
}) })
getEnergyData() getEnergyData()
}) })
if (res) { if (res) {
dialogVisible.value = false dialogVisible.value = false
// proxy.$refs['energyForm'].resetFields()
getEnergyData() getEnergyData()
} }
} else { } else {
// res = await proxy.$api.editEnergy(formEnergy) res = postEnergyUpdate(formEnergy.value)
res = postEnergyManageSave(formEnergy.value)
console.log(res);
proxy.$refs['energyForm'].resetFields() proxy.$refs['energyForm'].resetFields()
dialogVisible.value = false dialogVisible.value = false
...@@ -239,11 +224,13 @@ onMounted(() => { ...@@ -239,11 +224,13 @@ onMounted(() => {
<div class="th_div"> <div class="th_div">
<el-form ref="formRef" :model="formInline" :inline="true" <el-form ref="formRef" :model="formInline" :inline="true"
style="display: flex; justify-content: center; align-items: center; margin: 0;"> style="display: flex; justify-content: center; align-items: center; margin: 0;">
<el-form-item class="select-clean" prop="supplyName" label-width="280px" style="margin: 0;"> <el-form-item class="select-clean" prop="supplyType" label-width="280px" style="margin: 0;">
<el-select v-model="config.supplyName" placeholder="请选择" style="width:360px; margin-left: 20px;"> <el-select v-model="formInline.keyWord" placeholder="请选择" style="width:360px; margin-left: 20px;">
<el-option label="东部供热站" value="东部供热站" /> <el-option label="非节能" value="0" />
<el-option label="行政区供热站" value="行政区供热站" /> <el-option label="一步节能" value="1" />
<el-option label="福宛里供热站" value="福宛里供热站" /> <el-option label="二步节能" value="2" />
<el-option label="三步节能" value="3" />
<el-option label="四步节能" value="4" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -271,29 +258,26 @@ onMounted(() => { ...@@ -271,29 +258,26 @@ onMounted(() => {
stripe> stripe>
<el-table-column v-for="item in tableLabel" :key="item.prop" :width="item.width ? item.width : 150" <el-table-column v-for="item in tableLabel" :key="item.prop" :width="item.width ? item.width : 150"
:prop="item.prop" :label="item.label" /> :prop="item.prop" :label="item.label" />
<!-- <el-table-column prop="allowPagingId" label="Date" width="180" />
<el-table-column prop="supplyName" label="Name" width="180" />
<el-table-column prop="energyType" label="Address" />
<el-table-column prop="record" label="Address" />
<el-table-column prop="recordDate" label="Address" /> -->
<el-table-column fixed="right" label="操作" min-width="140"> <el-table-column fixed="right" label="操作" min-width="140">
<template #="scope"> <template #default="scope">
<el-button link type="primary" size="small" @click="handleEdit(scope.row)"> <el-button link type="primary" size="small" @click="handleEdit(scope.row)">
编辑 编辑
</el-button> </el-button>
<el-button link type="primary" size="small" @click="handleDelete(scope.row)">删除</el-button> <el-button link type="primary" size="small" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
<template #empty>
<el-empty description="暂无数据,快去添加数据吧.."></el-empty>
</template>
</el-table> </el-table>
<div class="bottom"> <!-- <div class="bottom">
<div class="bottom-left" style="color: #4B4847; font-size: 12px;"> <div class="bottom-left" style="color: #4B4847; font-size: 12px;">
共{{ config.total }}条记录,当前为第{{ config.page }}页,共{{ parseInt(config.total / 10 + 0.9) }}页 共{{ config.total }}条记录,当前为第{{ config.page }}页,共{{ parseInt(config.total / 10 + 0.9) }}页
</div> </div>
<el-pagination background layout="prev, pager, next" next-text="下一页" class="pager" :total="config.total" <el-pagination background layout="prev, pager, next" next-text="下一页" class="pager" :total="total"
size="small" @current-change="handleChange" /> size="small" @current-change="handleChange" />
</div> -->
</div>
</div> </div>
<el-dialog v-model="dialogVisible" :title="action == 'add' ? '数据新增' : '数据修改'" width="50%" :before-close="handleClose"> <el-dialog v-model="dialogVisible" :title="action == 'add' ? '数据新增' : '数据修改'" width="50%" :before-close="handleClose">
...@@ -305,8 +289,8 @@ onMounted(() => { ...@@ -305,8 +289,8 @@ onMounted(() => {
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-select v-model="formEnergy.supplyName" placeholder="请选择"> <el-select v-model="formEnergy.supplyId" placeholder="请选择">
<el-option label="东部供热站" value="东部供热站" /> <el-option label="东部供热站" value="DFA20074-8731-457F-B63F-4E1858CFE266" />
<el-option label="行政区供热站" value="行政区供热站" /> <el-option label="行政区供热站" value="行政区供热站" />
<el-option label="福宛里供热站" value="福宛里供热站" /> <el-option label="福宛里供热站" value="福宛里供热站" />
</el-select> </el-select>
...@@ -326,7 +310,7 @@ onMounted(() => { ...@@ -326,7 +310,7 @@ onMounted(() => {
<el-option label="热" value="1" /> <el-option label="热" value="1" />
<el-option label="水" value="2" /> <el-option label="水" value="2" />
<el-option label="电" value="3" /> <el-option label="电" value="3" />
<el-option label="机械" value="机械" /> <el-option label="机械" value="4" />
</el-select> </el-select>
</td> </td>
</tr> </tr>
...@@ -443,22 +427,21 @@ table td { ...@@ -443,22 +427,21 @@ table td {
} }
.bottom { // .bottom {
// border: 1px solid red; // // border: 1px solid red;
margin-top: 10px; // margin-top: 10px;
width: 100%; // width: 100%;
display: flex; // display: flex;
right: 10px; // right: 10px;
bottom: 30px; // bottom: 30px;
justify-content: space-between; // justify-content: space-between;
.bottom-left { // .bottom-left {
display: flex; // display: flex;
} // }
.pager { // .pager {
display: flex; // display: flex;
} // }
} // }</style>
</style>
...@@ -24,6 +24,13 @@ function revise(val){ ...@@ -24,6 +24,13 @@ function revise(val){
reviseForm.value = {...val} reviseForm.value = {...val}
reviseWindowOpen.value = true reviseWindowOpen.value = true
} // 修改按钮单击事件 } // 修改按钮单击事件
function search(){
if(!searchKey.value){
getData()
}else {
data.value = dataBackup.value.filter(item => item.phenomenonName.includes(searchKey.value))
}
}
function omit(val){ function omit(val){
let id = val.phenomenonId let id = val.phenomenonId
ElMessageBox.confirm( ElMessageBox.confirm(
...@@ -40,13 +47,6 @@ function omit(val){ ...@@ -40,13 +47,6 @@ function omit(val){
}) })
}).catch(err=>{}) }).catch(err=>{})
} // 删除按钮单击事件 } // 删除按钮单击事件
function search(){
if(!searchKey.value){
getData()
}else {
data.value = dataBackup.value.filter(item => item.phenomenonName.includes(searchKey.value) )
}
}
function handleClose(){ function handleClose(){
reviseWindowOpen.value = false reviseWindowOpen.value = false
addWindowOpen.value = false addWindowOpen.value = false
......
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