tb-business-car-business.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. <el-form ref="form" :model='p' @submit.native.prevent>
  22. <sa-item type="text" name="车牌号" v-model="p.carNo"></sa-item>
  23. <div class="c-item">
  24. <label class="c-label">入场时间:</label>
  25. <el-date-picker :clearable="false" v-model="inTime" type="datetimerange" range-separator="至"
  26. start-placeholder="开始日期" end-placeholder="结束日期">
  27. </el-date-picker>
  28. </div>
  29. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  30. <el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
  31. <el-button size="mini" type="primary" @click="confirmSelectFn">确定</el-button>
  32. </el-form>
  33. <!-- ------------- 数据列表 ------------- -->
  34. <el-table class="data-table" ref="data-table" :data="dataList">
  35. <sa-td type="selection"></sa-td>
  36. <sa-td name="车牌号" prop="carNo" width=120></sa-td>
  37. <el-table-column label="车牌颜色">
  38. <template slot-scope="s">
  39. <label v-if="!s.row.color">-</label>
  40. <label v-else>{{s.row.color}}</label>
  41. </template>
  42. </el-table-column>
  43. <sa-td name="入场通道" prop="inChannel"></sa-td>
  44. <sa-td name="入场时间" prop="realInTime"></sa-td>
  45. <sa-td name="离场时间" prop="realOutTime"></sa-td>
  46. <el-table-column label="停车费">
  47. <template slot-scope="s">
  48. <label v-if="s.row.money">{{s.row.money}}</label>
  49. <label v-else>-</label>
  50. </template>
  51. </el-table-column>
  52. <sa-td name="支付状态" prop="payType">
  53. <template slot-scope="s">
  54. <label v-if="s.row.payType.indexOf('免')!==-1">{{s.row.payType}}</label>
  55. <label v-else>
  56. <label v-if="s.row.money">已支付</label>
  57. <label v-else>未支付</label>
  58. </label>
  59. </template>
  60. </sa-td>
  61. <!-- <el-table-column label="操作" fixed="right">
  62. <template slot-scope="s">
  63. <el-button class="c-btn" type="primary" @click="sureFn(s.row)">选择
  64. </el-button>
  65. </template>
  66. </el-table-column> -->
  67. </el-table>
  68. <!-- ------------- 分页 ------------- -->
  69. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  70. </sa-item>
  71. </div>
  72. </div>
  73. <script>
  74. var app = new Vue({
  75. components: {
  76. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  77. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  78. },
  79. el: '.vue-box',
  80. data: {
  81. leveTime: [],
  82. inTime: [],
  83. businessId:sa.p('id','-1'),
  84. businessCarIds:sa.p('businessCarIds',''),
  85. carNo:sa.p('carNo',''),
  86. p: { // 查询参数
  87. carNo: decodeURIComponent(sa.p('carNo','')), //
  88. inStart:'',
  89. inEnd:'',
  90. limitDay:1,
  91. pageNo: 1, // 当前页
  92. pageSize: 10, // 页大小
  93. sortType: 10 ,// 排序方式
  94. },
  95. dataCount: 0,
  96. dataList: [], // 数据集合
  97. colorList: []
  98. },
  99. methods: {
  100. sureFn(data) {
  101. let id=data.id;
  102. let businessCarId=this.businessCarId;
  103. let content = '是否将[' + data.carNo + ']绑定到此业务';
  104. if (businessCarId&&id!=businessCarId) {
  105. content = '此业务已绑定车辆【' + decodeURIComponent(this.carNo) + '】,是否覆盖?';
  106. }
  107. if (id === businessCarId) {
  108. sa.error('该车已绑定此业务,无需绑定');
  109. return;
  110. }
  111. let obj = {
  112. id: this.businessId,
  113. businessCarId: id
  114. };
  115. sa.confirm(content, function() {
  116. sa.ajax('/TbBusiness/bindCar', obj, function(resp) {
  117. sa.alert('绑定成功');
  118. setTimeout(() => {
  119. sa.closeCurrIframe(); // 关闭本页
  120. parent.app.f5(); // 刷新父页面列表
  121. }, 1000)
  122. }.bind(this))
  123. }.bind(this));
  124. },
  125. confirmSelectFn(){
  126. let selection = this.$refs['data-table'].selection;
  127. if (selection.length == 0) {
  128. return sa.msg('至少选择一条记录')
  129. }
  130. let ids = sa.getArrayField(selection, 'id');
  131. let obj={
  132. businessId:this.businessId,
  133. businessCarIds:ids.join(',')
  134. }
  135. sa.confirm('是否确认绑定选中车辆?', function() {
  136. sa.ajax('/TbBusiness/bindOtherBusinessCar', obj, function(resp) {
  137. sa.alert('绑定成功');
  138. setTimeout(() => {
  139. sa.closeCurrIframe(); // 关闭本页
  140. parent.app.f5(); // 刷新父页面列表
  141. }, 1000)
  142. }.bind(this))
  143. }.bind(this));
  144. },
  145. // 刷新
  146. f5: function() {
  147. if (this.inTime && this.inTime.length > 0) {
  148. this.p.inStart = sa.forDatetime(this.inTime[0]);
  149. this.p.inEnd = sa.forDatetime(this.inTime[1]);
  150. } else {
  151. this.p.inStart = '';
  152. this.p.inEnd = '';
  153. }
  154. sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
  155. let list = res.data;
  156. this.dataList = list; // 数据
  157. this.dataCount = res.dataCount; // 数据总数
  158. let businessCarIdList = this.businessCarIds.split(',');
  159. list.forEach(row => {
  160. if (businessCarIdList.indexOf(row.id) !==-1 ) {
  161. this.$nextTick(() => {
  162. this.$refs['data-table'].toggleRowSelection(row,
  163. true)
  164. })
  165. }
  166. })
  167. sa.f5TableHeight(); // 刷新表格高度
  168. }.bind(this));
  169. },
  170. // 查看
  171. get: function(data) {
  172. sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id + '&businessId=' + this.p
  173. .businessId, '800px', '80%');
  174. },
  175. // 修改
  176. update: function(data) {
  177. sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
  178. .businessId, '500px', '80%');
  179. },
  180. // 新增
  181. add: function(data) {
  182. sa.showIframe('新增数据', 'tb-business-car-add.html?id=-1' + '&businessId=' + this.p.businessId,
  183. '550px', '80%');
  184. },
  185. },
  186. created: function() {
  187. this.f5();
  188. sa.onInputEnter();
  189. }
  190. })
  191. </script>
  192. </body>
  193. </html>