tb-people-list.html 11 KB

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