tb-people-list.html 11 KB

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