item.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/fireWarning/detail?id=' + this.data.id)
  41. },
  42. alarmClick(){
  43. this.$router.push('/iot/fireWarning/alarmIndex?id=' + this.data.id)
  44. console.log("alarmClick:"+this.data.id);
  45. }
  46. },
  47. async created() {},
  48. async mounted() {}
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .cell-title-value {
  53. display: none;
  54. }
  55. .k-app-list__item {
  56. // height: 11.85rem;
  57. background: #ffffff;
  58. margin: 0.3rem 0.325rem 0;
  59. font-size: 3.733333vw;
  60. .top {
  61. // min-height: 3rem;
  62. padding: 0.05rem 0.05rem;
  63. display: flex;
  64. flex-direction: row;
  65. align-items: center;
  66. border-bottom: 1px solid #f3f4f5;
  67. > label {
  68. // height: 1.38rem;
  69. // font-size: 1rem;
  70. // line-height: 1.25rem;
  71. color: #323233;
  72. opacity: 1;
  73. }
  74. }
  75. .bottom {
  76. min-height: 7.75rem;
  77. padding: 0 1rem;
  78. span {
  79. height: 1.25rem;
  80. font-size: 0.88rem;
  81. line-height: 1.25rem;
  82. color: #000000;
  83. opacity: 0.61;
  84. }
  85. }
  86. }
  87. .wrapper {
  88. display: flex;
  89. align-items: center;
  90. justify-content: center;
  91. height: 100%;
  92. }
  93. .time-cell-default {
  94. min-width: 60vw;
  95. }
  96. </style>