tb-sort-group-info.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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: 8em !important;
  20. }
  21. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner {
  22. width: 250px;
  23. }
  24. .item-num .el-input__inner {
  25. width: 130px;
  26. display: inline;
  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. <el-form v-if="m">
  36. <sa-info name="组名称" br>{{m.name}}</sa-info>
  37. <sa-info type="enum" name="是否启用" :value="m.status"
  38. :jv="{1: '是', 0: '否'}" br></sa-info>
  39. <sa-info type="enum" name="完整性支付" :value="m.completePay"
  40. :jv="{1: '是', 0: '否'}" br></sa-info>
  41. <sa-item name="" class="s-ok" br>
  42. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  43. </sa-item>
  44. <el-divider></el-divider>
  45. <h4>规则</h4>
  46. <div style="width: 850px;margin-top: 20px;">
  47. <div v-for="item in list" :key="item.index">
  48. <div class="c-item" v-if="item.index>0">
  49. <label class="c-label">项目间隔(分):</label>
  50. <el-input-number disabled class="item-num" v-model="item.interval" :step="10" :min="0"
  51. :max="9999">
  52. </el-input-number>
  53. </div>
  54. <div class="c-item">
  55. <label class="c-label">第{{item.index + 1}}个:</label>
  56. <el-select disabled v-model="item.typeId" placeholder="请选择">
  57. <el-option :label="type.name" :value="type.id"
  58. v-for="(type,index) in item.businessTypeList">
  59. </el-option>
  60. </el-select>
  61. <label class="c-label" style="width: 160px;">单项间隔(小时):</label>
  62. <el-input-number disabled class="item-num" v-model="item.singleIntervalTime" :step="1"
  63. :min="1" :max="48">
  64. </el-input-number>
  65. </div>
  66. </div>
  67. </div>
  68. </el-form>
  69. </div>
  70. </div>
  71. <!-- ------- 底部按钮 ------- -->
  72. <div class="s-foot">
  73. <el-button type="primary" @click="sa.closeCurrIframe()">关闭</el-button>
  74. </div>
  75. </div>
  76. <script>
  77. var app = new Vue({
  78. components: {
  79. "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
  80. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  81. },
  82. el: '.vue-box',
  83. data: {
  84. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  85. m: null, // 实体对象
  86. list: [],
  87. businessTypeList: [],
  88. },
  89. methods: {
  90. handlerAdd() {
  91. let list = this.list;
  92. this.list.push({
  93. index: list.length,
  94. typeId: '',
  95. interval: 30,
  96. singleIntervalTime: 12,
  97. businessTypeList: this.businessTypeList
  98. })
  99. },
  100. handlerDel(index) {
  101. let list = this.list;
  102. list.splice(index, 1);
  103. for (let i in list) {
  104. let obj = list[i];
  105. if (obj.index > index) {
  106. obj.index = obj.index - 1;
  107. }
  108. }
  109. this.list = list;
  110. },
  111. getBusinessType() {
  112. sa.ajax('/TbItemType/getList', {
  113. business: 0,
  114. sortType: 0
  115. }, function (resp) {
  116. let list = resp.data;
  117. this.businessTypeList = list;
  118. this.getById();
  119. }.bind(this))
  120. },
  121. // 创建一个 默认Model
  122. createModel: function () {
  123. return {
  124. id: '', //
  125. name: '', // 名称
  126. status: 1, // 是否启用(0=否,1=是)
  127. createTime: '', // 创建时间
  128. }
  129. },
  130. // 提交数据
  131. ok: function () {
  132. // 表单校验
  133. let m = this.m;
  134. sa.checkNull(m.name, '请输入 [名称]');
  135. // 开始增加或修改
  136. if (this.id <= 0) { // 添加
  137. sa.ajax('/TbSortGroup/add', m, function (res) {
  138. sa.alert('增加成功', this.clean);
  139. }.bind(this));
  140. } else { // 修改
  141. sa.ajax('/TbSortGroup/update', m, function (res) {
  142. sa.alert('修改成功', this.clean);
  143. }.bind(this));
  144. }
  145. },
  146. // 添加/修改 完成后的动作
  147. clean: function () {
  148. if (this.id == 0) {
  149. this.m = this.createModel();
  150. } else {
  151. parent.app.f5(); // 刷新父页面列表
  152. sa.closeCurrIframe(); // 关闭本页
  153. }
  154. },
  155. getById() {
  156. sa.ajax('/TbSortGroup/getById?id=' + this.id, function (res) {
  157. let data = res.data;
  158. if (data == null) {
  159. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  160. return;
  161. }
  162. let sorts = data.sorts;
  163. let businessTypeList = this.businessTypeList;
  164. let list = [];
  165. for (let i in sorts) {
  166. let sort = sorts[i];
  167. let obj = {
  168. index: parseInt(i),
  169. typeId: sort.typeId,
  170. interval: sort.intervalTime,
  171. singleIntervalTime: sort.singleIntervalTime,
  172. businessTypeList: businessTypeList
  173. }
  174. list.push(obj);
  175. }
  176. this.m = data;
  177. this.list = list;
  178. }.bind(this))
  179. }
  180. },
  181. mounted() {
  182. this.getBusinessType()
  183. }
  184. })
  185. </script>
  186. </body>
  187. </html>