tb-sort-group-list.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>业务限制组-列表</title>
  5. <meta 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. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="名称" v-model="p.name"></sa-item>
  25. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  26. <el-button v-if="sa.isAuth('tb-sort-group-add')" size="mini" type="primary" @click="add()">
  27. 新增
  28. </el-button>
  29. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  30. </el-form>
  31. <!-- ------------- 数据列表 ------------- -->
  32. <el-table class="data-table" ref="data-table" :data="dataList">
  33. <el-table-column type="index" width="50">
  34. </el-table-column>
  35. <sa-td name="规则组名称" prop="name"></sa-td>
  36. <sa-td name="是否启用" prop="status" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
  37. @change="s => updateStatus(s.row)"></sa-td>
  38. <sa-td name="完整性支付" prop="completePay" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
  39. @change="s => updateCompletePay(s.row)"></sa-td>
  40. <sa-td name="创建时间" prop="createTime"></sa-td>
  41. <el-table-column label="操作" fixed="right" width="240px">
  42. <template slot-scope="s">
  43. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  44. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  45. <el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  46. </template>
  47. </el-table-column>
  48. </el-table>
  49. <!-- ------------- 分页 ------------- -->
  50. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  51. </div>
  52. </div>
  53. <script>
  54. var app = new Vue({
  55. components: {
  56. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  57. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  58. },
  59. el: '.vue-box',
  60. data: {
  61. p: { // 查询参数
  62. id: '', //
  63. name: '', // 名称
  64. status: '', // 是否启用(0=否,1=是)
  65. createTime: '', // 创建时间
  66. pageNo: 1, // 当前页
  67. pageSize: 10, // 页大小
  68. sortType: 0 // 排序方式
  69. },
  70. dataCount: 0,
  71. dataList: [], // 数据集合
  72. },
  73. methods: {
  74. // 刷新
  75. f5: function () {
  76. sa.ajax('/TbSortGroup/getList', sa.removeNull(this.p), function (res) {
  77. this.dataList = res.data; // 数据
  78. this.dataCount = res.dataCount; // 数据总数
  79. sa.f5TableHeight(); // 刷新表格高度
  80. }.bind(this));
  81. },
  82. // 查看
  83. get: function (data) {
  84. sa.showIframe('数据详情', 'tb-sort-group-info.html?id=' + data.id, '1050px', '90%');
  85. },
  86. // 查看 - 根据选中的
  87. getBySelect: function (data) {
  88. var selection = this.$refs['data-table'].selection;
  89. if (selection.length == 0) {
  90. return sa.msg('请选择一条数据')
  91. }
  92. this.get(selection[0]);
  93. },
  94. // 修改
  95. update: function (data) {
  96. sa.showIframe('修改数据', 'tb-sort-group-edit.html?id=' + data.id, '1000px', '90%');
  97. },
  98. // 新增
  99. add: function (data) {
  100. sa.showIframe('新增数据', 'tb-sort-group-add.html?id=-1', '1000px', '90%');
  101. },
  102. // 删除
  103. del: function (data) {
  104. sa.confirm('是否删除,此操作不可撤销', function () {
  105. sa.ajax('/TbSortGroup/delete?id=' + data.id, function (res) {
  106. sa.arrayDelete(this.dataList, data);
  107. sa.ok('删除成功');
  108. sa.f5TableHeight(); // 刷新表格高度
  109. }.bind(this))
  110. }.bind(this));
  111. },
  112. updateCompletePay(data) {
  113. // 声明变量记录是否成功
  114. var isOk = false;
  115. var oldValue = data.completePay;
  116. var ajax = sa.ajax('/TbSortGroup/updateCompletePay', {
  117. id: data.id,
  118. value: data.completePay
  119. }, function (res) {
  120. isOk = true;
  121. sa.msg('修改成功');
  122. }.bind(this));
  123. // 如果未能修改成功, 则回滚
  124. $.when(ajax).done(function () {
  125. if (isOk == false) {
  126. data.completePay = oldValue;
  127. }
  128. })
  129. },
  130. // 改 - 是否启用(0=否,1=是)
  131. updateStatus: function (data) {
  132. // 声明变量记录是否成功
  133. var isOk = false;
  134. var oldValue = data.status;
  135. var ajax = sa.ajax('/TbSortGroup/updateStatus', {id: data.id, value: data.status}, function (res) {
  136. isOk = true;
  137. sa.msg('修改成功');
  138. }.bind(this));
  139. // 如果未能修改成功, 则回滚
  140. $.when(ajax).done(function () {
  141. if (isOk == false) {
  142. data.status = oldValue;
  143. }
  144. })
  145. },
  146. },
  147. created: function () {
  148. this.f5();
  149. sa.onInputEnter();
  150. }
  151. })
  152. </script>
  153. </body>
  154. </html>