mcu.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <headerBar
  3. title="初始设备调频设置"
  4. />
  5. <div class="page">
  6. <el-row v-for="item,key in editRowData" :key="index" class="mar-top-10">
  7. <el-col :span="12">{{key}}</el-col>
  8. <el-col :span="10">
  9. <el-input
  10. v-model="editRowData[key]"
  11. type="number"
  12. />
  13. </el-col>
  14. </el-row>
  15. <el-row align="middle" justify="middle" class="bottom-wrap">
  16. <el-col :span="24">
  17. <el-button type="primary" @click="get_deviation">读取配置</el-button>
  18. <el-button type="primary" @click="set_deviation">设置配置</el-button>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. </template>
  23. <script setup lang="ts">
  24. import {ref,reactive,onMounted} from "vue";
  25. import client from "@/stores/modules/client";
  26. import icpList from '@/utils/ipc'
  27. import socket from "@/stores/modules/socket";
  28. import {ElMessage} from "element-plus";
  29. const clientStore = client();
  30. const socketStore = socket()
  31. const editRowData = ref({
  32. }); // 当前编辑行的数据
  33. onMounted(()=>{
  34. get_deviation()
  35. })
  36. //获取配置
  37. async function get_deviation(){
  38. if(clientStore.isClient){
  39. socketStore.sendMessage({
  40. type: 'get_mcu_other_info',
  41. data:"get_mcu_other_info"
  42. })
  43. clientStore.ipc.on(icpList.socket.message+'_get_mcu_other_info', (event, result) => {
  44. console.log('_get_mcu_other_info')
  45. console.log(result)
  46. if(result.code === 0){
  47. editRowData.value = result.data
  48. }else if(result.msg){
  49. ElMessage.error(result.msg)
  50. }
  51. clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_mcu_other_info');
  52. });
  53. }
  54. }
  55. //设置 移动 调整
  56. async function set_deviation(action_name, type, key, min, max) {
  57. socketStore.sendMessage({
  58. type: 'set_mcu_other_info',
  59. data:{
  60. ...editRowData.value
  61. }
  62. })
  63. clientStore.ipc.on(icpList.socket.message+'_set_mcu_other_info', (event, result) => {
  64. console.log('_set_mcu_other_info')
  65. console.log(result)
  66. if(result.code === 0){
  67. ElMessage.success('设置成功')
  68. }
  69. clientStore.ipc.removeAllListeners(icpList.socket.message+'_set_mcu_other_info');
  70. });
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .bottom-wrap {
  75. position: fixed;
  76. bottom:0px;
  77. left: 0;
  78. right: 0;
  79. padding: 10px 0;
  80. background: #fff;
  81. }
  82. .page {
  83. padding-bottom: 60px;
  84. }
  85. .el-col {
  86. position: relative;
  87. ::v-deep {
  88. .error-msg{
  89. display: none;
  90. position: absolute;
  91. top: 41px;
  92. top: 28px;
  93. left: 8px;
  94. z-index: 22;
  95. color: #dc2626;
  96. font-size: 12px;
  97. }
  98. &:hover{
  99. .error-msg{
  100. display: block;
  101. }
  102. }
  103. }
  104. }
  105. </style>