| | |
| | | <el-row> |
| | | <el-col :span="4"> |
| | | <div class="search"> |
| | | <avue-form :option="option" v-model="form" @submit="connect"> |
| | | <avue-form :option="option" v-model="form" @submit="getMenuList"> |
| | | <template slot-scope="{}" slot="modulesIdLabel"> |
| | | <span></span> |
| | | </template> |
| | |
| | | socketIoClient: null, |
| | | } |
| | | }, |
| | | created() { |
| | | this.connect() |
| | | }, |
| | | mounted() { |
| | | }, |
| | | methods: { |
| | | handleSubmit(form, done) { |
| | | getAll(form).then(res => { |
| | | if (res.data.code == 200) { |
| | | let data = res.data.data |
| | | this.menuList = data |
| | | done() |
| | | } |
| | | }) |
| | | }, |
| | | handleSelect(index) { |
| | | let selectData = this.menuList.filter(e => { |
| | | return e.id == index |
| | |
| | | } |
| | | }, |
| | | |
| | | connect(form, done) { |
| | | connect() { |
| | | |
| | | // if (this.socketIoClient != null){ |
| | | // this.socketIoClient.disconnect() |
| | | // this.socketIoClient = null |
| | | // } |
| | | |
| | | |
| | | let serveUri = 'http://192.168.0.200:10246' |
| | | let params = { |
| | | modulesId: form.modulesId, |
| | | isView: true |
| | | } |
| | | // let params = { |
| | | // modulesId: form.modulesId, |
| | | // isView: true |
| | | // } |
| | | |
| | | this.socketIoClient = io.connect(serveUri, { |
| | | 'force new connection': true, |
| | | 'query': 'connectInfo=' + JSON.stringify(params) |
| | | // 'force new connection': true, |
| | | // 'query': 'connectInfo=' + JSON.stringify(params) |
| | | }); |
| | | |
| | | //监听与服务器的连接状态 |
| | | this.socketIoClient.on("connect", () => { |
| | | done() |
| | | // done() |
| | | }) |
| | | |
| | | //监听服务器发回的消息 |
| | |
| | | }); |
| | | |
| | | }, |
| | | getMenuList(form,done){ |
| | | this.sendMsg("putInClientMap",null) |
| | | done() |
| | | }, |
| | | sendMsg(msgName,data){ |
| | | let msg = { |
| | | current:this.form.modulesId, |
| | | msg :data |
| | | } |
| | | this.socketIoClient.emit(msgName,JSON.stringify(msg)) |
| | | }, |
| | | left() { |
| | | this.$refs.flipbook.flipLeft() |
| | | }, |