tb-item-type-add.html 4.4 KB

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