index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="page_list">
  3. <nav-bar></nav-bar>
  4. <van-row>
  5. <van-col span="24">
  6. <org-tree
  7. v-model="search.orgId"
  8. @changeItem="changeTree"
  9. @checked="orgCheckChanged"
  10. showChecked
  11. defaultChecked
  12. ></org-tree>
  13. </van-col>
  14. </van-row>
  15. <van-row>
  16. <van-col span="24">
  17. <van-cell title="UPS状态" @click="showStatus = true" is-link arrow-direction="down" :value="defaultStatus" />
  18. <van-popup v-model="showStatus" round position="bottom">
  19. <van-picker
  20. title="UPS状态"
  21. show-toolbar
  22. :columns="statusOptions"
  23. @confirm="onStatusConfirm"
  24. @cancel="onCancel"
  25. default-index="0"
  26. :close-on-click-overlay="false"
  27. />
  28. </van-popup>
  29. </van-col>
  30. </van-row>
  31. <div class="container">
  32. <k-list :list="list" :params="search" :auto="false" ref="list">
  33. <template slot-scope="{ data }">
  34. <item :data="data" :statusOptions="deviceTypeOptions"></item>
  35. </template>
  36. </k-list>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import NavBar from '@/components/NavBar'
  42. // import Calendar from '@/components/Calendar';
  43. import { mapGetters } from 'vuex'
  44. import { deptTreeList } from '@/api/public'
  45. // import { list, stateStatistic } from '@/api/iot/donghuan.js'
  46. import KList from '@/components/list/index.vue'
  47. import Item from './components/item.vue'
  48. import OrgTree from '@/components/orgTree'
  49. import dayjs from 'dayjs'
  50. export default {
  51. components: { NavBar, KList, Item, OrgTree },
  52. name: 'iot_ups',
  53. data() {
  54. return {
  55. search: {
  56. orgId: this.orgId,
  57. checkSub: true,
  58. deviceType: null,
  59. state: null,
  60. pageNum: 1,
  61. pageSize: 10
  62. },
  63. statusStatistic: null,
  64. showDeviceType: false,
  65. defaultDeviceType: '全部',
  66. showStatus: false,
  67. defaultStatus: '全部',
  68. dicts: ['sensor_alarm_status']
  69. }
  70. },
  71. watch: {},
  72. created() {},
  73. mounted() {
  74. this.search.orgId = this.orgId
  75. },
  76. computed: {
  77. ...mapGetters(['orgName', 'orgId', 'dictionary']),
  78. statusOptions() {
  79. let r = [{ value: null, text: '全部' }]
  80. let dict = this.getDictItem('sensor_alarm_status')
  81. if (dict) {
  82. dict.forEach(element => {
  83. let label = element.dictLabel
  84. if (element.dictValue == 0 && this.statusStatistic) {
  85. label += `(${this.statusStatistic.normal})`
  86. } else if (element.dictValue == 1 && this.statusStatistic) {
  87. label += `(${this.statusStatistic.alarm})`
  88. }
  89. r.push({ value: element.dictValue, text: label })
  90. })
  91. }
  92. return r
  93. }
  94. },
  95. methods: {
  96. list() {
  97. return {
  98. total: 3,
  99. rows: [
  100. {
  101. orgName: '六一分理处',
  102. deviceName: '监控主机Ups',
  103. state: 0,
  104. stateText: '正常',
  105. stateUpdateTime:dayjs().add(-1000,'second').format('YYYY-MM-DD HH:mm:ss')
  106. },
  107. {
  108. orgName: '六一分理处',
  109. deviceName: '现金区Ups',
  110. state: 0,
  111. stateText: '正常',
  112. stateUpdateTime:dayjs().add(-100,'second').format('YYYY-MM-DD HH:mm:ss')
  113. },
  114. {
  115. orgName: '六一分理处',
  116. deviceName: '大厅Ups',
  117. state: 0,
  118. stateText: '正常',
  119. stateUpdateTime:dayjs().add(-300,'second').format('YYYY-MM-DD HH:mm:ss')
  120. }
  121. ]
  122. }
  123. },
  124. onStatusConfirm(opt) {
  125. this.defaultState = opt.text
  126. this.search.state = opt.value
  127. this.showStatus = false
  128. },
  129. onCancel() {
  130. this.showAlarmType = false
  131. this.showStatus = false
  132. },
  133. //改变机构后将重新发起请求
  134. changeTree(node) {
  135. this.search.orgId = node.id
  136. },
  137. orgCheckChanged(v) {
  138. this.search.checkSub = v
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .page_list {
  145. background-color: transparent;
  146. display: block;
  147. .container {
  148. // overflow: auto;
  149. // height: calc(100vh - 11rem);
  150. .k-content-repair {
  151. display: flex;
  152. flex-direction: column;
  153. justify-content: space-between;
  154. flex: 1;
  155. }
  156. }
  157. }
  158. .search-devicetype {
  159. width: 25%;
  160. display: inline-block;
  161. text-align: center;
  162. margin-top: 10px;
  163. }
  164. .search-state {
  165. width: 100%;
  166. margin-top: 10px;
  167. padding-left: 10px;
  168. padding-right: 10px;
  169. > span {
  170. width: 50%;
  171. border: solid 1px rgb(196, 196, 196);
  172. display: inline-block;
  173. text-align: center;
  174. padding-top: 1.2vw;
  175. padding-bottom: 1.2vw;
  176. }
  177. }
  178. .alarm_state_selected {
  179. background-color: #409eff;
  180. border-color: #409eff;
  181. color: white;
  182. font-weight: 700;
  183. }
  184. </style>