tb-disinfect-add.html 9.3 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="../../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. <style type="text/css">
  18. .c-panel .el-form .c-label {
  19. width: 12em !important;
  20. }
  21. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner {
  22. width: 250px;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  28. <!-- ------- 内容部分 ------- -->
  29. <div class="s-body">
  30. <div class="c-panel">
  31. <div class="c-title" v-if="id == 0">数据添加</div>
  32. <div class="c-title" v-else>数据修改</div>
  33. <el-form v-if="m">
  34. <sa-item type="text" name="发货人" v-model="m.sendPeople" br></sa-item>
  35. <sa-item type="text" name="收货人" v-model="m.receivePeople" br></sa-item>
  36. <sa-item type="text" name="品名" v-model="m.goodsName" br></sa-item>
  37. <sa-item type="text" name="产地" v-model="m.origin" br></sa-item>
  38. <sa-item type="num" name="数量" v-model="m.num" br></sa-item>
  39. <sa-item type="num" name="重量(kg)" v-model="m.grossWeight" br></sa-item>
  40. <sa-item type="text" name="规格" v-model="m.unit" br></sa-item>
  41. <sa-item type="text" name="包装" v-model="m.pack" br></sa-item>
  42. <sa-item type="text" name="标记" v-model="m.flag" br></sa-item>
  43. <sa-item type="text" name="号码" v-model="m.phone" br></sa-item>
  44. <sa-item type="text" name="启运地" v-model="m.sourceAddress" br></sa-item>
  45. <sa-item type="text" name="到达口岸" v-model="m.arrivePart" br></sa-item>
  46. <sa-item type="text" name="运输工具" v-model="m.carName" br></sa-item>
  47. <sa-item type="text" name="运输工具号码" v-model="m.carNo" br></sa-item>
  48. <sa-item type="text" name="国内运输工具" v-model="m.chinaCarName" br></sa-item>
  49. <sa-item type="text" name="工具号码" v-model="m.chinaCarNo" br></sa-item>
  50. <sa-item type="text" name="备注" v-model="m.remark" br></sa-item>
  51. <sa-item type="text" name="申请单位" v-model="m.applyUnit" br></sa-item>
  52. <sa-item type="text" name="申请人" v-model="m.declarePeople" br></sa-item>
  53. <sa-item type="text" name="申请人联系号码" v-model="m.declarePhone" br></sa-item>
  54. <div class="c-item br">
  55. <label class="c-label">申请时间:</label>
  56. <el-date-picker type="date" value-format="yyyy-MM-dd" v-model="m.applyTime"
  57. placeholder="请选择"></el-date-picker>
  58. </div>
  59. <sa-item type="text" name="受理人" v-model="m.acceptPeople" br></sa-item>
  60. <div class="c-item br">
  61. <label class="c-label">受理时间:</label>
  62. <el-date-picker type="date" value-format="yyyy-MM-dd" v-model="m.acceptTime"
  63. placeholder="请选择"></el-date-picker>
  64. </div>
  65. <sa-item type="num" name="计费(分)" v-model="m.money" br></sa-item>
  66. <sa-item name="" class="s-ok" br>
  67. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  68. </sa-item>
  69. </el-form>
  70. </div>
  71. </div>
  72. <!-- ------- 底部按钮 ------- -->
  73. <div class="s-foot">
  74. <el-button type="primary" @click="ok()">确定</el-button>
  75. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  76. </div>
  77. </div>
  78. <script>
  79. var app = new Vue({
  80. components: {
  81. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  82. },
  83. el: '.vue-box',
  84. data: {
  85. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  86. m: null, // 实体对象
  87. },
  88. methods: {
  89. // 创建一个 默认Model
  90. createModel: function () {
  91. return {
  92. id: '', // 主键
  93. sendPeople: '', // 发货人
  94. receivePeople: '', // 收货人
  95. goodsName: '', // 品名
  96. origin: '', // 产地
  97. num: '', // 数量
  98. grossWeight: '', // 重量
  99. unit: '', // 规格
  100. pack: '', // 包装
  101. flag: '', // 标记
  102. phone: '', // 号码
  103. sourceAddress: '', // 启运地
  104. arrivePart: '', // 到达口岸
  105. carName: '', // 运输工具
  106. carNo: '', // 运输工具号码
  107. chinaCarName: '', // 中国运输工具
  108. chinaCarNo: '', // 中国运输号码
  109. remark: '', // 备注
  110. applyUnit: '', // 申请单位
  111. declarePeople: '', // 申请人
  112. declarePhone: '', // 申请人联系号码
  113. applyTime: '', // 申请时间
  114. acceptPeople: '', // 受理人
  115. acceptTime: '', // 受理时间
  116. money: '', // 计费(分)
  117. }
  118. },
  119. // 提交数据
  120. ok: function () {
  121. // 表单校验
  122. let m = this.m;
  123. // sa.checkNull(m.id, '请输入 [主键]');
  124. sa.checkNull(m.sendPeople, '请输入 [发货人]');
  125. sa.checkNull(m.receivePeople, '请输入 [收货人]');
  126. sa.checkNull(m.goodsName, '请输入 [品名]');
  127. sa.checkNull(m.origin, '请输入 [产地]');
  128. sa.checkNull(m.num, '请输入 [数量]');
  129. sa.checkNull(m.grossWeight, '请输入 [重量]');
  130. sa.checkNull(m.unit, '请输入 [规格]');
  131. sa.checkNull(m.pack, '请输入 [包装]');
  132. sa.checkNull(m.flag, '请输入 [标记]');
  133. sa.checkNull(m.phone, '请输入 [号码]');
  134. sa.checkNull(m.sourceAddress, '请输入 [启运地]');
  135. sa.checkNull(m.arrivePart, '请输入 [到达口岸]');
  136. sa.checkNull(m.carName, '请输入 [运输工具]');
  137. sa.checkNull(m.carNo, '请输入 [运输工具号码]');
  138. sa.checkNull(m.chinaCarName, '请输入 [国内运输工具]');
  139. sa.checkNull(m.chinaCarNo, '请输入 [国内运输工具号码]');
  140. // sa.checkNull(m.remark, '请输入 [备注]');
  141. sa.checkNull(m.applyUnit, '请输入 [申请单位]');
  142. sa.checkNull(m.declarePeople, '请输入 [申请人]');
  143. sa.checkNull(m.declarePhone, '请输入 [申请人联系号码]');
  144. if (!sa.isPhone(m.declarePhone)) {
  145. sa.error('申请人联系号码不正确')
  146. return;
  147. }
  148. sa.checkNull(m.applyTime, '请输入 [申请时间]');
  149. // sa.checkNull(m.acceptPeople, '请输入 [受理人]');
  150. // sa.checkNull(m.acceptTime, '请输入 [受理时间]');
  151. // sa.checkNull(m.money, '请输入 [计费(分)]');
  152. // 开始增加或修改
  153. if (this.id <= 0) { // 添加
  154. sa.ajax('/TbDisinfect/add', m, function (res) {
  155. sa.alert('增加成功', this.clean);
  156. }.bind(this));
  157. } else { // 修改
  158. sa.ajax('/TbDisinfect/update', m, function (res) {
  159. sa.alert('修改成功', this.clean);
  160. }.bind(this));
  161. }
  162. },
  163. // 添加/修改 完成后的动作
  164. clean: function () {
  165. if (this.id == 0) {
  166. this.m = this.createModel();
  167. } else {
  168. parent.app.f5(); // 刷新父页面列表
  169. sa.closeCurrIframe(); // 关闭本页
  170. }
  171. }
  172. },
  173. mounted: function () {
  174. // 初始化数据
  175. if (this.id <= 0) {
  176. this.m = this.createModel();
  177. } else {
  178. sa.ajax('/TbDisinfect/getById?id=' + this.id, function (res) {
  179. this.m = res.data;
  180. if (res.data == null) {
  181. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  182. }
  183. }.bind(this))
  184. }
  185. }
  186. })
  187. </script>
  188. </body>
  189. </html>