Quellcode durchsuchen

Merge branch 'master' of http://116.63.33.55/git/read_opc

# Conflicts:
#	reado-app/static/webview/record-wv.html
Zt vor 1 Jahr
Ursprung
Commit
0846979fd2
21 geänderte Dateien mit 496 neuen und 69 gelöschten Zeilen
  1. 12 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ChartServiceImpl.java
  2. 153 13
      chaunyi_opc/opc_da/src/main/resources/static/app/static/webview/record-wv.html
  3. 149 13
      chaunyi_opc/opc_da/src/main/resources/static/app/static/webview/report-wv.html
  4. 1 1
      chaunyi_opc/opc_da/src/main/resources/static/page/index.html
  5. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.68bacd05.css
  6. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-1c266168.183a7633.css
  7. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.c60763eb.js
  8. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-0b1e599b.e6bd40cd.js
  9. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-1c266168.4f75f8f1.js
  10. 0 0
      chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-bf7d2572.54137ea2.js
  11. 17 1
      chuanyi_client2/src/api/chart.js
  12. 16 7
      chuanyi_client2/src/components/CustomDialog/DataItem.vue
  13. 1 1
      chuanyi_client2/src/components/CustomDialog/DataSourceItem.vue
  14. 7 4
      chuanyi_client2/src/components/CustomDialog/UserGroup.vue
  15. 6 2
      chuanyi_client2/src/components/HeaderMain/index.vue
  16. 45 13
      chuanyi_client2/src/views/data_model/index.vue
  17. 1 1
      chuanyi_client2/src/views/group_item/index.vue
  18. 80 10
      chuanyi_client2/src/views/home/index.vue
  19. 2 2
      chuanyi_client2/src/views/index.vue
  20. 1 1
      chuanyi_client2/src/views/report_template/index.vue
  21. 5 0
      reado-app/static/webview/record-wv.html

+ 12 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/impl/ChartServiceImpl.java

@@ -50,6 +50,12 @@ public class ChartServiceImpl implements ChartService {
         Integer id = chart.getId();
         List<ChartItem> chartItemList = chart.getChartItemList();
         if (Blank.isNotEmpty(chartItemList)) {
+            String chartType = chart.getChartType();
+            if (chartType.equals(ConstantStr.BAR_CHART)) {
+                if (chartItemList.size() != 1) {
+                    return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "饼状图只能配置一个数据项");
+                }
+            }
             chartDao.addChartItem(id, chartItemList);
         }
         List<UserGroup> userGroupList = chart.getUserGroupList();
@@ -69,6 +75,12 @@ public class ChartServiceImpl implements ChartService {
         chartDao.delChartUserGroup(id);
         List<ChartItem> chartItemList = chart.getChartItemList();
         if (Blank.isNotEmpty(chartItemList)) {
+            String chartType = chart.getChartType();
+            if (chartType.equals(ConstantStr.BAR_CHART)) {
+                if (chartItemList.size() != 1) {
+                    return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "饼状图只能配置一个数据项");
+                }
+            }
             chartDao.addChartItem(id, chartItemList);
         }
         List<UserGroup> userGroupList = chart.getUserGroupList();

+ 153 - 13
chaunyi_opc/opc_da/src/main/resources/static/app/static/webview/record-wv.html

@@ -36,6 +36,8 @@
 			document.addEventListener('UniAppJSBridgeReady', function() {
 				uni.getEnv(function(res) {
 					console.log('当前环境:' + JSON.stringify(res));
+					window.sessionName = 'device_report_index'
+					sessionStorage.removeItem(window.sessionName)
 					const id = window.location.search.split('?id=')[1]
 					const token = window.localStorage.getItem('C_TOKEN')
 					$.ajax({
@@ -180,8 +182,7 @@
 										// 绘制基础数据项
 										drawBaseInfo(baseItem)
 										// 绘制数据值
-										drawTableData(reportTableItemList,
-											reportTableType)
+										drawTableData(reportTableItemList, reportTableType, data)
 										luckysheet.setRangeShow('BH1')
 										// convertChart(tableData)
 										// printExcel()
@@ -228,11 +229,26 @@
 						})
 					}
 					/** 绘制表格数据 */
-					function drawTableData(tableItemList, type) {
-						if (!tableItemList || tableItemList.length == 0) return
+					function drawTableData(tableItemList, type, tableInfo) {
+						if (!tableItemList || tableItemList.length == 0) {
+							updateLocalExcelContent()
+							return
+						}
 						// 事件驱动报表
 						if (type == 2 || type == 4) {
 							tableItemList.forEach((tableItem, i) => {
+								if (i == 0) {
+									let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+									let xAxis = tableItem.xaxis
+									let yAxis = tableItem.yaxis - 1
+									if (valueTimeList.length == 0) {
+									  luckysheet.setCellValue(xAxis, yAxis, '')
+									} else {
+									  valueTimeList.forEach((v, j) => {
+										luckysheet.setCellValue(xAxis + j, yAxis, v)
+									  })
+									}
+								}
 								let valueList = tableItem.valueList ? tableItem.valueList
 									.split(',') : []
 								let xAxis = tableItem.xaxis
@@ -246,26 +262,150 @@
 									})
 								}
 							})
+							updateLocalExcelContent()
+							return
+						}
+						// 设备报表
+						if (type == 5 || type == 6) {
+							tableItemList.forEach((tableItem, i) => {
+							  let standby = tableItem.standby ? JSON.parse(tableItem.standby) : {}
+							  let dataIndex = standby.index != null ? standby.index : -1
+							  let valueList = tableItem.valueList ? tableItem.valueList.split(',') : []
+							  let xAxis = tableItem.xaxis
+							  let yAxis = tableItem.yaxis
+							  // 序号、时间处理
+							  if (tableItem.timeItemType == 0) { // 序号、开始时间
+								let valueIndexList = tableItem.valueIndexList ? tableItem.valueIndexList.split(',') : []
+								deviceReportUpdateData('${index}', valueIndexList, false)
+								let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+								deviceReportUpdateData('${startTime}', valueTimeList, false)
+							  }
+							  if (tableItem.timeItemType == 1) { // 结束时间
+								let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+								deviceReportUpdateData('${stopTime}', valueTimeList, tableInfo.isGenCountTime == 1)
+							  }
+							  if (valueList.length == 0) {
+								luckysheet.setCellValue(xAxis, yAxis, '')
+							  } else {
+								valueList.forEach((v, j) => {
+								  luckysheet.setCellValue(xAxis + j, yAxis, v)
+								})
+							  }
+							})
+							updateLocalExcelContent()
 							return
 						}
 						// 其余报表信息
 						tableItemList.forEach((tableItem, i) => {
-							let standby = tableItem.standby ? JSON.parse(tableItem.standby) : {}
-							let dataIndex = standby.index != null ? standby.index : -1
+							// let standby = tableItem.standby ? JSON.parse(tableItem.standby) : {}
+							// let dataIndex = standby.index != null ? standby.index : -1
 							let valueList = tableItem.valueList ? tableItem.valueList.split(
 								',') : []
-							let val = (dataIndex == -1 || (dataIndex + 1) > valueList
-									.length) ?
-								cqcyCode['invalidData'] : valueList[dataIndex]
+							// let val = (dataIndex == -1 || (dataIndex + 1) > valueList
+							// 		.length) ?
+							// 	cqcyCode['invalidData'] : valueList[dataIndex]
 							let xAxis = tableItem.xaxis
 							let yAxis = tableItem.yaxis
-							try {
-								luckysheet.setCellValue(xAxis, yAxis, val)
-							} catch (e) {
-								console.warn(e)
+							if (valueList.length == 0) {
+							  luckysheet.setCellValue(xAxis, yAxis, '')
+							} else {
+							  valueList.forEach((v, j) => {
+								luckysheet.setCellValue(xAxis + j, yAxis, v)
+							  })
 							}
 						})
+						updateLocalExcelContent()
 					}
+					
+					/** 设备报表时间特殊处理 */
+					function deviceReportUpdateData(field, dataList, hasCalc) {
+					      let indexPos = sessionStorage.getItem(window.sessionName)
+					      if (indexPos) {
+					        let pos = indexPos.split(',')
+					        if (field == '${index}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1])
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, j + 1)
+					          })
+					        } else if (field == '${startTime}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1]) + 1
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, v)
+					          })
+					        } else if (field == '${stopTime}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1]) + 2
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, v)
+					            if (hasCalc) {
+					              let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+					              let minutes = calculateMinutes(startDate, v)
+					              luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
+					            }
+					          })
+					        }
+					        return
+					      }
+					      let option = luckysheet.getAllSheets()[0]
+					      option.celldata.map(item => {
+					        if (item.v.v) {
+					          item.v.v = String(item.v.v).trim()
+					          // 替换${xxx}内部数据
+					          if (item.v.v.match(/\${([^}]+)}/g)) {
+					            if (item.v.v.indexOf(field) > -1) {
+					              let yAxis = item.r
+					              let xAxis = item.c
+					              if (field == '${index}') {
+					                sessionStorage.setItem(window.sessionName, yAxis + ',' + xAxis)
+					                dataList.forEach((v, j) => {
+					                  luckysheet.setCellValue(yAxis + j, xAxis, j + 1)
+					                })
+					              } else {
+					                dataList.forEach((v, j) => {
+					                  luckysheet.setCellValue(yAxis + j, xAxis, v)
+					                  if (hasCalc) {
+					                    let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+					                    let minutes = calculateMinutes(startDate, v)
+					                    luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
+					                  }
+					                })
+					              }
+					            }
+					          }
+					        }
+					      })
+					    }
+						
+						/** 删除不合理数据值 */
+						function updateLocalExcelContent() {
+						  let option = luckysheet.getAllSheets()[0]
+						  option.celldata.map(item => {
+							if (item.v.v) {
+							  item.v.v = String(item.v.v).trim()
+							  // 替换${xxx}内部数据
+							  if (item.v.v.match(/\${([^}]+)}/g)) {
+								luckysheet.setCellValue(item.r, item.c, '')
+							  }
+							}
+						  })
+						}
+						
+						/** 计算分钟数 */
+						function calculateMinutes(time1, time2) {
+						  // 将时间字符串转换为Date对象
+						  let date1 = new Date(time1);
+						  let date2 = new Date(time2);
+						  // 计算时间差(以毫秒为单位)
+						  let diffInMilliseconds = Math.abs(date2.getTime() - date1.getTime());
+						  // 将时间差转换为分钟
+						  let minutes = Math.floor(diffInMilliseconds / 1000 / 60);
+						  return minutes;
+						}
+					
+					
+					
 				});
 			});
 		</script>

+ 149 - 13
chaunyi_opc/opc_da/src/main/resources/static/app/static/webview/report-wv.html

@@ -272,7 +272,7 @@
 										drawBaseInfo(baseItem)
 										// 绘制数据值
 										drawTableData(reportTableItemList,
-											reportTableType)
+											reportTableType, data.data)
 										luckysheet.setRangeShow('BH1')
 										convertChart(tableData)
 										printExcel()
@@ -540,11 +540,26 @@
 						}
 
 						/** 绘制表格数据 */
-						function drawTableData(tableItemList, type) {
-							if (!tableItemList || tableItemList.length == 0) return
+						function drawTableData(tableItemList, type, tableInfo) {
+							if (!tableItemList || tableItemList.length == 0) {
+								updateLocalExcelContent()
+								return
+							}
 							// 事件驱动报表
 							if (type == 2 || type == 4) {
 								tableItemList.forEach((tableItem, i) => {
+									if (i == 0) {
+										let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+										let xAxis = tableItem.xaxis
+										let yAxis = tableItem.yaxis - 1
+										if (valueTimeList.length == 0) {
+										  luckysheet.setCellValue(xAxis, yAxis, '')
+										} else {
+										  valueTimeList.forEach((v, j) => {
+											luckysheet.setCellValue(xAxis + j, yAxis, v)
+										  })
+										}
+									}
 									let valueList = tableItem.valueList ? tableItem.valueList
 										.split(',') : []
 									let xAxis = tableItem.xaxis
@@ -558,28 +573,149 @@
 										})
 									}
 								})
+								updateLocalExcelContent()
+								return
+							}
+							// 设备报表
+							if (type == 5 || type == 6) {
+								tableItemList.forEach((tableItem, i) => {
+								  let standby = tableItem.standby ? JSON.parse(tableItem.standby) : {}
+								  let dataIndex = standby.index != null ? standby.index : -1
+								  let valueList = tableItem.valueList ? tableItem.valueList.split(',') : []
+								  let xAxis = tableItem.xaxis
+								  let yAxis = tableItem.yaxis
+								  // 序号、时间处理
+								  if (tableItem.timeItemType == 0) { // 序号、开始时间
+									let valueIndexList = tableItem.valueIndexList ? tableItem.valueIndexList.split(',') : []
+									deviceReportUpdateData('${index}', valueIndexList, false)
+									let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+									deviceReportUpdateData('${startTime}', valueTimeList, false)
+								  }
+								  if (tableItem.timeItemType == 1) { // 结束时间
+									let valueTimeList = tableItem.valueTimeList ? tableItem.valueTimeList.split(',') : []
+									deviceReportUpdateData('${stopTime}', valueTimeList, tableInfo.isGenCountTime == 1)
+								  }
+								  if (valueList.length == 0) {
+									luckysheet.setCellValue(xAxis, yAxis, '')
+								  } else {
+									valueList.forEach((v, j) => {
+									  luckysheet.setCellValue(xAxis + j, yAxis, v)
+									})
+								  }
+								})
+								updateLocalExcelContent()
 								return
 							}
 							// 其余报表信息
 							tableItemList.forEach((tableItem, i) => {
-								let standby = tableItem.standby ? JSON.parse(tableItem.standby) :
-								{}
-								let dataIndex = standby.index != null ? standby.index : -1
+								// let standby = tableItem.standby ? JSON.parse(tableItem.standby) :
+								// {}
+								// let dataIndex = standby.index != null ? standby.index : -1
 								let valueList = tableItem.valueList ? tableItem.valueList.split(
 									',') : []
-								let val = (dataIndex == -1 || (dataIndex + 1) > valueList
-										.length) ?
-									cqcyCode['invalidData'] : valueList[dataIndex]
+								// let val = (dataIndex == -1 || (dataIndex + 1) > valueList
+								// 		.length) ?
+								// 	cqcyCode['invalidData'] : valueList[dataIndex]
 								let xAxis = tableItem.xaxis
 								let yAxis = tableItem.yaxis
-								try {
-									luckysheet.setCellValue(xAxis, yAxis, val)
-								} catch (e) {
-									console.warn(e)
+								if (valueList.length == 0) {
+								  luckysheet.setCellValue(xAxis, yAxis, '')
+								} else {
+								  valueList.forEach((v, j) => {
+									luckysheet.setCellValue(xAxis + j, yAxis, v)
+								  })
 								}
 							})
+							updateLocalExcelContent()
 						}
 
+					/** 设备报表时间特殊处理 */
+					function deviceReportUpdateData(field, dataList, hasCalc) {
+					      let indexPos = sessionStorage.getItem(window.sessionName)
+					      if (indexPos) {
+					        let pos = indexPos.split(',')
+					        if (field == '${index}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1])
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, j + 1)
+					          })
+					        } else if (field == '${startTime}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1]) + 1
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, v)
+					          })
+					        } else if (field == '${stopTime}') {
+					          let yAxis = parseInt(pos[0])
+					          let xAxis = parseInt(pos[1]) + 2
+					          dataList.forEach((v, j) => {
+					            luckysheet.setCellValue(yAxis + j, xAxis, v)
+					            if (hasCalc) {
+					              let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+					              let minutes = calculateMinutes(startDate, v)
+					              luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
+					            }
+					          })
+					        }
+					        return
+					      }
+					      let option = luckysheet.getAllSheets()[0]
+					      option.celldata.map(item => {
+					        if (item.v.v) {
+					          item.v.v = String(item.v.v).trim()
+					          // 替换${xxx}内部数据
+					          if (item.v.v.match(/\${([^}]+)}/g)) {
+					            if (item.v.v.indexOf(field) > -1) {
+					              let yAxis = item.r
+					              let xAxis = item.c
+					              if (field == '${index}') {
+					                sessionStorage.setItem(window.sessionName, yAxis + ',' + xAxis)
+					                dataList.forEach((v, j) => {
+					                  luckysheet.setCellValue(yAxis + j, xAxis, j + 1)
+					                })
+					              } else {
+					                dataList.forEach((v, j) => {
+					                  luckysheet.setCellValue(yAxis + j, xAxis, v)
+					                  if (hasCalc) {
+					                    let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+					                    let minutes = calculateMinutes(startDate, v)
+					                    luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
+					                  }
+					                })
+					              }
+					            }
+					          }
+					        }
+					      })
+					    }
+						
+						/** 删除不合理数据值 */
+						function updateLocalExcelContent() {
+						  let option = luckysheet.getAllSheets()[0]
+						  option.celldata.map(item => {
+							if (item.v.v) {
+							  item.v.v = String(item.v.v).trim()
+							  // 替换${xxx}内部数据
+							  if (item.v.v.match(/\${([^}]+)}/g)) {
+								luckysheet.setCellValue(item.r, item.c, '')
+							  }
+							}
+						  })
+						}
+						
+						/** 计算分钟数 */
+						function calculateMinutes(time1, time2) {
+						  // 将时间字符串转换为Date对象
+						  let date1 = new Date(time1);
+						  let date2 = new Date(time2);
+						  // 计算时间差(以毫秒为单位)
+						  let diffInMilliseconds = Math.abs(date2.getTime() - date1.getTime());
+						  // 将时间差转换为分钟
+						  let minutes = Math.floor(diffInMilliseconds / 1000 / 60);
+						  return minutes;
+						}
+					
 						/** 绘制基础数据项布局信息 */
 						function drawBaseInfo(baseData) {
 							if (!baseData) return

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
chaunyi_opc/opc_da/src/main/resources/static/page/index.html


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/app.68bacd05.css


+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-bf7d2572.183a7633.css → chaunyi_opc/opc_da/src/main/resources/static/page/static/css/chunk-1c266168.183a7633.css


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/app.c60763eb.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-0b1e599b.e6bd40cd.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-1c266168.4f75f8f1.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
chaunyi_opc/opc_da/src/main/resources/static/page/static/js/chunk-bf7d2572.54137ea2.js


+ 17 - 1
chuanyi_client2/src/api/chart.js

@@ -41,6 +41,22 @@ export function saveIndexChart(data) {
 }
 
 /**
+ * 修改数据图表
+ * @param data
+ * @returns {*}
+ */
+export function updateIndexChart(data) {
+    return request({
+        url: '/chart/updateChart',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data
+    })
+}
+
+/**
  * 根据ID删除图表信息
  * @param id
  * @returns {AxiosPromise}
@@ -61,7 +77,7 @@ export function delIndexChartById(id) {
  * @returns {AxiosPromise}
  */
 export function getIndexChartById(id) {
-    let uri = '/chart/getChartById?id=' + id
+    let uri = '/chart/getChartDetailsById?id=' + id
     return request({
         url: uri,
         headers: {

+ 16 - 7
chuanyi_client2/src/components/CustomDialog/DataItem.vue

@@ -90,12 +90,12 @@ export default {
   },
   methods: {
     /** 显示弹窗 */
-    show() {
+    show(groupId, items) {
       this.isSelectAllItem = false
       this.itemDataListByTree = []
       this.filterItemData = ''
       this.chooseDataGroup = null
-      this.getDataGroupList()
+      this.getDataGroupList(groupId, items)
       this.dialogDataItemVisible = true
     },
     /** 数据项搜索过滤 */
@@ -125,12 +125,12 @@ export default {
       }
     },
     /** 选择数据组值改变事件 */
-    dataGroupChangeEvent(val) {
+    dataGroupChangeEvent(val, items) {
       this.chooseDataGroup = val
-      this.getDataItemByGroup()
+      this.getDataItemByGroup(items)
     },
     /** 根据数据组获取数据项 */
-    getDataItemByGroup() {
+    getDataItemByGroup(items) {
       let id = this.chooseDataGroup
       if (!id) {
         showAlertMsgWin(this, null, '请选择数据组!')
@@ -142,15 +142,24 @@ export default {
       getTableItemGroupById(id, 1).then(res => {
         loading.close()
         this.itemDataListByTree = res.data.itemList
+        if (items) {
+          this.$refs.itemTree.setCheckedKeys(items)
+        }
       }).catch((e) => {
         loading.close()
         showAlertWin(this, null, e)
       })
     },
     /** 获取数据组列表 */
-    getDataGroupList() {
+    getDataGroupList(groupId, items) {
       getAllItemGroup(1).then(res => {
-        this.dataGroupList = res.data
+        this.$nextTick(() => {
+          this.dataGroupList = res.data
+          if (groupId) {
+            this.chooseDataGroup = groupId
+            this.dataGroupChangeEvent(groupId, items)
+          }
+        })
       }).catch((e) => {
         showAlertWin(this, null, e)
       })

+ 1 - 1
chuanyi_client2/src/components/CustomDialog/DataSourceItem.vue

@@ -189,7 +189,7 @@
     </el-dialog>
 
     <el-dialog
-        title="选择四则运算/值替换表达式"
+        title="选择表达式"
         width="500px"
         top="10vh"
         center

+ 7 - 4
chuanyi_client2/src/components/CustomDialog/UserGroup.vue

@@ -45,15 +45,18 @@ export default {
   },
   methods: {
     /** 显示弹窗 */
-    show() {
+    show(ids) {
       this.dialogUserGroupVisible = true
-      this.getAllUserGroup()
+      this.getAllUserGroup(ids)
     },
     /** 查询所有用户组 */
-    getAllUserGroup() {
+    getAllUserGroup(ids) {
       getAllUserGroup().then(res => {
         this.$nextTick(() => {
           this.userGroupList = res.data
+          if (ids) {
+            this.chooseUserGroup = ids
+          }
         })
       }).catch((e) => {
         showAlertWin(this, null, e)
@@ -80,7 +83,7 @@ export default {
 }
 </script>
 
-<style>
+<style scoped>
 .el-transfer-panel {
   border: 1px solid #e6ebf5;
   border-radius: 4px;

+ 6 - 2
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -444,7 +444,7 @@
     </el-dialog>
 
     <el-dialog
-        title="选择四则运算/值替换表达式"
+        title="选择表达式"
         width="500px"
         top="10vh"
         center
@@ -1601,8 +1601,12 @@ export default {
       this.leavesChooseList = []
       this.itemDataStep = 1
       this.tempItemList = JSON.parse(JSON.stringify(this.groupBasicForm.itemList))
-
       if (this.tempItemList && this.tempItemList.length > 0) {
+        this.tempItemList.forEach((t) => {
+          t.label = t.itemName
+          t.value = t.itemReadName
+          t.checked = false
+        })
         this.chooseItemDataListByTree = this.tempItemList
       }
       const loading = showLoading(this, '加载中,请稍候···')

+ 45 - 13
chuanyi_client2/src/views/data_model/index.vue

@@ -26,36 +26,49 @@
         </el-table-column>
         <el-table-column
             align="center"
-            label="表达式/值"
-            sortable="custom"
-            prop="operationRule"
-            width="350">
-        </el-table-column>
-        <el-table-column
-            align="center"
             label="类型"
             sortable="custom"
             prop="modelType"
-            width="200">
+            width="120">
           <template slot-scope="scope">
             <span>{{ scope.row.modelType == 0 ? '四则运算' : '值替换' }}</span>
           </template>
         </el-table-column>
         <el-table-column
             align="center"
+            label="表达式/值"
+            sortable="custom"
+            prop="operationRule"
+            width="300">
+        </el-table-column>
+        <el-table-column
+            align="center"
             label="数据值"
             prop="mathParameter"
-            width="150">
+            width="120">
           <template slot-scope="scope">
             <span>{{ scope.row.modelType == 0 ? scope.row.mathParameter : scope.row.replacingValue }}</span>
           </template>
         </el-table-column>
         <el-table-column
             align="center"
+            label="替换值②"
+            sortable="custom"
+            prop="operationRuleTwo"
+            width="120">
+        </el-table-column>
+        <el-table-column
+            align="center"
+            label="数据值②"
+            prop="replacingValueTwo"
+            width="120">
+        </el-table-column>
+        <el-table-column
+            align="center"
             label="创建时间"
             sortable
             prop="createTime"
-            width="200">
+            width="180">
         </el-table-column>
         <el-table-column label="操作" align="center" width="300">
           <template slot-scope="scope">
@@ -142,16 +155,22 @@
         <el-form-item label="名称" prop="remark">
           <el-input v-model="dataModelForm.remark" placeholder="请输入名称" maxlength="20"></el-input>
         </el-form-item>
-        <el-form-item label="替换规则" prop="operationRule">
+        <el-form-item label="替换规则" prop="operationRule">
           <span>当数据项值为</span>
           <el-input v-model="dataModelForm.operationRule" size="mini"
                     placeholder="请输入值" style="width: 110px; margin: 0 10px;"></el-input>
           <span>时,则替换成</span>
-<!--          <el-input v-model="dataModelForm.replacingValue" size="mini"-->
-<!--                    placeholder="请输入替换值" style="width: 110px; margin-left: 10px;"></el-input>-->
           <el-input-number v-model="dataModelForm.replacingValue" size="mini" placeholder="请输入替换值"
                            :min="0" :max="99" :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
         </el-form-item>
+        <el-form-item label="替换规则②" prop="operationRuleTwo">
+          <span>当数据项值为</span>
+          <el-input v-model="dataModelForm.operationRuleTwo" size="mini"
+                    placeholder="请输入值" style="width: 110px; margin: 0 10px;"></el-input>
+          <span>时,则替换成</span>
+          <el-input-number v-model="dataModelForm.replacingValueTwo" size="mini" placeholder="请输入替换值"
+                           :min="0" :max="99" :controls="false" :precision="0" style="width: 110px; margin-left: 10px;"></el-input-number>
+        </el-form-item>
         <el-form-item style="text-align: center;">
           <el-button type="primary" @click="saveDataModelEvent">确定</el-button>
           <el-button @click="dialogClose">取消</el-button>
@@ -233,6 +252,8 @@ export default {
         testVal: '',
         modelType: 0,
         replacingValue: '',
+        operationRuleTwo: '',
+        replacingValueTwo: '',
         remark: ''
       },
       dataModelTestForm: {
@@ -325,6 +346,8 @@ export default {
         testVal: '',
         modelType: 0,
         replacingValue: '',
+        operationRuleTwo: '',
+        replacingValueTwo: '',
         remark: ''
       }
       this.calcValResult = ''
@@ -340,6 +363,8 @@ export default {
         testVal: '',
         modelType: 1,
         replacingValue: '',
+        operationRuleTwo: '',
+        replacingValueTwo: '',
         remark: ''
       }
       this.calcValResult = ''
@@ -457,6 +482,13 @@ export default {
     saveDataModelEvent() {
       this.$refs['dataModelForm'].validate((valid) => {
         if (valid) {
+          if (this.dataModelForm.operationRule == this.dataModelForm.operationRuleTwo) {
+            showAlertMsgWin(this, null, '值替换时两个规则不能一致!')
+            return
+          }
+          if (!this.dataModelForm.operationRuleTwo) {
+            this.dataModelForm.replacingValueTwo = null
+          }
           const loading = showLoading(this, '保存中,请稍候···')
           if (this.dataModelForm.id) {
             updateDataModel(this.dataModelForm).then(res => {

+ 1 - 1
chuanyi_client2/src/views/group_item/index.vue

@@ -183,7 +183,7 @@
     </el-dialog>
 
     <el-dialog
-        title="选择四则运算/值替换表达式"
+        title="选择表达式"
         width="500px"
         top="10vh"
         center

+ 80 - 10
chuanyi_client2/src/views/home/index.vue

@@ -30,10 +30,27 @@
                 : (scope.row.chartType == 'line' ? '折线图' : '饼状图') }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="操作" align="center" width="300">
+        <el-table-column
+            align="center"
+            label="状态"
+            prop="reportTableType"
+            width="100">
+          <template slot-scope="scope">
+            <el-tag v-if="scope.row.userId != uid" type="success" style="margin-right: 5px;">被分享</el-tag>
+            <el-tag v-if="uid == scope.row.userId && scope.row.userGroupList && scope.row.userGroupList.length > 0"
+                    type="warning" style="margin-right: 5px;">已分享
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" width="200">
           <template slot-scope="scope">
             <el-button type="text"
                        size="small"
+                       icon="el-icon-edit"
+                       @click="updateChartItem(scope.row)">修改
+            </el-button>
+            <el-button type="text"
+                       size="small"
                        icon="el-icon-delete"
                        style="color: red;"
                        @click="removeChartItem(scope.row)">删除
@@ -55,7 +72,7 @@
 
     <!-- 新增首页图表 -->
     <el-dialog
-        title="添加图表"
+        :title="addIndexChart ? '添加图表' : '修改图表'"
         width="600px"
         top="5vh"
         center
@@ -129,7 +146,8 @@
         </el-form-item>
       </el-form>
       <span slot='footer'>
-        <el-button type="primary" @click="addIndexChartEvent">添加</el-button>
+        <el-button v-if="addIndexChart" type="primary" @click="addIndexChartEvent">添加</el-button>
+        <el-button v-else type="primary" @click="updateIndexChartEvent">修改</el-button>
         <el-button @click="dialogClose">取消</el-button>
       </span>
     </el-dialog>
@@ -145,9 +163,8 @@
 <script>
 import DataItem from '@/components/CustomDialog/DataItem'
 import UserGroup from '@/components/CustomDialog/UserGroup'
-import {goPage, showAlertMsgWin, showAlertWin, showConfirmWin, showLoading} from "@/utils/cqcy";
-import {delIndexChartById, getIndexChartById, getIndexChartList, saveIndexChart} from "@/api/chart";
-import {delItemGroupById} from "@/api/datasource";
+import { showAlertMsgWin, showAlertWin, showConfirmWin, showLoading} from "@/utils/cqcy";
+import {delIndexChartById, getIndexChartById, getIndexChartList, saveIndexChart, updateIndexChart} from "@/api/chart";
 import {mapGetters} from "vuex";
 
 export default {
@@ -159,6 +176,7 @@ export default {
     return {
       roleCodeList: [],
       dialogIndexChartVisible: false,
+      addIndexChart: true,
       hideMainViewFlag: true,
       chartDataList: [],
       chartTotal: 0,
@@ -212,7 +230,8 @@ export default {
   inject: ['__self'],
   computed: {
     ...mapGetters([
-      'roles'
+      'roles',
+      'uid'
     ])
   },
   mounted() {
@@ -239,8 +258,17 @@ export default {
     },
     /** 图表点击事件 */
     handleChartNodeClick(row) {
+    },
+    /** 图表修改事件 */
+    updateChartItem(row) {
       getIndexChartById(row.id).then(res => {
-        console.log(res)
+        if (!res.data) {
+          showAlertMsgWin(this, null, '修改失败!')
+          return
+        }
+        this.chartForm = res.data
+        this.addIndexChart = false
+        this.dialogIndexChartVisible = true
       }).catch((e) => {
         showAlertWin(this, null, e)
       })
@@ -262,6 +290,7 @@ export default {
     },
     /** 保存首页图表添加事件 */
     addIndexChartBtnEvent() {
+      this.addIndexChart = true
       this.dialogIndexChartVisible = true
     },
     /** 查询首页图表信息 */
@@ -294,6 +323,30 @@ export default {
       // this.chartForm.startTime = this.chartForm.dateRange[0]
       // this.chartForm.endTime = this.chartForm.dateRange[1]
       saveIndexChart(this.chartForm).then(res => {
+        this.addIndexChart = true
+        this.dialogIndexChartVisible = false
+        this.getIndexAllChart()
+        showAlertMsgWin(this, null, res.data)
+      }).catch((e) => {
+        showAlertWin(this, null, e)
+      })
+    },
+    /** 修改图表信息 */
+    updateIndexChartEvent() {
+      if (!this.chartForm.chartName || !this.chartForm.chartName.trim()) {
+        showAlertMsgWin(this, null, '图表名称不能为空!')
+        return
+      }
+      if (this.chartForm.chartItemList.length == 0) {
+        showAlertMsgWin(this, null, '数据项不能为空!')
+        return
+      }
+      if (this.chartForm.userGroupList.length == 0) {
+        showAlertMsgWin(this, null, '用户组不能为空!')
+        return
+      }
+      updateIndexChart(this.chartForm).then(res => {
+        this.addIndexChart = true
         this.dialogIndexChartVisible = false
         this.getIndexAllChart()
         showAlertMsgWin(this, null, res.data)
@@ -322,15 +375,32 @@ export default {
     },
     /** 选择数据项 */
     chooseDataItemEvent() {
-      this.$refs.dataItem.show()
+      let chartItemList = this.chartForm.chartItemList
+      let groupId = null
+      let items = []
+      if (chartItemList && chartItemList.length > 0) {
+        groupId = chartItemList[0].itemGroupId
+        chartItemList.forEach((t) => {
+          items.push(t.itemId)
+        })
+      }
+      this.$refs.dataItem.show(groupId, items)
     },
     /** 选择用户组 */
     chooseUserGroupEvent() {
-      this.$refs.userGroup.show()
+      let userGroups = this.chartForm.userGroupList
+      let groups = []
+      if (userGroups && userGroups.length > 0) {
+        userGroups.forEach((t) => {
+          groups.push(t.id)
+        })
+      }
+      this.$refs.userGroup.show(groups)
     },
     /** 弹出层关闭事件 */
     dialogClose(done) {
       Object.assign(this.$data.chartForm, this.$options.data.call(this).chartForm)
+      this.addIndexChart = true
       if (typeof (done) === 'function') {
         done()
       } else {

+ 2 - 2
chuanyi_client2/src/views/index.vue

@@ -109,13 +109,13 @@ export default {
       } else if (type == 4) {
         gotoPage(this, '/userGroup')
       } else {
-        this.changeTabType()
         gotoPage(this, '/index')
+        this.changeTabType()
       }
     },
     /** Tab 改变事件 */
     changeTabType(tab) {
-      if (this.$refs.childView) this.$refs.childView.hideMainView(tab == null)
+      if (this.$refs.childView && this.$refs.childView.hideMainView) this.$refs.childView.hideMainView(tab == null)
     },
     refreshReportTemplateData(val) {
       this.refreshReportTemplateDataFlag = val

+ 1 - 1
chuanyi_client2/src/views/report_template/index.vue

@@ -305,7 +305,7 @@
     </el-dialog>
 
     <el-dialog
-        title="选择四则运算/值替换表达式"
+        title="选择表达式"
         width="500px"
         top="10vh"
         center

+ 5 - 0
reado-app/static/webview/record-wv.html

@@ -231,6 +231,7 @@
 					/** 绘制表格数据 */
 					function drawTableData(tableItemList, type, tableInfo) {
 						if (!tableItemList || tableItemList.length == 0) {
+
 							updateLocalExcelContent()
 							return
 						}
@@ -292,6 +293,7 @@
 								})
 							  }
 							})
+
 							updateLocalExcelContent()
 							return
 						}
@@ -314,6 +316,7 @@
 							  })
 							}
 						})
+
 						updateLocalExcelContent()
 					}
 					
@@ -341,6 +344,7 @@
 					            luckysheet.setCellValue(yAxis + j, xAxis, v)
 					            if (hasCalc) {
 					              let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+
 					              let minutes = calculateMinutes(startDate, v)
 					              luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
 					            }
@@ -367,6 +371,7 @@
 					                  luckysheet.setCellValue(yAxis + j, xAxis, v)
 					                  if (hasCalc) {
 					                    let startDate = luckysheet.getCellValue(yAxis + j, xAxis - 1)
+
 					                    let minutes = calculateMinutes(startDate, v)
 					                    luckysheet.setCellValue(yAxis + j, xAxis + 1, minutes)
 					                  }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.