tb-venues-list.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  26. <el-button type="primary" icon="el-icon-plus" @click="add" v-if="sa.isAuth('tb-venues-add')">新增场所
  27. </el-button>
  28. <el-button type="info" icon="el-icon-refresh" @click="p.name='',f5()">重置</el-button>
  29. </el-form>
  30. <!-- ------------- 快捷按钮 ------------- -->
  31. <!-- ------------- 数据列表 ------------- -->
  32. <el-table class="data-table" ref="data-table" :data="dataList" row-key="id" border
  33. @expand-change="sa.f5TableHeight()">
  34. <sa-td name="序号" type="index"></sa-td>
  35. <sa-td name="名称" prop="name"></sa-td>
  36. <el-table-column label="类型" prop="type">
  37. <template slot-scope="s">
  38. <span v-if="s.row.type==1">人行道</span>
  39. <span v-else-if="s.row.type==2">车行道</span>
  40. <span v-else-if="s.row.type==3">场所</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="场所等级" prop="level">
  44. <template slot-scope="s">
  45. <span v-if="s.row.type==3">
  46. {{s.row.level}}级
  47. </span>
  48. <span v-else>-</span>
  49. </template>
  50. </el-table-column>
  51. <sa-td name="创建时间" prop="createTime"></sa-td>
  52. <sa-td name="更新时间" prop="updateTime"></sa-td>
  53. <el-table-column label="操作" fixed="right" width="320px">
  54. <template slot-scope="s">
  55. <el-button v-if="s.row.pId===-1&&sa.isAuth('tb-venues-edit')" class="c-btn" type="primary"
  56. icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  57. <el-button v-if="s.row.pId!==-1&&sa.isAuth('tb-venues-edit')" class="c-btn" type="primary"
  58. icon="el-icon-edit" @click="updateChild(s.row)">修改</el-button>
  59. <el-button v-if="s.row.pId===-1&&sa.isAuth('tb-venues-add')" class="c-btn" type="primary"
  60. icon="el-icon-plus" @click="addChildren(s.row)">添加通道</el-button>
  61. <el-button v-if="sa.isAuth('tb-venues-del')" class="c-btn" type="danger"
  62. icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <!-- ------------- 分页 ------------- -->
  67. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"
  68. :sizes="[1000]"></sa-item>
  69. </div>
  70. </div>
  71. <script>
  72. var app = new Vue({
  73. components: {
  74. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  75. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  76. },
  77. el: '.vue-box',
  78. data: {
  79. p: { // 查询参数
  80. id: '', //
  81. deptId: '', // 单位ID
  82. deptName: '', // 单位
  83. pId: '', // 父ID
  84. name: '', // 名称
  85. pageNo: 1, // 当前页
  86. pageSize: 10, // 页大小
  87. sortType:10 // 排序方式
  88. },
  89. dataCount: 0,
  90. dataList: [], // 数据集合
  91. },
  92. methods: {
  93. // 刷新
  94. f5: function() {
  95. sa.ajax('/TbVenues/getTree', sa.removeNull(this.p), function(res) {
  96. this.dataList = res.data; // 数据
  97. this.dataCount = res.dataCount; // 数据总数
  98. sa.f5TableHeight(); // 刷新表格高度
  99. }.bind(this));
  100. },
  101. // 查看
  102. get: function(data) {
  103. sa.showIframe('数据详情', 'tb-venues-info.html?id=' + data.id, '1050px', '90%');
  104. },
  105. // 查看 - 根据选中的
  106. getBySelect: function(data) {
  107. var selection = this.$refs['data-table'].selection;
  108. if (selection.length == 0) {
  109. return sa.msg('请选择一条数据')
  110. }
  111. this.get(selection[0]);
  112. },
  113. // 修改
  114. update: function(data) {
  115. sa.showIframe('修改场所', 'tb-venues-add.html?id=' + data.id, '600px', '60%');
  116. },
  117. updateChild(data) {
  118. sa.showIframe('修改通道', 'tb-venues-addchildren.html?id=' + data.id + '&deptId=' + data.deptId,
  119. '500px', '60%');
  120. },
  121. // 新增
  122. add: function(data) {
  123. sa.showIframe('新增场所', 'tb-venues-add.html?id=0', '500px', '60%');
  124. },
  125. // 新增子级
  126. addChildren: function(data) {
  127. sa.showIframe('新增通道', 'tb-venues-addchildren.html?departmentId='+data.departmentId+'&pId=' + data.id, '500px', '50%');
  128. },
  129. // 删除
  130. del: function(data) {
  131. sa.confirm('是否删除,此操作不可撤销', function() {
  132. sa.ajax('/TbVenues/delete?id=' + data.id, function(res) {
  133. this.f5();
  134. }.bind(this))
  135. }.bind(this));
  136. },
  137. // 批量删除
  138. deleteByIds: function() {
  139. // 获取选中元素的id列表
  140. let selection = this.$refs['data-table'].selection;
  141. let ids = sa.getArrayField(selection, 'id');
  142. if (selection.length == 0) {
  143. return sa.msg('请至少选择一条数据')
  144. }
  145. // 提交删除
  146. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  147. sa.ajax('/TbVenues/deleteByIds', {
  148. ids: ids.join(',')
  149. }, function(res) {
  150. this.f5();
  151. }.bind(this))
  152. }.bind(this));
  153. },
  154. },
  155. created: function() {
  156. this.f5();
  157. sa.onInputEnter();
  158. }
  159. })
  160. </script>
  161. </body>
  162. </html>