| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <div class="container-fluid">
- <div class="row">
- <button @click="function1">一组扭矩值</button>
- <button @click="function2">两组扭矩值</button>
- </div>
- </div>
- </template>
- <script>
- export default {
- components: {},
- data: function () {
- return {};
- },
- mounted() {
- //链接服务端
- this.websocket = new WebSocket('ws://10.190.26.106:40001');
- //配置客户端连接成功的回调方法
- this.websocket.onopen = function (event) {
- console.log('open...');
- };
- //配置客户端处理消息的回调方法
- this.websocket.onmessage = function (event) {};
- },
- methods: {
- function1: function () {
- var command = {};
- command.Cmd = '001';
- command.Columns = ['A', 'B'];
- command.Data = [
- [
- 5.017428224, 4.98081571, 5.003019857, 4.998418874, 5.01948845,
- 5.003861048, 5.008632472, 5.010097364, 5.017364211, 5.001737212,
- 4.998541241, 4.997037902, 5.005318685, 4.984643393, 4.990580734,
- 4.99575414, 5.012767043, 5.014282755, 4.996540185, 4.982290365,
- 5.006333141, 5.005797951, 5.017074823, 4.9962068, 4.993292436,
- 4.993060025, 5.009623623, 5.014318856, 5.006260344, 5.004688373,
- ],
- ];
- command.Program =
- 'Capa C1 5;' +
- 'Lspec 4.98;' +
- 'Uspec 5.02;' +
- 'Pooled;' +
- 'AMR;' +
- 'UnBiased;' +
- 'OBiased;' +
- 'Toler 6;' +
- 'Within;' +
- 'Overall;' +
- 'CStat;' +
- 'CPK \'B\'.';
- var sendData = JSON.stringify(command);
- this.websocket.send(sendData);
- },
- function2: function () {
- var command = {};
- command.Cmd = '001';
- command.Columns = ['A', 'B'];
- command.Data = [
- [
- 5.017428224, 4.98081571, 5.003019857, 4.998418874, 5.01948845,
- 5.003861048, 5.008632472, 5.010097364, 5.017364211, 5.001737212,
- 4.998541241, 4.997037902, 5.005318685, 4.984643393, 4.990580734,
- 4.99575414, 5.012767043, 5.014282755, 4.996540185, 4.982290365,
- 5.006333141, 5.005797951, 5.017074823, 4.9962068, 4.993292436,
- 4.993060025, 5.009623623, 5.014318856, 5.006260344, 5.004688373,
- ],
- ];
- //command.Program = "XbarChart C1 5."
- //command.Program = "XSChart C1 5.";
- //command.Program = "XRChart C1 5.";
- command.Program = 'IMRChart C1.;';
- var sendData = JSON.stringify(command);
- this.websocket.send(sendData);
- },
- },
- };
- </script>
- <style>
- </style>
|