relation-goods-type-add.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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, .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.id" br></sa-item>
  35. <sa-item type="text" name="" v-model="m.goodsId" 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.typeId" br></sa-item>
  38. <sa-item type="text" name="类型名称" v-model="m.typeName" br></sa-item>
  39. <sa-item type="enum" name="载重是否必填" v-model="m.needWeight" :jv="{1: '是', 0: '否'}" jtype="3" br></sa-item>
  40. <sa-item type="enum" name="规格是否必填" v-model="m.needCarSize" :jv="{1: '是', 0: '否'}" jtype="3"
  41. br></sa-item>
  42. <sa-item type="enum" name="申报单是否必填" v-model="m.needDeclare" :jv="{1: '是', 0: '否'}" jtype="3"
  43. br></sa-item>
  44. <sa-item type="enum" name="申报时间是否必填" v-model="m.needOperateTime" :jv="{1: '是', 0: '否'}" jtype="3"
  45. br></sa-item>
  46. <sa-item type="enum" name="是否必选" v-model="m.needSelect" :jv="{1: '是', 0: '否'}" jtype="3" br></sa-item>
  47. <sa-item name="" class="s-ok" br>
  48. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  49. </sa-item>
  50. </el-form>
  51. </div>
  52. </div>
  53. <!-- ------- 底部按钮 ------- -->
  54. <div class="s-foot">
  55. <el-button type="primary" @click="ok()">确定</el-button>
  56. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  57. </div>
  58. </div>
  59. <script>
  60. var app = new Vue({
  61. components: {
  62. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  63. },
  64. el: '.vue-box',
  65. data: {
  66. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  67. m: null, // 实体对象
  68. },
  69. methods: {
  70. // 创建一个 默认Model
  71. createModel: function () {
  72. return {
  73. id: '', //
  74. goodsId: '', //
  75. goodsName: '', // 作业类型
  76. typeId: '', //
  77. typeName: '', // 类型名称
  78. needWeight: '', // 载重是否必填(1=是,0=否)
  79. needCarSize: '', // 规格是否必填(1=是,0=否)
  80. needDeclare: '', // 申报单是否必填(1=是,0=否)
  81. needOperateTime: '', // 申报时间是否必填(1=是,0=否)
  82. needSelect: '', // 是否必选(1=是,0=否)
  83. }
  84. },
  85. // 提交数据
  86. ok: function () {
  87. // 表单校验
  88. let m = this.m;
  89. sa.checkNull(m.id, '请输入 []');
  90. sa.checkNull(m.goodsId, '请输入 []');
  91. sa.checkNull(m.goodsName, '请输入 [作业类型]');
  92. sa.checkNull(m.typeId, '请输入 []');
  93. sa.checkNull(m.typeName, '请输入 [类型名称]');
  94. sa.checkNull(m.needWeight, '请输入 [载重是否必填]');
  95. sa.checkNull(m.needCarSize, '请输入 [规格是否必填]');
  96. sa.checkNull(m.needDeclare, '请输入 [申报单是否必填]');
  97. sa.checkNull(m.needOperateTime, '请输入 [申报时间是否必填]');
  98. sa.checkNull(m.needSelect, '请输入 [是否必选]');
  99. // 开始增加或修改
  100. if (this.id <= 0) { // 添加
  101. sa.ajax('/RelationGoodsType/add', m, function (res) {
  102. sa.alert('增加成功', this.clean);
  103. }.bind(this));
  104. } else { // 修改
  105. sa.ajax('/RelationGoodsType/update', m, function (res) {
  106. sa.alert('修改成功', this.clean);
  107. }.bind(this));
  108. }
  109. },
  110. // 添加/修改 完成后的动作
  111. clean: function () {
  112. if (this.id == 0) {
  113. this.m = this.createModel();
  114. } else {
  115. parent.app.f5(); // 刷新父页面列表
  116. sa.closeCurrIframe(); // 关闭本页
  117. }
  118. }
  119. },
  120. mounted: function () {
  121. // 初始化数据
  122. if (this.id <= 0) {
  123. this.m = this.createModel();
  124. } else {
  125. sa.ajax('/RelationGoodsType/getById?id=' + this.id, function (res) {
  126. this.m = res.data;
  127. if (res.data == null) {
  128. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  129. }
  130. }.bind(this))
  131. }
  132. }
  133. })
  134. </script>
  135. </body>
  136. </html>