prodnum-06.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="container">
  3. <!-- 控制模式 -->
  4. <mpattern ref="mpattern" />
  5. <!-- 基础控制 -->
  6. <basics ref="basics" />
  7. <!-- 分时开关 -->
  8. <division ref="division" />
  9. </view>
  10. </template>
  11. <script>
  12. import mpattern from './modules/mpattern.vue'
  13. import basics from './modules/basics.vue'
  14. import division from './modules/division.vue'
  15. export default {
  16. name: "prodnum-06",
  17. components: { mpattern, basics, division },
  18. props: {
  19. control: Object
  20. },
  21. watch: {
  22. control: function (newVal) {
  23. if (newVal) {
  24. try {
  25. let nameList = ['Flow control', 'pressure control', 'Config', 'Sleep time', 'Pilot valve', 'Minimum', 'MOP']
  26. this.$refs.basics.itemList = this.__proto__.getControlItem(nameList, newVal.function, newVal.paramcmdvalues, newVal.params)
  27. this.$refs.basics.preview = ['Batt4', 'Batt12', 'BatFlow'].map(v => {
  28. return newVal.params[v]
  29. })
  30. } catch (error) {
  31. console.error("06基础控制", error)
  32. }
  33. try {
  34. let division = this.$refs.division;
  35. division && division.loadData(newVal.function, newVal.paramcmdvalues, newVal.params)
  36. } catch (error) {
  37. console.error("06分时控制", error)
  38. }
  39. try {
  40. let ctrlModel = this.__proto__.getControlItem(['Ctrl'], newVal.function, newVal.paramcmdvalues, newVal.params, { Ctrl: "radio" })[0]
  41. let preview = [];
  42. switch (ctrlModel.params.lastvalue - 0) {
  43. case 0:
  44. preview = {
  45. now: newVal.params['UpP'],
  46. tar: this.__proto__.getControlItem(['Upstream'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
  47. }
  48. break;
  49. case 1:
  50. preview = {
  51. now: newVal.params['DownP'],
  52. tar: this.__proto__.getControlItem(['Downstream'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
  53. }
  54. break;
  55. case 2:
  56. preview = {
  57. now: newVal.params['NowFlow'],
  58. tar: this.__proto__.getControlItem(['Constantflow'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
  59. }
  60. break;
  61. case 3:
  62. preview = {
  63. now: newVal.params['MostBad'],
  64. tar: this.__proto__.getControlItem(['unfavorable'], newVal.function, newVal.paramcmdvalues, newVal.params)[0]
  65. }
  66. break;
  67. }
  68. this.$refs.mpattern.ctrlModel = ctrlModel;
  69. this.$refs.mpattern.preview = preview;
  70. } catch (error) {
  71. console.error("06控制模式", error)
  72. }
  73. } else {
  74. }
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .container {
  81. width: 355px;
  82. margin: 0 auto;
  83. }
  84. </style>