Commit 4ac876ed authored by 裴文涛's avatar 裴文涛

风力配置查询完善

parent 58ef2d28
...@@ -93,3 +93,19 @@ export const alterPhenomenon = params => { // 修改数据————天气工 ...@@ -93,3 +93,19 @@ export const alterPhenomenon = 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 = () => { // 获取数据列表————风力配置
return http.post('/api/Scheduling/WindConfiguration/Get')
}
export const addWind = params => { // 新增数据————风力配置
return http.post('/api/Scheduling/WindConfiguration/Add', params)
}
export const alterWind = params => { // 修改数据————风力配置
return http.post('/api/Scheduling/WindConfiguration/Update',params)
}
export const deleteWind = params => { // 删除数据————风力配置
return http.post(`/api/Scheduling/WindConfiguration/Delete?Id=${params}`)
}
...@@ -52,9 +52,9 @@ function onReviseSubmit(){ ...@@ -52,9 +52,9 @@ function onReviseSubmit(){
} // 修改表单提交 } // 修改表单提交
function onAddSubmit(){ function onAddSubmit(){
addPhenomenon(addForm.value).then(res=>{ addPhenomenon(addForm.value).then(res=>{
console.log(res) handleClose()
getData()
}) })
handleClose()
} // 新增表单提交 } // 新增表单提交
function resetInput(){ function resetInput(){
addForm.value = { addForm.value = {
...@@ -130,9 +130,9 @@ function getData(){ ...@@ -130,9 +130,9 @@ function getData(){
<el-col :span="8" col-label class="energy-type-class">类型:</el-col> <el-col :span="8" col-label class="energy-type-class">类型:</el-col>
<el-col :span="16" col-value> <el-col :span="16" col-value>
<el-select placeholder="" size="small" v-model="reviseForm.phenomenonType" style="width: 370px"> <el-select placeholder="" size="small" v-model="reviseForm.phenomenonType" style="width: 370px">
<el-option value="1" label="1--晴天"/> <el-option value="1" label="1"/>
<el-option value="2" label="2--多云"/> <el-option value="2" label="2"/>
<el-option value="3" label="3--阴天"/> <el-option value="3" label="3"/>
</el-select> </el-select>
</el-col> </el-col>
</el-row> </el-row>
...@@ -176,22 +176,22 @@ function getData(){ ...@@ -176,22 +176,22 @@ function getData(){
<el-col :span="8" col-label class="energy-type-class">类型:</el-col> <el-col :span="8" col-label class="energy-type-class">类型:</el-col>
<el-col :span="16" col-value> <el-col :span="16" col-value>
<el-select placeholder="" size="small" v-model="addForm.phenomenonType" style="width: 370px"> <el-select placeholder="" size="small" v-model="addForm.phenomenonType" style="width: 370px">
<el-option value="1" label="1--晴天"/> <el-option value="1" label="1"/>
<el-option value="2" label="2--多云"/> <el-option value="2" label="2"/>
<el-option value="3" label="3--阴天"/> <el-option value="3" label="3"/>
</el-select> </el-select>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" col-label>对应温度:</el-col> <el-col :span="8" col-label>对应温度:</el-col>
<el-col :span="16" col-value> <el-col :span="16" col-value>
<el-input v-model="reviseForm.phenomenonTemp" placeholder="" style="width: 370px"/> <el-input v-model="addForm.phenomenonTemp" placeholder="" style="width: 370px"/>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" col-label>描述:</el-col> <el-col :span="8" col-label>描述:</el-col>
<el-col :span="16" col-value> <el-col :span="16" col-value>
<el-input v-model="reviseForm.phenomenonDesc" placeholder="" style="width: 370px"/> <el-input v-model="addForm.phenomenonDesc" placeholder="" style="width: 370px"/>
</el-col> </el-col>
</el-row> </el-row>
</template> </template>
......
<script setup> <script setup>
import {ref} from "vue"; import {onMounted, ref, watch, watchEffect} from "vue";
import {ElMessageBox} from "element-plus"; import {ElMessageBox} from "element-plus";
import {getWind, deleteWind, alterWind, addWind} from "@/api/scheduling.js"
const data = ref() const data = ref()
const dataBackup = ref([])
const searchKey = ref('') // 查询参数 const searchKey = ref('') // 查询参数
const reviseWindowOpen = ref(false) const reviseWindowOpen = ref(false)
const addWindowOpen = ref(false)
const reviseForm = ref({}) // 修改表单 const reviseForm = ref({}) // 修改表单
const addForm = ref({}) // 新增表单
const tableHeaderClass = data => { // 表头样式 const tableHeaderClass = data => { // 表头样式
return 'table-header-class' return 'table-header-class'
} }
...@@ -13,41 +17,87 @@ const tableBodyClass = data => { // 表体样式 ...@@ -13,41 +17,87 @@ const tableBodyClass = data => { // 表体样式
return 'table-body-class' return 'table-body-class'
} }
function revise(val){ function add() {
addWindowOpen.value = true
} // 新增按钮单击事件
function revise(val) {
reviseForm.value = {...val} reviseForm.value = {...val}
reviseWindowOpen.value = true reviseWindowOpen.value = true
} // 修改按钮单击事件 } // 修改按钮单击事件
function omit(val){ function omit(val) {
let id = val.phenomenonId let id = val.windId
ElMessageBox.confirm( ElMessageBox.confirm(
'点击确定后,该条数据将删除,是否继续?', '点击确定后,该条数据将删除,是否继续?',
'Warning', 'Warning',
{ {
confirmButtonText:'确定', confirmButtonText: '确定',
cancelButtonText:'取消', cancelButtonText: '取消',
type:'warning' type: 'warning'
} }
).then(()=>{ ).then(() => {
deleteWind(id).then(res => {
}).catch(err=>{}) getData()
})
}).catch(err => {
})
} // 删除按钮单击事件 } // 删除按钮单击事件
function handleClose(){ function search() {
if(!searchKey.value){
getData()
}else {
data.value = dataBackup.value.filter(item => searchKey.value == item.windLevel)
}
} // 处理查询
function handleClose() {
reviseWindowOpen.value = false reviseWindowOpen.value = false
addWindowOpen.value = false
resetInput()
} // 关闭弹窗 } // 关闭弹窗
function onReviseSubmit(){ function onReviseSubmit() {
alterWind(reviseForm.value).then(res => {
getData()
handleClose()
})
} // 修改表单提交 } // 修改表单提交
function onAddSubmit() {
addWind(addForm.value).then(res => {
getData()
handleClose()
})
} // 新增表单提交
onMounted(() => {
getData()
})
function getData() {
getWind().then(res => {
data.value = res.data
dataBackup.value = [...data.value]
})
}
function resetInput() {
addForm.value = {
windLevel: '',
windTemp: '',
windDesc: ''
}
}
</script> </script>
<template> <template>
<div class="windManage-container"> <div class="windManage-container">
<div class="search-wrapper"> <div class="search-wrapper">
<!-- <el-row>--> <el-row>
<!-- <el-col :span="8" label>名称:</el-col>--> <el-col :span="8" label>级数:</el-col>
<!-- <el-col :span="16">--> <el-col :span="16">
<!-- <el-input v-model="searchKey"/>--> <el-select placeholder="" clearable style="width: 200px" v-model="searchKey">
<!-- </el-col>--> <el-option v-for="item in 14" :key="item" :value="item" :label="item"/>
<!-- </el-row>--> </el-select>
<!-- <el-button type="primary" class="add-search-btn">查询</el-button>--> </el-col>
</el-row>
<el-button type="primary" @click="search" class="add-search-btn">查询</el-button>
<el-button type="primary" @click="add" class="add-search-btn">新增</el-button>
</div> </div>
<div class="table-wrapper"> <div class="table-wrapper">
<el-table <el-table
...@@ -73,7 +123,7 @@ function onReviseSubmit(){ ...@@ -73,7 +123,7 @@ function onReviseSubmit(){
</div> </div>
<div class="dialog-window"> <div class="dialog-window">
<el-dialog <el-dialog
title="天气工况设置修改" title="风力配置修改"
v-model="reviseWindowOpen" v-model="reviseWindowOpen"
width="700px" width="700px"
:before-close="handleClose"> :before-close="handleClose">
...@@ -106,11 +156,45 @@ function onReviseSubmit(){ ...@@ -106,11 +156,45 @@ function onReviseSubmit(){
</div> </div>
</template> </template>
</el-dialog> <!-- 修改弹窗 --> </el-dialog> <!-- 修改弹窗 -->
<el-dialog
title="风力配置新增"
v-model="addWindowOpen"
width="700px"
:before-close="handleClose">
<template #default>
<el-row first>
<el-col :span="8" col-label class="energy-type-class">级数:</el-col>
<el-col :span="16" col-value>
<el-select placeholder="" size="small" v-model="addForm.windLevel" style="width: 370px">
<el-option v-for="(item,index) in 14" :key="index" :value="item" :label="item"/>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>对应温度:</el-col>
<el-col :span="16" col-value>
<el-input v-model="addForm.windTemp" placeholder="" style="width: 370px"/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" col-label>描述:</el-col>
<el-col :span="16" col-value>
<el-input v-model="addForm.windDesc" placeholder="" style="width: 370px"/>
</el-col>
</el-row>
</template>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="onAddSubmit">保存</el-button>
<el-button type="primary" @click="handleClose">关闭</el-button>
</div>
</template>
</el-dialog> <!-- 新增弹窗 -->
</div> </div>
</div> </div>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.windManage-container{ .windManage-container {
width: 100%; width: 100%;
margin: 4px; margin: 4px;
} }
...@@ -145,6 +229,7 @@ function onReviseSubmit(){ ...@@ -145,6 +229,7 @@ function onReviseSubmit(){
background-color: #c4d8f1 !important; background-color: #c4d8f1 !important;
color: #124c6a; color: #124c6a;
} }
:deep(.table-body-class) { :deep(.table-body-class) {
font-size: 12px; font-size: 12px;
color: black; color: black;
...@@ -164,10 +249,11 @@ function onReviseSubmit(){ ...@@ -164,10 +249,11 @@ function onReviseSubmit(){
background: linear-gradient(to top, rgb(0, 198, 255), rgb(255, 255, 255)) !important; background: linear-gradient(to top, rgb(0, 198, 255), rgb(255, 255, 255)) !important;
} }
.el-row[first]{ .el-row[first] {
border-top: 1px solid #a6c3e9; border-top: 1px solid #a6c3e9;
} }
.el-row{
.el-row {
border-left: 1px solid #a6c3e9; border-left: 1px solid #a6c3e9;
border-right: 1px solid #a6c3e9; border-right: 1px solid #a6c3e9;
border-bottom: 1px solid #a6c3e9; border-bottom: 1px solid #a6c3e9;
...@@ -175,7 +261,8 @@ function onReviseSubmit(){ ...@@ -175,7 +261,8 @@ function onReviseSubmit(){
height: 35px; height: 35px;
color: #124362; color: #124362;
} }
.el-col[col-label]{
.el-col[col-label] {
display: flex; display: flex;
justify-content: end; justify-content: end;
align-items: center; align-items: center;
...@@ -183,13 +270,15 @@ function onReviseSubmit(){ ...@@ -183,13 +270,15 @@ function onReviseSubmit(){
background-color: #dfe8f6; background-color: #dfe8f6;
padding-right: 5px; padding-right: 5px;
} }
.el-col[col-value]{
.el-col[col-value] {
display: flex; display: flex;
justify-content: start; justify-content: start;
align-items: center; align-items: center;
padding-left: 5px; padding-left: 5px;
} }
.el-input{
.el-input {
color: black; color: black;
height: 24px; height: 24px;
} }
......
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