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'
//能源消耗-获取
export const postEnergyManage = params => {
return http.post(`/api/energy/getData`, params).then(res => res).catch(function (error) {
console.log(error);
})
return http.post(`/api/energy/getData`, params).then(res => res).catch(function (error) {
console.log(error);
})
}
// 能源消耗-删除
// export const postEnergyDel = EnergyId => {
......@@ -27,95 +27,102 @@ export const postEnergyUpdate = params => {
// 瞬时热量-获取列表
export const postInstantHeat = params => {
return http.post(`api/Scheduling/BizInstantaneousHeat/Get`).then(res => res).catch(function (error) {
console.log(error);
})
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`, params).then(res => res).catch(function (error) {
console.log(error);
})
return http.post(`api/Scheduling/BizInstantaneousHeat/Update`, params).then(res => res).catch(function (error) {
console.log(error);
})
}
// 参数设置
export const postConfigBoilerUpdate = params => {
return http.post(`api/configboiler/Save`, params).then(res => res).catch(function (error) {
console.log(error);
})
return http.post(`api/configboiler/Save`, params).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);
})
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);
})
return http.post(`/api/energy/Save`, 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);
// })
// }
export const getWeatherMagData = () => { // 获取气象干预数据
return http.get(`/api/cusweather/getData`)
}
export const alterWeatherMagData = params => { // 添加或修改气象干预数据/重新绑定换热站
return http.post(`/api/cusweather/SaveAll`, params)
return http.post(`/api/cusweather/SaveAll`, params)
}
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 = () => { // 获取年度参数列表
return http.post('/api/Scheduling/BizHeatSet/Get')
return http.post('/api/Scheduling/BizHeatSet/Get')
}
export const alterAnnualParam = params => { // 修改年度参数
return http.post('/api/Scheduling/BizHeatSet/Update', 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 => { // 删除年度参数
// console.log("地址:",`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
return http.post(`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
// console.log("地址:",`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
return http.post(`/api/Scheduling/BizHeatSet/Delete?Id=${params}`)
}
export const getPhenomenon = () => { // 获取数据列表————天气工况
return http.post('/api/Scheduling/WeatherCondition/Get')
return http.post('/api/Scheduling/WeatherCondition/Get')
}
export const addPhenomenon = params => { // 新增数据————天气工况
return http.post('/api/Scheduling/WeatherCondition/Add', params)
return http.post('/api/Scheduling/WeatherCondition/Add', params)
}
export const alterPhenomenon = params => { // 修改数据————天气工况
return http.post('/api/Scheduling/WeatherCondition/Update', 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 = () => { // 获取数据列表————风力配置
return http.post('/api/Scheduling/WindConfiguration/Get')
return http.post('/api/Scheduling/WindConfiguration/Get')
}
export const addWind = params => { // 新增数据————风力配置
return http.post('/api/Scheduling/WindConfiguration/Add', params)
return http.post('/api/Scheduling/WindConfiguration/Add', 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 => { // 删除数据————风力配置
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'
export const postServicCenterList = params => {
var url = "/api/gis/home/ServicCenterList";
return http.post(url).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//Gis获取供热站列表
export const postSupplylist = params => {
return http.post(`/api/gis/home/supplylist`, params).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//Gis获取换热站列表
export const postTransferList = params => {
return http.post(`/api/gis/home/TransferList`, params).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取室外温度
export const getForecast = params => {
return http.get(`/api/weather/Forecast`).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取实时数据接口
export const postGYPipeReal = params => {
return http.post(`/api/gis/GYPipeReal`).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取换热站工况数据接口1 -- 阀门开度
export const postGYTransferValue = params => {
return http.post(`/api/gis/GYTransferValue`).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取换热站工况数据接口2 -- 热单耗
export const postGYTransferHeatUC = params => {
return http.post(`/api/gis/GYTransferHeatUC`, params).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取智慧调控面积
export const postAreaList = params => {
return http.post(`/api/gis/home/area`, params).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取前12小时一次补水量曲线
export const postGYSupplyWater = params => {
return http.post(`/api/gis/GYSupplyWater`).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//获取换热站机组一网电调阀开度分布
export const postTransferOpenValue = params => {
return http.post(`/api/gis/TransferOpenValue`).then(res => res).catch(function (error) {
console.log(error);
console.log(error);
})
}
//供热站度日热耗偏移量接口
export const postGYSupplyHeatUCDeviation = params => {
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() {
<el-input clearable v-model="searchKey"/>
</el-col>
</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="handleAdd">新增</el-button>
</div>
<div class="table-wrapper">
<el-table
......
......@@ -24,6 +24,13 @@ function revise(val){
reviseForm.value = {...val}
reviseWindowOpen.value = true
} // 修改按钮单击事件
function search(){
if(!searchKey.value){
getData()
}else {
data.value = dataBackup.value.filter(item => item.phenomenonName.includes(searchKey.value))
}
}
function omit(val){
let id = val.phenomenonId
ElMessageBox.confirm(
......@@ -40,13 +47,6 @@ function omit(val){
})
}).catch(err=>{})
} // 删除按钮单击事件
function search(){
if(!searchKey.value){
getData()
}else {
data.value = dataBackup.value.filter(item => item.phenomenonName.includes(searchKey.value) )
}
}
function handleClose(){
reviseWindowOpen.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