tb-person-visit-record-add.html 5.8 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>
  36. <el-card>
  37. <div slot="header" class="clearfix">
  38. <span>人员信息</span>
  39. </div>
  40. <el-row>
  41. <el-col :span="8">
  42. <div class="c-item">
  43. <label class="c-label"><span style="color: red;">*</span>所属组织:</label>
  44. <el-select v-model="m.deptId">
  45. <el-option label="请选择" v-for="(item,index) in deptList" :key="item.id"
  46. :label="item.name" :value="item.id"></el-option>
  47. </el-select>
  48. </div>
  49. <sa-item type="text" name="姓名" v-model="m.name" br need></sa-item>
  50. <div class="c-item">
  51. <label class="c-label"><span style="color: red;">*</span>健康码:</label>
  52. <el-select v-model="m.healthStatus">
  53. <el-option label="请选择" v-for="(item,index) in healthList" :key="index"
  54. :label="item" :value="item"></el-option>
  55. </el-select>
  56. </div>
  57. </el-col>
  58. <el-col :span="8">
  59. <div class="c-item">
  60. <label class="c-label"><span style="color: red;">*</span>入场通道:</label>
  61. <el-select v-model="m.inChannel" placeholder="请选择">
  62. <el-option-group v-for="(area,index) in areaList" :key="index"
  63. :label="area.name">
  64. <el-option v-for="item in area.children" :key="item.id"
  65. :label="item.name" :value="item.id">
  66. </el-option>
  67. </el-option-group>
  68. </el-select>
  69. </div>
  70. <sa-item type="datetime" name="入场时间" v-model="m.inTime" br need></sa-item>
  71. <sa-item type="num" name="入场体温" v-model="m.inTemperature" br need></sa-item>
  72. </el-col>
  73. <el-col :span="8">
  74. <sa-item type="text" name="联系号码" v-model="m.phone"></sa-item>
  75. <sa-item type="text" name="身份证" v-model="m.idCard" br></sa-item>
  76. </el-col>
  77. </el-row>
  78. </el-card>
  79. <sa-item name="" class="s-ok" br>
  80. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  81. </sa-item>
  82. </el-form>
  83. </div>
  84. </div>
  85. <!-- ------- 底部按钮 ------- -->
  86. <div class="s-foot">
  87. <el-button type="primary" @click="ok()">确定</el-button>
  88. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  89. </div>
  90. </div>
  91. <script>
  92. var app = new Vue({
  93. components: {
  94. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  95. },
  96. el: '.vue-box',
  97. data: {
  98. currentUser: sa.$sys.getCurrUser(),
  99. healthList: [
  100. '绿码', '黄码', '红码', '未知'
  101. ],
  102. areaList: [],
  103. deptList: [],
  104. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  105. m: {
  106. id: '', // 主键
  107. deptId: '', // 单位ID
  108. healthStatus: '绿码', // 健康码
  109. name: '', // 姓名
  110. idCard: '', // 身份证
  111. phone: '',
  112. inChannel: '', // 场所
  113. outChannel: '',
  114. inTemperature: '36.5', // 体温
  115. outTemperature: '36.5',
  116. inTime: '', // 时间
  117. outTime: ''
  118. }, // 实体对象
  119. },
  120. methods: {
  121. getDeptList() {
  122. sa.ajax('/TbDept/getList', {
  123. pageNo: 1,
  124. pageSize: 100
  125. }, function(resp) {
  126. let list = resp.data;
  127. this.deptList = list;
  128. }.bind(this))
  129. },
  130. getVenuesList() {
  131. sa.ajax('/TbVenues/getTree', function(res) {
  132. this.areaList = res.data; // 数据
  133. }.bind(this));
  134. },
  135. // 创建一个 默认Model
  136. createModel: function() {
  137. return {
  138. id: '', // 主键
  139. deptId: '', // 单位ID
  140. healthStatus: '绿码', // 健康码
  141. name: '', // 姓名
  142. idCard: '', // 身份证
  143. phone: '',
  144. inChannel: '', // 场所
  145. outChannel: '',
  146. inTemperature: '36.5', // 体温
  147. outTemperature: '36.5',
  148. inTime: '', // 时间
  149. outTime: ''
  150. }
  151. },
  152. // 提交数据
  153. ok: function() {
  154. // 表单校验
  155. let m = this.m;
  156. sa.checkNull(m.deptId, '请选择 [所属组织]');
  157. sa.checkNull(m.name, '请输入 [姓名]');
  158. sa.checkNull(m.inChannel, '请选择 [入场通道]');
  159. sa.checkNull(m.inTime, '请选择[入场时间]');
  160. sa.ajax('/TbPersonVisitRecord/add', m, function(res) {
  161. sa.alert('增加成功', this.clean);
  162. }.bind(this));
  163. },
  164. // 添加/修改 完成后的动作
  165. clean: function() {
  166. this.m = this.createModel();
  167. }
  168. },
  169. mounted: function() {
  170. this.getVenuesList();
  171. this.getDeptList();
  172. }
  173. })
  174. </script>
  175. </body>
  176. </html>