tb-tactics-list.html 4.9 KB

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