tb-business-car-list.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. <style>
  18. .car-size .el-input__inner {
  19. width: 130px;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="vue-box" style="display: none;" :style="'display: block;'">
  25. <div class="c-panel">
  26. <div class="fast-btn">
  27. <el-button size="mini" type="primary" @click="add()"
  28. v-if="sa.isAuth('tb-flex-business-edit')&&confirm==0">
  29. 新增
  30. </el-button>
  31. <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
  32. </div>
  33. <!-- ------------- 数据列表 ------------- -->
  34. <el-table class="data-table" ref="data-table" :data="dataList">
  35. <sa-td name="车牌号" prop="carNo" width=120></sa-td>
  36. <sa-td name="入场时间" prop="realInTime" width=160></sa-td>
  37. <sa-td name="离场时间" prop="realOutTime" width=160></sa-td>
  38. <sa-td name="入场通道" prop="inChannel" width=180></sa-td>
  39. <sa-td name="离场通道" prop="outChannel" width=180></sa-td>
  40. <el-table-column label="停车费">
  41. <template slot-scope="s">
  42. <label v-if="s.row.money">{{s.row.money}}</label>
  43. <label v-else>-</label>
  44. </template>
  45. </el-table-column>
  46. <sa-td width="130" name="支付状态" prop="payType">
  47. </sa-td>
  48. <el-table-column label="操作" width="100px" fixed="right">
  49. <template slot-scope="s">
  50. <el-button v-if="sa.isAuth('tb-flex-business-edit')
  51. &&s.row.pay==0
  52. &&s.row.payUnloadMoney==0" class="c-btn" type="danger" @click="del(s.row)">删除
  53. </el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. </div>
  58. <el-dialog title="添加车辆" :visible.sync="modal.visible" width="400px">
  59. <el-form>
  60. <sa-item type="text" name="车牌号" v-model="modal.form.carNo" br need></sa-item>
  61. <div class="c-item">
  62. <label class="c-label">车辆类型:</label>
  63. <el-select v-model="modal.form.carType" placeholder="请选择">
  64. <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
  65. </el-option>
  66. </el-select>
  67. </div>
  68. <div class="c-item">
  69. </el-form>
  70. <span slot="footer" class="dialog-footer">
  71. <el-button @click="modal.visible = false">取 消</el-button>
  72. <el-button type="primary" @click="sureAddFn">确 认</el-button>
  73. </span>
  74. </el-dialog>
  75. </div>
  76. <script>
  77. var app = new Vue({
  78. components: {
  79. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  80. "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
  81. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  82. },
  83. el: '.vue-box',
  84. data: {
  85. report: {
  86. visible: false,
  87. business: {},
  88. },
  89. payStatus: sa.p('payStatus', 1),
  90. confirm: sa.p('confirm', 0),
  91. p: { // 查询参数
  92. businessId: sa.p('id', ''), //
  93. carNo: '', //
  94. },
  95. dataCount: 0,
  96. dataList: [], // 数据集合
  97. carTypeList: [],
  98. modal: {
  99. visible: false,
  100. form: {
  101. carNo: '',
  102. carSize: 13,
  103. carType: '载重',
  104. netWeight: 0
  105. }
  106. },
  107. },
  108. methods: {
  109. getItemType() {
  110. sa.ajax('/TbItem/getItemType', function(resp) {
  111. let list = resp.data;
  112. if (list.length > 0) {
  113. this.modal.form.carType = list[0].name;
  114. }
  115. this.carTypeList = list;
  116. }.bind(this))
  117. },
  118. sureAddFn() {
  119. let data = this.modal.form;
  120. if (!data.carNo) {
  121. sa.error('请填写车牌号')
  122. return;
  123. }
  124. data.businessId = this.p.businessId;
  125. sa.ajax('/TbBusiness/addCar', data, function(res) {
  126. sa.alert('添加成功');
  127. this.modal.visible = false;
  128. this.f5();
  129. }.bind(this));
  130. },
  131. // 刷新
  132. f5: function() {
  133. sa.ajax('/TbBusinessCar/getBusinessByBusinessCarId', sa.removeNull(this.p), function(res) {
  134. this.dataList = res.data; // 数据
  135. this.dataCount = res.dataCount; // 数据总数
  136. sa.f5TableHeight(); // 刷新表格高度
  137. }.bind(this));
  138. },
  139. // 查看
  140. get: function(data) {
  141. sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id + '&businessId=' + this.p
  142. .businessId, '800px', '80%');
  143. },
  144. // 修改
  145. update: function(data) {
  146. sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
  147. .businessId, '500px', '70%');
  148. },
  149. // 新增
  150. add: function(data) {
  151. Object.assign(this.modal, {
  152. visible: true,
  153. form: {
  154. carNo: '',
  155. carSize: 13,
  156. carType: '重车',
  157. netWeight: 0
  158. }
  159. })
  160. },
  161. // 删除
  162. del: function(data) {
  163. sa.confirm('是否删除,此操作不可撤销', function() {
  164. sa.ajax('/TbBusiness/deleteBusinessCar?id=' + data.id + '&businessId=' + this.p
  165. .businessId,
  166. function(res) {
  167. sa.arrayDelete(this.dataList, data);
  168. sa.ok('删除成功');
  169. sa.f5TableHeight(); // 刷新表格高度
  170. }.bind(this))
  171. }.bind(this));
  172. },
  173. // 改 - 状态(0=否,1=是)
  174. updateStatus: function(data) {
  175. if (!sa.isAuth('tb-business-car-change')) {
  176. sa.error('无权限')
  177. return false;
  178. }
  179. // 声明变量记录是否成功
  180. var isOk = false;
  181. var oldValue = data.isLock;
  182. var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
  183. id: data.id,
  184. value: data.isLock
  185. }, function(res) {
  186. isOk = true;
  187. sa.msg('修改成功');
  188. }.bind(this));
  189. // 如果未能修改成功, 则回滚
  190. $.when(ajax).done(function() {
  191. if (isOk == false) {
  192. data.isLock = oldValue;
  193. }
  194. })
  195. },
  196. },
  197. created: function() {
  198. this.f5();
  199. this.getItemType();
  200. sa.onInputEnter();
  201. }
  202. })
  203. </script>
  204. </body>
  205. </html>