Commit 253e9fee authored by jiaxu.yan's avatar jiaxu.yan

feat: 气象干预类型修改

parent cb391db4
......@@ -203,7 +203,6 @@ import { ElMessage } from "element-plus";
const options = reactive([]);
import store from "../../store/index";
import { vFloatNumber } from "@/utils/directives.js";
import { load } from "@amap/amap-jsapi-loader";
import { ElLoading } from "element-plus";
const form = ref({
types: [],
......
<script setup>
import {ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect} from "vue";
import {
ref,
defineProps,
defineEmits,
computed,
isRef,
onMounted,
watchEffect,
} from "vue";
import { vFloatNumber } from "@/utils/directives.js";
const props = defineProps({
open: {
type: Boolean,
default: false,
required: true
}
})
const emit = defineEmits(['onCancel','onConfirm'])
required: true,
},
});
const emit = defineEmits(["onCancel", "onConfirm"]);
const addData = ref({
transfers:[], // 换热站
customizeName: '', // 自定义名称
diffPercentage: '', // 自动偏差百分比
illumination: '', // 光照
transfers: [], // 换热站
customizeName: "", // 自定义名称
diffPercentage: "", // 自动偏差百分比
illumination: "", // 光照
isAuto: false, // 是否自动模式
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime:"", // 操作时间
sort: '', // 排序
tempRegulation: '', // 自动调节温度
temperature: '', // 温度
timeoutMin: '', // 自动验证循环时间
wind: '', // 风速
description: null, // 排序字段,全为Null
updateNullFields:"", // 无用,但不为空
isActive:false, // 是否启用
})
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime: "", // 操作时间
sort: "", // 排序
tempRegulation: "", // 自动调节温度
temperature: "", // 温度
timeoutMin: "", // 自动验证循环时间
wind: "", // 风速
description: null, // 排序字段,全为Null
updateNullFields: "", // 无用,但不为空
isActive: false, // 是否启用
});
const inputStyle = {
color: 'black',
height: '24px'
}
color: "black",
height: "24px",
};
function handleClose() {
resetInput()
emit('onCancel')
resetInput();
emit("onCancel");
}
function handleConfirm() {
addData.value.operateTime = getCurrentDateTime()
emit('onConfirm',addData.value)
resetInput()
addData.value.operateTime = getCurrentDateTime();
emit("onConfirm", addData.value);
resetInput();
}
function getCurrentDateTime() {
const now = new Date();
const year = now.getFullYear();
const month = ('0' + (now.getMonth() + 1)).slice(-2); // 月份从0开始,所以加1
const day = ('0' + now.getDate()).slice(-2);
const hours = ('0' + now.getHours()).slice(-2);
const minutes = ('0' + now.getMinutes()).slice(-2);
const seconds = ('0' + now.getSeconds()).slice(-2);
const month = ("0" + (now.getMonth() + 1)).slice(-2); // 月份从0开始,所以加1
const day = ("0" + now.getDate()).slice(-2);
const hours = ("0" + now.getHours()).slice(-2);
const minutes = ("0" + now.getMinutes()).slice(-2);
const seconds = ("0" + now.getSeconds()).slice(-2);
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} // 生成时间
function resetInput(){
addData.value={
transfers:[], // 换热站
customizeName: '', // 自定义名称
diffPercentage: '', // 自动偏差百分比
illumination: '', // 光照
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, // 是否启用
}
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime: "", // 操作时间
sort: "", // 排序
tempRegulation: "", // 自动调节温度
temperature: "", // 温度
timeoutMin: "", // 自动验证循环时间
wind: "", // 风速
description: null, // 排序字段,全为Null
updateNullFields: "", // 无用,但不为空
isActive: false, // 是否启用
};
}
</script>
<template>
<el-dialog
v-model="props.open"
width="1000px"
title="新增"
@close="emit('onCancel')">
v-model="props.open"
width="1000px"
title="新增"
@close="emit('onCancel')"
>
<template #default>
<div class="dialog-content">
<el-row style="border-top: #a6c3e9 1px solid">
<el-col :span="8" class="content-col-label">自定义名称:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.customizeName" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-model="addData.customizeName"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">干预模式:</el-col>
<el-col :span="16" class="content-col-value">
<el-radio-group v-model="addData.isFixed">
<el-radio :value="true" :style="{marginLeft:'10px'}">固定模式</el-radio>
<el-radio :value="false" :style="{marginLeft:'-15px'}">气象仪模式</el-radio>
<el-radio :value="true" :style="{ marginLeft: '10px' }"
>固定模式</el-radio
>
<el-radio :value="false" :style="{ marginLeft: '-15px' }"
>气象仪模式</el-radio
>
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">温度:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.temperature" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.temperature"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">风速:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.wind" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.wind"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.illumination" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.illumination"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">排序:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.sort" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.sort"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="content-col-label">切换自动模式:</el-col>
<el-col :span="7" class="content-col-value">
<el-checkbox :style="{marginLeft:'10px'}" v-model="addData.isAuto" label="自动模式"/>
<el-checkbox
:style="{ marginLeft: '10px' }"
v-model="addData.isAuto"
label="自动模式"
/>
</el-col>
<el-col :span="5" class="content-col-label">自动偏差百分比(%d):</el-col>
<el-col :span="5" class="content-col-label"
>自动偏差百分比(%d):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.diffPercentage" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.diffPercentage"
style="width: 240px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="content-col-label">自动验证循环时间(分钟):</el-col>
<el-col :span="5" class="content-col-label"
>自动验证循环时间(分钟):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.timeoutMin" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.timeoutMin"
style="width: 240px"
/>
</el-col>
<el-col :span="5" class="content-col-label">自动调节温度(℃):</el-col>
<el-col :span="5" class="content-col-label"
>自动调节温度(℃):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.tempRegulation" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="addData.tempRegulation"
style="width: 240px"
/>
</el-col>
</el-row>
</div>
......@@ -150,7 +212,6 @@ function resetInput(){
</template>
<style scoped>
.el-row {
color: black;
height: 35px;
......@@ -178,10 +239,10 @@ function resetInput(){
.el-input {
color: black;
}
.el-radio{
.el-radio {
color: black;
}
.el-checkbox{
.el-checkbox {
color: black;
}
</style>
\ No newline at end of file
</style>
<script setup>
import {ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect} from "vue";
import { vFloatNumber } from "@/utils/directives.js";
import {
ref,
defineProps,
defineEmits,
computed,
isRef,
onMounted,
watchEffect,
} from "vue";
const props = defineProps({
open: {
type: Boolean,
default: false,
required: true
required: true,
},
data: {
type: Object,
default: {},
required:true
}
})
required: true,
},
});
const emit = defineEmits({
onCancel: null,
onConfirm: data => {
return true
}
})
const reviseData = ref({})
watchEffect(()=>{
reviseData.value = {...props.data}
})
onConfirm: (data) => {
return true;
},
});
const reviseData = ref({});
watchEffect(() => {
reviseData.value = { ...props.data };
});
const inputStyle = {
color: 'black',
height: '24px'
}
color: "black",
height: "24px",
};
const switchingisAuto = computed({
get() {
return reviseData.value.isAuto === '自动模式'
return reviseData.value.isAuto === "自动模式";
},
set(newValue) {
if (newValue) {
reviseData.value.isAuto = '自动模式'
reviseData.value.isAuto = "自动模式";
} else {
reviseData.value.isAuto = '手动模式'
reviseData.value.isAuto = "手动模式";
}
}
}) // 可写计算属性,手动、自动模式切换
function onOpen(){
console.log('props.data数据',props.data)
console.log('修改弹窗接收到的数据',reviseData.value)
},
}); // 可写计算属性,手动、自动模式切换
function onOpen() {
console.log("props.data数据", props.data);
console.log("修改弹窗接收到的数据", reviseData.value);
}
</script>
<template>
<el-dialog
v-model="props.open"
width="1000px"
title="自定义修改"
@close="emit('onCancel')"
@open="onOpen">
v-model="props.open"
width="1000px"
title="自定义修改"
@close="emit('onCancel')"
@open="onOpen"
>
<template #default>
<div class="dialog-content">
<el-row style="border-top: #a6c3e9 1px solid">
<el-col :span="8" class="content-col-label">自定义名称:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.customizeName" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-model="reviseData.customizeName"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">干预模式:</el-col>
<el-col :span="16" class="content-col-value">
<el-radio-group v-model="reviseData.isFixed">
<el-radio value="固定模式" :style="{marginLeft:'10px'}">固定模式</el-radio>
<el-radio value="气象仪模式" :style="{marginLeft:'-15px'}">气象仪模式</el-radio>
<el-radio value="固定模式" :style="{ marginLeft: '10px' }"
>固定模式</el-radio
>
<el-radio value="气象仪模式" :style="{ marginLeft: '-15px' }"
>气象仪模式</el-radio
>
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">温度:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.temperature" style="width: 510px"/>
<el-input
v-float-number
:input-style="inputStyle"
v-model="reviseData.temperature"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">风速:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.wind" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="reviseData.wind"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.illumination" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="reviseData.illumination"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="8" class="content-col-label">排序:</el-col>
<el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.sort" style="width: 510px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="reviseData.sort"
style="width: 510px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="content-col-label">切换自动模式:</el-col>
<el-col :span="7" class="content-col-value">
<el-checkbox :style="{marginLeft:'10px'}" v-model="switchingisAuto" label="自动模式"/>
<el-checkbox
:style="{ marginLeft: '10px' }"
v-model="switchingisAuto"
label="自动模式"
/>
</el-col>
<el-col :span="5" class="content-col-label">自动偏差百分比(%d):</el-col>
<el-col :span="5" class="content-col-label"
>自动偏差百分比(%d):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.diffPercentage" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="reviseData.diffPercentage"
style="width: 240px"
/>
</el-col>
</el-row>
<el-row>
<el-col :span="5" class="content-col-label">自动验证循环时间(分钟):</el-col>
<el-col :span="5" class="content-col-label"
>自动验证循环时间(分钟):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.timeoutMin" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-model="reviseData.timeoutMin"
style="width: 240px"
/>
</el-col>
<el-col :span="5" class="content-col-label">自动调节温度(℃):</el-col>
<el-col :span="5" class="content-col-label"
>自动调节温度(℃):</el-col
>
<el-col :span="7" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.tempRegulation" style="width: 240px"/>
<el-input
:input-style="inputStyle"
v-float-number
v-model="reviseData.tempRegulation"
style="width: 240px"
/>
</el-col>
</el-row>
</div>
</template>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="emit('onConfirm', reviseData)">保存</el-button>
<el-button type="primary" @click="emit('onConfirm', reviseData)"
>保存</el-button
>
<el-button type="primary" @click="emit('onCancel')">关闭</el-button>
</div>
</template>
......@@ -125,7 +189,6 @@ function onOpen(){
</template>
<style scoped>
.el-row {
color: black;
height: 35px;
......@@ -153,10 +216,10 @@ function onOpen(){
.el-input {
color: black;
}
.el-radio{
.el-radio {
color: black;
}
.el-checkbox{
.el-checkbox {
color: black;
}
</style>
\ No newline at end of file
</style>
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