Browse Source

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

Koishi 3 years ago
parent
commit
2d1a83be18

+ 12 - 0
src/router/index.js

@@ -401,6 +401,12 @@ const routes = [{
 		import( /* webpackChunkName: "malfunctionStatistics" */ "../views/malfunctionRecall/index.vue"),
 },
 {
+	path: "/health/gzzd/gzfl", // 故障分类
+	name: "gzfl",
+	component: () =>
+		import( /* webpackChunkName: "malfunctionStatistics" */ "../views/malfunctionDiagnose/gzfl.vue"),
+},
+{
 	path: "/health/frist",
 	name: "health",
 	component: () =>
@@ -774,6 +780,12 @@ const routes = [{
 	component: () =>
 		import( /* webpackChunkName: "czjl" */ "../views/warn/czjl.vue"),
 },
+{//光伏告警
+	path: "/others/alarmCenter/gfgj",
+	name: "gfgj",
+	component: () =>
+		import( /* webpackChunkName: "gfgj" */ "../views/warn/gfgj.vue"),
+},
 {
 	path: "/others/alarmCenter/boosterAlarm",
 	name: "boosterAlarm",

File diff suppressed because it is too large
+ 32 - 21
src/views/HealthControl/gradeHistory.vue


+ 1 - 0
src/views/NewPages/alarm-center-1.vue

@@ -297,6 +297,7 @@ export default {
   methods: {
     //对比
     showChart(column) {
+		console.log(column.column.name)
       let that = this;
       that.dialogTitle = column.column.name;
       that.wtId = column.row.name;

+ 2 - 2
src/views/NewPages/multiple-y-line-chart-normal.vue

@@ -452,14 +452,14 @@ export default {
       this.initChart();
     });
   },
-  updated() {
+  beforeUpdate() {
     this.$nextTick(() => {
       this.initChart();
     });
   },
   unmounted() {
     window.removeEventListener("resize", this.resize);
-  },
+  }
 };
 </script>
 

+ 1 - 0
src/views/Others/index.vue

@@ -183,6 +183,7 @@ export default {
           url: "/others/alarmCenter/alarmcenter",
         },
         { name: "操作记录", key: "cz", url: "/others/alarmCenter/czjl" },
+		{ name: "光伏告警", key: "gfgj", url: "/others/alarmCenter/gfgj" },
       ],
       tableData1: {
         column: [

+ 11 - 8
src/views/WindSite/pages/BoosterStation.vue

@@ -135,16 +135,19 @@ export default {
                 code: ele.id,
               });
             } else {
-              btnGroup[1].btns.push({
-                text: ele.name,
-                code: ele.id,
-              });
+				btnGroup[1].btns.push({
+				  text: ele.name,
+				  code: ele.id,
+				});
+				if(ele.id == 'PL_GDC'){
+					btnGroup[1].btns.push({
+					  text: '平罗二期光伏电站',
+					  code: 'PL2_GDC',
+					});
+				}
             }
           });
-			btnGroup[1].btns.push({
-			  text: '平罗二期光伏电站',
-			  code: 'PL2_GDC',
-			});
+			
 			
 			// 当点击为宋六时
 			btnGroup[0].btns.push({

+ 75 - 15
src/views/WindSite/pages/Home/Home.vue

@@ -365,10 +365,18 @@
         </panel>
         </Col>
         <Col :span="8">
-        <panel title="日发电量对比">
+        <panel title="日发电量对比" subTitle="详情" @click='rfdl'>
           <multiple-bar-chart height="21.296vh" :list="CompleteElectricity.data" :units="CompleteElectricity.units"
             :showLegend="true" />
         </panel>
+		<el-dialog title="日发电量对比" v-model="rfdlDialog" width="70%" top="15vh" custom-class="modal" :close-on-click-modal="false">
+			<el-row type="flex">
+				<ComTable :data="tableData" height="15vh"></ComTable>
+			</el-row>
+			<el-row type="flex">
+				<multiple-bar-chart height="45vh" :list="CompleteElectricity.data" :units="CompleteElectricity.units" :showLegend="true" />
+			</el-row>
+		</el-dialog>
         </Col>
         <Col :span="8">
         <panel title="月发电量对比">
@@ -396,12 +404,13 @@ import LightMatrix from "./light-matrix.vue";
 import Station from "./Station.vue";
 import WindSiteWeather from "./wind-site-weather.vue";
 import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
+import ComTable from "@com/coms/table/table.vue";
 
 export default {
   // 名称
   name: "WindSiteHome",
   // 使用组件
-  components: { BtnGroup2, WindSiteWeather, Row, Col, Panel, DualPieChart, MultipleLineChart, Panel3, SvgIcon, HoverBarChart, MultipleBarChart, NormalLineChart, LightMatrix, BtnGroupDouble, Station },
+  components: { BtnGroup2, WindSiteWeather, Row, Col, Panel, DualPieChart, MultipleLineChart, Panel3, SvgIcon, HoverBarChart, MultipleBarChart, NormalLineChart, LightMatrix, BtnGroupDouble, Station ,ComTable},
   // 数据
   data () {
     return {
@@ -505,6 +514,11 @@ export default {
           btns: [],
         },
       ],
+	  rfdlDialog:false,
+	  tableData: {
+	  	column: [],
+	  	data: [],
+	  },
     };
   },
   // 函数
@@ -838,9 +852,16 @@ export default {
           wpId: that.wpId,
         },
         success (res) {
+			let column = [{
+				name: '',
+				field: 'tit',
+				is_num: false,
+				is_light: false,
+			 }],
+			tableData = [];
           let data = [
             {
-              title: "发电量",
+              title: "发电量",
               yAxisIndex: 0,
               value: [],
             },
@@ -849,20 +870,56 @@ export default {
               yAxisIndex: 0,
               value: [],
             },
+			{
+			  title: "风速",
+			  yAxisIndex: 0,
+			  value: [],
+			},
+			{
+			  title: "上网电量",
+			  yAxisIndex: 0,
+			  value: [],
+			},
           ];
-
-          res.data.forEach((ele) => {
-            data[0].value.push({
-              text: ele.timestr,
-              value: ele.value1 || 0,
-            });
-            data[1].value.push({
-              text: ele.timestr,
-              value: ele.value2 || 0,
-            });
+	
+          res.data.forEach((ele,idx) => {
+			  data[0].value.push({
+				text: ele.timestr,
+				value: ele.value1 || 0,
+			  });
+			 data[1].value.push({
+				text: ele.timestr,
+				value: ele.value2 || 0,
+			 });
+			 data[2].value.push({
+				text: ele.timestr,
+				value: ele.value3 || 0,
+			 });
+			 data[3].value.push({
+				text: ele.timestr,
+				value: ele.value4 || 0,
+			 });
+			 
+			 column.push({
+				name: ele.timestr,
+				field: idx,
+				is_num: false,
+				is_light: false,
+			 });
           });
-
-          that.CompleteElectricity.data = data;
+			that.CompleteElectricity.data = data;
+			data.forEach((ele,idx)=>{
+				let obj = [];
+				ele.value.forEach((ele2,idx2)=>{
+				  obj[idx2] = ele2.value;
+				})
+				obj['tit'] = ele.title;
+				tableData.push(obj)
+			})
+		  that.tableData = {
+			  column:column,
+			  data:tableData
+		  }
         },
       });
     },
@@ -906,6 +963,9 @@ export default {
         },
       });
     },
+	rfdl(){
+		this.rfdlDialog = true;
+	}
   },
 
   created () {

+ 1 - 1
src/views/layout/Menu.vue

@@ -980,7 +980,7 @@ export default {
                   path: "/others/warning",
                 },
                 {
-                  text: "智能营销样本库",
+                  text: "风电营销样本库",
                   icon: "svg-matrix",
                   path: "/others/market",
                 }

+ 8 - 0
src/views/malfunctionDiagnose/gzfl.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 21 - 6
src/views/malfunctionDiagnose/index.vue

@@ -82,6 +82,8 @@
       </div>
       <div class="query-actions">
         <button class="btn green" @click="search()">查询</button>
+		<button class="btn green" @click="">导入</button>
+		<button class="btn green" @click="export">导出</button>
       </div>
     </div>
     <div class="df-table">
@@ -191,7 +193,7 @@ export default {
           },
           {
             name: "操作",
-            field: "",
+            field: "cz",
             is_num: false,
             is_light: false,
             template() {
@@ -266,7 +268,6 @@ export default {
         });
       }
     },
-
     // 获取故障诊断树
     getTree(item) {
       let that = this;
@@ -289,15 +290,29 @@ export default {
     search() {
       this.getTableData();
     },
+	formatJson(filterVal, jsonData) {
+		return jsonData.map(v => filterVal.map(j => v[j]));
+	},
+	export() {
+		let that = this;
+		const {export_json_to_excel} = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
+		let tHeader = []; // 上面设置Excel的表格第一行的标题       
+		let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
+	
+		that.tableData.column.forEach(ele => {
+			if(ele.field != 'cz'){
+				tHeader.push(ele.name);
+				filterVal.push(ele.field);
+			}
+		});
+		const data = that.formatJson(filterVal, that.tableData.data);
+		export_json_to_excel(tHeader, data, '故障诊断'); // 最后一个是表名字
+	},
   },
 
   created() {
     this.requestData();
   },
-
-  mounted() {},
-
-  unmounted() {},
 };
 </script>
 

+ 623 - 0
src/views/sampleDatabase/fault/index - 副本.vue

@@ -0,0 +1,623 @@
+<template>
+	<el-scrollbar height="92vh" v-if="gzCgd == 1">
+		<div class="query mg-b-8">
+			<div class="query-items">
+				<div class="query-item">
+					<div class="lable">场站:</div>
+					<div class="search-input">
+						<el-select v-model="station" placeholder="请选择" popper-class="select">
+							<el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">样本类型:</div>
+					<div class="search-input">
+						<el-select v-model="tableTag" placeholder="请选择样本" popper-class="select">
+							<el-option v-for="item in tableTagArr" :key="item.value" :value="item.value" :label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">故障分类:</div>
+					<div class="search-input">
+						<el-select v-model="widget" multiple collapse-tags clearable placeholder="请选择"
+							popper-class="select">
+							<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">风机型号:</div>
+					<div class="search-input">
+						<el-select v-model="model" multiple collapse-tags clearable placeholder="请选择"
+							popper-class="select">
+							<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">时间:</div>
+					<div class="search-input">
+						<el-date-picker v-model="time" type="datetimerange" range-separator="至" start-placeholder="开始日期"
+							end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
+				</div>
+				<div class="query-actions">
+					<button class="btn" @click="query()">查询</button>
+					<button class="btn" @click="addEdit()">新增</button>
+				</div>
+			</div>
+		</div>
+		<el-row :type="'flex'" class="content">
+			<el-col :span="24">
+				<ComTable :data="tableData" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
+					v-loading="tableLoading" element-loading-text="拼命加载中"
+					element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
+			</el-col>
+		</el-row>
+		<el-dialog :title="isvisiableType == 1 ? '新增' : '编辑'" v-model="isvisiable" width="45%" top="15vh"
+			custom-class="modal" :close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
+			<!-- 这里是新增或编辑 -->
+			<el-row type="flex" class="mb10">
+				<el-col :span="12">
+					<div>样本类型:</div>
+					<el-select v-model="tableTag" placeholder="请选择样本" popper-class="select" class="w">
+						<el-option v-for="item in tableTagArr" :key="item.value" :value="item.value"
+							:label="item.label">
+						</el-option>
+					</el-select>
+				</el-col>
+				<el-col :span="12">
+					<div>风机型号:</div>
+					<el-select v-model="tableModel" placeholder="请选择风机型号" popper-class="select" class="w">
+						<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
+						</el-option>
+					</el-select>
+				</el-col>
+			</el-row>
+			<el-row type="flex" class="mb10">
+				<el-col :span="12">
+					<div>故障分类:</div>
+					<el-select v-model="tableFaulttype" placeholder="请选择故障" popper-class="select" class="w">
+						<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
+						</el-option>
+					</el-select>
+				</el-col>
+				<el-col :span="12">
+					<div>时间:</div>
+					<el-date-picker v-model="tableTime" type="datetimerange" range-separator="至"
+						start-placeholder="开始日期" end-placeholder="结束日期" class="w">
+					</el-date-picker>
+				</el-col>
+			</el-row>
+			<el-row type="flex" class="mb10">
+				<el-col :span="12">
+					<div>故障原因:</div>
+					<el-input placeholder="请输入故障原因" v-model="tableSymptom" :value="tableSymptom">
+					</el-input>
+				</el-col>
+				<el-col :span="12">
+					<div>风机厂商:</div>
+					<el-input placeholder="请输入风机厂商" v-model="tableManufacturer" :value="tableManufacturer">
+					</el-input>
+				</el-col>
+			</el-row>
+			<el-row type="flex" class="mb10">
+				<el-col :span="12">
+					<div>风机编号:</div>
+					<el-input placeholder="请输入风机编号" v-model="tableWindturbineid" :value="tableWindturbineid">
+					</el-input>
+				</el-col>
+			</el-row>
+			<el-row type="flex" justify="end">
+				<div class="query-actions" style="margin-top: 15px">
+					<button class="btn" @click="onClickDialogClose">取消</button>
+					<button class="btn" @click="dialogSave">保存</button>
+				</div>
+			</el-row>
+		</el-dialog>
+	</el-scrollbar>
+	<el-scrollbar height="92vh" v-if="gzCgd == 2">
+		<Point :data="gzCgdData" :st='st' @gzCgdClick="gzCgdClick" />
+	</el-scrollbar>
+</template>
+
+<script>
+	import ComTable from "@/components/coms/table/table.vue";
+	import Point from "./point.vue";
+	export default {
+		components: {
+			ComTable,
+			Point,
+		},
+		data() {
+			const that = this;
+			return {
+				tableTagArr: [{
+						label: '正样本',
+						value: 0
+					},
+					{
+						label: '负样本',
+						value: 1
+					}
+				],
+				queryType: false, //没有改变select时,点击查询无效
+				pageIndex: 1,
+				pageSize: 20,
+				gzCgd: 1, //传感点组件隐藏或显示
+				gzCgdData: [], //传感点参数
+				st:'',
+				BuJian: [],
+				ChangZhan: [],
+				fjxh: [],
+				fjxhArr: [],
+				widget: [],
+				model: [],
+				time: [],
+				station: '',
+				tableFaulttype: "",
+				tableTag: "",
+				tableModel: "",
+				tableTime: "",
+				tableSymptom: "",
+				tableManufacturer: "",
+				tableWindturbineid: "",
+				tableCategory: "", //隐藏保存部分
+				tableRemark: "",
+				tableFaultcode: "",
+				tableId: "",
+				tableSymptomcode: "",
+				tableStationen: "",
+				isvisiable: false,
+				isvisiableType: 1, //新增为1,编辑为2
+				tableData: {
+					column: [{
+							name: "序号",
+							field: "index",
+							is_light: false,
+							width: '50px',
+						},
+						{
+							name: "样本类型",
+							field: "tableTag",
+							is_light: false,
+							width: '100px',
+						},
+						{
+							name: "风机编号",
+							field: "tableWindturbineid",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "故障分类",
+							field: "tableFaulttype",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "故障原因",
+							field: "tableSymptom",
+							is_light: false,
+							width: '350px',
+						},
+						{
+							name: "时间",
+							field: "tableTime",
+							is_light: false,
+							width: '350px',
+						},
+						{
+							name: "风机厂商",
+							field: "tableManufacturer",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "风机型号",
+							field: "tableModel",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "操作",
+							is_light: false,
+							width: '200px',
+							template: () => {
+								return (
+									"<el-button type='text' style='cursor: pointer;' value='edit'>编辑</el-button>&nbsp" +
+									"<el-button type='text' style='cursor: pointer;' value='delete'>删除</el-button>&nbsp" +
+									"<el-button type='text' style='cursor: pointer;' value='config'>传感点</el-button>&nbsp"
+								);
+							},
+							click(e, row) {
+								that.onClickOption(e, row);
+							},
+						},
+					],
+					data: [],
+				}
+			};
+		},
+		methods: {
+			getTable() {
+				let that = this;
+				this.tableLoading = true;
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.10.4:9002/",
+					subUrl: "benchmarking/wplist",
+					data: {
+						wpId: that.stationId,
+						startTs: that.startDate,
+						endTs: that.endDate,
+						pageNum: that.pageIndex,
+						pageSize: that.pageSize,
+					},
+					success(res) {
+						var dataTab = [];
+						if (res.data) {
+							res.data.list.forEach(item => {
+								dataTab.push({ //表格
+									recodedata: that.formatTime(item.recodedata),
+									region: item.region,
+								})
+							})
+							that.tableData.data = dataTab;
+							that.tableData.total = res.data.total;
+						} else {
+							that.tableData.data = [];
+							that.tableData.total = 0;
+						}
+						that.tableLoading = false;
+					},
+				});
+			},
+			onChangePage(params) {
+				this.pageIndex = params.pageIndex;
+				this.pageSize = params.pageSize;
+				this.getTable();
+			},
+			startAjax() {
+				var that = this;
+				// that.time = [new Date((new Date() - 3600 * 1000 * 24 * 30)).formatDate("yyyy-MM-dd"), new Date().formatDate("yyyy-MM-dd")];
+				that.time = [new Date((new Date() - 3600 * 1000 * 24 * 360)).formatDate("yyyy-MM-dd"), new Date()
+					.formatDate("yyyy-MM-dd")
+				];
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.4:9001/",
+					subUrl: "benchmarking/wplist",
+					success(res) {
+						that.ChangZhan = res.data;
+						// that.station = res.data[0].name
+						that.station = res.data[1].name
+					},
+				});
+
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "basic/widget/condition",
+					success(res) {
+						let keys = Object.keys(res.data[0]);
+						let bujian = [],
+							widget = [];
+						keys.forEach((ele, index) => {
+							bujian.push({
+								label: res.data[0].ele,
+								value: ele
+							})
+							widget.push(ele)
+						})
+
+						that.widget = widget;
+						that.BuJian = bujian;
+					},
+				});
+
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "basic/station/all",
+					success(res) {
+						let fjxhArr = [];
+						let model = [],
+							fjxh = [];
+						res.data.forEach(ele => {
+							fjxhArr.push({
+								id: ele.id,
+								value: ele.model.split("/")
+							})
+							if (ele.id == "MHS_FDC") {
+								model = ele.model.split("/");
+								model.forEach(ele => {
+									fjxh.push({
+										label: ele,
+										value: ele
+									})
+								})
+							}
+						})
+						that.fjxhArr = fjxhArr;
+						that.model = model;
+						that.fjxh = fjxh;
+					},
+				});
+			},
+			query() {
+				if (this.queryType) {
+					this.list();
+				}
+			},
+			addEdit() {
+				this.isvisiableType = 1;
+				this.tableFaulttype = '';
+				this.tableModel = '';
+				this.tableTime = '';
+				this.tableSymptom = '';
+				this.tableManufacturer = '';
+				this.tableWindturbineid = '';
+
+				// this.tableCategory: data[i].category,
+				// this.tableRemark: data[i].remark,
+				// this.tableFaultcode: data[i].faultcode,
+				// this.tableId: data[i].id,
+				// this.tableSymptomcode:data[i].Symptomcode,
+				// this.tableStationen:data[i].stationen
+
+				this.isvisiable = true;
+			},
+			onClickOption(e, row) { // 操作按钮
+				let that = this;
+				if ("delete" == e.target.getAttribute("value")) {
+					that
+						.$confirm("确认删除此条样本数据?", "提示", {
+							confirmButtonText: "删除",
+							cancelButtonText: "取消"
+						})
+						.then((_) => {
+							console.log('ok')
+							// that.requestDelete(row);
+						})
+						.catch((_) => {});
+				}
+				if ("edit" == e.target.getAttribute("value")) {
+					that.isvisiableType = 2;
+					that.$nextTick(() => {
+						let tableTime = row.tableTime.split(" - ");
+						that.tableTag = row.tableTag;
+						that.BuJian.forEach(ele => {
+							if (ele.value == row.tableFaultcode) {
+								that.tableFaulttype = ele.label
+							}
+						})
+						that.tableModel = row.tableModel;
+						that.tableTime = [Date.parse(new Date(tableTime[0])), Date.parse(new Date(tableTime[1]))];
+						that.tableSymptom = row.tableSymptom;
+						that.tableManufacturer = row.tableManufacturer;
+						that.tableWindturbineid = row.tableWindturbineid;
+
+						that.tableCategory = row.tableCategory;
+						that.tableRemark = row.tableRemark;
+						that.tableFaultcode = row.tableFaultcode;
+						that.tableId = row.tableId;
+						that.tableSymptomcode = row.tableSymptomcode;
+						that.tableStationen = row.tableStationen;
+					});
+					that.isvisiable = true;
+				}
+				if ("config" == e.target.getAttribute("value")) { //传感点
+					that.API.requestData({
+						method: "GET",
+						baseURL: "http://192.168.1.18:9002/",
+						subUrl: "point/all",
+						data: {
+							wtId: row.tableWindturbineid,
+							widget: row.tableFaultcode
+						},
+						success(res) {
+							console.log(res)
+							if (res.code == 200) {
+								that.gzCgdData = res.data;
+								that.st = Date.parse(new Date(row.tableTime.split(" - ")[0]));
+								that.gzCgd = 2;
+							}
+						},
+					});
+				}
+			},
+			onClickDialogClose() { // 弹窗右上角关闭按钮
+				this.isvisiable = false;
+				this.isvisiableType = 1;
+			},
+			dialogSave() {
+				let that = this;
+				that.tableTime[0] = that.formatDate(that.tableTime[0].valueOf());
+				that.tableTime[1] = that.formatDate(that.tableTime[1].valueOf());
+				console.log(that.tableTime)
+				that.API.requestData({
+					method: "POST",
+					baseURL: "http://192.168.1.18:9002/",
+					headers: {
+						'Content-Type': 'application/json;charset=utf-8',
+					},
+					subUrl: "case/item/edit",
+					body: {
+						category: that.tableCategory,
+						endtime: that.tableTime[1],
+						faultcode: that.tableFaultcode,
+						faulttype: that.tableFaulttype,
+						id: that.tableId,
+						manufacturer: that.tableManufacturer,
+						model: that.tableModel,
+						remark: that.tableRemark,
+						starttime: that.tableTime[0],
+						stationen: that.tableStationen,
+						symptom: that.tableSymptom,
+						symptomcode: that.tableSymptomcode,
+						tag: that.tableTag == "正样本" ? 0 : 1,
+						windturbineid: that.tableWindturbineid
+					},
+					success(res) {
+						if (res.code == 200) {
+							that.BASE.showMsg({
+								type: "success",
+								msg: "保存成功",
+							});
+							that.onClickDialogClose();
+							that.list();
+						}
+					},
+				});
+			},
+			gzCgdClick(data) {
+				this.gzCgd = data;
+			},
+			formatDate(dates) {
+				var date = new Date(dates);
+				var YY = date.getFullYear() + '-';
+				var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+				var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+				var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+				var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+				var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+				return YY + MM + DD + " " + hh + mm + ss;
+			},
+			list() {
+				var that = this;
+				let station = '',
+					widget = ''
+				if (typeof that.time[0].valueOf() != 'string') {
+					that.time[0] = that.formatDate(that.time[0].valueOf())
+				}
+				if (typeof that.time[1].valueOf() != 'string') {
+					that.time[1] = that.formatDate(that.time[1].valueOf())
+				}
+				if (typeof that.station.valueOf() == 'string') {
+					that.ChangZhan.forEach(ele => {
+						if (ele.name == that.station) {
+							station = ele.id
+						}
+					})
+				}
+				if (typeof that.widget.valueOf() == 'string') {
+					that.BuJian.forEach(ele => {
+						if (ele.label == that.widget) {
+							widget = ele.value
+						}
+					})
+				}
+				if (that.model.length == 0) {
+					that.BASE.showMsg({
+						type: "warning",
+						msg: "请选择风机型号",
+					});
+					return
+				}
+				if (that.widget.length == 0) {
+					that.BASE.showMsg({
+						type: "warning",
+						msg: "请选择部件",
+					});
+					return
+				}
+				that.API.requestData({
+					showLoading: true,
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "case/fault/all",
+					data: {
+						widget: widget ? widget : that.widget,
+						station: station ? station : that.station,
+						model: that.model,
+						st: that.time[0].valueOf(),
+						et: that.time[1].valueOf()
+					},
+					success(res) {
+						if (res.code == 200) {
+							console.log(res)
+							that.tableData.data = [];
+							if (res.data.length) {
+								let data = res.data;
+								for (var i = 0; i < data.length; i++) {
+									let obj = {
+										index: i + 1,
+										tableTag: data[i].tag == 0 ? '正样本' : '负样本',
+										tableFaulttype: data[i].faulttype,
+										tableModel: data[i].model,
+										tableTime: data[i].starttime + ' - ' + data[i].endtime,
+										tableSymptom: data[i].symptom,
+										tableManufacturer: data[i].manufacturer,
+										tableWindturbineid: data[i].windturbineid,
+
+										tableCategory: data[i].category,
+										tableRemark: data[i].remark,
+										tableFaultcode: data[i].faultcode,
+										tableId: data[i].id,
+										tableSymptomcode: data[i].symptomcode,
+										tableStationen: data[i].stationen
+									};
+									that.tableData.data.push(obj);
+								}
+							}
+						}
+					},
+				});
+			},
+		},
+		created() {
+			let that = this;
+			that.startAjax();
+			setTimeout(function() {
+				that.list()
+			}, 500)
+		},
+		watch: {
+			station(res) {
+				let fjxh = [];
+				this.fjxhArr.forEach(ele => {
+					if (ele.id == res) {
+						ele.value.forEach(ele2 => {
+							fjxh.push({
+								label: ele2,
+								value: ele2
+							})
+						})
+						this.model = ele.value;
+					}
+				})
+				this.fjxh = fjxh;
+				this.queryType = true;
+			},
+			widget() {
+				this.queryType = true;
+			},
+			model() {
+				this.queryType = true;
+			},
+			time() {
+				this.queryType = true;
+			},
+		},
+	};
+</script>
+
+<style lang="less" scoped>
+	.mb10 {
+		margin-bottom: 10px;
+	}
+
+	.el-select.w {
+		width: 100%;
+	}
+
+	// .el-range-editor.w{width: 100%;}
+</style>

+ 203 - 328
src/views/sampleDatabase/fault/index.vue

@@ -1,36 +1,45 @@
 <template>
-	<el-scrollbar height="92vh" v-if="gzCgd == 1">
+	<el-scrollbar height="92vh">
 		<div class="query mg-b-8">
 			<div class="query-items">
-				<div class="query-item">
+				<div class="query-item" style="width: 200px;">
 					<div class="lable">场站:</div>
 					<div class="search-input">
 						<el-select v-model="station" placeholder="请选择" popper-class="select">
-							<el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
-							</el-option>
+							<el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name"> </el-option>
 						</el-select>
 					</div>
 				</div>
-				<div class="query-item">
-					<div class="lable">故障类:</div>
+				<div class="query-item" style="width: 230px;">
+					<div class="lable">故障类:</div>
 					<div class="search-input">
-						<el-select v-model="widget" multiple collapse-tags clearable placeholder="请选择"
-							popper-class="select">
-							<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
+						<el-select v-model="widget" multiple collapse-tags clearable placeholder="请选择" popper-class="select">
+							<el-option @click="checkAll" :class="active?'green':''">
+								全选
+							</el-option>
+							<el-option v-for="item in widgetArr" :key="item.value" :value="item.value" :label="item.label">
 							</el-option>
 						</el-select>
 					</div>
 				</div>
-				<div class="query-item">
+				<div class="query-item" style="width: 230px;">
 					<div class="lable">风机型号:</div>
 					<div class="search-input">
-						<el-select v-model="model" multiple collapse-tags clearable placeholder="请选择"
-							popper-class="select">
+						<el-select v-model="model" multiple collapse-tags clearable placeholder="请选择" popper-class="select">
 							<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
 							</el-option>
 						</el-select>
 					</div>
 				</div>
+				<div class="query-item" style="width: 180px;">
+					<div class="lable">模型:</div>
+					<div class="search-input">
+						<el-select v-model="mx" collapse-tags clearable placeholder="请选择" popper-class="select">
+							<el-option key="1" value="list" label="原数据"></el-option>
+							<el-option key="2" value="alg" label="DB-SCAN"></el-option>
+						</el-select>
+					</div>
+				</div>
 				<div class="query-item">
 					<div class="lable">时间:</div>
 					<div class="search-input">
@@ -40,83 +49,24 @@
 					</div>
 				</div>
 				<div class="query-actions">
-					<button class="btn" @click="query()">查询</button>
-					<button class="btn" @click="addEdit()">新增</button>
+					<button class="btn" @click="list">查询</button>
+					<button class="btn" @click="query()">导入</button>
+					<button class="btn" @click="export">导出</button>
 				</div>
 			</div>
 		</div>
 		<el-row :type="'flex'" class="content">
-			<el-col :span="24">
-				<ComTable :data="tableData" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
-					v-loading="tableLoading" element-loading-text="拼命加载中"
-					element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
-			</el-col>
+			<ComTable :data="tableData" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
+				v-loading="tableLoading" element-loading-text="拼命加载中"
+				element-loading-background="rgba(0, 0, 0, 0.8)" v-if="mx=='list'"></ComTable>
+			<ComTable :data="tableData2" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
+				v-loading="tableLoading" element-loading-text="拼命加载中"
+				element-loading-background="rgba(0, 0, 0, 0.8)" v-else></ComTable>	
 		</el-row>
-		<el-dialog :title="isvisiableType == 1 ? '新增' : '编辑'" v-model="isvisiable" width="45%" top="15vh"
-			custom-class="modal" :close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
-			<!-- 这里是新增或编辑 -->
-			<el-row type="flex" class="mb10">
-				<el-col :span="12">
-					<div>样本类型:</div>
-					<el-select v-model="tableTag" placeholder="请选择样本" popper-class="select" class="w">
-						<el-option v-for="item in tableTagArr" :key="item.value" :value="item.value"
-							:label="item.label">
-						</el-option>
-					</el-select>
-				</el-col>
-				<el-col :span="12">
-					<div>风机型号:</div>
-					<el-select v-model="tableModel" placeholder="请选择风机型号" popper-class="select" class="w">
-						<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
-						</el-option>
-					</el-select>
-				</el-col>
-			</el-row>
-			<el-row type="flex" class="mb10">
-				<el-col :span="12">
-					<div>故障分类:</div>
-					<el-select v-model="tableFaulttype" placeholder="请选择故障" popper-class="select" class="w">
-						<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
-						</el-option>
-					</el-select>
-				</el-col>
-				<el-col :span="12">
-					<div>时间:</div>
-					<el-date-picker v-model="tableTime" type="datetimerange" range-separator="至"
-						start-placeholder="开始日期" end-placeholder="结束日期" class="w">
-					</el-date-picker>
-				</el-col>
-			</el-row>
-			<el-row type="flex" class="mb10">
-				<el-col :span="12">
-					<div>故障原因:</div>
-					<el-input placeholder="请输入故障原因" v-model="tableSymptom" :value="tableSymptom">
-					</el-input>
-				</el-col>
-				<el-col :span="12">
-					<div>风机厂商:</div>
-					<el-input placeholder="请输入风机厂商" v-model="tableManufacturer" :value="tableManufacturer">
-					</el-input>
-				</el-col>
-			</el-row>
-			<el-row type="flex" class="mb10">
-				<el-col :span="12">
-					<div>风机编号:</div>
-					<el-input placeholder="请输入风机编号" v-model="tableWindturbineid" :value="tableWindturbineid">
-					</el-input>
-				</el-col>
-			</el-row>
-			<el-row type="flex" justify="end">
-				<div class="query-actions" style="margin-top: 15px">
-					<button class="btn" @click="onClickDialogClose">取消</button>
-					<button class="btn" @click="dialogSave">保存</button>
-				</div>
-			</el-row>
+		<el-dialog title="原始数据对比" v-model="gzCgd" width="80%" top="5vh" custom-class="modal" :close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
+			<Point :data="gzCgdData" :st='st' v-if='gzCgd'/>
 		</el-dialog>
 	</el-scrollbar>
-	<el-scrollbar height="92vh" v-if="gzCgd == 2">
-		<Point :data="gzCgdData" :st='st' @gzCgdClick="gzCgdClick" />
-	</el-scrollbar>
 </template>
 
 <script>
@@ -130,44 +80,23 @@
 		data() {
 			const that = this;
 			return {
-				tableTagArr: [{
-						label: '正样本',
-						value: 0
-					},
-					{
-						label: '负样本',
-						value: 1
-					}
-				],
-				queryType: false, //没有改变select时,点击查询无效
+				active: true,
+				selectAll: true,
+				
 				pageIndex: 1,
 				pageSize: 20,
-				gzCgd: 1, //传感点组件隐藏或显示
+				gzCgd: false, //传感点组件隐藏或显示
 				gzCgdData: [], //传感点参数
 				st:'',
-				BuJian: [],
+				widgetArr: [],
 				ChangZhan: [],
 				fjxh: [],
 				fjxhArr: [],
 				widget: [],
 				model: [],
+				mx:'list',
 				time: [],
 				station: '',
-				tableFaulttype: "",
-				tableTag: "",
-				tableModel: "",
-				tableTime: "",
-				tableSymptom: "",
-				tableManufacturer: "",
-				tableWindturbineid: "",
-				tableCategory: "", //隐藏保存部分
-				tableRemark: "",
-				tableFaultcode: "",
-				tableId: "",
-				tableSymptomcode: "",
-				tableStationen: "",
-				isvisiable: false,
-				isvisiableType: 1, //新增为1,编辑为2
 				tableData: {
 					column: [{
 							name: "序号",
@@ -176,28 +105,22 @@
 							width: '50px',
 						},
 						{
-							name: "样本类型",
-							field: "tableTag",
-							is_light: false,
-							width: '100px',
-						},
-						{
 							name: "风机编号",
-							field: "tableWindturbineid",
+							field: "wtId",
 							is_light: false,
 							width: '150px',
 						},
 						{
-							name: "故障类",
-							field: "tableFaulttype",
+							name: "故障类",
+							field: "tableTag",
 							is_light: false,
 							width: '150px',
 						},
 						{
-							name: "故障原因",
-							field: "tableSymptom",
+							name: "故障现象",
+							field: "symptom",
 							is_light: false,
-							width: '350px',
+							width: '300px',
 						},
 						{
 							name: "时间",
@@ -206,25 +129,72 @@
 							width: '350px',
 						},
 						{
-							name: "风机厂商",
+							name: "风机型号",
+							field: "tableModel",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "厂商",
 							field: "tableManufacturer",
 							is_light: false,
 							width: '150px',
 						},
 						{
+							name: "操作",
+							field: "cz",
+							is_light: false,
+							width: '200px',
+							template: () => {
+								return (
+									"<el-button type='text' style='cursor: pointer;' value='config'>传感点</el-button>&nbsp"
+								);
+							},
+							click(e, row) {
+								that.onClickOption(e, row);
+							},
+						},
+					],
+					data: [],
+				},
+				tableData2: {
+					column: [{
+							name: "序号",
+							field: "index",
+							is_light: false,
+							width: '50px',
+						},
+						{
+							name: "风机编号",
+							field: "wtId",
+							is_light: false,
+							width: '200px',
+						},
+						{
+							name: "故障类型",
+							field: "faulttype",
+							is_light: false,
+							width: '200px',
+						},
+						{
+							name: "故障时间",
+							field: "faultTime",
+							is_light: false,
+							width: '200px',
+						},
+						{
 							name: "风机型号",
-							field: "tableModel",
+							field: "modelId",
 							is_light: false,
-							width: '150px',
+							width: '200px',
 						},
 						{
 							name: "操作",
+							field: "cz",
 							is_light: false,
 							width: '200px',
 							template: () => {
 								return (
-									"<el-button type='text' style='cursor: pointer;' value='edit'>编辑</el-button>&nbsp" +
-									"<el-button type='text' style='cursor: pointer;' value='delete'>删除</el-button>&nbsp" +
 									"<el-button type='text' style='cursor: pointer;' value='config'>传感点</el-button>&nbsp"
 								);
 							},
@@ -234,87 +204,64 @@
 						},
 					],
 					data: [],
-				}
+				},
 			};
 		},
 		methods: {
-			getTable() {
-				let that = this;
-				this.tableLoading = true;
-				that.API.requestData({
-					method: "GET",
-					baseURL: "http://192.168.10.4:9002/",
-					subUrl: "benchmarking/wplist",
-					data: {
-						wpId: that.stationId,
-						startTs: that.startDate,
-						endTs: that.endDate,
-						pageNum: that.pageIndex,
-						pageSize: that.pageSize,
-					},
-					success(res) {
-						var dataTab = [];
-						if (res.data) {
-							res.data.list.forEach(item => {
-								dataTab.push({ //表格
-									recodedata: that.formatTime(item.recodedata),
-									region: item.region,
-								})
-							})
-							that.tableData.data = dataTab;
-							that.tableData.total = res.data.total;
-						} else {
-							that.tableData.data = [];
-							that.tableData.total = 0;
-						}
-						that.tableLoading = false;
-					},
-				});
+			checkAll() {
+				this.selectAll = !this.selectAll
+				if (this.selectAll) {
+					let widget = [];
+					this.widgetArr.forEach(ele=>{
+						widget.push(ele.value)
+					})
+					this.widget = widget;
+					this.active = true;
+				} else {
+					this.active = false;
+					this.widget = [];
+				}
 			},
 			onChangePage(params) {
 				this.pageIndex = params.pageIndex;
 				this.pageSize = params.pageSize;
-				this.getTable();
+				this.list();
 			},
-			startAjax() {
+			async startAjax() {
 				var that = this;
-				// that.time = [new Date((new Date() - 3600 * 1000 * 24 * 30)).formatDate("yyyy-MM-dd"), new Date().formatDate("yyyy-MM-dd")];
-				that.time = [new Date((new Date() - 3600 * 1000 * 24 * 360)).formatDate("yyyy-MM-dd"), new Date()
-					.formatDate("yyyy-MM-dd")
+				that.time = [new Date((new Date() - 3600 * 1000 * 24 * 360)).formatDate("yyyy-MM-dd hh:mm:ss"), new Date()
+					.formatDate("yyyy-MM-dd hh:mm:ss")
 				];
-				that.API.requestData({
+				await that.API.requestData({
 					method: "GET",
 					baseURL: "http://10.155.32.4:9001/",
 					subUrl: "benchmarking/wplist",
 					success(res) {
 						that.ChangZhan = res.data;
-						// that.station = res.data[0].name
 						that.station = res.data[1].name
 					},
 				});
 
-				that.API.requestData({
+				await that.API.requestData({
 					method: "GET",
 					baseURL: "http://192.168.1.18:9002/",
 					subUrl: "basic/widget/condition",
 					success(res) {
-						let keys = Object.keys(res.data[0]);
-						let bujian = [],
+						let widgetArr = [],
 							widget = [];
-						keys.forEach((ele, index) => {
-							bujian.push({
-								label: res.data[0].ele,
-								value: ele
+						res.data.forEach((ele, index) => {
+							widgetArr.push({
+								label: ele.faulttype,
+								value: ele.faultcode
 							})
-							widget.push(ele)
+							widget.push(ele.faultcode)
 						})
-
 						that.widget = widget;
-						that.BuJian = bujian;
+						that.widgetArr = widgetArr;
 					},
 				});
 
-				that.API.requestData({
+				await that.API.requestData({
 					method: "GET",
 					baseURL: "http://192.168.1.18:9002/",
 					subUrl: "basic/station/all",
@@ -342,135 +289,41 @@
 						that.fjxh = fjxh;
 					},
 				});
-			},
-			query() {
-				if (this.queryType) {
-					this.list();
-				}
-			},
-			addEdit() {
-				this.isvisiableType = 1;
-				this.tableFaulttype = '';
-				this.tableModel = '';
-				this.tableTime = '';
-				this.tableSymptom = '';
-				this.tableManufacturer = '';
-				this.tableWindturbineid = '';
-
-				// this.tableCategory: data[i].category,
-				// this.tableRemark: data[i].remark,
-				// this.tableFaultcode: data[i].faultcode,
-				// this.tableId: data[i].id,
-				// this.tableSymptomcode:data[i].Symptomcode,
-				// this.tableStationen:data[i].stationen
-
-				this.isvisiable = true;
+				that.list()
 			},
 			onClickOption(e, row) { // 操作按钮
 				let that = this;
-				if ("delete" == e.target.getAttribute("value")) {
-					that
-						.$confirm("确认删除此条样本数据?", "提示", {
-							confirmButtonText: "删除",
-							cancelButtonText: "取消"
-						})
-						.then((_) => {
-							console.log('ok')
-							// that.requestDelete(row);
-						})
-						.catch((_) => {});
-				}
-				if ("edit" == e.target.getAttribute("value")) {
-					that.isvisiableType = 2;
-					that.$nextTick(() => {
-						let tableTime = row.tableTime.split(" - ");
-						that.tableTag = row.tableTag;
-						that.BuJian.forEach(ele => {
-							if (ele.value == row.tableFaultcode) {
-								that.tableFaulttype = ele.label
-							}
-						})
-						that.tableModel = row.tableModel;
-						that.tableTime = [Date.parse(new Date(tableTime[0])), Date.parse(new Date(tableTime[1]))];
-						that.tableSymptom = row.tableSymptom;
-						that.tableManufacturer = row.tableManufacturer;
-						that.tableWindturbineid = row.tableWindturbineid;
-
-						that.tableCategory = row.tableCategory;
-						that.tableRemark = row.tableRemark;
-						that.tableFaultcode = row.tableFaultcode;
-						that.tableId = row.tableId;
-						that.tableSymptomcode = row.tableSymptomcode;
-						that.tableStationen = row.tableStationen;
-					});
-					that.isvisiable = true;
-				}
 				if ("config" == e.target.getAttribute("value")) { //传感点
 					that.API.requestData({
 						method: "GET",
 						baseURL: "http://192.168.1.18:9002/",
-						subUrl: "point/all",
+						subUrl: "point/list",
 						data: {
-							wtId: row.tableWindturbineid,
-							widget: row.tableFaultcode
+							wtId: row.wtId,
+							widget: row.widget
 						},
 						success(res) {
-							console.log(res)
 							if (res.code == 200) {
-								that.gzCgdData = res.data;
-								that.st = Date.parse(new Date(row.tableTime.split(" - ")[0]));
-								that.gzCgd = 2;
+								if(res.data.length){
+									that.gzCgdData = res.data;
+									if(that.mx == 'list'){
+										that.st = Date.parse(new Date(row.tableTime.split(" - ")[0]));
+									}else{
+										that.st = Date.parse(new Date(row.faultTime));
+									}
+									that.gzCgd = true;
+								}else{
+									that.BASE.showMsg({
+										msg: "暂无数据"
+									});
+								}
 							}
 						},
 					});
 				}
 			},
 			onClickDialogClose() { // 弹窗右上角关闭按钮
-				this.isvisiable = false;
-				this.isvisiableType = 1;
-			},
-			dialogSave() {
-				let that = this;
-				that.tableTime[0] = that.formatDate(that.tableTime[0].valueOf());
-				that.tableTime[1] = that.formatDate(that.tableTime[1].valueOf());
-				console.log(that.tableTime)
-				that.API.requestData({
-					method: "POST",
-					baseURL: "http://192.168.1.18:9002/",
-					headers: {
-						'Content-Type': 'application/json;charset=utf-8',
-					},
-					subUrl: "case/item/edit",
-					body: {
-						category: that.tableCategory,
-						endtime: that.tableTime[1],
-						faultcode: that.tableFaultcode,
-						faulttype: that.tableFaulttype,
-						id: that.tableId,
-						manufacturer: that.tableManufacturer,
-						model: that.tableModel,
-						remark: that.tableRemark,
-						starttime: that.tableTime[0],
-						stationen: that.tableStationen,
-						symptom: that.tableSymptom,
-						symptomcode: that.tableSymptomcode,
-						tag: that.tableTag == "正样本" ? 0 : 1,
-						windturbineid: that.tableWindturbineid
-					},
-					success(res) {
-						if (res.code == 200) {
-							that.BASE.showMsg({
-								type: "success",
-								msg: "保存成功",
-							});
-							that.onClickDialogClose();
-							that.list();
-						}
-					},
-				});
-			},
-			gzCgdClick(data) {
-				this.gzCgd = data;
+				this.gzCgd = false;
 			},
 			formatDate(dates) {
 				var date = new Date(dates);
@@ -500,13 +353,13 @@
 					})
 				}
 				if (typeof that.widget.valueOf() == 'string') {
-					that.BuJian.forEach(ele => {
+					that.widgetArr.forEach(ele => {
 						if (ele.label == that.widget) {
 							widget = ele.value
 						}
 					})
 				}
-				if (that.model.length == 0) {
+				if (that.model.length== 0) {
 					that.BASE.showMsg({
 						type: "warning",
 						msg: "请选择风机型号",
@@ -524,7 +377,7 @@
 					showLoading: true,
 					method: "GET",
 					baseURL: "http://192.168.1.18:9002/",
-					subUrl: "case/fault/all",
+					subUrl: "case/fault/list",
 					data: {
 						widget: widget ? widget : that.widget,
 						station: station ? station : that.station,
@@ -534,42 +387,71 @@
 					},
 					success(res) {
 						if (res.code == 200) {
-							console.log(res)
-							that.tableData.data = [];
 							if (res.data.length) {
 								let data = res.data;
-								for (var i = 0; i < data.length; i++) {
-									let obj = {
-										index: i + 1,
-										tableTag: data[i].tag == 0 ? '正样本' : '负样本',
-										tableFaulttype: data[i].faulttype,
-										tableModel: data[i].model,
-										tableTime: data[i].starttime + ' - ' + data[i].endtime,
-										tableSymptom: data[i].symptom,
-										tableManufacturer: data[i].manufacturer,
-										tableWindturbineid: data[i].windturbineid,
-
-										tableCategory: data[i].category,
-										tableRemark: data[i].remark,
-										tableFaultcode: data[i].faultcode,
-										tableId: data[i].id,
-										tableSymptomcode: data[i].symptomcode,
-										tableStationen: data[i].stationen
-									};
-									that.tableData.data.push(obj);
+								if(that.mx == 'list'){
+									that.tableData.data = [];
+									let k = 0;
+									for (var i = 0; i < data.length; i++) {
+											if(data[i].endtime != undefined){
+												k ++;
+												let obj = {
+													index: k,
+													tableTag: data[i].faulttype,
+													symptom: data[i].symptom,
+													tableModel: data[i].model,
+													tableTime: data[i].starttime + ' - ' + data[i].endtime,
+													tableManufacturer: data[i].manufacturer,
+													wtId: data[i].windturbineid,
+													widget:data[i].faultcode
+												};
+												that.tableData.data.push(obj);
+											}
+										}
+								}else{
+									that.tableData2.data = [];
+									let k = 0;
+									for (var i = 0; i < data.length; i++) {
+										if(data[i].endtime == undefined){
+											k ++;
+											let obj = {
+												index: k,
+												wtId: data[i].windturbineid,
+												faulttype: data[i].faulttype,
+												modelId: data[i].model,
+												faultTime: data[i].starttime,
+												widget:data[i].faultcode
+											};
+											that.tableData2.data.push(obj);
+										}
+									}
 								}
 							}
 						}
 					},
 				});
 			},
+			formatJson(filterVal, jsonData) {
+				return jsonData.map(v => filterVal.map(j => v[j]));
+			},
+			export() {
+				let that = this;
+				const {export_json_to_excel} = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
+				let tHeader = []; // 上面设置Excel的表格第一行的标题       
+				let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
+			
+				that.tableData.column.forEach(ele => {
+					if(ele.field != 'cz'){
+						tHeader.push(ele.name);
+						filterVal.push(ele.field);
+					}
+				});
+				const data = that.formatJson(filterVal, that.tableData.data);
+				export_json_to_excel(tHeader, data, '故障样本库'); // 最后一个是表名字
+			},
 		},
 		created() {
-			let that = this;
-			that.startAjax();
-			setTimeout(function() {
-				that.list()
-			}, 500)
+			this.startAjax();
 		},
 		watch: {
 			station(res) {
@@ -586,17 +468,10 @@
 					}
 				})
 				this.fjxh = fjxh;
-				this.queryType = true;
-			},
-			widget() {
-				this.queryType = true;
-			},
-			model() {
-				this.queryType = true;
-			},
-			time() {
-				this.queryType = true;
 			},
+			mx(){
+				this.list();
+			}
 		},
 	};
 </script>

+ 799 - 0
src/views/sampleDatabase/fault/point - 副本.vue

@@ -0,0 +1,799 @@
+<template>
+	<el-row type="flex">
+		<div class="query-actions">
+			<button class="btn" @click="addEdit">新增</button>
+			<button class="btn" @click="dbfx">原始数据对标</button>
+			<button class="btn" @click="back">返回</button>
+		</div>
+	</el-row>
+	<el-row :type="'flex'" class="content">
+		<el-col :span="24">
+			<ComTable :data="tableData" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
+				v-loading="tableLoading" ref="curRef" element-loading-text="拼命加载中"
+				element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
+		</el-col>
+	</el-row>
+		
+		
+	<el-dialog :title="isvisiableType == 1 ? '新增' : '编辑'" v-model="isvisiable" width="45%" top="15vh"
+		custom-class="modal" :close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
+		<!-- 这里是新增或编辑 -->
+		<el-row type="flex" class="mb10">
+			<el-col :span="12">
+				<div>样本类型:</div>
+				<el-select v-model="widget" placeholder="请选择样本" popper-class="select" class="w">
+					<el-option v-for="item in widgetArr" :key="item.value" :value="item.value"
+						:label="item.label">
+					</el-option>
+				</el-select>
+			</el-col>
+			<el-col :span="12">
+				<div>风机型号:</div>
+				<el-select v-model="tableModel" placeholder="请选择风机型号" popper-class="select" class="w">
+					<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
+					</el-option>
+				</el-select>
+			</el-col>
+		</el-row>
+		<el-row type="flex" class="mb10">
+			<el-col :span="12">
+				<div>故障分类:</div>
+				<el-select v-model="windturbinename" placeholder="请选择故障" popper-class="select" class="w">
+					<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
+					</el-option>
+				</el-select>
+			</el-col>
+			<el-col :span="12">
+				<div>时间:</div>
+				<el-date-picker v-model="tableTime" type="datetimerange" range-separator="至"
+					start-placeholder="开始日期" end-placeholder="结束日期" class="w">
+				</el-date-picker>
+			</el-col>
+		</el-row>
+		<el-row type="flex" class="mb10">
+			<el-col :span="12">
+				<div>故障原因:</div>
+				<el-input placeholder="请输入故障原因" v-model="tableSymptom" :value="tableSymptom">
+				</el-input>
+			</el-col>
+			<el-col :span="12">
+				<div>风机厂商:</div>
+				<el-input placeholder="请输入风机厂商" v-model="tableManufacturer" :value="tableManufacturer">
+				</el-input>
+			</el-col>
+		</el-row>
+		<el-row type="flex" class="mb10">
+			<el-col :span="12">
+				<div>风机编号:</div>
+				<el-input placeholder="请输入风机编号" v-model="stationcn" :value="stationcn">
+				</el-input>
+			</el-col>
+		</el-row>
+		<el-row type="flex" justify="end">
+			<div class="query-actions" style="margin-top: 15px">
+				<button class="btn" @click="onClickDialogClose">取消</button>
+				<button class="btn" @click="dialogSave">保存</button>
+			</div>
+		</el-row>
+	</el-dialog>
+	<!-- 原始数据start -->
+	<el-dialog title="原始数据" v-model="yssjDialog" width="70%" top="15vh" custom-class="modal"
+		:close-on-click-modal="false" :before-close="yssjDialogClose">
+		<div class="query mg-b-8">
+			<div class="query-items">
+				<div class="query-item">
+					<div class="lable">时间:</div>
+					<div class="search-input">
+						<el-date-picker v-model="time" type="datetimerange" range-separator="至" start-placeholder="开始日期"
+							end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">等间隔:</div>
+					<div class="search-input">
+						<el-select
+						  v-if="!chooseStatus"
+						  @change="switchChange(selectValue)"
+						  class="inputs"
+						  v-model="selectValue"
+						  placeholder="请选择"
+						>
+						  <el-option
+							v-for="item in timeoptions"
+							:key="item.value"
+							:label="item.label"
+							:value="item.value"
+						  >
+						  </el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-actions">
+					<button class="btn" @click="queryYssj">查询</button>
+				</div>
+			</div>
+		</div>
+		
+		<el-row type="flex">
+			<multiple-y-line-chart-normal
+			  height="500px"
+			  :list="Powertrend"
+			  :yAxises="PowertrendYAxises"
+			  :showLegend="true"
+			/>
+		</el-row>
+	</el-dialog>
+			<!-- 原始数据end -->
+</template>
+
+<script>
+	import ComTable from "@/components/coms/table/table.vue";
+		import MultipleYLineChartNormal from "../../NewPages/multiple-y-line-chart-normal.vue";
+		import Tab from "@/components/coms/tabs/tab.vue";
+	export default {
+		components: {
+			ComTable,MultipleYLineChartNormal,Tab
+		},
+		data() {
+			const that = this;
+			return {
+				Powertrend: [
+				  {
+				    title: "",
+				    yAxisIndex: 0, // 使用单位
+				    value: [],
+				  },
+				],
+				PowertrendYAxises: [
+				  {
+				    name: "功率",
+				    min: 0,
+				    max: null,
+				    unit: "(万kWh)",
+				    position: "left",
+				  },
+				  {
+				    name: "风速",
+				    min: 0,
+				    max: 25,
+				    unit: "(m/s)",
+				    position: "right",
+				  },
+				],
+				selectValue: "60",
+				timeoptions: [
+				  {
+				    value: "60",
+				    label: "一分钟",
+				  },
+				  {
+				    value: "300",
+				    label: "五分钟",
+				  },
+				  {
+				    value: "600",
+				    label: "十分钟",
+				  },
+				  {
+				    value: "1800",
+				    label: "三十分钟",
+				  },
+				  {
+				    value: "3600",
+				    label: "一小时",
+				  },
+				  {
+				    value: "86400",
+				    label: "一天",
+				  },
+				],
+				time: [],
+				yssjDialog:false,
+				point:[],
+				pointdes:[],
+				
+				widgetArr: [{label: '正样本',value: 0},{label: '负样本',value: 1}],
+				queryType: false, //没有改变select时,点击查询无效
+				pageIndex: 1,
+				pageSize: 20,
+				BuJian: [{
+					label: '部件1',
+					value: '1'
+				}, {
+					label: '部件2',
+					value: '2'
+				}],
+				ChangZhan: [{
+					label: '麻黄山风电场',
+					value: 'MHS_FDC'
+				}],
+				fjxh: [{
+					label: '类型1',
+					value: '1'
+				}],
+				fjxhArr: [{
+					id: "MHS_FDC",
+					value: ['UP77', 'UP82', 'UP105']
+				}],
+				widget: [],
+				model: [],
+				station: '',
+				windturbinename: "",
+				widget: "",
+				tableModel: "",
+				tableTime: "",
+				tableSymptom: "",
+				tableManufacturer: "",
+				stationcn: "",
+				tableCategory: "", //隐藏保存部分
+				tableRemark: "",
+				tableFaultcode: "",
+				tableId: "",
+				tableSymptomcode: "",
+				tableStationen: "",
+				isvisiable: false,
+				isvisiableType: 1, //新增为1,编辑为2
+				checkLength: 0, //对标分析只能选择5个
+				tableData: {
+					column: [{
+							name: "序号",
+							field: "index",
+							is_light: false,
+							width: '50px',
+						},
+						{
+						  name: "",
+						  field: "check",
+						  is_light: false,
+						  width: '50px',
+						  template: function () {
+						    return "<input class='check curCheckBox' type='CheckBox'/>";
+						  },
+						  click: function (event, data) {
+						    let point = data.point,
+								pointdes = data.pointdes;
+						    if (event.target.checked == false && that.checkLength <= 5) {
+						      that.point.forEach((item, i) => {
+						        if (item == point) {
+						          that.point.splice(i, 1);
+						          that.pointdes.splice(i, 1);
+						        }
+						      });
+						      that.checkLength--;
+						    } else if (event.target.checked && that.checkLength < 5) {
+						      that.point.push(point);
+						      that.pointdes.push(pointdes);
+						      that.checkLength++;
+						    } else if (that.checkLength == 5) {
+						      event.target.checked = false;
+						    }
+						  },
+						},
+						{
+							name: "风机",
+							field: "windturbineid",
+							is_light: false,
+							width: '100px',
+						},
+						{
+							name: "部件",
+							field: "widget",
+							is_light: false,
+							width: '100px',
+						},
+						{
+							name: "测点",
+							field: "point",
+							is_light: false,
+							width: '250px',
+						},
+						{
+							name: "测点描述",
+							field: "pointdes",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "风机型号",
+							field: "model",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "场站",
+							field: "stationcn",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "操作",
+							is_light: false,
+							width: '200px',
+							template: () => {
+								return (
+									"<el-button type='text' style='cursor: pointer;' value='edit'>编辑</el-button>&nbsp" +
+									"<el-button type='text' style='cursor: pointer;' value='delete'>删除</el-button>&nbsp" +
+									"<el-button type='text' style='cursor: pointer;' value='config'>原始数据</el-button>&nbsp"
+								);
+							},
+							click(e, row) {
+								that.onClickOption(e, row);
+							},
+						},
+					],
+					data: [{
+						index: 1,
+						windturbineid: 0,
+						widget: "MG01-01",
+						point: "0.1000",
+						pointdes: "0.1000",
+						model: "0.1000",
+						stationcn: "0.1000",
+						is_light: false,
+					}],
+				}
+			};
+		},
+		props: {
+			data: {
+				type: Array
+			},
+			st:{
+				type: String
+			}
+		},
+		methods: {
+			getTable() {
+				let that = this;
+				this.tableLoading = true;
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.10.4:9002/",
+					subUrl: "benchmarking/wplist",
+					data: {
+						wpId: that.stationId,
+						startTs: that.startDate,
+						endTs: that.endDate,
+						pageNum: that.pageIndex,
+						pageSize: that.pageSize,
+					},
+					success(res) {
+						var dataTab = [];
+						if (res.data) {
+							res.data.list.forEach(item => {
+								dataTab.push({ //表格
+									recodedata: that.formatTime(item.recodedata),
+									region: item.region,
+								})
+							})
+							that.tableData.data = dataTab;
+							that.tableData.total = res.data.total;
+						} else {
+							that.tableData.data = [];
+							that.tableData.total = 0;
+						}
+						that.tableLoading = false;
+					},
+				});
+			},
+			onChangePage(params) {
+				this.pageIndex = params.pageIndex;
+				this.pageSize = params.pageSize;
+				this.getTable();
+			},
+			startAjax() {
+				var that = this;
+				// that.time = [new Date((new Date() - 3600 * 1000 * 24 * 30)).formatDate("yyyy-MM-dd"), new Date().formatDate("yyyy-MM-dd")];
+				that.time = [new Date((new Date() - 3600 * 1000 * 24 * 360)).formatDate("yyyy-MM-dd"), new Date()
+					.formatDate("yyyy-MM-dd")
+				];
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.4:9001/",
+					subUrl: "benchmarking/wplist",
+					success(res) {
+						that.ChangZhan = res.data;
+						// that.station = res.data[0].name
+						that.station = res.data[1].name
+					},
+				});
+
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "basic/widget/condition",
+					success(res) {
+						let keys = Object.keys(res.data[0]);
+						let bujian = [],
+							widget = [];
+						keys.forEach((ele, index) => {
+							bujian.push({
+								label: res.data[0].ele,
+								value: ele
+							})
+							widget.push(ele)
+						})
+
+						that.widget = widget;
+						that.BuJian = bujian;
+					},
+				});
+
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "basic/station/all",
+					success(res) {
+						let fjxhArr = [];
+						let model = [],
+							fjxh = [];
+						res.data.forEach(ele => {
+							fjxhArr.push({
+								id: ele.id,
+								value: ele.model.split("/")
+							})
+							if (ele.id == "MHS_FDC") {
+								model = ele.model.split("/");
+								model.forEach(ele => {
+									fjxh.push({
+										label: ele,
+										value: ele
+									})
+								})
+							}
+						})
+						that.fjxhArr = fjxhArr;
+						that.model = model;
+						that.fjxh = fjxh;
+					},
+				});
+			},
+			query() {
+				if (this.queryType) {
+					this.list();
+				}
+			},
+			addEdit() {
+				this.isvisiableType = 1;
+				this.windturbinename = '';
+				this.tableModel = '';
+				this.tableTime = '';
+				this.tableSymptom = '';
+				this.tableManufacturer = '';
+				this.stationcn = '';
+
+				// this.tableCategory: data[i].category,
+				// this.tableRemark: data[i].remark,
+				// this.tableFaultcode: data[i].faultcode,
+				// this.tableId: data[i].id,
+				// this.tableSymptomcode:data[i].Symptomcode,
+				// this.tableStationen:data[i].stationen
+
+				this.isvisiable = true;
+			},
+			onClickOption(e, row) { // 操作按钮
+				let that = this;
+				if ("delete" == e.target.getAttribute("value")) {
+					that
+						.$confirm("确认删除此条样本数据?", "提示", {
+							confirmButtonText: "删除",
+							cancelButtonText: "取消"
+						})
+						.then((_) => {
+							console.log('ok')
+							// that.requestDelete(row);
+						})
+						.catch((_) => {});
+				}
+				if ("edit" == e.target.getAttribute("value")) {
+					that.isvisiableType = 2;
+					that.$nextTick(() => {
+						let tableTime = row.tableTime.split(" - ");
+						that.widget = row.widget;
+						that.BuJian.forEach(ele => {
+							if (ele.value == row.tableFaultcode) {
+								that.windturbinename = ele.label
+							}
+						})
+						that.tableModel = row.tableModel;
+						that.tableTime = [Date.parse(new Date(tableTime[0])), Date.parse(new Date(tableTime[1]))];
+						that.tableSymptom = row.tableSymptom;
+						that.tableManufacturer = row.tableManufacturer;
+						that.stationcn = row.stationcn;
+
+						that.tableCategory = row.tableCategory;
+						that.tableRemark = row.tableRemark;
+						that.tableFaultcode = row.tableFaultcode;
+						that.tableId = row.tableId;
+						that.tableSymptomcode = row.tableSymptomcode;
+						that.tableStationen = row.tableStationen;
+					});
+					that.isvisiable = true;
+				}
+				if ("config" == e.target.getAttribute("value")) { //传感点
+					that.time = [that.st - (3600 * 1000), that.st];
+					that.point =[row.point];
+					that.pointdes = [row.pointdes];
+					that.requestDetailData(that.point,that.pointdes,that.time,that.selectValue);
+					that.yssjDialog=true;
+				}
+			},
+			onClickDialogClose() { // 弹窗右上角关闭按钮
+				this.isvisiable = false;
+				this.isvisiableType = 1;
+			},
+			dialogSave() {
+				let that = this;
+				that.tableTime[0] = that.formatDate(that.tableTime[0].valueOf());
+				that.tableTime[1] = that.formatDate(that.tableTime[1].valueOf());
+				console.log(that.tableTime)
+				that.API.requestData({
+					method: "POST",
+					baseURL: "http://192.168.1.18:9002/",
+					headers: {
+						'Content-Type': 'application/json;charset=utf-8',
+					},
+					subUrl: "case/item/edit",
+					body: {
+						category: that.tableCategory,
+						endtime: that.tableTime[1],
+						faultcode: that.tableFaultcode,
+						faulttype: that.windturbinename,
+						id: that.tableId,
+						manufacturer: that.tableManufacturer,
+						model: that.tableModel,
+						remark: that.tableRemark,
+						starttime: that.tableTime[0],
+						stationen: that.tableStationen,
+						symptom: that.tableSymptom,
+						symptomcode: that.tableSymptomcode,
+						tag: that.widget == "正样本" ? 0 : 1,
+						windturbineid: that.stationcn
+					},
+					success(res) {
+						if (res.code == 200) {
+							that.BASE.showMsg({
+								type: "success",
+								msg: "保存成功",
+							});
+							that.onClickDialogClose();
+							that.list();
+						}
+					},
+				});
+			},
+			gzCgdClick(data) {
+				this.gzCgd = data;
+			},
+			formatDate(dates) {
+				var date = new Date(dates);
+				var YY = date.getFullYear() + '-';
+				var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+				var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+				var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+				var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+				var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+				return YY + MM + DD + " " + hh + mm + ss;
+			},
+			list(data) {
+				console.log(data)
+				var that = this;
+				that.tableData.data = [];
+				if (data.length) {
+					for (var i = 0; i < data.length; i++) {
+						let obj = {
+							index: i + 1,
+							windturbineid: data[i].windturbineid,
+							widget: data[i].widget,
+							point: data[i].point,
+							pointdes: data[i].pointdes,
+							model: data[i].model,
+							stationcn: data[i].stationcn,
+							
+						};
+						that.tableData.data.push(obj);
+					}
+				}
+				
+				
+				// let station = '',
+				// 	widget = ''
+				// if (typeof that.time[0].valueOf() != 'string') {
+				// 	that.time[0] = that.formatDate(that.time[0].valueOf())
+				// }
+				// if (typeof that.time[1].valueOf() != 'string') {
+				// 	that.time[1] = that.formatDate(that.time[1].valueOf())
+				// }
+				// if (typeof that.station.valueOf() == 'string') {
+				// 	that.ChangZhan.forEach(ele => {
+				// 		if (ele.name == that.station) {
+				// 			station = ele.id
+				// 		}
+				// 	})
+				// }
+				// if (typeof that.widget.valueOf() == 'string') {
+				// 	that.BuJian.forEach(ele => {
+				// 		if (ele.label == that.widget) {
+				// 			widget = ele.value
+				// 		}
+				// 	})
+				// }
+				// if (that.model.length == 0) {
+				// 	that.BASE.showMsg({
+				// 		type: "warning",
+				// 		msg: "请选择风机型号",
+				// 	});
+				// 	return
+				// }
+				// if (that.widget.length == 0) {
+				// 	that.BASE.showMsg({
+				// 		type: "warning",
+				// 		msg: "请选择部件",
+				// 	});
+				// 	return
+				// }
+				// that.API.requestData({
+				// 	showLoading: true,
+				// 	method: "GET",
+				// 	baseURL: "http://192.168.1.18:9002/",
+				// 	subUrl: "case/fault/all",
+				// 	data: {
+				// 		widget: widget ? widget : that.widget,
+				// 		station: station ? station : that.station,
+				// 		model: that.model,
+				// 		st: that.time[0].valueOf(),
+				// 		et: that.time[1].valueOf()
+				// 	},
+				// 	success(res) {
+				// 		if (res.code == 200) {
+				// 			console.log(res)
+				// 			that.tableData.data = [];
+				// 			if (res.data.length) {
+				// 				let data = res.data;
+				// 				for (var i = 0; i < data.length; i++) {
+				// 					let obj = {
+				// 						index: i + 1,
+				// 						widget: data[i].tag == 0 ? '正样本' : '负样本',
+				// 						windturbinename: data[i].faulttype,
+				// 						tableModel: data[i].model,
+				// 						tableTime: data[i].starttime + ' - ' + data[i].endtime,
+				// 						tableSymptom: data[i].symptom,
+				// 						tableManufacturer: data[i].manufacturer,
+				// 						stationcn: data[i].windturbineid,
+
+				// 						tableCategory: data[i].category,
+				// 						tableRemark: data[i].remark,
+				// 						tableFaultcode: data[i].faultcode,
+				// 						tableId: data[i].id,
+				// 						tableSymptomcode: data[i].symptomcode,
+				// 						tableStationen: data[i].stationen
+				// 					};
+				// 					that.tableData.data.push(obj);
+				// 				}
+				// 			}
+				// 		}
+				// 	},
+				// });
+			},
+			back() {
+				this.clearDb();
+				this.$emit('gzCgdClick', 1);
+			},
+			switchChange(interval,status) {
+			  if(status === 'interval') {
+			    this.chooseStatus = false
+			    this.selectValue = '60'
+			  }else if(status === 'original'){
+			    this.chooseStatus = true
+			  }
+			  // this.requestDetailData(
+			  //     this.wpvalue,
+			  //     this.startdate,
+			  //     this.enddate,
+			  //     interval,
+			  //     this.wtId,
+			  //     this.descName
+			  //   );
+			},
+			requestDetailData(point, pointdes, time,interval) {
+			    let that = this;
+				let Powertrend = [];
+				pointdes.forEach((ele,index)=>{
+					Powertrend.push({
+						title:ele,
+						smooth: true,
+						value: [],
+					})
+				})
+				point.forEach((ele,index)=>{
+					that.API.requestData({
+						method: "GET",
+						baseURL: "http://192.168.1.18:9002/",
+						subUrl: "point/item",
+						data:{
+							point:ele,
+							startTs:time[0],
+							endTs:time[1],
+							interval:interval
+						},
+						success(res) {
+							if(res.data){
+							  res.data.forEach((cEle) => {
+								Powertrend[index].value.push({
+								  text: new Date(cEle.ts).formatDate("hh:mm"),
+								  value: cEle.doubleValue,
+								});
+							  });
+							  if((point.length - 1) == index){
+								that.Powertrend = Powertrend;
+							  }
+							}
+						},
+					});
+				})
+				
+			},
+			queryYssj(){
+				this.requestDetailData(this.point,this.pointdes,[Date.parse(new Date(this.time[0])), Date.parse(new Date(this.time[1]))],this.selectValue);
+			},
+			dbfx() {
+			  var that = this;
+			  if (that.point.length <=5) {
+				  that.Powertrend = [];
+				  that.time = [that.st - (3600 * 1000), that.st];
+				  that.requestDetailData(that.point,that.pointdes,[Date.parse(new Date(that.time[0])), Date.parse(new Date(that.time[1]))],that.selectValue);
+			    that.yssjDialog = true;
+			    that.clearDb();
+			  }
+			},
+			clearDb() {
+			  //清空对标状态
+			  this.$refs.curRef.clearCheckBox();
+			  this.point = [];
+			  this.pointdes = [];
+			  this.checkLength = 0;
+			},
+		},
+		created() {
+			this.list(this.data)
+		},
+		watch: {
+			station(res) {
+				let fjxh = [];
+				this.fjxhArr.forEach(ele => {
+					if (ele.id == res) {
+						ele.value.forEach(ele2 => {
+							fjxh.push({
+								label: ele2,
+								value: ele2
+							})
+						})
+						this.model = ele.value;
+					}
+				})
+				this.fjxh = fjxh;
+				this.queryType = true;
+			},
+			widget() {
+				this.queryType = true;
+			},
+			model() {
+				this.queryType = true;
+			},
+			time() {
+				this.queryType = true;
+			},
+		},
+	};
+</script>
+
+<style lang="less" scoped>
+	.mb10 {
+		margin-bottom: 10px;
+	}
+
+	.el-select.w {
+		width: 100%;
+	}
+</style>

+ 180 - 663
src/views/sampleDatabase/fault/point.vue

@@ -1,84 +1,5 @@
 <template>
 	<el-row type="flex">
-		<div class="query-actions">
-			<button class="btn" @click="addEdit">新增</button>
-			<button class="btn" @click="dbfx">原始数据对标</button>
-			<button class="btn" @click="back">返回</button>
-		</div>
-	</el-row>
-	<el-row :type="'flex'" class="content">
-		<el-col :span="24">
-			<ComTable :data="tableData" :pageSize="pageSize" @onPagging="onChangePage" height="84vh"
-				v-loading="tableLoading" ref="curRef" element-loading-text="拼命加载中"
-				element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
-		</el-col>
-	</el-row>
-		
-		
-	<el-dialog :title="isvisiableType == 1 ? '新增' : '编辑'" v-model="isvisiable" width="45%" top="15vh"
-		custom-class="modal" :close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
-		<!-- 这里是新增或编辑 -->
-		<el-row type="flex" class="mb10">
-			<el-col :span="12">
-				<div>样本类型:</div>
-				<el-select v-model="widget" placeholder="请选择样本" popper-class="select" class="w">
-					<el-option v-for="item in widgetArr" :key="item.value" :value="item.value"
-						:label="item.label">
-					</el-option>
-				</el-select>
-			</el-col>
-			<el-col :span="12">
-				<div>风机型号:</div>
-				<el-select v-model="tableModel" placeholder="请选择风机型号" popper-class="select" class="w">
-					<el-option v-for="item in fjxh" :key="item.value" :value="item.value" :label="item.label">
-					</el-option>
-				</el-select>
-			</el-col>
-		</el-row>
-		<el-row type="flex" class="mb10">
-			<el-col :span="12">
-				<div>故障分类:</div>
-				<el-select v-model="windturbinename" placeholder="请选择故障" popper-class="select" class="w">
-					<el-option v-for="item in BuJian" :key="item.value" :value="item.value" :label="item.label">
-					</el-option>
-				</el-select>
-			</el-col>
-			<el-col :span="12">
-				<div>时间:</div>
-				<el-date-picker v-model="tableTime" type="datetimerange" range-separator="至"
-					start-placeholder="开始日期" end-placeholder="结束日期" class="w">
-				</el-date-picker>
-			</el-col>
-		</el-row>
-		<el-row type="flex" class="mb10">
-			<el-col :span="12">
-				<div>故障原因:</div>
-				<el-input placeholder="请输入故障原因" v-model="tableSymptom" :value="tableSymptom">
-				</el-input>
-			</el-col>
-			<el-col :span="12">
-				<div>风机厂商:</div>
-				<el-input placeholder="请输入风机厂商" v-model="tableManufacturer" :value="tableManufacturer">
-				</el-input>
-			</el-col>
-		</el-row>
-		<el-row type="flex" class="mb10">
-			<el-col :span="12">
-				<div>风机编号:</div>
-				<el-input placeholder="请输入风机编号" v-model="stationcn" :value="stationcn">
-				</el-input>
-			</el-col>
-		</el-row>
-		<el-row type="flex" justify="end">
-			<div class="query-actions" style="margin-top: 15px">
-				<button class="btn" @click="onClickDialogClose">取消</button>
-				<button class="btn" @click="dialogSave">保存</button>
-			</div>
-		</el-row>
-	</el-dialog>
-	<!-- 原始数据start -->
-	<el-dialog title="原始数据" v-model="yssjDialog" width="70%" top="15vh" custom-class="modal"
-		:close-on-click-modal="false" :before-close="yssjDialogClose">
 		<div class="query mg-b-8">
 			<div class="query-items">
 				<div class="query-item">
@@ -92,148 +13,100 @@
 				<div class="query-item">
 					<div class="lable">等间隔:</div>
 					<div class="search-input">
-						<el-select
-						  v-if="!chooseStatus"
-						  @change="switchChange(selectValue)"
-						  class="inputs"
-						  v-model="selectValue"
-						  placeholder="请选择"
-						>
-						  <el-option
-							v-for="item in timeoptions"
-							:key="item.value"
-							:label="item.label"
-							:value="item.value"
-						  >
-						  </el-option>
+						<el-select v-if="!chooseStatus" @change="switchChange(selectValue)" class="inputs"
+							v-model="selectValue" placeholder="请选择">
+							<el-option v-for="item in timeoptions" :key="item.value" :label="item.label"
+								:value="item.value">
+							</el-option>
 						</el-select>
 					</div>
 				</div>
 				<div class="query-actions">
-					<button class="btn" @click="queryYssj">查询</button>
+					<!-- <button class="btn" @click="clearDb">重置对标选项</button> -->
+					<button class="btn" @click="dbfx">原数据对标</button>
 				</div>
 			</div>
 		</div>
-		
-		<el-row type="flex">
-			<multiple-y-line-chart-normal
-			  height="500px"
-			  :list="Powertrend"
-			  :yAxises="PowertrendYAxises"
-			  :showLegend="true"
-			/>
-		</el-row>
-	</el-dialog>
-			<!-- 原始数据end -->
+	</el-row>
+	<el-row :type="'flex'" class="content mg-b-8">
+		<ComTable :data="tableData" :height="'30vh'" v-loading="tableLoading" ref="curRef" element-loading-text="拼命加载中"
+			element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
+	</el-row>
+	<el-row :type="'flex'" class="content" :style="{height:'44vh'}">
+		 <el-col :span="24">
+		 	<multiple-y-line-chart-normal height="45vh" :list="Powertrend" :yAxises="PowertrendYAxises"
+		 		:showLegend="true" />	 
+		 </el-col>
+	</el-row>
 </template>
 
 <script>
 	import ComTable from "@/components/coms/table/table.vue";
-		import MultipleYLineChartNormal from "../../NewPages/multiple-y-line-chart-normal.vue";
-		import Tab from "@/components/coms/tabs/tab.vue";
+	import MultipleYLineChartNormal from "../../NewPages/multiple-y-line-chart-normal.vue";
 	export default {
 		components: {
-			ComTable,MultipleYLineChartNormal,Tab
+			ComTable,
+			MultipleYLineChartNormal
 		},
 		data() {
 			const that = this;
 			return {
-				Powertrend: [
-				  {
-				    title: "",
-				    yAxisIndex: 0, // 使用单位
-				    value: [],
-				  },
-				],
-				PowertrendYAxises: [
-				  {
-				    name: "功率",
-				    min: 0,
-				    max: null,
-				    unit: "(万kWh)",
-				    position: "left",
-				  },
-				  {
-				    name: "风速",
-				    min: 0,
-				    max: 25,
-				    unit: "(m/s)",
-				    position: "right",
-				  },
+				Powertrend: [{
+					title: "",
+					yAxisIndex: 0, // 使用单位
+					value: [],
+				}, ],
+				PowertrendYAxises: [{
+						name: "",
+						min: 0,
+						max: null,
+						unit: "",
+						position: "left",
+					},
+					{
+						name: "",
+						min: 0,
+						max: 25,
+						unit: "",
+						position: "right",
+					},
 				],
 				selectValue: "60",
 				timeoptions: [
-				  {
-				    value: "60",
-				    label: "一分钟",
-				  },
-				  {
-				    value: "300",
-				    label: "五分钟",
-				  },
-				  {
-				    value: "600",
-				    label: "十分钟",
-				  },
-				  {
-				    value: "1800",
-				    label: "三十分钟",
-				  },
-				  {
-				    value: "3600",
-				    label: "一小时",
-				  },
-				  {
-				    value: "86400",
-				    label: "一天",
-				  },
+					{
+						value: "60",
+						label: "一分钟",
+					},
+					{
+						value: "300",
+						label: "五分钟",
+					},
+					{
+						value: "600",
+						label: "十分钟",
+					},
+					{
+						value: "1800",
+						label: "三十分钟",
+					},
+					{
+						value: "3600",
+						label: "一小时",
+					},
+					{
+						value: "86400",
+						label: "一天",
+					},
 				],
-				time: [],
-				yssjDialog:false,
-				point:[],
-				pointdes:[],
-				
-				widgetArr: [{label: '正样本',value: 0},{label: '负样本',value: 1}],
-				queryType: false, //没有改变select时,点击查询无效
-				pageIndex: 1,
+				time: [that.st - (3600 * 1000*24), that.st + (1000*10*60)],
+				point: [],
+				pointdes: [],
+
 				pageSize: 20,
-				BuJian: [{
-					label: '部件1',
-					value: '1'
-				}, {
-					label: '部件2',
-					value: '2'
-				}],
-				ChangZhan: [{
-					label: '麻黄山风电场',
-					value: 'MHS_FDC'
-				}],
-				fjxh: [{
-					label: '类型1',
-					value: '1'
-				}],
-				fjxhArr: [{
-					id: "MHS_FDC",
-					value: ['UP77', 'UP82', 'UP105']
-				}],
-				widget: [],
 				model: [],
 				station: '',
 				windturbinename: "",
-				widget: "",
-				tableModel: "",
-				tableTime: "",
-				tableSymptom: "",
-				tableManufacturer: "",
-				stationcn: "",
-				tableCategory: "", //隐藏保存部分
-				tableRemark: "",
-				tableFaultcode: "",
-				tableId: "",
-				tableSymptomcode: "",
-				tableStationen: "",
 				isvisiable: false,
-				isvisiableType: 1, //新增为1,编辑为2
 				checkLength: 0, //对标分析只能选择5个
 				tableData: {
 					column: [{
@@ -243,78 +116,52 @@
 							width: '50px',
 						},
 						{
-						  name: "",
-						  field: "check",
-						  is_light: false,
-						  width: '50px',
-						  template: function () {
-						    return "<input class='check curCheckBox' type='CheckBox'/>";
-						  },
-						  click: function (event, data) {
-						    let point = data.point,
-								pointdes = data.pointdes;
-						    if (event.target.checked == false && that.checkLength <= 5) {
-						      that.point.forEach((item, i) => {
-						        if (item == point) {
-						          that.point.splice(i, 1);
-						          that.pointdes.splice(i, 1);
-						        }
-						      });
-						      that.checkLength--;
-						    } else if (event.target.checked && that.checkLength < 5) {
-						      that.point.push(point);
-						      that.pointdes.push(pointdes);
-						      that.checkLength++;
-						    } else if (that.checkLength == 5) {
-						      event.target.checked = false;
-						    }
-						  },
-						},
-						{
-							name: "风机",
-							field: "windturbineid",
-							is_light: false,
-							width: '100px',
-						},
-						{
-							name: "部件",
-							field: "widget",
+							name: "",
+							field: "check",
 							is_light: false,
-							width: '100px',
+							width: '50px',
+							template: function() {
+								return "<input class='check curCheckBox' type='CheckBox'/>";
+							},
+							click: function(event, data) {
+								let point = data.point,
+									pointdes = data.pointdes;
+								if (event.target.checked == false && that.checkLength <= 5) {
+									that.point.forEach((item, i) => {
+										if (item == point) {
+											that.point.splice(i, 1);
+											that.pointdes.splice(i, 1);
+										}
+									});
+									that.checkLength--;
+								} else if (event.target.checked && that.checkLength < 5) {
+									that.point.push(point);
+									that.pointdes.push(pointdes);
+									that.checkLength++;
+								} else if (that.checkLength == 5) {
+									event.target.checked = false;
+								}
+							},
 						},
 						{
-							name: "测点",
+							name: "测点名称",
 							field: "point",
 							is_light: false,
-							width: '250px',
+							width: '400px',
 						},
 						{
 							name: "测点描述",
 							field: "pointdes",
 							is_light: false,
-							width: '150px',
-						},
-						{
-							name: "风机型号",
-							field: "model",
-							is_light: false,
-							width: '150px',
-						},
-						{
-							name: "场站",
-							field: "stationcn",
-							is_light: false,
-							width: '150px',
+							width: '350px',
 						},
 						{
 							name: "操作",
 							is_light: false,
-							width: '200px',
+							width: '250px',
 							template: () => {
 								return (
-									"<el-button type='text' style='cursor: pointer;' value='edit'>编辑</el-button>&nbsp" +
-									"<el-button type='text' style='cursor: pointer;' value='delete'>删除</el-button>&nbsp" +
-									"<el-button type='text' style='cursor: pointer;' value='config'>原始数据</el-button>&nbsp"
+									"<el-button type='text' style='cursor: pointer;' value='config'>查看原数据</el-button>&nbsp"
 								);
 							},
 							click(e, row) {
@@ -322,16 +169,7 @@
 							},
 						},
 					],
-					data: [{
-						index: 1,
-						windturbineid: 0,
-						widget: "MG01-01",
-						point: "0.1000",
-						pointdes: "0.1000",
-						model: "0.1000",
-						stationcn: "0.1000",
-						is_light: false,
-					}],
+					data: [],
 				}
 			};
 		},
@@ -339,245 +177,20 @@
 			data: {
 				type: Array
 			},
-			st:{
+			st: {
 				type: String
-			}
+			},
 		},
 		methods: {
-			getTable() {
-				let that = this;
-				this.tableLoading = true;
-				that.API.requestData({
-					method: "GET",
-					baseURL: "http://192.168.10.4:9002/",
-					subUrl: "benchmarking/wplist",
-					data: {
-						wpId: that.stationId,
-						startTs: that.startDate,
-						endTs: that.endDate,
-						pageNum: that.pageIndex,
-						pageSize: that.pageSize,
-					},
-					success(res) {
-						var dataTab = [];
-						if (res.data) {
-							res.data.list.forEach(item => {
-								dataTab.push({ //表格
-									recodedata: that.formatTime(item.recodedata),
-									region: item.region,
-								})
-							})
-							that.tableData.data = dataTab;
-							that.tableData.total = res.data.total;
-						} else {
-							that.tableData.data = [];
-							that.tableData.total = 0;
-						}
-						that.tableLoading = false;
-					},
-				});
-			},
-			onChangePage(params) {
-				this.pageIndex = params.pageIndex;
-				this.pageSize = params.pageSize;
-				this.getTable();
-			},
-			startAjax() {
-				var that = this;
-				// that.time = [new Date((new Date() - 3600 * 1000 * 24 * 30)).formatDate("yyyy-MM-dd"), new Date().formatDate("yyyy-MM-dd")];
-				that.time = [new Date((new Date() - 3600 * 1000 * 24 * 360)).formatDate("yyyy-MM-dd"), new Date()
-					.formatDate("yyyy-MM-dd")
-				];
-				that.API.requestData({
-					method: "GET",
-					baseURL: "http://10.155.32.4:9001/",
-					subUrl: "benchmarking/wplist",
-					success(res) {
-						that.ChangZhan = res.data;
-						// that.station = res.data[0].name
-						that.station = res.data[1].name
-					},
-				});
-
-				that.API.requestData({
-					method: "GET",
-					baseURL: "http://192.168.1.18:9002/",
-					subUrl: "basic/widget/condition",
-					success(res) {
-						let keys = Object.keys(res.data[0]);
-						let bujian = [],
-							widget = [];
-						keys.forEach((ele, index) => {
-							bujian.push({
-								label: res.data[0].ele,
-								value: ele
-							})
-							widget.push(ele)
-						})
-
-						that.widget = widget;
-						that.BuJian = bujian;
-					},
-				});
-
-				that.API.requestData({
-					method: "GET",
-					baseURL: "http://192.168.1.18:9002/",
-					subUrl: "basic/station/all",
-					success(res) {
-						let fjxhArr = [];
-						let model = [],
-							fjxh = [];
-						res.data.forEach(ele => {
-							fjxhArr.push({
-								id: ele.id,
-								value: ele.model.split("/")
-							})
-							if (ele.id == "MHS_FDC") {
-								model = ele.model.split("/");
-								model.forEach(ele => {
-									fjxh.push({
-										label: ele,
-										value: ele
-									})
-								})
-							}
-						})
-						that.fjxhArr = fjxhArr;
-						that.model = model;
-						that.fjxh = fjxh;
-					},
-				});
-			},
-			query() {
-				if (this.queryType) {
-					this.list();
-				}
-			},
-			addEdit() {
-				this.isvisiableType = 1;
-				this.windturbinename = '';
-				this.tableModel = '';
-				this.tableTime = '';
-				this.tableSymptom = '';
-				this.tableManufacturer = '';
-				this.stationcn = '';
-
-				// this.tableCategory: data[i].category,
-				// this.tableRemark: data[i].remark,
-				// this.tableFaultcode: data[i].faultcode,
-				// this.tableId: data[i].id,
-				// this.tableSymptomcode:data[i].Symptomcode,
-				// this.tableStationen:data[i].stationen
-
-				this.isvisiable = true;
-			},
 			onClickOption(e, row) { // 操作按钮
 				let that = this;
-				if ("delete" == e.target.getAttribute("value")) {
-					that
-						.$confirm("确认删除此条样本数据?", "提示", {
-							confirmButtonText: "删除",
-							cancelButtonText: "取消"
-						})
-						.then((_) => {
-							console.log('ok')
-							// that.requestDelete(row);
-						})
-						.catch((_) => {});
+				if ("config" == e.target.getAttribute("value")) { //原始数据
+					that.requestDetailData([row.point], [row.pointdes], [Date.parse(new Date(that.time[0])), Date.parse(
+						new Date(that.time[1]))], that.selectValue);
+					that.clearDb();
 				}
-				if ("edit" == e.target.getAttribute("value")) {
-					that.isvisiableType = 2;
-					that.$nextTick(() => {
-						let tableTime = row.tableTime.split(" - ");
-						that.widget = row.widget;
-						that.BuJian.forEach(ele => {
-							if (ele.value == row.tableFaultcode) {
-								that.windturbinename = ele.label
-							}
-						})
-						that.tableModel = row.tableModel;
-						that.tableTime = [Date.parse(new Date(tableTime[0])), Date.parse(new Date(tableTime[1]))];
-						that.tableSymptom = row.tableSymptom;
-						that.tableManufacturer = row.tableManufacturer;
-						that.stationcn = row.stationcn;
-
-						that.tableCategory = row.tableCategory;
-						that.tableRemark = row.tableRemark;
-						that.tableFaultcode = row.tableFaultcode;
-						that.tableId = row.tableId;
-						that.tableSymptomcode = row.tableSymptomcode;
-						that.tableStationen = row.tableStationen;
-					});
-					that.isvisiable = true;
-				}
-				if ("config" == e.target.getAttribute("value")) { //传感点
-					that.time = [that.st - (3600 * 1000), that.st];
-					that.point =[row.point];
-					that.pointdes = [row.pointdes];
-					that.requestDetailData(that.point,that.pointdes,that.time,that.selectValue);
-					that.yssjDialog=true;
-				}
-			},
-			onClickDialogClose() { // 弹窗右上角关闭按钮
-				this.isvisiable = false;
-				this.isvisiableType = 1;
-			},
-			dialogSave() {
-				let that = this;
-				that.tableTime[0] = that.formatDate(that.tableTime[0].valueOf());
-				that.tableTime[1] = that.formatDate(that.tableTime[1].valueOf());
-				console.log(that.tableTime)
-				that.API.requestData({
-					method: "POST",
-					baseURL: "http://192.168.1.18:9002/",
-					headers: {
-						'Content-Type': 'application/json;charset=utf-8',
-					},
-					subUrl: "case/item/edit",
-					body: {
-						category: that.tableCategory,
-						endtime: that.tableTime[1],
-						faultcode: that.tableFaultcode,
-						faulttype: that.windturbinename,
-						id: that.tableId,
-						manufacturer: that.tableManufacturer,
-						model: that.tableModel,
-						remark: that.tableRemark,
-						starttime: that.tableTime[0],
-						stationen: that.tableStationen,
-						symptom: that.tableSymptom,
-						symptomcode: that.tableSymptomcode,
-						tag: that.widget == "正样本" ? 0 : 1,
-						windturbineid: that.stationcn
-					},
-					success(res) {
-						if (res.code == 200) {
-							that.BASE.showMsg({
-								type: "success",
-								msg: "保存成功",
-							});
-							that.onClickDialogClose();
-							that.list();
-						}
-					},
-				});
-			},
-			gzCgdClick(data) {
-				this.gzCgd = data;
-			},
-			formatDate(dates) {
-				var date = new Date(dates);
-				var YY = date.getFullYear() + '-';
-				var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
-				var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
-				var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
-				var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
-				var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
-				return YY + MM + DD + " " + hh + mm + ss;
 			},
 			list(data) {
-				console.log(data)
 				var that = this;
 				that.tableData.data = [];
 				if (data.length) {
@@ -590,199 +203,103 @@
 							pointdes: data[i].pointdes,
 							model: data[i].model,
 							stationcn: data[i].stationcn,
-							
 						};
 						that.tableData.data.push(obj);
 					}
+					that.requestDetailData([data[0].point], [data[0].pointdes], [Date.parse(new Date(that.time[0])), Date.parse(
+						new Date(that.time[1]))], that.selectValue);
 				}
-				
-				
-				// let station = '',
-				// 	widget = ''
-				// if (typeof that.time[0].valueOf() != 'string') {
-				// 	that.time[0] = that.formatDate(that.time[0].valueOf())
-				// }
-				// if (typeof that.time[1].valueOf() != 'string') {
-				// 	that.time[1] = that.formatDate(that.time[1].valueOf())
-				// }
-				// if (typeof that.station.valueOf() == 'string') {
-				// 	that.ChangZhan.forEach(ele => {
-				// 		if (ele.name == that.station) {
-				// 			station = ele.id
-				// 		}
-				// 	})
-				// }
-				// if (typeof that.widget.valueOf() == 'string') {
-				// 	that.BuJian.forEach(ele => {
-				// 		if (ele.label == that.widget) {
-				// 			widget = ele.value
-				// 		}
-				// 	})
-				// }
-				// if (that.model.length == 0) {
-				// 	that.BASE.showMsg({
-				// 		type: "warning",
-				// 		msg: "请选择风机型号",
-				// 	});
-				// 	return
-				// }
-				// if (that.widget.length == 0) {
-				// 	that.BASE.showMsg({
-				// 		type: "warning",
-				// 		msg: "请选择部件",
-				// 	});
-				// 	return
-				// }
-				// that.API.requestData({
-				// 	showLoading: true,
-				// 	method: "GET",
-				// 	baseURL: "http://192.168.1.18:9002/",
-				// 	subUrl: "case/fault/all",
-				// 	data: {
-				// 		widget: widget ? widget : that.widget,
-				// 		station: station ? station : that.station,
-				// 		model: that.model,
-				// 		st: that.time[0].valueOf(),
-				// 		et: that.time[1].valueOf()
-				// 	},
-				// 	success(res) {
-				// 		if (res.code == 200) {
-				// 			console.log(res)
-				// 			that.tableData.data = [];
-				// 			if (res.data.length) {
-				// 				let data = res.data;
-				// 				for (var i = 0; i < data.length; i++) {
-				// 					let obj = {
-				// 						index: i + 1,
-				// 						widget: data[i].tag == 0 ? '正样本' : '负样本',
-				// 						windturbinename: data[i].faulttype,
-				// 						tableModel: data[i].model,
-				// 						tableTime: data[i].starttime + ' - ' + data[i].endtime,
-				// 						tableSymptom: data[i].symptom,
-				// 						tableManufacturer: data[i].manufacturer,
-				// 						stationcn: data[i].windturbineid,
-
-				// 						tableCategory: data[i].category,
-				// 						tableRemark: data[i].remark,
-				// 						tableFaultcode: data[i].faultcode,
-				// 						tableId: data[i].id,
-				// 						tableSymptomcode: data[i].symptomcode,
-				// 						tableStationen: data[i].stationen
-				// 					};
-				// 					that.tableData.data.push(obj);
-				// 				}
-				// 			}
-				// 		}
-				// 	},
-				// });
 			},
-			back() {
-				this.clearDb();
-				this.$emit('gzCgdClick', 1);
-			},
-			switchChange(interval,status) {
-			  if(status === 'interval') {
-			    this.chooseStatus = false
-			    this.selectValue = '60'
-			  }else if(status === 'original'){
-			    this.chooseStatus = true
-			  }
-			  // this.requestDetailData(
-			  //     this.wpvalue,
-			  //     this.startdate,
-			  //     this.enddate,
-			  //     interval,
-			  //     this.wtId,
-			  //     this.descName
-			  //   );
+			switchChange(interval, status) {
+				if (status === 'interval') {
+					this.chooseStatus = false
+					this.selectValue = '60'
+				} else if (status === 'original') {
+					this.chooseStatus = true
+				}
 			},
-			requestDetailData(point, pointdes, time,interval) {
-			    let that = this;
+			requestDetailData(point, pointdes, time, interval) {
+				let that = this;
 				let Powertrend = [];
-				pointdes.forEach((ele,index)=>{
+				let dataPoint = '';
+				pointdes.forEach((ele, index) => {
 					Powertrend.push({
-						title:ele,
+						title: ele,
 						smooth: true,
 						value: [],
 					})
 				})
-				point.forEach((ele,index)=>{
-					that.API.requestData({
-						method: "GET",
-						baseURL: "http://192.168.1.18:9002/",
-						subUrl: "point/item",
-						data:{
-							point:ele,
-							startTs:time[0],
-							endTs:time[1],
-							interval:interval
-						},
-						success(res) {
-							if(res.data){
-							  res.data.forEach((cEle) => {
-								Powertrend[index].value.push({
-								  text: new Date(cEle.ts).formatDate("hh:mm"),
-								  value: cEle.doubleValue,
-								});
-							  });
-							  if((point.length - 1) == index){
-								that.Powertrend = Powertrend;
-							  }
-							}
-						},
-					});
+				point.forEach((ele, index) => {
+					dataPoint += ele + ','
 				})
-				
-			},
-			queryYssj(){
-				this.requestDetailData(this.point,this.pointdes,[Date.parse(new Date(this.time[0])), Date.parse(new Date(this.time[1]))],this.selectValue);
+				dataPoint = dataPoint.slice(0, dataPoint.length - 1)
+				that.API.requestData({
+					showLoading: true,
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "point/item",
+					data: {
+						point: dataPoint,
+						startTs: time[0],
+						endTs: time[1],
+						interval: interval
+					},
+					success(res) {
+						if (res.data) {
+							res.data.forEach((ele, index) => {
+								ele.list.forEach(cEle => {
+									Powertrend[index].value.push({
+										text: new Date(cEle.ts).formatDate("hh:mm"),
+										value: cEle.doubleValue,
+									});
+								})
+							});
+							that.Powertrend = Powertrend;
+						}
+					},
+				});
 			},
 			dbfx() {
-			  var that = this;
-			  if (that.point.length <=5) {
-				  that.Powertrend = [];
-				  that.time = [that.st - (3600 * 1000), that.st];
-				  that.requestDetailData(that.point,that.pointdes,[Date.parse(new Date(that.time[0])), Date.parse(new Date(that.time[1]))],that.selectValue);
-			    that.yssjDialog = true;
-			    that.clearDb();
-			  }
+				var that = this;
+				if (that.point.length <= 5 && that.point.length != 0) {
+					that.Powertrend = [];
+					that.requestDetailData(that.point, that.pointdes, [Date.parse(new Date(that.time[0])), Date.parse(
+						new Date(that.time[1]))], that.selectValue);
+				}else{
+					this.BASE.showMsg({
+						type: "warning",
+						msg: "请选择测点后再对标",
+					});
+					return
+				}
 			},
-			clearDb() {
-			  //清空对标状态
-			  this.$refs.curRef.clearCheckBox();
-			  this.point = [];
-			  this.pointdes = [];
-			  this.checkLength = 0;
+			clearDb() { //清空对标状态
+				this.$refs.curRef.clearCheckBox();
+				this.point = [];
+				this.pointdes = [];
+				this.checkLength = 0;
 			},
 		},
 		created() {
-			this.list(this.data)
+			this.list(this.data);
 		},
 		watch: {
-			station(res) {
-				let fjxh = [];
-				this.fjxhArr.forEach(ele => {
-					if (ele.id == res) {
-						ele.value.forEach(ele2 => {
-							fjxh.push({
-								label: ele2,
-								value: ele2
-							})
-						})
-						this.model = ele.value;
-					}
-				})
-				this.fjxh = fjxh;
-				this.queryType = true;
-			},
-			widget() {
-				this.queryType = true;
+			selectValue() {
+				this.requestDetailData(this.point, this.pointdes, [Date.parse(new Date(this.time[0])), Date.parse(new Date(
+					this.time[1]))], this.selectValue);
 			},
-			model() {
-				this.queryType = true;
-			},
-			time() {
-				this.queryType = true;
+			time(e) {
+				let st = Date.parse(new Date(e[0])),
+					et = Date.parse(new Date(e[1]));
+				if((et - st) > (86400000 * 7)){//判断选择日期区间大于一周则重新选择
+					this.BASE.showMsg({
+						type: "warning",
+						msg: "请选择小于7天的日期区间",
+					});
+					return
+				}
+				this.requestDetailData(this.point, this.pointdes, [Date.parse(new Date(this.time[0])), Date.parse(new Date(
+					this.time[1]))], this.selectValue);
 			},
 		},
 	};

+ 416 - 18
src/views/sampleDatabase/performance/index.vue

@@ -1,26 +1,424 @@
 <template>
-  <el-scrollbar :height="height"> </el-scrollbar>
+	<el-scrollbar height="92vh">
+		<div class="query mg-b-8">
+			<div class="query-items">
+				<div class="query-item" style="width:200px">
+					<div class="lable">场站:</div>
+					<div class="search-input">
+						<el-select v-model="station" placeholder="请选择" popper-class="select">
+							<el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item" style="width:200px">
+					<div class="lable">样本类型:</div>
+					<div class="search-input">
+						<el-select v-model="yblx" placeholder="请选择样本" popper-class="select">
+							<el-option v-for="item in yblxArr" :key="item.value" :value="item.value"
+								:label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item" style="width:200px">
+					<div class="lable">模型:</div>
+					<div class="search-input">
+						<el-select v-model="model" collapse-tags placeholder="请选择"
+							popper-class="select">
+							<el-option v-for="item in models" :key="item.value" :value="item.value" :label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item" style="width:250px">
+					<div class="lable">时间间隔:</div>
+					<div class="search-input">
+						<el-select v-model="interval" collapse-tags clearable placeholder="请选择"
+							popper-class="select">
+							<el-option v-for="item in intervals" :key="item.value" :value="item.value" :label="item.label">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">时间:</div>
+					<div class="search-input">
+						<el-date-picker v-model="time" type="datetimerange" range-separator="至" start-placeholder="开始日期"
+							end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
+				</div>
+				<div class="query-actions">
+					<button class="btn" @click="list">查询</button>
+					<button class="btn" @click="dbfx">对比</button>
+				</div>
+			</div>
+		</div>
+		<el-row :type="'flex'" class="content">
+			<ComTable :data="tableData" height="70vh" v-loading="tableLoading" element-loading-text="拼命加载中"
+				element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
+		</el-row>
+		<el-dialog title="数据对比" v-model="dialog" width="90%" top="10vh" custom-class="modal"
+			:close-on-click-modal="false" :before-close="onClickDialogClose" class="isvisiable">
+			<scatter-line-chart :lineData="scatterLineData.lineData" :data="scatterLineData.data" xTitle="风速"
+				yTitle="功率" :height="'70vh'" />
+		</el-dialog>
+	</el-scrollbar>
 </template>
 
 <script>
-export default {
-  components: {},
-  data() {
-    return {};
-  },
-  props: {
-    currTab: {
-      type: Number,
-    },
-    height: {
-      type: String,
-    },
-  },
-  methods: {},
-  created() {},
-  mounted() {},
-};
+	import ComTable from "@/components/coms/table/table.vue";
+	import ScatterLineChart from "@/components/chart/combination/scatter-line-chart.vue";
+	import BASE from "@tools/basicTool.js";
+	export default {
+		components: {
+			ComTable,
+			ScatterLineChart,
+		},
+		data() {
+			const that = this;
+			return {
+				scatterLineData: {
+					data: [{
+							title: "1",
+							value: [
+								[14.49, 337.0],
+								[5.78, 368.0],
+								[5.08, 247.0],
+								[4.79, 171.0],
+								[4.05, 120.0],
+							],
+						},
+						{
+							title: "2",
+							value: [
+								[14.49, 37.0],
+								[5.78, 68.0],
+								[5.08, 47.0],
+								[4.79, 71.0],
+								[4.05, 20.0],
+							],
+						},
+					],
+					lineData: {
+						xTitle: "风速",
+						yTitle: "功率",
+						legends: [],
+						data: [
+							[80.67, 48.38, 65, 95.84, 71.84],
+							[93.67, 98.38, 165, 295.84, 471.84],
+						],
+					},
+				},
+				ids: [],
+				checkLength: 0, //对标分析只能选择5个
+				yblx: 0,
+				yblxArr: [{
+						label: '正样本',
+						value: 0
+					},
+					{
+						label: '负样本',
+						value: 1
+					}
+				],
+				dialog: false, //传感点组件隐藏或显示
+				ChangZhan: [],
+				fjxh: [],
+				fjxhArr: [],
+				// 模型
+				model: 0,
+				models: [
+					{
+						label: '欠发矩阵模型',
+						value: 0
+					}
+				],
+				// 时间间隔
+				interval: "0-0.5",
+				intervals: [//和明华有约定,必须这么写
+					{
+						label: '小于30分钟',
+						value: "0-0.5"
+					},
+					{
+						label: '30分钟-1小时',
+						value: "0.5-1"
+					},
+					{
+						label: '1小时-2小时',
+						value: "1-2"
+					},
+					{
+						label: '2小时-5小时',
+						value: "2-5"
+					},
+					{//42天
+						label: '大于5小时',
+						value: "5-1008"
+					}
+				],
+				time: [],
+				station: '',
+				tableData: {
+					column: [
+						{
+							name: "",
+							field: "check",
+							is_light: false,
+							width: '50px',
+							template: function() {
+								return "<input class='check curCheckBox' type='CheckBox'/>";
+							},
+							click: function(event, data) {
+								let id = data.id;
+								if (event.target.checked == false && that.checkLength <= 5) {
+									that.ids.forEach((item, i) => {
+										if (item == id) {
+											that.ids.splice(i, 1);
+										}
+									});
+									that.checkLength--;
+								} else if (event.target.checked && that.checkLength < 5) {
+									that.ids.push(id);
+									that.checkLength++;
+								} else if (that.checkLength == 5) {
+									event.target.checked = false;
+								}
+							},
+						},
+						{
+							name: "序号",
+							field: "index",
+							is_light: false,
+							width: '100px',
+						},
+						{
+							name: "样本类型",
+							field: "tag",
+							is_light: false,
+							width: '150px',
+						},
+						{
+							name: "风机编号",
+							field: "windturbineid",
+							is_light: false,
+							width: '250px',
+						},
+						{
+							name: "开始时间",
+							field: "starttime",
+							is_light: false,
+							width: '350px',
+						},
+						{
+							name: "结束时间",
+							field: "endtime",
+							is_light: false,
+							width: '350px',
+						},
+						{
+							name: "操作",
+							field: "cz",
+							is_light: false,
+							width: '200px',
+							template: () => {
+								return (
+									"<el-button type='text' style='cursor: pointer;' value='config'>查看</el-button>&nbsp"
+								);
+							},
+							click(e, row) {
+								that.onClickOption(e, row);
+							},
+						},
+					],
+					data: [],
+				},
+			};
+		},
+		methods: {
+			async startAjax() {
+				var that = this;
+				that.time = [new Date((new Date() - (3600 * 24 * 1000 * 30))).formatDate("yyyy-MM-dd hh:mm:ss"),
+					new Date().formatDate("yyyy-MM-dd hh:mm:ss")
+				];
+				await that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.4:9001/",
+					subUrl: "benchmarking/wplist",
+					success(res) {
+						that.ChangZhan = res.data;
+						that.station = res.data[0].name
+					},
+				});
+
+				// await that.API.requestData({
+				// 	method: "GET",
+				// 	baseURL: "http://192.168.1.18:9002/",
+				// 	subUrl: "basic/station/all",
+				// 	success(res) {
+				// 		let fjxhArr = [];
+				// 		let model = [],
+				// 			fjxh = [];
+				// 		res.data.forEach(ele => {
+				// 			fjxhArr.push({
+				// 				id: ele.id,
+				// 				value: ele.model.split("/")
+				// 			})
+				// 			if (ele.id == "MHS_FDC") {
+				// 				model = ele.model.split("/");
+				// 				model.forEach(ele => {
+				// 					fjxh.push({
+				// 						label: ele,
+				// 						value: ele
+				// 					})
+				// 				})
+				// 			}
+				// 		})
+				// 		that.fjxhArr = fjxhArr;
+				// 		that.model = model;
+				// 		that.fjxh = fjxh;
+				// 	},
+				// });
+				that.list()
+			},
+			onClickOption(e, row) { // 操作按钮
+				if ("config" == e.target.getAttribute("value")) { //查看
+					this.chart([row.id]);
+				}
+			},
+			chart(ids) {
+				const that = this;
+				BASE.showLoading({ text:"加载中..." });
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "case/performance/scatter",
+					data: {
+						id: ids,
+						interval: 30
+					},
+					success(res) {
+						if (res.code == 200) {
+							let data = res.data,
+								keys = Object.keys(data),
+								fs = [],
+								zs = [],
+								dotData = [];
+							keys.forEach(ele => {
+								let keyId = ele.split('_')[1],
+									dataType = ele.slice(0, 1);
+								ids.forEach(ele2 => {
+									if (ele2 == keyId && dataType == 'C') {
+										data[ele].forEach(ele3 => {
+											fs.push(ele3.fs)
+											zs.push(ele3.zs)
+										})
+									} else if (ele2 == keyId && dataType == 'S') {
+										dotData.push({
+											title: keyId,
+											value: data[ele]
+										})
+									}
+								})
+							})
+							that.scatterLineData.data = dotData;
+							that.scatterLineData.lineData.data = [fs, zs];
+							BASE.closeLoading();
+							that.dialog = true;
+						}
+					},
+				});
+			},
+			dbfx() {
+				var that = this;
+				if (that.ids.length <= 5 && that.ids.length != 0) {
+					that.chart(that.ids);
+				} else {
+					this.BASE.showMsg({
+						type: "warning",
+						msg: "请选择测点后再对比",
+					});
+					return
+				}
+			},
+			list() {
+				var that = this;
+				let station = '';
+				if (typeof that.time[0].valueOf() != 'string') {
+					that.time[0] = that.formatDate(that.time[0].valueOf())
+				}
+				if (typeof that.time[1].valueOf() != 'string') {
+					that.time[1] = that.formatDate(that.time[1].valueOf())
+				}
+				if (typeof that.station.valueOf() == 'string') {
+					that.ChangZhan.forEach(ele => {
+						if (ele.name == that.station) {
+							station = ele.id
+						}
+					})
+				}
+				that.API.requestData({
+					showLoading: true,
+					method: "GET",
+					baseURL: "http://192.168.1.18:9002/",
+					subUrl: "case/performance/list",
+					data: {
+						tag: that.yblx,
+						stationen: station ? station : that.station,
+						model: that.model,
+						interval: that.inverval,
+						starttime: that.time[0].valueOf(),
+						endtime: that.time[1].valueOf()
+					},
+					success(res) {
+						if (res.code == 200) {
+							if (res.data.length) {
+								let data = res.data;
+								that.tableData.data = [];
+								for (var i = 0; i < data.length; i++) {
+									let obj = {
+										index: i + 1,
+										tag: data[i].tag == 0 ? '正样本' : '负样本',
+										windturbineid: data[i].windturbineid,
+										starttime: data[i].starttime,
+										endtime: data[i].endtime,
+										id: data[i].id
+									};
+									that.tableData.data.push(obj);
+								}
+							}
+						}
+					},
+				});
+			},
+		},
+		created() {
+			this.startAjax();
+		},
+		watch: {
+			station(res) {
+				let fjxh = [];
+				this.fjxhArr.forEach(ele => {
+					if (ele.id == res) {
+						ele.value.forEach(ele2 => {
+							fjxh.push({
+								label: ele2,
+								value: ele2
+							})
+						})
+						this.model = ele.value;
+					}
+				})
+				this.fjxh = fjxh;
+			}
+		},
+	};
 </script>
 
 <style lang="less" scoped>
+	.el-select.w {
+		width: 100%;
+	}
 </style>

+ 476 - 19
src/views/sampleDatabase/warning/index.vue

@@ -1,26 +1,483 @@
 <template>
-  <el-scrollbar :height="height"> </el-scrollbar>
+	<div class="knowledge-2">
+		<div class="query mg-b-8">
+			<div class="query-items">
+				<div class="query-item">
+					<div class="lable">场站:</div>
+					<div class="search-input">
+						<el-select v-model="wpId" clearable placeholder="请选择" popper-class="select">
+							<el-option v-for="item in wpArray" :key="item.id" :value="item.id" :label="item.name" />
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">预警分类:</div>
+					<div class="search-input">
+						<el-select v-model="wtId" clearable collapse-tags multiple placeholder="请选择"
+							popper-class="select">
+							<el-option label="全选" :class="active?'selected':''" @click="checkAll"/>
+							<el-option v-for="(item ,index) in wtIdArr" :key="index" :value="item" :label="item" />
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item" style="width: 445px;">
+					<div class="lable">日期:</div>
+					<div class="search-input">
+						<el-date-picker v-model="month" type="datetimerange" range-separator="至" start-placeholder="开始日期"
+							end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
+				</div>
+				<div class="query-actions">
+					<button class="btn" @click="query">查询</button>
+					<button class="btn" @click="">导入</button>
+					<button class="btn" @click="export">导出</button>
+				</div>
+			</div>
+		</div>
+		<el-row :type="'flex'" class="content">
+			<el-col :span="24">
+				<ComTable :data="tableData" height="85vh"></ComTable>
+			</el-col>
+		</el-row>
+
+		<el-dialog :title="yssjTitle" v-model="yssjDialog" width="70%" top="15vh" custom-class="modal"
+			:close-on-click-modal="false" :before-close="yssjDialogClose">
+			<div class="query mg-b-8">
+				<div class="query-items">
+					<div class="query-item">
+						<div class="lable">等间隔:</div>
+						<div class="search-input">
+							<el-select v-if="!chooseStatus" @change="switchChange(selectValue)" class="inputs"
+								v-model="selectValue" placeholder="请选择">
+								<el-option v-for="item in timeoptions" :key="item.value" :label="item.label"
+									:value="item.value">
+								</el-option>
+							</el-select>
+						</div>
+					</div>
+					<div class="query-actions">
+						<button class="btn" @click="queryYssj">查询</button>
+					</div>
+				</div>
+			</div>
+
+			<el-row type="flex">
+				<multiple-y-line-chart-normal height="500px" :list="Powertrend" :showLegend="true" />
+			</el-row>
+		</el-dialog>
+	</div>
 </template>
 
 <script>
-export default {
-  components: {},
-  data() {
-    return {};
-  },
-  props: {
-    currTab: {
-      type: Number,
-    },
-    height: {
-      type: String,
-    },
-  },
-  methods: {},
-  created() {},
-  mounted() {},
-};
+	import ComTable from "@com/coms/table/table.vue";
+	import MultipleYLineChartNormal from "../../NewPages/multiple-y-line-chart-normal.vue";
+	import BASE from "@tools/basicTool.js";
+	export default {
+		components: {
+			ComTable,
+			MultipleYLineChartNormal
+		},
+		data() {
+			let that = this;
+			return {
+				active: true,
+				selectAll: true,
+				Powertrend: [],
+				selectValue: "60",
+				timeoptions: [{
+						value: "60",
+						label: "一分钟",
+					},
+					{
+						value: "300",
+						label: "五分钟",
+					},
+					{
+						value: "600",
+						label: "十分钟",
+					},
+					{
+						value: "1800",
+						label: "三十分钟",
+					},
+					{
+						value: "3600",
+						label: "一小时",
+					},
+					{
+						value: "86400",
+						label: "一天",
+					},
+				],
+				yssjDialog: false,
+				yssjData:{},
+				month: [],
+				wpId: "MHS_FDC",
+				wpArray: [],
+				wpName: "",
+				wtId: [],
+				// wtIdArr: ['发电机','变桨系统','测风系统','齿轮箱','液压系统','偏航系统','机舱','传动链'],
+				wtIdArr: [],
+				wtidData: [],
+				wtIdNum: false,
+				tableDataArr: {},
+				tableData: {
+					column: [{
+							name: "序号",
+							field: "index",
+							is_num: false,
+							is_light: false,
+							width: "60px"
+						},
+						{
+							name: "风机编号",
+							field: "fjbh",
+							is_num: false,
+							is_light: false,
+							width: "150px"
+						},
+						{
+							name: "预警分类",
+							field: "yjfl",
+							is_num: false,
+							is_light: false,
+						},
+						{
+							name: "预警描述",
+							field: "yjms",
+							is_num: false,
+							is_light: false,
+						},
+						{
+							name: "预警次数(次)",
+							field: "yjcs",
+							is_num: false,
+							is_light: false,
+							sortable: true,
+							width: "150px"
+						}, {
+							name: "预警时长(分钟)",
+							field: "yjsc",
+							is_num: false,
+							is_light: false,
+							sortable: true,
+							width: "150px"
+						}, {
+							name: "操作",
+							field: "cz",
+							is_num: false,
+							is_light: false,
+							width: "150px",
+							template: function() {
+								return "<a class='action'>原始数据</a>";
+							},
+							click: function(event, data) {
+								that.yssjTitle = data.yjms;
+								that.requestDetailData(that.wpId, data.fjbh, data.yjms, that.month);
+							},
+						},
+					],
+					data: [],
+				},
+			};
+		},
+		created() {
+			this.getWp();
+			this.month = [new Date((new Date() - 3600 * 1000 * 24 * 30)), new Date()];
+			this.requestSafeList();
+		},
+		methods: {
+			requestDetailData(wpId, fjbh, yjms, time) {
+				let that = this;
+				that.yssjData = {
+					wpId:wpId, 
+					fjbh:fjbh, 
+					yjms:yjms, 
+					time:time
+				};
+				BASE.showLoading();
+				that.API.requestData({
+					method: "GET",
+					subUrl: "/analysis/detail",
+					data: {
+						station: wpId,
+						startTs: new Date(new Date(time[0]).formatDate("yyyy/MM/dd")).getTime(),
+						endTs: new Date(new Date(time[1]).formatDate("yyyy/MM/dd")).getTime(),
+						interval: that.selectValue,
+						wtId: fjbh,
+						name: yjms
+					},
+					success(res) {
+						if (res.data.length != 0) {
+							let Powertrend = [];
+							res.data.forEach((cEle, index) => {
+								Powertrend.push({
+									title: cEle.name,
+									smooth: true,
+									value: [],
+								})
+								cEle.data.forEach((rEle) => {
+									Powertrend[index].value.push({
+										text: new Date(rEle.ts).formatDate("hh:mm"),
+										value: rEle.doubleValue
+									});
+								});
+							});
+							if (Powertrend.length != 0) {
+								that.Powertrend = Powertrend;
+								BASE.closeLoading();
+								that.yssjDialog = true;
+							}
+						} else {
+							BASE.closeLoading();
+							that.BASE.showMsg({
+								msg: "暂无数据"
+							});
+						}
+					},
+				});
+			},
+			queryYssj() {
+				let data = this.yssjData;
+				this.requestDetailData(data.wpId, data.fjbh, data.yjms, data.time)
+			},
+			switchChange(interval, status) {
+				if (status === 'interval') {
+					this.chooseStatus = false
+					this.selectValue = '60'
+				} else if (status === 'original') {
+					this.chooseStatus = true
+				}
+			},
+			formatDate(date) {
+				var date = new Date(date);
+				var YY = date.getFullYear() + '-';
+				var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+				var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+				return YY + MM + DD;
+			},
+			// 获取风场
+			getWp() {
+				let that = this;
+				that.API.requestData({
+					baseURL: "http://10.155.32.4:8082/",
+					subUrl: "powercompare/windfarmAjax",
+					success(res) {
+						that.wpArray = res.data;
+						that.wpId = res.data[0].id;
+						that.wpName = res.data[0].wpName;
+					}
+				});
+			},
+			// 获取停机事件
+			requestSafeList() {
+				let that = this;
+				// if (wtIdData) {
+				// 	that.tableData.data = wtIdData;
+				// 	that.wtIdData = [];
+				// 	return;
+				// }
+				// if (wpId) {
+				// 	that.wpId = wpId;
+				// }
+				that.month[0] = that.formatDate(that.month[0].valueOf())
+				that.month[1] = that.formatDate(that.month[1].valueOf())
+				let data = {
+					stationid: that.wpId,
+					startdate: that.month[0].valueOf(),
+					enddate: that.month[1].valueOf(),
+				};
+				that.API.requestData({
+					showLoading: true,
+					baseURL: "http://192.168.1.18:8075/",
+					subUrl: "alarm/count/query/new",
+					data,
+					success(res) {
+						if (res.code == 200) {
+							that.tableData.data = [];
+							if (res.data.length) {
+								let data = res.data;
+								let tabData = [];
+								let index = 1;
+								let wtIdArr = [];
+								data.forEach((ele, idx) => {
+									let key = Object.keys(ele);
+									ele[key].forEach((ele2, idx2) => {
+										if (ele2.time != 0 && ele2.count >= 10) { //过滤条件
+											let obj = {
+												index: index++,
+												fjbh: ele2.windturbineId,
+												yjfl: ele2.relatePartsText,
+												yjms: ele2.alertText,
+												yjcs: ele2.count,
+												yjsc: ele2.time,
+											};
+											tabData.push(obj);
+											let result = wtIdArr.some(ele4=>{
+												return ele2.relatePartsText === ele4
+											})
+											if(result == false){
+												wtIdArr.push(ele2.relatePartsText)
+											}
+										}
+									})
+								})
+								that.wtIdArr = wtIdArr;
+								that.wtId = wtIdArr;
+								that.tableData.data = tabData;
+								that.tableDataArr = {
+									column: that.tableData.column,
+									data: tabData
+								};
+							}
+						}
+					},
+				});
+			},
+			query() {
+				this.requestSafeList();
+			},
+			checkAll() {
+				this.selectAll = !this.selectAll
+				if (this.selectAll) {
+					this.wtId = this.wtIdArr;
+					this.active = true;
+				} else {
+					this.active = false;
+					this.wtId = [];
+				}
+			},
+			formatJson(filterVal, jsonData) {
+				return jsonData.map(v => filterVal.map(j => v[j]));
+			},
+			export() {
+				let that = this;
+				const {export_json_to_excel} = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
+				let tHeader = []; // 上面设置Excel的表格第一行的标题       
+				let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
+			
+				that.tableData.column.forEach(ele => {
+					if(ele.field != 'cz'){
+						tHeader.push(ele.name);
+						filterVal.push(ele.field);
+					}
+				});
+				const data = that.formatJson(filterVal, that.tableData.data);
+				export_json_to_excel(tHeader, data, '预警分析'); // 最后一个是表名字
+			},
+		},
+		watch: {
+			wpId() {
+				this.wtidData = undefined;
+				this.wtIdNum = false;
+			},
+			wtId(e) {
+				if (this.wtIdNum) {
+					let data = [];
+					let index = 1;
+					let tableDataArr = this.tableDataArr;
+					tableDataArr.data.forEach(ele => {
+						e.forEach(ele2 => {
+							if (ele.yjfl == ele2) {
+								let obj = {
+									index: index++,
+									fjbh: ele.fjbh,
+									yjfl: ele.yjfl,
+									yjms: ele.yjms,
+									yjcs: ele.yjcs,
+									yjsc: ele.yjsc,
+								};
+								data.push(obj)
+							}
+						})
+					})
+					if (data) {
+						this.tableData.data = data;
+						// this.wtidData = data;
+					}
+				}
+				this.wtIdNum = true;
+			},
+			// month(e) {
+			// 	this.month = [new Date((e - 3600 * 1000 * 24 * 30)), e];
+			// }
+		}
+	};
 </script>
 
-<style lang="less" scoped>
+<style lang="less" scope>
+	@titleGray: #9ca5a8;
+	@rowGray: #606769;
+	@darkBack: #536268;
+
+	.knowledge-2 {
+		.el-select {
+			width: 200px;
+		}
+
+		.action {
+			text-decoration: underline;
+			color: @green;
+			cursor: pointer;
+		}
+
+		.el-input {
+			width: 200px;
+		}
+	}
+</style>
+<style type="text/css">
+	.el-month-table td.today .cell {
+		color: #05bb4c;
+	}
+
+	.el-month-table td.end-date .cell,
+	.el-month-table td.start-date .cell {
+		background-color: #05bb4c;
+	}
+
+	.el-month-table td.in-range div,
+	.el-month-table td.in-range div:hover {
+		background: rgba(96, 103, 105, 0.4);
+	}
+
+	.el-date-editor.el-date-editor--monthrange {
+		border: 1px solid rgba(96, 103, 105, 0.2);
+		height: 33px;
+		padding: 0 8px;
+		width: 369px;
+	}
+
+	.el-date-editor.el-date-editor--monthrange .el-range-separator {
+		color: #B3BDC0;
+		line-height: 33px;
+	}
+
+	.el-date-editor.el-date-editor--monthrange .el-range-input {
+		flex-basis: 145px;
+		line-height: 33px;
+		background: transparent;
+		color: #B3BDC0;
+	}
+
+	.el-picker-panel.el-date-picker {
+		background: transparent;
+		color: #B3BDC0;
+	}
+
+	.el-picker-panel.el-date-picker td.current .cell {
+		background-color: #05bb4c;
+		color: white;
+	}
+
+	.el-picker-panel.el-date-picker td .cell:hover {
+		color: #05bb4c;
+	}
+
+	.el-picker-panel.el-date-picker td.current div,
+	.el-picker-panel.el-date-picker td.current div:hover {
+		background: rgba(96, 103, 105, 0.4);
+		border-radius: 50px;
+	}
 </style>

+ 220 - 0
src/views/warn/gfgj.vue

@@ -0,0 +1,220 @@
+<template>
+	<div>
+		<div class="query mg-b-8">
+			<div class="query-items">
+				<div class="query-item">
+					<div class="lable">光伏:</div>
+					<div class="search-input">
+						<el-select v-model="wpId" clearable placeholder="请选择" popper-class="select" @change=" (wpId) => { Windturbines(); } ">
+							<el-option v-for="item in ChangZhan" :key="item.id" :value="item.id" :label="item.name"></el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">机组:</div>
+					<div class="search-input">
+						<el-select v-model="wtId" placeholder="请选择" popper-class="select">
+							<el-option v-for="item in windturbines" :key="item.id" :label="item.name" :value="item.id">
+							</el-option>
+						</el-select>
+					</div>
+				</div>
+				<div class="query-item">
+				  <div class="lable">描述:</div>
+				  <div class="search-input">
+				    <el-input v-model="alarmDesc" placeholder="报警描述"></el-input>
+				  </div>
+				</div>
+				<div class="query-item">
+					<div class="lable">开始日期:</div>
+					<div class="search-input">
+						<el-date-picker v-model="startDate" type="datetime" placeholder="开始日期"
+							popper-class="date-select" value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
+					</div>
+				</div>
+				<div class="query-item">
+					<div class="lable">结束日期:</div>
+					<div class="search-input">
+						<el-date-picker v-model="endDate" type="datetime" placeholder="开始日期" popper-class="date-select"
+							value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
+					</div>
+				</div>
+				<div class="query-actions">
+					<button class="btn green" @click="getTable()">查询</button>
+					<button class="btn green" @click="exportExcel()">导出</button>
+				</div>
+			</div>
+		</div>
+		<div class="table-box">
+			<div class="title">光伏告警</div>
+			<ComTable ref="curRef" :data="tableData" :pageSize="20" @onPagging="onChangePage" @sizeChange="sizeChange"
+				@pageClick="pageClick" height="68vh" v-loading="tableLoading" element-loading-text="拼命加载中.."
+				element-loading-background="rgba(0, 0, 0, 0.8)"></ComTable>
+		</div>
+	</div>
+</template>
+<script>
+	import ComTable from "@/components/coms/table/table.vue";
+
+	export default {
+		components: {
+			ComTable
+		},
+		data() {
+			let that = this;
+			return {
+				waitAjax:true,//等待执行完了再加载table
+				ChangZhan: [],
+				wpId: "",
+				wtId: "",
+				windturbines: [],
+				alarmDesc: "",
+				startDate: "",
+				endDate: "",
+				tableLoading: true,
+				pageIndex: 1,
+				pageSize: 20,
+				tableData: {
+					column: [{
+							name: "场站",
+							field: "stationName",
+							is_num: false,
+							is_light: false,
+							id: "id",
+						},
+						{
+							name: "机组",
+							field: "windturbineName",
+							is_num: false,
+							is_light: false,
+							id: "id",
+						},
+
+						{
+							name: "报警时间",
+							field: "alertTime",
+							is_num: false,
+							is_light: false,
+							id: "id",
+						},
+						{
+							name: "报警描述",
+							field: "alertText",
+							is_num: false,
+							is_light: false,
+							id: "id",
+						},
+						{
+							name: "报警类别",
+							field: "category2",
+							is_num: false,
+							is_light: false,
+							id: "id",
+						},
+						{
+							name: "报警等级",
+							field: "messageType",
+							is_num: false,
+							is_light: false,
+							sortable: true,
+							id: "id",
+						},
+					],
+					data: [],
+					currentPageTotal: 0,
+				},
+			};
+		},
+		created() {
+			let end = new Date();
+			let start = new Date(end.getTime() - 1 * 24 * 60 * 60 * 1000);
+			this.endDate = end.formatDate("yyyy-MM-dd hh:mm:ss");
+			this.startDate = start.formatDate("yyyy-MM-dd hh:mm:ss");
+			this.ChangZhanVal();
+		},
+		methods: {
+			// 场站
+			ChangZhanVal() {
+				var that = this;
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.4:9001/benchmarking/wpgflist",
+					success(res) {
+						that.ChangZhan = res.data;
+						that.wpId = res.data[0].id;
+						that.Windturbines(that.wpId)
+						if(that.waitAjax){
+							that.getTable();
+							that.waitAjax=false;
+						}
+					},
+				});
+			},
+			Windturbines(wpId) {
+				let that = this;
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.4:8082/",
+					subUrl: "powercompare/windturbineAjax",
+					data: {
+						wpId: wpId
+					},
+					success(res) {
+						that.windturbines = res.data;
+						that.windturbines.unshift({
+							id: "",
+							name: "请选择"
+						});
+					},
+				});
+			},
+			getTable() {
+				let that = this;
+				this.tableLoading = true;
+				this.API.requestData({
+					timeout: 30000,
+					method: "GET",
+					baseURL: "http://192.168.1.18:8075/",
+					subUrl: "alarm/history/page",
+					data: {
+						category1: "GF",
+						stationid: this.wpId,
+						starttime: this.startDate,
+						endtime: this.endDate,
+						keyword: this.alarmDesc,
+						windturbineid: this.wtId,
+						pagenum: this.pageIndex,
+						pagesize: this.pageSize,
+					},
+					success(res) {
+						if (res.data) {
+							that.tableData.data = res.data.records;
+							that.tableData.total = res.data.total;
+							console.log(that.tableData)
+						} else {
+							that.tableData.data = [];
+							that.tableData.total = 0;
+						}
+						that.tableLoading = false;
+					},
+				});
+			},
+			onChangePage(params) {
+				this.pageIndex = params.pageIndex;
+				this.pageSize = params.pageSize;
+				this.getTable();
+			},
+			exportExcel() {
+				let excelData = this.BASE.deepCopy(this.tableData);
+				this.BASE.exportExcel(excelData, "光伏告警");
+			},
+		},
+	};
+</script>
+<style lang="less">
+	.title {
+		background: rgba(255, 255, 255, 0.1);
+		margin-bottom: 8px;
+		padding: 1vh;
+	}
+</style>