tb-group-leader.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>边民-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; 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="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
  12. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  13. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <script src="../../static/kj/upload-util.js"></script>
  17. <style type="text/css">
  18. .c-panel .el-form .c-label {
  19. width: 7em !important;
  20. }
  21. .c-panel .el-form .el-input,
  22. .c-panel .el-form .el-textarea__inner {
  23. width: 250px;
  24. }
  25. table {
  26. font-family: arial, sans-serif;
  27. border-collapse: collapse;
  28. width: 90%;
  29. margin-top: 26px ;
  30. margin-left: auto;
  31. margin-right: auto;
  32. }
  33. th {
  34. border: 1px solid darkgray;
  35. text-align: left;
  36. height: 30px;
  37. padding: 8px;
  38. background-color: #dddddd;
  39. }
  40. td {
  41. border: 1px solid darkgray;
  42. text-align: left;
  43. padding: 8px;
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  49. <!-- ------- 内容部分 ------- -->
  50. <div class="s-body">
  51. <div class="c-panel">
  52. <el-form size="mini" v-if="m">
  53. <table>
  54. <tr>
  55. <th>姓名</th>
  56. <td>{{m.name}}</td>
  57. <th>手机号码</th>
  58. <td>{{maskPhone(m.phone)}}</td>
  59. </tr>
  60. <tr>
  61. <th>银行</th>
  62. <td>{{m.bankCode}}</td>
  63. <th>身份证号</th>
  64. <td>{{maskId(m.idCard)}}</td>
  65. </tr>
  66. <tr>
  67. <th>银行卡号</th>
  68. <td>{{m.bankNo}}</td>
  69. <th>身份证</th>
  70. <td><div class="image-box-2" v-for="item in m.idCardImg_arr">
  71. <img :src="item" @click="sa.showImage(item, '500px', '400px')" />
  72. </div>
  73. </td>
  74. </tr>
  75. <tr>
  76. <th>联系地址</th>
  77. <td>{{m.address}}</td>
  78. <th>创建时间</th>
  79. <td>{{sa.forDate(m.createTime, 2)}}</td>
  80. </tr>
  81. </table>
  82. <div class="c-item br s-ok">
  83. <label class="c-label"></label>
  84. <el-button size="mini" type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  85. </div>
  86. </el-form>
  87. </div>
  88. </div>
  89. <!-- ------- 底部按钮 ------- -->
  90. <div class="s-foot">
  91. <el-button size="mini" type="primary" @click="ok()">确定</el-button>
  92. <el-button size="mini" @click="sa.closeCurrIframe()">取消</el-button>
  93. </div>
  94. </div>
  95. <script>
  96. var app = new Vue({
  97. el: '.vue-box',
  98. data: {
  99. id: sa.p('leaderId', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  100. m: {
  101. id: '', // 主键
  102. name: '', // 姓名
  103. code: '', // 边民号
  104. sex: '', // 性别(1=男,2=女)
  105. age: '', // 年龄
  106. idCard: '', // 身份证
  107. idCardImg: '', // 身份证复印件
  108. idCardImg_arr: [], // 身份证复印件 - 转数组
  109. phone: '', // 手机号码
  110. bankNo: '', // 银行编号
  111. bankCode: '', // 银行卡号
  112. groupId: sa.p('groupId', ''), // 所属互助组(1=测试组)
  113. groupName: '', // 互助组名称
  114. status: '', // 是否可用(0=否,1=是)
  115. role: '', // 角色(1=普通边民,2=兼组长)
  116. address: '', // 联系地址
  117. lock: '', // 是否锁定
  118. }, // 实体对象
  119. bankList: []
  120. },
  121. methods: {
  122. maskId:function (id) {
  123. return id.replace(/^(.{6})(.*)(.{4})$/,'$1********$3');
  124. },
  125. maskPhone:function (phone) {
  126. return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  127. },
  128. getBankList() {
  129. sa.ajax('/sp-admin/TbBank/getAll', function(resp) {
  130. this.bankList = resp.data;
  131. }.bind(this));
  132. },
  133. // 表单验证
  134. submitCheck: function() {
  135. try {
  136. var m = this.m; // 获取 m对象
  137. sa.checkNull(m.name, '请输入 [姓名]');
  138. sa.checkNull(m.idCard, '请输入 [身份证]');
  139. sa.checkNull(m.idCardImg, '请上传 [身份证复印件]');
  140. sa.checkNull(m.phone, '请输入 [手机号码]');
  141. sa.checkNull(m.bankCode, '请选择 [银行卡号]');
  142. return 'ok'; // 全部通过验证,返回ok 表示正确
  143. } catch (e) {
  144. sa.error(e);
  145. }
  146. },
  147. // 提交数据
  148. ok: function() {
  149. // 验证
  150. console.log("---1---=")
  151. this.m.idCardImg = this.m.idCardImg_arr.join(','); // 图片数组转字符串
  152. console.log("---2---=",this.m.idCardImg)
  153. // if (this.submitCheck() != 'ok') {
  154. // return;
  155. // }
  156. console.log("---3---=")
  157. // 开始增加或修改
  158. if (this.id <= 0) { // 添加
  159. console.log("---4---=")
  160. sa.ajax('/level-one-server/TbPeople/add', sa.removeNull(this.m), function(res) {
  161. sa.alert('增加成功', this.clean);
  162. }.bind(this));
  163. } else { // 修改
  164. console.log("---4---=")
  165. sa.ajax('/level-one-server/TbPeople/update', sa.removeNull(this.m), function(res) {
  166. sa.alert('修改成功', this.clean);
  167. }.bind(this));
  168. }
  169. },
  170. // 添加/修改 完成后的动作
  171. clean: function() {
  172. parent.app.f5(); // 刷新父页面列表
  173. sa.closeCurrIframe(); // 关闭本页
  174. },
  175. initFn() {
  176. // 初始化数据
  177. if (this.id > 0) {
  178. sa.ajax('/level-one-server/TbPeople/getById?id=' + this.id, function(res) {
  179. res.data.idCardImg_arr = sa.isNull(res.data.idCardImg) ? [] : res.data.idCardImg.split(','); // 身份证复印件 字符串转数组
  180. this.m = res.data;
  181. if (res.data == null) {
  182. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  183. }
  184. }.bind(this))
  185. };
  186. }
  187. },
  188. mounted: function() {
  189. this.initFn()
  190. this.getBankList()
  191. }
  192. })
  193. </script>
  194. </body>
  195. </html>