item.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="flex flex-col justify-center k-app-protection-list__item van-clearfix">
  3. <van-cell-group clickable @click="itemClick">
  4. <van-cell :title="data.name">
  5. <template #right-icon>
  6. <van-button
  7. size="mini"
  8. color="#008cd6"
  9. type="info"
  10. @click.stop="updateStatus(data, '1');return false;"
  11. v-if="data.status != '1' && data.orgId == orgId"
  12. >布防时间登记</van-button
  13. >
  14. <van-button
  15. size="mini"
  16. color="#008cd6"
  17. type="info"
  18. @click.stop="updateStatus(data, '0');return false;"
  19. v-if="data.status != '0' && data.orgId == orgId"
  20. >撤防时间登记</van-button
  21. >
  22. </template>
  23. </van-cell>
  24. <van-cell title="布撤防状态" >
  25. <template #right-icon>
  26. <!-- <span v-if="data.status==1" style="color:rgb(0,164,46)">布防</span>
  27. <span v-else-if="data.status==0" style="color:rgb(215,0,15)">撤防</span> -->
  28. <span >{{getDictLabel(data.status, 'protection_status', '未上报')}}</span>
  29. </template>
  30. </van-cell>
  31. <van-cell
  32. v-if="data.status == '0' || data.status == '1'"
  33. :title="data.status == '0' ? '撤防时间' : '布防时间'"
  34. :value="data.statusUpdateTime"
  35. />
  36. </van-cell-group>
  37. </div>
  38. </template>
  39. <script>
  40. import { mapGetters } from 'vuex'
  41. import * as api from '@/api/protection.js'
  42. import { Dialog } from 'vant'
  43. import dayjs from 'dayjs'
  44. export default {
  45. components: {},
  46. data() {
  47. return {}
  48. },
  49. computed: {
  50. ...mapGetters(['orgName', 'orgId','dictionary'])
  51. },
  52. watch: {},
  53. props: {
  54. data: {},
  55. statusOptions: {}
  56. },
  57. methods: {
  58. formatDate(dateStr) {
  59. return toFormatStr(dateStr)
  60. },
  61. updateStatus(data, status) {
  62. Dialog.confirm({
  63. message: `是否更新${this.getDictLabel(status, 'protection_status', '未上报')}时间?`
  64. })
  65. .then(() => {
  66. api.updateStatus(data.id, status).then(r => {
  67. if (r.data) {
  68. data.status = status
  69. data.statusUpdateTime = dayjs(r.data).format('YYYY-MM-DD HH:MM:ss')
  70. }
  71. })
  72. })
  73. .catch(() => {
  74. // on cancel
  75. })
  76. },
  77. itemClick() {
  78. this.$router.push('/protection/detail?id=' + this.data.id)
  79. }
  80. },
  81. async created() {},
  82. async mounted() {
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .k-app-protection-list__item {
  88. // height: 11.85rem;
  89. background: #ffffff;
  90. margin: 0.3rem 0.325rem 0;
  91. font-size: 3.733333vw;
  92. .top {
  93. // min-height: 3rem;
  94. padding: 0.05rem 0.05rem;
  95. display: flex;
  96. flex-direction: row;
  97. align-items: center;
  98. border-bottom: 1px solid #f3f4f5;
  99. > label {
  100. // height: 1.38rem;
  101. // font-size: 1rem;
  102. // line-height: 1.25rem;
  103. color: #323233;
  104. opacity: 1;
  105. }
  106. }
  107. .bottom {
  108. min-height: 7.75rem;
  109. padding: 0 1rem;
  110. span {
  111. height: 1.25rem;
  112. font-size: 0.88rem;
  113. line-height: 1.25rem;
  114. color: #000000;
  115. opacity: 0.61;
  116. }
  117. }
  118. }
  119. .wrapper {
  120. display: flex;
  121. align-items: center;
  122. justify-content: center;
  123. height: 100%;
  124. }
  125. </style>