tb-people-list.html 11 KB

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