prodnum-MT01.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. },
  48. {
  49. name: "失压警告",
  50. value: getBoole("A003"),
  51. },
  52. {
  53. name: "失压报警",
  54. value: getBoole("A004"),
  55. },
  56. {
  57. name: "电量低报警",
  58. value: getBoole("A002"),
  59. },
  60. ];
  61. function getBoole(name, expect = 1) {
  62. try {
  63. return newVal.paramvalues[name] == expect;
  64. } catch (error) {
  65. console.error("getBoole取值出错项", name);
  66. return false;
  67. }
  68. }
  69. } catch (error) {
  70. console.error("MT01指示灯", error);
  71. }
  72. try {
  73. this.$refs.阀门工作状态.ctrlModel = this.__proto__.getControlItem(
  74. ["阀门工作状态"],
  75. newVal,
  76. { 阀门工作状态: "radio" }
  77. )[0];
  78. switch (this.$refs.阀门工作状态.ctrlModel.showValue) {
  79. case "手动控制":
  80. this.$refs.阀门工作状态.list = [
  81. this.__proto__.getControlItem(["手动开度设置"], newVal)[0],
  82. ];
  83. break;
  84. case "自动调节":
  85. this.$refs.阀门工作状态.list = [
  86. this.__proto__.getControlItem(["手动压力设置"], newVal)[0],
  87. ];
  88. break;
  89. default:
  90. this.$refs.阀门工作状态.list = [];
  91. break;
  92. }
  93. console.log(
  94. "this.$refs.阀门工作状态.list",
  95. this.$refs.阀门工作状态.list
  96. );
  97. } catch (error) {
  98. console.error("MT01阀门工作状态", error);
  99. }
  100. try {
  101. let division = this.$refs.division;
  102. division && division.loadData(newVal);
  103. } catch (error) {
  104. console.error("MT01分时控制", error);
  105. }
  106. }
  107. },
  108. },
  109. data() {
  110. return {};
  111. },
  112. };
  113. </script>
  114. <style></style>