tb-deduction-bind-list.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
  12. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  13. <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
  14. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  15. <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <style type="text/css">
  18. .data-table > .el-table__header-wrapper > table > thead > tr > th:first-child > div {
  19. display: none!important;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="vue-box" style="display: none;" :style="'display: block;'">
  25. <div class="c-panel">
  26. <!-- ------------- 检索参数 ------------- -->
  27. <div class="c-title">检索参数</div>
  28. <el-form ref="form" :model='p' @submit.native.prevent>
  29. <sa-item type="text" name="客户名称" v-model="p.customerName"></sa-item>
  30. <sa-item type="text" name="绑定操作人" v-model="p.createBy"></sa-item>
  31. <sa-item type="text" name="解绑操作人" v-model="p.updateBy"></sa-item>
  32. <sa-item type="text" name="绑定时间" >
  33. <el-date-picker
  34. v-model="p.bindTime"
  35. type="daterange"
  36. align="right"
  37. unlink-panels
  38. value-format="yyyy-MM-dd"
  39. range-separator="至"
  40. start-placeholder="开始日期"
  41. end-placeholder="结束日期"
  42. :picker-options="pickerOptions">
  43. </el-date-picker>
  44. </sa-item>
  45. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  46. <br/>
  47. </el-form>
  48. <!-- ------------- 快捷按钮 ------------- -->
  49. <sa-item type="fast-btn">
  50. <el-button type="primary" class="c-btn" icon="el-icon-plus"
  51. v-if="sa.isAuth('tb-deduction-bind-list-bind')" @click="add">绑定车辆</el-button>
  52. </sa-item>
  53. <!-- ------------- 数据列表 ------------- -->
  54. <el-table class="data-table" ref="data-table" :data="dataList" @select="selectRow" @row-click="handleRowClick">
  55. <sa-td type="selection"></sa-td>
  56. <sa-td name="主键" prop="id" v-if="false"></sa-td>
  57. <sa-td name="客户id" prop="customerId"></sa-td>
  58. <sa-td name="客户名称" prop="customerName"></sa-td>
  59. <sa-td name="扣除金额" prop="deductMoney"></sa-td>
  60. <sa-td name="绑定车辆" prop="bindCar"></sa-td>
  61. <sa-td name="绑定时间" prop="bindTime"></sa-td>
  62. <sa-td name="解绑时间" prop="unbindTime"></sa-td>
  63. <sa-td name="绑定创建人" prop="createBy"></sa-td>
  64. <sa-td name="创建时间" prop="createTime"></sa-td>
  65. <sa-td name="解绑更新人" prop="updateBy"></sa-td>
  66. <sa-td name="更新时间" prop="updateTime"></sa-td>
  67. <sa-td name="扣款失败提示" prop="feeFailRecord" width="200" height="20"></sa-td>
  68. <el-table-column label="操作" fixed="right" width="240px">
  69. <template slot-scope="s">
  70. <el-button class="c-btn" type="primary" icon="el-icon-edit" v-if="sa.isAuth('tb-deduction-bind-list-unbind')"
  71. @click="unbind(s.row)">手动解绑</el-button>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. <!-- ------------- 分页 ------------- -->
  76. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  77. </div>
  78. </div>
  79. <script>
  80. var app = new Vue({
  81. components: {
  82. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  83. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  84. },
  85. el: '.vue-box',
  86. data: {
  87. p: { // 查询参数
  88. id: '', // 主键
  89. customerId: '', // 客户id
  90. customerName: '', // 客户名称
  91. deductMoney: '', // 扣除金额
  92. bindCar: '', // 绑定车辆
  93. bindTime: undefined, // 绑定时间
  94. unbindTime: undefined, // 解绑时候
  95. createBy: '', // 创建人
  96. createTime: undefined, // 创建时间
  97. updateTime: undefined, // 更新时间
  98. updateBy: '', // 更新人
  99. pageNo: 1, // 当前页
  100. pageSize: 10, // 页大小
  101. sortType: 0 // 排序方式
  102. },
  103. pickerOptions: {
  104. shortcuts: [{
  105. text: '最近一周',
  106. onClick(picker) {
  107. const end = new Date();
  108. const start = new Date();
  109. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  110. picker.$emit('pick', [start, end]);
  111. }
  112. }, {
  113. text: '最近一个月',
  114. onClick(picker) {
  115. const end = new Date();
  116. const start = new Date();
  117. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  118. picker.$emit('pick', [start, end]);
  119. }
  120. }, {
  121. text: '最近三个月',
  122. onClick(picker) {
  123. const end = new Date();
  124. const start = new Date();
  125. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  126. picker.$emit('pick', [start, end]);
  127. }
  128. }]
  129. },
  130. addCustomerId:'',
  131. dataCount: 0,
  132. dataList: [], // 数据集合
  133. },
  134. methods: {
  135. // 刷新
  136. f5: function () {
  137. sa.ajax('/TbDeductionBind/getList', sa.removeNull(this.p), function (res) {
  138. this.dataList = res.data; // 数据
  139. this.dataCount = res.dataCount; // 数据总数
  140. sa.f5TableHeight(); // 刷新表格高度
  141. }.bind(this));
  142. },
  143. // 查看
  144. get: function (data) {
  145. sa.showIframe('数据详情', 'tb-deduction-bind-info.html?id=' + data.id, '1050px', '90%');
  146. },
  147. // 查看 - 根据选中的
  148. getBySelect: function (data) {
  149. var selection = this.$refs['data-table'].selection;
  150. if (selection.length == 0) {
  151. return sa.msg('请选择一条数据')
  152. }
  153. this.get(selection[0]);
  154. },
  155. // 手动解绑
  156. unbind: function (data) {
  157. if(!data.id || data.id=="null" || data.id=="undefined"){
  158. sa.error2("没有车辆绑定信息!")
  159. return;
  160. }
  161. sa.showIframe('修改数据', 'tb-deduction-bind-unbind.html?id=' + data.id, '1000px', '90%');
  162. },
  163. // 车辆绑定
  164. add: function (data) {
  165. if(!this.addCustomerId){
  166. sa.error2("请选定客户进行绑定!")
  167. return;
  168. }
  169. sa.showIframe('车辆绑定', 'tb-deduction-bind-add.html?customerId='+ this.addCustomerId, '1000px', '90%');
  170. },
  171. // 删除
  172. del: function (data) {
  173. sa.confirm('是否删除,此操作不可撤销', function () {
  174. sa.ajax('/TbDeductionBind/delete?id=' + data.id, function (res) {
  175. sa.arrayDelete(this.dataList, data);
  176. sa.ok('删除成功');
  177. sa.f5TableHeight(); // 刷新表格高度
  178. }.bind(this))
  179. }.bind(this));
  180. },
  181. // 批量删除
  182. deleteByIds: function () {
  183. // 获取选中元素的id列表
  184. let selection = this.$refs['data-table'].selection;
  185. let ids = sa.getArrayField(selection, 'id');
  186. if (selection.length == 0) {
  187. return sa.msg('请至少选择一条数据')
  188. }
  189. // 提交删除
  190. sa.confirm('是否批量删除选中数据?此操作不可撤销', function () {
  191. sa.ajax('/TbDeductionBind/deleteByIds', {ids: ids.join(',')}, function (res) {
  192. sa.arrayDelete(this.dataList, selection);
  193. sa.ok('删除成功');
  194. sa.f5TableHeight(); // 刷新表格高度
  195. }.bind(this))
  196. }.bind(this));
  197. },
  198. selectRow(val, row) {
  199. this.$refs['data-table'].clearSelection();
  200. this.$refs['data-table'].toggleRowSelection(row, true);
  201. this.addCustomerId = row.customerId;
  202. },
  203. handleRowClick(row, column, event) {
  204. this.selectRow(null,row);
  205. }
  206. },
  207. created: function () {
  208. this.f5();
  209. sa.onInputEnter();
  210. }
  211. })
  212. </script>
  213. </body>
  214. </html>
  215. <script>
  216. import Style from "../../../app/uview-ui/libs/mixin/style";
  217. export default {
  218. components: {Style}
  219. }
  220. </script>