prodnum-MT01.vue 3.0 KB

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