浏览代码

故障样本库调整

chenminghua 3 年之前
父节点
当前提交
b1304280f1
共有 1 个文件被更改,包括 52 次插入55 次删除
  1. 52 55
      src/views/sampleDatabase/fault/index.vue

+ 52 - 55
src/views/sampleDatabase/fault/index.vue

@@ -2,7 +2,7 @@
 	<el-scrollbar height="92vh">
 		<div class="query mg-b-8">
 			<div class="query-items">
-				<div class="query-item" style="width: 200px;">
+				<div class="query-item" style="width: 220px;">
 					<div class="lable">场站:</div>
 					<div class="search-input">
 						<el-select v-model="station" placeholder="请选择" popper-class="select" @change="stationChange">
@@ -31,12 +31,16 @@
 						</el-select>
 					</div>
 				</div>
-				<div class="query-item" style="width: 180px;">
-					<div class="lable">型:</div>
+				<div class="query-item" style="width: 230px;">
+					<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 v-model="category" collapse-tags clearable placeholder="请选择" popper-class="select">
+							<el-option
+								v-for="item in categorys"
+								:key="item.value"
+								:value="item.value"
+								:label="item.label"
+							/>
 						</el-select>
 					</div>
 				</div>
@@ -51,14 +55,14 @@
 				<div class="query-actions">
 					<button class="btn" @click="list">查询</button>
 					<button class="btn" @click="query()">导入</button>
-					<button class="btn" @click="export">导出</button>
+					<button class="btn" @click="exportData()">导出</button>
 				</div>
 			</div>
 		</div>
 		<el-row :type="'flex'" class="content">
 			<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>
+				element-loading-background="rgba(0, 0, 0, 0.8)" v-if="category=='0'"></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>	
@@ -82,11 +86,15 @@
 			return {
 				active: true,
 				selectAll: true,
-				
 				pageIndex: 1,
 				pageSize: 20,
 				gzCgd: false, //传感点组件隐藏或显示
 				gzCgdData: [], //传感点参数
+				category: "0", //模型分类
+				categorys: [
+					{label: "检修样本", value: "0"},
+					{label: "DBSCAN样本", value: "1"},
+				],
 				st:'',
 				widgetArr: [],
 				ChangZhan: [],
@@ -94,7 +102,6 @@
 				fjxhArr: [],
 				widget: [],
 				model: [],
-				mx:'list',
 				time: [],
 				station: '',
 				tableData: {
@@ -312,7 +319,7 @@
 							if (res.code == 200) {
 								if(res.data.length){
 									that.gzCgdData = res.data;
-									if(that.mx == 'list'){
+									if(that.category == '0'){
 										that.st = Date.parse(new Date(row.tableTime.split(" - ")[0]));
 									}else{
 										that.st = Date.parse(new Date(row.faultTime));
@@ -390,48 +397,43 @@
 						widget: widget ? widget : that.widget,
 						station: station ? station : that.station,
 						model: that.model,
+						category: that.category,
 						st: that.time[0].valueOf(),
 						et: that.time[1].valueOf()
 					},
 					success(res) {
-						if (res.code == 200) {
-							if (res.data.length) {
-								let data = res.data;
-								if(that.mx == 'list'){
-									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);
-										}
-									}
+						if (res.code == 200 && res.data.length) {
+							let data = res.data;
+							if(that.category == '0'){
+								let k = 0;
+								for (var i = 0; i < data.length; i++) {
+									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 j = 0; j < data.length; j++) {
+									k ++;
+									let obj = {
+										index: k,
+										wtId: data[j].windturbineid,
+										faulttype: data[j].faulttype,
+										modelId: data[j].model,
+										faultTime: data[j].starttime,
+										widget:data[j].faultcode
+									};
+									that.tableData2.data.push(obj);
 								}
 							}
 						}
@@ -441,7 +443,7 @@
 			formatJson(filterVal, jsonData) {
 				return jsonData.map(v => filterVal.map(j => v[j]));
 			},
-			export() {
+			exportData() {
 				let that = this;
 				const {export_json_to_excel} = require('@tools/excel/Export2Excel.js'); // 注意这个Export2Excel路径      
 				let tHeader = []; // 上面设置Excel的表格第一行的标题       
@@ -460,11 +462,6 @@
 		created() {
 			this.startAjax();
 		},
-		watch: {
-			mx(){
-				this.list();
-			}
-		},
 	};
 </script>