prodnum-FW01.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <view style="height: 20px" />
  4. <Identity ref="Identity" />
  5. <basics ref="basics" />
  6. <pilotLamp ref="pilotLamp" itemW="21%" />
  7. <view class="control-title">设备参数</view>
  8. <preview ref="preview" />
  9. <control-panel ref="mpattern" />
  10. </view>
  11. </template>
  12. <script>
  13. import controlPanel from "../prodnum-YK01/modules/controlPanel.vue";
  14. import preview from "../prodnum-YK01/modules/preview.vue";
  15. import pilotLamp from "../prodnum-MT03/modules/pilotLamp.vue";
  16. import basics from "./modules/basics.vue";
  17. import Identity from "./modules/Identity.vue";
  18. export default {
  19. name: "prodnum-FW01",
  20. components: { controlPanel, pilotLamp, preview, Identity, basics },
  21. props: {
  22. control: Object,
  23. },
  24. watch: {
  25. control: function (newVal) {
  26. this.$refs.Identity.ctrlModel = this.__proto__.getControlItem(
  27. ["身份验证"],
  28. newVal
  29. )[0];
  30. this.$refs.Identity.bluetoothcode = newVal.bluetoothcode;
  31. if (newVal) {
  32. try {
  33. this.$refs.preview.list = [
  34. newVal.params["U002"],
  35. newVal.params["U003"],
  36. ];
  37. } catch (error) {
  38. console.error("FW01设备状态", error);
  39. }
  40. try {
  41. this.$refs.mpattern.itemList = this.__proto__.getControlItem(
  42. ["上传时间间隔", "开度变更提醒值", "阀门圈数", "当前阀门开度"],
  43. newVal
  44. );
  45. } catch (error) {
  46. console.error("FW01控制面板", error);
  47. }
  48. try {
  49. this.$refs.pilotLamp.list = [
  50. {
  51. name: "开度变动提醒",
  52. value: getBoole("A005"),
  53. },
  54. {
  55. name: "低电量提醒",
  56. value: getBoole("A002"),
  57. },
  58. ];
  59. if (getBoole("A005")) {
  60. this.$refs.basics.ctrlModel = this.__proto__.getControlItem(
  61. ["开度提醒复位"],
  62. newVal
  63. )[0];
  64. console.log("ctrlModel", this.$refs.basics.ctrlModel);
  65. }
  66. function getBoole(name, expect = 1) {
  67. try {
  68. return newVal.paramvalues[name] == expect;
  69. } catch (error) {
  70. console.log("getBoole取值出错项", name);
  71. return false;
  72. }
  73. }
  74. } catch (error) {
  75. console.error("FW01指示灯", error);
  76. }
  77. try {
  78. this.$Http.openNetwork(newVal.params.U004.lastvalue);
  79. } catch (error) {
  80. setTimeout(this.$Http.openNetwork(newVal.params.U004.lastvalue), 100);
  81. console.error("06信号强度", error);
  82. }
  83. } else {
  84. }
  85. },
  86. },
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. /deep/.pilotLamp .item {
  91. width: 21% !important;
  92. }
  93. </style>