Commit edcc2ecc authored by 黄贤军's avatar 黄贤军

需求

parent 917be7a2
Pipeline #21149 passed with stage
in 1 minute and 8 seconds
......@@ -27,6 +27,7 @@ module.exports = {
assetsPublicPath: '/',
proxyTable: {
'/mesAPI': {
timeout: 6*60*1000,
target: mesAPI,
changeOrigin: true,
pathRewrite: {
......
......@@ -29,6 +29,7 @@
<el-form-item label="MES数据库名" prop="name">
<el-input class="demo" v-model="ruleForm.mes_db_name"></el-input>
<el-button style="margin-left: 40px" type="primary" @click="test(ruleForm.mes_db_name)">测试连接</el-button>
<!-- <el-button style="margin-left: 40px" type="primary" @click="install()">测de </el-button> -->
</el-form-item>
<el-form-item>
<el-button type="primary" @click="set_project('ruleForm')">保存</el-button>
......@@ -138,6 +139,16 @@
</el-tab-pane>
</el-tabs>
<el-dialog
title="安装进度"
:visible.sync="dialogVisible_install"
width="80%"
:before-close="handleClose"
>
<p class="bgnr-txt" style="white-space: pre-wrap;" v-html="change(text)">
>{{text}}</p>
</el-dialog>
<el-dialog title="日志" :visible.sync="dialogTableVisible">
<el-table :data="gridData">
<el-table-column property="app_code" label="app编码" ></el-table-column>
......@@ -153,12 +164,14 @@
<script>
import axios from 'axios'
import utilSingeUc from '@basicClass/util_singe_uc.js'
import API from '@/utils/sha256/myHttpClient'
// import API from '@/utils/sha256/myHttpClient'
import { Loading } from 'element-ui'
export default {
mixins: [utilSingeUc],
data() {
return {
text: '',
dialogVisible_install: false,
percentage: 0,
install_dialogTableVisible: false,
searchParam: {
......@@ -185,6 +198,21 @@ export default {
}
},
methods: {
handleClose(done) {
clearInterval(this.chatTimer)
this.dialogVisible_install = false
this.text = ''
},
change: function(content) {
var reg = /[;;]/g
content = content.replace(reg, '$&\r\n')
return content
},
install() {
axios.get('mesAPI/install/test/700/').then(res => {
console.log(res)
})
},
openFullScreen(option) {
const loadings = Loading.service({
lock: true,
......@@ -199,105 +227,34 @@ export default {
},
// 安装runner
install_runner() {
this.openFullScreen('正在安装runner,请稍等')
axios.get(`mesAPI/install/runner/step1/`).then(res => {
this.percentage = 33
this.install_runner2()
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
axios.get(`mesAPI/install/runner/`).then(res => {
this.dialogVisible_install = true
this.chatTimer = setInterval(() => {
this.get_info_logs()
}, 2000)
})
},
install_runner2() {
axios.get(`mesAPI/install/runner/step2/`).then(res => {
console.log(res)
this.percentage = 66
this.install_runner3()
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
},
install_runner3() {
axios.get(`mesAPI/install/runner/step3/`).then(res => {
this.percentage = 100
setTimeout(_ => {
this.closeFullScreen(this.openFullScreen())
this.$message.success('安装成功')
this.percentage = 0
}, 1000)
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
get_info_logs() {
// var myDate = new Date()
// var since_time = `${myDate.getFullYear()}-${myDate.getMonth()}-${myDate.getDate()} ${myDate.getHours()}:${myDate.getMinutes()}:${myDate.getSeconds()}`
axios.get(`mesAPI/info/logs/`).then(res => {
// if (res.data.indexOf('安装成功') !== -1 || res.data.indexOf('远程升级完成') !== -1) {
// clearInterval(this.chatTimer)
// this.text = res.data
// } else {
this.text = res.data
// }
})
},
upgrade() {
this.openFullScreen('正在推送升级,请稍等')
this.percentage = 5
axios.get(`mesAPI/upgrade/remote/step1/`).then(res => {
this.upgrade2()
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
},
upgrade2() {
axios.get(`mesAPI/upgrade/remote/step2/`).then(res => {
this.percentage = 10
this.upgrade3(res.data.app_cout)
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
},
async upgrade3(app_count) {
for (let i = 1; i <= app_count; i++) {
console.log(i)
await axios.get(`mesAPI/upgrade/remote/step3/${i}/`).then(res => {
if (app_count > 10) { this.percentage = this.percentage + 2 } else {
this.percentage = this.percentage + 4
}
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
}
this.upgrade4()
},
upgrade4() {
axios.get(`mesAPI/upgrade/remote/step4/`).then(res => {
this.percentage = this.percentage + 5
this.upgrade5(res.data.app_cout)
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
},
async upgrade5(app_count) {
for (let i = 1; i <= app_count; i++) {
await axios.get(`mesAPI/upgrade/remote/step5/${i}/`).then(res => {
if (app_count > 10) { this.percentage = this.percentage + 2 } else {
this.percentage = this.percentage + 4
}
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
})
}
this.upgrade6()
},
upgrade6() {
API.get(`mesAPI/upgrade/remote/step6/`).then(res => {
setTimeout(_ => {
this.percentage = 100
this.closeFullScreen(this.openFullScreen())
this.$message.success('安装成功')
this.percentage = 0
}, 1500)
}).catch(res => {
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
axios.get(`mesAPI/upgrade/remote/`).then(res => {
this.dialogVisible_install = true
this.chatTimer = setInterval(() => {
this.get_info_logs()
}, 2000)
})
// this.openFullScreen('正在推送升级,请稍等')
// this.percentage = 5
},
download() {
this.$API.post(`mesAPI/info/app_upgrade/`, {}, {}, this.bill_list1).then(
......
......@@ -33,7 +33,7 @@
</el-form-item>
</el-form>
<div style="margin-top:20px;color:#31a9d3">
<span style="display: inline-block;width:49%;" v-if="!user_name" @click="setting_login">设置登陆信息</span>
<span style="display: inline-block;width:49%;" @click="setting_login">设置登陆信息</span>
</div>
</el-card>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment