| | |
| | | url: 'Device_infAction!serchAllFile', |
| | | data: null |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 获取文件导出时的进度条 |
| | | * 参数 null |
| | | */ |
| | | getProgress() { |
| | | return axios({ |
| | | method: 'post', |
| | | url: 'LoginAction!serchFileProgress', |
| | | data: null |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 文件下载 |
| | |
| | | |
| | | /** |
| | | * 编辑用户 |
| | | * 参数UName, UJobGroup, UNote |
| | | */ |
| | | update(data) { |
| | | return axios({ |
| | |
| | | router: '/batt-list/history', |
| | | }, |
| | | { |
| | | txt: '系统日志', |
| | | txt: '软件日志', |
| | | name: 'PagesSystem', |
| | | router: '/system', |
| | | }, |
| | |
| | | // 引入自定义主题 |
| | | import "./theme/transparent" |
| | | |
| | | import { |
| | | getMaxFromArr, |
| | | } from '../../assets/js/common.js' |
| | | // import { |
| | | // getMaxFromArr, |
| | | // } from '../../assets/js/common.js' |
| | | |
| | | export default { |
| | | props: { |
| | |
| | | unit: { |
| | | type: String, |
| | | default: '', |
| | | } |
| | | }, |
| | | 'trigger-on': { |
| | | type: String, |
| | | default: 'mousemove', |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | chart: "", |
| | | tooltip: { |
| | | triggerOn: this.triggerOn, |
| | | }, |
| | | dataZoom: { |
| | | show: this.showZoom, |
| | | disabled: this.zoom, |
| | |
| | | let dataZoom = this.dataZoom; |
| | | let unit = this.unit; |
| | | let history = this.history; |
| | | let tooltip = this.tooltip; |
| | | // 默认配置项 |
| | | let option = { |
| | | animation: false, |
| | |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | triggerOn: tooltip.triggerOn, |
| | | hideDelay: 10000, |
| | | formatter: function(params) { |
| | | var res = params[0].name; |
| | | var cols = Math.ceil(params.length/5); |
| | |
| | | res += '<br>'; |
| | | } |
| | | res += params[i].marker+params[i].seriesName |
| | | +': '+params[i].value+unit+ |
| | | +': '+params[i].value[1]+unit+ |
| | | "<span style='display: inline-block;margin-right: 8px'></span>"; |
| | | } |
| | | return res; |
| | |
| | | }, |
| | | yAxis: { |
| | | show: false, |
| | | max: null, |
| | | max: function(minMax) { |
| | | |
| | | return minMax.max*2; |
| | | }, |
| | | }, |
| | | dataZoom: [ |
| | | { |
| | |
| | | smooth: true, |
| | | symbolSize: 0, |
| | | sampling: 'average', |
| | | hoverAnimation:false, |
| | | data: [] |
| | | }] |
| | | }; |
| | |
| | | }else { |
| | | option.xAxis.data = opt.xAxis.data; |
| | | } |
| | | |
| | | |
| | | // 修改yAxis |
| | | if(opt.series != undefined) { |
| | | option.series = opt.series; |
| | | let sOptions = {}; |
| | | for(let key in opt.series[0]) { |
| | | if(key == 'data') { |
| | | sOptions[key] = opt.series[0].data.join(',').split(','); |
| | | }else { |
| | | sOptions[key] = opt.series[0][key]; |
| | | } |
| | | } |
| | | option.series[0] = sOptions; |
| | | } |
| | | |
| | | var values = option.series[0]?option.series[0].data:[1]; |
| | | var max = getMaxFromArr(values)*2; |
| | | option.yAxis.max = max; |
| | | // var values = option.series[0]?option.series[0].data:[1]; |
| | | // var max = getMaxFromArr(values)*2; |
| | | // option.yAxis.max = max; |
| | | // 设置图表的subtext |
| | | let dataIndex = this.dataIndex == -1?option.xAxis.data.length:this.dataIndex; |
| | | |
| | |
| | | if(!this.subtext || option.xAxis.data[dataIndex-1] == undefined) { |
| | | option.title.subtext=""; |
| | | } |
| | | |
| | | // 格式化data的数据 |
| | | let list = option.xAxis.data.map(function(value, index) { |
| | | let datas = option.series[0].data; |
| | | return [value, datas[index]]; |
| | | }); |
| | | delete option.xAxis.data |
| | | option.series[0].data = list; |
| | | |
| | | // 绘制图表 |
| | | this.$G.chartManage.get(this.id).setOption(option); |
| | | }, |
| | | appendData(data) { |
| | | // 绘制图表 |
| | | this.$G.chartManage.get(this.id).appendData({ |
| | | seriesIndex: 0, |
| | | data: data, |
| | | }); |
| | | }, |
| | | changeFullState: function() { |
| | | this.isFull = this.isFull?false:true; |
| | |
| | | chart.on('showTip', (data)=>{ |
| | | this.dataIndex = data.dataIndex; |
| | | let option = this.$G.chartManage.get(this.id).getOption(); |
| | | this.history.time = option.xAxis[0].data[data.dataIndex-1]; |
| | | this.history.value = option.series[0].data[data.dataIndex-1]; |
| | | this.history.time = option.series[0].data[data.dataIndex][0]; |
| | | this.history.value = option.series[0].data[data.dataIndex][1]; |
| | | }); |
| | | }, |
| | | destroyed() { |
| | |
| | | data() { |
| | | // 配置导出的action |
| | | let action = this.$config.http+'EXportCSV.servlet'; |
| | | |
| | | let record_time = new Date().format('yyyy-MM-dd hh:mm:ss'); |
| | | let record_time1 = new Date().format('yyyy-MM-dd hh:mm:ss'); |
| | | return { |
| | | loading: false, |
| | | layerLoad: '', |
| | |
| | | sliderOptions: {}, |
| | | drawer: false, |
| | | showChartTitle: [], |
| | | record_time: new Date(), |
| | | record_time1: new Date(), |
| | | record_time: new Date(record_time), |
| | | record_time1: new Date(record_time1), |
| | | pickerRange: { |
| | | start: '2019-01-01 00:00:00', |
| | | end: new Date().format('yyyy-MM-dd hh:mm:ss'), |
| | |
| | | let self = this; |
| | | let checkFormResult = this.checkFromData(); |
| | | if(checkFormResult.code == 1) { |
| | | let loading = self.$layer.loading(1); |
| | | this.layerLoad = this.$layer.loading(1); |
| | | let searchParams = checkFormResult.data; |
| | | let timeRanges = this.getTimeRanges(); |
| | | searchParams.record_time = timeRanges[0].record_time; |
| | | searchParams.record_time1 = timeRanges[0].record_time1; |
| | | // 查询历史数据 |
| | | this.$api.batt.searchHistoryData(searchParams) |
| | | .then(function(res) { |
| | |
| | | if(res.code == 1) { |
| | | data = res.data; |
| | | } |
| | | // 关闭弹出框 |
| | | self.$layer.close(loading); |
| | | |
| | | // 格式化数据并返回内容 |
| | | self.formatHistoryData(data, resize); |
| | | |
| | | // 循环执行余下的数据 |
| | | self.loopSearchHistoryData(timeRanges, 1, searchParams); |
| | | }).catch(function(error) { |
| | | console.log(error); |
| | | // 关闭弹出框 |
| | | self.$layer.close(loading); |
| | | // 关闭等待框 |
| | | self.$layer.close(self.layerLoad); |
| | | // 提示信息 |
| | | self.$layer.msg('获取数据失败!'); |
| | | }); |
| | |
| | | this.$layer.msg(checkFormResult.msg); |
| | | } |
| | | |
| | | }, |
| | | getTimeRanges() { |
| | | let record_time = this.record_time.getTime(); // 开始时间 |
| | | let record_time1 = this.record_time1.getTime(); // 结束时间 |
| | | let step = 3600*1000; // 一小时 |
| | | let nowTime = record_time + step; |
| | | let timeRanges = []; |
| | | while(nowTime<=(record_time1+step)) { |
| | | let endTime = nowTime>record_time1?record_time1:nowTime; |
| | | let tmp = { |
| | | record_time: new Date(record_time).format('yyyy-MM-dd hh:mm:ss'), |
| | | record_time1: new Date(endTime).format('yyyy-MM-dd hh:mm:ss'), |
| | | }; |
| | | record_time = nowTime + 1000; |
| | | nowTime = record_time + step; |
| | | timeRanges.push(tmp); |
| | | } |
| | | return timeRanges; |
| | | }, |
| | | loopSearchHistoryData(timeRanges, num, searchParams) { |
| | | let self = this; |
| | | let timeRange = timeRanges[num]; |
| | | // 无法获取到timeRange返回 |
| | | if(!timeRange) { |
| | | this.resizeCharts(); |
| | | // 关闭等待框 |
| | | this.$layer.close(this.layerLoad); |
| | | this.$layer.msg('数据加载完成'); |
| | | return; |
| | | } |
| | | // 更新循环量(重要) |
| | | num++; |
| | | // 设置开始和结束日期 |
| | | searchParams.record_time = timeRange.record_time; |
| | | searchParams.record_time1 = timeRange.record_time1; |
| | | // 查询历史数据 |
| | | this.$api.batt.searchHistoryData(searchParams) |
| | | .then(function(res) { |
| | | res = JSON.parse(res.data.result); |
| | | let data = []; |
| | | if(res.code == 1) { |
| | | data = res.data; |
| | | } |
| | | // 格式化数据并返回内容 |
| | | self.formatHistoryAppendData(data); |
| | | |
| | | // 回到函数 |
| | | self.loopSearchHistoryData(timeRanges, num, searchParams); |
| | | }).catch(function(error) { |
| | | console.log(error); |
| | | // 关闭等待框 |
| | | self.$layer.close(self.layerLoad); |
| | | // 提示信息 |
| | | self.$layer.msg('获取数据失败!'); |
| | | }); |
| | | }, |
| | | checkFromData() { |
| | | var result = { |
| | |
| | | result.msg = '开始时间大于结束时间'; |
| | | return result; |
| | | } |
| | | |
| | | // 开始日期和结束日期不能超过一天验证 |
| | | if(this.record_time1.getTime() - this.record_time.getTime()> 8.64e7 - 1000) { |
| | | if(this.record_time1.getTime() - this.record_time.getTime()> 86400196) { |
| | | result.code = 0; |
| | | result.msg = '时间间隔不能超出一天'; |
| | | return result; |
| | | } |
| | | |
| | | |
| | | result.data = { |
| | | dev_id: batt.dev_id, |
| | | dev_name: batt.full_name, |
| | |
| | | }); |
| | | } |
| | | }, |
| | | formatHistoryAppendData(data) { |
| | | // 无数据返回 |
| | | if(data.length == 0) { |
| | | return; |
| | | } |
| | | // 配置项 |
| | | let options = this.options; |
| | | // 定义配置量 |
| | | let chartOptions = {}; |
| | | let sliderChartOptions = {}; |
| | | // 遍历options的属性 |
| | | let flag = 0; |
| | | Object.keys(options).forEach(function(key) { |
| | | if(options[key].show) { |
| | | if(flag == 0) { |
| | | sliderChartOptions['slider'+key] = []; |
| | | } |
| | | chartOptions[key] = []; |
| | | flag++; |
| | | } |
| | | }); |
| | | // 遍历data的值 |
| | | for(let i=0; i<data.length; i++) { |
| | | let _data = data[i]; |
| | | let index = 0; |
| | | // 遍历options的属性 |
| | | Object.keys(options).forEach(function(key) { |
| | | if(options[key].show) { |
| | | |
| | | // 滑动配置项 |
| | | if(sliderChartOptions['slider'+key]) { |
| | | let appendData = [_data.record_time, _data.list[index]]; |
| | | sliderChartOptions['slider'+key].push(appendData); |
| | | } |
| | | |
| | | // 图表配置项 |
| | | let appendData = [_data.record_time, _data.list[index]]; |
| | | chartOptions[key].push(appendData); |
| | | |
| | | index++ |
| | | } |
| | | }); |
| | | } |
| | | // 添加数据到图表中 |
| | | this.appendOptions(chartOptions, sliderChartOptions); |
| | | }, |
| | | setOptions() { |
| | | let groups = []; |
| | | // 设置配置项 |
| | |
| | | |
| | | // 或者可以直接传入需要联动的实例数组 |
| | | this.$G.chartManage.connect(groups); |
| | | // 提示信息 |
| | | this.$layer.msg('数据加载完成!'); |
| | | }, |
| | | appendOptions(options, sliderOptions) { |
| | | // 设置配置项 |
| | | for(let key in options) { |
| | | // 配置项初始化 |
| | | this.$refs[key][0].appendData(options[key]); |
| | | } |
| | | |
| | | // 滚动条配置 |
| | | for(let key in sliderOptions) { |
| | | // 配置项初始化 |
| | | this.$refs[key][0].appendData(sliderOptions[key]); |
| | | } |
| | | }, |
| | | resizeCharts() { |
| | | // 设置配置项 |
| | |
| | | this.$G.chartManage.resize(key); |
| | | } |
| | | } |
| | | |
| | | // 设置配置项 |
| | | for(let key in this.sliderOptions) { |
| | | if(this.sliderOptions[key].show) { |
| | | // 配置项初始化 |
| | | this.$G.chartManage.resize(key); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | ensureSelects: function(res) { |
| | | let options = this.options; |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | | padding-top: 0.08rem; |
| | | padding-bottom: 0.08rem; |
| | | } |
| | | .line-chart-item { |
| | | flex: 1; |
| | |
| | | <div class="line-chart-item" v-if="option.show" :key="key"> |
| | | <line-chart :id="key" :ref="key" |
| | | :title="option.title" :height="option.height" |
| | | :subtext="true" :unit="option.unit"></line-chart> |
| | | :subtext="true" :unit="option.unit" trigger-on="click"></line-chart> |
| | | </div> |
| | | </template> |
| | | <div class="no-chart-text" v-if="showChartTitle.length==0">暂无图表显示</div> |
| | |
| | | let options = this.options; |
| | | // 遍历options的属性 |
| | | Object.keys(options).forEach(function(key) { |
| | | // 大于100笔数据移除第一笔数据 |
| | | if(options[key].option.series[0].data.length >=100) { |
| | | options[key].option.series[0].data.shift(); |
| | | options[key].option.xAxis.data.shift(); |
| | | let length = options[key].option.series[0].data.length; |
| | | let isUpdate = false; |
| | | if(options[key].option.xAxis.data[length-1] != data[0].record_time) { |
| | | isUpdate = true; |
| | | } |
| | | |
| | | // 添加数据 |
| | | options[key].option.series[0].data.push(data[0].list[options[key].num]); |
| | | options[key].option.xAxis.data.push(data[0].record_time); |
| | | // 更新数据 |
| | | if(isUpdate) { |
| | | // 大于100笔数据移除第一笔数据 |
| | | if(length >=100) { |
| | | options[key].option.series[0].data.shift(); |
| | | options[key].option.xAxis.data.shift(); |
| | | } |
| | | |
| | | // 添加数据 |
| | | options[key].option.series[0].data.push(data[0].list[options[key].num]); |
| | | options[key].option.xAxis.data.push(data[0].record_time); |
| | | } |
| | | }); |
| | | // 遍历data的值 |
| | | let record_time = data[0].record_time; |
| | |
| | | }); |
| | | |
| | | // 添加表格数据 |
| | | if(this.tbl.tbData >= 100) { |
| | | this.tbl.tbData.pop(); |
| | | if(this.tbl.tbData[0].record_time != realTimeData.record_time) { |
| | | if(this.tbl.tbData >= 100) { |
| | | this.tbl.tbData.pop(); |
| | | } |
| | | this.tbl.tbData.unshift(realTimeData); |
| | | } |
| | | this.tbl.tbData.unshift(realTimeData) |
| | | |
| | | // 设置图表 |
| | | if(this.type=='chart') { |
| | | this.setOptions(); |
| | |
| | | } |
| | | .line-chart-group { |
| | | box-sizing: border-box; |
| | | padding-top: 0.08rem; |
| | | padding-bottom: 0.08rem; |
| | | } |
| | | .page-tools { |
| | | text-align: right; |
| | |
| | | import FlexLayout from '@/components/FlexLayout' |
| | | import ContentBox from '@/components/ContentBox' |
| | | import MyTree from '@/components/tree/Index' |
| | | import { setTimeout } from 'timers'; |
| | | export default { |
| | | name: 'pagesFile', |
| | | components: { |
| | |
| | | // 单个下载 |
| | | download (obj) { |
| | | this.tableName = obj.table_date; |
| | | //this.getProgress(); |
| | | |
| | | this.$nextTick(()=>{ |
| | | this.$refs.export.submit(); |
| | | }); |
| | | }, |
| | | getProgress: function() { |
| | | let self = this; |
| | | // 请求后台获取进度 |
| | | this.$api.file.getProgress() |
| | | .then(function(res){ |
| | | res = JSON.parse(res.data.result); |
| | | console.log(res.data); |
| | | if(res.data<100) { |
| | | setTimeout(self.getProgress, 10); |
| | | } |
| | | }); |
| | | }, |
| | | treeClick(data) { |
| | | console.log(data, 'data'); |
| | | if (!data.end){ |
| | | return false; |
| | | } |
| | |
| | | this.$api.file.searchAllDevice() |
| | | .then((res) => { |
| | | const data = JSON.parse(res.data.result); |
| | | console.log(data); |
| | | let List = []; |
| | | let obj = {}; |
| | | if (data.code == 1) { |
| | |
| | | children |
| | | }); |
| | | } |
| | | console.log(this.treeData, '====treeData'); |
| | | }); |
| | | }).catch(() => { |
| | | this.$message({ |
| | |
| | | }, |
| | | // 行勾选状态变化 |
| | | selectChange (selection) { |
| | | console.log(selection); |
| | | this.selection = selection; |
| | | } |
| | | } |
| | |
| | | this.$api.login.checkSessionId() |
| | | .then(function(res) { |
| | | res = JSON.parse(res.data.result); |
| | | if(!res.data.UName || self.$store.state.login.username == "") { |
| | | if(!res.data.UName) { |
| | | // 退出到登录页 |
| | | self.$router.push('/login'); |
| | | } |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | //this.startCheckSessionId(); |
| | | this.startCheckSessionId(); |
| | | }, |
| | | destroyed() { |
| | | // 关闭计时器 |
| | |
| | | <!-- 武汉源畅 --> |
| | | <div class="info"> |
| | | <div class="">FMDS 设备数据记录平台</div> |
| | | <p>武汉源畅科技</p> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | }, |
| | | ], |
| | | tableData: [], |
| | | dateRange: ['2000-01-01', new Date().format('yyyy-MM-dd')], |
| | | dateRange: [new Date().format('yyyy-MM-dd'), new Date().format('yyyy-MM-dd')], |
| | | operationList: [ |
| | | { |
| | | value: '1', |
| | |
| | | data = res.data; |
| | | let page = data[data.length -1].page; |
| | | self.searchParams.page.pageAll = page.pageAll; |
| | | }else { |
| | | self.searchParams.page.pageAll = 0; |
| | | } |
| | | |
| | | // 设置表格数据 |
| | |
| | | <el-button type="primary" size="mini" |
| | | @click="showEditDialog(scope.row)">编辑</el-button> |
| | | <el-button type="danger" size="mini" |
| | | :disabled="scope.row.UName == 'superuser'" |
| | | @click="confirmDelUser(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | size="small" label-position="right" :rules="editUser.rules"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="用户名:" prop="UName"> |
| | | <el-input v-model="editUser.info.UName"></el-input> |
| | | <el-input v-model="editUser.info.UName" :disabled="true"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | |
| | | addUserClosed: function() { |
| | | var userInfo = { |
| | | UName: '', |
| | | USnId: '', |
| | | USnId: '123456', |
| | | UJobGroup: '', |
| | | UNote: '', |
| | | }; |
| | |
| | | }); |
| | | }, |
| | | showEditDialog: function(userInfo) { |
| | | let self = this; |
| | | // 显示弹出框 |
| | | this.editUser.show = true; |
| | | // 遍历userInfo属性修改编辑用户的值 |
| | | Object.keys(userInfo).forEach(function(key) { |
| | | console.log(key); |
| | | self.editUser.info[key] = userInfo[key]; |
| | | }); |
| | | }, |
| | | editUserClosed: function() { |
| | | var userInfo = { |
| | | UName: '', |
| | | USnId: '123456', |
| | | UJobGroup: '', |
| | | UNote: '', |
| | | }; |
| | | // 初始化添加用户信息 |
| | | this.editUser.info = userInfo; |
| | | |
| | | // 初始化添加用户表单 |
| | | this.$refs.editUser.resetFields(); |
| | | }, |
| | | editUserSubmit: function() { |
| | | |
| | | var self = this; |
| | | this.$refs.editUser.validate(function(valid) { |
| | | if(valid) { |
| | | self.editUser.info.Upassword = hex_md5(self.editUser.info.USnId); |
| | | self.editUserOk(self.editUser.info); |
| | | } |
| | | }); |
| | | }, |
| | | editUserOk: function(userInfo){ |
| | | console.log(userInfo); |
| | | var self = this; |
| | | this.$api.user.update(userInfo) |
| | | .then(function(res){ |
| | | res = JSON.parse(res.data.result); |
| | | if(res.code == 1) { |
| | | // 提示信息 |
| | | self.$message({ |
| | | type: 'success', |
| | | message: res.msg, |
| | | }); |
| | | |
| | | // 关闭弹出框 |
| | | self.editUser.show = false; |
| | | |
| | | // 查询用户列表 |
| | | self.searchUserListAll(); |
| | | }else { |
| | | // 提示信息 |
| | | self.$message({ |
| | | type: 'warning', |
| | | message: res.msg, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | confirmDelUser: function(userInfo) { |
| | | var self = this; |