tb-people-list.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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="https://unpkg.com/element-ui@2.13.0/lib/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. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .c-panel .el-form .c-label {
  20. width: 7em !important;
  21. }
  22. .c-panel .el-form .el-input,
  23. .c-panel .el-form .el-textarea__inner {
  24. width: 250px;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <div class="vue-box" style="display: none;" :style="'display: block;'">
  30. <div class="c-panel">
  31. <!-- ------------- 检索参数 ------------- -->
  32. <div class="c-title">检索参数</div>
  33. <el-form ref="form" :model='p' @submit.native.prevent>
  34. <sa-item type="text" name="姓名" v-model="p.name" :need="false"></sa-item>
  35. <sa-item type="num" name="手机号" v-model="p.phone" :need="false"></sa-item>
  36. <!-- <sa-item type="text" name="边民号" v-model="p.code" :need="false"></sa-item> -->
  37. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  38. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  39. <el-button v-if="sa.isAuth('tb-people-add')" size="mini" type="primary"
  40. @click="add()">新增</el-button>
  41. <!--<el-button v-if="sa.isAuth('tb-people-bind-shop')" size="mini" type="primary"
  42. @click="bindShopBatch()">批量绑定店铺</el-button>-->
  43. </el-form>
  44. <!-- ------------- 数据列表 ------------- -->
  45. <el-table class="data-table" ref="data-table" :data="dataList">
  46. <sa-td type="index" name="序号"></sa-td>
  47. <sa-td name="姓名" prop="name"></sa-td>
  48. <sa-td name="性别" prop="sex" type="enum" :jv="{'1': '男', '2': '女'}"></sa-td>
  49. <sa-td name="手机号码" prop="phone" type="phone"></sa-td>
  50. <sa-td name="身份证" prop="idCard" type="idCard"></sa-td>
  51. <sa-td name="互助组" prop="groupName"></sa-td>
  52. <sa-td name="银行" prop="bankName" width="160"></sa-td>
  53. <sa-td name="银行卡" prop="bankCode" width="200"></sa-td>
  54. <sa-td name="创建时间" prop="createTime"></sa-td>
  55. <el-table-column label="操作" width="280px" fixed="right">
  56. <template slot-scope="s">
  57. <el-button class="c-btn" type="success" icon="el-icon-view"
  58. @click="get(s.row)">查看</el-button>
  59. <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="primary" icon="el-icon-edit"
  60. @click="editFn(s.row)">手机号</el-button>
  61. <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="primary" icon="el-icon-edit"
  62. @click="updateBankInfo(s.row.id)">银行卡</el-button>
  63. <el-button v-if="sa.isAuth('tb-people-edit')" class="c-btn" type="warning" icon="el-icon-delete"
  64. @click="cleanFace(s.row)">人脸</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <!-- ------------- 分页 ------------- -->
  69. <div class="page-box">
  70. <el-pagination background layout="total, prev, pager, next, sizes, jumper"
  71. :current-page.sync="p.pageNo" :page-size.sync="p.pageSize" :total="dataCount"
  72. :page-sizes="[10, 20, 30, 40, 50, 100, 1000]" @current-change="f5()" @size-change="f5()">
  73. </el-pagination>
  74. </div>
  75. </div>
  76. <el-dialog :title="model.title" :visible.sync="model.visible" width="500px">
  77. <div class="c-item">
  78. <label class="c-label"><span style="color: red;">*</span>选择商铺:</label>
  79. <el-select v-model="model.form.shopId" placeholder="输入关键字搜索" filterable size="mini">
  80. <el-option label="请选择" :value="0" disabled></el-option>
  81. <el-option v-for="(item,index) in shopList" :key="index"
  82. :label="item.shopName+'('+item.shopNo+')'" :value="item.id"> </el-option>
  83. </el-select>
  84. </div>
  85. <span slot="footer" class="dialog-footer">
  86. <el-button @click="model.visible = false">取 消</el-button>
  87. <el-button type="primary" @click="sureSelect">确 定</el-button>
  88. </span>
  89. </el-dialog>
  90. <el-dialog :title="phone.title" :visible.sync="phone.visible" width="500px">
  91. <div>当前手机号:{{phone.form.phone}}</div>
  92. <sa-item type="num" name="新手机号" width="7em" v-model="phone.phone" br></sa-item>
  93. <span slot="footer" class="dialog-footer">
  94. <el-button @click="phone.visible = false">取 消</el-button>
  95. <el-button type="primary" @click="sureEdit">确 定</el-button>
  96. </span>
  97. </el-dialog>
  98. </div>
  99. <script>
  100. var app = new Vue({
  101. components: {
  102. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  103. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  104. },
  105. el: '.vue-box',
  106. data: {
  107. model: {
  108. title: '选择商铺',
  109. visible: false,
  110. form: {
  111. ids: '',
  112. shopId: '',
  113. shopName: ""
  114. }
  115. },
  116. phone: {
  117. title: '修改手机号',
  118. visible: false,
  119. phone:'',
  120. form: {
  121. ids: '',
  122. shopId: '',
  123. shopName: ""
  124. }
  125. },
  126. shopList: [],
  127. p: { // 查询参数
  128. name: '', // 姓名
  129. code: '', // 边民号
  130. sex: '', // 性别(1=男,2=女)
  131. age: '', // 年龄
  132. idCard: '', // 身份证
  133. phone: '', // 手机号码
  134. bankNo: '', // 银行编号
  135. bankCode: '', // 银行卡号
  136. bankName: '', // 银行名称
  137. groupId: '', // 所属互助组(1=测试组)
  138. groupName: '', // 互助组名称
  139. status: '', // 是否可用(0=否,1=是)
  140. role: '', // 角色(1=普通边民,2=兼组长)
  141. shopId: '', // 经度
  142. address: '', // 联系地址
  143. addressIds: '', // 地址ID
  144. detailAddress: '', // 详细地址
  145. isLock: '', // 是否锁定
  146. leftPrice: '', // 当天剩余额度
  147. pageNo: 1, // 当前页
  148. pageSize: 10, // 页大小
  149. sortType: 0 // 排序方式
  150. },
  151. dataCount: 0,
  152. dataList: [], // 数据集合
  153. },
  154. methods: {
  155. cleanFace(data){
  156. sa.confirm('是否清除该边民人脸?', function() {
  157. sa.ajax('/sp-admin/AppUser/cleanFace?id=' + data.id, function(res) {
  158. sa.ok('清除成功,需退出APP重新登录');
  159. sa.f5TableHeight(); // 刷新表格高度
  160. }.bind(this))
  161. }.bind(this));
  162. },
  163. editFn(data) {
  164. this.phone = {
  165. title: '修改【' + data.name + '】手机号',
  166. visible: true,
  167. phone:'',
  168. form: data
  169. }
  170. },
  171. sureEdit() {
  172. let phone=this.phone.phone;
  173. if(!sa.isPhone(phone)){
  174. sa.error('手机号不正确')
  175. return;
  176. }
  177. let data={
  178. id:this.phone.form.id,
  179. name:this.phone.name,
  180. phone: phone
  181. }
  182. sa.ajax('/level-one-server/TbPeople/editPhone', data, function(res) {
  183. sa.ok('修改成功');
  184. this.phone.visible = false;
  185. this.f5()
  186. }.bind(this));
  187. },
  188. bindShopBatch() {
  189. // 获取选中元素的id列表
  190. let selection = this.$refs['data-table'].selection;
  191. let ids = sa.getArrayField(selection, 'id');
  192. if (selection.length == 0) {
  193. return sa.msg('请至少选择一条数据')
  194. }
  195. this.model = {
  196. title: '批量绑定商铺',
  197. visible: true,
  198. form: {
  199. ids: ids.join(','),
  200. shopId: '',
  201. }
  202. }
  203. },
  204. selectShop(data) {
  205. this.model = {
  206. title: '绑定【' + data.name + '】商铺',
  207. visible: true,
  208. form: {
  209. ids: data.id,
  210. shopId: data.shopId,
  211. shopName: data.shopName
  212. }
  213. }
  214. },
  215. sureSelect() {
  216. let data = this.model.form;
  217. if (!data.shopId) {
  218. sa.error('请选择商铺')
  219. return;
  220. }
  221. sa.ajax('/level-one-server/TbPeople/bindShop', data, function(res) {
  222. sa.ok('绑定成功');
  223. this.model.visible = false;
  224. this.f5()
  225. }.bind(this));
  226. },
  227. removeBind(data) {
  228. sa.confirm('是否解绑商铺?', function() {
  229. sa.ajax('/level-one-server/TbPeople/removeBind?id=' + data.id, function(res) {
  230. sa.ok('解绑成功');
  231. this.f5()
  232. }.bind(this))
  233. }.bind(this));
  234. },
  235. getShopList() {
  236. sa.ajax('/level-one-server/TbShop/getList', {
  237. pageNo: 1,
  238. pageSize: 100,
  239. }, function(res) {
  240. this.shopList = res.data; // 数据
  241. }.bind(this));
  242. },
  243. // 刷新
  244. f5: function() {
  245. sa.ajax('/level-one-server/TbPeople/getList', sa.removeNull(this.p), function(res) {
  246. console.log("res", res)
  247. this.dataList = res.data; // 数据
  248. this.dataCount = res.dataCount; // 数据总数
  249. sa.f5TableHeight(); // 刷新表格高度
  250. }.bind(this));
  251. },
  252. // 查看
  253. get: function(data) {
  254. sa.showIframe('数据详情', 'tb-people-info.html?id=' + data.id, '1000px', '90%');
  255. },
  256. updateBankInfo(id) {
  257. sa.showIframe('修改银行卡信息', 'tb-people-bank.html?id=' + id, '650px', '40%');
  258. },
  259. // 修改
  260. update: function(data) {
  261. sa.showIframe('修改数据', 'tb-people-add.html?id=' + data.id, '1000px', '90%');
  262. },
  263. // 新增
  264. add: function(data) {
  265. sa.showIframe('新增数据', 'tb-people-add.html?id=-1', '1000px', '90%');
  266. },
  267. // 删除
  268. del: function(data) {
  269. sa.confirm('是否删除,此操作不可撤销', function() {
  270. sa.ajax('/level-one-server/TbPeople/delete?id=' + data.id, function(res) {
  271. sa.arrayDelete(this.dataList, data);
  272. sa.ok('删除成功');
  273. sa.f5TableHeight(); // 刷新表格高度
  274. }.bind(this))
  275. }.bind(this));
  276. },
  277. // 批量删除
  278. deleteByIds: function() {
  279. // 获取选中元素的id列表
  280. let selection = this.$refs['data-table'].selection;
  281. let ids = sa.getArrayField(selection, 'id');
  282. if (selection.length == 0) {
  283. return sa.msg('请至少选择一条数据')
  284. }
  285. // 提交删除
  286. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  287. sa.ajax('/level-one-server/TbPeople/deleteByIds', {
  288. ids: ids.join(',')
  289. }, function(res) {
  290. sa.arrayDelete(this.dataList, selection);
  291. sa.ok('删除成功');
  292. sa.f5TableHeight(); // 刷新表格高度
  293. }.bind(this))
  294. }.bind(this));
  295. },
  296. // 改 - 删除状态(0=禁用,1=启用)
  297. updateDeleteStatus: function(data) {
  298. // 声明变量记录是否成功
  299. var isOk = false;
  300. var oldValue = data.deleteStatus;
  301. var ajax = sa.ajax('/level-one-server/TbPeople/updateDeleteStatus', {
  302. id: data.id,
  303. value: data.deleteStatus
  304. }, function(res) {
  305. isOk = true;
  306. sa.msg('修改成功');
  307. }.bind(this));
  308. // 如果未能修改成功, 则回滚
  309. $.when(ajax).done(function() {
  310. if (isOk == false) {
  311. data.status = oldValue;
  312. }
  313. })
  314. },
  315. },
  316. created: function() {
  317. this.f5();
  318. this.getShopList()
  319. sa.onInputEnter();
  320. }
  321. })
  322. </script>
  323. </body>
  324. </html>