tb-business-car-business.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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"></sa-td>
  53. <!-- <el-table-column label="操作" fixed="right">
  54. <template slot-scope="s">
  55. <el-button class="c-btn" type="primary" @click="sureFn(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. leveTime: [],
  74. inTime: [],
  75. businessId: sa.p('id', '-1'),
  76. businessCarIds: sa.p('businessCarIds', ''),
  77. carNo: sa.p('carNo', ''),
  78. p: { // 查询参数
  79. carNo: decodeURIComponent(sa.p('carNo', '')), //
  80. inStart: '',
  81. inEnd: '',
  82. limitDay: 1,
  83. pageNo: 1, // 当前页
  84. pageSize: 10, // 页大小
  85. sortType: 10,// 排序方式
  86. },
  87. dataCount: 0,
  88. dataList: [], // 数据集合
  89. colorList: []
  90. },
  91. methods: {
  92. sureFn(data) {
  93. let id = data.id;
  94. let businessCarId = this.businessCarId;
  95. let content = '是否将[' + data.carNo + ']绑定到此业务';
  96. if (businessCarId && id != businessCarId) {
  97. content = '此业务已绑定车辆【' + decodeURIComponent(this.carNo) + '】,是否覆盖?';
  98. }
  99. if (id === businessCarId) {
  100. sa.error('该车已绑定此业务,无需绑定');
  101. return;
  102. }
  103. let obj = {
  104. id: this.businessId,
  105. businessCarId: id
  106. };
  107. sa.confirm(content, function () {
  108. sa.ajax('/TbBusiness/bindCar', obj, function (resp) {
  109. sa.alert('绑定成功');
  110. setTimeout(() => {
  111. sa.closeCurrIframe(); // 关闭本页
  112. parent.app.f5(); // 刷新父页面列表
  113. }, 1000)
  114. }.bind(this))
  115. }.bind(this));
  116. },
  117. confirmSelectFn() {
  118. let selection = this.$refs['data-table'].selection;
  119. if (selection.length == 0) {
  120. return sa.msg('至少选择一条记录')
  121. }
  122. let ids = sa.getArrayField(selection, 'id');
  123. let obj = {
  124. businessId: this.businessId,
  125. businessCarIds: ids.join(',')
  126. }
  127. sa.confirm('是否确认绑定选中车辆?', function () {
  128. sa.ajax('/TbBusiness/bindOtherBusinessCar', obj, function (resp) {
  129. sa.alert('绑定成功');
  130. setTimeout(() => {
  131. sa.closeCurrIframe(); // 关闭本页
  132. parent.app.f5(); // 刷新父页面列表
  133. }, 1000)
  134. }.bind(this))
  135. }.bind(this));
  136. },
  137. // 刷新
  138. f5: function () {
  139. if (this.inTime && this.inTime.length > 0) {
  140. this.p.inStart = sa.forDatetime(this.inTime[0]);
  141. this.p.inEnd = sa.forDatetime(this.inTime[1]);
  142. } else {
  143. this.p.inStart = '';
  144. this.p.inEnd = '';
  145. }
  146. sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function (res) {
  147. let list = res.data;
  148. this.dataList = list; // 数据
  149. this.dataCount = res.dataCount; // 数据总数
  150. let businessCarIdList = this.businessCarIds.split(',');
  151. list.forEach(row => {
  152. if (businessCarIdList.indexOf(row.id) !== -1) {
  153. this.$nextTick(() => {
  154. this.$refs['data-table'].toggleRowSelection(row,
  155. true)
  156. })
  157. }
  158. })
  159. sa.f5TableHeight(); // 刷新表格高度
  160. }.bind(this));
  161. },
  162. // 查看
  163. get: function (data) {
  164. sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id + '&businessId=' + this.p
  165. .businessId, '800px', '80%');
  166. },
  167. // 修改
  168. update: function (data) {
  169. sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
  170. .businessId, '500px', '80%');
  171. },
  172. // 新增
  173. add: function (data) {
  174. sa.showIframe('新增数据', 'tb-business-car-add.html?id=-1' + '&businessId=' + this.p.businessId,
  175. '550px', '80%');
  176. },
  177. },
  178. created: function () {
  179. this.f5();
  180. sa.onInputEnter();
  181. }
  182. })
  183. </script>
  184. </body>
  185. </html>