From 0c27203594a48b4fbf8bb33e9a0d3894a27575dc Mon Sep 17 00:00:00 2001 From: whychdw <49690745@qq.com> Date: 星期二, 25 五月 2021 10:30:23 +0800 Subject: [PATCH] 更新面板弹出逻辑 --- src/pages/test/noLoadTest.vue | 5 ++ src/common.js | 27 +++++++++++++ src/main.js | 1 src/components/smallModule/NewTest.vue | 6 ++ src/pages/test/dialog/LoadTestDialog.vue | 42 +++++++++++++-------- src/pages/test/dialog/testStepDialog.vue | 9 ++++ 6 files changed, 71 insertions(+), 19 deletions(-) diff --git a/src/common.js b/src/common.js new file mode 100644 index 0000000..772239b --- /dev/null +++ b/src/common.js @@ -0,0 +1,27 @@ +//鏍煎紡鍖栨椂闂� +Date.prototype.format = function(format) { + let o = { + "M+": this.getMonth() + 1, //month + "d+": this.getDate(), //day + "h+": this.getHours(), //hour + "m+": this.getMinutes(), //minute + "s+": this.getSeconds(), //second + "q+": Math.floor((this.getMonth() + 3) / 3), //quarter + "S": this.getMilliseconds() //millisecond + }; + if (/(y+)/.test(format)) format = format.replace(RegExp.$1, + (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (let k in o) + if (new RegExp("(" + k + ")").test(format)) + format = format.replace(RegExp.$1, + RegExp.$1.length == 1 ? o[k] : + ("00" + o[k]).substr(("" + o[k]).length)); + return format; +}; + +// 瀵箃oFixed鏁板瓧淇濈暀浣嶆暟浜屾灏佽锛坧s锛歵oFixed杩斿洖鐨勬槸瀛楃涓诧級 +Number.prototype.toHold = function(value) { + let hold = this.toFixed(value); + hold = Number(hold); + return hold; +}; \ No newline at end of file diff --git a/src/components/smallModule/NewTest.vue b/src/components/smallModule/NewTest.vue index fdc43e4..2e51f8f 100644 --- a/src/components/smallModule/NewTest.vue +++ b/src/components/smallModule/NewTest.vue @@ -8,7 +8,7 @@ </div> </div> <div class="new-test-content"> - <el-button class="block-button" type="primary" size="small">鏂板缓璇曢獙</el-button> + <el-button class="block-button" type="primary" size="small" :disabled="!to">鏂板缓璇曢獙</el-button> </div> </div> </template> @@ -36,6 +36,10 @@ type: Number, default: 0 }, + to: { + type: String, + default: "" + } }, data() { return { diff --git a/src/main.js b/src/main.js index a5560c1..5411541 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,7 @@ import App from './App.vue' import router from './router' import store from './store' +import "./common" import * as THREE from 'three' window.THREE = THREE diff --git a/src/pages/test/dialog/LoadTestDialog.vue b/src/pages/test/dialog/LoadTestDialog.vue index f904a51..a094f0f 100644 --- a/src/pages/test/dialog/LoadTestDialog.vue +++ b/src/pages/test/dialog/LoadTestDialog.vue @@ -37,7 +37,7 @@ :modal-append-to-body="false"> <heating-up-rs :list="heatingUpList" @updatePoint="updatePoint"></heating-up-rs> </el-dialog> - <test-step-dialog :type="type" :step="testStepKey" :list="list" :end="endStep"></test-step-dialog> + <test-step-dialog :type="type" :step="testStepKey" :list="list" :end="endStep" :progress="progressStep"></test-step-dialog> </div> </template> @@ -114,7 +114,8 @@ heatingUpList: [], list: [], testStepKey: -1, - endStep: false + endStep: false, + progressStep: false, } }, watch: { @@ -141,30 +142,39 @@ } experimentPoint(postData).then((res) => { let rs = res.data; - console.log(rs); let data = []; if (rs.code == 1) { data = rs.data.map(item => { - item.start = item.startTime ? `寮�濮嬫椂闂碶n${item.startTime}` : ''; - item.end = item.endTime ? `瀹屾垚鏃堕棿\n${item.endTime}` : ''; + let start = item.startTime?new Date(item.startTime).format("hh:ss"):''; + let end = item.endTime?new Date(item.endTime).format("hh:ss"):''; + item.start = item.startTime ? `寮�濮嬫椂闂碶n${start}`: ''; + item.end = item.endTime ? `瀹屾垚鏃堕棿\n${end}`: ''; item.endText = item.averagePower ? `骞冲潎鍔熺巼\n${item.averagePower}kW` : ''; return item; }); } this.list = data; - // 璁剧疆testStepKey - let step = -1; - for(let i=0; i<data.length; i++) { - if(data[i].status == 0) { + this.$nextTick(()=>{ + // 璁剧疆testStepKey + let step = -1; + this.progressStep = false; + for(let i=0; i<data.length; i++) { + let status = data[i].status; + if(status == 0) { + step = i; + this.endStep = false; + break; + }else if(status == 1) { + step = i; + this.progressStep = true; + break; + } step = i; - this.endStep = false; - break; + this.endStep = true; } - step = i; - this.endStep = true; - } - // 璁剧疆鏈縺娲荤偣 - this.testStepKey = step; + // 璁剧疆鏈縺娲荤偣 + this.testStepKey = step; + }); this.$emit('updateList', this.list); }).catch((err) => { console.log(err) diff --git a/src/pages/test/dialog/testStepDialog.vue b/src/pages/test/dialog/testStepDialog.vue index 49faf0a..65c2ed9 100644 --- a/src/pages/test/dialog/testStepDialog.vue +++ b/src/pages/test/dialog/testStepDialog.vue @@ -42,6 +42,10 @@ end: { type: Boolean, default: false, + }, + progress: { + type: Boolean, + default: false, } }, watch: { @@ -49,6 +53,9 @@ this.checkStep(); }, end() { + this.checkStep(); + }, + progress() { this.checkStep(); } }, @@ -64,7 +71,7 @@ }, methods: { checkStep() { - if(this.step != -1) { + if(this.step != -1 && !this.progress) { this.changeDialog(); } }, diff --git a/src/pages/test/noLoadTest.vue b/src/pages/test/noLoadTest.vue index 67ac439..a868c98 100644 --- a/src/pages/test/noLoadTest.vue +++ b/src/pages/test/noLoadTest.vue @@ -195,7 +195,7 @@ </div> </div> </div> - <load-test-dialog :type="type" :visible="dialogVisible"></load-test-dialog> + <load-test-dialog :type="type" :visible="dialogVisible" @updateList="updateList"></load-test-dialog> </div> </template> @@ -364,6 +364,9 @@ yAxisIndex: 1, }] }); + }, + updateList(list) { + this.list = list; } } } -- Gitblit v1.9.1