item.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="flex flex-col justify-center k-app-edu-training-list__item">
  3. <div class="top flex flex-row items-center justify-between">
  4. <label style="width: 70%">{{ data.title }}</label>
  5. <div style="width: 30%; text-align: right">
  6. <span>{{ data.name }}</span>
  7. <van-button size="mini" type="primary" @click="updateStatus(data.id, '1')" v-if="data.status != '1'"
  8. >布防</van-button
  9. >
  10. <van-button size="mini" type="primary" @click="updateStatus(data.id, '0')" v-if="data.status != '0'"
  11. >撤防</van-button
  12. >
  13. </div>
  14. </div>
  15. <van-cell-group clickable @click="itemClick">
  16. <van-cell title="防区状态" :value="getLabel(statusOptions, data.status)" />
  17. <van-cell
  18. v-if="data.status == '0' || data.status == '1'"
  19. :title="data.status == '0' ? '撤防时间' : '布防时间'"
  20. :value="data.statusUpdateTime"
  21. />
  22. </van-cell-group>
  23. </div>
  24. </template>
  25. <script>
  26. import { getLabel } from '@/utils/optionEx.js'
  27. import * as api from '@/api/protection.js'
  28. import { Dialog } from 'vant'
  29. export default {
  30. components: {},
  31. data() {
  32. return {
  33. }
  34. },
  35. computed: {},
  36. watch: {},
  37. props: {
  38. data: {},
  39. statusOptions: {}
  40. },
  41. methods: {
  42. getLabel,
  43. formatDate(dateStr) {
  44. return toFormatStr(dateStr)
  45. },
  46. updateStatus(id, status) {
  47. Dialog.confirm({
  48. message: `防区状态将变更为${this.getLabel(this.statusOptions, status)},请确认`
  49. })
  50. .then(() => {
  51. api.updateStatus(id, status)
  52. })
  53. .catch(() => {
  54. // on cancel
  55. })
  56. },
  57. itemClick(){
  58. }
  59. },
  60. async created() {},
  61. async mounted() {}
  62. }
  63. </script>
  64. <style lang="less" scoped>
  65. .k-app-edu-training-list__item {
  66. // height: 11.85rem;
  67. background: #ffffff;
  68. margin: 0.625rem 0.625rem 0;
  69. .top {
  70. min-height: 3rem;
  71. padding: 0 1rem;
  72. display: flex;
  73. flex-direction: row;
  74. align-items: center;
  75. border-bottom: 1px solid #f3f4f5;
  76. > label {
  77. // height: 1.38rem;
  78. font-size: 1rem;
  79. // line-height: 1.25rem;
  80. color: #323233;
  81. opacity: 1;
  82. }
  83. }
  84. .bottom {
  85. min-height: 7.75rem;
  86. padding: 0 1rem;
  87. span {
  88. height: 1.25rem;
  89. font-size: 0.88rem;
  90. line-height: 1.25rem;
  91. color: #000000;
  92. opacity: 0.61;
  93. }
  94. }
  95. }
  96. .wrapper {
  97. display: flex;
  98. align-items: center;
  99. justify-content: center;
  100. height: 100%;
  101. }
  102. </style>