tb-demand-quotation-add.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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: 7em !important;
  20. }
  21. .c-panel .el-form .el-input,
  22. .c-panel .el-form .el-textarea__inner {
  23. width: 250px;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  29. <!-- ------- 内容部分 ------- -->
  30. <div class="s-body">
  31. <div class="c-panel">
  32. <div class="c-title" v-if="id == 0">数据添加</div>
  33. <div class="c-title" v-else>数据修改</div>
  34. <el-form v-if="m">
  35. <el-row :gutter="50">
  36. <el-col :span="12">
  37. <sa-item type="text" name="组名称" v-model="m.groupName" br></sa-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <sa-item type="text" name="报价" v-model="m.quotation" br></sa-item>
  41. </el-col>
  42. </el-row>
  43. <el-row :gutter="50">
  44. <el-col :span="12">
  45. <sa-item type="text" name="组名称" v-model="m.groupName" br></sa-item>
  46. </el-col>
  47. <el-col :span="12">
  48. <sa-item type="text" name="报价" v-model="m.quotation" br></sa-item>
  49. </el-col>
  50. </el-row>
  51. <!-- <sa-item type="text" name="一级市场组长需求抢购表ID" v-model="m.id" br></sa-item>
  52. <sa-item type="text" name="一级市场互市组组长ID" v-model="m.leaderId" br></sa-item>
  53. <sa-item type="text" name="组名称" v-model="m.groupName" br></sa-item>
  54. <sa-item type="text" name="二级市场收购商需求表ID" v-model="m.demandId" br></sa-item>
  55. <sa-item type="text" name="报价" v-model="m.quotation" br></sa-item>
  56. <sa-item type="text" name="创建人编号" v-model="m.createBy" br></sa-item>
  57. <sa-item type="text" name="创建人名称" v-model="m.createName" br></sa-item>
  58. <sa-item type="text" name="创建时间" v-model="m.createTime" br></sa-item>
  59. <sa-item type="text" name="删除状态" v-model="m.deleteStatus" br></sa-item> -->
  60. <sa-item name="" class="s-ok" br>
  61. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  62. </sa-item>
  63. </el-form>
  64. </div>
  65. </div>
  66. <!-- ------- 底部按钮 ------- -->
  67. <div class="s-foot">
  68. <el-button type="primary" @click="ok()">确定</el-button>
  69. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  70. </div>
  71. </div>
  72. <script>
  73. var app = new Vue({
  74. components: {
  75. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  76. },
  77. el: '.vue-box',
  78. data: {
  79. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  80. m: null, // 实体对象
  81. },
  82. methods: {
  83. // 创建一个 默认Model
  84. createModel: function () {
  85. return {
  86. id: '', // 一级市场组长需求抢购表ID
  87. leaderId: '', // 一级市场互市组组长ID(tb_people)
  88. groupName: '', // 组名称
  89. demandId: '', // 二级市场收购商需求表ID
  90. quotation: '', // 报价(CNY)
  91. createBy: '', // 创建人编号
  92. createName: '', // 创建人名称(报价人)
  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.leaderId, '请输入 [一级市场互市组组长ID]');
  103. sa.checkNull(m.groupName, '请输入 [组名称]');
  104. sa.checkNull(m.demandId, '请输入 [二级市场收购商需求表ID]');
  105. sa.checkNull(m.quotation, '请输入 [报价]');
  106. sa.checkNull(m.createBy, '请输入 [创建人编号]');
  107. sa.checkNull(m.createName, '请输入 [创建人名称]');
  108. sa.checkNull(m.createTime, '请输入 [创建时间]');
  109. sa.checkNull(m.deleteStatus, '请输入 [删除状态]');
  110. // 开始增加或修改
  111. if (this.id <= 0) { // 添加
  112. sa.ajax('/TbDemandQuotation/add', m, function (res) {
  113. sa.alert('增加成功', this.clean);
  114. }.bind(this));
  115. } else { // 修改
  116. sa.ajax('/TbDemandQuotation/update', m, function (res) {
  117. sa.alert('修改成功', this.clean);
  118. }.bind(this));
  119. }
  120. },
  121. // 添加/修改 完成后的动作
  122. clean: function () {
  123. if (this.id == 0) {
  124. this.m = this.createModel();
  125. } else {
  126. parent.app.f5(); // 刷新父页面列表
  127. sa.closeCurrIframe(); // 关闭本页
  128. }
  129. }
  130. },
  131. mounted: function () {
  132. // 初始化数据
  133. if (this.id <= 0) {
  134. this.m = this.createModel();
  135. } else {
  136. sa.ajax('/TbDemandQuotation/getById?id=' + this.id, function (res) {
  137. this.m = res.data;
  138. if (res.data == null) {
  139. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  140. }
  141. }.bind(this))
  142. }
  143. }
  144. })
  145. </script>
  146. </body>
  147. </html>