diff --git a/src/i18n/jp.js b/src/i18n/jp.js index fa56b5d9f5..305d52f91d 100644 --- a/src/i18n/jp.js +++ b/src/i18n/jp.js @@ -1366,6 +1366,13 @@ export default { 报告操作: 'レポート', 报告配置: 'レポート構成', 生成报告: '生成', + 报告信息: '情報', + 生成时间: '生成時間', + 文件地址: 'ファイルアドレス', + 预览: 'プレビュー', + 下载: 'ダウンロード', + 删除: '削除#サクジョ#', + 报告生成成功: 'レポート生成成功', }, }, } diff --git a/src/views/CloudPressure/index.vue b/src/views/CloudPressure/index.vue index 2fee3c5454..4537d92e14 100644 --- a/src/views/CloudPressure/index.vue +++ b/src/views/CloudPressure/index.vue @@ -28,6 +28,67 @@ + + + + + + + + + @@ -506,8 +579,53 @@ beforeClose() { this.fetchData() }, + showDocxInfo(info) { + const _docxInfo = info.basedata.docxInfo + _docxInfo.forEach((i) => { + i.timestamp = this.$moment + .unix(i.timestamp) + .format('YYYY-MM-DD HH:mm:ss') + }) + this.details = info + console.log(info) + this.report = true + }, async generateReport(row) { - console.log(row) + const params = { + reportid: row.objectId, + templateUrl: row.basedata.templateUrl, + grafanaHost: location.hostname, + parseHost: location.hostname, + } + + const res = await axios.post('/grafana/generateReport', params, { + headers: { + 'Access-Control-Allow-Origin': '*', //解决cors头问题 + 'Access-Control-Allow-Credentials': 'true', //解决session问题 + 'Content-Type': 'application/json', //将表单数据传递转化为application/json类型 + sessionToken: this.usertoken, + }, + withCredentials: true, + }) + this.$baseMessage(this.$translateTitle('pressure.报告生成成功')) + }, + async preview(fileurl) { + const encodeUrl = encodeURIComponent(Base64.encode(fileurl)) + window.open( + // + `${location.hostname}:8012/onlinePreview?url=${encodeUrl}` + ) + console.log('encodeUrl', encodeUrl, fileurl) + }, + async download(row) { + window.location = row.docxUrl + }, + async delete_item(row, index, tableData) { + tableData.splice(index, 1) + console.log(tableData) + await putDevice(this.details.objectId, { + basedata: this.details.basedata, + }) }, async busButton(col, type) { console.log(col, type) @@ -839,6 +957,9 @@ const { count = 0, results = [] } = await queryDevice(params) const timeExp = /\[(\d{2,}):(\d{2})(?:\.(\d{2,3}))?]/g results.forEach((i) => { + i?.basedata?.templateUrl + ? '' + : (i.basedata = { templateUrl: '', docxInfo: [] }) i.startTime = i?.profile?.startTime ? this.$moment .unix(i.profile.startTime)