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 = { ...@@ -27,6 +27,7 @@ module.exports = {
assetsPublicPath: '/', assetsPublicPath: '/',
proxyTable: { proxyTable: {
'/mesAPI': { '/mesAPI': {
timeout: 6*60*1000,
target: mesAPI, target: mesAPI,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<el-form-item label="MES数据库名" prop="name"> <el-form-item label="MES数据库名" prop="name">
<el-input class="demo" v-model="ruleForm.mes_db_name"></el-input> <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="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-form-item> <el-form-item>
<el-button type="primary" @click="set_project('ruleForm')">保存</el-button> <el-button type="primary" @click="set_project('ruleForm')">保存</el-button>
...@@ -138,6 +139,16 @@ ...@@ -138,6 +139,16 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </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-dialog title="日志" :visible.sync="dialogTableVisible">
<el-table :data="gridData"> <el-table :data="gridData">
<el-table-column property="app_code" label="app编码" ></el-table-column> <el-table-column property="app_code" label="app编码" ></el-table-column>
...@@ -153,12 +164,14 @@ ...@@ -153,12 +164,14 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import utilSingeUc from '@basicClass/util_singe_uc.js' 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' import { Loading } from 'element-ui'
export default { export default {
mixins: [utilSingeUc], mixins: [utilSingeUc],
data() { data() {
return { return {
text: '',
dialogVisible_install: false,
percentage: 0, percentage: 0,
install_dialogTableVisible: false, install_dialogTableVisible: false,
searchParam: { searchParam: {
...@@ -185,6 +198,21 @@ export default { ...@@ -185,6 +198,21 @@ export default {
} }
}, },
methods: { 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) { openFullScreen(option) {
const loadings = Loading.service({ const loadings = Loading.service({
lock: true, lock: true,
...@@ -199,105 +227,34 @@ export default { ...@@ -199,105 +227,34 @@ export default {
}, },
// 安装runner // 安装runner
install_runner() { install_runner() {
this.openFullScreen('正在安装runner,请稍等') axios.get(`mesAPI/install/runner/`).then(res => {
axios.get(`mesAPI/install/runner/step1/`).then(res => { this.dialogVisible_install = true
this.percentage = 33 this.chatTimer = setInterval(() => {
this.install_runner2() this.get_info_logs()
}).catch(res => { }, 2000)
this.percentage = 0
this.closeFullScreen(this.openFullScreen())
}) })
}, },
install_runner2() { get_info_logs() {
axios.get(`mesAPI/install/runner/step2/`).then(res => { // var myDate = new Date()
console.log(res) // var since_time = `${myDate.getFullYear()}-${myDate.getMonth()}-${myDate.getDate()} ${myDate.getHours()}:${myDate.getMinutes()}:${myDate.getSeconds()}`
this.percentage = 66 axios.get(`mesAPI/info/logs/`).then(res => {
this.install_runner3() // if (res.data.indexOf('安装成功') !== -1 || res.data.indexOf('远程升级完成') !== -1) {
}).catch(res => { // clearInterval(this.chatTimer)
this.percentage = 0 // this.text = res.data
this.closeFullScreen(this.openFullScreen()) // } else {
}) this.text = res.data
}, // }
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())
}) })
}, },
upgrade() { upgrade() {
this.openFullScreen('正在推送升级,请稍等') axios.get(`mesAPI/upgrade/remote/`).then(res => {
this.percentage = 5 this.dialogVisible_install = true
axios.get(`mesAPI/upgrade/remote/step1/`).then(res => { this.chatTimer = setInterval(() => {
this.upgrade2() this.get_info_logs()
}).catch(res => { }, 2000)
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())
}) })
// this.openFullScreen('正在推送升级,请稍等')
// this.percentage = 5
}, },
download() { download() {
this.$API.post(`mesAPI/info/app_upgrade/`, {}, {}, this.bill_list1).then( this.$API.post(`mesAPI/info/app_upgrade/`, {}, {}, this.bill_list1).then(
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="margin-top:20px;color:#31a9d3"> <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> </div>
</el-card> </el-card>
</div> </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