Skip to content

Commit

Permalink
feat(cloudPressure): 压测报告生成添加等待时间 优化loading
Browse files Browse the repository at this point in the history
修复位置回显错误的问题
  • Loading branch information
h7ml committed Jun 23, 2022
1 parent 38d6fd5 commit 7ee61f2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,22 @@ module.exports = {
{ value: 'revert', name: 'revert: 回滚 commit' },
],
scopes: [
['dashboard','总控台'],
['multitenant','多租户'],
['equipmentCloud','设备云'],
['cloudOperations','云运维'],
['cloudFunction','云函数'],
['cloudTest','云检测'],
['cloudSystem','云系统'],
['cloudLogs','云日志'],
['cloudPressure','云压测'],
['projects', '项目搭建'],
['components', '组件相关'],
['vuex', 'vuex 相关'],
['issues', 'issues 修复'],
['utils', 'utils 相关'],
['styles', '样式相关'],
['api', 'api相关'],
['deps', '项目依赖'],
['auth', '对 auth 修改'],
['other', '其他修改'],
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

### Bug Fixes

* **components:** 百度地图 ([d2d36cd](https://github.com/dgiot/dgiot-dashboard/commit/d2d36cd565d8dde402892789ce01a84aa47f0752))
* **components:** 设备列表 ([7a5b59b](https://github.com/dgiot/dgiot-dashboard/commit/7a5b59b9bbbd9163e5df359224f5b6b433b2432e))
* **components:** 设备列表 ([a9dd45c](https://github.com/dgiot/dgiot-dashboard/commit/a9dd45ca5044fa0532807a114feab6d8125d625b))
* **components:** 设备列表 ([36e2951](https://github.com/dgiot/dgiot-dashboard/commit/36e29513ec2e8a88ccb586e1779800f81aa4b771))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

### Bug Fixes

* **components:** 百度地图 ([d2d36cd](https://github.com/dgiot/dgiot-dashboard/commit/d2d36cd565d8dde402892789ce01a84aa47f0752))
* **components:** 设备列表 ([7a5b59b](https://github.com/dgiot/dgiot-dashboard/commit/7a5b59b9bbbd9163e5df359224f5b6b433b2432e))
* **components:** 设备列表 ([a9dd45c](https://github.com/dgiot/dgiot-dashboard/commit/a9dd45ca5044fa0532807a114feab6d8125d625b))
* **components:** 设备列表 ([36e2951](https://github.com/dgiot/dgiot-dashboard/commit/36e29513ec2e8a88ccb586e1779800f81aa4b771))
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

### Bug Fixes

* **components:** 百度地图 ([d2d36cd](https://github.com/dgiot/dgiot-dashboard/commit/d2d36cd565d8dde402892789ce01a84aa47f0752))
* **components:** 设备列表 ([7a5b59b](https://github.com/dgiot/dgiot-dashboard/commit/7a5b59b9bbbd9163e5df359224f5b6b433b2432e))
* **components:** 设备列表 ([a9dd45c](https://github.com/dgiot/dgiot-dashboard/commit/a9dd45ca5044fa0532807a114feab6d8125d625b))
* **components:** 设备列表 ([36e2951](https://github.com/dgiot/dgiot-dashboard/commit/36e29513ec2e8a88ccb586e1779800f81aa4b771))
Expand Down
15 changes: 12 additions & 3 deletions src/views/CloudPressure/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
</el-button>
<el-button
:disabled="!row.basedata.templateUrl"
:loading="row.loading"
size="mini"
type="success"
@click.native="generateReport(row)"
Expand Down Expand Up @@ -604,13 +605,14 @@
this.report = true
},
async generateReport(row) {
row.loading = true
const params = {
reportid: row.objectId,
templateUrl: row.basedata.templateUrl,
grafanaHost: location.hostname,
parseHost: location.hostname,
}
let random = Math.random() * 20 + 30
const res = await axios.post('/grafana/generateReport', params, {
headers: {
'Access-Control-Allow-Origin': '*', //解决cors头问题
Expand All @@ -621,8 +623,14 @@
withCredentials: true,
})
console.log(res)
this.$baseMessage(this.$translateTitle('pressure.报告生成成功'))
this.fetchData()
console.log(random)
setTimeout(async () => {
// 随机数30到50 秒后设置报告生成成功
// 关闭按钮加载状态
row.loading = false
this.$baseMessage(this.$translateTitle('pressure.报告生成成功'))
this.fetchData()
}, random * 1000 * 10)
},
async preview(fileurl) {
const encodeUrl = encodeURIComponent(Base64.encode(fileurl))
Expand Down Expand Up @@ -981,6 +989,7 @@
const { count = 0, results = [] } = await queryDevice(params)
const timeExp = /\[(\d{2,}):(\d{2})(?:\.(\d{2,3}))?]/g
results.forEach((i) => {
i.loading = false
i?.basedata ? '' : (i.basedata = {})
i?.basedata?.docxInfo ? '' : (i.basedata.docxInfo = [])
i?.basedata?.templateUrl
Expand Down

0 comments on commit 7ee61f2

Please sign in to comment.