tb-goods-demand-add.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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="../../static/kj/element-ui/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. <style type="text/css">
  17. .c-panel .el-form .c-label{width: 7em !important;}
  18. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
  19. </style>
  20. </head>
  21. <body>
  22. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  23. <!-- ------- 内容部分 ------- -->
  24. <div class="s-body">
  25. <div class="c-panel">
  26. <div class="c-title" v-if="id == 0">数据添加</div>
  27. <div class="c-title" v-else>数据修改</div>
  28. <el-form v-if="m">
  29. <!-- <sa-item type="text" name="二级市场商家需求发布表主键ID" v-model="m.id" br></sa-item>
  30. <sa-item type="text" name="一级市场海关允许售卖商品ID" v-model="m.levelOneGoodsId" br></sa-item> -->
  31. <el-row :gutter="50">
  32. <el-col :span="12">
  33. <sa-item type="text" name="商品名称" v-model="m.goodsName" br></sa-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <sa-item type="text" name="商品图片" v-model="m.goodsImg" br></sa-item>
  37. </el-col>
  38. </el-row>
  39. <el-row :gutter="50">
  40. <el-col :span="12">
  41. <sa-item type="text" name="商家名称" v-model="m.purchaserName" br></sa-item>
  42. </el-col>
  43. <el-col :span="12">
  44. <sa-item type="text" name="已被接单" v-model="m.isOrders" br></sa-item>
  45. </el-col>
  46. </el-row>
  47. <el-row :gutter="50">
  48. <el-col :span="12">
  49. <sa-item type="text" name="商品量" v-model="m.goodsQuantity" br></sa-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <sa-item type="text" name="商家备注" v-model="m.remark" br></sa-item>
  53. </el-col>
  54. </el-row>
  55. <!-- <sa-item type="text" name="二级市场商家ID" v-model="m.purchaserId" br></sa-item> -->
  56. <!-- <sa-item type="text" name="创建时间" v-model="m.createTime" br></sa-item>
  57. <sa-item type="text" name="删除状态" v-model="m.deleteStatus" br></sa-item> -->
  58. <sa-item name="" class="s-ok" br>
  59. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  60. </sa-item>
  61. </el-form>
  62. </div>
  63. </div>
  64. <!-- ------- 底部按钮 ------- -->
  65. <div class="s-foot">
  66. <el-button type="primary" @click="ok()">确定</el-button>
  67. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  68. </div>
  69. </div>
  70. <script>
  71. var app = new Vue({
  72. components: {
  73. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  74. },
  75. el: '.vue-box',
  76. data: {
  77. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  78. m: null, // 实体对象
  79. },
  80. methods: {
  81. // 创建一个 默认Model
  82. createModel: function() {
  83. return {
  84. id: '', // 二级市场商家需求发布表主键ID
  85. levelOneGoodsId: '', // 一级市场海关允许售卖商品ID
  86. goodsName: '', // 商品名称
  87. goodsImg: '', // 商品图片
  88. purchaserId: '', // 二级市场商家ID
  89. purchaserName: '', // 商家名称
  90. isOrders: '', // 已被接单
  91. goodsQuantity: '', // 商品量(根据海关允许发布表的计量单位决定,例如:柜,KG,吨)
  92. remark: '', // 商家备注
  93. createTime: '', // 创建时间
  94. deleteStatus: '', // 删除状态
  95. }
  96. },
  97. // 提交数据
  98. ok: function(){
  99. // 表单校验
  100. let m = this.m;
  101. sa.checkNull(m.id, '请输入 [二级市场商家需求发布表主键ID]');
  102. sa.checkNull(m.levelOneGoodsId, '请输入 [一级市场海关允许售卖商品ID]');
  103. sa.checkNull(m.goodsName, '请输入 [商品名称]');
  104. sa.checkNull(m.goodsImg, '请输入 [商品图片]');
  105. sa.checkNull(m.purchaserId, '请输入 [二级市场商家ID]');
  106. sa.checkNull(m.purchaserName, '请输入 [商家名称]');
  107. sa.checkNull(m.isOrders, '请输入 [已被接单]');
  108. sa.checkNull(m.goodsQuantity, '请输入 [商品量]');
  109. sa.checkNull(m.remark, '请输入 [商家备注]');
  110. sa.checkNull(m.createTime, '请输入 [创建时间]');
  111. sa.checkNull(m.deleteStatus, '请输入 [删除状态]');
  112. // 开始增加或修改
  113. if(this.id <= 0) { // 添加
  114. sa.ajax('/TbGoodsDemand/add', m, function(res){
  115. sa.alert('增加成功', this.clean);
  116. }.bind(this));
  117. } else { // 修改
  118. sa.ajax('/TbGoodsDemand/update', m, function(res){
  119. sa.alert('修改成功', this.clean);
  120. }.bind(this));
  121. }
  122. },
  123. // 添加/修改 完成后的动作
  124. clean: function() {
  125. if(this.id == 0) {
  126. this.m = this.createModel();
  127. } else {
  128. parent.app.f5(); // 刷新父页面列表
  129. sa.closeCurrIframe(); // 关闭本页
  130. }
  131. }
  132. },
  133. mounted: function(){
  134. // 初始化数据
  135. if(this.id <= 0) {
  136. this.m = this.createModel();
  137. } else {
  138. sa.ajax('/TbGoodsDemand/getById?id=' + this.id, function(res) {
  139. this.m = res.data;
  140. if(res.data == null) {
  141. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  142. }
  143. }.bind(this))
  144. }
  145. }
  146. })
  147. </script>
  148. </body>
  149. </html>