Преглед изворни кода

五项损失率:bug,点击表头,清除checkbox状态;对标弹出层的柱状图未写

mw_666 пре 3 година
родитељ
комит
59bf00042c
1 измењених фајлова са 46 додато и 22 уклоњено
  1. 46 22
      src/views/Decision/Decision2.vue

+ 46 - 22
src/views/Decision/Decision2.vue

@@ -54,7 +54,7 @@
 			</div>
 			<div class="query-actions">
 				<button class="btn green">搜索</button>
-				<button class="btn" @click="dialogVisible = true">对标分析</button>
+				<button class="btn" @click="dbfx">对标分析</button>
 				<button class="btn">导出</button>
 			</div>
 		</div>
@@ -112,7 +112,9 @@
 		data() {
 			let that = this;
 			return {
-				tableId:[],
+				tableIdArr: [], //放checkbox的id数组
+				tableId: [],
+				checkLength: 0, //对标分析只能选择2个
 				tableData: {
 					column: [{
 							name: "",
@@ -129,6 +131,7 @@
 								return "<input class='check' type='CheckBox'/>";
 							},
 							click: function(event, data) {
+								console.log(data)
 								// checkbox 事件
 								// event.target checkbox or td 需进行判断
 								// event.target.checked 判断 checkbox 是否选中
@@ -136,9 +139,19 @@
 								// console.log(that);
 								// console.log(event.target);
 								// console.log(event.target.checked);
-								if(event.target.checked){
-									console.log(JSON.stringify(data));
-									
+								var dataId = that.tableIdArr[data.index - 1];
+								if (event.target.checked == false && that.checkLength <= 2) {
+									that.tableId.forEach((item, i) => {
+										if (item == dataId) {
+											that.tableId.splice(i, 1)
+										}
+									})
+									that.checkLength--;
+								} else if (event.target.checked && that.checkLength < 2) {
+									that.tableId.push(dataId)
+									that.checkLength++;
+								} else if (that.checkLength == 2) {
+									event.target.checked = false;
 								}
 							},
 						},
@@ -301,7 +314,6 @@
 					],
 					data: [],
 				},
-				checkLength:0,
 				options: [],
 				ChangZhan: [], //场站
 				XiangMu: [], //项目
@@ -318,15 +330,8 @@
 				innerLl: [], //理论发电量占比
 				outerLl: [],
 				analyis: [], //损失电量分析
-				dialogVisible: false,
-				radarValue: [{
-					indicator: ["风能利用率", "故障损失率", "检修损失率", "弃风率", "性能损失率", "受累损失率", "复位及时率", "消缺及时率", "状态转换率"],
-					data: [{
-						value: [1, 2, 3, 4, 5, 6, 7, 8, 9]
-					}, {
-						value: [9, 8, 5, 4, 5, 4, 7, 8, 9]
-					}]
-				}],
+				dialogVisible: true,
+				radarValue: [],
 				windNum: 'dd',
 				windNum2: 'dd',
 				tabs: []
@@ -337,7 +342,6 @@
 			this.value4 = this.getTime(1);
 			this.value5 = this.getTime(2);
 			this.AjaxCommon();
-			this.AjaxDbfx();
 		},
 		methods: {
 			ChangZhanVal() {
@@ -442,6 +446,7 @@
 							xdssdl = [],
 							slssdl = [];
 						res.data.forEach((item, index) => {
+							that.tableIdArr.push(item.id);
 
 							dataTab.push({ //表格
 								index: index + 1,
@@ -467,7 +472,6 @@
 								xnssl: item.xnssl,
 								slsslpm: item.slsslpm,
 								slssl: item.slssl,
-								// cz: '暂无按钮',
 								is_light: false
 							})
 
@@ -550,10 +554,9 @@
 					method: "GET",
 					subUrl: "benchmarking/wxssl",
 					data: {
-						// wpids: that.value1,
-						wpids: ['XS_FDC', 'MHS_FDC'],
-						projectids: '',
-						lineids: '',
+						wpids: that.tableId,
+						projectids: that.value2,
+						lineids: that.value3,
 						beginDate: that.value4,
 						endDate: that.value5,
 						target: '',
@@ -607,7 +610,21 @@
 							name: "受累损失率",
 							windData1: data[0].slssl,
 							windData2: data[1].slssl
-						}]
+						}];
+
+
+						that.radarValue = [{
+							indicator: ["风能利用率", "故障损失率", "检修损失率", "弃风率", "性能损失率", "受累损失率"],
+							data: [{
+								value: [data[0].fnlyl, data[0].gzssl, data[0].jxssl, data[0].qfl,
+									data[0].xnssl, data[0].slssl
+								]
+							}, {
+								value: [data[1].fnlyl, data[1].gzssl, data[1].jxssl, data[1].qfl,
+									data[1].xnssl, data[1].slssl
+								]
+							}]
+						}];
 					}
 				});
 			},
@@ -623,6 +640,13 @@
 				callback(result);
 				return true;
 			},
+			dbfx() {
+				var that = this;
+				if (that.tableId.length == 2) {
+					that.dialogVisible = true;
+					this.AjaxDbfx();
+				}
+			}
 		}
 	};
 </script>