tb-business-car-list.html 7.9 KB

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