Merge pull request ''改数据分析bug'' (#26) from fzq into develop
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			Reviewed-on: #26
This commit is contained in:
		@@ -446,6 +446,7 @@ export default {
 | 
			
		||||
		// 获取工序列表
 | 
			
		||||
		getWorksetionList() {
 | 
			
		||||
			// 分页列表才有根据产线过滤功能
 | 
			
		||||
			// this.wsList = []
 | 
			
		||||
			for (let i = 0; i < this.lineIds.length; i++) {
 | 
			
		||||
				this.$http({
 | 
			
		||||
					// url: this.$http.adornUrl('/monitoring/workshopSection/list'),
 | 
			
		||||
@@ -582,6 +583,8 @@ export default {
 | 
			
		||||
					// 	this.renderChart()
 | 
			
		||||
					// })
 | 
			
		||||
				}
 | 
			
		||||
			}).catch((err) => {
 | 
			
		||||
				// console.error(err)
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		setOptions(opts) {
 | 
			
		||||
@@ -592,29 +595,29 @@ export default {
 | 
			
		||||
			if (this.chart) this.chart.setOption(this.defaultOpts, true)
 | 
			
		||||
		},
 | 
			
		||||
		// 失效函数
 | 
			
		||||
		parseTableProps(nameData) {
 | 
			
		||||
			const subProps = []
 | 
			
		||||
			const labelNameMap = new Map()
 | 
			
		||||
		// parseTableProps(nameData) {
 | 
			
		||||
		// 	const subProps = []
 | 
			
		||||
		// 	const labelNameMap = new Map()
 | 
			
		||||
 | 
			
		||||
			// if (nameData.length) {
 | 
			
		||||
			// 	/** 处理 nameData */
 | 
			
		||||
			// 	nameData.forEach((item) => {
 | 
			
		||||
			// 		if (!labelNameMap.get(item.name)) {
 | 
			
		||||
			// 			labelNameMap.set(item.name, 1)
 | 
			
		||||
			// 			subProps.push({ name: item.name, prop: item.name })
 | 
			
		||||
			// 		}
 | 
			
		||||
			// 	})
 | 
			
		||||
			// }
 | 
			
		||||
		// 	// if (nameData.length) {
 | 
			
		||||
		// 	// 	/** 处理 nameData */
 | 
			
		||||
		// 	// 	nameData.forEach((item) => {
 | 
			
		||||
		// 	// 		if (!labelNameMap.get(item.name)) {
 | 
			
		||||
		// 	// 			labelNameMap.set(item.name, 1)
 | 
			
		||||
		// 	// 			subProps.push({ name: item.name, prop: item.name })
 | 
			
		||||
		// 	// 		}
 | 
			
		||||
		// 	// 	})
 | 
			
		||||
		// 	// }
 | 
			
		||||
 | 
			
		||||
			this.tableConfigDynamic = [
 | 
			
		||||
				{ type: 'index', width: 100, name: i18n.t('index') },
 | 
			
		||||
				{ name: i18n.t('pl.name'), prop: '0' },
 | 
			
		||||
				...Array.from(new Set(res.data.data[0].records.map((item) => moment(item.recordTime).format('MM-DD')))).map((name) => ({ prop: String(++this.count), name }))
 | 
			
		||||
			]
 | 
			
		||||
			/** echarts related */
 | 
			
		||||
			// this.echartCategories = subProps.map((item) => item.name)
 | 
			
		||||
			this.echartCategories = this.dataListDynamic.map((item) => item.name)
 | 
			
		||||
		},
 | 
			
		||||
		// 	this.tableConfigDynamic = [
 | 
			
		||||
		// 		{ type: 'index', width: 100, name: i18n.t('index') },
 | 
			
		||||
		// 		{ name: i18n.t('pl.name'), prop: '0' },
 | 
			
		||||
		// 		...Array.from(new Set(res.data.data[0].records.map((item) => moment(item.recordTime).format('MM-DD')))).map((name) => ({ prop: String(++this.count), name }))
 | 
			
		||||
		// 	]
 | 
			
		||||
		// 	/** echarts related */
 | 
			
		||||
		// 	// this.echartCategories = subProps.map((item) => item.name)
 | 
			
		||||
		// 	this.echartCategories = this.dataListDynamic.map((item) => item.name)
 | 
			
		||||
		// },
 | 
			
		||||
 | 
			
		||||
		// parseDynamicData(data) {
 | 
			
		||||
		// 	this.echartCheckTypes.splice(0)
 | 
			
		||||
@@ -740,9 +743,11 @@ export default {
 | 
			
		||||
					//遍历属性
 | 
			
		||||
					this.keys = [...Object.keys(res.data),...this.keys]
 | 
			
		||||
					// console.log('this.finalVal', this.finalVal)
 | 
			
		||||
					// console.log('keys', this.keys)
 | 
			
		||||
					console.log('keys', this.keys)
 | 
			
		||||
					this.values = Object.values(res.data)
 | 
			
		||||
					// console.log('values', this.values)
 | 
			
		||||
					// 初始化values2
 | 
			
		||||
					this.values2 = []
 | 
			
		||||
					for (let c = 0; c < this.values.length; c++) {
 | 
			
		||||
						this.values2.push(
 | 
			
		||||
							this.values[c].map((item) => {
 | 
			
		||||
@@ -750,8 +755,9 @@ export default {
 | 
			
		||||
							})
 | 
			
		||||
						)
 | 
			
		||||
					}
 | 
			
		||||
					console.log('values2', this.values2)
 | 
			
		||||
					this.finalVal = [...this.values2,...this.finalVal]
 | 
			
		||||
					// console.log('this.finalVal', this.finalVal)
 | 
			
		||||
					console.log('this.finalVal', this.finalVal)
 | 
			
		||||
					this.$message.success(this.$t('pl.success'))
 | 
			
		||||
					this.$nextTick(() => {
 | 
			
		||||
						this.dialogVisible = false
 | 
			
		||||
 
 | 
			
		||||
@@ -165,7 +165,64 @@ const FakeChart = {
 | 
			
		||||
				},
 | 
			
		||||
				toolbox: {
 | 
			
		||||
					feature: {
 | 
			
		||||
						dataView: { show: true, readOnly: false },
 | 
			
		||||
						dataView: {
 | 
			
		||||
							show: true,
 | 
			
		||||
							readOnly: true,
 | 
			
		||||
							optionToContent: function (opt) {
 | 
			
		||||
								var axisData = opt.xAxis[0].data
 | 
			
		||||
								var series = opt.series
 | 
			
		||||
								//验证是否是中文
 | 
			
		||||
								var pattern = new RegExp('[\u4E00-\u9FA5]+')
 | 
			
		||||
								if (pattern.test(series[0].name)) {
 | 
			
		||||
									var table =
 | 
			
		||||
										'<table class="layui-table" style="width:100%;text-align:center"><tbody><tr>' +
 | 
			
		||||
										'<td>设备名称</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[0].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[1].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[2].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'</tr>'
 | 
			
		||||
								} else {
 | 
			
		||||
									var table =
 | 
			
		||||
										'<table class="layui-table" style="width:100%;text-align:center"><tbody><tr>' +
 | 
			
		||||
										'<td>Equipment Name</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[0].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[1].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[2].name +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'</tr>'
 | 
			
		||||
								}
 | 
			
		||||
								for (var i = 0, l = axisData.length; i < l; i++) {
 | 
			
		||||
									table +=
 | 
			
		||||
										'<tr>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										axisData[i] +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[0].data[i] +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[1].data[i] +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'<td>' +
 | 
			
		||||
										series[2].data[i] +
 | 
			
		||||
										'</td>' +
 | 
			
		||||
										'</tr>'
 | 
			
		||||
								}
 | 
			
		||||
								table += '</tbody></table>'
 | 
			
		||||
								return table
 | 
			
		||||
							}
 | 
			
		||||
						},
 | 
			
		||||
						restore: { show: true },
 | 
			
		||||
						saveAsImage: { show: true }
 | 
			
		||||
					}
 | 
			
		||||
@@ -531,7 +588,7 @@ export default {
 | 
			
		||||
					this.echartRealtime = this.echartCategories
 | 
			
		||||
					// this.parseTableProps(res.data.nameData)
 | 
			
		||||
 | 
			
		||||
					// console.log('this.dataListDynamic', this.dataListDynamic)
 | 
			
		||||
					console.log('this.dataListDynamic', this.dataListDynamic)
 | 
			
		||||
 | 
			
		||||
					this.buildGraphData()
 | 
			
		||||
				})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user