tb-business-car-list.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. <el-table class="data-table" ref="data-table" :data="dataList">
  23. <sa-td type="selection"></sa-td>
  24. <sa-td name="车牌号" prop="carNo"></sa-td>
  25. <sa-td name="车辆规格" prop="carSize"></sa-td>
  26. <sa-td name="联系人" prop="driverName"></sa-td>
  27. <sa-td name="联系号码" prop="driverPhone"></sa-td>
  28. <sa-td name="入场时间" prop="realInTime"></sa-td>
  29. <sa-td name="离场时间" prop="realOutTime"></sa-td>
  30. <el-table-column label="停车费">
  31. <template slot-scope="s">
  32. <label v-if="s.row.money">{{s.row.money}}</label>
  33. <label v-else>{{s.row.basePartMoney}}</label>
  34. </template>
  35. </el-table-column>
  36. <sa-td width="130" name="支付状态" prop="pay" type="enum" :jv="{0: '未支付[#ff0000]', 1: '已支付[#005500]'}">
  37. </sa-td>
  38. <sa-td name="状态" prop="isLock" type="switch" :jv="{1: '锁定[#ff0000]', 0: '正常[#005500]'}"
  39. @change="s => updateStatus(s.row)"></sa-td>
  40. <!-- <el-table-column label="操作" fixed="right" width="240px">
  41. <template slot-scope="s">
  42. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  43. </el-button>
  44. <el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  45. </el-button>
  46. <el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除
  47. </el-button>
  48. </template>
  49. </el-table-column> -->
  50. </el-table>
  51. <!-- ------------- 分页 ------------- -->
  52. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  53. </sa-item>
  54. </div>
  55. </div>
  56. <script>
  57. var app = new Vue({
  58. components: {
  59. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  60. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  61. },
  62. el: '.vue-box',
  63. data: {
  64. p: { // 查询参数
  65. id: '', //
  66. businessId: sa.p('id', '-1'), //
  67. carNo: '', //
  68. preInTime: '', //
  69. preOutTime: '', //
  70. realInTime: '', //
  71. realOutTime: '', //
  72. money: '', //
  73. driverPhone: '', //
  74. pageNo: 1, // 当前页
  75. pageSize: 10, // 页大小
  76. sortType: 0 // 排序方式
  77. },
  78. dataCount: 0,
  79. dataList: [], // 数据集合
  80. },
  81. methods: {
  82. // 刷新
  83. f5: function() {
  84. sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
  85. this.dataList = res.data; // 数据
  86. this.dataCount = res.dataCount; // 数据总数
  87. sa.f5TableHeight(); // 刷新表格高度
  88. }.bind(this));
  89. },
  90. // 改 - 状态(0=否,1=是)
  91. updateStatus: function(data) {
  92. // 声明变量记录是否成功
  93. var isOk = false;
  94. var oldValue = data.isLock;
  95. var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
  96. id: data.id,
  97. value: data.isLock
  98. }, function(res) {
  99. isOk = true;
  100. sa.msg('修改成功');
  101. }.bind(this));
  102. // 如果未能修改成功, 则回滚
  103. $.when(ajax).done(function() {
  104. if (isOk == false) {
  105. data.isLock = oldValue;
  106. }
  107. })
  108. },
  109. },
  110. created: function() {
  111. this.f5();
  112. sa.onInputEnter();
  113. }
  114. })
  115. </script>
  116. </body>
  117. </html>