提交 80a7722a authored 作者: Your Name's avatar Your Name

修改选中项

上级 2ef56b9f
......@@ -5,7 +5,7 @@
<div class="whole" v-for="(item,index) in val ">
<div class="newApply-title">
<!--<el-radio v-model="tech" :label="1">{{item.name}}</el-radio>-->
<span @click="check(index)"> <i :class="(isCheck==index) ? 'isActive': ''"></i> </span>
<span @click="check(index)"> <i :class="(index == isCheck - 1) ? 'isActive': ''"></i> </span>
<div>{{item.name}}</div>
</div>
<div class="newApply-content">
......@@ -33,7 +33,7 @@ export default {
name: 'newApply',
// import引入的组件需要注入到对象中才能使用
components: {},
props: ['val','applyId'],
props: ['val','applyId','osId'],
data () {
// 这里存放数据
return {
......@@ -49,11 +49,14 @@ export default {
},
check(i) {
console.log('选中',i)
this.isCheck = i;
console.log(this.isCheck)
this.isCheck = i + 1
console.log(this.isCheck)
},
makeSure() {
let a = this.applyId;
let b = this.isCheck + 1;
let b = this.isCheck;
let obj = {
id: a,
techId: b
......@@ -61,9 +64,13 @@ export default {
this.$server.postMidify(obj).then(res => {
console.log('postMidify',res);
this.$emit('on-close');
console.log(this.$parent)
this.$emit('on-closeWeb');
this.$emit('on-project');
// this.$emit('on-websocket');
}).catch(err => {
console.log(err)
this.$message.error('请求失败')
......@@ -79,12 +86,22 @@ export default {
},
'applyId': function(applyId) {
console.log('项目id',applyId)
}
},
'osId': function(osId) {
console.log('osIdid',osId)
this.isCheck = this.osId
},
},
//生命周期 - 创建完成(可以访问当前this实例)
created () {},
created () {
},
// 生命周期 - 挂载完成(可以访问DOM元素)
mounted () {},
mounted () {
console.log(this.osId)
this.isCheck = this.osId
console.log('122222',this.isCheck)
},
// 生命周期 - 创建之前
beforeCreate () {},
// 生命周期 - 挂载之前
......@@ -92,7 +109,9 @@ export default {
// 生命周期 - 更新之前
beforeUpdate () {},
// 生命周期 - 更新之后
updated () {},
updated () {
// this.check(this.osId);
},
// 生命周期 - 销毁之前
beforeDestroy () {},
// 生命周期 - 销毁完成
......
......@@ -128,7 +128,7 @@
</div>
<!--重新申请弹窗-->
<el-dialog :visible.sync="applyModal" width="0%" >
<newApply :val="applyMessage" :applyId="applyId" :osId="osId" @on-project="newProject()" @on-close="reset()"></newApply>
<newApply :val="applyMessage" :applyId="applyId" :osId="osId" @on-closeWeb="websocketCosle" @on-websocket="newWebsocket()" @on-project="newProject()" @on-close="reset()"></newApply>
<img src="../assets/img/close.png" class="closeModel" @click="reset()">
</el-dialog>
......@@ -168,7 +168,8 @@ export default {
jenkinsName: '', // webstock
logData:'', // 日志
data: '',
osId: ''
osId: '',
techId: ''
};
},
// 方法集合
......@@ -193,6 +194,11 @@ export default {
this.pathSuffix = res.data.pathSuffix
this.jenkinsName = res.data.jenkinsName
this.copyWebsocket(res.data.jenkinsName)
// localStorage.setItem('jenkinsName',this.jenkinsName);
// console.log(localStorage.getItem('jenkinsName'))
this.techId = res.data.techId;
console.log('66666666',this.techId)
}).catch(err => {
// console.log(err);
this.$message.error('数据请求失败');
......@@ -206,7 +212,8 @@ export default {
console.log(res.data);
this.applyMessage = res.data
this.applyId = this.id
this.osId = this.os.id
this.osId = this.techId
console.log('909090',this.osId)
// console.log('77777',this.applyId)
}).catch(err => {
// console.log(err)
......@@ -258,11 +265,14 @@ export default {
},
// websocket
copyWebsocket(val) {
// console.log(this.val,this.close)
var that = this;
// Create WebSocket connection.
// console.log('this.jenkinsName2121',this.jenkinsName)
// const socket = new WebSocket('ws://' + baseUrl.WS_CONT + '/webServer/${this.jenkinsName}');
const socket = new WebSocket(`ws://${baseUrl.WS_CONT}/webServer/${val}`);
this.WS = socket;
// Connection opened
socket.addEventListener('open', function (event) {
socket.send('Hello Server!');
......@@ -282,6 +292,16 @@ export default {
newProject(){
console.log(1)
this.getProject();
},
// newWebsocket(){
// console.log(99)
// this.copyWebsocket();
// },
websocketCosle(e){
this.WS.close()
// const socket = new WebSocket(`ws://${baseUrl.WS_CONT}/webServer/${this.jenkinsName}`);
// socket.close();
// this.copyWebsocket();
}
},
// 监听属性 类似于data概念
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论