state.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view v-if="list.length">
  3. <view class="control-title">设备状态</view>
  4. <u-subsection :list="list" :current="current" @change="onChange" />
  5. <My_input ref="MyInput" />
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: "state",
  11. data() {
  12. return {
  13. list: [],
  14. current: -1,
  15. options: []
  16. }
  17. },
  18. methods: {
  19. onChange(index) {
  20. if (index == this.current) return;
  21. let item = this.options[index],
  22. that = this;
  23. uni.showModal({
  24. title: '提示',
  25. content: `是否确定将设备更改为${item.funcname}状态`,
  26. success: ({ confirm }) => {
  27. if (confirm) that.$refs.MyInput.submit(item.w_functionid, {
  28. [item.paramName]: 1
  29. })
  30. },
  31. })
  32. },
  33. }
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. /deep/.u-subsection__item__text {
  38. span {
  39. font-size: 10px;
  40. }
  41. }
  42. </style>