prodnum-MT01.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view>
  3. <view class="control-title">控制面板</view>
  4. <pilotLamp ref="pilotLamp" />
  5. <view style="height: 20px" />
  6. <mpattern ref="阀门工作状态" />
  7. <tabs :control="control" />
  8. <division ref="division" />
  9. </view>
  10. </template>
  11. <script>
  12. import mpattern from "./modules/mpattern";
  13. import tabs from "./modules/tabs";
  14. import pilotLamp from "./modules/pilotLamp";
  15. import division from "./modules/division";
  16. export default {
  17. name: "prodnum-MT01",
  18. components: { mpattern, tabs, pilotLamp, division },
  19. props: {
  20. control: Object,
  21. },
  22. watch: {
  23. control: function (newVal) {
  24. if (newVal) {
  25. console.log("MT01", newVal);
  26. try {
  27. this.$refs.pilotLamp.list = [
  28. {
  29. name: "就地",
  30. value: getBoole("S002", 0),
  31. },
  32. {
  33. name: "远程",
  34. value: getBoole("S002")
  35. },
  36. {
  37. name: "开到位",
  38. value: getBoole("S004"),
  39. },
  40. {
  41. name: "关到位",
  42. value: getBoole("S003"),
  43. },
  44. {
  45. name: "过扭故障",
  46. value: getBoole("A001"),
  47. warn: true,
  48. },
  49. {
  50. name: "失压警告",
  51. value: getBoole("A003"),
  52. warn: true,
  53. },
  54. {
  55. name: "失压报警",
  56. value: getBoole("A004"),
  57. warn: true,
  58. },
  59. {
  60. name: "电量低报警",
  61. value: getBoole("A002"),
  62. warn: true,
  63. },
  64. ];
  65. function getBoole(name, expect = 1) {
  66. try {
  67. return newVal.paramvalues[name] == expect;
  68. } catch (error) {
  69. console.error("getBoole取值出错项", name);
  70. return false;
  71. }
  72. }
  73. } catch (error) {
  74. console.error("MT01指示灯", error);
  75. }
  76. try {
  77. this.$refs.阀门工作状态.ctrlModel = this.__proto__.getControlItem(
  78. ["阀门工作状态"],
  79. newVal,
  80. { 阀门工作状态: "radio" }
  81. )[0];
  82. switch (this.$refs.阀门工作状态.ctrlModel.showValue) {
  83. case "手动控制":
  84. this.$refs.阀门工作状态.list = [
  85. this.__proto__.getControlItem(["手动开度设置"], newVal)[0],
  86. ];
  87. break;
  88. case "自动调节":
  89. this.$refs.阀门工作状态.list = [
  90. this.__proto__.getControlItem(["手动压力设置"], newVal)[0],
  91. ];
  92. break;
  93. default:
  94. this.$refs.阀门工作状态.list = [];
  95. break;
  96. }
  97. console.log(
  98. "this.$refs.阀门工作状态.list",
  99. this.$refs.阀门工作状态.list
  100. );
  101. } catch (error) {
  102. console.error("MT01阀门工作状态", error);
  103. }
  104. try {
  105. let division = this.$refs.division;
  106. division && division.loadData(newVal);
  107. } catch (error) {
  108. console.error("MT01分时控制", error);
  109. }
  110. }
  111. },
  112. },
  113. data() {
  114. return {};
  115. },
  116. };
  117. </script>
  118. <style></style>