tb-business-car-list.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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()" v-if="payStatus==1&&sa.isAuth('tb-business-edit')">
  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. <el-table-column label="预交停车费">
  35. <template slot-scope="s">
  36. <label>{{s.row.basePartMoney}}</label>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="已交费用">
  40. <template slot-scope="s">
  41. <label v-if="s.row.money">{{s.row.money}}</label>
  42. <label v-else>-</label>
  43. </template>
  44. </el-table-column>
  45. <sa-td name="联系人" prop="driverName"></sa-td>
  46. <sa-td name="联系号码" prop="driverPhone"></sa-td>
  47. <sa-td name="入场时间" prop="realInTime" width=180></sa-td>
  48. <sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
  49. <el-table-column label="操作" fixed="right" width="200px">
  50. <template slot-scope="s">
  51. <el-button v-if="sa.isAuth('tb-business-car-change')&&s.row.realInTime==null" class="c-btn" type="primary" @click="inFn(s.row)">确认入场
  52. </el-button>
  53. <el-button v-if="sa.isAuth('tb-business-car-change')&&s.row.realInTime!=null&&s.row.realOutTime==null" class="c-btn" type="primary" @click="outFn(s.row)">确认离场
  54. </el-button>
  55. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
  56. </el-button>
  57. <el-button v-if="s.row.pay==0&&sa.isAuth('tb-business-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
  58. </el-button>
  59. <el-button v-if="s.row.pay==0&&sa.isAuth('tb-business-edit')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除
  60. </el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <!-- ------------- 分页 ------------- -->
  65. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  66. </sa-item>
  67. </div>
  68. <el-dialog title="确认入场" :visible.sync="rc.visible" width="400px">
  69. <el-form label-position="left">
  70. <div class="confirm-in">
  71. <sa-item type="datetime" name="入场时间" v-model="rc.form.realInTime" br></sa-item>
  72. <div class="c-item">
  73. <label class="c-label"><span style="color: red;">*</span>入场通道:</label>
  74. <el-input v-model="rc.form.inChannel" placeholder="入场通道" >
  75. </el-input>
  76. </div>
  77. </div>
  78. </el-form>
  79. <span slot="footer" class="dialog-footer">
  80. <el-button @click="rc.visible = false">取 消</el-button>
  81. <el-button type="primary" @click="sureInFn">确 认</el-button>
  82. </span>
  83. </el-dialog>
  84. <el-dialog title="确认离场" :visible.sync="out.visible" width="400px">
  85. <el-form label-position="left">
  86. <div class="confirm-in">
  87. <sa-item type="datetime" name="离场时间" v-model="out.form.realOutTime" br></sa-item>
  88. <div class="c-item">
  89. <label class="c-label"><span style="color: red;">*</span>离场通道:</label>
  90. <el-input v-model="out.form.outChannel" placeholder="离场通道" >
  91. </el-input>
  92. </div>
  93. </div>
  94. </el-form>
  95. <span slot="footer" class="dialog-footer">
  96. <el-button @click="out.visible = false">取 消</el-button>
  97. <el-button type="primary" @click="sureOutFn">确 认</el-button>
  98. </span>
  99. </el-dialog>
  100. </div>
  101. <script>
  102. var app = new Vue({
  103. components: {
  104. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  105. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  106. },
  107. el: '.vue-box',
  108. data: {
  109. payStatus:sa.p('payStatus',1),
  110. p: { // 查询参数
  111. id: '', //
  112. businessId: sa.p('id', ''), //
  113. carNo: '', //
  114. preInTime: '', //
  115. preOutTime: '', //
  116. realInTime: '', //
  117. realOutTime: '', //
  118. money: '', //
  119. driverPhone: '', //
  120. pageNo: 1, // 当前页
  121. pageSize: 10, // 页大小
  122. sortType: 0 // 排序方式
  123. },
  124. dataCount: 0,
  125. dataList: [], // 数据集合
  126. rc:{
  127. visible:false,
  128. form:{
  129. realInTime:'',
  130. inChannel:''
  131. }
  132. },
  133. out:{
  134. visible:false,
  135. form:{
  136. realOutTime:'',
  137. outChannel:''
  138. }
  139. }
  140. },
  141. methods: {
  142. inFn(data){
  143. Object.assign(this.rc,{
  144. visible:true,
  145. form:data
  146. })
  147. },
  148. sureInFn(){
  149. if(!this.rc.form.realInTime){
  150. sa.error('请填写入场时间')
  151. return;
  152. }
  153. if(!this.rc.form.inChannel){
  154. sa.error('请填写入场通道')
  155. return;
  156. }
  157. sa.ajax('/TbBusinessCar/update', this.rc.form, function(res) {
  158. sa.alert('操作成功');
  159. this.rc.visible=false;
  160. this.f5();
  161. }.bind(this));
  162. },
  163. outFn(data){
  164. Object.assign(this.out,{
  165. visible:true,
  166. form:data
  167. })
  168. },
  169. sureOutFn(){
  170. if(!this.out.form.realOutTime){
  171. sa.error('请填写离场时间')
  172. return;
  173. }
  174. if(!this.out.form.outChannel){
  175. sa.error('请填写离场通道')
  176. return;
  177. }
  178. sa.ajax('/TbBusinessCar/update', this.out.form, function(res) {
  179. sa.alert('操作成功');
  180. this.out.visible=false;
  181. this.f5();
  182. }.bind(this));
  183. },
  184. // 刷新
  185. f5: function() {
  186. sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
  187. this.dataList = res.data; // 数据
  188. this.dataCount = res.dataCount; // 数据总数
  189. sa.f5TableHeight(); // 刷新表格高度
  190. }.bind(this));
  191. },
  192. // 查看
  193. get: function(data) {
  194. sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id+'&businessId='+this.p.businessId, '800px', '80%');
  195. },
  196. // 修改
  197. update: function(data) {
  198. sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id+'&businessId='+this.p.businessId, '500px', '70%');
  199. },
  200. // 新增
  201. add: function(data) {
  202. sa.showIframe('新增数据', 'tb-business-car-add.html?id=-1'+'&businessId='+this.p.businessId, '550px', '80%');
  203. },
  204. // 删除
  205. del: function(data) {
  206. sa.confirm('是否删除,此操作不可撤销', function() {
  207. sa.ajax('/TbBusinessCar/delete?id=' + data.id, function(res) {
  208. sa.arrayDelete(this.dataList, data);
  209. sa.ok('删除成功');
  210. sa.f5TableHeight(); // 刷新表格高度
  211. }.bind(this))
  212. }.bind(this));
  213. },
  214. // 改 - 状态(0=否,1=是)
  215. updateStatus: function(data) {
  216. if(!sa.isAuth('tb-business-car-change')){
  217. sa.error('无权限')
  218. return false;
  219. }
  220. // 声明变量记录是否成功
  221. var isOk = false;
  222. var oldValue = data.isLock;
  223. var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
  224. id: data.id,
  225. value: data.isLock
  226. }, function(res) {
  227. isOk = true;
  228. sa.msg('修改成功');
  229. }.bind(this));
  230. // 如果未能修改成功, 则回滚
  231. $.when(ajax).done(function() {
  232. if (isOk == false) {
  233. data.isLock = oldValue;
  234. }
  235. })
  236. },
  237. },
  238. created: function() {
  239. this.f5();
  240. sa.onInputEnter();
  241. }
  242. })
  243. </script>
  244. </body>
  245. </html>