Commit b9a17161 authored by xuke's avatar xuke

rules

parent e0d888ae
...@@ -127,10 +127,10 @@ ...@@ -127,10 +127,10 @@
<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 height="60px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="topMost"> <el-form-item prop="topMost">
<el-input v-float-number style="width: 80%" v-model="addParams.topMost"></el-input> <el-input v-float-number maxlength="10" style="width: 80%" v-model="addParams.topMost"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -141,10 +141,10 @@ ...@@ -141,10 +141,10 @@
<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 height="60px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="upper"> <el-form-item prop="upper">
<el-input v-float-number style="width: 80%" v-model="addParams.upper"></el-input> <el-input v-float-number maxlength="10" style="width: 80%" v-model="addParams.upper"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -156,10 +156,10 @@ ...@@ -156,10 +156,10 @@
<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 height="60px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="lower"> <el-form-item prop="lower">
<el-input v-float-number style="width: 80%" v-model="addParams.lower"></el-input> <el-input v-float-number maxlength="10" style="width: 80%" v-model="addParams.lower"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -170,10 +170,10 @@ ...@@ -170,10 +170,10 @@
<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 height="60px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="downMost"> <el-form-item prop="downMost">
<el-input v-float-number style="width: 80%" v-model="addParams.downMost"></el-input> <el-input v-float-number maxlength="10" style="width: 80%" v-model="addParams.downMost"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -581,19 +581,6 @@ let param = ref({ ...@@ -581,19 +581,6 @@ let param = ref({
const formRef = ref() const formRef = ref()
addParams.value = {} addParams.value = {}
const rules = reactive({ const rules = reactive({
topMost: [
{ pattern: /^(\d{1,10})(\.[0-9]{1,4})?$/, "message": "上上限值长度超出范围", trigger: "blur" }
],
upper: [
{ pattern: /^(\d{1,10})(\.[0-9]{1,4})?$/, "message": "上限值长度超出范围", trigger: "blur" }
],
lower: [
{ pattern: /^(\d{1,10})(\.[0-9]{1,4})?$/, "message": "下限值长度超出范围", trigger: "blur" }
],
downMost: [
{ pattern: /^(\d{1,10})(\.[0-9]{1,4})?$/, "message": "下下限值长度超出范围", trigger: "blur" }
],
alarmPlan: [ alarmPlan: [
{ pattern: /^.{1,50}$/, "message": "报警预案必须是1-50位字符", trigger: "blur" } { pattern: /^.{1,50}$/, "message": "报警预案必须是1-50位字符", trigger: "blur" }
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="contentBlock"> <div class="contentBlock">
<div class="contentBlockInn"> <div class="contentBlockInn">
<el-card class="card-contianer"> <el-card class="card-contianer">
<el-form ref="formRef" :rules="rules" :model="formDatas" label-width="auto"> <el-form ref="formRef" :rules="rules" :model="formDatas" label-width="auto" :inline-message="true">
<table v-loading="loading" cellpadding="0" cellspacing="1" style="background-color: #99bbe8"> <table v-loading="loading" cellpadding="0" cellspacing="1" style="background-color: #99bbe8">
<tr> <tr>
<th style="width: 25%">电调阈开启度</th> <th style="width: 25%">电调阈开启度</th>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="openingOfElectricValve" style="padding: 0;margin: 0;"> <el-form-item prop="openingOfElectricValve" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%; text-align: left" <el-input maxlength="3" v-float-number style="width: 80%; text-align: left"
v-model="formDatas.openingOfElectricValve"> v-model="formDatas.openingOfElectricValve">
<template #append> <template #append>
<div style="width: 40px">%</div> <div style="width: 40px">%</div>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="boilerOutletWaterTemperature" style="padding: 0;margin: 0;"> <el-form-item prop="boilerOutletWaterTemperature" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="formDatas.boilerOutletWaterTemperature"> <el-input maxlength="10" style="width: 80%" v-model="formDatas.boilerOutletWaterTemperature">
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></div>
</template> </template>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="holdingTime" style="padding: 0;margin: 0;"> <el-form-item prop="holdingTime" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%" v-model="formDatas.holdingTime"> <el-input maxlength="10" v-float-number style="width: 80%" v-model="formDatas.holdingTime">
<template #append> <template #append>
<div style="width: 40px">分钟</div> <div style="width: 40px">分钟</div>
</template> </template>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="upperLlimitMainFlow" style="padding: 0;margin: 0;"> <el-form-item prop="upperLlimitMainFlow" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%" v-model="formDatas.upperLlimitMainFlow"> <el-input maxlength="10" v-float-number style="width: 80%" v-model="formDatas.upperLlimitMainFlow">
<template #append> <template #append>
<div style="width: 40px">m3/h</div> <div style="width: 40px">m3/h</div>
</template> </template>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="lowerLlimitMainFlow" style="padding: 0;margin: 0;"> <el-form-item prop="lowerLlimitMainFlow" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%" v-model="formDatas.lowerLlimitMainFlow"> <el-input maxlength="10" v-float-number style="width: 80%" v-model="formDatas.lowerLlimitMainFlow">
<template #append> <template #append>
<div style="width: 40px">m3/h</div> <div style="width: 40px">m3/h</div>
</template> </template>
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="maxTargetTemperature" style="padding: 0;margin: 0;"> <el-form-item prop="maxTargetTemperature" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="formDatas.maxTargetTemperature"> <el-input maxlength="10" style="width: 80%" v-model="formDatas.maxTargetTemperature">
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></div>
</template> </template>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="bestHoldingTime" style="padding: 0;margin: 0;"> <el-form-item prop="bestHoldingTime" style="padding: 0;margin: 0;">
<el-input v-float-number style="width: 80%" v-model="formDatas.bestHoldingTime"> <el-input maxlength="10" v-float-number style="width: 80%" v-model="formDatas.bestHoldingTime">
<template #append> <template #append>
<div style="width: 40px">分钟</div> <div style="width: 40px">分钟</div>
</template> </template>
...@@ -202,22 +202,22 @@ const rules = reactive({ ...@@ -202,22 +202,22 @@ const rules = reactive({
boilerOutletWaterTemperature: [ boilerOutletWaterTemperature: [
{ pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的锅炉出水温度", trigger: "blur" } { pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的锅炉出水温度", trigger: "blur" }
], ],
upperLlimitMainFlow: [ // upperLlimitMainFlow: [
{ pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量上限值", trigger: "blur" } // { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量上限值", trigger: "blur" }
], // ],
lowerLlimitMainFlow: [ // lowerLlimitMainFlow: [
{ pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量下限值", trigger: "blur" } // { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量下限值", trigger: "blur" }
], // ],
maxTargetTemperature: [ maxTargetTemperature: [
{ pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的目标温度最大值", trigger: "blur" }, { pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的目标温度最大值", trigger: "blur" },
], ],
bestHoldingTime: [ // bestHoldingTime: [
{ pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的持续时间", trigger: "blur" } // { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的持续时间", trigger: "blur" }
], // ],
holdingTime: [ // holdingTime: [
{ pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的保持时间", trigger: "blur" } // { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的保持时间", trigger: "blur" }
] // ]
}); });
// 获取数据列表 // 获取数据列表
...@@ -355,4 +355,41 @@ table.botList td { ...@@ -355,4 +355,41 @@ table.botList td {
text-align: left; text-align: left;
font-weight: bolder; font-weight: bolder;
} }
// 校验时样式
.el-form-item__content {
margin-left: 0 !important;
}
.el-form-item__error--inline {
top: auto;
left: auto;
display: inline-block;
margin-left: 10px;
line-height: 18px;
position: fixed;
padding: 5px 10px;
background: rgba(0, 0, 0, 0.85);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 5px rgba(0, 0, 0, 0.6);
word-break: break-all;
word-wrap: break-word;
border-radius: 4px;
margin-top: 4px;
max-width: 160px;
min-width: 100px;
height: auto;
z-index: 10000;
color: white !important;
}
.el-form-item__error--inline::before {
content: '';
width: 0;
height: 0;
border: 6px solid transparent;
border-right-color: #080B12;
position: absolute;
left: -11px;
top: 8px;
}
</style> </style>
...@@ -118,7 +118,7 @@ const rules = reactive({ ...@@ -118,7 +118,7 @@ const rules = reactive({
], ],
record: [ record: [
{ required: true, message: "能源用度是必选项", trigger: "blur" }, { required: true, message: "能源用度是必选项", trigger: "blur" },
{ pattern: /^(\d{1,10})$/, "message": "能源用度是 1-10位正整数", trigger: "blur" }
], ],
recordDate: [{ required: true, message: "日期是必选项" }], recordDate: [{ required: true, message: "日期是必选项" }],
}); });
...@@ -154,11 +154,13 @@ const handleDelete = (row) => { ...@@ -154,11 +154,13 @@ const handleDelete = (row) => {
// 新增 // 新增
const action = ref('add') const action = ref('add')
const handleClose = () => { const handleClose = () => {
loading.value = false
dialogVisible.value = false dialogVisible.value = false
reset() reset()
} }
const handleCancel = () => { const handleCancel = () => {
dialogVisible.value = false dialogVisible.value = false
loading.value = false
} }
const handleAdd = () => { const handleAdd = () => {
action.value = "add", action.value = "add",
...@@ -352,7 +354,7 @@ onMounted(() => { ...@@ -352,7 +354,7 @@ onMounted(() => {
<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 height="50px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="supplyName" style="margin: 0; padding: 0; width: 100%;"> <el-form-item prop="supplyName" style="margin: 0; padding: 0; width: 100%;">
<el-select v-model="formEnergy.supplyId" placeholder="请选择"> <el-select v-model="formEnergy.supplyId" placeholder="请选择">
...@@ -369,7 +371,7 @@ onMounted(() => { ...@@ -369,7 +371,7 @@ onMounted(() => {
<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 height="66px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="energyType" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="energyType" style="margin: 0; padding: 0; width: 100%">
<el-select v-model="formEnergy.energyType" placeholder="请选择"> <el-select v-model="formEnergy.energyType" placeholder="请选择">
...@@ -389,10 +391,10 @@ onMounted(() => { ...@@ -389,10 +391,10 @@ onMounted(() => {
<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 height="66px"> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="record" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="record" style="margin: 0; padding: 0; width: 100%">
<el-input v-float-number v-model="formEnergy.record" placeholder="请输入能源用度" /> <el-input v-float-number maxlength="10" v-model="formEnergy.record" placeholder="请输入能源用度" />
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -403,7 +405,7 @@ onMounted(() => { ...@@ -403,7 +405,7 @@ onMounted(() => {
<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 height="66px"> <tr>
<td> <td>
<el-form-item prop="recordDate" style="margin: 0; padding: 0; width: 100%"> <el-form-item prop="recordDate" style="margin: 0; padding: 0; width: 100%">
<el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="formEnergy.recordDate" type="datetime" <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" v-model="formEnergy.recordDate" type="datetime"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<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"> <el-form ref="formRef" :rules="rules" :model="List" label-width="auto" :inline-message="true">
<table v-loading="loading" cellpadding="0" cellspacing="1"> <table v-loading="loading" cellpadding="0" cellspacing="1">
<tr> <tr>
<th style="width: 25%">计划名称</th> <th style="width: 25%">计划名称</th>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="planName" style="padding: 0;margin: 0;"> <el-form-item prop="planName" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.planName"></el-input> <el-input maxlength="20" style="width: 80%" v-model="List.planName"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="diffPercentage" style="padding: 0;margin: 0;"> <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 maxLenght="10" style="width: 80%" v-model="List.diffPercentage"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="timeoutMin" style="padding: 0;margin: 0;"> <el-form-item prop="timeoutMin" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.timeoutMin"></el-input> <el-input v-float-number maxlength="10" style="width: 80%" v-model="List.timeoutMin"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form-item prop="tempRegulation" style="padding: 0;margin: 0;"> <el-form-item prop="tempRegulation" style="padding: 0;margin: 0;">
<el-input style="width: 80%" v-model="List.tempRegulation"></el-input> <el-input maxlength="10" style="width: 80%" v-model="List.tempRegulation"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -111,14 +111,12 @@ const List = ref( ...@@ -111,14 +111,12 @@ const List = ref(
//校验规则 //校验规则
const rules = reactive({ const rules = reactive({
planName: [ planName: [
{ required: true, message: "计划名称是必填项", trigger: "blur" },
{ pattern: /^.{1,20}$/, "message": "计划名称必须是1-20位字符", trigger: "blur" } { pattern: /^.{1,20}$/, "message": "计划名称必须是1-20位字符", trigger: "blur" }
], ],
diffPercentage: [ diffPercentage: [
{ pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" } { pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" }
], ],
timeoutMin: [
{ pattern: /^(\d{1,10})$/, "message": "判断时间必须是1-10位正整数", trigger: "blur" }
],
tempRegulation: [ tempRegulation: [
{ pattern: /^(-?\d{1,10})(\.[0-9]{1,4})?$/, message: "请输入正确的调节温度最大值", trigger: "blur" } { pattern: /^(-?\d{1,10})(\.[0-9]{1,4})?$/, message: "请输入正确的调节温度最大值", trigger: "blur" }
], ],
...@@ -214,4 +212,42 @@ table.botList td { ...@@ -214,4 +212,42 @@ table.botList td {
text-align: left; text-align: left;
font-weight: bolder; font-weight: bolder;
} }
// 校验时样式
.el-form-item__content {
margin-left: 0 !important;
}
.el-form-item__error--inline {
top: auto;
left: auto;
display: inline-block;
margin-left: 10px;
line-height: 18px;
position: fixed;
padding: 5px 10px;
background: rgba(0, 0, 0, 0.85);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
0 0 5px rgba(0, 0, 0, 0.6);
word-break: break-all;
word-wrap: break-word;
border-radius: 4px;
margin-top: 4px;
max-width: 160px;
min-width: 100px;
height: auto;
z-index: 10000;
color: white !important;
}
.el-form-item__error--inline::before {
content: '';
width: 0;
height: 0;
border: 6px solid transparent;
border-right-color: #080B12;
position: absolute;
left: -11px;
top: 8px;
}
</style> </style>
...@@ -199,6 +199,10 @@ function resetSearch(){ ...@@ -199,6 +199,10 @@ function resetSearch(){
supplySearchKey.value = '' supplySearchKey.value = ''
getData() getData()
} }
function revise1(row) {
console.log("scope.row", row);
}
</script> </script>
<template> <template>
......
...@@ -54,6 +54,8 @@ watchEffect(() => { ...@@ -54,6 +54,8 @@ watchEffect(() => {
props.data.transfers = [] props.data.transfers = []
props.data.updateNullFields = '' props.data.updateNullFields = ''
reviseData.value = cloneDeep(props.data) // 深拷贝数据 reviseData.value = cloneDeep(props.data) // 深拷贝数据
console.log("props.data===>", props.data);
console.log(reviseData.value);
}) })
const inputStyle = { const inputStyle = {
color: 'black', color: 'black',
...@@ -99,16 +101,25 @@ async function handleConfirm() { ...@@ -99,16 +101,25 @@ async function handleConfirm() {
} }
}) })
}) })
} }
} }
} }
// 重置表单
const reset = () => {
const form = unref(formRef)
form.resetFields()
}
function onClose(){
reset()
emit('onCancel')
}
</script> </script>
<template> <template>
<el-dialog v-model="props.open" width="1000px" title="自定义修改" @close="emit('onCancel')" @open="onOpen"> <el-dialog v-model="props.open" width="1000px" title="自定义修改" @close="onClose" @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-form ref="formRef" :model="reviseData" :rules="rules" label-width="auto">
......
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