Browse Source

齿轮箱故障诊断【等残差预测记录接口】

wangmengwei@gyee-china.com 3 years ago
parent
commit
e0abe34c9a
1 changed files with 127 additions and 55 deletions
  1. 127 55
      src/views/MalfunctionWarning/diagnose.vue

+ 127 - 55
src/views/MalfunctionWarning/diagnose.vue

@@ -38,17 +38,17 @@
 				<el-row type="flex">
 					<el-col :span="12">
 						<panel title="残差 【模型记录】" :showLine="false">
-							<div style="height: 60vh; overflow-y: auto; margin-top: 30px">
+							<div class="timeLine">
 								<div class="body" v-for="(item, index) in ccS" :key="index">
 									<div class="left">
-										<div :class="index === current ? 'round_on' : 'round'"></div>
+										<div class="round_on"></div>
 										<div class="line"></div>
 									</div>
 									<div class="right">
-										<div>{{ item.showTime }}</div>
+										<div>{{ item.time }}</div>
 										<div class="content">
 											<div class="names">
-												{{ item.showName || item.ducumentName }}
+												{{ item.faultIds }}
 											</div>
 											<button class="btn" @click="deleteDate(item.name)">
 												删除
@@ -60,22 +60,43 @@
 						</panel>
 					</el-col>
 					<el-col :span="12">
-
+						<panel title="油温 【模型记录】" :showLine="false">
+							<div class="timeLine">
+								<div class="body" v-for="(item, index) in ywS" :key="index">
+									<div class="left">
+										<div class="round_on"></div>
+										<div class="line"></div>
+									</div>
+									<div class="right">
+										<div>{{ item.time }}</div>
+										<div class="content">
+											<div class="names">
+												{{ item.faultIds }}
+											</div>
+											<button class="btn" @click="deleteDate(item.name)">
+												删除
+											</button>
+										</div>
+									</div>
+								</div>
+							</div>
+						</panel>
 					</el-col>
 				</el-row>
 
 			</el-col>
 			<el-col :span="12">
 				<panel title="残差 【预测记录】" :showLine="false">
-					<double-line-chart height="35vh" />
+					<double-line-chart height="35vh" :list='ccChart' />
 					<div class="green text">
-						依据月份的模型,油温误差大于0.1,预计在[时间],齿轮箱会发生油温故障
+						依据当前的模型,油温误差大于0.1,预计在[时间],齿轮箱会发生油温故障
 					</div>
 				</panel>
 				<panel title="油温 【预测记录】" :showLine="false">
 					<double-line-chart height="35vh" :list='ywChart' />
 					<div class="green text">
-						预计未来10分钟的油温走势,当前油温: {{ywChartHtml[0]}} ℃,未来10分钟油温:{{ywChartHtml[1]}} ℃ 。
+						预计未来10分钟的油温走势,当前时间为{{new Date(endTs).formatDate("yyyy-MM-dd hh:mm")}},当前油温: {{ywChartHtml[0]}}
+						℃,未来10分钟油温:{{ywChartHtml[1]}} ℃ 。
 					</div>
 				</panel>
 			</el-col>
@@ -107,13 +128,28 @@
 					smooth: true,
 					value: []
 				}],
-				ywChartHtml:[],
+				ywChartHtml: [],
+				ccChart: [{
+					title: "实时油温",
+					smooth: true,
+					value: []
+				}, {
+					title: "油温残差",
+					smooth: true,
+					value: []
+				}, {
+					title: "理论油温",
+					smooth: true,
+					value: []
+				}],
 				startTs: '',
 				endTs: '',
 				date: [],
-				uniformCodes: ['YWCH', 'CI0671', 'LLYW', 'AI041'],
+				uniformCodes: ['CI0671', 'AI041'],
 				interval: null,
-				flag:1
+				flag: 1,
+				ccS: [],
+				ywS: []
 			};
 		},
 		created() {
@@ -124,37 +160,48 @@
 			this.startAjax();
 		},
 		methods: {
-			async history(thingId, uniformCode) {
+			async history(thingId, uniformCode) { //油温chart历史
 				let that = this;
 				let items = [];
-				const {data} = await axios.get(`http://192.168.10.18:8011/ts/history/snap?thingType=windturbine&uniformCode=${uniformCode}&thingId=${thingId}&startTs=${that.startTs}&endTs=${that.endTs}&interval=60`);
+				const {
+					data
+				} = await axios.get(
+					`http://192.168.10.18:8011/ts/history/snap?thingType=windturbine&uniformCode=${uniformCode}&thingId=${thingId}&startTs=${that.startTs}&endTs=${that.endTs}&interval=60`
+					);
 				data.forEach(ele => {
 					items.push({
-						text: new Date(ele.ts).formatDate("yyyy-MM-dd hh:ss"),
+						text: new Date(ele.ts).formatDate("yyyy-MM-dd hh:mm"),
 						value: ele.value.toFixed(2)
 					})
 				})
 				if (uniformCode === 'AI041') {
-					that.ywChart[0].value = items
+					that.ywChart[0].value = items;
+					that.ccChart[0].value = items;
 				}
 				if (uniformCode === 'CI0671') {
 					that.ywChart[1].value = items
 				}
 			},
-			async list(thingId) {
+			async list(thingId) { //一秒一次
 				let that = this;
-				const {data} = await axios.get(`http://192.168.10.18:8011/ts/latest?thingType=windturbine&uniformCodes=YWCH,CI0671,LLYW,AI041&thingId=${thingId}`);
-				that.ywChart[0].value.push({
-					text: new Date(data.AI041.ts).formatDate("yyyy-MM-dd hh:ss"),
+				const {
+					data
+				} = await axios.get(
+					`http://192.168.10.18:8011/ts/latest?thingType=windturbine&uniformCodes=YWCH,CI0671,LLYW,AI041&thingId=${thingId}`
+					);
+				let AI041 = {
+					text: new Date(data.AI041.ts).formatDate("yyyy-MM-dd hh:mm"),
 					value: data.AI041.value.toFixed(2)
-				})
+				}
+				that.ywChart[0].value.push(AI041)
 				that.ywChart[1].value.push({
-					text: new Date(data.CI0671.ts).formatDate("yyyy-MM-dd hh:ss"),
+					text: new Date(data.CI0671.ts).formatDate("yyyy-MM-dd hh:mm"),
 					value: data.CI0671.value.toFixed(2)
 				})
-				that.ywChartHtml = [data.AI041.value.toFixed(2),data.CI0671.value.toFixed(2)];
+				that.ywChartHtml = [data.AI041.value.toFixed(2), data.CI0671.value.toFixed(2)];
+				that.ccChart[0].value.push(AI041);
 			},
-			async startAjax() {
+			async startAjax() { //场站
 				var that = this;
 				await that.API.requestData({
 					method: "GET",
@@ -166,45 +213,67 @@
 					},
 				});
 			},
-			deleteDate(val) {
-				// let that = this;
-				// this.API.requestData({
-				//   method: "GET",
-				//   baseURL: "http://192.168.10.18:8080/",
-				//   subUrl: "api/coordinate/history/remove/",
-				//   data: {
-				//     names: val,
-				//   },
-				//   success(res) {
-				//     if (res) {
-				//       that.showResultList = [];
-				//       that.barList = [];
-				//       that.recordList = [];
-				//       that.current = 0
-				//       if (!that.supervisedFlag) {
-				//         that.getRecords();
-				//         that.getScatter();
-				//       } else {
-				//         that.getSupervisedRecord();
-				//       }
-				//     }
-				//   },
-				// });
-			},
 			query() {
+				this.ywYc();
+				this.mxjl();
+			},
+			ywYc() { //油温预测记录
 				this.ywChart[0].value = [];
 				this.ywChart[1].value = [];
 				this.uniformCodes.forEach(ele => {
 					this.history(this.fj, ele);
 				})
-				
+
 				this.list(this.fj);
 				clearInterval(this.interval);
 				this.interval = null;
 				this.interval = setInterval(() => {
 					this.list(this.fj)
 				}, 60000);
-			}
+			},
+			mxjl() { //模型记录
+				let that = this;
+				that.API.requestData({ //风机
+					method: "GET",
+					baseURL: "http://10.155.32.14:9090/",
+					subUrl: "api/gearbox-diagnosis/history",
+					success(res) {
+						let cc = [],
+							yw = [];
+						res.forEach(ele => {
+							let data = {
+								name: ele.name,
+								time: ele.name.split('_')[1],
+								faultIds: ele.faultIds ? ele.faultIds : '暂无数据	'
+							};
+							ele.name.split('_')[0] === '残差' ? cc.push(data) : yw.push(data);
+						})
+
+						that.ccS = cc;
+						that.ywS = yw;
+					},
+				});
+			},
+			deleteDate(val) {
+				let that = this;
+				that.API.requestData({
+					method: "GET",
+					baseURL: "http://10.155.32.14:9090/",
+					subUrl: "api/gearbox-diagnosis/history/remove",
+					data: {
+						names: val,
+					},
+					success(res) {
+						if (res == 'success') {
+							that.mxjl();
+							that.BASE.showMsg({
+								type: "success",
+								msg: '已删除'
+							});
+						}
+					},
+				});
+			},
 		},
 		unmounted() {
 			clearInterval(this.interval);
@@ -217,7 +286,7 @@
 			// AI041 实时油温
 			station(e) {
 				let that = this;
-				that.API.requestData({
+				that.API.requestData({ //风机
 					method: "GET",
 					baseURL: "http://10.155.32.4:9001/",
 					subUrl: "benchmarking/wtList",
@@ -227,16 +296,13 @@
 					success(res) {
 						that.fjArr = res.data;
 						that.fj = res.data[0].id;
-						if(that.flag === 1){
+						if (that.flag === 1) {
 							that.query();
 						}
 						that.flag = 2;
 					},
 				});
 			},
-			// fj(e){
-			// 	this.list(e);
-			// },
 			date(e) {
 				this.startTs = e[0].valueOf();
 				this.endTs = e[1].valueOf();
@@ -298,6 +364,12 @@
 		}
 	}
 
+	.timeLine {
+		height: 80vh;
+		overflow-y: auto;
+		margin-top: 30px;
+	}
+
 	.text {
 		font-size: 2vh;
 		margin: 1vh 0;