tb-gate-terminal-list.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>车辆道闸-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css & js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="名称" v-model="p.name"></sa-item>
  25. <sa-item type="text" name="IP地址" v-model="p.ip"></sa-item>
  26. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  27. <el-button type="primary" icon="el-icon-plus" @click="add" v-if="sa.isAuth('tb-gate-terminal-add')">
  28. 新增</el-button>
  29. <el-button type="info" icon="el-icon-refresh" @click="p.name='',p.ip='',f5()">重置</el-button>
  30. </el-form>
  31. <!-- ------------- 数据列表 ------------- -->
  32. <el-table class="data-table" ref="data-table" :data="dataList">
  33. <sa-td name="序号" type="index"></sa-td>
  34. <sa-td name="名称" prop="name" width="140"></sa-td>
  35. <sa-td name="所在场所" prop="venuesName"></sa-td>
  36. <sa-td name="所在通道" prop="channelName"></sa-td>
  37. <sa-td name="方向" prop="direction" type="enum" :jv="{1: '入场', 2: '离场'}"></sa-td>
  38. <sa-td name="IP地址" prop="ip" width="140"></sa-td>
  39. <sa-td name="状态" prop="state"></sa-td>
  40. <el-table-column label="通讯">
  41. <template slot-scope="s">
  42. <el-button class="c-btn" @click="checkFn(s.row)">检测
  43. </el-button>
  44. </template>
  45. </el-table-column>
  46. <sa-td name="创建时间" prop="createTime" width="140"></sa-td>
  47. <sa-td name="更新时间" prop="updateTime" width="140"></sa-td>
  48. <el-table-column label="操作" fixed="right" width="240px">
  49. <template slot-scope="s">
  50. <el-button class="c-btn" type="success" @click="open(s.row)">开闸</el-button>
  51. <el-button class="c-btn" type="primary" @click="update(s.row)">修改</el-button>
  52. <el-button class="c-btn" type="danger" @click="del(s.row)">删除</el-button>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <!-- ------------- 分页 ------------- -->
  57. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  58. </sa-item>
  59. </div>
  60. </div>
  61. <script>
  62. var app = new Vue({
  63. components: {
  64. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  65. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  66. },
  67. el: '.vue-box',
  68. data: {
  69. p: { // 查询参数
  70. id: '', // 主键
  71. name: '', // 名称
  72. deptId: '', // 单位id
  73. sn: '', // 序列号
  74. ip: '', // IP地址
  75. pageNo: 1, // 当前页
  76. pageSize: 10, // 页大小
  77. sortType: 0 // 排序方式
  78. },
  79. dataCount: 0,
  80. dataList: [], // 数据集合
  81. },
  82. methods: {
  83. open(data) {
  84. sa.confirm('是否远程开闸?', function() {
  85. sa.ajax('/TbGateTerminal/open?id=' + data.id, function(res) {
  86. sa.ok('开闸成功');
  87. }.bind(this))
  88. }.bind(this));
  89. },
  90. checkFn(data) {
  91. sa.ajax('/TbGateTerminal/check', data, function(res) {
  92. sa.ok('通讯正常');
  93. }.bind(this));
  94. },
  95. // 刷新
  96. f5: function() {
  97. sa.ajax('/TbGateTerminal/getList', sa.removeNull(this.p), function(res) {
  98. this.dataList = res.data; // 数据
  99. this.dataCount = res.dataCount; // 数据总数
  100. sa.f5TableHeight(); // 刷新表格高度
  101. }.bind(this));
  102. },
  103. // 查看
  104. get: function(data) {
  105. sa.showIframe('数据详情', 'tb-gate-terminal-info.html?id=' + data.id, '1050px', '90%');
  106. },
  107. // 查看 - 根据选中的
  108. getBySelect: function(data) {
  109. var selection = this.$refs['data-table'].selection;
  110. if (selection.length == 0) {
  111. return sa.msg('请选择一条数据')
  112. }
  113. this.get(selection[0]);
  114. },
  115. // 修改
  116. update: function(data) {
  117. sa.showIframe('修改数据', 'tb-gate-terminal-add.html?id=' + data.id, '600px', '60%');
  118. },
  119. // 新增
  120. add: function(data) {
  121. sa.showIframe('新增数据', 'tb-gate-terminal-add.html?id=-1', '700px', '60%');
  122. },
  123. // 删除
  124. del: function(data) {
  125. sa.confirm('是否删除,此操作不可撤销', function() {
  126. sa.ajax('/TbGateTerminal/delete?id=' + data.id, function(res) {
  127. sa.arrayDelete(this.dataList, data);
  128. sa.ok('删除成功');
  129. sa.f5TableHeight(); // 刷新表格高度
  130. }.bind(this))
  131. }.bind(this));
  132. },
  133. // 批量删除
  134. deleteByIds: function() {
  135. // 获取选中元素的id列表
  136. let selection = this.$refs['data-table'].selection;
  137. let ids = sa.getArrayField(selection, 'id');
  138. if (selection.length == 0) {
  139. return sa.msg('请至少选择一条数据')
  140. }
  141. // 提交删除
  142. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  143. sa.ajax('/TbGateTerminal/deleteByIds', {
  144. ids: ids.join(',')
  145. }, function(res) {
  146. sa.arrayDelete(this.dataList, selection);
  147. sa.ok('删除成功');
  148. sa.f5TableHeight(); // 刷新表格高度
  149. }.bind(this))
  150. }.bind(this));
  151. },
  152. },
  153. created: function() {
  154. this.f5();
  155. sa.onInputEnter();
  156. }
  157. })
  158. </script>
  159. </body>
  160. </html>