Commit cb391db4 authored by jiaxu.yan's avatar jiaxu.yan

feat: 完善参数配置页面

parent 90ce2f96
//只允许输入整数
export const integerOnly = {
beforeMount(el) {
el.addEventListener('input', event => {
// 获取输入框的当前值
let value = event.target.value;
// 使用正则表达式来匹配非整数字符,替换为空字符串
value = value.replace(/[^0-9]/g, '');
// 如果值变化了,更新输入框的值
if (value !== event.target.value) {
event.target.value = value;
}
});
}
};
// 只允许输入浮点数
export const vFloatNumber = {
beforeMount(el) {
el.addEventListener('input', (e) => {
e.target.value = e.target.value.replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g, '.').replace(/^(\d+)\./g, '$1.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
e.target.value = e.target.value.replace(/^(\d+)\./g, '$1.').replace(/^0+(?=[1-9])/, '');
if (e.target.value.split('.').length > 2) {
e.target.value = e.target.value.replace('.', '$#$').split('.').map(part => part.replace(/\d/g, '')).join('.').replace('$#$', '.').substring(0, e.target.value.length - 1);
}
});
}
};
\ No newline at end of file
...@@ -13,15 +13,15 @@ ...@@ -13,15 +13,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%;text-align: left;" 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>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -36,12 +36,16 @@ ...@@ -36,12 +36,16 @@
{{ option }} {{ option }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> --> </el-checkbox-group> -->
<el-checkbox-group v-model="form.type" style="width: 60%"> <el-checkbox-group
v-model="formDatas.transferIds"
style="width: 60%"
>
<el-checkbox <el-checkbox
v-for="(option, index) in formDatas.transferIds" v-for="(option, index) in options"
:label="option" :label="option.value"
:key="index"
> >
{{ option }} {{ option.label }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</td> </td>
...@@ -53,15 +57,15 @@ ...@@ -53,15 +57,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%" style="width: 80%"
v-model="formDatas.boilerOutletWaterTemperature" v-model="formDatas.boilerOutletWaterTemperature"
> >
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></div>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -75,15 +79,15 @@ ...@@ -75,15 +79,15 @@
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-form> <el-form>
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%" style="width: 80%"
v-model="formDatas.holdingTime" v-model="formDatas.holdingTime"
> >
<template #append> <template #append>
<div style="width: 40px">分钟</div> <div style="width: 40px">分钟</div>
</template> </template>
</el-input-number> </el-input>
</el-form> </el-form>
</td> </td>
</tr> </tr>
...@@ -97,15 +101,15 @@ ...@@ -97,15 +101,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%" style="width: 80%"
v-model="formDatas.upperLlimitMainFlow" v-model="formDatas.upperLlimitMainFlow"
> >
<template #append> <template #append>
<div style="width: 40px">m3/h</div> <div style="width: 40px">m3/h</div>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -118,15 +122,15 @@ ...@@ -118,15 +122,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%" style="width: 80%"
v-model="formDatas.lowerLlimitMainFlow" v-model="formDatas.lowerLlimitMainFlow"
> >
<template #append> <template #append>
<div style="width: 40px">m3/h</div> <div style="width: 40px">m3/h</div>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -138,15 +142,15 @@ ...@@ -138,15 +142,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%" style="width: 80%"
v-model="formDatas.maxTargetTemperature" v-model="formDatas.maxTargetTemperature"
> >
<template #append> <template #append>
<div style="width: 40px"></div> <div style="width: 40px"></div>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -159,15 +163,15 @@ ...@@ -159,15 +163,15 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
<el-input-number <el-input
:controls="false" v-float-number
style="width: 80%;" style="width: 80%"
v-model="formDatas.bestHoldingTime" v-model="formDatas.bestHoldingTime"
> >
<template #append> <template #append>
<div style="width: 40px">分钟</div> <div style="width: 40px">分钟</div>
</template> </template>
</el-input-number> </el-input>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -196,22 +200,15 @@ import { ref, reactive, onMounted, onUnmounted, onBeforeMount } from "vue"; ...@@ -196,22 +200,15 @@ import { ref, reactive, onMounted, onUnmounted, onBeforeMount } from "vue";
import { postConfigBoilerUpdate } from "@/api/scheduling.js"; import { postConfigBoilerUpdate } from "@/api/scheduling.js";
import http from "../../api/http"; import http from "../../api/http";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
const options = reactive([ 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({ const form = ref({
types: [], types: [],
}); });
const formDatas = ref([ const formDatas = ref([
{ {
updateNullFields: "", updateNullFields: "",
...@@ -223,24 +220,71 @@ const formDatas = ref([ ...@@ -223,24 +220,71 @@ const formDatas = ref([
lowerLlimitMainFlow: "", lowerLlimitMainFlow: "",
maxTargetTemperature: "", maxTargetTemperature: "",
bestHoldingTime: "", bestHoldingTime: "",
transferIds: "", transferIds: [],
}, },
]); ]);
const getListData = () => { const getListData = () => {
const loading = ElLoading.service({
lock: true,
text: "获取数据中",
background: "rgba(0, 0, 0, 0.7)",
});
http.get("/api/configboiler/getData").then((result) => { http.get("/api/configboiler/getData").then((result) => {
formDatas.value = result.data; formDatas.value = result.data;
formDatas.value.transferIds = formDatas.value.transferIds.split(",");
formDatas.value.updateNullFields = ""; formDatas.value.updateNullFields = "";
loading.close();
}); });
}; };
const onSave = async () => { const onSave = async () => {
const loading = ElLoading.service({
lock: true,
text: "保存数据中",
background: "rgba(0, 0, 0, 0.7)",
});
formDatas.value.transferIds = formDatas.value.transferIds.join(",");
const result = await postConfigBoilerUpdate({ ...formDatas.value }); const result = await postConfigBoilerUpdate({ ...formDatas.value });
if (result.success) { if (result.success) {
getListData();
loading.close();
ElMessage.success("修改成功"); ElMessage.success("修改成功");
} }
}; };
//获取换热机组列表
function getSupplys() {
options.length = 0;
var result = store.getters.getEnterprise();
console.log(result);
if (result) {
result.forEach((element) => {
// if (element.enterpriseId === enterpriseId.value) {
if (
element.enterpriseId ===
"9BCA54BC-8F27-4849-8D7D-50C5099E1949".toLowerCase()
) {
element.serviceCenterList.forEach((center) => {
let c = [];
center.supplyList.forEach((supply) => {
let chi = [];
supply.transferList.forEach((unit) => {
options.push({ value: unit.unitId, label: unit.unitName });
});
// c.push({ children: chi, label: supply.supplyName });
});
// options.push({ children: c, label: center.serviceCenterName });
});
}
});
}
console.log(options);
}
onMounted(() => { onMounted(() => {
getListData(); getListData();
getSupplys();
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
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