tb-business-car-list.html 5.3 KB

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