index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading" style="width: 100%">
  4. <!-- 搜索表单 -->
  5. <seekPage :seekList="seekList" :formLength="3" @search="reload"></seekPage>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. :page-size="20"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. >
  19. <template v-slot:deviceName="{ row }">
  20. <el-link type="primary" :underline="false" @click="openDetail(row)">
  21. {{ row.deviceName }}
  22. </el-link>
  23. </template>
  24. <!-- 是否正常列 -->
  25. <template v-slot:isAbnormal="{ row }">
  26. <el-tag :type="row.isAbnormal == 0 ? 'success' : 'danger'" size="small">
  27. {{ row.isAbnormal == 0 ? '正常通行' : '异常事件' }}
  28. </el-tag>
  29. </template>
  30. <!-- 操作 -->
  31. <template v-slot:action="{ row }">
  32. <el-link
  33. type="primary"
  34. :underline="false"
  35. icon="el-icon-view"
  36. @click="openDetail(row)"
  37. >
  38. 查看详情
  39. </el-link>
  40. </template>
  41. </ele-pro-table>
  42. </el-card>
  43. <!-- 查看详情弹窗 -->
  44. <detail-dialog
  45. :visible.sync="detailVisible"
  46. :data="currentRow"
  47. />
  48. </div>
  49. </template>
  50. <script>
  51. import seekPage from '@/BIZComponents/seekPage.vue';
  52. import tabMixins from '@/mixins/tableColumnsMixin';
  53. import { listEntryExitRecords } from '@/api/‌doorSecurity‌';
  54. import detailDialog from './components/detailDialog.vue';
  55. export default {
  56. mixins: [tabMixins],
  57. components: {
  58. seekPage,
  59. detailDialog
  60. },
  61. data() {
  62. return {
  63. loading: false,
  64. detailVisible: false,
  65. currentRow: null,
  66. selection: [],
  67. cacheKeyUrl: 'eos-entryExitRecords-list',
  68. columnsVersion: 1
  69. };
  70. },
  71. computed: {
  72. columns() {
  73. void this.columnsVersion;
  74. return [
  75. {
  76. width: 45,
  77. type: 'selection',
  78. columnKey: 'selection',
  79. align: 'center'
  80. },
  81. {
  82. width: 60,
  83. label: '序号',
  84. type: 'index',
  85. columnKey: 'index',
  86. align: 'center'
  87. },
  88. {
  89. minWidth: 140,
  90. prop: 'deviceName',
  91. label: '设备名称',
  92. align: 'center',
  93. showOverflowTooltip: true,
  94. slot: 'deviceName'
  95. },
  96. {
  97. minWidth: 100,
  98. prop: 'doorNo',
  99. label: '门号',
  100. align: 'center',
  101. showOverflowTooltip: true
  102. },
  103. {
  104. minWidth: 140,
  105. prop: 'ipAddress',
  106. label: '设备IP',
  107. align: 'center',
  108. showOverflowTooltip: true
  109. },
  110. // {
  111. // minWidth: 120,
  112. // prop: 'personName',
  113. // label: '人员姓名',
  114. // align: 'center',
  115. // showOverflowTooltip: true
  116. // },
  117. {
  118. minWidth: 110,
  119. prop: 'isAbnormal',
  120. label: '是否正常',
  121. slot: 'isAbnormal',
  122. align: 'center',
  123. formatter: (_row, _column, cellValue) => {
  124. return cellValue == 0 ? '正常通行' : '异常事件';
  125. }
  126. },
  127. {
  128. minWidth: 120,
  129. prop: 'eventType',
  130. label: '事件类型',
  131. align: 'center',
  132. showOverflowTooltip: true
  133. },
  134. {
  135. minWidth: 120,
  136. prop: 'eventDescription',
  137. label: '事件描述',
  138. align: 'center',
  139. showOverflowTooltip: true
  140. },
  141. {
  142. minWidth: 120,
  143. prop: 'eventTime',
  144. label: '触发时间',
  145. align: 'center',
  146. showOverflowTooltip: true
  147. },
  148. // {
  149. // columnKey: 'action',
  150. // label: '操作',
  151. // width: 120,
  152. // align: 'center',
  153. // resizable: false,
  154. // slot: 'action',
  155. // fixed: 'right'
  156. // }
  157. ];
  158. },
  159. seekList() {
  160. return [
  161. {
  162. label: '设备名称:',
  163. value: 'deviceName',
  164. type: 'input',
  165. placeholder: '请输入设备名称'
  166. },
  167. // {
  168. // label: '门号:',
  169. // value: 'doorNo',
  170. // type: 'input',
  171. // placeholder: '请输入门号'
  172. // },
  173. // {
  174. // label: '人员姓名:',
  175. // value: 'personName',
  176. // type: 'input',
  177. // placeholder: '请输入人员姓名'
  178. // },
  179. {
  180. label: '是否正常:',
  181. value: 'isAbnormal',
  182. type: 'select',
  183. planList: [
  184. { value: '0', label: '正常通行' },
  185. { value: '1', label: '异常事件' }
  186. ],
  187. placeholder: '请选择'
  188. },
  189. {
  190. label: '事件类型:',
  191. value: 'eventType',
  192. type: 'input',
  193. placeholder: '请输入事件类型'
  194. }
  195. ];
  196. }
  197. },
  198. methods: {
  199. /* 表格数据源 */
  200. async datasource({ page, limit, where }) {
  201. const res = await listEntryExitRecords({
  202. pageNum: page,
  203. size: limit,
  204. ...where
  205. });
  206. res.count = res.total || 0;
  207. res.list = res.records || [];
  208. return res
  209. },
  210. /* 刷新表格 */
  211. reload(where = {}) {
  212. this.$refs.table.reload({ page: 1, where });
  213. },
  214. /* 打开查看详情弹窗 */
  215. openDetail(row) {
  216. this.currentRow = row || null;
  217. this.detailVisible = true;
  218. }
  219. }
  220. };
  221. </script>