tb-people-list.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.code"></sa-item>
  26. <sa-item type="enum" name="所属互助组" v-model="p.groupId"
  27. :jv="{1: '测试组'}" jtype="2" def="不限"></sa-item>
  28. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  29. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  30. </el-form>
  31. <div class="fast-btn">
  32. <el-button v-if="sa.isAuth('tb-people-add')" size="mini" type="primary" @click="add()">新增</el-button>
  33. <el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
  34. </div>
  35. <!-- ------------- 数据列表 ------------- -->
  36. <el-table class="data-table" ref="data-table" :data="dataList" >
  37. <sa-td type="selection"></sa-td>
  38. <sa-td name="姓名" prop="name" ></sa-td>
  39. <sa-td name="边民号" prop="code" ></sa-td>
  40. <sa-td name="性别" prop="sex" type="enum" :jv="{1: '男', 2: '女'}"></sa-td>
  41. <sa-td name="年龄" prop="age" type="num"></sa-td>
  42. <sa-td name="身份证" prop="idCard" ></sa-td>
  43. <sa-td name="身份证复印件" prop="idCardImg" type="img-list"></sa-td>
  44. <sa-td name="手机号码" prop="phone" ></sa-td>
  45. <sa-td name="银行编号" prop="bankNo" ></sa-td>
  46. <sa-td name="银行卡号" prop="bankCode" ></sa-td>
  47. <sa-td name="银行名称" prop="bankName" ></sa-td>
  48. <sa-td name="所属互助组" prop="groupId" type="enum" :jv="{1: '测试组'}"></sa-td>
  49. <sa-td name="互助组名称" prop="groupName" ></sa-td>
  50. <sa-td name="是否可用" prop="status" type="enum" :jv="{0: '否', 1: '是'}"></sa-td>
  51. <sa-td name="角色" prop="role" type="num"></sa-td>
  52. <sa-td name="经度" prop="lng" ></sa-td>
  53. <sa-td name="纬度" prop="lat" ></sa-td>
  54. <sa-td name="最后一次下单定位" prop="lastLocation" ></sa-td>
  55. <sa-td name="联系地址" prop="address" ></sa-td>
  56. <sa-td name="地址ID" prop="addressIds" ></sa-td>
  57. <sa-td name="详细地址" prop="detailAddress" ></sa-td>
  58. <sa-td name="是否锁定" prop="isLock" ></sa-td>
  59. <sa-td name="当天剩余额度" prop="leftPrice" ></sa-td>
  60. <sa-td name="" prop="judgeStatus" ></sa-td>
  61. <!-- <sa-td name="" prop="judgeContent" ></sa-td>
  62. <sa-td name="" prop="registerTime" ></sa-td>
  63. <sa-td name="" prop="judgeTime" ></sa-td>
  64. <sa-td name="" prop="personId" ></sa-td> -->
  65. <!-- <sa-td name="删除状态" prop="deleteStatus" type="switch" :jv="{0: '禁用', 1: '启用'}" @change="s => updateDeleteStatus(s.row)"></sa-td> -->
  66. <el-table-column label="操作" fixed="right" width="240px">
  67. <template slot-scope="s">
  68. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  69. <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  70. <el-button v-if="sa.isAuth('tb-people-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <!-- ------------- 分页 ------------- -->
  75. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  76. </div>
  77. </div>
  78. <script>
  79. var app = new Vue({
  80. components: {
  81. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  82. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  83. },
  84. el: '.vue-box',
  85. data: {
  86. p: { // 查询参数
  87. name: '', // 姓名
  88. code: '', // 边民号
  89. sex: '', // 性别(1=男,2=女)
  90. age: '', // 年龄
  91. idCard: '', // 身份证
  92. phone: '', // 手机号码
  93. bankNo: '', // 银行编号
  94. bankCode: '', // 银行卡号
  95. bankName: '', // 银行名称
  96. groupId: '', // 所属互助组(1=测试组)
  97. groupName: '', // 互助组名称
  98. status: '', // 是否可用(0=否,1=是)
  99. role: '', // 角色(1=普通边民,2=兼组长)
  100. lng: '', // 经度
  101. lat: '', // 纬度
  102. lastLocation: '', // 最后一次下单定位
  103. address: '', // 联系地址
  104. addressIds: '', // 地址ID
  105. detailAddress: '', // 详细地址
  106. isLock: '', // 是否锁定
  107. leftPrice: '', // 当天剩余额度
  108. // judgeStatus: '', //
  109. // judgeContent: '', //
  110. // registerTime: '', //
  111. // judgeTime: '', //
  112. // personId: '', //
  113. // deleteStatus: '', // 删除状态(0=禁用,1=启用)
  114. pageNo: 1, // 当前页
  115. pageSize: 10, // 页大小
  116. sortType: 0 // 排序方式
  117. },
  118. dataCount: 0,
  119. dataList: [], // 数据集合
  120. },
  121. methods: {
  122. // 刷新
  123. f5: function() {
  124. sa.ajax('/level-one-server/TbPeople/getList', sa.removeNull(this.p), function(res) {
  125. this.dataList = res.data; // 数据
  126. this.dataCount = res.dataCount; // 数据总数
  127. sa.f5TableHeight(); // 刷新表格高度
  128. }.bind(this));
  129. },
  130. // 查看
  131. get: function(data) {
  132. sa.showIframe('数据详情', 'tb-people-info.html?id=' + data.id, '1050px', '90%');
  133. },
  134. // 查看 - 根据选中的
  135. getBySelect: function(data) {
  136. var selection = this.$refs['data-table'].selection;
  137. if(selection.length == 0) {
  138. return sa.msg('请选择一条数据')
  139. }
  140. this.get(selection[0]);
  141. },
  142. // 修改
  143. update: function(data) {
  144. sa.showIframe('修改数据', 'tb-people-add.html?id=' + data.id, '1000px', '90%');
  145. },
  146. // 新增
  147. add: function(data) {
  148. sa.showIframe('新增数据', 'tb-people-add.html?id=-1', '1000px', '90%');
  149. },
  150. // 删除
  151. del: function(data) {
  152. sa.confirm('是否删除,此操作不可撤销', function() {
  153. sa.ajax('/level-one-server/TbPeople/delete?id=' + data.id, function(res) {
  154. sa.arrayDelete(this.dataList, data);
  155. sa.ok('删除成功');
  156. sa.f5TableHeight(); // 刷新表格高度
  157. }.bind(this))
  158. }.bind(this));
  159. },
  160. // 批量删除
  161. deleteByIds: function() {
  162. // 获取选中元素的id列表
  163. let selection = this.$refs['data-table'].selection;
  164. let ids = sa.getArrayField(selection, 'id');
  165. if(selection.length == 0) {
  166. return sa.msg('请至少选择一条数据')
  167. }
  168. // 提交删除
  169. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  170. sa.ajax('/level-one-server/TbPeople/deleteByIds', {ids: ids.join(',')}, function(res) {
  171. sa.arrayDelete(this.dataList, selection);
  172. sa.ok('删除成功');
  173. sa.f5TableHeight(); // 刷新表格高度
  174. }.bind(this))
  175. }.bind(this));
  176. },
  177. // 改 - 删除状态(0=禁用,1=启用)
  178. updateDeleteStatus: function(data) {
  179. // 声明变量记录是否成功
  180. var isOk = false;
  181. var oldValue = data.deleteStatus;
  182. var ajax = sa.ajax('/level-one-server/TbPeople/updateDeleteStatus', {id: data.id, value: data.deleteStatus}, function(res) {
  183. isOk = true;
  184. sa.msg('修改成功');
  185. }.bind(this));
  186. // 如果未能修改成功, 则回滚
  187. $.when(ajax).done(function() {
  188. if(isOk == false) {
  189. data.status = oldValue;
  190. }
  191. })
  192. },
  193. },
  194. created: function() {
  195. this.f5();
  196. sa.onInputEnter();
  197. }
  198. })
  199. </script>
  200. </body>
  201. </html>