MinitabTest.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="container-fluid">
  3. <div class="row">
  4. <button @click="function1">一组扭矩值</button>
  5. <button @click="function2">两组扭矩值</button>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. components: {},
  12. data: function () {
  13. return {};
  14. },
  15. mounted() {
  16. //链接服务端
  17. this.websocket = new WebSocket('ws://10.190.26.106:40001');
  18. //配置客户端连接成功的回调方法
  19. this.websocket.onopen = function (event) {
  20. console.log('open...');
  21. };
  22. //配置客户端处理消息的回调方法
  23. this.websocket.onmessage = function (event) {};
  24. },
  25. methods: {
  26. function1: function () {
  27. var command = {};
  28. command.Cmd = '001';
  29. command.Columns = ['A', 'B'];
  30. command.Data = [
  31. [
  32. 5.017428224, 4.98081571, 5.003019857, 4.998418874, 5.01948845,
  33. 5.003861048, 5.008632472, 5.010097364, 5.017364211, 5.001737212,
  34. 4.998541241, 4.997037902, 5.005318685, 4.984643393, 4.990580734,
  35. 4.99575414, 5.012767043, 5.014282755, 4.996540185, 4.982290365,
  36. 5.006333141, 5.005797951, 5.017074823, 4.9962068, 4.993292436,
  37. 4.993060025, 5.009623623, 5.014318856, 5.006260344, 5.004688373,
  38. ],
  39. ];
  40. command.Program =
  41. 'Capa C1 5;' +
  42. 'Lspec 4.98;' +
  43. 'Uspec 5.02;' +
  44. 'Pooled;' +
  45. 'AMR;' +
  46. 'UnBiased;' +
  47. 'OBiased;' +
  48. 'Toler 6;' +
  49. 'Within;' +
  50. 'Overall;' +
  51. 'CStat;' +
  52. 'CPK \'B\'.';
  53. var sendData = JSON.stringify(command);
  54. this.websocket.send(sendData);
  55. },
  56. function2: function () {
  57. var command = {};
  58. command.Cmd = '001';
  59. command.Columns = ['A', 'B'];
  60. command.Data = [
  61. [
  62. 5.017428224, 4.98081571, 5.003019857, 4.998418874, 5.01948845,
  63. 5.003861048, 5.008632472, 5.010097364, 5.017364211, 5.001737212,
  64. 4.998541241, 4.997037902, 5.005318685, 4.984643393, 4.990580734,
  65. 4.99575414, 5.012767043, 5.014282755, 4.996540185, 4.982290365,
  66. 5.006333141, 5.005797951, 5.017074823, 4.9962068, 4.993292436,
  67. 4.993060025, 5.009623623, 5.014318856, 5.006260344, 5.004688373,
  68. ],
  69. ];
  70. //command.Program = "XbarChart C1 5."
  71. //command.Program = "XSChart C1 5.";
  72. //command.Program = "XRChart C1 5.";
  73. command.Program = 'IMRChart C1.;';
  74. var sendData = JSON.stringify(command);
  75. this.websocket.send(sendData);
  76. },
  77. },
  78. };
  79. </script>
  80. <style>
  81. </style>