Browse Source

Merge remote-tracking branch 'origin/master'

liujiejie 1 year ago
parent
commit
de4695abc3

+ 29 - 0
src/api/ledger.js

@@ -385,4 +385,33 @@ export function saveWindFieldResource(data) {
     method: 'post',
     data
   })
+}
+
+// 风场资源文件删除
+export function delWindFieldResource(data) {
+  return request({
+    url: '/energy-manage-service/api/wind/field/delWindFieldResource',
+    method: 'post',
+    data
+  })
+}
+
+
+
+// 驾驶舱接口
+// 获取统计数
+export function getCompanyFieldNumberVo(data) {
+  return request({
+    url: '/energy-manage-service/sysOrganizationAuth/getCompanyFieldNumberVo',
+    method: 'post',
+    data
+  })
+}
+
+export function getSysOrganizationAuthTreeByRoleId(data) {
+  return request({
+    url: '/energy-manage-service/sysOrganizationAuth/getSysOrganizationAuthTreeByRoleId',
+    method: 'post',
+    data
+  })
 }

BIN
src/assets/img/icon01.png


BIN
src/assets/img/icon02.png


BIN
src/assets/img/icon03.png


BIN
src/assets/img/icon04.png


BIN
src/assets/img/icon05.png


+ 252 - 23
src/components/map/index.vue

@@ -1,13 +1,53 @@
-<!--
- * @Author: Rain
- * @Date: 2024/05/22 14:02:59
- * @LastEditTime: 2024-06-06 09:29:04
- * @Description: Do Something
--->
 <template>
-  <div id="map" class="map"></div>
+  <div class="map-container">
+    <div id="map" class="map"></div>
+    <div v-if="hoverInfo" :style="hoverStyle" class="hover-info">
+      <h3>XXXX风场</h3>
+      <div>
+        <p><span>风场编号</span><span>xxxx</span></p>
+        <p><span>风场名称</span><span>xxxx</span></p>
+        <p><span>空气密度-合同</span><span>xxxx</span></p>
+        <p><span>启用状态</span><span>xxxx</span></p>
+        <p><span>风机数量</span><span>xxxx</span></p>
+        <p><span>总额定容量</span><span>xxxx</span></p>
+        <p><span>经度</span><span>xxxx</span></p>
+        <p><span>纬度</span><span>xxxx</span></p>
+        <p><span>海拔高度</span><span>xxxx</span></p>
+        <p><span>更新时间</span><span>xxxx</span></p>
+      </div>
+    </div>
+    <div v-if="hoverfengji" :style="hoverfengjiStyle" class="hover-fengji">
+      <h3>XXX风机</h3>
+      <div>
+        <p><span>风机编号</span><span>xxxx</span></p>
+        <p><span>风机名称</span><span>xxxx</span></p>
+        <p><span>额定容量</span><span>xxxx</span></p>
+        <p><span>海拔高度</span><span>xxxx</span></p>
+        <p><span>轮毂高度</span><span>xxxx</span></p>
+        <p><span>经度</span><span>xxxx</span></p>
+        <p><span>维度</span><span>xxxx</span></p>
+        <p><span>是否标杆风机</span><span>xxxx</span></p>
+        <p><span>创建时间</span><span>xxxx</span></p>
+        <p><span>更新人</span><span>xxxx</span></p>
+        <p><span>更新时间</span><span>xxxx</span></p>
+      </div>
+    </div>
+    <div v-if="hoverta" :style="hovertaStyle" class="hover-ta">
+      <h3>XXXXX测风塔</h3>
+      <div>
+        <p><span>测风塔编号</span><span>xxxx</span></p>
+        <p><span>机型类型</span><span>xxxx</span></p>
+        <p><span>经度</span><span>xxxx</span></p>
+        <p><span>维度</span><span>xxxx</span></p>
+        <p><span>状态</span><span>xxxx</span></p>
+        <p><span>测风塔高度</span><span>xxxx</span></p>
+        <p><span>创建时间</span><span>xxxx</span></p>
+      </div>
+    </div>
+  </div>
 </template>
 
+
 <script>
 import "ol/ol.css";
 import { Map, View, Feature } from "ol";
@@ -22,8 +62,53 @@ 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"; //这只是一个演示  具体图片自己去定义
+
+import icon01 from "../../assets/img/icon01.png";
+import icon02 from "../../assets/img/icon02.png";
+import icon03 from "../../assets/img/icon03.png";
+import icon04 from "../../assets/img/icon04.png";
+import icon05 from "../../assets/img/icon05.png";
+import defaultIcon from "../../assets/img/icon05.png";
 export default {
+  maplist: {
+    type: Object,
+    default: () => {
+      return {};
+    },
+  },
   name: "T-map",
+  data() {
+    return {
+      hoverInfo: null,
+      hoverStyle: {
+        position: "absolute",
+        left: "0px", // Initialize left property
+        top: "0px",
+      },
+      hoverfengji: null,
+      hoverfengjiStyle: {
+        position: "absolute",
+        left: "0px", // Initialize left property
+        top: "0px",
+      },
+      hoverta: null,
+      hovertaStyle: {
+        position: "absolute",
+        left: "0px", // Initialize left property
+        top: "0px",
+      },
+    };
+  },
+  watch: {
+    maplist: {
+      handler(data) {
+        if (data) {
+          console.log(data);
+        }
+      },
+      deep: true, // 深度监听
+    },
+  },
   mounted() {
     this.map = new Map({
       target: "map",
@@ -32,7 +117,7 @@ export default {
         center: fromLonLat([116.389, 39.903]), //地图中心
         zoom: 5, //默认缩放级别
         minZoom: 5, //最小缩放级别
-        maxZoom: 12, //最大缩放级
+        maxZoom: 12, //最大缩放级
         extent: [
           70.3671875, 18.14576369243164, 134.92927612304688, 55.667146064662596,
         ],
@@ -58,7 +143,8 @@ export default {
      * 地图上打点
      * @param data
      */
-    addMarker(data = { point: [120.2, 30.35] }) {
+    addMarker(data = { point: [120.2, 30.35], val: "1" }) {
+      console.log(data);
       const layer = this.map
         .getLayers()
         .getArray()
@@ -66,11 +152,8 @@ export default {
           return element.get("id") === "marker";
         });
       const source = layer.getSource();
-      // const feature = new Feature({
-      //     geometry: new Point(fromLonLat(data.point)),
-      //     name: "marker",
-      //     data,
-      // });
+
+      const iconSrc = this.getIconForValue(data.val);
 
       const feature = new Feature({
         geometry: new Point(fromLonLat(data.point, "EPSG:4326")),
@@ -80,27 +163,88 @@ export default {
       feature.setStyle(
         new Style({
           image: new Icon({
-            // src: this.$route.name === 'Index' ? icon : icon2,    //昨天说的不同图标可以在这里加判断,这里也只是一个演示 根据路由加载不同图标
-            src: icon,
+            src: iconSrc,
             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);
     },
     /**
+     * 地图上打点
+     * @param data
+     */
+    clearMarkers() {
+      const layer = this.map
+        .getLayers()
+        .getArray()
+        .find((element) => {
+          return element.get("id") === "marker";
+        });
+      if (layer) {
+        const source = layer.getSource();
+        source.clear(); // 清空所有特征
+      }
+    },
+    getIconForValue(val) {
+      // Define icon sources based on different values of val
+      switch (val) {
+        case "-1" || -1:
+          return icon01; // Define icon1 variable with the path to the icon for val 1
+        case "2":
+          return icon02; // Define icon2 variable with the path to the icon for val 2
+        case "3":
+          return icon03; // Define icon3 variable with the path to the icon for val 3
+        case "4":
+          return icon04; // Define icon3 variable with the path to the icon for val 3
+        case "5":
+          return icon05; // Define icon3 variable with the path to the icon for val 3
+        default:
+          return defaultIcon; // Define defaultIcon variable with the path to the default icon
+      }
+    },
+
+    /**
      * 初始化地图事件
      */
     initEvent() {
+      this.map.on("pointermove", (evt) => {
+        const features = this.map.getFeaturesAtPixel(evt.pixel, {
+          hitTolerance: 1,
+        });
+        if (features && features.length > 0) {
+          const feature = features.at(0);
+          const val = feature.get("data").val;
+          if (val === "3") {
+            this.hoverInfo = `Marker at ${feature.get("data").point}`;
+            this.hoverStyle.left = `${evt.pixel[0] + 10}px`;
+            this.hoverStyle.top = `${evt.pixel[1] + 10}px`;
+          } else if (val === "4") {
+            this.hoverfengji = true;
+            this.hoverfengjiStyle.left = `${evt.pixel[0] + 10}px`;
+            this.hoverfengjiStyle.top = `${evt.pixel[1] + 10}px`;
+            this.currentFeatureData = feature.get("data"); // Store the feature data for click event
+          } else if (val === "5") {
+            this.hoverta = true;
+            this.hovertaStyle.left = `${evt.pixel[0] + 10}px`;
+            this.hovertaStyle.top = `${evt.pixel[1] + 10}px`;
+            this.currentFeatureData = feature.get("data"); // Store the feature data for click event
+          } else {
+            this.hoverInfo = null;
+            this.hoverfengji = false;
+            this.hoverta = false;
+            this.currentFeatureData = null; // Ensure no stored feature data if val is not 3 or 4
+          }
+        } else {
+          this.hoverInfo = null;
+          this.hoverfengji = false;
+          this.hoverta = false;
+          this.currentFeatureData = null; // Ensure no stored feature data if there are no features
+        }
+      });
+
       this.map.on("click", (evt) => {
         const features = this.map.getFeaturesAtPixel(evt.pixel, {
           hitTolerance: 1,
@@ -109,8 +253,20 @@ export default {
           const feature = features.at(0);
           this.$emit("feature-click", feature.get("data"));
         }
+        // Check if there's stored feature data and if it's a val === "4" feature
+        if (this.currentFeatureData && this.currentFeatureData.val === "4") {
+          // Handle click event for val === "4"
+          this.handleFeatureClick(this.currentFeatureData);
+        }
       });
     },
+
+    handleFeatureClick(featureData) {
+      // Implement your logic to handle the click event for val === "4"
+      // For example, emit an event or perform some action
+      console.log("Feature with val === '4' clicked:", featureData);
+    },
+
     /**
      * 平移缩放
      * @param data
@@ -127,8 +283,81 @@ export default {
 </script>
 
 <style scoped lang="scss">
+.map-container {
+  position: relative;
+  width: 100%;
+  height: 100%;
+}
+
 .map {
   width: 100%;
   height: 100%;
 }
+
+.hover-info {
+  position: absolute;
+  color: white;
+  padding: 0px;
+  z-index: 100;
+  h3 {
+    background-color: #008080cc;
+    width: 240px;
+    padding: 5px 10px;
+    font-size: 16px;
+  }
+  div {
+    background-color: #00808097;
+    width: 240px;
+    font-size: 12px;
+    p {
+      padding: 5px 10px;
+      display: flex;
+      justify-content: space-between;
+    }
+  }
+}
+.hover-fengji {
+  position: absolute;
+  color: white;
+  padding: 0px;
+  z-index: 100;
+  h3 {
+    background-color: #027cb4cc;
+    width: 240px;
+    padding: 5px 10px;
+    font-size: 16px;
+  }
+  div {
+    background-color: #027cb49e;
+    width: 240px;
+    font-size: 12px;
+    p {
+      padding: 5px 10px;
+      display: flex;
+      justify-content: space-between;
+    }
+  }
+}
+.hover-ta {
+  position: absolute;
+  color: white;
+  padding: 0px;
+  z-index: 100;
+  h3 {
+    background-color: #d90019b2;
+    width: 240px;
+    padding: 5px 10px;
+    font-size: 16px;
+  }
+  div {
+    background-color: #d9001994;
+    width: 240px;
+    font-size: 12px;
+    p {
+      padding: 5px 10px;
+      display: flex;
+      justify-content: space-between;
+    }
+  }
+}
 </style>

+ 28 - 11
src/components/selecttree.vue

@@ -4,7 +4,6 @@
       ref="elSelect"
       v-model="newVal"
       :placeholder="placeholder"
-      filterable
       :filter-method="filterTree"
       clearable
       @change="$forceUpdate()"
@@ -15,12 +14,12 @@
         <el-tree
           :data="openSearch ? searchData : list"
           ref="tree"
-          node-key="companyCode"
+          :node-key="defaultParentProps.value"
           :expand-on-click-node="false"
           :default-expanded-keys="defaultExpandedKeys"
           :current-node-key="newVal"
           highlight-current
-          :props="defaultProps"
+          :props="defaultParentProps"
           check-on-click-node
           auto-expand-parent
           @node-click="handleNodeClick"
@@ -49,15 +48,25 @@ export default {
       type: String,
       default: "请选择",
     },
+    type: {
+      type: String,
+      default: "0",
+    },
+    defaultParentProps: {
+      type: Object,
+      default: () => {
+        return {
+          children: "children",
+          label: "companyName",
+          value: "companyCode",
+        };
+      },
+    },
   },
 
   data() {
     return {
-      defaultProps: {
-        children: "children",
-        label: "companyName",
-        value: "companyCode",
-      },
+      defaultProps: {},
       newVal: "", //本页面选中的数据
       label: "",
       selectTree: {},
@@ -85,6 +94,14 @@ export default {
       deep: true, // 深度监听
       immediate: true, //首次触发
     },
+    list: {
+      handler(value) {
+        if (value && this.type === "1") {
+          this.newVal = value[0][this.defaultParentProps.value];
+        }
+      },
+      deep: true, // 深度监听
+    },
     newVal(value) {
       const check = this.findLabel(this.list, value);
       if (check) {
@@ -103,8 +120,8 @@ export default {
   methods: {
     //节点选择事件
     handleNodeClick(data) {
-      this.newVal = data.companyCode;
-      this.label = data.companyName;
+      this.newVal = data[this.defaultParentProps.value];
+      this.label = data[this.defaultParentProps.label];
       this.$refs.elSelect.blur();
       this.searchData = [];
       this.openSearch = false;
@@ -139,7 +156,7 @@ export default {
     findLabel(arr, value) {
       for (let i = 0; i < arr.length; i++) {
         const item = arr[i];
-        if (item.companyCode === value) {
+        if (item[this.defaultParentProps.value] === value) {
           return item;
         } else if (item.children && item.children.length > 0) {
           const result = this.findLabel(item.children, value);

+ 135 - 26
src/views/admin/cockpitManage/Index.vue

@@ -1,20 +1,36 @@
 <template>
   <div class="map-ditu">
-    <Tmap ref="map" @feature-click="featureClick"></Tmap>
+    <Tmap ref="map" :maplist="maplist" @feature-click="featureClick"></Tmap>
     <div class="ledata">
-      <el-input v-model="treeval" @focus="showTree = true"></el-input>
-      <div class="Showtree">
-        <el-tree
-          v-if="showTree"
-          :data="treeData"
-          @node-click="handleNodeClick"
-        ></el-tree>
-      </div>
-
-      <p><span class="SpText">风场总数:</span>20 个</p>
-      <p><span class="SpText">已分析风场:</span>10 个</p>
-      <p><span class="SpText">未分析风场:</span>10个</p>
-      <p><span class="SpText">风机数量:</span>10 个</p>
+      <selecttree
+        placeholder="请选择上级单位"
+        :list="parentOpt"
+        type="1"
+        v-model="companyCode"
+        @change="parentChange"
+        :defaultParentProps="{
+          children: 'children',
+          label: 'companyName',
+          value: 'codeNumber',
+        }"
+      >
+      </selecttree>
+
+      <p>
+        <span class="SpText">风场总数:</span>{{ totalList.fieldSumNumber }} 个
+      </p>
+      <p>
+        <span class="SpText">已分析风场:</span
+        >{{ totalList.analysisFinishNumber }} 个
+      </p>
+      <p>
+        <span class="SpText">未分析风场:</span
+        >{{ totalList.analysisUnFinishedNumber }} 个
+      </p>
+      <p>
+        <span class="SpText">风机数量:</span
+        >{{ totalList.engineGroupNumber }} 个
+      </p>
       <p>
         <span class="SpText">风机状态:</span>
         <span class="red"></span>
@@ -35,6 +51,11 @@
 </template>
 
 <script>
+import selecttree from "../../../components/selecttree.vue";
+import {
+  getCompanyFieldNumberVo,
+  getSysOrganizationAuthTreeByRoleId,
+} from "@/api/ledger.js";
 import Tmap from "@/components/map";
 import Rightdata from "./component/rightdata.vue";
 export default {
@@ -42,6 +63,7 @@ export default {
   components: {
     Tmap,
     Rightdata,
+    selecttree,
   },
   data() {
     return {
@@ -67,22 +89,99 @@ export default {
           label: "Node 2",
         },
       ],
+      maplist: [
+        { point: [116.4074, 39.9042], val: "1" },
+        { point: [104.0657, 30.6595], val: "2" },
+        { point: [108.9402, 34.3416], val: "3" },
+      ],
+      totalList: [],
+      parentOpt: [],
+      companyCode: "",
     };
   },
-
+  created() {
+    this.GETtree();
+    this.GETtotal();
+  },
   mounted() {
     //模拟地图上的点位
-    const data = [{ point: [120.2, 30.35] }];
+    const data = this.maplist;
     data.forEach((element) => {
       console.log(element);
-      this.$refs.map.addMarker(element);
+      // this.$refs.map.addMarker({ point: [116.40740,39.90420], val: "1" });
     });
   },
 
   methods: {
-    clickEvent(data) {
-      console.log(data);
-      this.$router.push({ name: "about" });
+    // 获取总数
+    GETtotal() {
+      getCompanyFieldNumberVo().then((res) => {
+        this.totalList = res.data;
+      });
+    },
+    // 获取企业数
+    async GETtree() {
+      const res = await getSysOrganizationAuthTreeByRoleId();
+      const treedata = res.data;
+      const processedData = this.processTreeData(treedata);
+      this.parentOpt = processedData;
+    },
+
+    //过滤数据
+    processTreeData(treeData) {
+      const processedData = [];
+      function processNode(node) {
+        if (node.codeType === "field") {
+          node.companyName = node.fieldName;
+        }
+        if (node.children && node.children.length > 0) {
+          node.children.forEach((child) => {
+            processNode(child);
+          });
+        }
+      }
+      treeData.forEach((root) => {
+        processNode(root);
+        processedData.push(root);
+      });
+
+      return processedData;
+    },
+    parseCoordinates(input) {
+      if (input && typeof input === "string") {
+        return input.split(",").map(Number);
+      }
+      return [];
+    },
+    parentChange(data) {
+      //data为当前选中对象
+      this.maplist = data;
+      console.log(data, "parentChange");
+      if (data.codeType === "field") {
+        if (this.parseCoordinates(data.longitudeAndLatitudeString).length > 0) {
+          this.$refs.map.addMarker({
+            point: this.parseCoordinates(data.longitudeAndLatitudeString),
+            val: data.analysisState,
+          });
+          return;
+        }
+        this.$refs.map.clearMarkers();
+      } else {
+        const dataMapList = data.children;
+        dataMapList.forEach((element) => {
+          console.log(element);
+          if (
+            this.parseCoordinates(element.longitudeAndLatitudeString).length > 0
+          ) {
+            this.$refs.map.addMarker({
+              point: this.parseCoordinates(element.longitudeAndLatitudeString),
+              val: element.analysisState,
+            });
+            return;
+          }
+          this.$refs.map.clearMarkers();
+        });
+      }
     },
 
     handleSwitchChange() {
@@ -94,9 +193,19 @@ export default {
       // 隐藏树列表
       this.showTree = false;
     },
-    featureClick() {
-      this.$router.push("cockpitManage/electronic-map");
-      //点击事件  跳转B页面
+    featureClick(data) {
+      const val = data.val;
+
+      if (val === "-1" || val === -1) {
+        this.$message.error("当前风场未进行分析");
+      } else if (val === "2") {
+        this.$message({
+          message: "当前风场正在分析中",
+          type: "warning",
+        });
+      } else if (val === "3") {
+        this.$router.push("cockpitManage/electronic-map");
+      }
     },
   },
 };
@@ -104,9 +213,9 @@ export default {
 
 <style lang="scss" scoped>
 .map-ditu {
-  min-width: 86.9vw;
-  max-width: 94.9vw;
-  height: 93.4vh;
+  // min-width: 86.9vw;
+  // max-width: 94.9vw;
+  height: 93vh;
   position: relative;
 }
 

+ 0 - 295
src/views/admin/cockpitManage/component/rightdata copy.vue

@@ -1,295 +0,0 @@
-<template>
-
-
-    <div class="backbone">
-        <div>
-            <h3>风场分析完成率</h3>
-            <div id="main" style="width: 260px; height: 160px;"></div>
-
-        </div>
-        <div>
-            <h3>异常设备概览</h3>
-            <div class="BOX">
-                <div style="display: flex;">
-                    <div class="YC01">
-                        <strong>4545</strong>
-                        <span>异常总数</span>
-                    </div>
-                    <div class="YC02">
-                        <strong>20</strong>
-                        <span>本月异常</span>
-                    </div>
-                </div>
-
-                <div style="display: flex;">
-                    <div class="YC02">
-                        <strong class="textred">0</strong>
-                        <span>未处理异常</span>
-                    </div>
-                    <div class="YC02">
-                        <strong class="texyellow">20</strong>
-                        <span>异常设备数</span>
-                    </div>
-                    <div class="YC03">
-
-                    </div>
-
-                </div>
-            </div>
-        </div>
-        <div>
-            <h3>异常数据信息</h3>
-            <div>
-                <el-table v-loading="shujuloading" :data="tableData" :max-height="150" ref="shujuscroll_Table" stripe
-                    @mouseenter.native="shujuautoScroll(true)" @mouseleave.native="shujuautoScroll(false)"
-                    class="Tabtab">
-                    <el-table-column prop="name" label="姓名">
-                    </el-table-column>
-                    <el-table-column prop="date" label="日期">
-                    </el-table-column>
-                    <el-table-column prop="date" label="记录">
-                    </el-table-column>
-                </el-table>
-            </div>
-        </div>
-        <div>
-            <h3>近期操作记录</h3>
-            <div>
-                <el-table v-loading="loading" :data="tableData" :max-height="150" ref="scroll_Table" stripe
-                    @mouseenter.native="autoScroll(true)" @mouseleave.native="autoScroll(false)" class="Tabtab">
-                    <el-table-column prop="name" label="姓名">
-                    </el-table-column>
-                    <el-table-column prop="date" label="日期">
-                    </el-table-column>
-                    <el-table-column prop="date" label="记录">
-                    </el-table-column>
-                </el-table>
-            </div>
-        </div>
-
-    </div>
-</template>
-
-<script>
-import * as echarts from 'echarts';
-export default {
-    data() {
-        return {
-
-            myChart: null,
-            loading: false,
-            shujuloading: false,
-            tableData: [{ name: '王小虎', }, { name: '王小虎', }, { name: '王小虎', }, { name: '王小虎', }, { name: '王小虎', }, { name: '王小虎', }],
-            scrolltimer: '', // 自动滚动的定时任务
-        }
-    },
-    mounted() {
-        this.autoScroll()
-        this.shujuautoScroll()
-        this.initChart();
-
-    },
-    beforeDestroy() {
-        this.autoScroll(true)
-        this.shujuautoScroll(true)
-    },
-
-
-    methods: {
-        autoScroll(stop) {
-            const table = this.$refs.scroll_Table
-            // 拿到表格中承载数据的div元素
-            const divData = table.$refs.bodyWrapper
-            // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
-            if (stop) {
-                //再通过事件监听,监听到 组件销毁 后,再执行关闭计时器。
-                window.clearInterval(this.scrolltimer)
-            } else {
-                this.scrolltimer = window.setInterval(() => {
-                    // 元素自增距离顶部1像素
-                    divData.scrollTop += 1
-                    // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
-                    if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
-                        // 重置table距离顶部距离
-                        divData.scrollTop = 0
-                        // 重置table距离顶部距离。值=(滚动到底部时,距离顶部的大小) - 整个高度/2
-                        // divData.scrollTop = divData.scrollTop - divData.scrollHeight / 2
-                    }
-                }, 150) // 滚动速度
-
-            }
-        },
-        shujuautoScroll(stop) {
-            const table = this.$refs.shujuscroll_Table
-            // 拿到表格中承载数据的div元素
-            const divData = table.$refs.bodyWrapper
-            // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
-            if (stop) {
-                //再通过事件监听,监听到 组件销毁 后,再执行关闭计时器。
-                window.clearInterval(this.scrolltimer)
-            } else {
-                this.scrolltimer = window.setInterval(() => {
-                    // 元素自增距离顶部1像素
-                    divData.scrollTop += 1
-                    // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
-                    if (divData.clientHeight + divData.scrollTop == divData.scrollHeight) {
-                        // 重置table距离顶部距离
-                        divData.scrollTop = 0
-                        // 重置table距离顶部距离。值=(滚动到底部时,距离顶部的大小) - 整个高度/2
-                        // divData.scrollTop = divData.scrollTop - divData.scrollHeight / 2
-                    }
-                }, 150) // 滚动速度
-
-            }
-        },
-
-        initChart() {
-            var chartDom = document.getElementById('main');
-            var myChart = echarts.init(chartDom);
-            var option;
-
-            option = {
-                tooltip: {
-                    trigger: 'item',
-                    formatter: function (params) {
-                        var percent = params.percent.toFixed(2) + '%';
-                        return `${params.name}: ${params.value} (${percent})`;
-                    }
-                },
-                legend: {
-                    orient: 'vertical',
-                    left: 'left',
-                    top: '30%' // 将图例向下移动一些
-                },
-                series: [
-                    {
-                        type: 'pie',
-                        radius: ['40%', '80%'],
-                        avoidLabelOverlap: false,
-                        label: {
-                            show: false,
-                            position: 'center'
-                        },
-                        labelLine: {
-                            show: false
-                        },
-                        center: ['60%', '50%'], // 将饼图往右移动一些
-                        data: [
-                            { value: 15, name: '已完成', itemStyle: { color: '#7ECF51' } },
-                            { value: 50, name: '进行中', itemStyle: { color: '#EECB5F' } },
-                            { value: 30, name: '未开始', itemStyle: { color: '#E16757' } },
-                        ]
-                    }
-                ]
-            };
-
-            option && myChart.setOption(option);
-        }
-
-
-
-    }
-};
-</script>
-
-
-<style lang="scss" scoped>
-.backbone {
-    width: 300px;
-    color: #FFF;
-    background: #008080;
-    height: 95%;
-    border-radius: 5px;
-    padding: 20px;
-
-}
-
-.BOX {
-    background: #004F5F;
-    display: flex;
-
-
-    padding-left: 10px;
-    flex-wrap: wrap;
-    padding-bottom: 15px;
-
-}
-
-.YC01 {
-    width: 154px;
-    height: 60px;
-    background-image: url('../../../../assets/001.png');
-    background-size: 154px 60px;
-    background-repeat: no-repeat;
-    background-position: center;
-    margin-right: 15px;
-    margin-top: 15px;
-    text-align: center;
-
-    strong {
-        display: block;
-        font-size: 26px;
-        color: #4BFFFF;
-    }
-
-    span {
-        display: block;
-        font-size: 12px;
-
-    }
-}
-
-.YC02 {
-    width: 70px;
-    height: 60px;
-    background-image: url('../../../../assets/002.png');
-    background-size: 70px 60px;
-    background-repeat: no-repeat;
-    background-position: center;
-    margin-right: 15px;
-    margin-top: 15px;
-    text-align: center;
-
-    .textred {
-        color: #D9001B;
-    }
-
-    .texyellow {
-        color: #FACD91;
-    }
-
-    strong {
-        display: block;
-        font-size: 26px;
-        color: #4BFFFF;
-    }
-
-    span {
-        display: block;
-        font-size: 12px;
-
-    }
-}
-
-.YC03 {
-    width: 70px;
-    height: 60px;
-}
-
-.Tabtab {
-    font-size: 12px;
-}
-
-::v-deep.el-table__cell {
-    padding: 2px 0 !important
-}
-
-::v-deep.el-table .el-table__cell {
-    padding: 2px 0 !important
-}
-
-
-::v-deep.el-table--scrollable-y .el-table__body-wrapper {
-    overflow-y: clip !important
-}
-</style>

+ 20 - 18
src/views/admin/cockpitManage/electronicMap.vue

@@ -1,43 +1,45 @@
 <template>
   <div class="map-ditu">
     <Tmap ref="map"></Tmap>
-    <!-- <router-view></router-view> -->
   </div>
 </template>
 
 <script>
 import Tmap from "@/components/map";
+
 export default {
   name: "Index",
   components: {
     Tmap,
   },
-  data() {
-    return {};
-  },
 
   mounted() {
-    //模拟地图上的点位
-    const data = [{ point: [120.2, 30.35] }, { point: [120.21, 30.35] }];
-    data.forEach((element) => {
-      console.log(element);
-      this.$refs.map.addMarker(element);
-    });
-    this.$nextTick(() => {
-      //模拟需求中的B页面 跳转缩放定位
-      this.$refs.map.moveAndZoom({ point: [120.2, 30.35], zoom: 15 });
-    });
+    this.addMarkersAndZoom();
   },
 
-  methods: {},
+  methods: {
+    addMarkersAndZoom() {
+      const points = [
+        { point: [120.2, 30.35], val: "4" },
+        { point: [120.21, 30.35], val: "5" },
+      ];
+
+      // Add markers to the map
+      points.forEach((point) => {
+        this.$refs.map.addMarker(point);
+      });
+
+      // Zoom to a specific point
+      const zoomPoint = { point: [120.2, 30.35], zoom: 15 };
+      this.$refs.map.moveAndZoom(zoomPoint);
+    },
+  },
 };
 </script>
 
 <style lang="scss" scoped>
 .map-ditu {
-  min-width: 86.9vw;
-  max-width: 94.9vw;
-  height: 93.4vh;
+  height: 93vh;
   position: relative;
 }
 </style>

+ 535 - 0
src/views/ledger/anemometer copy.vue

@@ -0,0 +1,535 @@
+<template>
+  <div class="global-variable">
+    <div class="condition">
+      <el-form :inline="true" :model="formInline" class="demo-form-inline">
+        <el-form-item label="测风塔名称:">
+          <el-input
+            v-model="formInline.anemometerName"
+            placeholder="请输入测风塔名称"
+            size="small"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="选择日期:" size="small">
+          <el-date-picker
+            v-model="formInline.timeQuantum"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="onDateChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="onSubmit" size="small"
+            >查询</el-button
+          >
+          <el-button @click="reset" size="small">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="list-page">
+      <div class="newly">
+        <el-button type="primary" @click="newnuedialog" size="small"
+          >新增</el-button
+        >
+      </div>
+
+      <el-table
+        class="center-align-table"
+        :data="tableData"
+        border
+        :cell-style="rowStyle"
+      >
+        <el-table-column
+          align="center"
+          fixed
+          prop="anemometerName"
+          label="测风塔名称"
+        >
+          <template slot-scope="scope">
+            <el-button
+              @click="particulars(scope.row)"
+              type="text"
+              size="small"
+              >{{ scope.row.anemometerName }}</el-button
+            >
+          </template>
+        </el-table-column>
+
+        <el-table-column
+          prop="anemometerCode"
+          align="center"
+          label="测风塔编号"
+        >
+        </el-table-column>
+
+        <el-table-column
+          prop="longitude"
+          align="center"
+          label="经度"
+          width="200"
+        >
+        </el-table-column>
+
+        <el-table-column
+          prop="latitude"
+          align="center"
+          label="纬度"
+          width="200"
+        >
+        </el-table-column>
+        <el-table-column prop="state" align="center" label="状态" width="100">
+          <template slot-scope="{ row }">
+            {{ row.state == 1 ? '启用' : '停用' }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="createTime" align="center" label="创建时间">
+        </el-table-column>
+        <el-table-column
+          prop="transition"
+          align="center"
+          fixed="right"
+          label="操作"
+          width="200"
+        >
+          <template slot-scope="scope">
+            <el-button @click="compile(scope.row)" type="text" size="small"
+              >编辑</el-button
+            >
+
+            <el-button
+              v-if="scope.row.state == 0"
+              @click="start(scope.row, 1)"
+              type="text"
+              size="small"
+              >启用</el-button
+            >
+            <el-button
+              v-else
+              style="color: #666"
+              @click="start(scope.row, 0)"
+              type="text"
+              size="small"
+              >停用</el-button
+            >
+            <el-button
+              style="color: #f00"
+              @click="deleted(scope.row)"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination-container">
+        <el-pagination
+          @current-change="handleCurrentChange"
+          :current-page.sync="formInline.pageNum"
+          layout="total, prev, pager, next"
+          :page-size="formInline.pageSize"
+          :total="formInline.totalSize"
+        >
+        </el-pagination>
+      </div>
+    </div>
+
+    <!-- 弹出层 -->
+
+    <!-- 新增 -->
+    <el-dialog
+      :title="title"
+      :visible.sync="nuedialog"
+      width="860px"
+      @close="resetForm"
+    >
+      <div class="addition">
+        <span @click="addition">
+          <SvgIcons
+            name="jia"
+            class="jia"
+            width="20px"
+            height="22px"
+            color="#222"
+          ></SvgIcons>
+        </span>
+        <span @click="subtraction">
+          <SvgIcons
+            name="jian"
+            class="jian"
+            width="20px"
+            height="22px"
+            color="#222"
+          ></SvgIcons>
+        </span>
+      </div>
+      <div class="general">
+        <div class="condition">
+          <p>测风塔名称:</p>
+          <el-input v-model="anemometerName"></el-input>
+        </div>
+        <div class="condition">
+          <p>经度:</p>
+          <el-input v-model="latitude"></el-input>
+        </div>
+
+        <div class="condition">
+          <p>纬度:</p>
+          <el-input v-model="longitude"></el-input>
+        </div>
+        <div
+          v-for="(tower, index) in anemometerTowerHeightDtoList || [
+            { anemometerHeight: '' }
+          ]"
+          :key="index"
+          class="condition"
+        >
+          <p>测风塔高度{{ index + 1 }}:</p>
+          <el-input
+            v-model="tower.anemometerHeight"
+            placeholder="请输入测风塔高度"
+          ></el-input>
+        </div>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="nuedialog = false" size="small">取 消</el-button>
+        <el-button type="primary" @click="newly" size="small">确 定</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 测风塔详情 -->
+    <el-dialog title="详情" :visible.sync="unusualdialog" width="400px">
+      <p>测风塔名称:{{ hightower.anemometerName }}</p>
+      <p>测风塔编号:{{ hightower.anemometerCode }}</p>
+      <p>经度:{{ hightower.longitude }}</p>
+      <p>维度:{{ hightower.latitude }}</p>
+      <p>状态: {{ hightower.state === 1 ? '启用' : '停用' }}</p>
+      <p v-for="(item, index) in cftList" :key="index">
+        测风塔高度:{{ item.anemometerHeight }}米
+      </p>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  createAnemometerTower,
+  delAnemometerTower,
+  getAnemometerTower,
+  getAnemometerTowerPage,
+  updateAnemometerTower,
+  updateAnemometerTowerState
+} from '@/api/ledger.js'
+export default {
+  data() {
+    return {
+      tableData: [],
+      formInline: {
+        anemometerName: '',
+        timeQuantum: [],
+        pageNum: 1,
+        pageSize: 10,
+        totalSize: 0
+      },
+      startDate: '',
+      endDate: '',
+      // 新增测风塔信息
+      anemometerName: '',
+      latitude: '',
+      longitude: '',
+      anemometerTowerHeightDtoList: [
+        {
+          anemometerHeight: ''
+        }
+      ],
+      errors: [],
+      hightower: [],
+      cftList: [],
+      // 新增信息
+      nuedialog: false,
+      unusualdialog: false,
+      title: '',
+      isEdit: false,
+      detail: {}
+    }
+  },
+  created() {
+    this.onSubmit()
+  },
+  methods: {
+    rowStyle() {
+      return 'text-align:center'
+    },
+    onDateChange(date) {
+      if (Array.isArray(date)) {
+        this.startDate = this.$formatDate(date[0])
+        this.endDate = this.$formatDate(date[1])
+        if (this.endDate < this.startDate) {
+          this.endDate = this.startDate
+        }
+      } else {
+        this.startDate = null
+        this.endDate = null
+      }
+    },
+
+    // 查询
+    onSubmit() {
+      let paramsData = {
+        anemometerName: this.formInline.anemometerName || undefined,
+        beginTime: this.startDate || undefined,
+        endTime: this.endDate || undefined,
+        pageNum: this.formInline.pageNum,
+        pageSize: this.formInline.pageSize
+      }
+      getAnemometerTowerPage(paramsData).then((res) => {
+        this.tableData = res.data.list
+        this.formInline.totalSize = res.data.totalSize
+      })
+    },
+    // 重置
+    reset() {
+      this.formInline.anemometerName = ''
+      this.formInline.timeQuantum = []
+      this.endDate = ''
+      this.startDate = ''
+    },
+    // 重置
+    resetForm() {
+      this.anemometerName = ''
+      this.latitude = ''
+      this.longitude = ''
+      this.anemometerTowerHeightDtoList = [
+        {
+          anemometerHeight: ''
+        }
+      ]
+    },
+    //打开新增
+    newnuedialog() {
+      this.nuedialog = true
+      this.title = '新增'
+    },
+    // 新增提交
+    newly() {
+      const isEmptyAnemometerHeight = this.anemometerTowerHeightDtoList.some(
+        (tower) =>
+          !tower.anemometerHeight || !tower.anemometerHeight.toString().trim()
+      )
+
+      if (isEmptyAnemometerHeight) {
+        this.$message({
+          message: '测风塔高度不能为空',
+          type: 'warning'
+        })
+        return
+      }
+
+      // Other validation checks
+      if (!this.anemometerName) {
+        this.$message({
+          message: '请填写测风塔名称',
+          type: 'warning'
+        })
+        return
+      }
+      if (!this.latitude) {
+        this.$message({
+          message: '请填写纬度',
+          type: 'warning'
+        })
+        return
+      }
+      if (!this.longitude) {
+        this.$message({
+          message: '请填写经度',
+          type: 'warning'
+        })
+        return
+      }
+      let paramsData = {
+        anemometerName: this.anemometerName,
+        latitude: this.latitude,
+        longitude: this.longitude,
+      }
+      if (!this.isEdit) {
+        paramsData.anemometerTowerHeightDtoList=this.anemometerTowerHeightDtoList
+        createAnemometerTower(paramsData).then((res) => {
+          this.nuedialog = false
+          this.$message.success('新增成功')
+          this.onSubmit()
+        })
+      } else {
+        paramsData.anemometerTowerHeightListDtos=this.anemometerTowerHeightDtoList
+        paramsData.anemometerCode = this.detail.anemometerCode
+        // delete objectval.parentCode
+        updateAnemometerTower(paramsData).then((res) => {
+          this.isEdit = false
+          this.nuedialog = false
+          this.onSubmit()
+          this.$message.success('编辑成功')
+        })
+      }
+      this.resetForm()
+    },
+
+    // 查看详情
+    particulars(row) {
+      getAnemometerTower({ anemometerCode: row.anemometerCode }).then((res) => {
+        this.hightower = res.data
+        this.cftList = res.data.list
+      })
+      this.unusualdialog = true
+    },
+    // 启用/停用
+    start(row, type) {
+      let objectval = {
+        anemometerCode: row.anemometerCode,
+        state: type === 0 ? 0 : 1
+      }
+      updateAnemometerTowerState(objectval).then((res) => {
+        this.$message({
+          message: '状态已更新成功',
+          type: 'success'
+        })
+        // this.$message(`${type === 1 ? '状态已更新成功' : '状态已更新成功'}`);
+        row.state = type === 1 ? 0 : 1
+        this.onSubmit()
+      })
+    },
+    // 删除
+    deleted(row) {
+      console.log(row, 'row')
+      if (row.state == '1') {
+        this.$message({
+          type: 'error',
+          message: '该项处于启用状态,无法删除!'
+        })
+        return
+      }
+      this.$confirm('此操作将永久删除该文件,是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          delAnemometerTower({ anemometerCode: row.anemometerCode }).then(
+            (res) => {
+              this.onSubmit()
+              // 执行删除操作
+              this.$message({
+                type: 'success',
+                message: '删除成功!'
+              })
+            }
+          )
+        })
+        .catch(() => {
+          // 取消删除
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          })
+        })
+    },
+
+    // 编辑
+    compile(row) {
+      this.title = '编辑'
+      this.isEdit = true
+      getAnemometerTower({ anemometerCode: row.anemometerCode }).then((res) => {
+        this.hightower = res.data
+        this.cftList = res.data.list
+        const item = JSON.parse(JSON.stringify(res.data))
+        this.detail = item
+        this.anemometerName = item.anemometerName
+        this.latitude = item.latitude
+        this.longitude = item.longitude
+        this.anemometerTowerHeightDtoList = this.cftList
+        this.nuedialog = true
+      })
+    },
+
+    //分页数据切换
+    handleCurrentChange(val) {
+      this.formInline.pageNum = val
+      this.onSubmit()
+    },
+
+    // 测风塔高度
+    addition() {
+      this.anemometerTowerHeightDtoList.push({ anemometerHeight: '' })
+    },
+    subtraction() {
+      if (this.anemometerTowerHeightDtoList.length > 1) {
+        // Ensure at least one input remains
+        this.anemometerTowerHeightDtoList.pop()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.general {
+  display: flex;
+  flex-wrap: wrap;
+
+  .condition {
+    width: 50%;
+    display: flex;
+
+    p {
+      width: 130px;
+      text-align: right;
+      line-height: 40px;
+    }
+
+    span {
+      line-height: 40px;
+      margin-right: 5px;
+      padding-left: 20px;
+    }
+
+    .el-select {
+      width: 100%;
+      margin-bottom: 20px;
+    }
+
+    .el-input {
+      margin-bottom: 20px;
+    }
+  }
+}
+
+.attachment {
+  display: flex;
+  padding-top: 10px;
+
+  p {
+    margin-right: 20px;
+    color: #409eff;
+  }
+}
+
+.addition {
+  display: flex;
+  justify-content: flex-end;
+  margin-bottom: 10px;
+}
+
+.error {
+  color: red;
+  position: absolute;
+  bottom: 85px;
+  left: 91px;
+  width: 213px !important;
+  font-size: 12px;
+}
+
+.forinput {
+  position: relative;
+}
+</style>

+ 229 - 236
src/views/ledger/anemometer.vue

@@ -81,7 +81,7 @@
         </el-table-column>
         <el-table-column prop="state" align="center" label="状态" width="100">
           <template slot-scope="{ row }">
-            {{ row.state == 1 ? '启用' : '停用' }}
+            {{ row.state == 1 ? "启用" : "停用" }}
           </template>
         </el-table-column>
         <el-table-column prop="createTime" align="center" label="创建时间">
@@ -141,62 +141,51 @@
     <el-dialog
       :title="title"
       :visible.sync="nuedialog"
-      width="860px"
+      width="520px"
       @close="resetForm"
+      
     >
-      <div class="addition">
-        <span @click="addition">
-          <SvgIcons
-            name="jia"
-            class="jia"
-            width="20px"
-            height="22px"
-            color="#222"
-          ></SvgIcons>
-        </span>
-        <span @click="subtraction">
-          <SvgIcons
-            name="jian"
-            class="jian"
-            width="20px"
-            height="22px"
-            color="#222"
-          ></SvgIcons>
-        </span>
-      </div>
-      <div class="general">
-        <div class="condition">
-          <p>测风塔名称:</p>
-          <el-input v-model="anemometerName"></el-input>
-        </div>
-        <div class="condition">
-          <p>经度:</p>
-          <el-input v-model="latitude"></el-input>
-        </div>
-
-        <div class="condition">
-          <p>纬度:</p>
-          <el-input v-model="longitude"></el-input>
-        </div>
-        <div
-          v-for="(tower, index) in anemometerTowerHeightDtoList || [
-            { anemometerHeight: '' }
-          ]"
+      <el-form
+        :model="dynamicValidateForm"
+        ref="dynamicValidateForm"
+        label-width="100px"
+        class="demo-dynamic"
+        :rules="rules"
+      >
+        <el-form-item prop="anemometerName" label="测风塔名称">
+          <el-input v-model="dynamicValidateForm.anemometerName"></el-input>
+        </el-form-item>
+        <el-form-item prop="longitude" label="经度">
+          <el-input v-model="dynamicValidateForm.longitude"></el-input>
+        </el-form-item>
+        <el-form-item prop="latitude" label="纬度">
+          <el-input v-model="dynamicValidateForm.latitude"></el-input>
+        </el-form-item>
+        <el-form-item
+          v-for="(
+            tower, index
+          ) in dynamicValidateForm.anemometerTowerHeightDtoList"
+          :label="'测风塔高度' + (index + 1)"
           :key="index"
-          class="condition"
+          :prop="'anemometerTowerHeightDtoList.' + index + '.anemometerHeight'"
+          :rules="[
+            { required: true, message: '请输入测风塔高度', trigger: 'blur' },
+            { validator: validateUniqueHeight, trigger: 'blur' },
+          ]"
         >
-          <p>测风塔高度{{ index + 1 }}:</p>
-          <el-input
-            v-model="tower.anemometerHeight"
-            placeholder="请输入测风塔高度"
-          ></el-input>
-        </div>
-      </div>
+          <el-input v-model="tower.anemometerHeight"></el-input>
+          <el-button v-if="index > 0" @click.prevent="removeTower(index)"
+            >删除</el-button
+          >
+        </el-form-item>
 
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="nuedialog = false" size="small">取 消</el-button>
-        <el-button type="primary" @click="newly" size="small">确 定</el-button>
-      </span>
+        <el-form-item>
+          <el-button type="primary" @click="submitForm('dynamicValidateForm')"
+            >提交</el-button
+          >
+          <el-button @click="addDomain">新增测风塔高度</el-button>
+        </el-form-item>
+      </el-form>
     </el-dialog>
 
     <!-- 测风塔详情 -->
@@ -205,7 +194,7 @@
       <p>测风塔编号:{{ hightower.anemometerCode }}</p>
       <p>经度:{{ hightower.longitude }}</p>
       <p>维度:{{ hightower.latitude }}</p>
-      <p>状态: {{ hightower.state === 1 ? '启用' : '停用' }}</p>
+      <p>状态: {{ hightower.state === 1 ? "启用" : "停用" }}</p>
       <p v-for="(item, index) in cftList" :key="index">
         测风塔高度:{{ item.anemometerHeight }}米
       </p>
@@ -220,29 +209,38 @@ import {
   getAnemometerTower,
   getAnemometerTowerPage,
   updateAnemometerTower,
-  updateAnemometerTowerState
-} from '@/api/ledger.js'
+  updateAnemometerTowerState,
+} from "@/api/ledger.js";
 export default {
   data() {
     return {
       tableData: [],
       formInline: {
-        anemometerName: '',
+        anemometerName: "",
         timeQuantum: [],
         pageNum: 1,
         pageSize: 10,
-        totalSize: 0
+        totalSize: 0,
       },
-      startDate: '',
-      endDate: '',
+      startDate: "",
+      endDate: "",
       // 新增测风塔信息
-      anemometerName: '',
-      latitude: '',
-      longitude: '',
+
+      dynamicValidateForm: {
+        anemometerTowerHeightDtoList: [
+          {
+            anemometerHeight: "",
+          },
+        ],
+        anemometertower: "",
+        longitude: "",
+        latitude: "",
+      },
+
       anemometerTowerHeightDtoList: [
         {
-          anemometerHeight: ''
-        }
+          anemometerHeight: "",
+        },
       ],
       errors: [],
       hightower: [],
@@ -250,28 +248,41 @@ export default {
       // 新增信息
       nuedialog: false,
       unusualdialog: false,
-      title: '',
+      title: "",
       isEdit: false,
-      detail: {}
-    }
+      detail: {},
+      rules: {
+        anemometerName: [
+          { required: true, message: "请输入测风塔名称", trigger: "blur" },
+        ],
+        longitude: [
+          { required: true, message: "请输入经度", trigger: "blur" },
+          { validator: this.validateNumber, trigger: "blur" },
+        ],
+        latitude: [
+          { required: true, message: "请输入纬度", trigger: "blur" },
+          { validator: this.validateNumber, trigger: "blur" },
+        ],
+      },
+    };
   },
   created() {
-    this.onSubmit()
+    this.onSubmit();
   },
   methods: {
     rowStyle() {
-      return 'text-align:center'
+      return "text-align:center";
     },
     onDateChange(date) {
       if (Array.isArray(date)) {
-        this.startDate = this.$formatDate(date[0])
-        this.endDate = this.$formatDate(date[1])
+        this.startDate = this.$formatDate(date[0]);
+        this.endDate = this.$formatDate(date[1]);
         if (this.endDate < this.startDate) {
-          this.endDate = this.startDate
+          this.endDate = this.startDate;
         }
       } else {
-        this.startDate = null
-        this.endDate = null
+        this.startDate = null;
+        this.endDate = null;
       }
     },
 
@@ -282,194 +293,195 @@ export default {
         beginTime: this.startDate || undefined,
         endTime: this.endDate || undefined,
         pageNum: this.formInline.pageNum,
-        pageSize: this.formInline.pageSize
-      }
+        pageSize: this.formInline.pageSize,
+      };
       getAnemometerTowerPage(paramsData).then((res) => {
-        this.tableData = res.data.list
-        this.formInline.totalSize = res.data.totalSize
-      })
+        this.tableData = res.data.list;
+        this.formInline.totalSize = res.data.totalSize;
+      });
     },
     // 重置
     reset() {
-      this.formInline.anemometerName = ''
-      this.formInline.timeQuantum = []
-      this.endDate = ''
-      this.startDate = ''
+      this.formInline.anemometerName = "";
+      this.formInline.timeQuantum = [];
+      this.endDate = "";
+      this.startDate = "";
     },
     // 重置
     resetForm() {
-      this.anemometerName = ''
-      this.latitude = ''
-      this.longitude = ''
-      this.anemometerTowerHeightDtoList = [
-        {
-          anemometerHeight: ''
-        }
-      ]
+     Object.assign(this.$data.dynamicValidateForm, this.$options.data().dynamicValidateForm);
     },
     //打开新增
     newnuedialog() {
-      this.nuedialog = true
-      this.title = '新增'
-    },
-    // 新增提交
-    newly() {
-      const isEmptyAnemometerHeight = this.anemometerTowerHeightDtoList.some(
-        (tower) =>
-          !tower.anemometerHeight || !tower.anemometerHeight.toString().trim()
-      )
-
-      if (isEmptyAnemometerHeight) {
-        this.$message({
-          message: '测风塔高度不能为空',
-          type: 'warning'
-        })
-        return
-      }
-
-      // Other validation checks
-      if (!this.anemometerName) {
-        this.$message({
-          message: '请填写测风塔名称',
-          type: 'warning'
-        })
-        return
-      }
-      if (!this.latitude) {
-        this.$message({
-          message: '请填写纬度',
-          type: 'warning'
-        })
-        return
-      }
-      if (!this.longitude) {
-        this.$message({
-          message: '请填写经度',
-          type: 'warning'
-        })
-        return
-      }
-      let paramsData = {
-        anemometerName: this.anemometerName,
-        latitude: this.latitude,
-        longitude: this.longitude,
-      }
-      if (!this.isEdit) {
-        paramsData.anemometerTowerHeightDtoList=this.anemometerTowerHeightDtoList
-        createAnemometerTower(paramsData).then((res) => {
-          this.nuedialog = false
-          this.$message.success('新增成功')
-          this.onSubmit()
-        })
-      } else {
-        paramsData.anemometerTowerHeightListDtos=this.anemometerTowerHeightDtoList
-        paramsData.anemometerCode = this.detail.anemometerCode
-        // delete objectval.parentCode
-        updateAnemometerTower(paramsData).then((res) => {
-          this.isEdit = false
-          this.nuedialog = false
-          this.onSubmit()
-          this.$message.success('编辑成功')
-        })
-      }
-      this.resetForm()
+      this.nuedialog = true;
+      this.title = "新增";
     },
 
     // 查看详情
     particulars(row) {
       getAnemometerTower({ anemometerCode: row.anemometerCode }).then((res) => {
-        this.hightower = res.data
-        this.cftList = res.data.list
-      })
-      this.unusualdialog = true
+        this.hightower = res.data;
+        this.cftList = res.data.list;
+      });
+      this.unusualdialog = true;
     },
     // 启用/停用
     start(row, type) {
       let objectval = {
         anemometerCode: row.anemometerCode,
-        state: type === 0 ? 0 : 1
-      }
+        state: type === 0 ? 0 : 1,
+      };
       updateAnemometerTowerState(objectval).then((res) => {
         this.$message({
-          message: '状态已更新成功',
-          type: 'success'
-        })
+          message: "状态已更新成功",
+          type: "success",
+        });
         // this.$message(`${type === 1 ? '状态已更新成功' : '状态已更新成功'}`);
-        row.state = type === 1 ? 0 : 1
-        this.onSubmit()
-      })
+        row.state = type === 1 ? 0 : 1;
+        this.onSubmit();
+      });
     },
     // 删除
     deleted(row) {
-      console.log(row, 'row')
-      if (row.state == '1') {
+      console.log(row, "row");
+      if (row.state == "1") {
         this.$message({
-          type: 'error',
-          message: '该项处于启用状态,无法删除!'
-        })
-        return
+          type: "error",
+          message: "该项处于启用状态,无法删除!",
+        });
+        return;
       }
-      this.$confirm('此操作将永久删除该文件,是否继续?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
+      this.$confirm("此操作将永久删除该文件,是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
       })
         .then(() => {
           delAnemometerTower({ anemometerCode: row.anemometerCode }).then(
             (res) => {
-              this.onSubmit()
+              this.onSubmit();
               // 执行删除操作
               this.$message({
-                type: 'success',
-                message: '删除成功!'
-              })
+                type: "success",
+                message: "删除成功!",
+              });
             }
-          )
+          );
         })
         .catch(() => {
           // 取消删除
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          })
-        })
+            type: "info",
+            message: "已取消删除",
+          });
+        });
     },
 
     // 编辑
     compile(row) {
-      this.title = '编辑'
-      this.isEdit = true
+      this.title = "编辑";
+      this.isEdit = true;
       getAnemometerTower({ anemometerCode: row.anemometerCode }).then((res) => {
-        this.hightower = res.data
-        this.cftList = res.data.list
-        const item = JSON.parse(JSON.stringify(res.data))
-        this.detail = item
-        this.anemometerName = item.anemometerName
-        this.latitude = item.latitude
-        this.longitude = item.longitude
-        this.anemometerTowerHeightDtoList = this.cftList
-        this.nuedialog = true
-      })
+        this.hightower = res.data;
+        this.cftList = res.data.list;
+        const item = JSON.parse(JSON.stringify(res.data));
+        this.detail = item;
+        this.dynamicValidateForm.anemometerName = item.anemometerName;
+        this.dynamicValidateForm.latitude = item.latitude;
+        this.dynamicValidateForm.longitude = item.longitude;
+        this.dynamicValidateForm.anemometerTowerHeightDtoList = this.cftList;
+        this.nuedialog = true;
+      });
     },
 
     //分页数据切换
     handleCurrentChange(val) {
-      this.formInline.pageNum = val
-      this.onSubmit()
+      this.formInline.pageNum = val;
+      this.onSubmit();
     },
 
-    // 测风塔高度
-    addition() {
-      this.anemometerTowerHeightDtoList.push({ anemometerHeight: '' })
+    // 修改的
+    submitForm(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (!valid) {
+          this.$message.error("请填写必填项");
+          return;
+        }
+
+        let paramsData = {
+          anemometerName: this.dynamicValidateForm.anemometerName,
+          latitude: this.dynamicValidateForm.latitude,
+          longitude: this.dynamicValidateForm.longitude,
+        };
+
+        if (!this.isEdit) {
+          paramsData.anemometerTowerHeightDtoList =
+            this.dynamicValidateForm.anemometerTowerHeightDtoList;
+          createAnemometerTower(paramsData).then((res) => {
+            this.nuedialog = false;
+            this.$message.success("新增成功");
+            this.onSubmit();
+          });
+        } else {
+          paramsData.anemometerTowerHeightListDtos =
+            this.dynamicValidateForm.anemometerTowerHeightDtoList;
+          paramsData.anemometerCode = this.detail.anemometerCode;
+          updateAnemometerTower(paramsData).then((res) => {
+            this.isEdit = false;
+            this.nuedialog = false;
+            this.onSubmit();
+            this.$message.success("编辑成功");
+          });
+        }
+      });
+    },
+
+    // xz
+    addDomain() {
+      this.dynamicValidateForm.anemometerTowerHeightDtoList.push({
+        anemometerHeight: "",
+      });
     },
-    subtraction() {
-      if (this.anemometerTowerHeightDtoList.length > 1) {
-        // Ensure at least one input remains
-        this.anemometerTowerHeightDtoList.pop()
+    // 删除
+    removeTower(index) {
+      this.dynamicValidateForm.anemometerTowerHeightDtoList.splice(index, 1);
+    },
+
+    // 数字验证
+    validateNumber(rule, value, callback) {
+      const numberRegex = /^\d{1,4}(\.\d{1,2})?$/; // 匹配不超过四位数且小数点后不超过二位数的数字
+      if (!value) {
+        callback(new Error("该项不能为空"));
+      } else if (!numberRegex.test(value)) {
+        callback(
+          new Error("该项必须为不超过四位数且小数点后不超过三位数的数字")
+        );
+      } else {
+        callback();
       }
-    }
-  }
-}
+    },
+    validateUniqueHeight(rule, value, callback) {
+      const heights = this.dynamicValidateForm.anemometerTowerHeightDtoList.map(
+        (tower) => tower.anemometerHeight
+      );
+
+    
+      const isDuplicate =
+        heights.filter((height) => height === value).length > 1;
+
+
+      const isInvalidLength = value && value.toString().length > 3;
+
+      if (isDuplicate) {
+        callback(new Error("输入的测风塔高度不能重复"));
+      } else if (isInvalidLength) {
+        callback(new Error("测风塔高度不能超过三位数"));
+      } else {
+        callback();
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -504,32 +516,13 @@ export default {
   }
 }
 
-.attachment {
-  display: flex;
-  padding-top: 10px;
-
-  p {
-    margin-right: 20px;
-    color: #409eff;
+.demo-dynamic {
+  .el-input {
+    width: 300px;
+    margin-right: 10px;
+  }
+  .el-form-item {
+    margin-bottom: 20px;
   }
-}
-
-.addition {
-  display: flex;
-  justify-content: flex-end;
-  margin-bottom: 10px;
-}
-
-.error {
-  color: red;
-  position: absolute;
-  bottom: 85px;
-  left: 91px;
-  width: 213px !important;
-  font-size: 12px;
-}
-
-.forinput {
-  position: relative;
 }
 </style>

+ 183 - 157
src/views/ledger/component/windsiteMessage.vue

@@ -1,182 +1,208 @@
 <template>
-    <div>
-        <!-- 风场详情 -->
-        <el-dialog title="风场信息" :visible.sync="localUnusualdialog" width="800px" @close="handleClose">
-            <div class="general">
-                <div class="condition">
-                    <p>风场名称:</p><span>{{ unusualdialogdata.fieldName }}</span>
-                </div>
-                <div class="condition">
-                    <p>空气密度:</p><span>{{ unusualdialogdata.density }}(kg/m³)</span>
-                </div>
-
-                <div class="condition">
-                    <p>上级单位:</p><span>{{ unusualdialogdata.companyName }}</span>
-                </div>
-                <div class="condition">
-                    <p>海拔高度:</p><span>{{ unusualdialogdata.elevationHeight }}(米)</span>
-                </div>
-
-                <div class="condition">
-                    <p>所在省:</p><span>{{ unusualdialogdata.provinceName }}</span>
-                </div>
-                <div class="condition">
-                    <p>所在市:</p> <span>{{ unusualdialogdata.cityName }}</span>
-                </div>
-                <div class="condition">
-                    <p>经度:</p><span>{{ unusualdialogdata.longitude }}</span>
-                </div>
-
-                <div class="condition">
-                    <p>纬度:</p><span>{{ unusualdialogdata.latitude }}</span>
-                </div>
-
-                <div class="condition">
-                    <p>测风塔:</p> <span>{{ anemometerText }}</span>
-                </div>
-            </div>
-            <div class="attachment">
-                <p class="model-center" @click="download">合同功率曲线附件下载</p>
-
-            </div>
-            <p>下载资源文件附件</p>
-            <el-table :data="unusualdialogdata.windFieldResourceVos
-                " style="width: 100%">
-                <el-table-column prop="fileName" label="文件名">
-                </el-table-column>
-                <el-table-column prop="type" label="文件类型">
-                </el-table-column>
-
-                <el-table-column fixed="right" label="操作" width="120">
-                    <template slot-scope="scope">
-                        <el-button @click.native.prevent="resource(scope.row)" type="text" size="small">
-                            下载
-                        </el-button>
-                        <el-button @click.native.prevent="deleteRow(scope.row)" type="text" size="small">
-                            删除
-                        </el-button>
-
-                    </template>
-                </el-table-column>
-            </el-table>
-        </el-dialog>
-    </div>
+  <div>
+    <!-- 风场详情 -->
+    <el-dialog
+      title="风场信息"
+      :visible.sync="localUnusualdialog"
+      width="800px"
+      @close="handleClose"
+    >
+      <div class="general">
+        <div class="condition">
+          <p>风场名称:</p>
+          <span>{{ unusualdialogdata.fieldName }}</span>
+        </div>
+        <div class="condition">
+          <p>空气密度:</p>
+          <span>{{ unusualdialogdata.density }}(kg/m³)</span>
+        </div>
+
+        <div class="condition">
+          <p>上级单位:</p>
+          <span>{{ unusualdialogdata.companyName }}</span>
+        </div>
+        <div class="condition">
+          <p>海拔高度:</p>
+          <span>{{ unusualdialogdata.elevationHeight }}(米)</span>
+        </div>
+
+        <div class="condition">
+          <p>所在省:</p>
+          <span>{{ unusualdialogdata.provinceName }}</span>
+        </div>
+        <div class="condition">
+          <p>所在市:</p>
+          <span>{{ unusualdialogdata.cityName }}</span>
+        </div>
+        <div class="condition">
+          <p>经度:</p>
+          <span>{{ unusualdialogdata.longitude }}</span>
+        </div>
+
+        <div class="condition">
+          <p>纬度:</p>
+          <span>{{ unusualdialogdata.latitude }}</span>
+        </div>
+
+        <div class="condition">
+          <p>测风塔:</p>
+          <span>{{ anemometerText }}</span>
+        </div>
+      </div>
+      <div class="attachment">
+        <p class="model-center" @click="download">合同功率曲线附件下载</p>
+      </div>
+      <p>下载资源文件附件</p>
+      <el-table
+        :data="unusualdialogdata.windFieldResourceVos"
+        style="width: 100%"
+      >
+        <el-table-column prop="fileName" label="文件名"> </el-table-column>
+        <el-table-column prop="type" label="文件类型"> </el-table-column>
+
+        <el-table-column fixed="right" label="操作" width="120">
+          <template slot-scope="scope">
+            <el-button
+              @click.native.prevent="resource(scope.row)"
+              type="text"
+              size="small"
+            >
+              查看附件
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        unusualdialog: {
-            type: Boolean,
-            default: false
-        },
-        unusualdialogdata: {
-            type: Object,
-            default: () => []
-        }
+  props: {
+    unusualdialog: {
+      type: Boolean,
+      default: false,
     },
-    data() {
-        return {
-            tableData: [],
-            anemometerText: "",
-            AllTemplateurl: "",
-        }
+    unusualdialogdata: {
+      type: Object,
+      default: () => [],
     },
-
-    computed: {
-        localUnusualdialog: {
-            get() {
-                return this.unusualdialog;
-            },
-            set(value) {
-                // 在这里不进行任何修改
-            }
-        }
+  },
+  data() {
+    return {
+      tableData: [],
+      anemometerText: "",
+      AllTemplateurl: "",
+    };
+  },
+
+  computed: {
+    localUnusualdialog: {
+      get() {
+        return this.unusualdialog;
+      },
+      set(value) {
+        // 在这里不进行任何修改
+      },
     },
-    watch: {
-        unusualdialogdata: {
-            handler() {
-                this.generateAnemometerText();
-            },
-            deep: true,
-            immediate: true
-        }
+  },
+  watch: {
+    unusualdialogdata: {
+      handler() {
+        this.generateAnemometerText();
+      },
+      deep: true,
+      immediate: true,
     },
-    methods: {
-        handleClose() {
-            this.$emit('handleClose', false, 'unusualdialog');
-        },
-        generateAnemometerText() {
-            const anemometerTowerByFieldVos = this.unusualdialogdata.anemometerTowerByFieldVos || [];
-            const anemometerNames = anemometerTowerByFieldVos.map(item => item.anemometerName).join('\\');
-
-            // 将结果赋值给 anemometerText
-            this.anemometerText = anemometerNames;
-        },
-        // 下载附件
-        download() {
-            if (this.unusualdialogdata.powerContractUrl) {
-                const link = document.createElement('a')
-                link.href = this.unusualdialogdata.powerContractUrl
-                link.download = '' // 可以设置默认下载文件名
-                link.target = '_blank' // 新窗口打开
-                document.body.appendChild(link)
-                link.click()
-                document.body.removeChild(link)
-            } else {
-                console.error('URL is not set')
-            }
-        },
-        // 测试玩
-        resource(row) {
-       
-        },
-    }
-}
+  },
+  methods: {
+    handleClose() {
+      this.$emit("handleClose", false, "unusualdialog");
+    },
+    generateAnemometerText() {
+      const anemometerTowerByFieldVos =
+        this.unusualdialogdata.anemometerTowerByFieldVos || [];
+      const anemometerNames = anemometerTowerByFieldVos
+        .map((item) => item.anemometerName)
+        .join("\\");
+
+      // 将结果赋值给 anemometerText
+      this.anemometerText = anemometerNames;
+    },
+    // 下载附件
+    download() {
+      if (this.unusualdialogdata.powerContractUrl) {
+        const link = document.createElement("a");
+        link.href = this.unusualdialogdata.powerContractUrl;
+        link.download = ""; // 可以设置默认下载文件名
+        link.target = "_blank"; // 新窗口打开
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      } else {
+        console.error("URL is not set");
+      }
+    },
+    // 测试玩
+    resource(row) {
+        console.log(row,'row');
+      if (row.resourceUrl) {
+        const link = document.createElement("a");
+        link.href = row.resourceUrl;
+        link.download = ""; // 可以设置默认下载文件名
+        link.target = "_blank"; // 新窗口打开
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      } else {
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .general {
-    display: flex;
-    flex-wrap: wrap;
+  display: flex;
+  flex-wrap: wrap;
 
-    .condition {
-        width: 50%;
-        display: flex;
+  .condition {
+    width: 50%;
+    display: flex;
 
-        p {
-            width: 100px;
-            text-align: right;
-            line-height: 40px;
-        }
+    p {
+      width: 100px;
+      text-align: right;
+      line-height: 40px;
+    }
 
-        span {
-            line-height: 40px;
+    span {
+      line-height: 40px;
 
-            padding-left: 20px;
-        }
+      padding-left: 20px;
+    }
 
-        .el-select {
-            width: 100%;
-            margin-bottom: 20px;
-        }
+    .el-select {
+      width: 100%;
+      margin-bottom: 20px;
+    }
 
-        .el-input {
-            margin-bottom: 20px;
-        }
+    .el-input {
+      margin-bottom: 20px;
     }
+  }
 }
 
 .attachment {
-    display: flex;
-    padding-top: 10px;
-
-    .model-center {
-        color: #409eff;
-        cursor: pointer;
-        line-height: 40px;
-        height: 40px;
-        font-size: 14px;
-    }
+  display: flex;
+  padding-top: 10px;
+
+  .model-center {
+    color: #409eff;
+    cursor: pointer;
+    line-height: 40px;
+    height: 40px;
+    font-size: 14px;
+  }
 }
 </style>

+ 165 - 152
src/views/ledger/component/windsitetolead.vue

@@ -1,177 +1,190 @@
 <template>
-    <div>
-        <el-dialog title="导入文件" :visible.sync="localtolead" width="400px" @close="handleClose">
-            <el-alert title="请点击模板下载文件附件" type="success" :closable="false">
-            </el-alert>
-            <p class="model-center" @click="download">模板下载</p>
-            <div class="UPcondition">
-                <p>上级单位:</p>
-                <selecttree placeholder="请选择上级单位" :list="parentOptdata" v-model="companyCode" @change="parentChange">
-                </selecttree>
-            </div>
-
-
-            <el-upload class="upload-demo" :file-list="fileList" drag action :multiple="false"
-                :before-upload="beforeUpload" :limit="1" :auto-upload="false" :on-change="handleOnChange"
-                accept=".xlsx">
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-                <div class="el-upload__tip" slot="tip">
-                    只能上传xlsx文件,且不超过5MB
-                </div>
-            </el-upload>
-            <span slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="filesubmit" size="small">提交</el-button>
-            </span>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog
+      title="导入文件"
+      :visible.sync="localtolead"
+      width="400px"
+      @close="handleClose"
+    >
+      <el-alert title="请点击模板下载文件附件" type="success" :closable="false">
+      </el-alert>
+      <p class="model-center" @click="download">模板下载</p>
+      <div class="UPcondition">
+        <p>上级单位:</p>
+        <selecttree
+          placeholder="请选择上级单位"
+          :list="parentOptdata"
+          v-model="companyCode"
+          @change="parentChange"
+        >
+        </selecttree>
+      </div>
+
+      <el-upload
+        class="upload-demo"
+        :file-list="fileList"
+        drag
+        action
+        :multiple="false"
+        :before-upload="beforeUpload"
+        :limit="1"
+        :auto-upload="false"
+        :on-change="handleOnChange"
+        accept=".xlsx"
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        <div class="el-upload__tip" slot="tip">
+          只能上传xlsx文件,且不超过5MB
+        </div>
+      </el-upload>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="filesubmit" size="small"
+          >提交</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import selecttree from "../../../components/selecttree.vue"
-import {
-
-    windFieldImportData
-
-} from '@/api/ledger.js'
+import selecttree from "../../../components/selecttree.vue";
+import { windFieldImportData } from "@/api/ledger.js";
 export default {
-    components: {
-
-        selecttree,
+  components: {
+    selecttree,
+  },
+
+  props: {
+    tolead: {
+      type: Boolean,
+      default: false,
     },
-
-    props: {
-        tolead: {
-            type: Boolean,
-            default: false
-        },
-        parentOptdata: {
-            type: Array,
-            default: () => []
-        },
-        AllTemplateurl: {
-            type: Object,
-            default: () => { }
-        },
-
+    parentOptdata: {
+      type: Array,
+      default: () => [],
     },
-    computed: {
-        localtolead: {
-            get() {
-                console.log(this.tolead);
-                return this.tolead;
-            },
-            set(value) {
-                // 在这里不进行任何修改
-            }
-        }
+    AllTemplateurl: {
+      type: Object,
+      default: () => {},
     },
-    data() {
-        return {
-            companyCode: "",
-            superior: "",
-            superiorOptions: [],
-            fileList: [
-            ],
-       
-        }
+  },
+  computed: {
+    localtolead: {
+      get() {
+        console.log(this.tolead);
+        return this.tolead;
+      },
+      set(value) {
+        // 在这里不进行任何修改
+      },
+    },
+  },
+  data() {
+    return {
+      companyCode: "",
+      superior: "",
+      superiorOptions: [],
+      fileList: [],
+    };
+  },
+
+  methods: {
+    rowStyle() {
+      return "text-align:center";
     },
 
-    methods: {
-
-        rowStyle() {
-            return "text-align:center";
-        },
-
-        // 下载附件
-        download() {
-            if (this.AllTemplateurl.field) {
-                const link = document.createElement('a')
-                link.href = this.AllTemplateurl.field
-                link.download = '' // 可以设置默认下载文件名
-                link.target = '_blank' // 新窗口打开
-                document.body.appendChild(link)
-                link.click()
-                document.body.removeChild(link)
-            } else {
-                console.error('URL is not set')
-            }
-        },
-
-        handleClose() {
-            this.$emit('handleClose', false, 'tolead');
-        }
-        ,
-        // 附件提交
-        filesubmit() {
-            console.log(this.globalFileList)
-            let filedata = {
-                companyCode: this.companyCode,
-                file: this.globalFileList
-            }
-            windFieldImportData(filedata).then((res) => {
-                console.log(res, 'rrr')
-                this.$message.success('上传成功')
-                this.$emit('handleClose', false, 'tolead');
-                this.$emit('onSubmit');
-            })
-        },
-
+    // 下载附件
+    download() {
+      if (this.AllTemplateurl.field) {
+        const link = document.createElement("a");
+        link.href = this.AllTemplateurl.field;
+        link.download = ""; // 可以设置默认下载文件名
+        link.target = "_blank"; // 新窗口打开
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      } else {
+        console.error("URL is not set");
+      }
+    },
 
-        parentChange(data) {
-            //data为当前选中对象`
-            console.log(data);
-        },
-        // 附件验证
-        beforeUpload(fileList) {
-            const isXLSX =
-                fileList.type ===
-                'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
-            if (!isXLSX) {
-                this.$message.error('只能上传xlsx文件')
-            }
-            const isLt5MB = fileList.size / 1024 / 1024 < 5
-            if (!isLt5MB) {
-                this.$message.error('文件大小不能超过5MB')
-            }
-            console.log(fileList, 'fileList')
-            return isXLSX && isLt5MB
-        },
-        handleOnChange(fileList) {
-            console.log(fileList)
-            this.globalFileList = fileList.raw
-        }
+    handleClose() {
+      this.$emit("handleClose", false, "tolead");
+    },
+    // 附件提交
+    filesubmit() {
+      let filedata = {
+        companyCode: this.companyCode,
+        file: this.globalFileList,
+      };
+      if (filedata.file == undefined) {
+        this.$message({
+          message: '请先上传附件',
+          type: 'warning'
+        });
+      } else {
+        windFieldImportData(filedata).then((res) => {
+          this.$message.success("上传成功");
+          this.$emit("handleClose", false, "tolead");
+          this.$emit("onSubmit");
+        });
+      }
     },
 
-}
+    parentChange(data) {
+      //data为当前选中对象`
+      console.log(data);
+    },
+    // 附件验证
+    beforeUpload(fileList) {
+      const isXLSX =
+        fileList.type ===
+        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+      if (!isXLSX) {
+        this.$message.error("只能上传xlsx文件");
+      }
+      const isLt5MB = fileList.size / 1024 / 1024 < 5;
+      if (!isLt5MB) {
+        this.$message.error("文件大小不能超过5MB");
+      }
+      console.log(fileList, "fileList");
+      return isXLSX && isLt5MB;
+    },
+    handleOnChange(fileList) {
+      console.log(fileList);
+      this.globalFileList = fileList.raw;
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .UPcondition {
-    display: flex;
-    margin-bottom: 10px;
+  display: flex;
+  margin-bottom: 10px;
 
-    p {
-        width: 74px;
-        text-align: right;
-        line-height: 40px;
-    }
+  p {
+    width: 74px;
+    text-align: right;
+    line-height: 40px;
+  }
 
-    .el-select {
-        width: 100%;
-        margin-bottom: 20px;
-    }
+  .el-select {
+    width: 100%;
+    margin-bottom: 20px;
+  }
 
-    .el-input {
-        margin-bottom: 20px;
-    }
+  .el-input {
+    margin-bottom: 20px;
+  }
 }
 
 .model-center {
-    color: #409eff;
-    cursor: pointer;
-    line-height: 40px;
-    height: 40px;
-    font-size: 14px;
+  color: #409eff;
+  cursor: pointer;
+  line-height: 40px;
+  height: 40px;
+  font-size: 14px;
 }
 </style>

+ 267 - 220
src/views/ledger/component/windsiteup.vue

@@ -1,252 +1,299 @@
 <template>
-    <div>
-        <el-dialog title="上传文件" :visible.sync="localuploadingPOP" width="400px" @close="handleClose">
-            <div class="UPcondition">
-                <p>文件类型:</p>
-                <el-select v-model="superior" clearable placeholder="请选择">
-                    <el-option v-for="item in superiorOptions" :key="item.value" :label="item.label"
-                        :value="item.value">
-                    </el-option>
-                </el-select>
-            </div>
-            <!-- <div v-show="fileShow">
-                <el-alert title="请点击模板下载文件附件" type="success" :closable="false">
-                </el-alert>
-                <p class="model-center" @click="download">模板下载</p>
-                <el-upload class="upload-demo" :file-list="fileList" drag action :multiple="false"
-                    :before-upload="beforeUpload" :limit="1" :auto-upload="false" :on-change="handleOnChange"
-                    accept=".xlsx">
-                    <i class="el-icon-upload"></i>
-                    <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-                    <div class="el-upload__tip" slot="tip">
-                        只能上传xlsx文件,且不超过5MB
-                    </div>
-                </el-upload>
-                <span slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="filesubmit" size="small">提交</el-button>
-                </span>
-            </div> -->
-            <div v-show="resourceShow">
-
-                <el-upload class="upload-demo" :file-list="resourcefileList"
-                    action="http://106.120.102.238:16600/energy-manage-service/api/check/upload" :multiple="false"
-                    :before-upload="resourcebeforeUpload" :limit="1" :auto-upload="false"
-                    :on-change="resourcehandleOnChange" accept=".jpg,.png,.pdf,.docx" ref="upload">
-                    <i class="el-icon-upload"></i>
-                    <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-                    <div class="el-upload__tip" slot="tip">
-                        只能上传jpg,png,pdf,docx文件,且不超过5MB
-                    </div>
-                </el-upload>
-                <span slot="footer" class="dialog-footer">
-                    <el-button type="primary" @click="resourcefilesubmit" size="small">提交</el-button>
-                </span>
-            </div>
-
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog
+      title="上传文件"
+      :visible.sync="localuploadingPOP"
+      width="400px"
+      @close="handleClose"
+    >
+      <div class="UPcondition">
+        <p>文件类型:</p>
+        <el-select v-model="superior" clearable placeholder="请选择">
+          <el-option
+            v-for="item in superiorOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          >
+          </el-option>
+        </el-select>
+      </div>
+      <div v-if="fileShow">
+        <el-alert
+          title="请点击模板下载文件附件"
+          type="success"
+          :closable="false"
+        >
+        </el-alert>
+        <p class="model-center" @click="download">模板下载</p>
+        <el-upload
+          class="upload-demo"
+          :file-list="fileList"
+          drag
+          action
+          :multiple="false"
+          :before-upload="beforeUpload"
+          :limit="1"
+          :auto-upload="false"
+          :on-change="handleOnChange"
+          accept=".xlsx"
+        >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+          <div class="el-upload__tip" slot="tip">
+            只能上传xlsx文件,且不超过5MB
+          </div>
+        </el-upload>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="filesubmit" size="small"
+            >提交</el-button
+          >
+        </span>
+      </div>
+      <div v-if="resourceShow">
+        <el-upload
+          class="uploaddemo2"
+          :file-list="resourcefileList"
+          action="http://192.168.50.235:16200/energy-manage-service/api/check/upload"
+          :multiple="false"
+          :before-upload="resourcebeforeUpload"
+          :limit="1"
+          :auto-upload="false"
+          :on-change="resourcehandleOnChange"
+          accept=".jpg,.png,.pdf,.docx"
+          ref="upload"
+        >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        </el-upload>
+        <div class="el-upload__tip" slot="tip">
+          只能上传jpg,png,pdf,docx文件,且不超过5MB
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="resourcefilesubmit" size="small"
+            >提交</el-button
+          >
+        </span>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 import {
-
-    powerWordContractImportData,
-    saveWindFieldResource
-
-} from '@/api/ledger.js'
+  powerWordContractImportData,
+  saveWindFieldResource,
+} from "@/api/ledger.js";
 export default {
-    props: {
-        uploadingPOP: {
-            type: Boolean,
-            default: false
-        },
-        rowdata: {
-            type: Object,
-            default: () => { }
-        },
-        AllTemplateurlDR: {
-            type: Object,
-            default: () => { }
-        },
+  props: {
+    uploadingPOP: {
+      type: Boolean,
+      default: false,
     },
-    computed: {
-        localuploadingPOP: {
-            get() {
-
-                return this.uploadingPOP;
-            },
-            set(value) {
-                // 在这里不进行任何修改
-            }
-        }
+    rowdata: {
+      type: Object,
+      default: () => {},
     },
-    data() {
-        return {
-            superior: "",
-            superiorOptions: [{
-                value: '1',
-                label: '合同功率曲线'
-            }, {
-                value: '2',
-                label: "资源文件"
-            }],
-            fileList: [
-
-            ],
-            resourcefileList: [],
-            fileShow: true,
-            resourceShow: false,
-            globalFileList: [],
-            succeed: {},
-        }
+    AllTemplateurlDR: {
+      type: Object,
+      default: () => {},
     },
-    watch: {
-        superior(newVal) {
-            if (newVal === '1' || newVal === '') {
-                this.fileShow = true;
-                this.resourceShow = false;
-            } else {
-                this.fileShow = false;
-                this.resourceShow = true;
-            }
-        }
+  },
+  computed: {
+    localuploadingPOP: {
+      get() {
+        return this.uploadingPOP;
+      },
+      set(value) {
+        // 在这里不进行任何修改
+      },
     },
-
-    methods: {
-        rowStyle() {
-            return "text-align:center";
+  },
+  data() {
+    return {
+      superior: "",
+      superiorOptions: [
+        {
+          value: "1",
+          label: "合同功率曲线",
         },
-
-        // 下载附件
-        download() {
-            if (this.AllTemplateurlDR.htPower) {
-                const link = document.createElement('a')
-                link.href = this.AllTemplateurlDR.htPower
-                link.download = '' // 可以设置默认下载文件名
-                link.target = '_blank' // 新窗口打开
-                document.body.appendChild(link)
-                link.click()
-                document.body.removeChild(link)
-            } else {
-
-            }
-        },
-        beforeUpload(fileList) {
-            const isXLSX =
-                fileList.type ===
-                'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
-            if (!isXLSX) {
-                this.$message.error('只能上传xlsx文件')
-            }
-            const isLt5MB = fileList.size / 1024 / 1024 < 5
-            if (!isLt5MB) {
-                this.$message.error('文件大小不能超过5MB')
-            }
-
-            return isXLSX && isLt5MB
-        },
-        handleOnChange(fileList) {
-
-            this.globalFileList = fileList.raw
-        },
-
-        // 附件提交
-        filesubmit() {
-
-            let filedata = {
-                fieldCode: this.rowdata.fieldCode,
-                file: this.globalFileList
-            }
-
-            powerWordContractImportData(filedata).then((res) => {
-
-                this.$message.success('上传成功')
-                this.$emit('handleClose', false, 'tolead');
-            })
-        },
-
-        handleClose() {
-            this.$emit('handleClose', false, 'uploadingPOP');
+        {
+          value: "2",
+          label: "资源文件",
         },
+      ],
+      fileList: [],
+      resourcefileList: [],
+      fileShow: true,
+      resourceShow: false,
+      globalFileList: [],
+      succeed: {},
+    };
+  },
+  watch: {
+    superior(newVal) {
+      if (newVal === "1" || newVal === "") {
+        this.fileShow = true;
+        this.resourceShow = false;
+      } else {
+        this.fileShow = false;
+        this.resourceShow = true;
+      }
+    },
+  },
 
-        // 资源文件
-        resourcebeforeUpload(file) {
-            const allowedTypes = [
-                'image/jpeg', // jpg
-                'image/png',  // png
-                'application/pdf', // pdf
-                'application/vnd.openxmlformats-officedocument.wordprocessingml.document' // docx
-            ];
-            const isAllowedType = allowedTypes.includes(file.type);
-            if (!isAllowedType) {
-                this.$message.error('只能上传jpg, png, pdf, docx文件');
-                return false; // 阻止文件上传
-            }
-            const isLt5MB = file.size / 1024 / 1024 < 5;
-            if (!isLt5MB) {
-                this.$message.error('文件大小不能超过5MB');
-                return false; // 阻止文件上传
-            }
+  methods: {
+    rowStyle() {
+      return "text-align:center";
+    },
 
-            return true; // 允许文件上传
-        },
-        resourcehandleOnChange(file, fileList) {
+    // 下载附件
+    download() {
+      if (this.AllTemplateurlDR.htPower) {
+        const link = document.createElement("a");
+        link.href = this.AllTemplateurlDR.htPower;
+        link.download = ""; // 可以设置默认下载文件名
+        link.target = "_blank"; // 新窗口打开
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      } else {
+      }
+    },
+    beforeUpload(fileList) {
+      const isXLSX =
+        fileList.type ===
+        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+      if (!isXLSX) {
+        this.$message.error("只能上传xlsx文件");
+      }
+      const isLt5MB = fileList.size / 1024 / 1024 < 5;
+      if (!isLt5MB) {
+        this.$message.error("文件大小不能超过5MB");
+      }
 
-            this.globalFileList = file.raw;
-            this.succeed = file.response
-            console.log(this.succeed, '   this.succeed');
-            console.log(this.globalFileList, '   this.globalFileList');
-            // 手动触发上传
-            if (file.status === 'ready') {
-                this.$refs.upload.submit();
-            }
-        },
+      return isXLSX && isLt5MB;
+    },
+    handleOnChange(fileList) {
+      this.globalFileList = fileList.raw;
+    },
 
+    // 附件提交
+    filesubmit() {
+      let filedata = {
+        fieldCode: this.rowdata.fieldCode,
+        file: this.globalFileList,
+      };
+      if (filedata.file == "") {
+        this.$message({
+          message: "请先上传附件在点击提交",
+          type: "warning",
+        });
+      } else {
+        powerWordContractImportData(filedata).then((res) => {
+          this.$message.success("上传成功");
+          this.$emit("handleClose", false, "tolead");
+        });
+      }
+    },
 
-        resourcefilesubmit() {
+    handleClose() {
+      this.$emit("handleClose", false, "uploadingPOP");
+    },
 
-            let filedata = {
-                fieldCode: this.rowdata.fieldCode,
-                fileName: this.globalFileList.name,
-                resourceUrl: this.succeed.data,
-                type: this.globalFileList.type
-            }
+    // 资源文件
+    resourcebeforeUpload(file) {
+      const allowedTypes = [
+        "image/jpeg", // jpg
+        "image/png", // png
+        "application/pdf", // pdf
+        "application/vnd.openxmlformats-officedocument.wordprocessingml.document", // docx
+      ];
+      const isAllowedType = allowedTypes.includes(file.type);
+      if (!isAllowedType) {
+        this.$message.error("只能上传jpg, png, pdf, docx文件");
+        return false; // 阻止文件上传
+      }
+      const isLt5MB = file.size / 1024 / 1024 < 5;
+      if (!isLt5MB) {
+        this.$message.error("文件大小不能超过5MB");
+        return false; // 阻止文件上传
+      }
 
-            saveWindFieldResource(filedata).then((res) => {
+      return true; // 允许文件上传
+    },
+    resourcehandleOnChange(file, fileList) {
+      this.globalFileList = file.raw;
+      this.succeed = file.response;
+      console.log(this.succeed, "   this.succeed");
+      console.log(this.globalFileList, "   this.globalFileList");
+      // 手动触发上传
+      if (file.status === "ready") {
+        this.$refs.upload.submit();
+      }
+    },
 
-                this.$message.success('上传成功')
-                this.$emit('handleClose', false, 'tolead');
-            })
-        },
-    }
-}
+    resourcefilesubmit() {
+      let filedata = {
+        fieldCode: this.rowdata.fieldCode,
+        fileName: this.globalFileList.name,
+        resourceUrl: this.succeed.data,
+        type: this.globalFileList.type,
+      };
+      if (filedata.resourceUrl == "") {
+        this.$message({
+          message: "请先上传附件在点击提交",
+          type: "warning",
+        });
+      } else {
+        saveWindFieldResource(filedata).then((res) => {
+          this.$message.success("上传成功");
+          this.$emit("handleClose", false, "tolead");
+        });
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .UPcondition {
-    display: flex;
+  display: flex;
 
-    p {
-        width: 74px;
-        text-align: right;
-        line-height: 40px;
-    }
+  p {
+    width: 74px;
+    text-align: right;
+    line-height: 40px;
+  }
 
-    .el-select {
-        width: 100%;
-        margin-bottom: 20px;
-    }
+  .el-select {
+    width: 100%;
+    margin-bottom: 20px;
+  }
 
-    .el-input {
-        margin-bottom: 20px;
-    }
+  .el-input {
+    margin-bottom: 20px;
+  }
 }
 
 .model-center {
-    color: #409eff;
-    cursor: pointer;
-    line-height: 40px;
-    height: 40px;
-    font-size: 14px;
+  color: #409eff;
+  cursor: pointer;
+  line-height: 40px;
+  height: 40px;
+  font-size: 14px;
+}
+.uploaddemo2 {
+  width: 360px;
+  height: 200px;
+  border: 1px dashed rgb(196, 196, 196);
+  text-align: center;
+  padding-top: 50px;
+  .el-icon-upload {
+    font-size: 50px;
+  }
+}
+.uploaddemo2:hover {
+  border: 1px dashed #409eff;
 }
 </style>

+ 11 - 3
src/views/ledger/draught.vue

@@ -101,7 +101,7 @@
       </span>
     </el-dialog>
     <!-- 新增 -->
-    <el-dialog :title="title" :visible.sync="nuedialog" width="1000px">
+    <el-dialog :title="title" :visible.sync="nuedialog" width="1000px"       @close="resetForm('ruleForm')">
       <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
         <div class="form-row">
           <el-form-item label="风机名称:" prop="engineName">
@@ -513,16 +513,24 @@ export default {
     reset() { },
     //导入提交
     UPsubmit() {
-      console.log(this.globalFileList)
+
       let filedata = {
         fieldCode: this.subordinate,
         file: this.globalFileList
       }
-      windEngineGroupImportData(filedata).then((res) => {
+      if(filedata.file==""){
+        this.$message({
+          message: '请先提交附件',
+          type: 'warning'
+        });
+      }else{
+        windEngineGroupImportData(filedata).then((res) => {
         console.log(res)
         this.uploadingPOP = false
         this.$message.success('上传成功')
       })
+      }
+   
       console.log(filedata);
       // this.tolead = false
     },

+ 182 - 67
src/views/ledger/enterprise.vue

@@ -3,30 +3,51 @@
     <div class="condition">
       <el-form :inline="true" :model="formInline" class="demo-form-inline">
         <el-form-item label="单位名称:">
-          <el-input v-model="formInline.companyName" placeholder="请输入单位名称" size="small"></el-input>
+          <el-input
+            v-model="formInline.companyName"
+            placeholder="请输入单位名称"
+            size="small"
+          ></el-input>
         </el-form-item>
         <el-form-item label="状态:">
-          <el-select v-model="formInline.state" placeholder="选择状态" size="small ">
+          <el-select
+            v-model="formInline.state"
+            placeholder="选择状态"
+            size="small "
+          >
             <el-option label="启用" value="1"></el-option>
             <el-option label="停用" value="0"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="getTableList" size="small">查询</el-button>
+          <el-button type="primary" @click="getTableList" size="small"
+            >查询</el-button
+          >
           <el-button @click="reset" size="small">重置</el-button>
         </el-form-item>
       </el-form>
     </div>
     <div class="list-page">
       <div class="newly">
-        <el-button type="primary" @click="newnuedialog" size="small">新增</el-button>
+        <el-button type="primary" @click="newnuedialog" size="small"
+          >新增</el-button
+        >
         <el-button type="primary" @click="toggleExpandAll" size="small">{{
           defaultExpandAll ? "收起" : "展开"
         }}</el-button>
       </div>
 
-      <el-table class="center-align-table" ref="table" :data="tableData" border :cell-style="rowStyle" stripe
-        row-key="id" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
+      <el-table
+        class="center-align-table"
+        ref="table"
+        :data="tableData"
+        border
+        :cell-style="rowStyle"
+        stripe
+        row-key="id"
+        default-expand-all
+        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
+      >
         <!-- Table Columns -->
         <el-table-column fixed prop="codeName" align="center" label="单位名称">
         </el-table-column>
@@ -35,7 +56,11 @@
 
         <el-table-column prop="fieldCount" label="风场数量" width="200">
           <template slot-scope="scope">
-            <el-button @click="particulars(scope.row)" type="text" size="small"></el-button>
+            <el-button
+              @click="particulars(scope.row)"
+              type="text"
+              size="small"
+            ></el-button>
           </template>
         </el-table-column>
 
@@ -46,13 +71,45 @@
         </el-table-column>
         <el-table-column prop="createTime" align="center" label="创建时间">
         </el-table-column>
-        <el-table-column prop="state" align="center" fixed="right" label="操作" width="200">
+        <el-table-column
+          prop="state"
+          align="center"
+          fixed="right"
+          label="操作"
+          width="200"
+        >
           <template slot-scope="scope">
-            <el-button @click="compile(scope.row)" type="text" size="small">编辑</el-button>
-            <el-button @click="newcomer(scope.row, 'addChild')" type="text" size="small">新增</el-button>
-            <el-button v-if="scope.row.state == 0" @click="start(scope.row, 1)" type="text" size="small">启用</el-button>
-            <el-button v-else style="color: #666" @click="start(scope.row, 0)" type="text" size="small">停用</el-button>
-            <el-button style="color: #f00" @click="deleted(scope.row)" type="text" size="small">删除</el-button>
+            <el-button @click="compile(scope.row)" type="text" size="small"
+              >编辑</el-button
+            >
+            <el-button
+              @click="newcomer(scope.row, 'addChild')"
+              type="text"
+              size="small"
+              >新增</el-button
+            >
+            <el-button
+              v-if="scope.row.state == 0"
+              @click="start(scope.row, 1)"
+              type="text"
+              size="small"
+              >启用</el-button
+            >
+            <el-button
+              v-else
+              style="color: #666"
+              @click="start(scope.row, 0)"
+              type="text"
+              size="small"
+              >停用</el-button
+            >
+            <el-button
+              style="color: #f00"
+              @click="deleted(scope.row)"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -60,34 +117,79 @@
 
     <!-- 弹出层 -->
     <!-- 新增 -->
-    <el-dialog :title="title" :visible.sync="nuedialog" width="380px">
-      <el-form ref="newform" :rules="rules" :model="newform" label-width="90px" class="form-margin">
+    <el-dialog
+      :title="title"
+      :visible.sync="nuedialog"
+      width="380px"
+      @close="handleClose"
+    >
+      <el-form
+        ref="newform"
+        :rules="rules"
+        :model="newform"
+        label-width="90px"
+        class="form-margin"
+      >
         <el-form-item label="单位名称:" prop="companyName">
           <el-input v-model="newform.companyName" size="small"></el-input>
         </el-form-item>
         <el-form-item label="所属省:" prop="province">
-          <el-select v-model="newform.province" placeholder="请选择" size="small" value-key="areaId" @change="fetchCities">
-            <el-option v-for="item in shengdata" :key="item.areaId" :label="item.province" :value="item"></el-option>
+          <el-select
+            v-model="newform.province"
+            placeholder="请选择"
+            size="small"
+            value-key="areaId"
+            @change="fetchCities"
+          >
+            <el-option
+              v-for="item in shengdata"
+              :key="item.areaId"
+              :label="item.province"
+              :value="item"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="所属市:" prop="city">
-          <el-select v-model="newform.city" placeholder="请选择" size="small" value-key="areaId" @change="$forceUpdate()">
-            <el-option v-for="item in shidata" :key="item.areaId" :label="item.city" :value="item"></el-option>
+          <el-select
+            v-model="newform.city"
+            placeholder="请选择"
+            size="small"
+            value-key="areaId"
+            @change="$forceUpdate()"
+          >
+            <el-option
+              v-for="item in shidata"
+              :key="item.areaId"
+              :label="item.city"
+              :value="item"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="备注:">
-          <el-input v-model="newform.described" size="small" type="textarea"></el-input>
+          <el-input
+            v-model="newform.described"
+            size="small"
+            type="textarea"
+          ></el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="nuedialog = false" size="small">取 消</el-button>
-        <el-button type="primary" @click="newly('newform')" size="small">确 定</el-button>
+        <el-button type="primary" @click="newly('newform')" size="small"
+          >确 定</el-button
+        >
       </span>
     </el-dialog>
 
     <!-- 风场数量 -->
     <el-dialog title="风场数量" :visible.sync="unusualdialog" width="1000px">
-      <el-table class="center-align-table" :data="tableData" border :cell-style="rowStyle" stripe>
+      <el-table
+        class="center-align-table"
+        :data="tableData"
+        border
+        :cell-style="rowStyle"
+        stripe
+      >
         <!-- Table Columns -->
         <el-table-column fixed prop="name" align="center" label="风场名称">
         </el-table-column>
@@ -106,7 +208,12 @@
       </el-table>
 
       <div class="pagination-container">
-        <el-pagination :page-size="10" :pager-count="11" layout="total, prev, pager, next" :total="35">
+        <el-pagination
+          :page-size="10"
+          :pager-count="11"
+          layout="total, prev, pager, next"
+          :total="35"
+        >
         </el-pagination>
       </div>
     </el-dialog>
@@ -123,7 +230,7 @@ import {
   findAllProvince,
   getCitiesByPId,
   getWindCompany,
-  delCompany
+  delCompany,
 } from "@/api/ledger.js";
 export default {
   data() {
@@ -148,7 +255,9 @@ export default {
       defaultExpandAll: true,
 
       rules: {
-        companyName: [{ required: true, message: "请填写单位名称", trigger: "blur,change" }],
+        companyName: [
+          { required: true, message: "请填写单位名称", trigger: "blur,change" },
+        ],
         province: [{ required: true, message: "请选择省", trigger: "change" }],
         city: [{ required: true, message: "请选择市", trigger: "change" }],
       },
@@ -159,7 +268,7 @@ export default {
       isEdit: false,
       title: "新增",
       warningShown: false,
-      addPrarentCompanyCode: null
+      addPrarentCompanyCode: null,
     };
   },
   created() {
@@ -178,6 +287,10 @@ export default {
     },
   },
   methods: {
+    handleClose() {
+      Object.assign(this.$data.newform, this.$options.data().newform);
+    },
+
     rowStyle() {
       return "text-align:center";
     },
@@ -196,10 +309,10 @@ export default {
     reset() {
       this.formInline.companyName = "";
       this.formInline.state = "";
-      this.newform.companyName = ""
-      this.newform.province = ""
-      this.newform.city = ""
-      this.newform.described = ""
+      this.newform.companyName = "";
+      this.newform.province = "";
+      this.newform.city = "";
+      this.newform.described = "";
 
       getAllWindCompany({
         companyName: "",
@@ -226,7 +339,6 @@ export default {
       });
     },
 
-
     // 省份
     postsheng() {
       findAllProvince().then((res) => {
@@ -236,7 +348,7 @@ export default {
     // 市
     fetchCities(item, city) {
       console.log(item, this.newform.province);
-      this.newform.province = item
+      this.newform.province = item;
       let data = {
         provinceId: item.areaId,
       };
@@ -244,7 +356,10 @@ export default {
         this.shidata = res.data;
       });
       if (city) {
-        this.newform.city = Object.assign({}, { areaId: city.areaId, city: city.city });
+        this.newform.city = Object.assign(
+          {},
+          { areaId: city.areaId, city: city.city }
+        );
       }
     },
     // 新增提交
@@ -262,26 +377,24 @@ export default {
           };
           if (!this.isEdit) {
             addCompany(objectval).then((res) => {
-              this.addPrarentCompanyCode = null
-            })
+              this.addPrarentCompanyCode = null;
+            });
           } else {
-            objectval.companyCode = this.detail.companyCode
-            delete objectval.parentCode
+            objectval.companyCode = this.detail.companyCode;
+            delete objectval.parentCode;
             updateCompany(objectval).then((res) => {
-              this.addPrarentCompanyCode = null
-              this.isEdit = false
-            })
+              this.addPrarentCompanyCode = null;
+              this.isEdit = false;
+            });
           }
           console.log(objectval);
           this.nuedialog = false;
-          this.getTableList()
+          this.getTableList();
         } else {
-          console.log('error submit!!');
+          console.log("error submit!!");
           return false;
         }
       });
-
-
     },
 
     // 新增触发 一级新增
@@ -293,7 +406,7 @@ export default {
     // 新增子级 这是二级入口
     newcomer(row, type) {
       this.nuedialog = true;
-      this.addPrarentCompanyCode = row.companyCode
+      this.addPrarentCompanyCode = row.companyCode;
       this.title = "新增子单位";
     },
 
@@ -314,14 +427,13 @@ export default {
       })
         .then(() => {
           delCompany({ companyCode: row.companyCode }).then((res) => {
-            this.getTableList()
+            this.getTableList();
             // 执行删除操作
             this.$message({
               type: "success",
               message: "删除成功!",
             });
-          })
-
+          });
         })
         .catch(() => {
           // 取消删除
@@ -353,7 +465,6 @@ export default {
       }
     },
 
-
     //异常详情
     particulars(row) {
       this.unusualdialog = true;
@@ -361,29 +472,33 @@ export default {
     // 编辑回显
     compile(row) {
       this.title = "编辑";
-      this.isEdit = true
+      this.isEdit = true;
       getWindCompany({
-        companyCode: row.companyCode
+        companyCode: row.companyCode,
       }).then((res) => {
-        const item = JSON.parse(JSON.stringify(res.data))
-        this.detail = item
-        this.newform = Object.assign({}, {
-          companyName: item.companyName,
-          described: item.described,
-        });
-        this.newform.province = Object.assign({}, { areaId: item.provinceId, provice: item.provinceName });
-        let that = this
+        const item = JSON.parse(JSON.stringify(res.data));
+        this.detail = item;
+        this.newform = Object.assign(
+          {},
+          {
+            companyName: item.companyName,
+            described: item.described,
+          }
+        );
+        this.newform.province = Object.assign(
+          {},
+          { areaId: item.provinceId, provice: item.provinceName }
+        );
+        let that = this;
         // this.newform.city = Object.assign({}, { areaId: item.cityId, city: item.cityName });
-        this.fetchCities(this.newform.province, { areaId: item.cityId, city: item.cityName })
-        console.log(this.newform, row, item)
+        this.fetchCities(this.newform.province, {
+          areaId: item.cityId,
+          city: item.cityName,
+        });
+        console.log(this.newform, row, item);
         this.nuedialog = true;
-      })
-
-
-
+      });
     },
-
-
   },
 };
 </script>

+ 1 - 1
src/views/ledger/milltype.vue

@@ -73,7 +73,7 @@
 
     <!-- 新增 -->
     <el-dialog :title="title" :visible.sync="nuedialog" :before-close="handleClose" width="800px">
-      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm form-grid">
+      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm form-grid">
         <div class="form-row">
           <el-form-item label="收资机型型号:" prop="machineTypeCode">
             <el-input v-model="ruleForm.machineTypeCode" size="small"></el-input>

+ 209 - 63
src/views/ledger/windsite.vue

@@ -3,15 +3,27 @@
     <div class="condition">
       <el-form :inline="true" :model="formInline" class="demo-form-inline">
         <el-form-item label="风场名称:">
-          <el-input v-model="formInline.fieldName" placeholder="请输入风场名称" size="small"></el-input>
+          <el-input
+            v-model="formInline.fieldName"
+            placeholder="请输入风场名称"
+            size="small"
+          ></el-input>
         </el-form-item>
         <el-form-item label="选择日期:" size="small">
-          <el-date-picker v-model="formInline.timeQuantum" type="daterange" range-separator="至" start-placeholder="开始日期"
-            end-placeholder="结束日期" @change="onDateChange">
+          <el-date-picker
+            v-model="formInline.timeQuantum"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="onDateChange"
+          >
           </el-date-picker>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="onSubmit" size="small">查询</el-button>
+          <el-button type="primary" @click="onSubmit" size="small"
+            >查询</el-button
+          >
           <el-button @click="reset" size="small">重置</el-button>
         </el-form-item>
       </el-form>
@@ -19,19 +31,36 @@
     <div class="list-page">
       <div class="newly">
         <el-button @click="upfile" size="small">导入</el-button>
-        <el-button type="primary" @click="newnuedialog" size="small">新增</el-button>
+        <el-button type="primary" @click="newnuedialog" size="small"
+          >新增</el-button
+        >
       </div>
 
-      <el-table class="center-align-table" :data="tableData" border :cell-style="rowStyle">
+      <el-table
+        class="center-align-table"
+        :data="tableData"
+        border
+        :cell-style="rowStyle"
+      >
         <el-table-column align="center" fixed prop="" label="单位名称">
           <template slot-scope="scope">
-            <el-button @click="particulars(scope.row)" type="text" size="small">{{ scope.row.fieldName }}</el-button>
+            <el-button
+              @click="particulars(scope.row)"
+              type="text"
+              size="small"
+              >{{ scope.row.fieldName }}</el-button
+            >
           </template>
         </el-table-column>
 
         <el-table-column prop="windCompany" align="center" label="关联公司">
         </el-table-column>
-        <el-table-column prop="windCompany" align="center" label="风机数量" width="80">
+        <el-table-column
+          prop="windCompany"
+          align="center"
+          label="风机数量"
+          width="80"
+        >
           <template slot-scope="scope">
             <el-button @click="ONdraught(scope.row)" type="text" size="small">{{
               scope.row.wegNumber
@@ -39,15 +68,35 @@
           </template>
         </el-table-column>
 
-        <el-table-column align="center" prop="abnormal" label="测风塔" width="80">
+        <el-table-column
+          align="center"
+          prop="abnormal"
+          label="测风塔"
+          width="80"
+        >
           <template slot-scope="scope">
-            <el-button @click="ONanemometer(scope.row)" type="text" size="small">{{ scope.row.atrNumber }}</el-button>
+            <el-button
+              @click="ONanemometer(scope.row)"
+              type="text"
+              size="small"
+              >{{ scope.row.atrNumber }}</el-button
+            >
           </template>
         </el-table-column>
 
-        <el-table-column prop="provinceName" align="center" label="所在省" width="100">
+        <el-table-column
+          prop="provinceName"
+          align="center"
+          label="所在省"
+          width="100"
+        >
         </el-table-column>
-        <el-table-column prop="cityName" align="center" label="所在市" width="100">
+        <el-table-column
+          prop="cityName"
+          align="center"
+          label="所在市"
+          width="100"
+        >
         </el-table-column>
 
         <!-- <el-table-column prop="ratedCapacityNumber" align="center" label="总额定容量" width="100">
@@ -61,19 +110,53 @@
             {{ row.state == 1 ? "启用" : "停用" }}
           </template>
         </el-table-column>
-        <el-table-column prop="transition" align="center" fixed="right" label="操作" width="200">
+        <el-table-column
+          prop="transition"
+          align="center"
+          fixed="right"
+          label="操作"
+          width="200"
+        >
           <template slot-scope="scope">
-            <el-button @click="compile(scope.row)" type="text" size="small">编辑</el-button>
-            <el-button @click="uploading(scope.row)" type="text" size="small">上传</el-button>
-            <el-button v-if="scope.row.state == 0" @click="start(scope.row, 1)" type="text" size="small">启用</el-button>
-            <el-button v-else style="color: #666" @click="start(scope.row, 0)" type="text" size="small">停用</el-button>
-            <el-button style="color: #f00" @click="deleted(scope.row)" type="text" size="small">删除</el-button>
+            <el-button @click="compile(scope.row)" type="text" size="small"
+              >编辑</el-button
+            >
+            <el-button @click="uploading(scope.row)" type="text" size="small"
+              >上传</el-button
+            >
+            <el-button
+              v-if="scope.row.state == 0"
+              @click="start(scope.row, 1)"
+              type="text"
+              size="small"
+              >启用</el-button
+            >
+            <el-button
+              v-else
+              style="color: #666"
+              @click="start(scope.row, 0)"
+              type="text"
+              size="small"
+              >停用</el-button
+            >
+            <el-button
+              style="color: #f00"
+              @click="deleted(scope.row)"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
       <div class="pagination-container">
-        <el-pagination @current-change="handleCurrentChange" :current-page.sync="formInline.pageNum"
-          layout="total, prev, pager, next" :page-size="formInline.pageSize" :total="formInline.totalSize">
+        <el-pagination
+          @current-change="handleCurrentChange"
+          :current-page.sync="formInline.pageNum"
+          layout="total, prev, pager, next"
+          :page-size="formInline.pageSize"
+          :total="formInline.totalSize"
+        >
         </el-pagination>
       </div>
     </div>
@@ -99,7 +182,12 @@
           <div class="row">
             <div class="condition">
               <el-form-item label="上级单位:" prop="companyCode">
-                <selecttree placeholder="请选择上级单位" :list="parentOpt" v-model="form.companyCode" @change="parentChange">
+                <selecttree
+                  placeholder="请选择上级单位"
+                  :list="parentOpt"
+                  v-model="form.companyCode"
+                  @change="parentChange"
+                >
                 </selecttree>
               </el-form-item>
             </div>
@@ -112,17 +200,35 @@
           <div class="row">
             <div class="condition">
               <el-form-item label="所在省:" prop="provinceName">
-                <el-select v-model="form.provinceName" placeholder="请选择" value-key="areaId" @change="fetchCities">
-                  <el-option v-for="item in provinceNameOptions" :key="item.areaId" :label="item.province"
-                    :value="item">
+                <el-select
+                  v-model="form.provinceName"
+                  placeholder="请选择"
+                  value-key="areaId"
+                  @change="fetchCities"
+                >
+                  <el-option
+                    v-for="item in provinceNameOptions"
+                    :key="item.areaId"
+                    :label="item.province"
+                    :value="item"
+                  >
                   </el-option>
                 </el-select>
               </el-form-item>
             </div>
             <div class="condition">
               <el-form-item label="所在市:" prop="cityName">
-                <el-select v-model="form.cityName" placeholder="请选择" value-key="areaId">
-                  <el-option v-for="item in cityNameOptions" :key="item.areaId" :label="item.city" :value="item">
+                <el-select
+                  v-model="form.cityName"
+                  placeholder="请选择"
+                  value-key="areaId"
+                >
+                  <el-option
+                    v-for="item in cityNameOptions"
+                    :key="item.areaId"
+                    :label="item.city"
+                    :value="item"
+                  >
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -143,10 +249,19 @@
           <div class="row">
             <div class="condition">
               <el-form-item label="测风塔:" prop="anemometerTowerRelationDtos">
-                <el-select v-model="form.anemometerTowerRelationDtos" multiple collapse-tags placeholder="请选择"
-                  value-key="anemometerCode">
-                  <el-option v-for="item in options" :key="item.anemometerCode" :label="item.anemometerName"
-                    :value="item.anemometerCode">
+                <el-select
+                  v-model="form.anemometerTowerRelationDtos"
+                  multiple
+                  collapse-tags
+                  placeholder="请选择"
+                  value-key="anemometerCode"
+                >
+                  <el-option
+                    v-for="item in options"
+                    :key="item.anemometerCode"
+                    :label="item.anemometerName"
+                    :value="item.anemometerCode"
+                  >
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -157,14 +272,16 @@
 
       <div class="bianji" v-show="listedfiles">
         <el-table :data="filetableData" style="width: 100%">
-          <el-table-column prop="" label="文件名" width="180">
-          </el-table-column>
-          <el-table-column prop="" label="文件类型" width="180">
-          </el-table-column>
-          <el-table-column prop="" label="文件大小"> </el-table-column>
+          <el-table-column prop="fileName" label="文件名"> </el-table-column>
+          <el-table-column prop="type" label="文件类型"> </el-table-column>
+
           <el-table-column fixed="right" label="操作" width="120">
             <template slot-scope="scope">
-              <el-button @click.native.prevent="deleteRow(scope.row)" type="text" size="small">
+              <el-button
+                @click.native.prevent="deleteRow(scope.row)"
+                type="text"
+                size="small"
+              >
                 删除
               </el-button>
             </template>
@@ -172,25 +289,50 @@
         </el-table>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="handleClose(false, 'nuedialog')" size="small">取 消</el-button>
-        <el-button type="primary" @click="newly('formRef')" size="small">确 定</el-button>
+        <el-button @click="handleClose(false, 'nuedialog')" size="small"
+          >取 消</el-button
+        >
+        <el-button type="primary" @click="newly('formRef')" size="small"
+          >确 定</el-button
+        >
       </span>
     </el-dialog>
 
     <!-- 风场详情 -->
-    <WindsiteMessage :unusualdialog="unusualdialog" :unusualdialogdata="unusualdialogdata" @handleClose="handleClose">
+    <WindsiteMessage
+      :unusualdialog="unusualdialog"
+      :unusualdialogdata="unusualdialogdata"
+      @handleClose="handleClose"
+    >
     </WindsiteMessage>
     <!-- 测风塔 -->
-    <windsitemachine :anemometerdialog="anemometerdialog" :anemometerData="anemometerData" @handleClose="handleClose">
+    <windsitemachine
+      :anemometerdialog="anemometerdialog"
+      :anemometerData="anemometerData"
+      @handleClose="handleClose"
+    >
     </windsitemachine>
     <!-- 风机数量 -->
-    <windsitetower :draught="draught" :draughtData="draughtData" @handleClose="handleClose"></windsitetower>
+    <windsitetower
+      :draught="draught"
+      :draughtData="draughtData"
+      @handleClose="handleClose"
+    ></windsitetower>
     <!-- 上传 -->
-    <windsiteup :uploadingPOP="uploadingPOP" :rowdata="rowdata" :AllTemplateurlDR="AllTemplateurlDR"
-      @handleClose="handleClose"></windsiteup>
+    <windsiteup
+      :uploadingPOP="uploadingPOP"
+      :rowdata="rowdata"
+      :AllTemplateurlDR="AllTemplateurlDR"
+      @handleClose="handleClose"
+    ></windsiteup>
     <!-- 导入 -->
-    <windsitetolead :parentOptdata="parentOptdata" :AllTemplateurl="AllTemplateurl" :tolead="tolead"
-      @handleClose="handleClose" @onSubmit="onSubmit"></windsitetolead>
+    <windsitetolead
+      :parentOptdata="parentOptdata"
+      :AllTemplateurl="AllTemplateurl"
+      :tolead="tolead"
+      @handleClose="handleClose"
+      @onSubmit="onSubmit"
+    ></windsitetolead>
   </div>
 </template>
 
@@ -208,7 +350,8 @@ import {
   updateWindFieldStateById,
   windEngineGrouPage,
   windFieldDto,
-  getAllTemplate
+  getAllTemplate,
+  delWindFieldResource,
 } from "@/api/ledger.js";
 import selecttree from "../../components/selecttree";
 import WindsiteMessage from "./component/windsiteMessage.vue";
@@ -314,7 +457,7 @@ export default {
     this.postsheng();
     this.relevanceunit();
     this.TowerNameList();
-    this.getAllTemplate()
+    this.getAllTemplate();
   },
   methods: {
     handleClose(value, dialogName) {
@@ -327,9 +470,9 @@ export default {
     },
     getAllTemplate() {
       getAllTemplate().then((res) => {
-        this.AllTemplateurl = res.data
-        this.AllTemplateurlDR = res.data
-      })
+        this.AllTemplateurl = res.data;
+        this.AllTemplateurlDR = res.data;
+      });
     },
 
     // 时间转换
@@ -387,7 +530,6 @@ export default {
         const res = await getAllWindCompany();
         this.parentOpt = res.data;
         this.parentOptdata = res.data;
-
       } catch (error) {
         console.error("Error fetching wind company data:", error);
       }
@@ -479,7 +621,7 @@ export default {
       });
     },
     // 重置
-    reset() { },
+    reset() {},
     //导入提交
     UPsubmit() {
       this.tolead = false;
@@ -518,32 +660,30 @@ export default {
 
     // 编辑
     compile(row) {
-      console.log(row, "row");
-      //编辑 接口WindFieldDto
       getWindFieldVo({
         fieldCode: row.fieldCode,
       }).then((res) => {
+        this.filetableData = res.data.windFieldResourceVos;
         const item = JSON.parse(JSON.stringify(res.data));
         this.detail = item;
         Object.keys(this.form).forEach((key) => {
           this.form[key] = item[key];
         });
-        this.form.anemometerTowerRelationDtos = item?.anemometerTowerByFieldVos.map(element => {
-          return element.anemometerCode
-        });
+        this.form.anemometerTowerRelationDtos =
+          item?.anemometerTowerByFieldVos.map((element) => {
+            return element.anemometerCode;
+          });
         this.detail = row;
         this.nuedialog = true;
         this.listedfiles = true;
         this.title = "编辑";
         this.isEdit = true;
       });
-
     },
     // 上传附件
     uploading(row) {
       this.uploadingPOP = true;
-      this.rowdata = row
-
+      this.rowdata = row;
     },
 
     // 删除
@@ -587,9 +727,15 @@ export default {
         type: "warning",
       })
         .then(() => {
-          this.$message({
-            type: "success",
-            message: "删除成功!",
+          delWindFieldResource({ id: row.id }).then((res) => {
+            const index = this.filetableData.indexOf(row);
+            if (index !== -1) {
+              this.filetableData.splice(index, 1);
+            }
+            this.$message({
+              type: "success",
+              message: "删除成功!",
+            });
           });
         })
         .catch(() => {

+ 2 - 2
vue.config.js

@@ -70,14 +70,14 @@ module.exports = {
         // target: "http://106.120.102.238:16600", //外网
         changeOrigin: true,
         pathRewrite: {
-          "^/api": "", // 需要rewrite重写的,
+          "^/api": "", // 需要regit write重写的,
         },
       },
       "/downLoadApi": {
         target: "http://192.168.50.241:8080", //http://192.168.50.241:8080/
         changeOrigin: true,
         pathRewrite: {
-          "^/downLoadApi": "", // 需要rewrite重写的,
+          "^/downLoadApi": "", // 需要rewrite重写的,z
         },
       },
     },