tb-group-leader.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. </tr>
  58. <tr>
  59. <th>手机号码</th>
  60. <td>{{m.phone}}</td>
  61. </tr>
  62. <tr>
  63. <th>身份证号</th>
  64. <td>{{m.idCard}}</td>
  65. </tr>
  66. <tr>
  67. <th>银行</th>
  68. <td>{{m.bankNo}}</td>
  69. </tr>
  70. <tr>
  71. <th>银行卡号</th>
  72. <td>{{m.bankCode}}</td>
  73. </tr>
  74. <tr>
  75. <th>地址</th>
  76. <td>{{m.birplAddr}}</td>
  77. </tr>
  78. </table>
  79. <div class="c-item br s-ok">
  80. <label class="c-label"></label>
  81. <el-button size="mini" type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  82. </div>
  83. </el-form>
  84. </div>
  85. </div>
  86. <!-- ------- 底部按钮 ------- -->
  87. <div class="s-foot">
  88. <el-button size="mini" type="primary" @click="ok()">确定</el-button>
  89. <el-button size="mini" @click="sa.closeCurrIframe()">取消</el-button>
  90. </div>
  91. </div>
  92. <script>
  93. var app = new Vue({
  94. el: '.vue-box',
  95. data: {
  96. id: sa.p('leaderId', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  97. m: {
  98. id: '', // 主键
  99. name: '', // 姓名
  100. code: '', // 边民号
  101. sex: '', // 性别(1=男,2=女)
  102. age: '', // 年龄
  103. idCard: '', // 身份证
  104. idCardImg: '', // 身份证复印件
  105. idCardImg_arr: [], // 身份证复印件 - 转数组
  106. phone: '', // 手机号码
  107. bankNo: '', // 银行编号
  108. bankCode: '', // 银行卡号
  109. groupId: sa.p('groupId', ''), // 所属互助组(1=测试组)
  110. groupName: '', // 互助组名称
  111. status: '', // 是否可用(0=否,1=是)
  112. role: '', // 角色(1=普通边民,2=兼组长)
  113. address: '', // 联系地址
  114. lock: '', // 是否锁定
  115. }, // 实体对象
  116. bankList: []
  117. },
  118. methods: {
  119. maskId:function (id) {
  120. return id.replace(/^(.{6})(.*)(.{4})$/,'$1********$3');
  121. },
  122. maskPhone:function (phone) {
  123. return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  124. },
  125. getBankList() {
  126. sa.ajax('/sp-admin/TbBank/getAll', function(resp) {
  127. this.bankList = resp.data;
  128. }.bind(this));
  129. },
  130. // 表单验证
  131. submitCheck: function() {
  132. try {
  133. var m = this.m; // 获取 m对象
  134. sa.checkNull(m.name, '请输入 [姓名]');
  135. sa.checkNull(m.idCard, '请输入 [身份证]');
  136. sa.checkNull(m.idCardImg, '请上传 [身份证复印件]');
  137. sa.checkNull(m.phone, '请输入 [手机号码]');
  138. sa.checkNull(m.bankCode, '请选择 [银行卡号]');
  139. return 'ok'; // 全部通过验证,返回ok 表示正确
  140. } catch (e) {
  141. sa.error(e);
  142. }
  143. },
  144. // 提交数据
  145. ok: function() {
  146. // 验证
  147. console.log("---1---=")
  148. this.m.idCardImg = this.m.idCardImg_arr.join(','); // 图片数组转字符串
  149. console.log("---2---=",this.m.idCardImg)
  150. // if (this.submitCheck() != 'ok') {
  151. // return;
  152. // }
  153. console.log("---3---=")
  154. // 开始增加或修改
  155. if (this.id <= 0) { // 添加
  156. console.log("---4---=")
  157. sa.ajax('/level-one-server/TbPeople/add', sa.removeNull(this.m), function(res) {
  158. sa.alert('增加成功', this.clean);
  159. }.bind(this));
  160. } else { // 修改
  161. console.log("---4---=")
  162. sa.ajax('/level-one-server/TbPeople/update', sa.removeNull(this.m), function(res) {
  163. sa.alert('修改成功', this.clean);
  164. }.bind(this));
  165. }
  166. },
  167. // 添加/修改 完成后的动作
  168. clean: function() {
  169. parent.app.f5(); // 刷新父页面列表
  170. sa.closeCurrIframe(); // 关闭本页
  171. },
  172. initFn() {
  173. // 初始化数据
  174. if (this.id > 0) {
  175. sa.ajax('/level-one-server/TbPeople/getById?id=' + this.id, function(res) {
  176. res.data.idCardImg_arr = sa.isNull(res.data.idCardImg) ? [] : res.data.idCardImg.split(','); // 身份证复印件 字符串转数组
  177. this.m = res.data;
  178. if (res.data == null) {
  179. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  180. }
  181. }.bind(this))
  182. };
  183. }
  184. },
  185. mounted: function() {
  186. this.initFn()
  187. this.getBankList()
  188. }
  189. })
  190. </script>
  191. </body>
  192. </html>