item.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="flex flex-col justify-center k-app-list__item van-clearfix">
  3. <van-cell-group @click="itemClick">
  4. <van-cell :title="data.deviceName" value-class="cell-title-value" title-style="width:100% ;">
  5. <template #right-icon>
  6. <van-tag type="danger" v-if="data.state === 1" @click.stop="alarmClick">{{ data.stateText }}</van-tag>
  7. <van-tag color="gray" text-color="black" v-else-if="data.state == null">未上报</van-tag>
  8. <van-tag type="primary" v-else>{{ data.stateText }}</van-tag>
  9. </template>
  10. </van-cell>
  11. <van-cell title="所属机构" :value="data.orgName"></van-cell>
  12. <van-cell title="上报时间" v-if="data.state != null" :value="stateUpdateTimeText"></van-cell>
  13. </van-cell-group>
  14. </div>
  15. </template>
  16. <script>
  17. import { mapGetters } from 'vuex'
  18. import dayjs from 'dayjs'
  19. export default {
  20. components: {},
  21. data() {
  22. return {}
  23. },
  24. computed: {
  25. ...mapGetters(['orgName', 'orgId', 'dictionary']),
  26. stateUpdateTimeText() {
  27. if (this.data.stateUpdateTime == null) {
  28. return '未上报'
  29. }
  30. return dayjs(this.data.stateUpdateTime).format('YYYY年M月D日H时m分');
  31. },
  32. },
  33. watch: {},
  34. props: {
  35. data: {},
  36. statusOptions: {}
  37. },
  38. methods: {
  39. itemClick() {
  40. this.$router.push('/iot/envMonitor/detail?id=' + this.data.id)
  41. },
  42. alarmClick(){
  43. this.$router.push('/iot/envMonitor/alarmIndex?id=' + this.data.id)
  44. }
  45. },
  46. async created() {},
  47. async mounted() {}
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .cell-title-value {
  52. display: none;
  53. }
  54. .k-app-list__item {
  55. // height: 11.85rem;
  56. background: #ffffff;
  57. margin: 0.3rem 0.325rem 0;
  58. font-size: 3.733333vw;
  59. .top {
  60. // min-height: 3rem;
  61. padding: 0.05rem 0.05rem;
  62. display: flex;
  63. flex-direction: row;
  64. align-items: center;
  65. border-bottom: 1px solid #f3f4f5;
  66. > label {
  67. // height: 1.38rem;
  68. // font-size: 1rem;
  69. // line-height: 1.25rem;
  70. color: #323233;
  71. opacity: 1;
  72. }
  73. }
  74. .bottom {
  75. min-height: 7.75rem;
  76. padding: 0 1rem;
  77. span {
  78. height: 1.25rem;
  79. font-size: 0.88rem;
  80. line-height: 1.25rem;
  81. color: #000000;
  82. opacity: 0.61;
  83. }
  84. }
  85. }
  86. .wrapper {
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. height: 100%;
  91. }
  92. .time-cell-default {
  93. min-width: 60vw;
  94. }
  95. </style>