detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <div class="detail">
  3. <nav-bar></nav-bar>
  4. <card class="info">
  5. <van-cell-group>
  6. <van-cell title="控制器名称" :value="info.name" />
  7. <van-cell title="所属监控主机" :value="info.hostName" v-if="info.hostName" value-class="cell-host"/>
  8. <van-cell title="所属机构" :value="info.orgName" />
  9. </van-cell-group>
  10. </card>
  11. <card title="布撤防历史" class="history">
  12. <template>
  13. <k-list :list="history" :params="search">
  14. <template v-slot:header>
  15. <div class="header">
  16. <span>布撤防状态</span>
  17. <span>布撤防时间</span>
  18. <span>上报人</span>
  19. </div>
  20. </template>
  21. <template slot-scope="{ data }">
  22. <div class="datarow">
  23. <!-- <span v-if="data.status == 1" style="color: rgb(0, 164, 46)">布防</span>
  24. <span v-else-if="data.status == 0" style="color: rgb(215, 0, 15)">撤防</span> -->
  25. <span>{{ getDictLabel(data.status, 'protection_status', '未上报') }}</span>
  26. <span>{{ data.statusChangeTime }}</span>
  27. <span>{{ data.statusUpdatorName ? data.statusUpdatorName : '自动获取' }}</span>
  28. </div>
  29. </template>
  30. </k-list>
  31. </template>
  32. </card>
  33. </div>
  34. </template>
  35. <script>
  36. import KList from '@/components/list/index.vue'
  37. import { get, history } from '@/api/protection.js'
  38. import Card from '@/components/card/index.vue'
  39. import { getLabel } from '@/utils/optionEx'
  40. import NavBar from '@/components/NavBar'
  41. import { mapGetters } from 'vuex'
  42. export default {
  43. data() {
  44. return {
  45. info: {},
  46. search: {
  47. protectionId: this.$route.query.id
  48. },
  49. statusOptions: [
  50. { value: -1, text: '布撤防状态' },
  51. { value: '0', text: '撤防' },
  52. { value: '1', text: '布防' },
  53. { value: '2', text: '未知' }
  54. ],
  55. dicts: ['protection_status']
  56. }
  57. },
  58. components: { NavBar, KList, Card },
  59. computed: {
  60. ...mapGetters(['dictionary'])
  61. },
  62. mounted() {
  63. this.getInfo()
  64. },
  65. methods: {
  66. history,
  67. getLabel,
  68. getInfo() {
  69. get(this.search.protectionId).then(r => {
  70. this.info = r.data
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .detail {
  78. margin: 15px;
  79. }
  80. .info {
  81. ::v-deep .van-cell__title {
  82. max-width: 40%;
  83. }
  84. ::v-deep .van-cell__value {
  85. max-width: 60%;
  86. }
  87. }
  88. .history {
  89. ::v-deep .header {
  90. display: flex;
  91. flex-direction: row;
  92. background-color: rgb(240, 240, 240);
  93. padding-top: 10px;
  94. padding-bottom: 10px;
  95. }
  96. ::v-deep .header > span {
  97. display: inline-block;
  98. text-align: center;
  99. }
  100. ::v-deep .header > span {
  101. display: inline-block;
  102. text-align: center;
  103. }
  104. ::v-deep .header > span:nth-child(1) {
  105. width: 30%;
  106. }
  107. ::v-deep .header > span:nth-child(2) {
  108. width: 40%;
  109. }
  110. ::v-deep .header > span:nth-child(3) {
  111. width: 30%;
  112. }
  113. ::v-deep .datarow {
  114. display: flex;
  115. flex-direction: row;
  116. padding-top: 15px;
  117. padding-bottom: 10px;
  118. border-bottom: 1px solid rgb(240, 240, 240);
  119. }
  120. ::v-deep .datarow > span {
  121. display: inline-block;
  122. text-align: center;
  123. }
  124. ::v-deep .datarow > span:nth-child(1) {
  125. width: 30%;
  126. }
  127. ::v-deep .datarow > span:nth-child(2) {
  128. width: 40%;
  129. }
  130. ::v-deep .datarow > span:nth-child(3) {
  131. width: 30%;
  132. }
  133. }
  134. .cell-host{
  135. min-width: 58vw;
  136. }
  137. </style>