Commit 77ecd1bc authored by 裴文涛's avatar 裴文涛
parents 29c4a617 cd57e9b3
<script setup>
import mitter from "@/utils/mitter";
import { ref } from "vue";
const props = defineProps({
items: Object,
prop: String,
});
const value = ref("");
const input = () => {
console.log(props.items);
mitter.emit("changeVal", { name: props.prop, value: value.value });
};
</script>
<template>
<div>
<el-date-picker v-bind="items" v-model="value" @input="input" />
</div>
</template>
import select from "./select.vue";
import input from "./input.vue";
import dateTimePicker from "./dateTimePicker.vue";
export default {
select,
input,
dateTimePicker
};
<script setup>
import mitter from "@/utils/mitter";
import { ref } from "vue";
const props = defineProps({
items: Object,
prop: String,
});
const value = ref("");
const input = () => {
console.log(props.items);
mitter.emit("changeVal", { name: props.prop, value: value.value });
};
</script>
<template>
<div>
<el-input v-bind="items" v-model="value" @input="input" />
</div>
</template>
<script setup>
import { ref } from "vue";
import emitter from "@/utils/mitter";
const porps = defineProps({
items: Object,
prop: String,
});
const value = ref("");
// 选择某一项之后触发changeVale事件
const onChangeFirstValue = (val) => {
emitter.emit("changeVal", { name: porps.prop, value: value.value });
};
</script>
<template>
<div>
<el-select
v-model="value"
:v-bind="items"
style="width: 240px"
@change="onChangeFirstValue(value)"
>
<el-option
v-for="item in items.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
\ No newline at end of file
<template>
<div class="annual-param-container">
<el-card>
<div class="search-add-wrapper">
<el-form ref="searchForm" :inline="true" label-suffix=":">
<el-row :gutter="10">
<el-col
v-for="(item, index) in props.schemas"
:key="index"
:span="20"
>
<el-form-item :label="item.label" :prop="item.prop">
<component
:is="components[item.type]"
:prop="item.prop"
:items="item.componentProps"
></component>
<!-- <el-input v-model="queryPrarms" placeholder="请选择" /> -->
</el-form-item>
</el-col>
</el-row>
</el-form>
<div>
<el-button type="primary" class="add-search-btn" @click="handleSearch"
>查询</el-button
>
<el-button type="primary" class="add-search-btn" @click="handleReset"
>重置</el-button
>
</div>
</div>
<div class="table-wrapper">
<el-table
:data="data"
stripe
border
style="width: 100%"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass"
>
<el-table-column
v-for="(column, key) in columns"
:key="key"
:v-bind="column"
></el-table-column>
</el-table>
</div>
</el-card>
</div>
</template>
<script setup>
import { defineProps, reactive, watch } from "vue";
import mitter from "@/utils/mitter";
import components from "@/components/FormComponents/index"; // 将所有组件引入
const emit = defineEmits(["DataChange"]);
const props = defineProps({
schemas: {
type: Array,
default: [],
},
formData: {
type: Object,
default: () => {},
},
api: {
type: String,
default: "",
},
columns: {
type: Array,
default: [],
},
});
const data = reactive([]);
const searchForm = reactive({});
const handleSearch = () => {
console.log(handleSearch);
};
const handleReset = () => {
console.log(handleReset);
};
// 监听chageVal
mitter.on("changeVal", (data) => {
console.log(data);
const { name, value } = data;
if (name) {
props.formData[name] = value;
}
});
watch(
() => props.formData,
(newVal) => {
emit("DataChange", newVal);
},
{ deep: true }
);
defineExpose({ formData: props.formData });
</script>
<style scoped lang="less">
.annual-param-container {
width: 100%;
margin: 4px;
}
.search-add-wrapper {
width: 100%;
display: flex;
justify-content: start;
}
.search-add-wrapper .el-row {
border: none;
display: flex;
align-items: center;
margin: 5px 10px 5px 5px;
}
.add-search-btn {
margin: 5px 10px 5px 0;
}
:deep(.table-header-class) {
text-align: center;
font-size: 12px;
background-color: #c4d8f1 !important;
color: #124c6a;
}
:deep(.table-body-class) {
font-size: 12px;
color: black;
}
.table-operate-column {
display: flex;
justify-content: center;
align-items: center;
}
.table-operate-column .el-button {
font-size: 12px;
}
::v-deep .el-table__body tr:hover > td {
background: linear-gradient(
to top,
rgb(0, 198, 255),
rgb(255, 255, 255)
) !important;
}
.pagination-wrapper {
padding: 5px;
display: flex;
justify-content: space-between;
align-items: center;
}
.el-row[first] {
border-top: 1px solid #a6c3e9;
}
.el-row {
border-left: 1px solid #a6c3e9;
border-right: 1px solid #a6c3e9;
border-bottom: 1px solid #a6c3e9;
width: 100%;
height: 35px;
color: #124362;
}
.el-col[col-label] {
display: flex;
justify-content: end;
align-items: center;
border-right: 1px solid #a6c3e9;
background-color: #f2f6f8;
padding-right: 5px;
}
.el-col[col-value] {
display: flex;
justify-content: start;
align-items: center;
padding-left: 5px;
}
.el-input {
color: black;
height: 24px;
}
</style>
This diff is collapsed.
import mitt from "mitt";
const emitter = mitt();
export default emitter;
\ No newline at end of file
...@@ -3,5 +3,5 @@ const port='8001'; ...@@ -3,5 +3,5 @@ const port='8001';
//export const SERVEICE='http://218.69.97.198:8001' //export const SERVEICE='http://218.69.97.198:8001'
//'http://218.69.97.198:8001' //'http://218.69.97.198:8001'
//export const TEST_SERVEICE='http://localhost:5013' //export const TEST_SERVEICE='http://192.168.1.2:5013/'
export const SERVEICE='http://localhost:5013' export const SERVEICE='http://192.168.1.2:5013/'
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-row> <el-row v-show="dialog_content">
<el-col :span="6"> <el-col :span="6">
<div class="left"> <div class="left">
<el-table :data="cnNames_before" class="scroll-table" :row-style="{ height: '16px' }" <el-table :data="cnNames_before" class="scroll-table" :row-style="{ height: '16px' }"
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<el-col :span="12"> <el-col :span="12">
<div class="middle"> <div class="middle">
<el-form ref="formRef" :model="addParams" :rules="rules" label-width="auto"> <el-form ref="formRef" :model="addParams" :rules="rules" label-width="auto" :disabled="form_control">
<table cellpadding="0" cellspacing="1" border="1" class="big_table"> <table cellpadding="0" cellspacing="1" border="1" class="big_table">
<tr> <tr>
<th style="width: 25%">报警名称:</th> <th style="width: 25%">报警名称:</th>
...@@ -187,7 +187,10 @@ ...@@ -187,7 +187,10 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input style="width: 80%" type="textarea" rows="6" v-model="addParams.alarmPlan"></el-input> <el-form-item prop="alarmPlan">
<el-input style="width: 80%" type="textarea" rows="6"
v-model="addParams.alarmPlan"></el-input>
</el-form-item>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -574,35 +577,33 @@ let param = ref({ ...@@ -574,35 +577,33 @@ let param = ref({
//表单校验规则 //表单校验规则
const formRef = ref() const formRef = ref()
addParams.value = {}
const rules = reactive({ const rules = reactive({
topMost: [ topMost: [
{ required: true, message: "上上限值是必填项", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "上上限值是 1-10位实数", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "上上限值输入不合法", trigger: "blur" },
{ min: 1, max: 10, message: '上上限值必须是 1-10位的数字', trigger: 'blur' }
], ],
upper: [ upper: [
{ required: true, message: "上限值是必填项", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "上限值是 1-10位实数", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "上限值输入不合法", trigger: "blur" },
{ min: 1, max: 10, message: '上限值必须是 1-10位的数字', trigger: 'blur' }
], ],
lower: [ lower: [
{ required: true, message: "下限值是必填项", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "下限值是 1-10位实数", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "下限值输入不合法", trigger: "blur" },
{ min: 1, max: 10, message: '下限值必须是 1-10位的数字', trigger: 'blur' }
], ],
downMost: [ downMost: [
{ required: true, message: "下下限值是必填项", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "下下限值是 1-10位实数", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "下下限值输入不合法", trigger: "blur" }, ],
{ min: 1, max: 10, message: '下下限值必须是 1-10位的数字', trigger: 'blur' } alarmPlan: [
{ pattern: /^.{1,50}$/, "message": "报警预案是 1-50位字符", trigger: "blur" }
] ]
}); });
let newType = ref(0) let newType = ref(0)
watchEffect(() => { watchEffect(() => {
console.log("监听::::", type.value); // console.log("监听::::", type.value);
if (type.value === "GetPipeAlarmStatusData") { if (type.value === "GetPipeAlarmStatusData") {
newType.value = 1 newType.value = 1
param.value.baseId = "pipeParaBaseId" param.value.baseId = "pipeParaBaseId"
...@@ -628,9 +629,17 @@ const getCnNames = () => { ...@@ -628,9 +629,17 @@ const getCnNames = () => {
}); });
} }
// 表单编辑控制
const dialog_content = ref(false)
const form_control = ref(true)
// 点击确定查询数据 // 点击确定查询数据
const paramsSetting = () => { const paramsSetting = () => {
dialog_content.value = true
getCnNames() getCnNames()
ElMessage.info("请选择参数后进行编辑...")
} }
// newRow接收param.value.baseId,添加需要使用 // newRow接收param.value.baseId,添加需要使用
...@@ -659,6 +668,7 @@ const selectBeforeParams = (row) => { ...@@ -659,6 +668,7 @@ const selectBeforeParams = (row) => {
// console.log("查看baseId --- dataaaaa:", data); // console.log("查看baseId --- dataaaaa:", data);
data.then(function () { data.then(function () {
param.value.cnName = row.cnName param.value.cnName = row.cnName
form_control.value = false
}); });
} else { } else {
ElMessage.info("该参数暂不需要修改...") ElMessage.info("该参数暂不需要修改...")
...@@ -692,6 +702,7 @@ const selectAfterParams = (row) => { ...@@ -692,6 +702,7 @@ const selectAfterParams = (row) => {
// 数据回显 // 数据回显
addParams.value = { ...val.data } addParams.value = { ...val.data }
param.value.cnName = row.cnName param.value.cnName = row.cnName
form_control.value = false
if (type.value === 1) { if (type.value === 1) {
delId.value = val.data.pipeAlarmParaId delId.value = val.data.pipeAlarmParaId
} else if (type.value === 2) { } else if (type.value === 2) {
...@@ -711,6 +722,9 @@ const selectAfterParams = (row) => { ...@@ -711,6 +722,9 @@ const selectAfterParams = (row) => {
const onAdd = () => { const onAdd = () => {
// console.log("!!!!!!!", addParams.value); // console.log("!!!!!!!", addParams.value);
// 提交添加或修改-以上至少有一个选项有值
if (addParams.value.topMost || addParams.value.upper || addParams.value.lower || addParams.value.downMost) {
// 执行添加或修改
addParams.value.updateNullFields = "" addParams.value.updateNullFields = ""
if (newType.value === 1) { if (newType.value === 1) {
addParams.value.pipeId = dept.value addParams.value.pipeId = dept.value
...@@ -720,6 +734,7 @@ const onAdd = () => { ...@@ -720,6 +734,7 @@ const onAdd = () => {
} else { } else {
addParams.value.gatherType = 1 addParams.value.gatherType = 1
} }
http.post("api/alarm/para/pipesave", { ...addParams.value }, false).then((res) => { http.post("api/alarm/para/pipesave", { ...addParams.value }, false).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success(res.message) ElMessage.success(res.message)
...@@ -729,6 +744,7 @@ const onAdd = () => { ...@@ -729,6 +744,7 @@ const onAdd = () => {
delete addParams.value.voicePath delete addParams.value.voicePath
reset() reset()
param.value.cnName = "" param.value.cnName = ""
form_control.value = true
getCnNames() getCnNames()
} else { } else {
ElMessage.error("操作失败") ElMessage.error("操作失败")
...@@ -744,6 +760,7 @@ const onAdd = () => { ...@@ -744,6 +760,7 @@ const onAdd = () => {
delete addParams.value.boilerId delete addParams.value.boilerId
reset() reset()
param.value.cnName = "" param.value.cnName = ""
form_control.value = true
getCnNames() getCnNames()
} else { } else {
ElMessage.error("操作失败") ElMessage.error("操作失败")
...@@ -760,12 +777,18 @@ const onAdd = () => { ...@@ -760,12 +777,18 @@ const onAdd = () => {
delete addParams.value.unitId delete addParams.value.unitId
reset() reset()
param.value.cnName = "" param.value.cnName = ""
form_control.value = true
getCnNames() getCnNames()
} else { } else {
ElMessage.error("操作失败") ElMessage.error("操作失败")
} }
}) })
} }
} else {
ElMessage.error("请至少输入一个报警上下限数值")
}
} }
// 按钮 // 按钮
...@@ -785,6 +808,8 @@ const onDel = () => { ...@@ -785,6 +808,8 @@ const onDel = () => {
http.post("api/alarm/para/pipedelete", { id: delId.value }, false).then((res) => { http.post("api/alarm/para/pipedelete", { id: delId.value }, false).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success(res.message) ElMessage.success(res.message)
param.value.cnName = ""
form_control.value = true
reset() reset()
} else { } else {
ElMessage.error("删除失败!!") ElMessage.error("删除失败!!")
...@@ -794,6 +819,8 @@ const onDel = () => { ...@@ -794,6 +819,8 @@ const onDel = () => {
http.post("api/alarm/para/boilerdelete", { id: delId.value }, false).then((res) => { http.post("api/alarm/para/boilerdelete", { id: delId.value }, false).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success(res.message) ElMessage.success(res.message)
param.value.cnName = ""
form_control.value = true
reset() reset()
} else { } else {
ElMessage.error("删除失败") ElMessage.error("删除失败")
...@@ -803,6 +830,8 @@ const onDel = () => { ...@@ -803,6 +830,8 @@ const onDel = () => {
http.post("api/alarm/para/transdelete", { id: delId.value }, false).then((res) => { http.post("api/alarm/para/transdelete", { id: delId.value }, false).then((res) => {
if (res.success) { if (res.success) {
ElMessage.success(res.message) ElMessage.success(res.message)
param.value.cnName = ""
form_control.value = true
reset() reset()
} else { } else {
ElMessage.error("删除失败") ElMessage.error("删除失败")
...@@ -815,7 +844,6 @@ const onDel = () => { ...@@ -815,7 +844,6 @@ const onDel = () => {
}).finally(() => { }).finally(() => {
getCnNames() getCnNames()
}) })
} }
// 关闭dialog右上× 清空数据 // 关闭dialog右上× 清空数据
...@@ -828,6 +856,12 @@ const onClose = () => { ...@@ -828,6 +856,12 @@ const onClose = () => {
param.value.cnName = "" param.value.cnName = ""
} }
// watchEffect(() => {
// if (param.value.cnName) {
// form_control.value = false
// }
// })
onMounted(() => { onMounted(() => {
getuser() getuser()
setContentHeight(); setContentHeight();
......
...@@ -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"> <el-form-item prop="boilerOutletWaterTemperature">
<el-input v-float-number style="width: 80%" v-model="formDatas.boilerOutletWaterTemperature"> <el-input style="width: 80%" v-model="formDatas.boilerOutletWaterTemperature">
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></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"> <el-form-item prop="maxTargetTemperature">
<el-input v-float-number style="width: 80%" v-model="formDatas.maxTargetTemperature"> <el-input style="width: 80%" v-model="formDatas.maxTargetTemperature">
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></div>
</template> </template>
...@@ -166,11 +166,12 @@ import { ElMessage } from "element-plus"; ...@@ -166,11 +166,12 @@ import { ElMessage } from "element-plus";
const options = reactive([]); const options = reactive([]);
import store from "../../store/index"; import store from "../../store/index";
import { vFloatNumber } from "@/utils/directives.js"; import { vFloatNumber } from "@/utils/directives.js";
import { nextTick } from "vue";
const loading = ref(false) const loading = ref(false)
const form = ref({ const form = ref({
types: [], types: [],
}); });
const formRef = ref() let formRef = ref()
const formDatas = ref([ const formDatas = ref([
{ {
...@@ -189,34 +190,33 @@ const formDatas = ref([ ...@@ -189,34 +190,33 @@ const formDatas = ref([
//表单校验规则 //表单校验规则
// 正则 /^(-?[0-9]+(\.[0-9]+)?){1,10}$/ ==> {1-10}不起作用,下面又一遍 // 正则 /^(-?\d{1,5})(\.[0-9]{1,4})?$/
// 正负可选
// 整数位至多5位
// 小数可选,小数部分之多4位
const rules = reactive({ const rules = reactive({
openingOfElectricValve: [ openingOfElectricValve: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "电动调节阀开度输入不合法", trigger: "blur" }, { pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" }
{ min: 1, max: 10, message: '电动调节阀开度必须是 1-10位的数字', trigger: 'change' }
], ],
boilerOutletWaterTemperature: [ boilerOutletWaterTemperature: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "锅炉出水温度输入不合法", trigger: "blur" }, { pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的锅炉出水温度", trigger: "blur" }
{ min: 1, max: 10, message: '锅炉出水温度必须是 1-10位的数字', trigger: 'change' }
], ],
upperLlimitMainFlow: [ upperLlimitMainFlow: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "锅炉房供水总管流量上限值输入不合法", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量上限值", trigger: "blur" }
{ min: 1, max: 10, message: '锅炉房供水总管流量上限值必须是 1-10位的数字', trigger: 'change' }
], ],
lowerLlimitMainFlow: [ lowerLlimitMainFlow: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "锅炉房供水总管流量下限值输入不合法", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的锅炉房供水总管流量下限值", trigger: "blur" }
{ min: 1, max: 10, message: '锅炉房供水总管流量下限值必须是 1-10位的数字', trigger: 'change' }
], ],
maxTargetTemperature: [ maxTargetTemperature: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "目标温度最大值输入不合法", trigger: "blur" }, { pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的目标温度最大值", trigger: "blur" },
{ min: 1, max: 10, message: '目标温度最大值必须是 1-10位的数字', trigger: 'change' }
], ],
bestHoldingTime: [ bestHoldingTime: [
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "持续时间输入不合法", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的持续时间", trigger: "blur" }
{ min: 1, max: 10, message: '持续时间必须是 1-10位的数字', trigger: 'change' }
], ],
holdingTime: [ holdingTime: [
{ pattern: /^[0-9]\d{1,10}$/, "message": "保持时间必须是 1-10位的数字", trigger: 'change' } { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "请输入正确的保持时间", trigger: "blur" }
] ]
}); });
...@@ -278,9 +278,19 @@ function getSupplys() { ...@@ -278,9 +278,19 @@ function getSupplys() {
} }
// console.log("遍历的options===========>:", options); // console.log("遍历的options===========>:", options);
} }
const clearFormValidation = () => {
nextTick(() => {
formRef.value?.clearValidate()
})
}
onMounted(() => { onMounted(() => {
getListData(); getListData();
getSupplys(); getSupplys();
clearFormValidation()
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
import { ref, onMounted, getCurrentInstance, reactive, nextTick } from "vue"; import { ref, onMounted, getCurrentInstance, reactive, nextTick } from "vue";
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
import axios from "axios"; import axios from "axios";
import { Search, Document } from "@element-plus/icons-vue"; import { Search, Minus, Document } from "@element-plus/icons-vue";
import { import {
getOrganizationStructureInterface getOrganizationStructureInterface
} from "@/api/scheduling"; } from "@/api/scheduling";
import http from "../../api/http"; import http from "../../api/http";
import loading from "element-plus";
import store from "../../store"; import store from "../../store";
import { vFloatNumber } from "@/utils/directives.js"; import { vFloatNumber } from "@/utils/directives.js";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -32,12 +31,14 @@ const reset = () => { ...@@ -32,12 +31,14 @@ const reset = () => {
"energyName": '' "energyName": ''
} }
} }
const loading = ref(false)
const energyForm = ref() const energyForm = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const getEnergyData = () => { const getEnergyData = () => {
loading.value = true
http.post("/api/energy/getData", config.supplyType).then((res) => { http.post("/api/energy/getData", config.supplyType).then((res) => {
if (res.success) { if (res.success) {
loading.value = false
tableData.value = res.data; tableData.value = res.data;
ElMessage.success(res.message); ElMessage.success(res.message);
} else { } else {
...@@ -87,11 +88,16 @@ const config = reactive({ ...@@ -87,11 +88,16 @@ const config = reactive({
const handleSearch = () => { const handleSearch = () => {
config.supplyType = formInline.keyWord; config.supplyType = formInline.keyWord;
config.supplyType = [`${config.supplyType}`]; config.supplyType = [`${config.supplyType}`];
getEnergyData(), getEnergyData()
(formEnergy.value.energyType = ""),
ElMessage.success("获取数据成功");
}; };
// 重置按钮
const handleReset = () => {
formInline.keyWord = ""
config.supplyType = ["0", "1", "2", "3", "4"]
getEnergyData()
}
const timeFormat = (time) => { const timeFormat = (time) => {
var time = new Date(time); var time = new Date(time);
var year = time.getFullYear(); var year = time.getFullYear();
...@@ -100,7 +106,7 @@ const timeFormat = (time) => { ...@@ -100,7 +106,7 @@ const timeFormat = (time) => {
function add(m) { function add(m) {
return m < 10 ? "0" + m : m; return m < 10 ? "0" + m : m;
} }
return year + '/' + add(month) + '/' + add(date) + ' 0:00:00' return year + '/' + add(month) + '/' + add(date)
} }
//表单校验规则 //表单校验规则
...@@ -111,9 +117,7 @@ const rules = reactive({ ...@@ -111,9 +117,7 @@ const rules = reactive({
], ],
record: [ record: [
{ required: true, message: "能源用度是必选项", trigger: "blur" }, { required: true, message: "能源用度是必选项", trigger: "blur" },
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, message: "能源用度必须输入1-10位数字", trigger: "blur" }, { pattern: /^(\d{1,10})$/, "message": "能源用度是 1-10位正整数", trigger: "blur" }
{ min: 1, max: 10, message: '能源用度必须是 1-10位的数字', trigger: 'blur' }
], ],
recordDate: [{ required: true, message: "日期是必选项" }], recordDate: [{ required: true, message: "日期是必选项" }],
}); });
...@@ -256,6 +260,7 @@ function getOrganizationStructure() { ...@@ -256,6 +260,7 @@ function getOrganizationStructure() {
onMounted(() => { onMounted(() => {
getOrganizationStructure() getOrganizationStructure()
getEnergyData() getEnergyData()
}) })
</script> </script>
...@@ -288,6 +293,10 @@ onMounted(() => { ...@@ -288,6 +293,10 @@ onMounted(() => {
<Search style="width: 1em; height: 1em; margin-right: 8px" /> <Search style="width: 1em; height: 1em; margin-right: 8px" />
查询 查询
</el-button> </el-button>
<el-button type="primary" @click="handleReset">
<Minus style="width: 1em; height: 1em; margin-right: 8px" />
重置
</el-button>
<el-button type="primary" @click="handleAdd"> <el-button type="primary" @click="handleAdd">
<Document style="width: 1em; height: 1em; margin-right: 8px" /> <Document style="width: 1em; height: 1em; margin-right: 8px" />
新增 新增
...@@ -297,7 +306,7 @@ onMounted(() => { ...@@ -297,7 +306,7 @@ onMounted(() => {
</table> </table>
<el-table :data="tableData" style="width: 100%;font-size: 12px;color: #181818;" <el-table v-loading="loading" :data="tableData" style="width: 100%;font-size: 12px;color: #181818;"
:header-cell-style="{ color: '#225475', backgroundColor: '#B8CFEE', 'text-align': 'center', height: '40px', padding: '0px', border: '1px solid #99bbe8' }" :header-cell-style="{ color: '#225475', backgroundColor: '#B8CFEE', 'text-align': 'center', height: '40px', padding: '0px', border: '1px solid #99bbe8' }"
:cell-style="{ 'text-align': 'center', padding: '0px' }" :row-style="{ height: '30px', padding: '0px' }" border :cell-style="{ 'text-align': 'center', padding: '0px' }" :row-style="{ height: '30px', padding: '0px' }" border
stripe max-height="633"> stripe max-height="633">
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
<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>
...@@ -54,7 +56,7 @@ ...@@ -54,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 v-float-number style="width: 80%" v-model="List.tempRegulation"></el-input> <el-input style="width: 80%" v-model="List.tempRegulation"></el-input>
</el-form-item> </el-form-item>
</td> </td>
</tr> </tr>
...@@ -67,7 +69,9 @@ ...@@ -67,7 +69,9 @@
<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>
...@@ -106,20 +110,20 @@ const List = ref( ...@@ -106,20 +110,20 @@ const List = ref(
) )
//校验规则 //校验规则
const rules = reactive({ const rules = reactive({
planName: [
{ pattern: /^.{1,20}$/, "message": "计划名称必须是1-20位字符", trigger: "blur" }
],
diffPercentage: [ diffPercentage: [
{ required: true, message: "偏差百分比是必填项", trigger: "blur" }, { pattern: /^([0-9]\d{0,1}|100$)(\.\d{1,4})?$/, "message": "请输入正确的百分比格式", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?){1,10}$/, "message": "偏差百分比输入不合法", trigger: 'blur' },
{ min: 1, max: 10, message: '偏差百分比必须是 1-10位的数字', trigger: 'change' }
], ],
timeoutMin: [ timeoutMin: [
{ required: true, message: "判断时间是必填项", trigger: "blur" }, { pattern: /^(\d{1,5})(\.[0-9]{1,4})?$/, "message": "判断时间必须是1-10位实数", trigger: "blur" }
{ pattern: /^[0-9]\d{1,10}$/, "message": "判断时间必须是 1-10位的数字", trigger: 'change' }
], ],
tempRegulation: [ tempRegulation: [
{ required: true, message: "调节温度是必选项", trigger: "blur" }, { pattern: /^(-?\d{1,5})(\.[0-9]{1,4})?$/, message: "请输入正确的调节温度最大值", trigger: "blur" }
{ pattern: /^(-?[0-9]+(\.[0-9]+)?)$/, "message": "调节温度输入不合法", trigger: 'blur' }, ],
{ min: 1, max: 10, message: '调节温度必须是 1-10位的数字', trigger: 'change' } description: [
{ pattern: /^.{1,50}$/, "message": "备注必须是1-50位字符", trigger: "blur" }
] ]
}); });
......
<template>
<PageData
api="/api/Scheduling/WeatherCondition/Get"
:schemas="schemas"
:columns="columns"
:formData="formData"
@DataChange="formDataChange"
></PageData>
</template>
<script setup>
import { computed, onMounted, reactive, ref } from "vue";
import PageData from "@/components/PageData.vue";
import { columns, schemas } from "./formSchems";
const formData = ref({
name: "",
code: "",
date: "",
});
const formDataChange = (val) => {
formData.value = val;
};
</script>
import { ref } from "vue";
export const columns = ref([
{
label: "设备名称",
prop: "name",
align: "center",
with: 200,
},
{
label: "设备名称",
prop: "name",
align: "center",
with: 200,
},
{
label: "设备名称",
prop: "name",
align: "center",
with: 200,
},
]);
export const schemas = ref([
{
label: "设备名称",
prop: "name",
type: "input",
componentProps: {
placeholder: "请输入设备名称",
},
},
{
label: "设备编号",
prop: "code",
type: "select",
componentProps: {
options: [
{ label: "11111", value: 1 },
{ label: "22222", value: 2 },
],
placeholder: "请输入设备编号",
},
},
{
label: "设备名称",
prop: "date",
type: "dateTimePicker",
componentProps: {
type: "datetimerange",
startPlaceholder: "开始日起",
endPlaceholder: "结束日期",
format: "YYYY-MM-DD HH:mm:ss",
datFormat: "YYYY/MM/DD",
timeFormat: "HH:mm:ss",
},
},
]);
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