Bläddra i källkod

Merge remote-tracking branch 'origin/master'

zhoupeng 1 år sedan
förälder
incheckning
dccab0857f
1 ändrade filer med 100 tillägg och 10 borttagningar
  1. 100 10
      chuanyi_client2/src/views/report_template/index.vue

+ 100 - 10
chuanyi_client2/src/views/report_template/index.vue

@@ -62,6 +62,10 @@
           <svg-icon icon-class="report_data" style="width: 35px;"/>
           <span>数据项</span>
         </div>
+		<div class="cy-chart-div" @click="updateDataEvent()" v-if="templateReportType != 5">
+		  <svg-icon icon-class="report_data" style="width: 35px;"/>
+		  <span>修改策略</span>
+		</div>
         <div class="cy-chart-div" @click="barEvent('bar')" v-if="templateReportType != 2 && templateReportType != 5">
           <svg-icon icon-class="bar_chart"/>
           <span>柱状图</span>
@@ -412,8 +416,9 @@
         :append-to-body="true">
       <div style="height: 60vh; overflow: auto;">
         <div>
-          <label>数据组:</label>
+          <label v-if="templateReportType != 2 || (!isUpdateShow && templateReportType == 2)">数据组:</label>
           <el-select filterable
+		  v-if="templateReportType != 2 || (!isUpdateShow && templateReportType == 2)"
                      v-model="chooseDataGroup"
                      @change="getGroupById"
                      placeholder="请选择数据组"
@@ -437,7 +442,7 @@
 <!--                :value="dict.value"-->
 <!--            ></el-option>-->
 <!--          </el-select>-->
-          <el-button size="mini" @click="addDataItem" style="width: 100px;margin-top: 4px; margin-left: 10px;">
+          <el-button v-if="templateReportType != 2 || (!isUpdateShow && templateReportType == 2)" size="mini" @click="addDataItem" style="width: 100px;margin-top: 4px; margin-left: 10px;">
             选择数据项
           </el-button>
           <template v-if="!hasBelongDataFlag">
@@ -820,6 +825,7 @@ export default {
   },
   data() {
     return {
+		isUpdateShow: false,
       newItemId: 0,
       ctrlxstatus: false,
       sheetAxis: [],
@@ -1791,6 +1797,8 @@ export default {
       //   chooseList.push(checkedNode)
       // }
       // this.chooseItemData = chooseList
+	  console.log(this.chooseItemData)
+	  console.log(_temp)
       this.chooseItemData = _temp
       this.dialogDataItemVisible = false
       if (this.dialogGroupItemVisible) {
@@ -1834,9 +1842,11 @@ export default {
           break
         }
       }
-      this.chooseGroupItemList = this.chooseGroupItemList.filter(function (item, index) {
-        return item.itemGroupId != group.id;
-      })
+	  if (!this.isUpdateShow) {
+		  this.chooseGroupItemList = this.chooseGroupItemList.filter(function (item, index) {
+			return item.itemGroupId != group.id;
+		  })
+	  }
 
       for (let j = 0; j < this.chooseItemData.length; j++) {
         this.chooseItemData[j].groupName = group.groupName
@@ -2024,6 +2034,7 @@ export default {
     },
     /** 数据项 */
     dataEvent(type) {
+		this.isUpdateShow = false
       let rangeWithFlatten = luckysheet.getRangeWithFlatten()
       if (!rangeWithFlatten || rangeWithFlatten.length != 1) {
         showAlertMsgWin(this, null, '请选择一项单元格!')
@@ -2182,7 +2193,11 @@ export default {
 				  v = '${' + item.dataSourceName + '.' + item.itemReadName + '}'
           // v = item.dataSourceName + "." + item.itemReadName
 			  }
-              item.placeHolder = v
+			  if (!item.placeHolder) {
+				item.placeHolder = v
+			  } else {
+				  v = item.placeHolder
+			  }
               item.standby = JSON.stringify({
                   'index': n,
                   'fieldType': this.itemShowParams.fieldType
@@ -2289,6 +2304,7 @@ export default {
     },
     /** 向数据表格增加数据(重复判断) */
     pushToItemTable(item) {
+		console.log(item)
       let itemInfo = {
         'itemId': item.id,
         'isDriverItem': item.isDriverItem,
@@ -2299,8 +2315,21 @@ export default {
         'bucketType': item.bucketType,
         'valueType': item.valueType,
         'bucketValue': item.bucketValue,
-        'standby': item.standby
-      }
+        'standby': item.standby,
+		'itemName': item.itemName,
+		'itemReadName': item.itemReadName,
+		'dataSourceName': item.dataSourceName,
+		'itemGroupId': item.itemGroupId,
+		'itemType': item.itemType,
+		'checked': item.checked
+      }
+	  if (item.dataSourceId) {
+		  itemInfo.dataSourceId = item.dataSourceId
+	  }
+	  if (item.itemId) {
+		  itemInfo.itemId = item.itemId
+	  }
+	  
       itemInfo.startTime = null
       itemInfo.endTime = null
       // 当前是手动报表
@@ -2854,7 +2883,68 @@ export default {
     closeMenu() {
       this.visibleChartMenu = false
     },
-
+	updateDataEvent() {
+      let rangeWithFlatten = luckysheet.getRangeWithFlatten()
+      if (!rangeWithFlatten) {
+        showAlertMsgWin(this, null, '请选择要修改的数据项!')
+        return
+      }
+	  const sheetData = luckysheet.getSheet(0).data
+	  let flattenObj = {}
+	  let status = false;
+	  for (let i = 0; i < rangeWithFlatten.length; i++) {
+		const val = sheetData[rangeWithFlatten[i].r][rangeWithFlatten[i].c]
+		if (!status) {
+			if (val) {
+				status = true;
+			}
+		}
+		
+	  	flattenObj[rangeWithFlatten[i].c + "_" + rangeWithFlatten[i].r] = val
+	  }
+	  console.log(flattenObj)
+	  if (!status) {
+		  showAlertMsgWin(this, null, '选择区域未包含有效数据项!')
+		  return
+	  }
+	  const items = this.toolItemTable;
+	  let arr = []
+	  for (let i = 0; i < items.length; i++) {
+	  	const key = items[i].yaxis + "_" + items[i].xaxis
+		if (flattenObj[key]) {
+			arr.push(items[i])
+		}
+	  }
+	  if (!arr.length) {
+		  showAlertMsgWin(this, null, '选择区域未包含有效数据项!')
+		  return
+	  }
+	  console.log(arr)
+	  this.chooseGroupItemList = arr
+	  this.isUpdateShow = true
+	  // 初始化数据显示方式
+	  this.itemShowParams = {
+	    fieldType: '1',
+	    valType: '2',
+	    valLine: 1,
+	    dataId: new Date().getTime()
+	  }
+	  this.deviceReportCondition = {
+	    type: null,
+	    variableType: '1',
+	    isGenCountTime: '0',
+	    startItemId: null,
+	    startItemName: null,
+	    startValue: '',
+	    endItemId: null,
+	    endItemName: null,
+	    endValue: ''
+	  }
+	  this.getDataGroupList()
+	  this.hasBelongDataFlag = false
+	  // this.chooseDataGroup = null
+	  this.dialogGroupItemVisible = true
+    },
   }
 }
 </script>
@@ -2884,7 +2974,7 @@ export default {
 }
 
 .cy-div2 {
-  width: 60px;
+  width: 70px;
   height: 100%;
   z-index: 1;
   background: #2c3e50;