Преглед изворни кода

性能分析评估页面联调

liujiejie пре 1 година
родитељ
комит
66d580ed5a

+ 1 - 2
src/api/dataManage.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2024-06-04 09:48:21
- * @LastEditTime: 2024-06-05 10:41:29
+ * @LastEditTime: 2024-06-05 15:24:06
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /dashengmag/performance-test/src/api/dataManage.js
@@ -30,7 +30,6 @@ export function editTimeGranularityQuery(data) {
     data,
   });
 }
-
 //转换\重新转换
 export function dataTransfer(data) {
   return request({

+ 63 - 6
src/api/performance.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2024-06-03 09:29:50
- * @LastEditTime: 2024-06-03 17:22:24
+ * @LastEditTime: 2024-06-06 16:00:28
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/api/performance。.js
@@ -15,7 +15,7 @@ export function getBatchMagList(data) {
     params: data,
   });
 }
-//新增
+//批次管理新增
 export function addFieldBatch(data) {
   return request({
     url: "/energy-manage-service/windEnginBatch/addFieldBatch",
@@ -23,7 +23,7 @@ export function addFieldBatch(data) {
     data,
   });
 }
-//编辑
+//批次管理编辑
 export function updateFieldBatch(data) {
   return request({
     url: "/energy-manage-service/windEnginBatch/updateFieldBatch",
@@ -31,7 +31,7 @@ export function updateFieldBatch(data) {
     data,
   });
 }
-//onOrOffFieldBatch更改状态
+//批次管理onOrOffFieldBatch更改状态
 export function onOrOffFieldBatch(data) {
   return request({
     url: "/energy-manage-service/windEnginBatch/onOrOffFieldBatch",
@@ -39,7 +39,7 @@ export function onOrOffFieldBatch(data) {
     data,
   });
 }
-//deleteFieldBatch 删除
+//批次管理deleteFieldBatch 删除
 export function deleteFieldBatch(data) {
   return request({
     url: "/energy-manage-service/windEnginBatch/deleteFieldBatch",
@@ -47,10 +47,67 @@ export function deleteFieldBatch(data) {
     data,
   });
 }
-//获取关联风场接口
+//批次管理获取关联风场接口
 export function queryCodeNum() {
   return request({
     url: "/energy-manage-service/sysOrganizationAuth/queryCodeNum",
     method: "get",
   });
 }
+//获取性能分析评估接口
+export function getAnalysisResultList(data) {
+  return request({
+    url: "/energy-manage-service/analysis/analysisResultList",
+    method: "get",
+    params: data,
+  });
+}
+//性能分析异常描述列表 /analysisErr/analysisErrQuery
+export function analysisErrQuery(data) {
+  return request({
+    url: "/energy-manage-service/analysisErr/analysisErrQuery",
+    method: "get",
+    params: data,
+  });
+}
+// //异常描述列表 风机编号/api/wind/engine/group/getWindEngineGroupByUser
+// export function getWindEngineGroupByUser(data) {
+//   return request({
+//     url: "/energy-manage-service/api/wind/engine/group/getWindEngineGroupByUser",
+//     method: "get",
+//     params: data,
+//   });
+// }
+
+//异常描述列表 分析类型、风机号查询   入参batchCode 批次编号  /analysis/analysisEditQuery
+export function analysisEditQuery(data) {
+  return request({
+    url: "/energy-manage-service/analysis/analysisEditQuery",
+    method: "get",
+    params: data,
+  });
+}
+//异常描述列表 添加/analysis/analysisErrAdd
+export function analysisErrAdd(data) {
+  return request({
+    url: "/energy-manage-service/analysisErr/analysisErrAdd",
+    method: "post",
+    data,
+  });
+}
+//删除 异常描述列
+export function analysisErrDel(data) {
+  return request({
+    url: "/energy-manage-service/analysisErr/analysisErrDel",
+    method: "post",
+    data,
+  });
+}
+//编辑 异常描述列/analysisErr/analysisErrEdit
+export function analysisErrEdit(data) {
+  return request({
+    url: "/energy-manage-service/analysisErr/analysisErrEdit",
+    method: "post",
+    data,
+  });
+}

+ 15 - 0
src/assets/init-vue.js

@@ -0,0 +1,15 @@
+/*
+ * @Author: your name
+ * @Date: 2024-06-05 14:39:45
+ * @LastEditTime: 2024-06-05 14:39:53
+ * @LastEditors: bogon
+ * @Description: In User Settings Edit
+ * @FilePath: /dashengmag/performance-test/src/assets/init-vue.js
+ */
+// static/init-vue.js
+
+// 初始化 Vue 应用的逻辑
+new Vue({
+  router,
+  render: (h) => h(App),
+}).$mount("#app");

+ 104 - 102
src/components/map/index.vue

@@ -1,11 +1,11 @@
 <!--
  * @Author: Rain
  * @Date: 2024/05/22 14:02:59
- * @LastEditTime: 2024/05/23 15:04:36
+ * @LastEditTime: 2024-06-06 09:29:04
  * @Description: Do Something
 -->
 <template>
-    <div id="map" class="map"></div>
+  <div id="map" class="map"></div>
 </template>
 
 <script>
@@ -18,115 +18,117 @@ import { Vector } from "ol/source";
 import { Vector as VectorLayer } from "ol/layer";
 import { Point } from "ol/geom";
 import { Icon, Style } from "ol/style";
-import ZoomSlider from 'ol/control/ZoomSlider.js';
-import {defaults as defaultControls} from 'ol/control.js';
+import ZoomSlider from "ol/control/ZoomSlider.js";
+import { defaults as defaultControls } from "ol/control.js";
 import icon from "../../assets/location.png";
 import icon2 from "../../assets/location.png"; //这只是一个演示  具体图片自己去定义
 export default {
-    name: "T-map",
-    mounted() {
-        this.map = new Map({
-            target: "map",
-            view: new View({
-                projection: "EPSG:4326",
-                center: fromLonLat([116.389, 39.903]), //地图中心
-                zoom: 5, //默认缩放级别  
-                minZoom: 5, //最小缩放级别
-                maxZoom: 12, //最大缩放级
-                extent: [70.3671875, 18.14576369243164, 134.92927612304688, 55.667146064662596]
-            }),
-            layers: [
-                new TileLayer({
-                    source: new XYZ({
-                        url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //根据自己实际的地理位置
-                    }),
-                }),
-                new VectorLayer({
-                    id: "marker",
-                    source: new Vector(),
-                }),
-            ],
-            controls: defaultControls().extend([new ZoomSlider()]),
+  name: "T-map",
+  mounted() {
+    this.map = new Map({
+      target: "map",
+      view: new View({
+        projection: "EPSG:4326",
+        center: fromLonLat([116.389, 39.903]), //地图中心
+        zoom: 5, //默认缩放级别
+        minZoom: 5, //最小缩放级别
+        maxZoom: 12, //最大缩放级
+        extent: [
+          70.3671875, 18.14576369243164, 134.92927612304688, 55.667146064662596,
+        ],
+      }),
+      layers: [
+        new TileLayer({
+          source: new XYZ({
+            url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //根据自己实际的地理位置
+          }),
+        }),
+        new VectorLayer({
+          id: "marker",
+          source: new Vector(),
+        }),
+      ],
+      controls: defaultControls().extend([new ZoomSlider()]),
+    });
+    console.log(this.map.getView().calculateExtent());
+    this.initEvent();
+  },
+  methods: {
+    /**
+     * 地图上打点
+     * @param data
+     */
+    addMarker(data = { point: [120.2, 30.35] }) {
+      const layer = this.map
+        .getLayers()
+        .getArray()
+        .find((element) => {
+          return element.get("id") === "marker";
         });
-        console.log(this.map.getView().calculateExtent())
-        this.initEvent();
-    },
-    methods: {
-        /**
-         * 地图上打点
-         * @param data
-         */
-        addMarker(data = { point: [120.2, 30.35] }) {
-            const layer = this.map
-                .getLayers()
-                .getArray()
-                .find((element) => {
-                    return element.get("id") === "marker";
-                });
-            const source = layer.getSource();
-            // const feature = new Feature({
-            //     geometry: new Point(fromLonLat(data.point)),
-            //     name: "marker",
-            //     data,
-            // });
+      const source = layer.getSource();
+      // const feature = new Feature({
+      //     geometry: new Point(fromLonLat(data.point)),
+      //     name: "marker",
+      //     data,
+      // });
 
-            const feature= new Feature ({
-                geometry: new Point(fromLonLat(data.point,'EPSG:4326')),
-                name:"marker",
-                data,
-            })
-            feature.setStyle(
-                new Style({
-                    image: new Icon({
-                        // src: this.$route.name === 'Index' ? icon : icon2,    //昨天说的不同图标可以在这里加判断,这里也只是一个演示 根据路由加载不同图标
-                        src:icon,
-                        scale: [0.3, 0.3],
-                        anchor: [0.5, 1],
-                        opacity: 1,
-                    }),
-                    // text: new Text({
-                    //   font: "12px Calibri,sans-serif",
-                    //   text: "",
-                    //   fill: new Fill({
-                    //     color: "red",
-                    //   }),
-                    // }),
-                })
-            );
-            source.addFeature(feature);
-        },
-        /**
-         * 初始化地图事件
-         */
-        initEvent() {
-            this.map.on("click", (evt) => {
-                const features = this.map.getFeaturesAtPixel(evt.pixel, {
-                    hitTolerance: 1,
-                });
-                if (features && features.length > 0) {
-                    const feature = features.at(0);
-                    this.$emit("feature-click", feature.get("data"));
-                }
-            });
-        },
-        /**
-         * 平移缩放
-         * @param data
-         */
-        moveAndZoom(data = { point: [120.2, 30.35], zoom: 10 }) {
-            this.map.getView().animate({
-                center: fromLonLat(data.point,'EPSG:4326'),
-                zoom: data.zoom,
-                duration: 2000,
-            });
-        },
+      const feature = new Feature({
+        geometry: new Point(fromLonLat(data.point, "EPSG:4326")),
+        name: "marker",
+        data,
+      });
+      feature.setStyle(
+        new Style({
+          image: new Icon({
+            // src: this.$route.name === 'Index' ? icon : icon2,    //昨天说的不同图标可以在这里加判断,这里也只是一个演示 根据路由加载不同图标
+            src: icon,
+            scale: [0.3, 0.3],
+            anchor: [0.5, 1],
+            opacity: 1,
+          }),
+          // text: new Text({
+          //   font: "12px Calibri,sans-serif",
+          //   text: "",
+          //   fill: new Fill({
+          //     color: "red",
+          //   }),
+          // }),
+        })
+      );
+      source.addFeature(feature);
+    },
+    /**
+     * 初始化地图事件
+     */
+    initEvent() {
+      this.map.on("click", (evt) => {
+        const features = this.map.getFeaturesAtPixel(evt.pixel, {
+          hitTolerance: 1,
+        });
+        if (features && features.length > 0) {
+          const feature = features.at(0);
+          this.$emit("feature-click", feature.get("data"));
+        }
+      });
+    },
+    /**
+     * 平移缩放
+     * @param data
+     */
+    moveAndZoom(data = { point: [120.2, 30.35], zoom: 10 }) {
+      this.map.getView().animate({
+        center: fromLonLat(data.point, "EPSG:4326"),
+        zoom: data.zoom,
+        duration: 2000,
+      });
     },
+  },
 };
 </script>
 
 <style scoped lang="scss">
 .map {
-    width: 100%;
-    height: 100%
+  width: 100%;
+  height: 100%;
 }
-</style>
+</style>

+ 26 - 14
src/views/dataAdministration/index.vue

@@ -621,26 +621,39 @@ export default {
       this.unusualdialog = true;
       this.errInfo = row.errInfo;
     },
-    // 下载
-    async handleClick(row) {
+    //下载
+    async handleClick() {
       try {
+        // 获取 HTML 内容
         const response = await axios.get("/downLoadApi", {
-          responseType: "text",
-        }); // 确保响应类型为文本
-        console.log(response, "结构");
-        const htmlContent = response.data; // HTML 内容
-        const blob = new Blob([htmlContent], { type: "text/html" }); // 创建 Blob 对象
-        const url = URL.createObjectURL(blob); // 创建临时 URL
-        window.open(url, "_blank"); // 在新标签页中打开该 URL
+          responseType: "blob",
+        }); // 确保响应类型为 Blob
+        const reader = new FileReader();
+        reader.onload = function (event) {
+          const htmlContent = event.target.result; // 读取的 HTML 内容
+          const newWindow = window.open("", "_blank");
+          newWindow.document.open();
+          newWindow.document.write(htmlContent);
+          newWindow.document.close();
+          // 获取当前页面的 URL
+          const currentUrl = window.location.href;
+          const proxyUrl = currentUrl.substring(0, currentUrl.indexOf("/", 8)); // 从第8个字符开始搜索,找到第一个 "/" 为止
+          // 拼接代理地址和接口路径
+          const apiEndpoint = proxyUrl + "/downLoadApi";
+
+          // 拼接新的路径
+          const newUrl = apiEndpoint + "/downLoadApi";
+          // 设置 base 元素
+          const baseElement = newWindow.document.createElement("base");
+          baseElement.href = newUrl; // 使用代理地址和接口路径
+          newWindow.document.head.appendChild(baseElement);
+        };
+        reader.readAsText(response.data, "utf-8"); // 以 UTF-8 编码读取 Blob
       } catch (error) {
         console.error("Failed to fetch data:", error);
         this.$message.error("无法打开新链接");
       }
     },
-    // 转换
-    transition(row) {},
-    // 重新转换
-    reconverted(row) {},
     async getTableList() {
       try {
         this.loading = true;
@@ -679,7 +692,6 @@ export default {
   },
 };
 </script>
-
 <style lang="scss" scoped>
 ::v-deep.dialogBox {
   .el-form-item__content .el-input--small .el-input__inner {

+ 57 - 167
src/views/performance/assetssMag.vue

@@ -8,10 +8,10 @@
         class="demo-form-inline"
         :rules="rules"
       >
-        <el-form-item label="风场名称:" prop="userName">
+        <el-form-item label="风场名称:" prop="fieldName">
           <el-input
             size="small"
-            v-model="formInline.userName"
+            v-model="formInline.fieldName"
             placeholder="请输入风场名称"
           ></el-input>
         </el-form-item>
@@ -34,17 +34,30 @@
         <el-table-column
           align="center"
           fixed
-          prop="userId"
+          prop="fieldName"
           label="风场名称"
           width="100"
         >
         </el-table-column>
-        <el-table-column align="center" label="批次编号" prop="userName">
+        <el-table-column align="center" label="批次编号" prop="batchCode">
         </el-table-column>
         <el-table-column prop="loginName" align="center" label="分析状态">
+          <template slot-scope="scope">
+            <span>
+              {{
+                scope.row.analysisState == 0
+                  ? "分析中"
+                  : scope.row.analysisState == -1
+                  ? "未分析"
+                  : scope.row.analysisState == 1
+                  ? "分析完成"
+                  : "/"
+              }}</span
+            >
+          </template>
         </el-table-column>
         <el-table-column
-          prop="state"
+          prop="errState"
           align="center"
           label="异常状态"
           width="100"
@@ -52,11 +65,11 @@
           <template slot-scope="scope">
             <span>
               {{
-                scope.row.state == 0
-                  ? "未启用"
-                  : scope.row.state == 1
-                  ? "启用"
-                  : "禁用"
+                scope.row.errState == 0
+                  ? "未异常"
+                  : scope.row.errState == 1
+                  ? "异常"
+                  : "/"
               }}</span
             >
           </template>
@@ -64,11 +77,13 @@
         <el-table-column prop="roleName" align="center" label="异常信息">
           <template slot-scope="scope">
             <el-button
+              v-if="scope.row.errState == 1"
               @click="abnormalDialog(scope.row, '异常详情')"
               type="text"
               size="small"
               >异常详情</el-button
             >
+            <span v-else>/</span>
           </template>
         </el-table-column>
         <el-table-column prop="roleName" align="center" label="分析记录">
@@ -81,7 +96,7 @@
             >
           </template>
         </el-table-column>
-        <el-table-column prop="roleName" align="center" label="创建时间">
+        <el-table-column prop="createTime" align="center" label="创建时间">
         </el-table-column>
         <el-table-column
           prop="transition"
@@ -119,7 +134,13 @@
     </div>
     <!-- 弹出层 -->
     <!-- 异常信息 /异常描述-->
-    <my-dialog :visible="dialogVisible" :title="title" @confirm="handleConfirm">
+    <my-dialog
+      :visible="dialogVisible"
+      :errorInfo="errorInfo"
+      :title="title"
+      :rowInfo="rowInfo"
+      @confirm="handleConfirm"
+    >
       <div slot="tableEl">
         <el-empty description="暂无数据"></el-empty>
       </div>
@@ -129,77 +150,35 @@
 
 <script>
 import MyDialog from "./components/dialogCom.vue";
-
+import { getAnalysisResultList } from "@/api/performance";
 export default {
   components: {
     MyDialog,
   },
   data() {
-    const validateUserName = (rule, value, callback) => {
-      const regex = /^[^\u4e00-\u9fa5\W]+$/;
-      if (!value) {
-        callback(new Error("账号名称不能为空"));
-      } else if (!regex.test(value)) {
-        callback(new Error("账号名称不能包含中文及特殊字符"));
-      } else {
-        callback();
-      }
-    };
-    const validatePhone = (rule, value, callback) => {
-      const phoneRegex = /^[1][3-9][0-9]{9}$/;
-      if (!value) {
-        return callback(new Error("手机号不能为空"));
-      }
-      if (!phoneRegex.test(value)) {
-        return callback(new Error("请输入正确的手机号"));
-      }
-      callback();
-    };
     return {
       dialogVisible: false,
       loadingView: false,
       loading: false, //数据加载中
+      errorInfo: "",
       rules: {
-        roleId: { trigger: "change" },
-        userName: { trigger: "blur" },
+        fieldName: { trigger: "blur" },
       },
       roleList: [],
       formInline: {
-        userName: undefined,
-        roleId: undefined,
+        fieldName: undefined,
         pageNum: 1,
         pageSize: 10,
-        // sort: "desc",
         totalSize: 0,
       },
-      tableData: [{}],
-      // 新增编辑表单
-      ruleForm: {
-        phone: null,
-        pwd: null,
-        roleId: null,
-        userName: null,
-        loginName: null,
-      },
-      addUserRules: {
-        phone: [
-          { required: true, message: "请输入手机号", trigger: "blur" },
-          { validator: validatePhone, trigger: "blur" },
-        ],
-        loginName: [
-          { required: true, message: "请输入账号名称", trigger: "blur" },
-          { validator: validateUserName, trigger: "blur" },
-        ],
-        pwd: { required: true, message: "请输入密码", trigger: "blur" },
-        roleId: { required: true, message: "请选择角色", trigger: "change" },
-        userName: [
-          { required: true, message: "请输入员工姓名", trigger: "blur" },
-        ],
-      },
+      tableData: [],
+      rowInfo: {},
       title: "",
     };
   },
-  created() {},
+  created() {
+    this.getTableList();
+  },
 
   methods: {
     //分析
@@ -217,32 +196,34 @@ export default {
       });
     },
     abnormalDialog(row, title) {
-      console.log("dialog 调起");
       this.dialogVisible = true;
+      if (title === "异常详情") {
+        this.errorInfo = row.errInfo;
+        this.rowInfo = {};
+      } else if (title === "异常描述") {
+        this.errorInfo = "";
+        this.rowInfo = row;
+      }
       this.title = title;
     },
     handleConfirm(slotContent) {
-      console.log("确认按钮点击");
-      console.log("插槽内容:", slotContent);
       this.dialogVisible = false;
     },
     //分页数据切换
     handleCurrentChange(val) {
       this.formInline.pageNum = val;
-      // this.getTableList();
+      this.getTableList();
     },
-    //修改状态
-    setState(state, userId) {},
     async getTableList() {
       try {
         this.loading = true;
-        // const result = await getUserTableList({
-        //   ...this.formInline,
-        //   totalSize: undefined,
-        // });
-        // this.tableData = result.data.list;
-        // this.formInline.totalSize = result.data.totalSize;
-        // this.loading = false;
+        const result = await getAnalysisResultList({
+          ...this.formInline,
+          totalSize: undefined,
+        });
+        this.tableData = result.data.list;
+        this.formInline.totalSize = result.data.totalSize;
+        this.loading = false;
       } catch (error) {
         this.$message({
           type: "error",
@@ -262,97 +243,6 @@ export default {
       this.$refs[formName].resetFields();
       this.getTableList();
     },
-
-    // 新增,编辑确定
-    // submitForm(formName) {
-    //   this.$refs[formName].validate((valid) => {
-    //     if (valid) {
-    //       this.loadingView = true;
-    //       switch (this.title) {
-    //         case "新增":
-    //           addUser({ ...this.ruleForm, userId: undefined })
-    //             .then((res) => {
-    //               this.$message({
-    //                 type: "success",
-    //                 message: res.msg,
-    //               });
-    //               this.getTableList();
-    //               this.nuedialog = false;
-    //               this.loadingView = false;
-    //             })
-    //             .catch(() => {
-    //               this.loadingView = false;
-    //             });
-
-    //           break;
-    //         case "编辑":
-    //           editUser({ ...this.ruleForm })
-    //             .then((res) => {
-    //               this.$message({
-    //                 type: "success",
-    //                 message: res.msg,
-    //               });
-    //               this.getTableList();
-    //               this.nuedialog = false;
-    //               this.loadingView = false;
-    //             })
-    //             .catch(() => {
-    //               this.loadingView = false;
-    //             });
-
-    //           break;
-    //       }
-    //       // this.nuedialog = false;
-    //     } else {
-    //       return false;
-    //     }
-    //   });
-    // },
-    //点击取消
-    // cancel(formName) {
-    //   this.$refs[formName] && this.$refs[formName].resetFields();
-    //   this.ruleForm = {
-    //     phone: null,
-    //     pwd: null,
-    //     roleId: null,
-    //     userName: null,
-    //     userId: null,
-    //     loginName: null,
-    //   };
-    //   this.nuedialog = false;
-    //   this.loadingView = false;
-    // },
-    // 编辑 回显数据
-    async compile(row) {
-      try {
-        // const result = await getUserInfoByUserId({ userId: row.userId });
-        const userInfo = result.data;
-        // 直接替换整个对象,以确保 Vue 的响应式系统能够检测到变化
-        this.ruleForm = {
-          phone: userInfo.userPhone,
-          pwd: undefined, // 如果需要重置密码字段
-          roleId: userInfo.roleId.toString(),
-          userName: userInfo.userName,
-          userId: userInfo.userId, // 如果需要用户ID
-          loginName: userInfo.loginName,
-        };
-        this.nuedialog = true;
-        this.title = "编辑";
-      } catch (error) {
-        this.$message.error("获取用户信息失败");
-      }
-    },
-    // 新增
-    newnuedialog() {
-      this.cancel("addUserForm");
-      this.ruleForm = {
-        loginName: "",
-        pwd: "",
-        userName: "",
-      };
-      this.nuedialog = true;
-      this.title = "新增";
-    },
   },
 };
 </script>

+ 137 - 43
src/views/performance/components/abnormalDetail.vue

@@ -3,18 +3,14 @@
     <div class="newly">
       <el-button type="primary" @click="addRow" size="small">新增</el-button>
     </div>
-
     <el-table :data="tableData" border>
       <el-table-column prop="name" label="异常数量" align="center">
         <template slot-scope="scope">
           <div v-if="scope.row.isEditing">
-            <el-input
-              v-model="scope.row.name"
-              placeholder="Enter name"
-            ></el-input>
+            <el-input v-model="scope.row.errCount" type="number"></el-input>
           </div>
           <div v-else>
-            {{ scope.row.name }}
+            {{ scope.row.errCount }}
           </div>
         </template>
       </el-table-column>
@@ -22,52 +18,67 @@
         <template slot-scope="scope">
           <div v-if="scope.row.isEditing">
             <el-input
-              v-model="scope.row.age"
+              v-model="scope.row.handleErrCount"
               type="number"
-              placeholder="Enter age"
             ></el-input>
           </div>
           <div v-else>
-            {{ scope.row.age }}
+            {{ scope.row.handleErrCount }}
           </div>
         </template>
       </el-table-column>
       <el-table-column prop="address" label="分析类型">
         <template slot-scope="scope">
-          <div v-if="scope.row.isEditing">
-            <el-input
-              v-model="scope.row.address"
-              placeholder="Enter address"
-            ></el-input>
+          <div v-if="scope.row.isEditing && setDataState === 'add'">
+            <el-select v-model="scope.row.analysisTypeCode" size="small">
+              <el-option
+                v-for="item in analysisTypeList"
+                :key="item.typeCode"
+                :label="item.typeName"
+                :value="item.typeCode"
+              ></el-option>
+            </el-select>
           </div>
           <div v-else>
-            {{ scope.row.address }}
+            {{ scope.row.analysisTypeName }}
           </div>
         </template>
       </el-table-column>
       <el-table-column prop="address" label="机组编号" align="center">
         <template slot-scope="scope">
-          <div v-if="scope.row.isEditing">
-            <el-input
-              v-model="scope.row.address"
-              placeholder="Enter address"
-            ></el-input>
+          <div v-if="scope.row.isEditing && setDataState === 'add'">
+            <el-select v-model="scope.row.engineCode" size="small">
+              <el-option
+                v-for="item in windEngineGroupList"
+                :key="item"
+                :label="item"
+                :value="item"
+              ></el-option>
+            </el-select>
           </div>
           <div v-else>
-            {{ scope.row.address }}
+            {{ scope.row.engineCode }}
           </div>
         </template>
       </el-table-column>
       <el-table-column prop="address" label="创建时间" align="center">
         <template slot-scope="scope">
-          <div v-if="scope.row.isEditing">/</div>
-          <div v-else>/</div>
+          <div v-if="scope.row.isEditing">
+            {{ scope.row.createTime ? scope.row.createTime : "/" }}
+          </div>
+          <div v-else>
+            {{ scope.row.createTime ? scope.row.createTime : "/" }}
+          </div>
         </template>
       </el-table-column>
       <el-table-column prop="address" label="更新时间" align="center">
         <template slot-scope="scope">
-          <div v-if="scope.row.isEditing">/</div>
-          <div v-else>/</div>
+          <div v-if="scope.row.isEditing">
+            {{ scope.row.updateTime ? scope.row.updateTime : "/" }}
+          </div>
+          <div v-else>
+            {{ scope.row.updateTime ? scope.row.updateTime : "/" }}
+          </div>
         </template>
       </el-table-column>
       <el-table-column label="操作" width="150" align="center">
@@ -84,9 +95,7 @@
             @click="submitRow(scope.$index)"
             >提交</el-button
           >
-          <el-button @click="deleteRow(scope.$index)" size="small"
-            >删除</el-button
-          >
+          <el-button @click="deleteRow(scope.row)" size="small">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -104,49 +113,134 @@
 </template>
 
 <script>
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {
+  analysisErrQuery,
+  analysisErrAdd,
+  analysisEditQuery,
+  analysisErrDel,
+  analysisErrEdit,
+} from "@/api/performance";
+
 export default {
+  components: {
+    Treeselect,
+  },
+  props: {
+    batchCode: String,
+  },
   data() {
     return {
+      setDataState: "",
       formInline: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         totalSize: 0,
       },
-      tableData: [
-        { name: "John", age: 25, address: "New York", isEditing: false },
-        { name: "Mike", age: 30, address: "Los Angeles", isEditing: false },
-        { name: "Kate", age: 22, address: "Chicago", isEditing: false },
-      ],
+      menuOptions: [],
+      tableData: [],
+      windEngineGroupList: [],
+      analysisTypeList: [],
     };
   },
+  created() {
+    this.getWindCodeList(this.batchCode);
+    this.getTableList(this.batchCode);
+  },
+  watch: {
+    batchCode(newVal) {
+      this.getWindCodeList(newVal);
+      this.getTableList(newVal);
+    },
+  },
+
   methods: {
     // 分页数据切换
     handleCurrentChange(val) {
       this.formInline.pageNum = val;
-      // this.getTableList();
+      this.getTableList(this.batchCode);
+    },
+    async getWindCodeList(batchCode) {
+      try {
+        const response = await analysisEditQuery({ batchCode });
+        this.analysisTypeList = response.data.analysisTypeList;
+        this.windEngineGroupList = response.data.windEngineGroupList;
+      } catch (error) {
+        console.error(error);
+      }
+    },
+    async getTableList(batchCode) {
+      try {
+        const response = await analysisErrQuery({
+          batchCode,
+          pageNum: this.formInline.pageNum,
+          pageSize: 5,
+        });
+        this.tableData = response.data.list;
+        this.formInline.totalSize = response.data.totalSize;
+        console.log(response, "response");
+      } catch (error) {
+        console.error(error);
+      }
     },
     // 新增数据
     addRow() {
+      this.setDataState = "add";
       this.tableData.unshift({
-        name: "",
-        age: null,
-        address: "",
+        batchCode: "",
+        engineCode: "",
+        analysisTypeCode: "",
+        errCount: "",
+        handleErrCount: "",
         isEditing: true,
       });
     },
     // 编辑行
     editRow(index) {
+      this.setDataState = "edit";
       this.$set(this.tableData[index], "isEditing", true);
     },
     // 提交行
-    submitRow(index) {
-      this.$set(this.tableData[index], "isEditing", false);
+    async submitRow(index) {
+      if (this.setDataState === "add") {
+        try {
+          const response = await analysisErrAdd({
+            batchCode: this.batchCode,
+            engineCode: this.tableData[0].engineCode,
+            analysisTypeCode: this.tableData[0].analysisTypeCode,
+            errCount: this.tableData[0].errCount,
+            handleErrCount: this.tableData[0].handleErrCount,
+          });
+          this.$set(this.tableData[index], "isEditing", false);
+          this.getTableList(this.batchCode);
+        } catch (err) {
+          console.error(err);
+        }
+      } else if (this.setDataState === "edit") {
+        try {
+          await analysisErrEdit({
+            id: this.tableData[index].id,
+            errCount: this.tableData[index].errCount,
+            handleErrCount: this.tableData[index].handleErrCount,
+          });
+          this.$set(this.tableData[index], "isEditing", false);
+          this.getTableList(this.batchCode);
+        } catch (err) {
+          console.error(err);
+        }
+      }
+
       // 处理提交逻辑,例如发送数据到服务器
-      console.log("Row submitted:", this.tableData[index]);
     },
     // 删除行
-    deleteRow(index) {
-      this.tableData.splice(index, 1);
+    async deleteRow(row) {
+      try {
+        await analysisErrDel({ id: row.id });
+        this.getTableList(this.batchCode);
+      } catch (err) {
+        console.error(err);
+      }
     },
   },
 };

+ 22 - 5
src/views/performance/components/dialogCom.vue

@@ -3,16 +3,23 @@
     :visible.sync="dialogVisible"
     :title="title"
     :before-close="handleClose"
+    :width="title === '异常详情' ? '750px' : '1120px'"
   >
     <!-- 根据 emptyFlag 和 title 显示不同的内容 -->
-    <slot v-if="emptyFlag" name="tableEl"></slot>
+    <!-- <slot v-if="emptyFlag" name="tableEl"></slot> -->
     <abnormal-detail
-      v-else-if="title === '异常描述'"
+      v-if="title === '异常描述'"
       ref="abnormalDetailRef"
+      :batchCode="rowInfo.batchCode"
     ></abnormal-detail>
+
+    <div class="dialogBox" v-if="title === '异常详情'">
+      <el-card shadow="always">
+        <i class="el-icon-warning"></i> {{ errorInfo }}
+      </el-card>
+    </div>
     <div slot="footer" v-if="title === '异常详情'" class="dialog-footer">
       <el-button @click="handleClose">取消</el-button>
-      <el-button type="primary" @click="handleConfirm">确定</el-button>
     </div>
   </el-dialog>
 </template>
@@ -27,18 +34,30 @@ export default {
   props: {
     title: String,
     visible: Boolean, // 控制对话框显示隐藏
+    errorInfo: String,
+    rowInfo: Object,
   },
   data() {
     return {
       dialogVisible: this.visible,
       emptyFlag: false,
+      batchCode: "",
     };
   },
+
   watch: {
     visible(newVal) {
       this.dialogVisible = newVal;
       this.checkEmptyFlag();
     },
+    rowInfo: {
+      handler(newVal, oldVal) {
+        console.log(newVal, oldVal, "dialognewVal, oldVal");
+        this.batchCode = newVal.batchCode;
+      },
+      deep: true,
+      immediate: true,
+    },
   },
   methods: {
     handleClose() {
@@ -47,7 +66,6 @@ export default {
     handleConfirm() {
       // 获取插槽内容并传递出去
       const slotContent = this.$slots.tableEl;
-      console.log(slotContent);
       this.$emit("confirm", slotContent);
     },
     checkEmptyFlag() {
@@ -55,7 +73,6 @@ export default {
         if (this.$refs.abnormalDetailRef) {
           const tableData = this.$refs.abnormalDetailRef.tableData;
           this.emptyFlag = !tableData || tableData.length === 0;
-          console.log(this.emptyFlag, "this.emptyFlag");
         }
       });
     },

+ 2 - 2
vue.config.js

@@ -65,8 +65,8 @@ module.exports = {
     proxy: {
       "/api": {
         // target: "http://192.168.5.4:16200", // 石月
-        // target: "http://192.168.50.235:16200", //内网
-        target: "http://192.168.5.15:16200",
+        target: "http://192.168.50.235:16200", //内网
+        // target: "http://192.168.5.15:16200",
         // target: "http://106.120.102.238:16600", //外网
         changeOrigin: true,
         pathRewrite: {