Commit 0759a1c5 authored by jiaxu.yan's avatar jiaxu.yan

feat: 调度管理二次提交

parent 13451151
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
"jsencrypt": "^3.3.2", "jsencrypt": "^3.3.2",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"less": "^4.2.0", "less": "^4.2.0",
"lodash": "^4.17.21",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"node-sass": "^9.0.0", "node-sass": "^9.0.0",
"public-ip": "^6.0.2", "public-ip": "^6.0.2",
......
...@@ -77,7 +77,7 @@ export const alterWeatherMagData = params => { // 添加或修改气象干预数 ...@@ -77,7 +77,7 @@ export const alterWeatherMagData = params => { // 添加或修改气象干预数
return http.post(`/api/cusweather/SaveAll`, params) return http.post(`/api/cusweather/SaveAll`, params)
} }
export const getTransfer = param => { // 获取换热站列表 export const getTransferInterface = param => { // 获取换热站列表
return http.post("/api/cusweather/getTransferIds",param) return http.post("/api/cusweather/getTransferIds",param)
} }
......
This diff is collapsed.
...@@ -5,83 +5,84 @@ ...@@ -5,83 +5,84 @@
<div class="card-header"> <div class="card-header">
<span>瞬时热量对比配置</span> <span>瞬时热量对比配置</span>
</div> </div>
<el-form ref="formRef" :rules="rules" :model="List" label-width="auto">
<table v-loading="loading" cellpadding="0" cellspacing="1">
<table cellpadding="0" cellspacing="1">
<tr> <tr>
<th style="width: 25%">计划名称:</th> <th style="width: 25%">计划名称</th>
<td style="width: 60%; margin:0; padding: 0"> <td style="width: 60%; margin:0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="planName" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.planName"></el-input> <el-input style="width: 80%" v-model="List.planName"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<th style="width: 25%">偏差百分比 (%):</th> <th style="width: 25%">偏差百分比 (%)</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="diffPercentage" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%" v-model="List.diffPercentage"></el-input> <el-input v-float-number style="width: 80%" v-model="List.diffPercentage"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<th style="width: 25%">判断时间 (分):</th> <th style="width: 25%">判断时间 (分)</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="timeoutMin" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.timeoutMin"></el-input> <el-input style="width: 80%" v-model="List.timeoutMin"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<th style="width: 25%">调节温度 (℃)</th> <th style="width: 25%">调节温度 (℃)</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input v-float-number style="width: 80%" v-model="List.tempRegulation"></el-input> <el-form-item prop="tempRegulation" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.tempRegulation"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<th style="width: 25%">备注</th> <th style="width: 25%">备注</th>
<td style="width: 60%; margin: 0; padding: 0"> <td style="width: 60%; margin: 0; padding: 0">
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="description" style="padding: 0;margin: 0;">
<el-input style="width: 80%" type="textarea" rows="6" v-model="List.description"></el-input> <el-input style="width: 80%" type="textarea" rows="6" v-model="List.description"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</el-form>
<div class="btngrounp"> <div class="btngrounp">
<el-button type="primary" @click="onSave">保存</el-button> <el-button type="primary" @click="onSave">保存</el-button>
<el-button type="primary" style="margin: 0 0 0 5px" @click="onCancel">关闭</el-button> <el-button type="primary" style="margin: 0 0 0 5px" @click="onCancel">关闭</el-button>
</div> </div>
</el-card> </el-card>
</div> </div>
</div> </div>
...@@ -94,9 +95,9 @@ import { ElMessage } from "element-plus"; ...@@ -94,9 +95,9 @@ import { ElMessage } from "element-plus";
import http from "../../api/http"; import http from "../../api/http";
import { vFloatNumber } from "@/utils/directives.js"; import { vFloatNumber } from "@/utils/directives.js";
const loading = ref(false) const loading = ref(false)
const formRef = ref()
const List = ref(
const List = ref([
{ {
"planId": "", "planId": "",
"planName": "", "planName": "",
...@@ -106,25 +107,46 @@ const List = ref([ ...@@ -106,25 +107,46 @@ const List = ref([
"description": "", "description": "",
"isActive": '' "isActive": ''
} }
]) )
//校验规则
const rules = reactive({
const getInstanceHeat = async () => { planName: [
{ pattern: /^.{1,20}$/, "message": "计划名称必须是1-20位字符", trigger: "blur" }
],
diffPercentage: [
{ pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" }
],
timeoutMin: [
{ pattern: /^(\d{1,10})$/, "message": "判断时间必须是1-10位正整数", trigger: "blur" }
],
tempRegulation: [
{ pattern: /^(-?\d{1,10})(\.[0-9]{1,4})?$/, message: "请输入正确的调节温度最大值", trigger: "blur" }
],
description: [
{ pattern: /^.{1,50}$/, "message": "备注必须是1-50位字符", trigger: "blur" }
]
});
const getInstanceHeat = () => {
loading.value = true loading.value = true
const data = await postInstantHeat(); http.post("api/Scheduling/BizInstantaneousHeat/Get", false).then(res => {
console.log(data); if (res.success) {
List.value = data.data[0] List.value = res.data[0]
console.log("res.data===>", res.data);
loading.value = false loading.value = false
}
})
} }
const onSave = async () => { const onSave = async () => {
// await postInstantHeatUpdate(List.value) await formRef.value.validate()
await http.post("/api/Scheduling/BizInstantaneousHeat/Update", { ...List.value }, false).then((res) => {
await http.post("/api/Scheduling/BizInstantaneousHeat/Update", { ...List.value }, false).then((result) => { if (res.success) {
ElMessage.success(res.message)
getInstanceHeat()
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
ElMessage.success('修改成功')
getInstanceHeat()
} }
onMounted(() => { onMounted(() => {
getInstanceHeat() getInstanceHeat()
......
This diff is collapsed.
<script setup> <script setup>
import {computed, isRef, onMounted, reactive, ref, shallowRef} from "vue"; import {computed, isRef, onBeforeMount, onMounted, reactive, ref, shallowRef} from "vue";
import ReviseWindow from "./weatherManageSub/ReviseWindow.vue"; import ReviseWindow from "./weatherManageSub/ReviseWindow.vue";
import BindWindow from "./weatherManageSub/BindWindow.vue"; import BindWindow from "./weatherManageSub/BindWindow.vue";
import {getWeatherMagData, alterWeatherMagData, deleteWeatherMagData} from '@/api/scheduling.js' import {
getWeatherMagData,
alterWeatherMagData,
deleteWeatherMagData,
getOrganizationStructureInterface
} from '@/api/scheduling.js'
import AddWindow from "./weatherManageSub/AddWindow.vue"; import AddWindow from "./weatherManageSub/AddWindow.vue";
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import store from "@/store/index.js";
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import {vFloatNumber} from "@/utils/directives.js";
const data = ref() const data = ref()
const dataBackup = 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) // 新增按钮弹窗状态
...@@ -20,7 +24,32 @@ const tableHeaderClass = data => { // 表头样式 ...@@ -20,7 +24,32 @@ const tableHeaderClass = data => { // 表头样式
const tableBodyClass = data => { // 表体样式 const tableBodyClass = data => { // 表体样式
return 'table-body-class' return 'table-body-class'
} }
const isAutoSearchKey = ref() // 手自动模式查询
const supplySearchKey = ref() // 供热站查询
const organizationStructure = ref([]) // 组织结构数据
const supplyData = ref([]) // 供热站数据
function search() {
if(!isAutoSearchKey.value && !supplySearchKey.value){
getData()
}else {
if(isAutoSearchKey.value && supplySearchKey.value){
data.value = dataBackup.value.filter(item => {
return item.isAuto === isAutoSearchKey.value && item.supplyName.includes(supplySearchKey.value)
})
}else {
if(isAutoSearchKey.value){
data.value = dataBackup.value.filter(item => {
return item.isAuto === isAutoSearchKey.value
})
}else {
data.value = dataBackup.value.filter(item => {
return item.supplyName.includes(supplySearchKey.value)
})
}
}
}
}
const revise = (row) => { // 修改按钮单击事件 const revise = (row) => { // 修改按钮单击事件
dependentSub.value = row dependentSub.value = row
reviseWindowOpen.value = true reviseWindowOpen.value = true
...@@ -29,6 +58,10 @@ const bind = (row) => { // 绑定按钮单击事件 ...@@ -29,6 +58,10 @@ const bind = (row) => { // 绑定按钮单击事件
dependentSub.value = row dependentSub.value = row
bindWindowOpen.value = true bindWindowOpen.value = true
} }
const cancelRevise = ()=>{
reviseWindowOpen.value = false
getData()
}
const confirmRevise = val => { // 修改弹窗确认按钮事件 const confirmRevise = val => { // 修改弹窗确认按钮事件
let params = cloneDeep(val) let params = cloneDeep(val)
params.isAuto = params.isAuto === '自动模式' ? true : false params.isAuto = params.isAuto === '自动模式' ? true : false
...@@ -48,7 +81,7 @@ const confirmRevise = val => { // 修改弹窗确认按钮事件 ...@@ -48,7 +81,7 @@ const confirmRevise = val => { // 修改弹窗确认按钮事件
}) })
}else { }else {
ElMessage({ ElMessage({
message: '修改失败.', message: res.message,
type: 'error', type: 'error',
}) })
} }
...@@ -76,7 +109,7 @@ const confirmBind = val => { ...@@ -76,7 +109,7 @@ const confirmBind = val => {
bindWindowOpen.value = false bindWindowOpen.value = false
}else { }else {
ElMessage({ ElMessage({
message: '绑定失败.', message: res.message,
type: 'error', type: 'error',
}) })
} }
...@@ -94,30 +127,31 @@ const onCancelBind = () => { ...@@ -94,30 +127,31 @@ const onCancelBind = () => {
bindWindowOpen.value = false bindWindowOpen.value = false
getData() getData()
} }
onMounted(() => { onBeforeMount(()=>{
getData() getData()
getOrganizationStructure()
}) })
function getData() { function getData() {
getWeatherMagData().then(res => { getWeatherMagData().then(res => {
data.value = res.data data.value = res.data
dataBackup.value = [...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=>{
if(res.success){ if(res.success){
getData()
addWindowOpen.value = false
ElMessage({ ElMessage({
message: '新增成功.', message: res.message,
type: 'success', type: 'success',
}) })
addWindowOpen.value = false
getData()
}else { }else {
ElMessage({ ElMessage({
message: '新增失败.', message: res.message,
type: 'error', type: 'error',
}) })
} }
...@@ -139,17 +173,54 @@ function getCurrentDateTime() { ...@@ -139,17 +173,54 @@ function getCurrentDateTime() {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} // 生成时间 } // 生成时间
function getSupply() {
supplyData.value = []
organizationStructure.value[0].serviceCenterList.forEach(fir_item => {
fir_item.supplyList.forEach(sec_item => {
let temp = {
supplyId: sec_item.supplyId,
supplyName: sec_item.supplyName,
}
supplyData.value.push({...temp})
})
})
} // 根据组织结构获取供热站数据
function getOrganizationStructure() {
getOrganizationStructureInterface().then(res => {
organizationStructure.value = res.data
getSupply()
}).catch(err => {
ElMessage.error('接口异常,获取数据失败.')
})
} // 获取组织结构
function resetSearch(){
isAutoSearchKey.value = ''
supplySearchKey.value = ''
getData()
}
</script> </script>
<template> <template>
<div class="weather-manage-container"> <div class="weather-manage-container">
<el-row> <el-row>
<el-col :span="15" left-col> <el-col :span="15" left-col>
<el-button type="primary" @click="addWindowOpen = true" class="add-btn">新增</el-button> <div class="isAuto-search-area">
<el-button type="primary" @click="getData">查询</el-button> 手自动模式:
<el-select v-model="isAutoSearchKey" style="width: 220px" placeholder="请选择手自动模式" clearable>
<el-option :label="手动模式" value="手动模式"/>
<el-option :label="自动模式" value="自动模式"/>
</el-select>
</div>
<div class="supplyName-search-area">
供热站名称:
<el-input v-model="supplySearchKey" placeholder="请输入供热站名称" clearable style="width: 220px"/>
</div>
</el-col> </el-col>
<el-col :span="9" right-col> <el-col :span="7" right-col>
<el-button type="primary" @click="addWindowOpen = true" class="add-btn">新增</el-button>
<el-button type="primary" @click="search">查询</el-button>
<el-button type="primary" @click="resetSearch">重置</el-button>
</el-col> </el-col>
</el-row> </el-row>
<div class="table-wrapper"> <div class="table-wrapper">
...@@ -158,7 +229,8 @@ function getCurrentDateTime() { ...@@ -158,7 +229,8 @@ function getCurrentDateTime() {
stripe stripe
border border
style="width: 100%" style="width: 100%"
height="900px" height="720px"
:default-sort="{ prop: 'operateTime', order: 'descending' }"
:header-cell-class-name="tableHeaderClass" :header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass"> :row-class-name="tableBodyClass">
<el-table-column prop="allowPagingId" label="编号" align="center" width="60"/> <el-table-column prop="allowPagingId" label="编号" align="center" width="60"/>
...@@ -179,7 +251,6 @@ function getCurrentDateTime() { ...@@ -179,7 +251,6 @@ function getCurrentDateTime() {
<div class="table-operate-column"> <div class="table-operate-column">
<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>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -193,28 +264,38 @@ function getCurrentDateTime() { ...@@ -193,28 +264,38 @@ function getCurrentDateTime() {
<ReviseWindow <ReviseWindow
:open="reviseWindowOpen" :open="reviseWindowOpen"
:data="dependentSub" :data="dependentSub"
@onCancel="reviseWindowOpen = false" @onCancel="cancelRevise"
@onConfirm="confirmRevise" @onConfirm="confirmRevise"
></ReviseWindow> ></ReviseWindow>
<BindWindow <BindWindow
:open="bindWindowOpen" :open="bindWindowOpen"
:data="dependentSub" :data="dependentSub"
:supply="supplyData"
@onCancel="onCancelBind" @onCancel="onCancelBind"
@onConfirm="confirmBind"></BindWindow> @onConfirm="confirmBind"></BindWindow>
</div> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.weather-manage-container { .weather-manage-container {
width: 100%; width: 100%;
margin: 4px;
} }
.el-col[left-col] { .el-col[left-col]{
border-right: 1px solid #a6c3e9; border-right: 1px solid #a6c3e9;
display: flex;
align-items: center;
justify-content: start;
padding-left: 20px;
font-size: 14px;
.isAuto-search-area{
margin-right: 20px;
}
.supplyName-search-area{
}
} }
.el-row { .el-row {
......
This diff is collapsed.
<script setup> <script setup>
import {ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect} from "vue"; import { ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect, reactive } from "vue";
import {vFloatNumber} from "@/utils/directives.js"; import { vFloatNumber } from "@/utils/directives.js";
const props = defineProps({ const props = defineProps({
open: { open: {
...@@ -9,23 +9,23 @@ const props = defineProps({ ...@@ -9,23 +9,23 @@ const props = defineProps({
required: true required: true
} }
}) })
const emit = defineEmits(['onCancel','onConfirm']) const emit = defineEmits(['onCancel', 'onConfirm'])
const addData = ref({ const addData = ref({
transfers:[], // 换热站 transfers: [], // 换热站
customizeName: '', // 自定义名称 customizeName: '', // 自定义名称
diffPercentage: '', // 自动偏差百分比 diffPercentage: '', // 自动偏差百分比
illumination: '', // 光照 illumination: '', // 光照
isAuto: false, // 是否自动模式 isAuto: false, // 是否自动模式
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式 isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime:"", // 操作时间 operateTime: "", // 操作时间
sort: '', // 排序 sort: '', // 排序
tempRegulation: '', // 自动调节温度 tempRegulation: '', // 自动调节温度
temperature: '', // 温度 temperature: '', // 温度
timeoutMin: '', // 自动验证循环时间 timeoutMin: '', // 自动验证循环时间
wind: '', // 风速 wind: '', // 风速
description: null, // 排序字段,全为Null description: null, // 排序字段,全为Null
updateNullFields:"", // 无用,但不为空 updateNullFields: "", // 无用,但不为空
isActive:false, // 是否启用 isActive: false, // 是否启用
}) })
const inputStyle = { const inputStyle = {
color: 'black', color: 'black',
...@@ -36,9 +36,13 @@ function handleClose() { ...@@ -36,9 +36,13 @@ function handleClose() {
emit('onCancel') emit('onCancel')
} }
function handleConfirm() { function handleConfirm() {
formRef.value.validate(valid=>{
if(valid){
addData.value.operateTime = getCurrentDateTime() addData.value.operateTime = getCurrentDateTime()
emit('onConfirm',addData.value) emit('onConfirm', addData.value)
resetInput() resetInput()
}
})
} }
function getCurrentDateTime() { function getCurrentDateTime() {
const now = new Date(); const now = new Date();
...@@ -51,94 +55,148 @@ function getCurrentDateTime() { ...@@ -51,94 +55,148 @@ function getCurrentDateTime() {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} // 生成时间 } // 生成时间
function resetInput(){ function onOpen() {
addData.value={ resetInput()
transfers:[], // 换热站 formRef.value.resetFields()
}
function resetInput() {
addData.value = {
transfers: [], // 换热站
customizeName: '', // 自定义名称 customizeName: '', // 自定义名称
diffPercentage: '', // 自动偏差百分比 diffPercentage: '', // 自动偏差百分比
illumination: '', // 光照 illumination: '', // 光照
isAuto: false, // 是否自动模式 isAuto: false, // 是否自动模式
isFixed: false, // 干预模式:true 固定模式,false 气象仪模式 isFixed: false, // 干预模式:true 固定模式,false 气象仪模式
operateTime:"", // 操作时间 operateTime: "", // 操作时间
sort: '', // 排序 sort: '', // 排序
tempRegulation: '', // 自动调节温度 tempRegulation: '', // 自动调节温度
temperature: '', // 温度 temperature: '', // 温度
timeoutMin: '', // 自动验证循环时间 timeoutMin: '', // 自动验证循环时间
wind: '', // 风速 wind: '', // 风速
description: null, // 排序字段,全为Null description: null, // 排序字段,全为Null
updateNullFields:"", // 无用,但不为空 updateNullFields: "", // 无用,但不为空
isActive:false, // 是否启用 isActive: false, // 是否启用
} }
} }
const formRef = ref()
//校验规则
const rules = reactive({
diffPercentage: [
{ pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" }
],
wind: [
{ pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur" }
],
illumination: [
{ pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "光照必须是1-11位实数", trigger: "blur" }
],
sort: [
{ pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur" }
],
timeoutMin: [
{ pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "判断时间必须是1-11位实数", trigger: "blur" }
],
temperature: [
{required: true, message: '请输入正确的温度'},
{ pattern: /^(-?\d{1,11})(\.[0-9]{1,4})?$/, message: "请输入正确的温度", trigger: "blur" }
]
});
</script> </script>
<template> <template>
<el-dialog <el-dialog v-model="props.open" width="1000px" title="新增" @close="emit('onCancel')" @open="onOpen">
v-model="props.open"
width="1000px"
title="新增"
@close="emit('onCancel')">
<template #default> <template #default>
<div class="dialog-content"> <div class="dialog-content">
<el-form :rules="rules" ref="formRef" :model="addData" label-width="auto">
<el-row style="border-top: #a6c3e9 1px solid"> <el-row style="border-top: #a6c3e9 1px solid">
<el-col :span="8" class="content-col-label">自定义名称:</el-col> <el-col :span="8" class="content-col-label">自定义名称:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.customizeName" style="width: 510px"/> <el-input maxlength="11" :input-style="inputStyle" v-model="addData.customizeName" style="width: 510px" />
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">干预模式:</el-col> <el-col :span="8" class="content-col-label">干预模式:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-radio-group v-model="addData.isFixed"> <el-radio-group v-model="addData.isFixed">
<el-radio :value="true" :style="{marginLeft:'10px'}">固定模式</el-radio> <el-radio :value="true" :style="{ marginLeft: '10px' }">固定模式</el-radio>
<el-radio :value="false" :style="{marginLeft:'-15px'}">气象仪模式</el-radio> <el-radio :value="false" :style="{ marginLeft: '-15px' }">气象仪模式</el-radio>
</el-radio-group> </el-radio-group>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">温度:</el-col> <el-col :span="8" class="content-col-label">温度:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="addData.temperature" style="width: 510px"/> <el-form-item prop="temperature" style="padding: 0;margin: 0;">
<el-input maxlength="11" :input-style="inputStyle" v-model="addData.temperature" style="width: 510px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">风速:</el-col> <el-col :span="8" class="content-col-label">风速:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.wind" style="width: 510px"/> <el-form-item prop="wind" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="addData.wind" style="width: 510px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">光照:</el-col> <el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.illumination" style="width: 510px"/> <el-form-item prop="illumination" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="addData.illumination"
style="width: 510px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">排序:</el-col> <el-col :span="8" class="content-col-label">排序:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="addData.sort" style="width: 510px"/> <el-form-item prop="sort" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="addData.sort" style="width: 510px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<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-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>
<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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="addData.diffPercentage" style="width: 240px"/> <el-form-item prop="diffPercentage" style="padding: 0;margin: 0;">
<el-input v-float-number :input-style="inputStyle" maxlength="11" v-model="addData.diffPercentage"
style="width: 240px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="addData.timeoutMin" style="width: 240px"/> <el-form-item prop="timeoutMin" style="padding: 0;margin: 0;">
<el-input v-float-number :input-style="inputStyle" maxlength="11" v-model="addData.timeoutMin"
style="width: 240px" />
</el-form-item>
</el-col> </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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="addData.tempRegulation" style="width: 240px"/> <el-form-item prop="tempRegulation" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="addData.tempRegulation"
style="width: 240px" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form>
</div> </div>
</template> </template>
<template #footer> <template #footer>
...@@ -151,7 +209,6 @@ function resetInput(){ ...@@ -151,7 +209,6 @@ function resetInput(){
</template> </template>
<style scoped> <style scoped>
.el-row { .el-row {
color: black; color: black;
height: 35px; height: 35px;
...@@ -179,10 +236,12 @@ function resetInput(){ ...@@ -179,10 +236,12 @@ function resetInput(){
.el-input { .el-input {
color: black; color: black;
} }
.el-radio{
.el-radio {
color: black; color: black;
} }
.el-checkbox{
.el-checkbox {
color: black; color: black;
} }
</style> </style>
\ No newline at end of file
<script setup> <script setup>
import {ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect} from "vue"; import {ref, defineProps, defineEmits, computed, isRef, onMounted, watchEffect, reactive} from "vue";
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import {vFloatNumber} from "@/utils/directives.js"; import {vFloatNumber} from "@/utils/directives.js";
import {getTransferInterface} from "@/api/scheduling.js";
const props = defineProps({ const props = defineProps({
open: { open: {
...@@ -12,7 +14,7 @@ const props = defineProps({ ...@@ -12,7 +14,7 @@ const props = defineProps({
data: { data: {
type: Object, type: Object,
default: {}, default: {},
required:true required: true
} }
}) })
const emit = defineEmits({ const emit = defineEmits({
...@@ -22,7 +24,32 @@ const emit = defineEmits({ ...@@ -22,7 +24,32 @@ const emit = defineEmits({
} }
}) })
const reviseData = ref({}) const reviseData = ref({})
watchEffect(()=>{
const formRef = ref()
//校验规则
const rules = reactive({
diffPercentage: [
{pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur"}
],
wind: [
{pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "风速必须是1-11位实数", trigger: "blur"}
],
illumination: [
{pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "光照必须是1-11位实数", trigger: "blur"}
],
sort: [
{pattern: /^(\d{1,11})$/, "message": "排序必须是1-11位正整数", trigger: "blur"}
],
timeoutMin: [
{pattern: /^(\d{1,11})(\.[0-9]{1,4})?$/, "message": "判断时间必须是1-10位实数", trigger: "blur"}
],
temperature: [
{required: true, message: '请输入正确的温度', trigger: 'blur'},
{pattern: /^(-?\d{1,11})(\.[0-9]{1,4})?$/, message: "请输入正确的温度", trigger: "blur"}
]
});
watchEffect(() => {
// reviseData.value = {...props.data} // reviseData.value = {...props.data}
props.data.transfers = [] props.data.transfers = []
props.data.updateNullFields = '' props.data.updateNullFields = ''
...@@ -44,85 +71,124 @@ const switchingisAuto = computed({ ...@@ -44,85 +71,124 @@ const switchingisAuto = computed({
} }
} }
}) // 可写计算属性,手动、自动模式切换 }) // 可写计算属性,手动、自动模式切换
function onOpen(){ function onOpen() {
// console.log('props.data数据',props.data) formRef.value.resetFields()
// console.log('修改弹窗接收到的数据',reviseData.value) }
async function handleConfirm() {
if (reviseData.value.hasOwnProperty('supplyId')) {
if (reviseData.value.supplyId) {
const result = await getTransferInterface(param)
for (let item of result.data) {
reviseData.value.transfers.push(
{
customizeId: reviseData.value.customizeId,
unitId: item.transferId,
updateNullFields: ''
}
)
}
}
}
formRef.value.validate(valid => {
if (valid) {
emit('onConfirm', reviseData.value)
}
})
} }
</script> </script>
<template> <template>
<el-dialog <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> <template #default>
<div class="dialog-content"> <div class="dialog-content">
<el-form ref="formRef" :model="reviseData" :rules="rules" label-width="auto">
<el-row style="border-top: #a6c3e9 1px solid"> <el-row style="border-top: #a6c3e9 1px solid">
<el-col :span="8" class="content-col-label">自定义名称:</el-col> <el-col :span="8" class="content-col-label">自定义名称:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.customizeName" style="width: 510px"/> <el-input maxlength="11" :input-style="inputStyle" v-model="reviseData.customizeName"
style="width: 510px"/>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">干预模式:</el-col> <el-col :span="8" class="content-col-label">干预模式:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-radio-group v-model="reviseData.isFixed"> <el-radio-group v-model="reviseData.isFixed">
<el-radio value="固定模式" :style="{marginLeft:'10px'}">固定模式</el-radio> <el-radio value="固定模式" :style="{ marginLeft: '10px' }">固定模式</el-radio>
<el-radio value="气象仪模式" :style="{marginLeft:'-15px'}">气象仪模式</el-radio> <el-radio value="气象仪模式" :style="{ marginLeft: '-15px' }">气象仪模式</el-radio>
</el-radio-group> </el-radio-group>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">温度:</el-col> <el-col :span="8" class="content-col-label">温度:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="reviseData.temperature" style="width: 510px"/> <el-form-item prop="temperature" style="padding: 0;margin: 0;">
<el-input maxlength="11" :input-style="inputStyle" v-model="reviseData.temperature"
style="width: 510px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">风速:</el-col> <el-col :span="8" class="content-col-label">风速:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.wind" style="width: 510px"/> <el-form-item prop="wind" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="reviseData.wind" style="width: 510px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">光照:</el-col> <el-col :span="8" class="content-col-label">光照:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.illumination" style="width: 510px"/> <el-form-item prop="illumination" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="reviseData.illumination"
style="width: 510px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" class="content-col-label">排序:</el-col> <el-col :span="8" class="content-col-label">排序:</el-col>
<el-col :span="16" class="content-col-value"> <el-col :span="16" class="content-col-value">
<el-input :input-style="inputStyle" v-model="reviseData.sort" style="width: 510px"/> <el-form-item prop="sort" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="reviseData.sort" style="width: 510px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<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-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>
<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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="reviseData.diffPercentage" style="width: 240px"/> <el-form-item prop="diffPercentage" style="padding: 0;margin: 0;">
<el-input v-float-number :input-style="inputStyle" maxlength="11" v-model="reviseData.diffPercentage"
style="width: 240px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="reviseData.timeoutMin" style="width: 240px"/> <el-form-item prop="timeoutMin" style="padding: 0;margin: 0;">
<el-input v-float-number :input-style="inputStyle" maxlength="11" v-model="reviseData.timeoutMin"
style="width: 240px"/>
</el-form-item>
</el-col> </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-col :span="7" class="content-col-value">
<el-input v-float-number :input-style="inputStyle" v-model="reviseData.tempRegulation" style="width: 240px"/> <el-form-item prop="tempRegulation" style="padding: 0;margin: 0;">
<el-input :input-style="inputStyle" maxlength="11" v-model="reviseData.tempRegulation"
style="width: 240px"/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form>
</div> </div>
</template> </template>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="emit('onConfirm', reviseData)">保存</el-button> <el-button type="primary" @click="handleConfirm">保存</el-button>
<el-button type="primary" @click="emit('onCancel')">关闭</el-button> <el-button type="primary" @click="emit('onCancel')">关闭</el-button>
</div> </div>
</template> </template>
...@@ -130,7 +196,6 @@ function onOpen(){ ...@@ -130,7 +196,6 @@ function onOpen(){
</template> </template>
<style scoped> <style scoped>
.el-row { .el-row {
color: black; color: black;
height: 35px; height: 35px;
...@@ -158,10 +223,12 @@ function onOpen(){ ...@@ -158,10 +223,12 @@ function onOpen(){
.el-input { .el-input {
color: black; color: black;
} }
.el-radio{
.el-radio {
color: black; color: black;
} }
.el-checkbox{
.el-checkbox {
color: black; color: black;
} }
</style> </style>
\ No newline at end of file
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