tb-person-visit-record-edit.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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: 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" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  30. <!-- ------- 内容部分 ------- -->
  31. <div class="s-body">
  32. <div class="c-panel">
  33. <div class="c-title" v-if="id == 0">数据添加</div>
  34. <div class="c-title" v-else>数据修改</div>
  35. <el-form v-if="m">
  36. <el-row>
  37. <el-col :span="12">
  38. <div class="c-item">
  39. <label class="c-label"><span style="color: red;">*</span>单位:</label>
  40. <el-select v-model="m.deptId" disabled>
  41. <el-option label="请选择" v-for="(item,index) in deptList" :key="item.id"
  42. :label="item.name" :value="item.id"></el-option>
  43. </el-select>
  44. </div>
  45. <sa-item type="text" name="姓名" v-model="m.name" br need></sa-item>
  46. <sa-item type="text" name="身份证" v-model="m.idCard" br need></sa-item>
  47. <sa-item type="text" name="联系号码" v-model="m.phone" br need></sa-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <sa-item type="text" name="体温" v-model="m.temperature" br need></sa-item>
  51. <div class="c-item">
  52. <label class="c-label">离场通道:</label>
  53. <el-select v-model="m.channel" placeholder="请选择">
  54. <el-option-group v-for="(area,index) in areaList" :key="index"
  55. :label="area.name">
  56. <el-option v-for="item in area.children" :key="item.id" :label="item.name"
  57. :value="item.id">
  58. </el-option>
  59. </el-option-group>
  60. </el-select>
  61. </div>
  62. <div class="c-item">
  63. <label class="c-label"><span style="color: red;">*</span>健康码:</label>
  64. <el-select v-model="m.healthStatus" :disabled="currentUser.deptId!=='9999999'">
  65. <el-option label="请选择" v-for="(item,index) in healthList" :key="index"
  66. :label="item" :value="item"></el-option>
  67. </el-select>
  68. </div>
  69. <sa-item type="datetime" name="时间" v-model="m.visitDate" br need></sa-item>
  70. </el-col>
  71. </el-row>
  72. </el-form>
  73. </div>
  74. </div>
  75. <!-- ------- 底部按钮 ------- -->
  76. <div class="s-foot">
  77. <el-button type="primary" @click="ok()">确定</el-button>
  78. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  79. </div>
  80. </div>
  81. <script>
  82. var app = new Vue({
  83. components: {
  84. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  85. },
  86. el: '.vue-box',
  87. data: {
  88. currentUser: sa.$sys.getCurrUser(),
  89. areaList: [],
  90. healthList: [
  91. '绿码', '黄码', '红码', '未知'
  92. ],
  93. deptList: [],
  94. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  95. m: null, // 实体对象
  96. },
  97. methods: {
  98. // 创建一个 默认Model
  99. createModel: function() {
  100. return {
  101. id: '', // 主键
  102. direction: '', // 出入(1=入场,2=离场)
  103. deptId: '', // 单位ID
  104. phone: '', // 单位名称
  105. name: '', // 姓名
  106. picture: '', // 图片
  107. idCard: '', // 身份证
  108. channel: '', // 通过通道
  109. venues: '', // 场所
  110. temperature: '', // 体温
  111. healthStatus: '', // 健康码
  112. sn: '', // 上传设备
  113. visitDate: '', // 时间
  114. createTime: '', // 创建时间
  115. }
  116. },
  117. // 提交数据
  118. ok: function() {
  119. // 表单校验
  120. let m = this.m;
  121. sa.checkNull(m.name, '请输入 [姓名]');
  122. let phone = m.phone;
  123. if (!sa.isPhone(phone)) {
  124. sa.error('请输入正确的号码');
  125. return false;
  126. }
  127. sa.checkNull(m.idCard, '请输入 [身份证]');
  128. sa.checkNull(m.channel, '请输入 [通过通道]');
  129. sa.checkNull(m.venues, '请输入 [场所]');
  130. sa.checkNull(m.temperature, '请输入 [体温]');
  131. sa.checkNull(m.healthStatus, '请输入 [健康码]');
  132. sa.ajax('/TbPersonVisitRecord/update', m, function(res) {
  133. sa.alert('修改成功', this.clean);
  134. }.bind(this));
  135. },
  136. getVenuesList() {
  137. sa.ajax('/TbVenues/getTree', function(res) {
  138. this.areaList = res.data; // 数据
  139. }.bind(this));
  140. },
  141. getDeptList() {
  142. sa.ajax('/TbDept/getList', {
  143. pageNo: 1,
  144. pageSize: 100
  145. }, function(resp) {
  146. let list = resp.data;
  147. let deptId = this.currentUser.deptId;
  148. if (deptId != 9999999) {
  149. this.m.deptId = deptId;
  150. }
  151. this.deptList = list;
  152. }.bind(this))
  153. },
  154. // 添加/修改 完成后的动作
  155. clean: function() {
  156. parent.app.f5(); // 刷新父页面列表
  157. sa.closeCurrIframe(); // 关闭本页
  158. },
  159. getById() {
  160. sa.ajax('/TbPersonVisitRecord/getById?id=' + this.id, function(res) {
  161. this.m = res.data;
  162. if (res.data == null) {
  163. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  164. }
  165. }.bind(this))
  166. }
  167. },
  168. mounted: function() {
  169. this.getDeptList();
  170. this.getVenuesList();
  171. this.getById();
  172. }
  173. })
  174. </script>
  175. </body>
  176. </html>