tb-business-car-list.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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()"
  23. v-if="confirm==0&&sa.isAuth('tb-business-edit')">
  24. 新增</el-button>
  25. <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
  26. </div>
  27. <!-- ------------- 数据列表 ------------- -->
  28. <el-table class="data-table" ref="data-table" :data="dataList">
  29. <sa-td name="车牌号" prop="carNo" width=120></sa-td>
  30. <sa-td name="车辆规格" prop="carSize"></sa-td>
  31. <sa-td width="130" name="支付状态" prop="pay" type="enum" :jv="{0: '未支付[#ff0000]', 1: '已支付[#005500]'}">
  32. </sa-td>
  33. <sa-td width=100 name="车辆状态" prop="isLock" type="switch" :jv="{1: '锁定[#ff0000]', 0: '正常[#005500]'}"
  34. @change="s => updateStatus(s.row)"></sa-td>
  35. <el-table-column label="证明">
  36. <template slot-scope="s">
  37. <el-button type="primary" @click="checkFn(s.row)">查看</el-button>
  38. </template>
  39. </el-table-column>
  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 name="入场时间" prop="realInTime" width=160></sa-td>
  47. <sa-td name="入场通道" prop="inChannel" width=180></sa-td>
  48. <sa-td name="离场时间" prop="realOutTime" width=160></sa-td>
  49. <sa-td name="离场通道" prop="outChannel" width=180></sa-td>
  50. <el-table-column label="操作" width="120px" fixed="right">
  51. <template slot-scope="s">
  52. <el-button v-if="sa.isAuth('tb-business-car-change')&&s.row.realInTime==null" class="c-btn"
  53. type="primary" @click="inFn(s.row)">确认入场
  54. </el-button>
  55. <el-button
  56. v-if="sa.isAuth('tb-business-car-change')&&s.row.realInTime!=null&&s.row.realOutTime==null"
  57. class="c-btn" type="primary" @click="outFn(s.row)">确认离场
  58. </el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <!-- ------------- 分页 ------------- -->
  63. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  64. </sa-item>
  65. </div>
  66. <el-dialog title="确认入场" :visible.sync="rc.visible" width="400px">
  67. <el-form label-position="left">
  68. <div class="confirm-in">
  69. <sa-item type="datetime" name="入场时间" v-model="rc.form.realInTime" br></sa-item>
  70. <div class="c-item">
  71. <label class="c-label"><span style="color: red;">*</span>入场通道:</label>
  72. <el-input v-model="rc.form.inChannel" placeholder="入场通道">
  73. </el-input>
  74. </div>
  75. </div>
  76. </el-form>
  77. <span slot="footer" class="dialog-footer">
  78. <el-button @click="rc.visible = false">取 消</el-button>
  79. <el-button type="primary" @click="sureInFn">确 认</el-button>
  80. </span>
  81. </el-dialog>
  82. <el-dialog title="确认离场" :visible.sync="out.visible" width="400px">
  83. <el-form label-position="left">
  84. <div class="confirm-in">
  85. <sa-item type="datetime" name="离场时间" v-model="out.form.realOutTime" br></sa-item>
  86. <div class="c-item">
  87. <label class="c-label"><span style="color: red;">*</span>离场通道:</label>
  88. <el-input v-model="out.form.outChannel" placeholder="离场通道">
  89. </el-input>
  90. </div>
  91. </div>
  92. </el-form>
  93. <span slot="footer" class="dialog-footer">
  94. <el-button @click="out.visible = false">取 消</el-button>
  95. <el-button type="primary" @click="sureOutFn">确 认</el-button>
  96. </span>
  97. </el-dialog>
  98. <el-dialog title="证明" :visible.sync="report.visible" width="500px">
  99. <div>
  100. <el-form>
  101. <el-row>
  102. <el-col span="12">
  103. <sa-info name="核酸报告" :value="report.business.nucleicReport" type="img"></sa-info>
  104. </el-col>
  105. <el-col span="12">
  106. <sa-info name="出仓证明" :value="report.business.outReport" type="img"></sa-info>
  107. </el-col>
  108. </el-row>
  109. <el-row style="margin-top: 20px;">
  110. <el-col span="12">
  111. <sa-info name="消杀证明" :value="report.business.disinfectReport" type="img"></sa-info>
  112. </el-col>
  113. <el-col span="12">
  114. <sa-info name="检验检疫证" :value="report.business.checkReport" type="img"></sa-info>
  115. </el-col>
  116. </el-row>
  117. </el-form>
  118. </div>
  119. </el-dialog>
  120. </div>
  121. <script>
  122. var app = new Vue({
  123. components: {
  124. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  125. "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
  126. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  127. },
  128. el: '.vue-box',
  129. data: {
  130. report: {
  131. visible: false,
  132. business: {},
  133. },
  134. payStatus: sa.p('payStatus', 1),
  135. confirm: sa.p('confirm', 0),
  136. p: { // 查询参数
  137. id: '', //
  138. businessId: sa.p('id', ''), //
  139. carNo: '', //
  140. preInTime: '', //
  141. preOutTime: '', //
  142. realInTime: '', //
  143. realOutTime: '', //
  144. money: '', //
  145. driverPhone: '', //
  146. pageNo: 1, // 当前页
  147. pageSize: 10, // 页大小
  148. sortType: 0 // 排序方式
  149. },
  150. dataCount: 0,
  151. dataList: [], // 数据集合
  152. rc: {
  153. visible: false,
  154. form: {
  155. realInTime: '',
  156. inChannel: ''
  157. }
  158. },
  159. out: {
  160. visible: false,
  161. form: {
  162. realOutTime: '',
  163. outChannel: ''
  164. }
  165. }
  166. },
  167. methods: {
  168. checkFn(data) {
  169. sa.ajax('/TbBusiness/getById?id=' + data.businessId, function(resp) {
  170. let business = resp.data;
  171. if (!business.outReport) {
  172. //sa.error('未上传')
  173. }
  174. this.report.visible = true;
  175. this.report.business = business;
  176. }.bind(this))
  177. },
  178. inFn(data) {
  179. Object.assign(this.rc, {
  180. visible: true,
  181. form: data
  182. })
  183. },
  184. sureInFn() {
  185. if (!this.rc.form.realInTime) {
  186. sa.error('请填写入场时间')
  187. return;
  188. }
  189. if (!this.rc.form.inChannel) {
  190. sa.error('请填写入场通道')
  191. return;
  192. }
  193. sa.ajax('/TbBusinessCar/inCar', this.rc.form, function(res) {
  194. sa.alert('操作成功');
  195. this.rc.visible = false;
  196. this.f5();
  197. }.bind(this));
  198. },
  199. outFn(data) {
  200. Object.assign(this.out, {
  201. visible: true,
  202. form: data
  203. })
  204. },
  205. sureOutFn() {
  206. if (!this.out.form.realOutTime) {
  207. sa.error('请填写离场时间')
  208. return;
  209. }
  210. if (!this.out.form.outChannel) {
  211. sa.error('请填写离场通道')
  212. return;
  213. }
  214. sa.ajax('/TbBusinessCar/outCar', this.out.form, function(res) {
  215. sa.alert('操作成功');
  216. this.out.visible = false;
  217. this.f5();
  218. }.bind(this));
  219. },
  220. // 刷新
  221. f5: function() {
  222. sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
  223. this.dataList = res.data; // 数据
  224. this.dataCount = res.dataCount; // 数据总数
  225. sa.f5TableHeight(); // 刷新表格高度
  226. }.bind(this));
  227. },
  228. // 查看
  229. get: function(data) {
  230. sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id + '&businessId=' + this.p
  231. .businessId, '800px', '80%');
  232. },
  233. // 修改
  234. update: function(data) {
  235. sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
  236. .businessId, '500px', '70%');
  237. },
  238. // 新增
  239. add: function(data) {
  240. sa.showIframe('新增数据', 'tb-business-car-add.html?id=-1' + '&businessId=' + this.p.businessId,
  241. '550px', '80%');
  242. },
  243. // 删除
  244. del: function(data) {
  245. sa.confirm('是否删除,此操作不可撤销', function() {
  246. sa.ajax('/TbBusinessCar/delete?id=' + data.id, function(res) {
  247. sa.arrayDelete(this.dataList, data);
  248. sa.ok('删除成功');
  249. sa.f5TableHeight(); // 刷新表格高度
  250. }.bind(this))
  251. }.bind(this));
  252. },
  253. // 改 - 状态(0=否,1=是)
  254. updateStatus: function(data) {
  255. if (!sa.isAuth('tb-business-car-change')) {
  256. sa.error('无权限')
  257. return false;
  258. }
  259. // 声明变量记录是否成功
  260. var isOk = false;
  261. var oldValue = data.isLock;
  262. var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
  263. id: data.id,
  264. value: data.isLock
  265. }, function(res) {
  266. isOk = true;
  267. sa.msg('修改成功');
  268. }.bind(this));
  269. // 如果未能修改成功, 则回滚
  270. $.when(ajax).done(function() {
  271. if (isOk == false) {
  272. data.isLock = oldValue;
  273. }
  274. })
  275. },
  276. },
  277. created: function() {
  278. this.f5();
  279. sa.onInputEnter();
  280. }
  281. })
  282. </script>
  283. </body>
  284. </html>