tb-group-people.html 5.9 KB

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