Bläddra i källkod

Merge branch 'yx' of http://61.161.152.110:10101/r/electronic-map into sl

# Conflicts:
#	src/router/index.js
shilin 3 år sedan
förälder
incheckning
cf14d988d5

+ 1 - 1
public/static/config/modeConfig.js

@@ -11,7 +11,7 @@ if (localTest) {
     baseURL = "http://192.168.10.12:8082/" // 联机调试 - 石林
         // baseURL = "http://10.155.32.33:9001/" // 联机调试 - 谢生杰
 } else {
-    baseURL = "http://192.168.10.12:8082/" // 正式环境
+    baseURL = "http://10.155.32.4:8082/" // 正式环境
 }
 
 websocketUrl = (baseURL.replace(/http:\/\/|https:\/\//g, "")) + "gyee-websocket";

+ 37 - 11
src/views/HealthControl/Health0.vue

@@ -14,6 +14,7 @@
                       clearable
                       placeholder="请选择风场"
                       popper-class="select"
+                      @change="wpselect"
                     >
                       <el-option
                         v-for="item in options"
@@ -33,6 +34,7 @@
                       clearable
                       placeholder="请选择风机"
                       popper-class="select"
+                      @change="wtselect"
                     >
                       <el-option
                         v-for="item in options1"
@@ -45,11 +47,11 @@
                   </div>
                 </div>
               </div>
-              <div class="query-actions">
+              <!-- <div class="query-actions">
                 <button class="btn" type="button">
                   <i class="el-icon-back mg-r-8"></i><span>返回</span>
                 </button>
-              </div>
+              </div> -->
             </div>
           </el-col>
         </el-row>
@@ -59,7 +61,7 @@
               <SvgIcon svgid="svg-wind-site"></SvgIcon>
             </span>
             <div class="fan-code">
-              <div class="fan-code-text font-md green">MG02-01</div>
+              <div class="fan-code-text font-md green">{{value2}}</div>
               <div class="fan-code-label font-md gray-l">高频:</div>
               <div class="fan-code-value font-md green">{{stoptypemap && stoptypemap.top1type}}</div>
               <div class="fan-code-label font-md gray-l">中频:</div>
@@ -71,13 +73,13 @@
               <SvgIcon svgid="svg-wind-site"></SvgIcon>
             </span>
             <div class="fan-code bg">
-              <div class="fan-code-label font-md gray-l">高频:</div>
+              <div class="fan-code-label font-md gray-l">风机评分:</div>
             </div>
             <div class="fan-code">
               <div class="fan-code-value nm font-md green">{{stoptypemap && stoptypemap.wtscore}}</div>
             </div>
             <button class="btn mg-l-16" type="button">
-              <i class="el-icon-s-order mg-r-8"></i><span>健康报告</span>
+              <i class="el-icon-s-order mg-r-8" @click="onClickReport()"></i><span>健康报告</span>
             </button>
           </el-col>
         </el-row>
@@ -97,9 +99,9 @@
           </el-col>
           <el-col :span="6"></el-col>
           <el-col :span="6"></el-col>
-          <el-col :span="6">
+          <!-- <el-col :span="6">
             <progress-bar title="风机" name="风机健康度" :progress='partmap && partmap.fj.smsyl' :color="partmap &&color(partmap.fj.jkzt)"></progress-bar>
-          </el-col>
+          </el-col> -->
         </el-row>
         <el-row>
           <el-col :span="6" class="mg-t-16">
@@ -197,6 +199,7 @@
         </el-row>
       </el-col>
     </el-row>
+    <health-report :show="reportshow" :params="reportparams" @closed="closed"/>
   </div>
 </template>
 
@@ -205,6 +208,7 @@ import SvgIcon from "@com/coms/icon/svg-icon.vue";
 import StandAloneImg from "@/views/WindSite/pages/Info/StandAloneImg.vue";
 import ProgressBar from "@com/coms/progress-bar/progress-bar.vue";
 import Table from "../../components/coms/table/table.vue";
+import HealthReport from "../../components/other/healthReport/index.vue"
 export default {
   setup() {},
   components: {
@@ -212,9 +216,12 @@ export default {
     StandAloneImg,
     ProgressBar,
     Table,
+    HealthReport
   },
   data() {
     return {
+      reportshow: false, //是否显示健康报告
+      reportparams: undefined,
       bsxImg: require("@assets/png/bsx.png"),
       options: [
         {
@@ -707,13 +714,31 @@ export default {
   },
   created() {
       this.search()
-      this.wtid = this.$route.params.wtId;
-      this.wpid = this.$route.params.wpId;
+        this.wtid = this.$route.params.wtId;
+        this.wpid = this.$route.params.wpId;
   },
   methods: {
+    // 查看健康报告
+    onClickReport(){
+      console.warn('查看健康报告');
+      this.reportshow = true
+      this.reportparams = {wtId: this.value2, recorddate: new Date(new Date()).formatDate("yyyy-MM-dd")}
+    },
+    // 关闭健康报告
+    closed(){
+      this.reportshow = false
+    },
       color(val){
      return this.colorval[val]
     },
+    wpselect(){
+      console.warn('wpselect');
+      this.searchWindturbine('select')
+    },
+    wtselect(){
+      console.warn('wtselect');
+      this.searchWtHealthInfo()
+    },
     async search() {
       const { data } = await this.API.requestData({
         subUrl: "powercompare/windfarmAjax",
@@ -722,7 +747,7 @@ export default {
       this.value1 = this.wpid;
       this.searchWindturbine()
     },
-    async searchWindturbine() {
+    async searchWindturbine(statu) {
       const { data } = await this.API.requestData({
         subUrl: "/powercompare/windturbineAjax",
         data:{
@@ -730,13 +755,14 @@ export default {
         }
       });
       this.options1 = data.data;
-      this.value2 = this.wtid;
+      this.value2 = statu =='select' ?data.data[0].id : this.wtid;
       console.warn(data);
      this.searchWtHealthInfo()
     },
     async searchWtHealthInfo() {
       const { data } = await this.API.requestData({
         subUrl: "/healthsub//findWtHealthInfo",
+        showLoading: true,
         method:'POST',
         timeout: 30000, // 请求超时时间,默认 3s ,可缺省
         data:{

+ 53 - 36
src/views/HealthControl/Health8.vue

@@ -58,47 +58,50 @@
         <div style="height: calc(100vh - 174px)">
           <table style="width: 100%" border="0" cellspacing="0">
             <tbody>
-              <tr v-for="(item,index) in tableData" :key="index">
-                <td style="width: 50px">{{item.id}}</td>
-                <td style="width: 105px">{{item.wtname}}</td>
-                <td style="width: 105px">{{item.model}}</td>
+              <tr v-for="(item, index) in tableData" :key="index">
+                <td style="width: 50px">{{ item.id }}</td>
+                <td style="width: 105px">{{ item.wtname }}</td>
+                <td style="width: 105px">{{ item.model }}</td>
                 <td style="width: 350px">
                   <div class="percent-item">
-                    {{item.zxd}}%
+                    {{ item.zxd }}%
                     <div class="percent-bar" style="">
-                      <div class="percent-value" :style="{'width':`${item.zxd}%`}"></div>
+                      <div
+                        class="percent-value"
+                        :style="{ width: `${item.zxd}%` }"
+                      ></div>
                     </div>
                   </div>
                 </td>
                 <td class="score" style="width: 100px">
-                  <div>{{item.score}}</div>
+                  <div>{{ item.score }}</div>
                 </td>
                 <td>
-                  <table-line-chart :list='item.futureHealth'/>
+                  <table-line-chart :list="item.futureHealth" />
                 </td>
                 <td class="item">
-                  <div :class="[color(item.clx)]">{{item.clx}}</div>
+                  <div :class="[color(item.clx)]">{{ item.clx }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.fdj)]">{{item.fdj}}</div>
+                  <div :class="[color(item.fdj)]">{{ item.fdj }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.zz)]">{{item.zz}}</div>
+                  <div :class="[color(item.zz)]">{{ item.zz }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.bj)]">{{item.bj}}</div>
+                  <div :class="[color(item.bj)]">{{ item.bj }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.ph)]">{{item.ph}}</div>
+                  <div :class="[color(item.ph)]">{{ item.ph }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.jc)]">{{item.jc}}</div>
+                  <div :class="[color(item.jc)]">{{ item.jc }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.bpq)]">{{item.bpq}}</div>
+                  <div :class="[color(item.bpq)]">{{ item.bpq }}</div>
                 </td>
                 <td class="item">
-                  <div :class="[color(item.zk)]">{{item.zk}}</div>
+                  <div :class="[color(item.zk)]">{{ item.zk }}</div>
                 </td>
               </tr>
             </tbody>
@@ -139,39 +142,53 @@ export default {
         },
       ],
       value1: "",
-      tableData:'',
-      colorval:{
-        '优':'purple',
-        '良':'orange',
-        '差':'red',
-      }
+      tableData: "",
+      colorval: {
+        优: "purple",
+        良: "orange",
+        差: "red",
+      },
     };
+    futureHealth: null;
   },
   created() {
     this.search();
   },
   methods: {
-    color(val){
-     return this.colorval[val]
+    color(val) {
+      return this.colorval[val];
     },
     async search() {
-      const {data} = await this.API.requestData({
+      const { data } = await this.API.requestData({
         subUrl: "powercompare/windfarmAjax",
       });
-      this.options = data.data
-      this.value1 = data.data[0].id
-      this.searchWindTurbineHealthList()
+      this.options = data.data;
+      this.value1 = data.data[0].id;
+      this.searchWindTurbineHealthList();
     },
-    async searchWindTurbineHealthList(){
-      const {data} = await this.API.requestData({
+    async searchWindTurbineHealthList() {
+      const { data } = await this.API.requestData({
         subUrl: "wtHealthList/windTurbineHealthList",
-        method: "POST", 
-        data:{
-          wpId : this.value1
-        }
+        method: "POST",
+        data: {
+          wpId: this.value1,
+        },
       });
-        this.tableData = data.data
-    }
+      this.tableData = data.data;
+      console.warn(data.data);
+      data.data.forEach((k) => {
+        let arr =[]
+        k.futureHealth.forEach((e, index) => {
+          let obj = {
+            text: index,
+            value: e,
+          };
+          arr.push(obj)
+        });
+        k.futureHealth = arr
+      });
+      console.warn(this.tableData);
+    },
   },
 };
 </script>

+ 61 - 39
src/views/NewPages/personnel.vue

@@ -17,6 +17,7 @@
         v-for="(item, index) in resData"
         :key="index"
         @click="todesc(item)"
+        :style="[item.objects && frontOneHour < item.objects['LAT'].ts ? 'order:-1' :'']"
       >
         <div class="personnel-box-item-h">
           <div class="personnel-box-item-header">
@@ -54,7 +55,14 @@
             {{ item.objects && item.username }}
           </div>
           <div class="personnel-box-item-icon">
-            <i :class="['el-icon-user-solid',item.objects && frontOneHour<item.objects['LAT'].ts? 'icolor':'']" ></i>
+            <i
+              :class="[
+                'el-icon-user-solid',
+                item.objects && frontOneHour < item.objects['LAT'].ts
+                  ? 'icolor'
+                  : '',
+              ]"
+            ></i>
           </div>
         </div>
       </div>
@@ -75,7 +83,7 @@
               <div class="search-input">
                 <el-date-picker
                   v-model="startdate"
-                  type="date"
+                  type="datetime"
                   placeholder="选择日期"
                   popper-class="date-select"
                   class="placeholder-left"
@@ -88,7 +96,7 @@
               <div class="search-input">
                 <el-date-picker
                   v-model="enddate"
-                  type="date"
+                  type="datetime"
                   placeholder="选择日期"
                   popper-class="date-select"
                   class="placeholder-left"
@@ -161,7 +169,7 @@
           height="45vh"
           :showLegend="true"
           :units="['半小时检测值']"
-          :list='chartList'
+          :list="chartList"
         />
       </div>
     </el-dialog>
@@ -211,12 +219,11 @@ export default {
       dialogVisible: false,
       resData: null,
       perData: null,
-      frontOneHour : new Date().getTime() - 10 * 60 * 1000,
-      startdate: new Date(
-        new Date(new Date().setDate(new Date().getDate() - 1))
-      ).formatDate("yyyy-MM-dd"),
-      enddate: new Date(new Date()).formatDate("yyyy-MM-dd"),
-      chartList:[
+      frontOneHour: new Date().getTime() - 10 * 60 * 1000,  //前十分钟
+      startdate: new Date(new Date().getTime() - 60 * 60 * 1000
+      ).formatDate("yyyy-MM-dd hh:mm:ss"),
+      enddate: new Date(new Date()).formatDate("yyyy-MM-dd hh:mm:ss"),
+      chartList: [
         {
           title: "疲劳度",
           yAxisIndex: 0,
@@ -314,14 +321,14 @@ export default {
   },
   // 函数
   methods: {
-      imgurl(v){
-          try {
-              const url  = require(`@assets/person/${v}.jpg`)
-              return url
-          } catch (error) {
-              return require('@assets/logo.png')
-          }
-      },
+    imgurl(v) {
+      try {
+        const url = require(`@assets/person/${v}.jpg`);
+        return url;
+      } catch (error) {
+        return require("@assets/logo.png");
+      }
+    },
     clickBtn(btn, index) {
       this.search(btn.val);
       this.btnIndex = index;
@@ -332,28 +339,43 @@ export default {
     async todesc(item) {
       this.dialogVisible = true;
       this.perData = item;
-      this.searchper()
+      this.searchper();
     },
     async searchper() {
-      const { data } = await axios.get(  //http://192.168.10.12:8082/   //http://10.155.32.4:8010
-        `http://192.168.1.18:8087/bracelet/getInfo?userid=${this.perData.mobile}&beginDate=${new Date(this.startdate).formatDate("yyyy-MM-dd HH:mm:ss")}&endDate=${new Date(this.enddate).formatDate("yyyy-MM-dd HH:mm:ss")}`);
-      let arr=[]
-      data.data.forEach(e => {
-          let obj={
-            title: e.name,
-            yAxisIndex: 0,
-            value:[]
-          }
-          e.bs.forEach(i => {
-              let obj1={
-              text: "1",
-              value: i.val,
-            }
-              obj.value.push(obj1)
-          })
-          arr.psuh(obj)
+      const { data } = await axios.get(
+        //http://192.168.10.12:8082/   //http://10.155.32.4:8010
+        // `http://10.155.32.4:8034/bracelet/getInfo?userid=1864&beginDate=2021-07-15+12%3A01%3A22&endDate=2021-07-15+15%3A01%3A22`);
+      
+      `http://10.155.32.4:8034/bracelet/getInfo?userid=${this.perData.mobile}&beginDate=${new Date(this.startdate).formatDate("yyyy-MM-dd hh:mm:ss")}&endDate=${new Date(this.enddate).formatDate("yyyy-MM-dd hh:mm:ss")}`);
+      console.warn(data);
+      let arr = [];
+      let resarr = ["pld", "ssxy", "szxy", "xtpl", "xy"];
+      const objb = {
+        pld: "疲劳度",
+        ssxy: "收缩血压",
+        szxy: "舒张血压",
+        xtpl: "心跳频率",
+        xy: "血氧",
+      };
+      resarr.forEach((e) => {
+        let obj = {
+          title: objb[e],
+          yAxisIndex: 0,
+          value: [],
+        };
+        let vlarr = [];
+        data.forEach((k) => {
+          let obj1 = {
+            text: new Date(k.date).formatDate("hh:mm"),
+            value: k[e]
+          };
+          vlarr.push(obj1);
+        });
+        obj.value = vlarr;
+        arr.push(obj);
       });
-      this.chartList = arr
+      console.warn(arr);
+      this.chartList = arr;
     },
     async search(id) {
       const { data } = await axios.get(
@@ -387,8 +409,8 @@ export default {
 </script>
 
 <style lang="less">
-.icolor{
-    color: #05bb4c;
+.icolor {
+  color: #05bb4c;
 }
 .personnel {
   widows: 100%;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1673 - 0
src/views/WindSite/components/boosterstation/mch/BoosterStation.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1349 - 0
src/views/WindSite/components/boosterstation/mch/mch.vue


+ 697 - 0
src/views/WindSite/components/boosterstation/mch/previewPicture.vue

@@ -0,0 +1,697 @@
+<template>
+	<div class="pop-up-main">
+		<div class="paln-box">
+			<div class="movableItem" :style="{width:width,height:height}" @mousewheel="rollImg($event)"
+				@mousedown="drag($event,1)" ref="bigImage">
+				<!-- 图片不可选中 或不可拖拽到新标签打开-->
+				<slot name="svg" oncontextmenu="return false;" onselectstart="return false;" draggable="false"></slot>
+				<template v-if="isEdit &&iconWidth">
+					<img ref="signImage" :src="iconImgUrl" @mousedown="dragSign($event,key)"
+						v-for="(item,key) in equipment" :key="key"
+						:style="{top:equipment[key].top+'%',left:equipment[key].left+'%',width:iconWidth,height:iconHeight}"
+						class="equipment" />
+				</template>
+				<el-popover width="200" placement="bottom-start" trigger="hover" :close-delay="100" content="暂无描述"
+					v-else-if="!isEdit&&iconWidth &&arrIcon.length==equipment.length " v-for="(item,key) in equipment"
+					:key="key" popper-class="preview-popover">
+					<!-- &&arrIcon.length==equipment.length -->
+					<template>
+						<div v-if="equipment[key].describe" class="describe">
+							<p class="describe-top">{{equipment[key].describe.deviceName}}</p>
+							<p class="describe-center">{{equipment[key].describe.remark}}</p>
+							<p class="describe-bottom">{{equipment[key].describe.location}}</p>
+						</div>
+					</template>
+					<!-- <img oncontextmenu="return false;" onselectstart="return false;" draggable="false" slot="reference"
+						ref="signImage" :src="$baseUrl + equipment[key].iconImgUrl"
+						:style="{top:equipment[key].top+'%',left:equipment[key].left+'%',width:arrIcon[key].iconWidth,height:arrIcon[key].iconHeight}"
+						class="equipment" /> -->
+				</el-popover>
+			</div>
+		</div>
+	</div>
+</template>
+<script>
+	export default {
+		props: {
+			equipment: {
+				type: Array,
+				default: () => {
+					return [{
+						iconImgUrl: "",
+						top: 0,
+						left: 0,
+					}, ];
+				},
+			},
+			isEdit: {
+				default: false,
+			},
+			imgUrl: {},
+		},
+
+		data() {
+			return {
+				// 定时器
+				timer: "",
+				// 图片加载失败
+				imgOnerror: false,
+				imgIndex: 0,
+				isChange: true,
+				// 图片显示默认大小
+				width: "1400px",
+				height: "900px",
+				// 可缩小倍数,为空则可无限缩小
+				minification: 3,
+				// 可放大倍数 为空则可无限放大
+				magnification: "",
+				bigMaxWidth: 1600,
+				bigMaxHeight: 800,
+
+				// 小图标信息
+				iconImgUrl: "",
+				iconWidth: "",
+				// 存储每个小图标处理好的宽高
+				iconHeight: "",
+				arrIcon: [],
+				iconMaxWidth: 32,
+				iconMaxHeight: 32,
+				tog: 1,
+			};
+		},
+		methods: {
+			// 获取图片大小
+			getImgInfo(
+				imgUrl,
+				MaxWidth,
+				MaxHeight,
+				StrWidth,
+				StrHeight,
+				Array = false,
+				arr,
+				num = 0
+			) {
+				var img = new Image();
+
+				// img.src = imgUrl;
+				img = document.getElementsByClassName("svg")
+				let _this = this;
+				img.onerror = () => {
+					// console.log("加载失败!!", _this.arrIcon.length);
+					console.log(imgUrl, MaxWidth, MaxHeight, StrWidth, StrHeight);
+					_this.imgOnerror = true;
+					_this.imgIndex =
+						_this.arrIcon.length - 1 < 0 ? 0 : _this.arrIcon.length - 1;
+					this.timer = setTimeout(() => {
+						if (num <= 5) {
+							_this.getImgInfo(
+								imgUrl,
+								MaxWidth,
+								MaxHeight,
+								StrWidth,
+								StrHeight,
+								Array,
+								arr,
+								num + 1
+							);
+						}
+						clearInterval(this.timer);
+					}, 2000);
+				};
+				img.onload = function(e) {
+					//  显示时 初始 最大宽度
+					let maxWidth = MaxWidth;
+					//  显示时 初始 最大高度
+					let maxHeight = MaxHeight;
+					if (
+						e.path[0].naturalWidth <= maxWidth &&
+						e.path[0].naturalHeight <= maxHeight
+					) {
+						_this[StrWidth] = e.path[0].naturalWidth + "px";
+						_this[StrHeight] = e.path[0].naturalHeight + "px";
+					} else {
+						_this[StrWidth] = e.path[0].naturalWidth + "px";
+						_this[StrHeight] = e.path[0].naturalHeight + "px";
+						if (
+							e.path[0].naturalWidth > maxWidth &&
+							e.path[0].naturalHeight <= maxHeight
+						) {
+							let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
+							_this[StrWidth] = "1600px";
+							_this[StrHeight] = maxWidth / ratio + "px";
+						} else if (
+							e.path[0].naturalWidth <= maxWidth &&
+							e.path[0].naturalHeight > maxHeight
+						) {
+							let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
+							_this[StrWidth] = maxHeight * ratio + "px";
+							_this[StrHeight] = "800px";
+						} else if (
+							e.path[0].naturalWidth > maxWidth &&
+							e.path[0].naturalHeight > maxHeight
+						) {
+							let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
+							let w = maxWidth;
+							let h = w / ratio;
+							if (h > maxHeight) {
+								let ratio2 = w / h;
+								h = maxHeight;
+								w = h * ratio2;
+							}
+							_this[StrWidth] = w + "px";
+							_this[StrHeight] = h + "px";
+						}
+					}
+					if (Array) {
+						_this[arr].push({
+							iconWidth: _this[StrWidth],
+							iconHeight: _this[StrHeight],
+						});
+						console.log(
+							"tow#################################arrIcon",
+							_this[arr].length
+						);
+					}
+					// _this[StrWidth] = `${e.path[0].naturalWidth}px`;
+					// _this[StrHeight] = `${e.path[0].naturalHeight}px`;
+					// vm.$set(vm.imgInfo, "width", img.width);
+					// vm.$set(vm.imgInfo, "height", img.height);
+					// console.log("打印图片信息", imgUrl, _this[StrWidth], _this[StrHeight]); // 打印图片信息
+
+					// console.log("打印图片信息", e.path[0].naturalHeight); // 打印图片信息
+					// console.log("打印图片信息", e); // 打印图片信息
+					// console.log("打印图片信息this.width", _this[StrWidth]); // 打印图片信息
+					// console.log("打印图片信息this.height", _this[StrHeight]); // 打印图片信息
+				};
+			},
+			// 缩放
+			rollImg() {
+				var that = this;
+				// var oImg = document.getElementsByClassName("movableItem")[0];
+				var oImg = this.$refs.bigImage;
+				console.log(
+					"length",
+					document.getElementsByClassName("movableItem").length
+				);
+				console.log("oImg", oImg);
+				var _this = this;
+
+				function fnWheel(obj, fncc) {
+					obj.onmousewheel = fn;
+					if (obj.addEventListener) {
+						obj.addEventListener("DOMMouseScroll", fn, false);
+					}
+
+					function fn(ev) {
+						var oEvent = ev || window.event;
+						var down = true;
+						if (oEvent.detail) {
+							down = oEvent.detail > 0;
+						} else {
+							down = oEvent.wheelDelta < 0;
+						}
+						if (fncc) {
+							fncc.call(this, down, oEvent);
+						}
+						if (oEvent.preventDefault) {
+							oEvent.preventDefault();
+						}
+						return false;
+					}
+				}
+				fnWheel(oImg, function(down, oEvent) {
+					var oldWidth = this.offsetWidth;
+					var oldHeight = this.offsetHeight;
+					var oldLeft = this.offsetLeft;
+					var oldTop = this.offsetTop;
+					var parent = oEvent.path[2];
+					// 获取父元素距离页面可视区域的位置
+					var parentLeft = parent.getBoundingClientRect().left;
+					var parentTop = parent.getBoundingClientRect().top;
+					// 比例 = (点击位置距离可视窗口位置 - 父元素距离可视窗口位置 - 相对定位的left)/ 本身宽度
+					var scaleX = (oEvent.clientX - parentLeft - oldLeft) / oldWidth; //比例
+					var scaleY = (oEvent.clientY - parentTop - oldTop) / oldHeight;
+
+					let nowWidth = this.style.width.split("p")[0];
+					let initWidth = _this.width.split("p")[0];
+					let initHeight = _this.height.split("p")[0];
+
+					let miniFlag = true;
+					let magniFlag = true;
+					if (_this.minification) {
+						// 限制缩小范围
+						if (nowWidth <= parseInt(initWidth / _this.minification)) {
+							miniFlag = false;
+							console.log("限制缩小范围");
+							console.log(
+								"限制缩小范围",
+								nowWidth,
+								parseInt(initWidth / _this.minification)
+							);
+							this.style.width = parseInt(initWidth / _this.minification) + "px";
+							this.style.height =
+								parseInt(initHeight / _this.minification) + "px";
+						}
+						if (_this.magnification) {
+							// 限制放大范围
+							if (nowWidth >= parseInt(initWidth * _this.magnification)) {
+								magniFlag = false;
+								console.log("限制放大范围");
+								this.style.width =
+									parseInt(initWidth * _this.magnification) + "px";
+								this.style.height =
+									parseInt(initHeight * _this.magnification) + "px";
+							}
+						}
+					}
+
+					if (down && miniFlag) {
+						console.log("缩小");
+						this.style.width = parseInt(this.offsetWidth * 0.9) + "px";
+						this.style.height = parseInt(this.offsetHeight * 0.9) + "px";
+						
+						that.width = parseInt(this.offsetWidth * 0.9) + "px";
+						that.height = parseInt(this.offsetHeight * 0.9) + "px";
+					} else if (!down && magniFlag) {
+						console.log("放大");
+						this.style.width = parseInt(this.offsetWidth * 1.1) + "px";
+						this.style.height = parseInt(this.offsetHeight * 1.1) + "px";
+						that.width = parseInt(this.offsetWidth * 1.1) + "px";
+						that.height = parseInt(this.offsetHeight * 1.1) + "px";
+					}
+					var newWidth = this.offsetWidth;
+					var newHeight = this.offsetHeight;
+
+					// 新的相对位置left = 原先的相对位置left - 比例 *(本身新的宽度-旧的宽度)
+					this.style.left =
+						Math.round(this.offsetLeft - scaleX * (newWidth - oldWidth)) + "px";
+					this.style.top =
+						Math.round(this.offsetTop - scaleY * (newHeight - oldHeight)) + "px";
+				});
+				// console.log(that.width)
+			},
+			// },
+			//拖拽
+			drag(ev) {
+				// var ie = document.all;
+				// console.log(ev / 0);
+
+				var nn6 = document.getElementById && !document.all;
+				var isdrag = false;
+				var y, x;
+				var nTY, nTX;
+				var oDragObj;
+
+				function moveMouse(e) {
+					if (isdrag) {
+						oDragObj.style.top =
+							(nn6 ? nTY + e.clientY - y : nTY + event.clientY - y) + "px";
+						oDragObj.style.left =
+							(nn6 ? nTX + e.clientX - x : nTX + event.clientX - x) + "px";
+						return false;
+					}
+				}
+
+				function initDrag(e) {
+					// console.log("点击图片initDrag");
+					var oDragHandle = nn6 ? e.target : event.srcElement;
+					var topElement = "HTML";
+					while (
+						oDragHandle.tagName != topElement &&
+						oDragHandle.className != "movableItem"
+					) {
+						oDragHandle = nn6 ?
+							oDragHandle.parentNode :
+							oDragHandle.parentElement;
+					}
+					if (oDragHandle.className == "movableItem") {
+						isdrag = true;
+						oDragObj = oDragHandle;
+						// 父元素宽高
+						let width = e.path[2].offsetWidth;
+						let height = e.path[2].offsetHeight;
+						// 这里判断第一次获取不到style 样式 默认为 居中50%
+						if (oDragObj.style.top == "") {
+							// nTY = parseInt((50 * height) / 100 + 0);
+							nTY = 0;
+							nTX = parseInt((50 * width) / 100 + 0);
+						} else {
+							nTY = parseInt(oDragObj.style.top + 0);
+							nTX = parseInt(oDragObj.style.left + 0);
+						}
+						y = nn6 ? e.clientY : event.clientY;
+						x = nn6 ? e.clientX : event.clientX;
+						oDragObj.style.cursor = "move";
+						document.onmousemove = moveMouse;
+						return false;
+					}
+				}
+				document.onmousemove = initDrag;
+				// document.onmouseup = new Function("isdrag=false");
+				document.onmouseup = function(e) {
+					isdrag = false;
+					document.onmousemove = null;
+					document.onmouseup = null;
+					var oDragHandle = nn6 ? e.target : event.srcElement;
+					var topElement = "HTML";
+					while (
+						oDragHandle.tagName != topElement &&
+						oDragHandle.className != "movableItem"
+					) {
+						oDragHandle = nn6 ?
+							oDragHandle.parentNode :
+							oDragHandle.parentElement;
+					}
+					if (oDragHandle.className == "movableItem") {
+						oDragObj = oDragHandle;
+						oDragObj.style.cursor = "Default";
+					}
+				};
+				ev = event || window.event;
+
+				// 取消事件冒泡行为
+				// window.event ? (window.event.cancelBubble = true) : ev.stopPropagation();
+			},
+			// 拖拽标记
+			// eslint-disable-next-line no-unused-vars
+			dragSign(ev, key) {
+				var nn6 = document.getElementById && !document.all;
+				var isdrag = false;
+				var y, x;
+				var nTY, nTX;
+				var oDragObj;
+				let _this = this;
+
+				function moveMouse(e) {
+
+					if (isdrag) {
+						this.equipmentKey = key;
+						// console.log("thisequipmentKey", this.equipmentKey);
+
+						let widthItem = e.path[1].style.width.split("p");
+						let heightItem = e.path[1].style.height.split("p");
+						let width = widthItem[0];
+						// eslint-disable-next-line no-unused-vars
+						let height = heightItem[0];
+						let top =
+							((nn6 ?
+									(nTY / 100) * height + e.clientY - y :
+									(nTY / 100) * height + event.clientY - y) /
+								height) *
+							100;
+						let left =
+							((nn6 ?
+									(nTX / 100) * width + e.clientX - x :
+									(nTX / 100) * width + event.clientX - x) /
+								width) *
+							100;
+
+						if (top >= 0 && top <= 100) {
+							_this.equipment[key].top = top;
+						}
+						if (left >= 0 && left <= 100) {
+							_this.equipment[key].left = left;
+						}
+
+						return false;
+					}
+				}
+				// eslint-disable-next-line no-unused-vars
+				function initDrag(e) {
+					// console.log("_this", _this);
+					var oDragHandle = nn6 ? e.target : event.srcElement;
+					var topElement = "HTML";
+					while (
+						oDragHandle.tagName != topElement &&
+						oDragHandle.className.indexOf("equipment") == -1
+					) {
+						oDragHandle = nn6 ?
+							oDragHandle.parentNode :
+							oDragHandle.parentElement;
+					}
+					if (oDragHandle.className.indexOf("equipment") != -1) {
+						isdrag = true;
+						oDragObj = oDragHandle;
+						// 父元素宽高
+						let width = e.path[1].offsetWidth;
+						let height = e.path[1].offsetHeight;
+						// console.log(width, height);
+						console.log("oDragObj.style", oDragObj.style);
+						// 这里判断第一次获取不到style 样式 默认为 居中50%
+						if (oDragObj.style.top == "") {
+							nTY = parseInt((50 * height) / 100 + 0);
+							nTX = parseInt((50 * width) / 100 + 0);
+						} else if (oDragObj.style.top.indexOf("%") != -1) {
+							nTY = oDragObj.style.top.split("%")[0];
+							nTX = oDragObj.style.left.split("%")[0];
+						} else {
+							nTY = parseInt(oDragObj.style.top + 0);
+							nTX = parseInt(oDragObj.style.left + 0);
+						}
+						y = nn6 ? e.clientY : event.clientY;
+						x = nn6 ? e.clientX : event.clientX;
+
+						oDragObj.style.cursor = "move";
+						document.onmousemove = moveMouse;
+						return false;
+					}
+				}
+
+				// document.onmousedown = initDrag;
+				document.onmousemove = initDrag;
+
+				document.onmouseup = function(e) {
+					isdrag = false;
+					document.onmousemove = null;
+					document.onmouseup = null;
+					var oDragHandle = nn6 ? e.target : event.srcElement;
+					var topElement = "HTML";
+					while (
+						oDragHandle.tagName != topElement &&
+						oDragHandle.className != "equipment"
+					) {
+						oDragHandle = nn6 ?
+							oDragHandle.parentNode :
+							oDragHandle.parentElement;
+					}
+					if (oDragHandle.className == "equipment") {
+						oDragObj = oDragHandle;
+						oDragObj.style.cursor = "Default";
+					}
+				};
+
+				// _this.equipmentKey = key;
+				// _this.equipment[_this.equipmentKey].left = l;
+				// _this.equipment[_this.equipmentKey].top = t;
+				ev = event || window.event;
+
+				// 取消事件冒泡行为
+				window.event ? (window.event.cancelBubble = true) : ev.stopPropagation();
+			},
+		},
+		
+		watch: {
+			equipment() {
+				if (this.equipment.length != 0) {
+					this.arrIcon = [];
+					let finish = true;
+					this.equipment.filter((item) => {
+						if (!item.iconImgUrl) {
+							finish = false;
+						}
+						return true;
+					});
+					console.log("finish", finish);
+					if (finish) {
+						this.equipment.filter((item, index) => {
+							if (index >= this.imgIndex) {
+								console.log("iconImgUrl", this.equipment[index].iconImgUrl);
+								this.getImgInfo(
+									this.$baseUrl + item.iconImgUrl,
+									this.iconMaxWidth,
+									this.iconMaxHeight,
+									"iconWidth",
+									"iconHeight",
+									true,
+									"arrIcon"
+								);
+							}
+							// console.log("22filter", index);
+							return true;
+						});
+					}
+				}
+			},
+		},
+		created() {
+			this.getImgInfo(
+				this.imgUrl,
+				this.bigMaxWidth,
+				this.bigMaxHeight,
+				"width",
+				"height"
+			);
+			if (this.equipment.length != 0) {
+				this.arrIcon = [];
+				let finish = true;
+				this.equipment.filter((item) => {
+					if (!item.iconImgUrl) {
+						finish = false;
+					}
+					return true;
+				});
+				// console.log("finish", finish);
+				if (finish) {
+					this.equipment.filter((item, index) => {
+						if (index >= this.imgIndex) {
+							console.log("iconImgUrl", this.equipment[index].iconImgUrl);
+							this.getImgInfo(
+								this.$baseUrl + item.iconImgUrl,
+								this.iconMaxWidth,
+								this.iconMaxHeight,
+								"iconWidth",
+								"iconHeight",
+								true,
+								"arrIcon"
+							);
+						}
+						// console.log("22filter", index);
+						return true;
+					});
+				}
+			}
+
+			this.iconImgUrl = JSON.parse(
+				JSON.stringify(this.$baseUrl + this.equipment[0].iconImgUrl)
+			);
+			// console.log("imgUrl", this.imgUrl);
+			// console.log("equipment", this.equipment);
+			// //禁止鼠标右键
+			// document.oncontextmenu = function() {
+			//   return false;
+			// };
+		},
+	};
+</script>
+<style lang="less">
+	.preview-popover {
+		background-color: #d3edf7dd;
+		padding: 12px;
+
+		.popper__arrow::after {
+			border-bottom-color: #d3edf7dd !important;
+		}
+
+		.describe {
+			p {
+				padding-bottom: 5px;
+
+				&:last-child {
+					padding-bottom: 0px;
+				}
+			}
+
+			.describe-top {
+				// color: sandybrown;
+				// color: red;
+				color: rgb(21, 110, 110);
+			}
+
+			.describe-center {
+				color: rgb(79, 21, 206);
+			}
+
+			.describe-bottom {
+				color: rgb(30, 31, 29);
+			}
+		}
+	}
+</style>
+<style lang="less" scoped>
+	.pop-up-main {
+		width: 100%;
+		height: calc(100vh - 12vh);
+		overflow-y:hidden ;
+
+		.paln-box {
+			width: 100%;
+			height: 100%;
+			position: relative;
+
+			.movableItem {
+				position: absolute;
+				// top: 75%;
+				left: 50%;
+				transform: translate(-50%, -10%);
+
+				img,
+				.svg {
+					z-index: 1;
+					width: 100%;
+					height: 100%;
+				}
+
+				.equipment {
+					position: absolute;
+					top: 0;
+					left: 0;
+					transform: translate(-50%, -50%);
+					z-index: 2;
+					font-size: 40px;
+					// color: red;
+					// background: blue;
+					zoom: 1;
+				}
+			}
+
+			.shuaxin {
+				position: absolute;
+				z-index: 2;
+				font-size: 40px;
+				top: 20px;
+				left: 20px;
+				cursor: pointer;
+
+				&:hover {
+					color: yellowgreen;
+				}
+			}
+
+			.equipment {
+				color: white;
+			}
+
+			&/deep/.el-button {
+				z-index: 2;
+				position: absolute;
+				bottom: 60px;
+				right: 20px;
+				width: 60px;
+				height: 35px;
+
+				span {
+					display: inline-block;
+					position: absolute;
+					top: 50%;
+					left: 50%;
+					transform: translate(-50%, -50%);
+				}
+
+				i {
+					display: inline-block;
+					position: absolute;
+					top: 50%;
+					left: 25%;
+					transform: translate(-50%, -50%);
+				}
+			}
+		}
+	}
+
+	// body {
+	// 		height: 100%;
+	// 		overflow: hidden;
+	// 		margin: 0;
+	// 		padding: 0;
+	// 	}
+</style>

+ 131 - 103
src/views/WindSite/pages/BoosterStation.vue

@@ -1,123 +1,151 @@
 <template>
-    <div class="booster-station">
-        <div class="btn-group-tabs">
-            <BtnGroup2
-                :btnGroups="btnGroups"
-                :rowIndex="0"
-                :index="1"
-                @select="select"
-            ></BtnGroup2>
-        </div>
-        <bsx6 class="booster-station-body"></bsx6>
+  <div class="booster-station">
+    <div class="btn-group-tabs">
+      <BtnGroup2
+        :btnGroups="btnGroups"
+        :rowIndex="rowIndex"
+        :index="selectIndex"
+        @select="select"
+      ></BtnGroup2>
     </div>
+    <!-- <bsx6 class="booster-station-body"></bsx6> -->
+    <BoosterMCH class="booster-station-body"></BoosterMCH>
+  </div>
 </template>
 
 <script>
 import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
-import bsx6 from "../components/bsx6.vue";
+// import bsx6 from "../components/bsx6.vue";
+import BoosterMCH from "../components/boosterstation/mch/mch.vue";
+
 export default {
-    // 名称
-    name: "BoosterStation",
-    // 使用组件
-    components: {
-        bsx6,
-        BtnGroup2,
-    },
-    // 数据
-    data() {
-        return {
-            btnGroups: [
-                {
-                    icon: "svg-wind-site",
-                    btns: [
-                        {
-                            text: "牛首山风场",
-                            code: "mmfdc1",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mhsfc",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmfdc2",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmfdc3",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmfdc4",
-                        },
-                    ],
-                },
-                {
-                    icon: "svg-photovoltaic",
-                    btns: [
-                        {
-                            text: "牛首山风场",
-                            code: "mmgf1",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmgf2",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmgf3",
-                        },
-                        {
-                            text: "牛首山风场",
-                            code: "mmgf4",
-                        },
-                    ],
-                },
-            ],
-        };
-    },
-    // 函数
-    methods: {
-        select: function (item) {
-            console.log(item)
-        }
-    },
-    // 生命周期钩子
-    beforeCreate() {
-        // 创建前
-    },
-    created() {
-        // 创建后
+  // 名称
+  name: "BoosterStation",
+  // 使用组件
+  components: {
+    // bsx6,
+    BtnGroup2,
+    BoosterMCH,
+  },
+  // 数据
+  data() {
+    return {
+      selectIndex: 0,
+      rowIndex: 0,
+      btnGroups: [
+        {
+          icon: "svg-wind-site",
+          btns: [],
+        },
+        {
+          icon: "svg-photovoltaic",
+          btns: [],
+        },
+      ],
+    };
+  },
+  created() {
+    let that = this;
+    that.wpId = that.$route.params.wpId;
+    that.$nextTick(() => {
+      that.getWp();
+    });
+  },
+  // 函数
+  methods: {
+    select(res) {
+      this.$router.replace({
+        path: `/monitor/windsite/boosterstation/${res.code}`,
+      });
     },
-    beforeMount() {
-        // 渲染前
-    },
-    mounted() {
-        // 渲染后
+    getWp() {
+      let that = this;
+      that.API.requestData({
+        method: "GET",
+        subUrl: "powercompare/windfarmAllAjax",
+        success(res) {
+          let btnGroup = [
+            {
+              icon: "svg-wind-site",
+              btns: [],
+            },
+            {
+              icon: "svg-photovoltaic",
+              btns: [],
+            },
+          ];
+
+          res.data.forEach((ele, index) => {
+            if (ele.id.indexOf("FDC") !== -1) {
+              btnGroup[0].btns.push({
+                text: ele.name,
+                code: ele.id,
+              });
+            } else {
+              btnGroup[1].btns.push({
+                text: ele.name,
+                code: ele.id,
+              });
+            }
+          });
+
+          that.btnGroups = btnGroup;
+          that.renderBtnActiveIndex();
+        },
+      });
     },
-    beforeUpdate() {
-        // 数据更新前
+    renderBtnActiveIndex() {
+      this.btnGroups.forEach((pEle, pIndex) => {
+        pEle.btns.forEach((cEle, cIndex) => {
+          if (cEle.code === this.wpId) {
+            this.rowIndex = pIndex;
+            this.selectIndex = cIndex;
+          }
+        });
+      });
     },
-    updated() {
-        // 数据更新后
+  },
+  // 生命周期钩子
+  beforeCreate() {
+    // 创建前
+  },
+  beforeMount() {
+    // 渲染前
+  },
+  mounted() {
+    // 渲染后
+  },
+  beforeUpdate() {
+    // 数据更新前
+  },
+  updated() {
+    // 数据更新后
+  },
+  watch: {
+    $route(res) {
+      this.wpId = res.params.wpId;
+      if (res.params.wpId) {
+        this.renderBtnActiveIndex();
+      }
     },
+  },
 };
 </script>
 
 <style lang="less" scoped>
 .booster-station {
-    width: 100%;
-    height: calc(100vh - 90px);
-    display: flex;
-    flex-direction: column;
+  width: 100%;
+  height: calc(100vh - 90px);
+  display: flex;
+  flex-direction: column;
 
-    .btn-group-tabs {
-        display: flex;
-        flex-direction: row;
-    }
+  .btn-group-tabs {
+    display: flex;
+    flex-direction: row;
+  }
 
-    .booster-station-body {
-        flex-grow: 1;
-    }
+  .booster-station-body {
+    flex-grow: 1;
+  }
 }
 </style>