tb-person-filing-add.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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="../../static/kj/element-ui/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: 7.5em !important;
  21. }
  22. .c-panel .el-form .el-input,
  23. .c-panel .el-form .el-textarea__inner {
  24. width: 250px;
  25. }
  26. .rota {
  27. position: relative;
  28. right: 6px;
  29. font-size: 10px;
  30. cursor: pointer;
  31. padding: 3px;
  32. border-radius: 5px;
  33. bottom: 5em;
  34. color: cornflowerblue
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  40. <!-- ------- 内容部分 ------- -->
  41. <div class="s-body">
  42. <div class="c-panel">
  43. <div class="c-title" v-if="id == 0">数据添加</div>
  44. <div class="c-title" v-else>数据修改</div>
  45. <el-form v-if="m">
  46. <el-row>
  47. <el-col :span="12">
  48. <div class="c-item">
  49. <label class="c-label"><span style="color: red;">*</span>备案组织:</label>
  50. <el-select v-model="m.deptId" @change="deptChange">
  51. <el-option label="请选择" v-for="(item,index) in deptList" :key="item.id"
  52. :label="item.name" :value="item.id"></el-option>
  53. </el-select>
  54. </div>
  55. <sa-item type="text" name="姓名" v-model="m.name" br need></sa-item>
  56. <sa-item type="text" name="身份证" v-model="m.idCard" br need></sa-item>
  57. <sa-item type="num" name="联系电话" v-model="m.phone" br></sa-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <sa-item type="text" name="商铺号" v-if="m.deptName.indexOf('商铺')!==-1" v-model="m.shopCode" br need></sa-item>
  61. <sa-item type="text" name="边民证" v-if="m.icCard" v-model="m.icCard" br></sa-item>
  62. <sa-item type="text" name="来访事由" v-model="m.visitReason" br></sa-item>
  63. <sa-item type="textarea" name="备注" v-model="m.remark" br></sa-item>
  64. <sa-item type="img" name="人脸" v-model="m.photo" br need>
  65. <span slot="tip" class="rota">
  66. <span @click="rotaFn(-90)">
  67. <i class="el-icon-refresh-left"></i>
  68. </span>
  69. <span style="margin-left: 10px;" @click="rotaFn(90)">
  70. <i class="el-icon-refresh-right"></i>
  71. </span>
  72. </span>
  73. </sa-item>
  74. </el-col>
  75. </el-row>
  76. </el-form>
  77. </div>
  78. </div>
  79. <!-- ------- 底部按钮 ------- -->
  80. <div class="s-foot">
  81. <el-button type="primary" @click="ok()">确定</el-button>
  82. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  83. </div>
  84. </div>
  85. <script>
  86. var app = new Vue({
  87. components: {
  88. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  89. },
  90. el: '.vue-box',
  91. data: {
  92. venuesList: [],
  93. currentUser: sa.$sys.getCurrUser(),
  94. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  95. m: {
  96. id: '', //
  97. deptId: '', // 单位ID
  98. deptName:'',
  99. name: '', // 姓名
  100. phone: '', // 联系电话
  101. type: 1, // 类型(1=临时,2=内部)
  102. idCard: '', // 身份证
  103. remark: '', // 备注
  104. }, // 实体对象
  105. deptList: []
  106. },
  107. methods: {
  108. rotaFn(rota) {
  109. let m = this.m;
  110. sa.ajax('/TbPersonFiling/rota', {
  111. rota: rota,
  112. id:m.id
  113. }, function(resp) {
  114. this.init();
  115. }.bind(this))
  116. },
  117. deptChange(id) {
  118. let deptList = this.deptList;
  119. let dept = deptList.filter(obj => obj.id == id)[0];
  120. this.m.deptName=dept.name;
  121. console.log(this.m.deptName.indexOf('商铺'))
  122. },
  123. getDeptList() {
  124. sa.ajax('/TbDept/getList', {
  125. pageNo: 1,
  126. pageSize: 100
  127. }, function(resp) {
  128. let list = resp.data;
  129. this.deptList = list;
  130. }.bind(this))
  131. },
  132. // 提交数据
  133. ok: function() {
  134. // 表单校验
  135. let m = this.m;
  136. sa.checkNull(m.deptId, '请选择备案组织');
  137. sa.checkNull(m.name, '请输入 [姓名]');
  138. sa.checkNull(m.idCard, '请输入 [身份证]');
  139. let idCard = m.idCard;
  140. if (idCard.length < 15) {
  141. sa.error('请输入正确的身份证');
  142. return false;
  143. }
  144. if (m.deptName.indexOf('商铺')!==-1&&!m.shopCode) {
  145. sa.error('请输入商铺号');
  146. return false;
  147. }
  148. sa.checkNull(m.photo, '请上传 [人脸]');
  149. m = sa.removeNull(m);
  150. // 开始增加或修改
  151. if (this.id <= 0) { // 添加
  152. sa.ajax('/TbPersonFiling/add', m, function(res) {
  153. sa.alert('增加成功', this.clean);
  154. }.bind(this));
  155. } else { // 修改
  156. sa.ajax('/TbPersonFiling/update', m, function(res) {
  157. sa.alert('修改成功', this.clean);
  158. }.bind(this));
  159. }
  160. },
  161. // 添加/修改 完成后的动作
  162. clean: function() {
  163. parent.app.f5(); // 刷新父页面列表
  164. sa.closeCurrIframe(); // 关闭本页
  165. },
  166. init() {
  167. // 初始化数据
  168. if (this.id > 0) {
  169. sa.ajax('/TbPersonFiling/getById?id=' + this.id, function(res) {
  170. this.m = res.data;
  171. if (res.data == null) {
  172. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  173. }
  174. }.bind(this))
  175. }
  176. }
  177. },
  178. mounted: function() {
  179. this.init();
  180. this.getDeptList();
  181. }
  182. })
  183. </script>
  184. </body>
  185. </html>