tb-people-list.html 12 KB

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