tb-group-list.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>互助组-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <script src="../../static/kj/upload-util.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="组长名" v-model="p.leaderName"></sa-item>
  26. <sa-item type="text" name="组长电话" v-model="p.leaderPhone"></sa-item>
  27. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  28. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  29. </el-form>
  30. <div class="fast-btn">
  31. <el-button size="mini" type="primary" icon="el-icon-tickets" @click="getBySelect()">批量导入</el-button>
  32. <el-button size="mini" type="success" icon="el-icon-document-copy" @click="getBySelect()">导入模板</el-button>
  33. <el-button v-if="sa.isAuth('tb-group-add')" size="mini" icon="el-icon-plus" type="primary" @click="add()">新增</el-button>
  34. <el-button size="mini" type="success" icon="el-icon-view" @click="getBySelect()">查看</el-button>
  35. <el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteByIds()">删除</el-button>
  36. <!-- <el-button size="mini" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button> -->
  37. </div>
  38. <!-- ------------- 数据列表 ------------- -->
  39. <el-table class="data-table" ref="data-table" :data="dataList" >
  40. <sa-td type="selection"></sa-td>
  41. <sa-td name="名称" prop="name" ></sa-td>
  42. <sa-td name="组长ID" prop="leaderId" ></sa-td>
  43. <sa-td name="组长名" prop="leaderName" ></sa-td>
  44. <sa-td name="组长电话" prop="leaderPhone" ></sa-td>
  45. <sa-td name="边民证编号" prop="code" ></sa-td>
  46. <sa-td name="地址" prop="address" ></sa-td>
  47. <sa-td name="详细地址" prop="detailAddress" ></sa-td>
  48. <sa-td name="当天该组剩余额度" prop="leftPrice" ></sa-td>
  49. <!-- <sa-td name="删除状态" prop="deleteStatus" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateDeleteStatus(s.row)"></sa-td> -->
  50. <el-table-column label="操作" fixed="right" width="280px">
  51. <template slot-scope="s">
  52. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  53. <el-button v-if="sa.isAuth('tb-group-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  54. <el-button class="c-btn" type="success" icon="el-icon-female" @click="getPeople()">边民</el-button>
  55. <el-button v-if="sa.isAuth('tb-group-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!-- ------------- 分页 ------------- -->
  60. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  61. </div>
  62. </div>
  63. <script>
  64. var app = new Vue({
  65. components: {
  66. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  67. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  68. },
  69. el: '.vue-box',
  70. data: {
  71. p: { // 查询参数
  72. id: '', //
  73. addressIds: '', //
  74. address: '', //
  75. detailAddress: '', //
  76. name: '', // 名称
  77. leaderId: '', // 组长ID
  78. leaderName: '', // 组长名
  79. leaderPhone: '', // 组长电话
  80. code: '', //
  81. leftPrice: '', // 当天该组剩余额度
  82. createTime: '', // 创建时间
  83. createBy: '', // 创建人编号
  84. createName: '', // 创建人名称
  85. updateTime: '', // 更新时间
  86. updateBy: '', // 更新人编号
  87. updateName: '', // 更新人名称
  88. deleteStatus: '', // 删除状态(0=禁用,1=启用)
  89. pageNo: 1, // 当前页
  90. pageSize: 10, // 页大小
  91. sortType: 0 // 排序方式
  92. },
  93. dataCount: 0,
  94. dataList: [], // 数据集合
  95. },
  96. methods: {
  97. // 刷新
  98. f5: function() {
  99. sa.ajax('/level-one-server/TbGroup/getList', sa.removeNull(this.p), function(res) {
  100. this.dataList = res.data; // 数据
  101. this.dataCount = res.dataCount; // 数据总数
  102. sa.f5TableHeight(); // 刷新表格高度
  103. }.bind(this));
  104. },
  105. // 查看
  106. get: function(data) {
  107. sa.showIframe('数据详情', 'tb-group-info.html?id=' + data.id, '1050px', '90%');
  108. },
  109. // 查看 - 根据选中的
  110. getBySelect: function(data) {
  111. var selection = this.$refs['data-table'].selection;
  112. if(selection.length == 0) {
  113. return sa.msg('请选择一条数据')
  114. }
  115. this.get(selection[0]);
  116. },
  117. // 修改
  118. update: function(data) {
  119. sa.showIframe('修改数据', 'tb-group-add.html?id=' + data.id, '1000px', '90%');
  120. },
  121. // 新增
  122. add: function(data) {
  123. sa.showIframe('新增数据', 'tb-group-add.html?id=-1', '1000px', '90%');
  124. },
  125. // 删除
  126. del: function(data) {
  127. sa.confirm('是否删除,此操作不可撤销', function() {
  128. sa.ajax('/level-one-server/TbGroup/delete?id=' + data.id, function(res) {
  129. sa.arrayDelete(this.dataList, data);
  130. sa.ok('删除成功');
  131. sa.f5TableHeight(); // 刷新表格高度
  132. }.bind(this))
  133. }.bind(this));
  134. },
  135. // 批量删除
  136. deleteByIds: function() {
  137. // 获取选中元素的id列表
  138. let selection = this.$refs['data-table'].selection;
  139. let ids = sa.getArrayField(selection, 'id');
  140. if(selection.length == 0) {
  141. return sa.msg('请至少选择一条数据')
  142. }
  143. // 提交删除
  144. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  145. sa.ajax('/level-one-server/TbGroup/deleteByIds', {ids: ids.join(',')}, function(res) {
  146. sa.arrayDelete(this.dataList, selection);
  147. sa.ok('删除成功');
  148. sa.f5TableHeight(); // 刷新表格高度
  149. }.bind(this))
  150. }.bind(this));
  151. },
  152. // 改 - 删除状态(0=禁用,1=启用)
  153. updateDeleteStatus: function(data) {
  154. // 声明变量记录是否成功
  155. var isOk = false;
  156. var oldValue = data.deleteStatus;
  157. var ajax = sa.ajax('/level-one-server/TbGroup/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  158. isOk = true;
  159. sa.msg('修改成功');
  160. }.bind(this));
  161. // 如果未能修改成功, 则回滚
  162. $.when(ajax).done(function() {
  163. if(isOk == false) {
  164. data.status = oldValue;
  165. }
  166. })
  167. },
  168. getPeople: function(){
  169. sa.showIframe('边民管理', '../tb-people/tb-people-list.html', '1050px', '90%');
  170. }
  171. },
  172. created: function() {
  173. this.f5();
  174. sa.onInputEnter();
  175. }
  176. })
  177. </script>
  178. </body>
  179. </html>