tb-purchaser-address-add.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. <el-row :gutter="50">
  30. <el-col :span="12">
  31. <sa-item type="text" name="省" v-model="m.province" br></sa-item>
  32. </el-col>
  33. <el-col :span="12">
  34. <sa-item type="text" name="市" v-model="m.city" br></sa-item>
  35. </el-col>
  36. </el-row>
  37. <el-row :gutter="50">
  38. <el-col :span="12">
  39. <sa-item type="text" name="镇/区" v-model="m.town" br></sa-item>
  40. </el-col>
  41. <el-col :span="12">
  42. <sa-item type="text" name="街道" v-model="m.street" br></sa-item>
  43. </el-col>
  44. </el-row>
  45. <el-row :gutter="50">
  46. <el-col :span="12">
  47. <sa-item type="text" name="楼号" v-model="m.buildingNo" br></sa-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <sa-item type="text" name="地址全称" v-model="m.addressName" br></sa-item>
  51. </el-col>
  52. </el-row>
  53. <el-row :gutter="50">
  54. <el-col :span="12">
  55. <sa-item type="text" name="邮编" v-model="m.postNum" br></sa-item>
  56. </el-col>
  57. </el-row>
  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. owner: '', // 该地址拥有者主键
  86. province: '', // 省
  87. city: '', // 市
  88. town: '', // 镇/区
  89. street: '', // 街道
  90. buildingNo: '', // 楼号
  91. addressName: '', // 地址全称
  92. postNum: '', // 邮编
  93. }
  94. },
  95. // 提交数据
  96. ok: function(){
  97. // 表单校验
  98. let m = this.m;
  99. sa.checkNull(m.id, '请输入 [收购商地址表主键ID]');
  100. sa.checkNull(m.owner, '请输入 [该地址拥有者主键]');
  101. sa.checkNull(m.province, '请输入 [省]');
  102. sa.checkNull(m.city, '请输入 [市]');
  103. sa.checkNull(m.town, '请输入 [镇/区]');
  104. sa.checkNull(m.street, '请输入 [街道]');
  105. sa.checkNull(m.buildingNo, '请输入 [楼号]');
  106. sa.checkNull(m.addressName, '请输入 [地址全称]');
  107. sa.checkNull(m.postNum, '请输入 [邮编]');
  108. // 开始增加或修改
  109. if(this.id <= 0) { // 添加
  110. sa.ajax('/TbPurchaserAddress/add', m, function(res){
  111. sa.alert('增加成功', this.clean);
  112. }.bind(this));
  113. } else { // 修改
  114. sa.ajax('/TbPurchaserAddress/update', m, function(res){
  115. sa.alert('修改成功', this.clean);
  116. }.bind(this));
  117. }
  118. },
  119. // 添加/修改 完成后的动作
  120. clean: function() {
  121. if(this.id == 0) {
  122. this.m = this.createModel();
  123. } else {
  124. parent.app.f5(); // 刷新父页面列表
  125. sa.closeCurrIframe(); // 关闭本页
  126. }
  127. }
  128. },
  129. mounted: function(){
  130. // 初始化数据
  131. if(this.id <= 0) {
  132. this.m = this.createModel();
  133. } else {
  134. sa.ajax('/TbPurchaserAddress/getById?id=' + this.id, function(res) {
  135. this.m = res.data;
  136. if(res.data == null) {
  137. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  138. }
  139. }.bind(this))
  140. }
  141. }
  142. })
  143. </script>
  144. </body>
  145. </html>