Commit 5a0a69fc authored by 裴文涛's avatar 裴文涛

添加新增等操作后提示功能

parent 7338d58d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import {computed, onMounted, reactive, ref} from "vue"; import {computed, onMounted, reactive, ref} from "vue";
import {zhCn} from "element-plus/es/locale/index"; import {zhCn} from "element-plus/es/locale/index";
import {getAnnualParam, alterAnnualParam, addAnnualParam, deleteAnnualParam} from '@/api/scheduling.js' import {getAnnualParam, alterAnnualParam, addAnnualParam, deleteAnnualParam} from '@/api/scheduling.js'
import {ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
const data = ref() const data = ref()
const dataBackup = ref([]) const dataBackup = ref([])
...@@ -56,9 +56,17 @@ function handleDelete(val) { ...@@ -56,9 +56,17 @@ function handleDelete(val) {
deleteAnnualParam(val.paramId).then(res => { deleteAnnualParam(val.paramId).then(res => {
if (res.success) { if (res.success) {
getData() getData()
ElMessage({
message: '删除成功.',
type: 'success',
})
} }
}) })
}).catch(err => { }).catch(err => {
ElMessage({
message: '删除失败.',
type: 'error',
})
}) })
} // 处理删除 } // 处理删除
function handleAdd() { function handleAdd() {
...@@ -78,7 +86,16 @@ function onSubmit() { ...@@ -78,7 +86,16 @@ function onSubmit() {
if (res.success) { if (res.success) {
getData() getData()
handleClose() handleClose()
ElMessage({
message: '修改成功.',
type: 'success',
})
} }
}).catch(err=>{
ElMessage({
message: '修改失败.',
type: 'error',
})
}) })
} // 提交修改 } // 提交修改
function onAddSubmit() { // 提交新增 function onAddSubmit() { // 提交新增
...@@ -91,6 +108,15 @@ function onAddSubmit() { // 提交新增 ...@@ -91,6 +108,15 @@ function onAddSubmit() { // 提交新增
addAnnualParam(addForm.value).then(res => { addAnnualParam(addForm.value).then(res => {
getData() getData()
handleClose() handleClose()
ElMessage({
message: '新增成功.',
type: 'success',
})
}).catch(err=>{
ElMessage({
message: '新增失败.',
type: 'error',
})
}) })
} // 提交新增 } // 提交新增
function handleClose() { function handleClose() {
......
<script setup> <script setup>
import {onMounted, ref} from "vue"; import {onMounted, ref} from "vue";
import {ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getPhenomenon,addPhenomenon,alterPhenomenon,deletePhenomenon} from "@/api/scheduling.js" import {getPhenomenon,addPhenomenon,alterPhenomenon,deletePhenomenon} from "@/api/scheduling.js"
const data = ref() const data = ref()
...@@ -44,8 +44,17 @@ function omit(val){ ...@@ -44,8 +44,17 @@ function omit(val){
).then(()=>{ ).then(()=>{
deletePhenomenon(id).then(res=>{ deletePhenomenon(id).then(res=>{
getData() getData()
ElMessage({
message: '删除成功.',
type: 'success',
})
}) })
}).catch(err=>{}) }).catch(err=>{
ElMessage({
message: '删除失败.',
type: 'error',
})
})
} // 删除按钮单击事件 } // 删除按钮单击事件
function handleClose(){ function handleClose(){
reviseWindowOpen.value = false reviseWindowOpen.value = false
...@@ -56,12 +65,30 @@ function onReviseSubmit(){ ...@@ -56,12 +65,30 @@ function onReviseSubmit(){
alterPhenomenon(reviseForm.value).then(res=>{ alterPhenomenon(reviseForm.value).then(res=>{
getData() getData()
reviseWindowOpen.value = false reviseWindowOpen.value = false
ElMessage({
message: '修改成功.',
type: 'success',
})
}).catch(err=>{
ElMessage({
message: '修改失败.',
type: 'error',
})
}) })
} // 修改表单提交 } // 修改表单提交
function onAddSubmit(){ function onAddSubmit(){
addPhenomenon(addForm.value).then(res=>{ addPhenomenon(addForm.value).then(res=>{
handleClose() handleClose()
getData() getData()
ElMessage({
message: '新增成功.',
type: 'success',
})
}).catch(err=>{
ElMessage({
message: '新增失败.',
type: 'error',
})
}) })
} // 新增表单提交 } // 新增表单提交
function resetInput(){ function resetInput(){
......
...@@ -4,35 +4,43 @@ import ReviseWindow from "./weatherManageSub/ReviseWindow.vue"; ...@@ -4,35 +4,43 @@ import ReviseWindow from "./weatherManageSub/ReviseWindow.vue";
import BindWindow from "./weatherManageSub/BindWindow.vue"; import BindWindow from "./weatherManageSub/BindWindow.vue";
import {getWeatherMagData, alterWeatherMagData, getTransfer} from '@/api/scheduling.js' import {getWeatherMagData, alterWeatherMagData, getTransfer} from '@/api/scheduling.js'
import AddWindow from "./weatherManageSub/AddWindow.vue"; import AddWindow from "./weatherManageSub/AddWindow.vue";
import {ElMessage} from "element-plus";
const data = ref() const data = ref()
const reviseWindowOpen = ref(false) // 修改按钮弹窗状态 const reviseWindowOpen = ref(false) // 修改按钮弹窗状态
const bindWindowOpen = ref(false) // 绑定按钮弹窗状态 const bindWindowOpen = ref(false) // 绑定按钮弹窗状态
const addWindowOpen = ref(false) // 新增按钮弹窗状态 const addWindowOpen = ref(false) // 新增按钮弹窗状态
const dependentSub = ref({}) // 修改和绑定弹窗数据依赖 const dependentSub = ref({}) // 修改和绑定弹窗数据依赖
const tableHeaderClass = data => { // 表头样式 const tableHeaderClass = data => { // 表头样式
return 'table-header-class' return 'table-header-class'
} }
const tableBodyClass = data => { // 表体样式 const tableBodyClass = data => { // 表体样式
return 'table-body-class' return 'table-body-class'
} }
const revise = (row) => { // 修改按钮单击事件 const revise = (row) => { // 修改按钮单击事件
dependentSub.value = row dependentSub.value = row
reviseWindowOpen.value = true reviseWindowOpen.value = true
} }
const bind = (row) => { // 绑定按钮单击事件 const bind = (row) => { // 绑定按钮单击事件
// getTransfer(id).then(res=>{
// // console.log(res)
// })
dependentSub.value = row dependentSub.value = row
bindWindowOpen.value = true bindWindowOpen.value = true
} }
const confirmRevise = val => { // 修改弹窗确认按钮事件 const confirmRevise = val => { // 修改弹窗确认按钮事件
alterWeatherMagData(val).then(res=>{ console.log('修改数据',val)
getData() // alterWeatherMagData(val).then(res=>{
reviseWindowOpen.value = false // getData()
}) // reviseWindowOpen.value = false
// ElMessage({
// message: '修改成功.',
// type: 'success',
// })
// }).catch(err=>{
// ElMessage({
// message: '修改失败.',
// type: 'error',
// })
// })
} }
const confirmBind = val => { const confirmBind = val => {
bindWindowOpen.value = false bindWindowOpen.value = false
...@@ -43,15 +51,26 @@ onMounted(() => { ...@@ -43,15 +51,26 @@ onMounted(() => {
function getData() { function getData() {
getWeatherMagData().then(res => { getWeatherMagData().then(res => {
data.value = res.data data.value = res.data
console.log("所有数据",data.value)
}) })
} }
function handleAddWinOpenClose(){ function handleAddWinOpenClose(){
addWindowOpen.value = false addWindowOpen.value = false
} }
function handleAdd(val){ function handleAdd(val){
console.log("新增数据",val)
alterWeatherMagData(val).then(res=>{ alterWeatherMagData(val).then(res=>{
getData() getData()
addWindowOpen.value = false addWindowOpen.value = false
ElMessage({
message: '新增成功.',
type: 'success',
})
}).catch(err=>{
ElMessage({
message: '新增失败.',
type: 'error',
})
}) })
} // 新增数据提交 } // 新增数据提交
</script> </script>
...@@ -88,13 +107,10 @@ function handleAdd(val){ ...@@ -88,13 +107,10 @@ function handleAdd(val){
<el-table-column prop="diffPercentage" label="自动偏差百分比" width="170"/> <el-table-column prop="diffPercentage" label="自动偏差百分比" width="170"/>
<el-table-column prop="timeoutMin" label="验证时间" width="100"/> <el-table-column prop="timeoutMin" label="验证时间" width="100"/>
<el-table-column prop="tempRegulation" label="调节温度" width="100"/> <el-table-column prop="tempRegulation" label="调节温度" width="100"/>
<el-table-column prop="sort" label="排序" width="60"/> <el-table-column prop="sort" sortable label="排序" width="60"/>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template #default="scope"> <template #default="scope">
<div class="table-operate-column"> <div class="table-operate-column">
<!-- <el-link :underline="false" @click="revise(scope.row)" type="primary">修改</el-link>-->
<!-- <el-link :underline="false" @click="bind(scope.row)" type="primary">绑定换热站</el-link>-->
<!-- <el-link :underline="false" type="primary">详情</el-link>-->
<el-button link @click="revise(scope.row)" type="primary">修改</el-button> <el-button link @click="revise(scope.row)" type="primary">修改</el-button>
<el-button link @click="bind(scope.row)" type="primary">绑定换热站</el-button> <el-button link @click="bind(scope.row)" type="primary">绑定换热站</el-button>
<el-button link type="primary">详情</el-button> <el-button link type="primary">详情</el-button>
......
<script setup> <script setup>
import {onMounted, ref, watch, watchEffect} from "vue"; import {onMounted, ref, watch, watchEffect} from "vue";
import {ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getWind, deleteWind, alterWind, addWind} from "@/api/scheduling.js" import {getWind, deleteWind, alterWind, addWind} from "@/api/scheduling.js"
const data = ref() const data = ref()
...@@ -37,8 +37,16 @@ function omit(val) { ...@@ -37,8 +37,16 @@ function omit(val) {
).then(() => { ).then(() => {
deleteWind(id).then(res => { deleteWind(id).then(res => {
getData() getData()
ElMessage({
message: '删除成功.',
type: 'success',
})
}) })
}).catch(err => { }).catch(err => {
ElMessage({
message: '删除失败.',
type: 'error',
})
}) })
} // 删除按钮单击事件 } // 删除按钮单击事件
function search() { function search() {
...@@ -57,13 +65,31 @@ function onReviseSubmit() { ...@@ -57,13 +65,31 @@ function onReviseSubmit() {
alterWind(reviseForm.value).then(res => { alterWind(reviseForm.value).then(res => {
getData() getData()
handleClose() handleClose()
ElMessage({
message: '修改成功.',
type: 'success',
})
}).catch(err=>{
ElMessage({
message: '修改失败.',
type: 'error',
})
}) })
} // 修改表单提交 } // 修改表单提交
function onAddSubmit() { function onAddSubmit() {
addWind(addForm.value).then(res => { addWind(addForm.value).then(res => {
getData() getData()
handleClose() handleClose()
}) ElMessage({
message: '新增成功.',
type: 'success',
})
}).catch(err=>[
ElMessage({
message: '新增失败.',
type: 'error',
})
])
} // 新增表单提交 } // 新增表单提交
onMounted(() => { onMounted(() => {
......
...@@ -31,45 +31,13 @@ const inputStyle = { ...@@ -31,45 +31,13 @@ const inputStyle = {
height: '24px' height: '24px'
} }
function handleClose() { function handleClose() {
addData.value = { resetInput()
customizeName: '', // 自定义名称
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
temperature: '', // 温度
wind: '', // 风速
illumination: '', // 光照
sort: '', // 排序
isAuto: false, // 是否自动模式
diffPercentage: '', // 自动偏差百分比
timeoutMin: '', // 自动验证循环时间
tempRegulation: '', // 自动调节温度
operateTime:"", // 操作时间
description: null, // 排序字段,全为Null
updateNullField:"", // 无用,但不为空
isActive:false, // 是否启用
supplyId:'', // 供热站编号
}
emit('onCancel') emit('onCancel')
} }
function handleConfirm() { function handleConfirm() {
addData.value.operateTime = getCurrentDateTime() addData.value.operateTime = getCurrentDateTime()
emit('onConfirm',addData.value) emit('onConfirm',addData.value)
addData.value = { resetInput()
customizeName: '', // 自定义名称
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
temperature: '', // 温度
wind: '', // 风速
illumination: '', // 光照
sort: '', // 排序
isAuto: false, // 是否自动模式
diffPercentage: '', // 自动偏差百分比
timeoutMin: '', // 自动验证循环时间
tempRegulation: '', // 自动调节温度
operateTime:"", // 操作时间
description: null, // 排序字段,全为Null
updateNullField:"", // 无用,但不为空
isActive:false, // 是否启用
supplyId:'', // 供热站编号
}
} }
function getCurrentDateTime() { function getCurrentDateTime() {
const now = new Date(); const now = new Date();
...@@ -82,6 +50,25 @@ function getCurrentDateTime() { ...@@ -82,6 +50,25 @@ function getCurrentDateTime() {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} // 生成时间 } // 生成时间
function resetInput(){
addData.value={
transfers:[], // 换热站
customizeName: '', // 自定义名称
diffPercentage: '', // 自动偏差百分比
illumination: '', // 光照
isAuto: false, // 是否自动模式
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime:"", // 操作时间
sort: '', // 排序
tempRegulation: '', // 自动调节温度
temperature: '', // 温度
timeoutMin: '', // 自动验证循环时间
wind: '', // 风速
description: null, // 排序字段,全为Null
updateNullFields:"", // 无用,但不为空
isActive:false, // 是否启用
}
}
</script> </script>
<template> <template>
......
<script setup> <script setup>
import {ref, defineProps, defineEmits, watchEffect} from "vue"; import {ref, defineProps, defineEmits, watchEffect, onMounted} from "vue";
import http from "@/api/http.js";
import store from "@/store/index.js";
const props = defineProps({ const props = defineProps({
open: { open: {
...@@ -52,7 +54,10 @@ const heatExchangeList = ref([ ...@@ -52,7 +54,10 @@ const heatExchangeList = ref([
'开元里', '开元里',
'振业里' '振业里'
]) // 换热站列表 ]) // 换热站列表
onMounted(()=>{
// let result = store.getters.getEnterprise()
// console.log("绑定窗口挂载",result)
})
const onSubmit = ()=>{ const onSubmit = ()=>{
emit('onConfirm', bindData) emit('onConfirm', bindData)
} // 点击保存按钮 } // 点击保存按钮
......
...@@ -39,6 +39,10 @@ const switchingisAuto = computed({ ...@@ -39,6 +39,10 @@ const switchingisAuto = computed({
} }
} }
}) // 可写计算属性,手动、自动模式切换 }) // 可写计算属性,手动、自动模式切换
function onOpen(){
console.log('props.data数据',props.data)
console.log('修改弹窗接收到的数据',reviseData.value)
}
</script> </script>
<template> <template>
...@@ -46,7 +50,8 @@ const switchingisAuto = computed({ ...@@ -46,7 +50,8 @@ const switchingisAuto = computed({
v-model="props.open" v-model="props.open"
width="1000px" width="1000px"
title="自定义修改" title="自定义修改"
@close="emit('onCancel')"> @close="emit('onCancel')"
@open="onOpen">
<template #default> <template #default>
<div class="dialog-content"> <div class="dialog-content">
<el-row style="border-top: #a6c3e9 1px solid"> <el-row style="border-top: #a6c3e9 1px solid">
......
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