tb-group-people.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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="../../static/kj/element-ui/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. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <el-form ref="form" :model='p' @submit.native.prevent>
  22. <div class="c-item">
  23. <label class="c-label">姓名:</label>
  24. <el-input size="mini" v-model="p.name"></el-input>
  25. </div>
  26. <div class="c-item">
  27. <label class="c-label">手机号码:</label>
  28. <el-input size="mini" v-model="p.phone"></el-input>
  29. </div>
  30. <div class="c-item" style="min-width: 0px;">
  31. <el-button size="mini" type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  32. <el-button size="mini" type="primary" icon="el-icon-plus" @click="add()">添加</el-button>
  33. <el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteByIds()">移出</el-button>
  34. <el-button size="mini" type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  35. </div>
  36. </el-form>
  37. <!-- ------------- 快捷按钮 ------------- -->
  38. <div class="fast-btn">
  39. </div>
  40. <!-- ------------- 数据列表 ------------- -->
  41. <el-table class="data-table" ref="data-table" :data="dataList" size="small">
  42. <el-table-column align="center" type="selection" width="45px"></el-table-column>
  43. <el-table-column align="center" label="姓名" prop="name" ></el-table-column>
  44. <el-table-column align="center" label="边民号" prop="code" ></el-table-column>
  45. <el-table-column align="center" label="性别">
  46. <template slot-scope="s">
  47. <b v-if="s.row.sex == 1">男</b>
  48. <b v-if="s.row.sex == 2">女</b>
  49. </template>
  50. </el-table-column>
  51. <el-table-column align="center" label="手机号码" prop="phone" ></el-table-column>
  52. <el-table-column align="center" label="操作" fixed="right" width="240px">
  53. <template slot-scope="s">
  54. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  55. <el-button 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. <div class="page-box">
  61. <el-pagination background
  62. layout="total, prev, pager, next, sizes, jumper"
  63. :current-page.sync="p.pageNo"
  64. :page-size.sync="p.pageSize"
  65. :total="dataCount"
  66. :page-sizes="[1, 10, 20, 30, 40, 50, 100, 1000]"
  67. @current-change="f5()"
  68. @size-change="f5()">
  69. </el-pagination>
  70. </div>
  71. </div>
  72. </div>
  73. <script>
  74. var app = new Vue({
  75. el: '.vue-box',
  76. data: {
  77. p: { // 查询参数
  78. id: '', // 主键
  79. name: '', // 姓名
  80. code: '', // 边民号
  81. idCard: '', // 身份证
  82. phone: '', // 手机号码
  83. groupId: sa.p('groupId',-1), // 所属互助组(1=测试组)
  84. pageNo: 1, // 当前页
  85. pageSize: 10, // 页大小
  86. sortType: 0 // 排序方式
  87. },
  88. dataCount: 0,
  89. dataList: [], // 数据集合
  90. },
  91. methods: {
  92. // 刷新
  93. f5: function() {
  94. sa.ajax('/level-one-server/TbPeople/getList', sa.removeNull(this.p), function(res) {
  95. this.dataList = res.data; // 数据
  96. this.dataCount = res.dataCount; // 数据总数
  97. sa.f5TableHeight(); // 刷新表格高度
  98. }.bind(this));
  99. },
  100. // 查看
  101. get: function(data) {
  102. sa.showIframe('数据详情', '../tb-people/tb-people-info.html?id=' + data.id, '950px', '90%');
  103. },
  104. // 查看 - 根据选中的
  105. getBySelect: function(data) {
  106. var selection = this.$refs['data-table'].selection;
  107. if(selection.length == 0) {
  108. return sa.msg('请选择一条数据')
  109. }
  110. this.get(selection[0]);
  111. },
  112. // 新增
  113. add: function() {
  114. sa.showIframe('添加边民', 'tb-group-people-add.html?groupId='+this.p.groupId, '900px', '90%');
  115. },
  116. // 删除
  117. del: function(data) {
  118. sa.confirm('是否移除此边民?', function() {
  119. let obj={
  120. groupId:this.p.groupId,
  121. ids:data.id
  122. }
  123. sa.ajax('/level-one-server/TbPeople/leaveGroup',obj, function(res) {
  124. sa.arrayDelete(this.dataList, data);
  125. sa.ok('已移除');
  126. sa.f5TableHeight(); // 刷新表格高度
  127. }.bind(this))
  128. }.bind(this));
  129. },
  130. // 批量删除
  131. deleteByIds: function() {
  132. // 获取选中元素的id列表
  133. let selection = this.$refs['data-table'].selection;
  134. let ids = sa.getArrayField(selection, 'id');
  135. if(selection.length == 0) {
  136. return sa.msg('请至少选择一条数据')
  137. }
  138. // 提交删除
  139. sa.confirm('是否要移除已选择的边民?', function() {
  140. sa.ajax('/level-one-server/TbPeople/leaveGroup', {groupId:this.p.groupId,ids: ids.join(',')}, function(res) {
  141. sa.arrayDelete(this.dataList, selection);
  142. sa.ok('已移除');
  143. sa.f5TableHeight(); // 刷新表格高度
  144. }.bind(this))
  145. }.bind(this));
  146. },
  147. },
  148. created: function() {
  149. this.f5();
  150. sa.onInputEnter();
  151. }
  152. })
  153. </script>
  154. </body>
  155. </html>