tb-item-type-add.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. .item-num .el-input__inner {
  26. width: 100px;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  32. <!-- ------- 内容部分 ------- -->
  33. <div class="s-body">
  34. <div class="c-panel">
  35. <div class="c-title" v-if="id == 0">数据添加</div>
  36. <div class="c-title" v-else>数据修改</div>
  37. <el-form v-if="m">
  38. <sa-item type="text" name="项目名称" v-model="m.name" placeholder="请输入项目名称" br>
  39. </sa-item>
  40. <div class="c-item">
  41. <label class="c-label">排序:</label>
  42. <el-input-number class="item-num" v-model="m.sort" :step="1" :min="1" step-strictly>
  43. </el-input-number>
  44. </div>
  45. </el-form>
  46. </div>
  47. </div>
  48. <!-- ------- 底部按钮 ------- -->
  49. <div class="s-foot">
  50. <el-button type="primary" @click="ok()">确定</el-button>
  51. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  52. </div>
  53. </div>
  54. <script>
  55. var app = new Vue({
  56. components: {
  57. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  58. },
  59. el: '.vue-box',
  60. data: {
  61. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  62. businessType: [],
  63. m: {
  64. id: '', // 主键
  65. sort: '1',
  66. needRemark: 0,
  67. taxRate: 0.6,
  68. inc: 0,
  69. name: '',
  70. payStep: '',
  71. code: '',
  72. business: '0',
  73. }, // 实体对象
  74. typeList: [],
  75. stepList: []
  76. },
  77. methods: {
  78. // 提交数据
  79. ok: function () {
  80. // 表单校验
  81. let m = this.m;
  82. sa.checkNull(m.name, '请输入 [项目名称]');
  83. // 开始增加或修改
  84. if (this.id <= 0) { // 添加
  85. sa.ajax('/TbItemType/add', m, function (res) {
  86. sa.alert('增加成功', this.clean);
  87. }.bind(this));
  88. } else { // 修改
  89. sa.ajax('/TbItemType/update', m, function (res) {
  90. sa.alert('修改成功', this.clean);
  91. }.bind(this));
  92. }
  93. },
  94. // 添加/修改 完成后的动作
  95. clean: function () {
  96. if (this.id == 0) {
  97. } else {
  98. parent.app.f5(); // 刷新父页面列表
  99. sa.closeCurrIframe(); // 关闭本页
  100. }
  101. },
  102. },
  103. mounted: function () {
  104. // 初始化数据
  105. if (this.id <= 0) {
  106. } else {
  107. sa.ajax('/TbItemType/getById?id=' + this.id, function (res) {
  108. this.m = res.data;
  109. this.businessType = res.data.businessType ? res.data.businessType.split(',') : []
  110. if (res.data == null) {
  111. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  112. }
  113. }.bind(this))
  114. }
  115. }
  116. })
  117. </script>
  118. </body>
  119. </html>