Browse Source

feat: 机理模型,ecahrt,table, 新增机理路径配置

sunxiao 1 month ago
parent
commit
17be47a4d2

+ 1 - 1
.env.development

@@ -5,7 +5,7 @@ VITE_APP_TITLE = LibraAI智能体运营平台
 VITE_APP_ENV = 'development'
 
 # 管理系统/开发环境
-VITE_APP_BASE_API =  'http://192.168.40.18:8080/'
+VITE_APP_BASE_API =  'http://192.168.40.21:8080/'
 # VITE_APP_BASE_API = 'http://192.168.9.54:8080/'
 
 VITE_APP_BASE_TEST = http://192.168.40.21:8080/

+ 44 - 0
src/api/business/conf.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询机理模型预测配置列表
+export function listConf(query) {
+  return request({
+    url: '/business/predictConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询机理模型预测配置详细
+export function getConf(id) {
+  return request({
+    url: '/business/predictConf/' + id,
+    method: 'get'
+  })
+}
+
+// 新增机理模型预测配置
+export function addConf(data) {
+  return request({
+    url: '/business/predictConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改机理模型预测配置
+export function updateConf(data) {
+  return request({
+    url: '/business/predictConf',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除机理模型预测配置
+export function delConf(id) {
+  return request({
+    url: '/business/predictConf/' + id,
+    method: 'delete'
+  })
+}

+ 91 - 15
src/views/business/comparison/components/echartConfig.js

@@ -1,5 +1,5 @@
 export const getEchartLineOption = ({ xAxisData, echartData, specificData }) => {
-  const colors = ["#5B8FF9", "#82c370", "#ffbf59"];
+  const colors = ["#5B8FF9", "#82c370", "#ffbf59", 'red'];
   const series = echartData.map(({ name, val: data }, index) => ({
     name,
     data,
@@ -14,6 +14,7 @@ export const getEchartLineOption = ({ xAxisData, echartData, specificData }) =>
   }));
 
   series.push({
+    name: 'TFT',
     tooltip: {
       show: false
     },
@@ -38,11 +39,12 @@ export const getEchartLineOption = ({ xAxisData, echartData, specificData }) =>
       end: 100,
       xAxisIndex: [0],
     }],
+    color: colors,
     grid: {
       left: "5%",
-      top: "2%",
+      top: "10%",
       right: "12%",
-      bottom: 30,
+      bottom: '18%',
       containLabel: true,
     },
     legend: {
@@ -53,18 +55,7 @@ export const getEchartLineOption = ({ xAxisData, echartData, specificData }) =>
       top: "center",
       itemWidth: 8,
       itemHeight: 8,
-      padding: [0, 30],
-      // selected: {
-      //   Real_1:true,
-      //   Real_2:false,
-      //   Real_3:false,
-      //   TFTpre_1: true,
-      //   TFTpre_2: false,
-      //   TFTpre_3: false,
-      //   LSTMpre_1: true,
-      //   LSTMpre_2: false,
-      //   LSTMpre_3: false
-      // }
+      padding: [0, 30]
     },
     tooltip: {
       trigger: "axis",
@@ -83,3 +74,88 @@ export const getEchartLineOption = ({ xAxisData, echartData, specificData }) =>
   };
   return option;
 };
+
+
+// const colors = ["#5B8FF9", "#82c370", "#ffbf59"];
+//   const series = echartData.map(({ name, val: data }, index) => ({
+//     name,
+//     data,
+//     type: "line",
+//     showSymbol: false,
+//     lineStyle: {
+//       width: 2,
+//       color: colors[index],
+//     },
+//     smooth: true,
+//     xAxisIndex: 0,
+//   }));
+
+//   series.push({
+//     tooltip: {
+//       show: false
+//     },
+//     type: "line",
+//     symbolSize: 8,
+//     itemStyle: {
+//       color: "red",
+//     },
+//     itemStyle: {
+//       color: colors[0],
+//     },
+//     xAxisIndex: 0,
+//     data: specificData,
+//   });
+
+//   const option = {
+//     dataZoom: [{
+//       bottom: 10,
+//       height: 20,
+//       show: true,
+//       start: 0,
+//       end: 100,
+//       xAxisIndex: [0],
+//     }],
+//     grid: {
+//       left: "5%",
+//       top: "2%",
+//       right: "12%",
+//       bottom: 30,
+//       containLabel: true,
+//     },
+//     legend: {
+//       left: "left",
+//       icon: "circle",
+//       orient: "vertical",
+//       left: "88%",
+//       top: "center",
+//       itemWidth: 8,
+//       itemHeight: 8,
+//       padding: [0, 30],
+//       // selected: {
+//       //   Real_1:true,
+//       //   Real_2:false,
+//       //   Real_3:false,
+//       //   TFTpre_1: true,
+//       //   TFTpre_2: false,
+//       //   TFTpre_3: false,
+//       //   LSTMpre_1: true,
+//       //   LSTMpre_2: false,
+//       //   LSTMpre_3: false
+//       // }
+//     },
+//     tooltip: {
+//       trigger: "axis",
+//     },
+//     xAxis: [
+//       {
+//         type: "category",
+//         boundaryGap: false,
+//         data: xAxisData,
+//       },
+//     ],
+//     yAxis: {
+//       type: "value",
+//     },
+//     series,
+//   };
+//   return option;

+ 14 - 7
src/views/business/comparison/index.vue

@@ -48,6 +48,9 @@
         <el-table-column label="LSTM预测1小时值" align="center" prop="yyForecastOne" width="140" />
         <el-table-column label="LSTM预测1误差值" align="center" prop="yyOneSubtract" width="150" />
         <el-table-column label="LSTM预测1小时百分比误差" align="center" prop="yyErrorRateOneStr" width="200" />
+        <el-table-column label="机理模型1小时值" align="center" prop="jlForecastOne" width="130" />
+        <el-table-column label="机理模型1小时差值" align="center" prop="jlOneSubtract" width="150" />
+        <el-table-column label="机理模型1小时百分比误差" align="center" prop="jlErrorRateOneStr" width="200" />
         <el-table-column label="预测2时间" align="center" prop="forecastTimeTwo" width="120" />
         <el-table-column label="实际2小时值" align="center" prop="realTwo" width="120" />
         <el-table-column label="TFT预测2小时值" align="center" prop="hsForecastTwo" width="120" />
@@ -56,6 +59,9 @@
         <el-table-column label="LSTM预测2小时值" align="center" prop="yyForecastTwo" width="140" />
         <el-table-column label="LSTM预测2误差值" align="center" prop="yyTwoSubtract" width="140" />
         <el-table-column label="LSTM预测2小时百分比误差" align="center" prop="yyErrorRateTwoStr" width="200" />
+        <el-table-column label="机理模型2小时值" align="center" prop="jlForecastTwo" width="130" />
+        <el-table-column label="机理模型2小时差值" align="center" prop="jlTwoSubtract" width="150" />
+        <el-table-column label="机理模型2小时百分比误差" align="center" prop="jlErrorRateTwoStr" width="200" />
         <el-table-column label="预测3时间" align="center" prop="forecastTimeThree" width="120" />
         <el-table-column label="实际3小时值" align="center" prop="realThree" width="120" />
         <el-table-column label="TFT预测3小时值" align="center" prop="hsForecastThree" width="120" />
@@ -64,6 +70,9 @@
         <el-table-column label="LSTM预测3小时值" align="center" prop="yyForecastThree" width="140" />
         <el-table-column label="LSTM预测3误差值" align="center" prop="yyThreeSubtract" width="140" />
         <el-table-column label="LSTM预测3小时百分比误差" align="center" prop="yyErrorRateThreeStr" width="190" />
+        <el-table-column label="机理模型3小时值" align="center" prop="jlForecastThree" width="130" />
+        <el-table-column label="机理模型3小时差值" align="center" prop="jlThreeSubtract" width="150" />
+        <el-table-column label="机理模型3小时百分比误差" align="center" prop="jlErrorRateThreeStr" width="200" />
       </el-table>
 
       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
@@ -296,12 +305,7 @@ export default {
         { name: 'TFT', val: [...data.hs.data, ...reusltData] },
         { name: '真实值', val: data.real.data },
         { name: 'LSTM', val: data.yy.data },
-        // { name: 'TFTpre_1', val: hsForecastOneList },
-        // { name: 'TFTpre_2', val: hsForecastTwoList },
-        // { name: 'TFTpre_3', val: hsForecastThreeList },
-        // { name: 'LSTMpre_1', val: yyForecastOneList },
-        // { name: 'LSTMpre_2', val: yyForecastTwoList },
-        // { name: 'LSTMpre_3', val: yyForecastThreeList }
+        { name: '机理模型', val: data.jl.data }
       ]
 
       const specificData = new Array(data.hs.data.length).fill(null).concat( reusltData );
@@ -378,7 +382,10 @@ export default {
           qynh31: '#1缺氧氨氮',
           qynh32: '#2缺氧氨氮'
         }
-        this.comparisonList = response.rows.map(item => ({ ...item, category: whiteList[item.category] }));
+        this.comparisonList = response.rows.map(item => ({ 
+          ...item, 
+          category: whiteList[item.category]
+        }));
         this.total = response.total;
         this.loading = false;
       });

+ 291 - 0
src/views/business/conf/index.vue

@@ -0,0 +1,291 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="Plus"
+          @click="handleAdd"
+          v-hasPermi="['business:conf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="Edit"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['business:conf:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="Delete"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['business:conf:remove']"
+        >删除</el-button>
+      </el-col>
+      <!-- <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="Download"
+          @click="handleExport"
+          v-hasPermi="['business:conf:export']"
+        >导出</el-button>
+      </el-col> -->
+      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="confList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="序号" align="center" type="index" prop="id" :width="50"/>
+      <el-table-column label="预测类型" align="center" prop="type">
+        <template #default="scope">
+          <span>{{ forecastType[scope.row.type] }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="Y1 可选择时间起始小时-最小值" align="center" prop="y1Min" />
+      <el-table-column label="Y1 可选择时间起始小时-最大值" align="center" prop="y1Max" />
+      <el-table-column label="X 可选择时间起始小时时间-最小值" align="center" prop="xMin" />
+      <el-table-column label="X 可选择时间起始小时时间-最大值" align="center" prop="xMax" />
+      <el-table-column label="进水COD限定值或者其他业务变量限定值" align="center" prop="x1" />
+      <el-table-column label="变动系统" align="center" prop="a" />
+      <el-table-column label="符合变动范围" align="center" prop="b" />
+      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:conf:edit']">修改</el-button>
+          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['business:conf:remove']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改机理模型预测配置对话框 -->
+    <el-dialog :title="title" v-model="open" width="900px" append-to-body>
+      <el-form ref="confRef" :model="form" :rules="rules" label-width="300px">
+        <el-form-item label="Y1 可选择时间起始小时-最小值" prop="y1Min">
+          <el-select v-model="form.type">
+            <el-option v-for="item in forecastOptions" :key="item.value" :label="item.label" :value="item.value" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="Y1 可选择时间起始小时-最小值" prop="y1Min">
+          <el-input v-model="form.y1Min" placeholder="请输入Y1 可选择时间起始小时-最小值" />
+        </el-form-item>
+        <el-form-item label="Y1 可选择时间起始小时-最大值" prop="y1Max">
+          <el-input v-model="form.y1Max" placeholder="请输入Y1 可选择时间起始小时-最大值" />
+        </el-form-item>
+        <el-form-item label="X 可选择时间起始小时时间-最小值" prop="xMin">
+          <el-input v-model="form.xMin" placeholder="请输入X 可选择时间起始小时时间-最小值" />
+        </el-form-item>
+        <el-form-item label="X 可选择时间起始小时时间-最大值" prop="xMax">
+          <el-input v-model="form.xMax" placeholder="请输入X 可选择时间起始小时时间-最大值" />
+        </el-form-item>
+        <el-form-item label="进水COD限定值或者其他业务变量限定值" prop="x1">
+          <el-input v-model="form.x1" placeholder="请输入进水COD限定值或者其他业务变量限定值" />
+        </el-form-item>
+        <el-form-item label="变动系统" prop="a">
+          <el-input v-model="form.a" placeholder="请输入变动系统" />
+        </el-form-item>
+        <el-form-item label="符合变动范围" prop="b">
+          <el-input v-model="form.b" placeholder="请输入符合变动范围" />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="Conf">
+import { listConf, getConf, delConf, addConf, updateConf } from "@/api/business/conf";
+
+const { proxy } = getCurrentInstance();
+
+const confList = ref([]);
+const open = ref(false);
+const loading = ref(true);
+const showSearch = ref(true);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const title = ref("");
+
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    type: null,
+    y1Min: null,
+    y1Max: null,
+    xMin: null,
+    xMax: null,
+    x1: null,
+    a: null,
+    b: null,
+    revision: null,
+  },
+  rules: {
+  }
+});
+
+const { queryParams, form, rules } = toRefs(data);
+
+const forecastType = {
+  0: "出水COD",
+  1: "出水氨氮",
+  2: "出水总氮",
+  3: "出水正磷盐",
+  4: "缺氧氨氮",
+  5: "缺氧硝酸盐"
+}
+
+const forecastOptions = [
+  { value: 0, label: "出水COD" },
+  { value: 1, label: "出水氨氮" },
+  { value: 2, label: "出水总氮" },
+  { value: 3, label: "出水正磷盐" },
+  { value: 4, label: "缺氧氨氮" },
+  { value: 5, label: "缺氧硝酸盐" }
+]
+
+/** 查询机理模型预测配置列表 */
+function getList() {
+  loading.value = true;
+  listConf(queryParams.value).then(response => {
+    confList.value = response.rows;
+    total.value = response.total;
+    loading.value = false;
+  });
+}
+
+// 取消按钮
+function cancel() {
+  open.value = false;
+  reset();
+}
+
+// 表单重置
+function reset() {
+  form.value = {
+    id: null,
+    type: null,
+    y1Min: null,
+    y1Max: null,
+    xMin: null,
+    xMax: null,
+    x1: null,
+    a: null,
+    b: null,
+    delFlag: null,
+    revision: null,
+    createBy: null,
+    createTime: null,
+    updateBy: null,
+    updateTime: null,
+    remark: null,
+    type: null
+  };
+  proxy.resetForm("confRef");
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map(item => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+/** 新增按钮操作 */
+function handleAdd() {
+  reset();
+  open.value = true;
+  title.value = "添加机理模型预测配置";
+}
+
+/** 修改按钮操作 */
+function handleUpdate(row) {
+  reset();
+  const _id = row.id || ids.value
+  getConf(_id).then(response => {
+    form.value = response.data;
+    open.value = true;
+    title.value = "修改机理模型预测配置";
+  });
+}
+
+/** 提交按钮 */
+function submitForm() {
+  proxy.$refs["confRef"].validate(valid => {
+    if (valid) {
+      if (form.value.id != null) {
+        updateConf(form.value).then(response => {
+          proxy.$modal.msgSuccess("修改成功");
+          open.value = false;
+          getList();
+        });
+      } else {
+        addConf(form.value).then(response => {
+          proxy.$modal.msgSuccess("新增成功");
+          open.value = false;
+          getList();
+        });
+      }
+    }
+  });
+}
+
+/** 删除按钮操作 */
+function handleDelete(row) {
+  const _ids = row.id || ids.value;
+  proxy.$modal.confirm('是否确认删除机理模型预测配置编号为"' + _ids + '"的数据项?').then(function() {
+    return delConf(_ids);
+  }).then(() => {
+    getList();
+    proxy.$modal.msgSuccess("删除成功");
+  }).catch(() => {});
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+  proxy.download('business/conf/export', {
+    ...queryParams.value
+  }, `conf_${new Date().getTime()}.xlsx`)
+}
+
+getList();
+</script>