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

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

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