tb-orders-add.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css js 资源 -->
  8. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.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{width: 7em !important;}
  19. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
  20. </style>
  21. </head>
  22. <body>
  23. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  24. <!-- ------- 内容部分 ------- -->
  25. <div class="s-body">
  26. <div class="c-panel">
  27. <div class="c-title" v-if="id == 0">数据添加</div>
  28. <div class="c-title" v-else>数据修改</div>
  29. <el-form v-if="m">
  30. <sa-item type="text" name="订单编号" v-model="m.orderNo" br></sa-item>
  31. <sa-item type="text" name="商品名称" v-model="m.goodsName" br></sa-item>
  32. <sa-item type="text" name="商品来源" v-model="m.goodsFrom" br></sa-item>
  33. <sa-item type="text" name="发货商电话" v-model="m.shipperPhone" br></sa-item>
  34. <sa-item type="text" name="发货商名称" v-model="m.shipperName" br></sa-item>
  35. <sa-item type="text" name="司机ID" v-model="m.driverId" br></sa-item>
  36. <sa-item type="text" name="司机名称" v-model="m.driverName" br></sa-item>
  37. <sa-item type="text" name="司机电话" v-model="m.driverPhone" br></sa-item>
  38. <sa-item type="text" name="车型ID" v-model="m.carId" br></sa-item>
  39. <sa-item type="text" name="车型名称" v-model="m.carType" br></sa-item>
  40. <sa-item type="text" name="收货人名称" v-model="m.consigneeName" br></sa-item>
  41. <sa-item type="text" name="收货人电话号码" v-model="m.consigneePhone" br></sa-item>
  42. <sa-item type="text" name="申报订单号" v-model="m.declarationNumber" br></sa-item>
  43. <sa-item type="enum" name="订单状态已完成" v-model="m.orderFinish" :jv="{0: '禁用', 1: '启用'}" jtype="3" br></sa-item>
  44. <!-- <sa-item type="enum" name="删除状态" v-model="m.deleteStatus" :jv="{0: '禁用', 1: '启用'}" jtype="3" br></sa-item> -->
  45. <sa-item name="" class="s-ok" br>
  46. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  47. </sa-item>
  48. </el-form>
  49. </div>
  50. </div>
  51. <!-- ------- 底部按钮 ------- -->
  52. <div class="s-foot">
  53. <el-button type="primary" @click="ok()">确定</el-button>
  54. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  55. </div>
  56. </div>
  57. <script>
  58. var app = new Vue({
  59. components: {
  60. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  61. },
  62. el: '.vue-box',
  63. data: {
  64. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  65. m: null, // 实体对象
  66. },
  67. methods: {
  68. // 创建一个 默认Model
  69. createModel: function() {
  70. return {
  71. orderNo: '', // 订单编号
  72. goodsId: '', // 商品id
  73. goodsName: '', // 商品名称
  74. goodsFrom: '', // 商品来源(国家)
  75. shipperPhone: '', // 发货商电话
  76. shipperName: '', // 发货商名称
  77. driverId: '', // 司机ID
  78. driverName: '', // 司机名称
  79. driverPhone: '', // 司机电话
  80. carId: '', // 车型ID
  81. carType: '', // 车型名称
  82. consigneeName: '', // 收货人名称
  83. consigneePhone: '', // 收货人电话号码
  84. declarationNumber: '', // (预留字段) 申报订单号
  85. orderFinish: '', // 订单状态已完成 (0=禁用,1=启用)
  86. // deleteStatus: '', // 删除状态(0=禁用,1=启用)
  87. }
  88. },
  89. // 提交数据
  90. ok: function(){
  91. // 表单校验
  92. let m = this.m;
  93. sa.checkNull(m.id, '请输入 [货运订单管理表主键]');
  94. sa.checkNull(m.orderNo, '请输入 [订单编号]');
  95. sa.checkNull(m.goodsId, '请输入 [商品id]');
  96. sa.checkNull(m.goodsName, '请输入 [商品名称]');
  97. sa.checkNull(m.goodsFrom, '请输入 [商品来源]');
  98. sa.checkNull(m.shipperPhone, '请输入 [发货商电话]');
  99. sa.checkNull(m.shipperName, '请输入 [发货商名称]');
  100. sa.checkNull(m.driverId, '请输入 [司机ID]');
  101. sa.checkNull(m.driverName, '请输入 [司机名称]');
  102. sa.checkNull(m.driverPhone, '请输入 [司机电话]');
  103. sa.checkNull(m.carId, '请输入 [车型ID]');
  104. sa.checkNull(m.carType, '请输入 [车型名称]');
  105. sa.checkNull(m.consigneeName, '请输入 [收货人名称]');
  106. sa.checkNull(m.consigneePhone, '请输入 [收货人电话号码]');
  107. sa.checkNull(m.declarationNumber, '请输入 [申报订单号]');
  108. sa.checkNull(m.orderFinish, '请输入 [订单状态已完成]');
  109. sa.checkNull(m.createTime, '请输入 [创建时间]');
  110. sa.checkNull(m.createBy, '请输入 [创建人编号]');
  111. sa.checkNull(m.createName, '请输入 [创建人名称]');
  112. sa.checkNull(m.updateTime, '请输入 [更新时间]');
  113. sa.checkNull(m.updateBy, '请输入 [更新人编号]');
  114. sa.checkNull(m.updateName, '请输入 [更新人名称]');
  115. sa.checkNull(m.deleteStatus, '请输入 [删除状态]');
  116. // 开始增加或修改
  117. if(this.id <= 0) { // 添加
  118. sa.ajax('/level-one-server/TbOrders/add', m, function(res){
  119. sa.alert('增加成功', this.clean);
  120. }.bind(this));
  121. } else { // 修改
  122. sa.ajax('/level-one-server/TbOrders/update', m, function(res){
  123. sa.alert('修改成功', this.clean);
  124. }.bind(this));
  125. }
  126. },
  127. // 添加/修改 完成后的动作
  128. clean: function() {
  129. if(this.id == 0) {
  130. this.m = this.createModel();
  131. } else {
  132. parent.app.f5(); // 刷新父页面列表
  133. sa.closeCurrIframe(); // 关闭本页
  134. }
  135. }
  136. },
  137. mounted: function(){
  138. // 初始化数据
  139. if(this.id <= 0) {
  140. this.m = this.createModel();
  141. } else {
  142. sa.ajax('/level-one-server/TbOrders/getById?id=' + this.id, function(res) {
  143. this.m = res.data;
  144. if(res.data == null) {
  145. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  146. }
  147. }.bind(this))
  148. }
  149. }
  150. })
  151. </script>
  152. </body>
  153. </html>