123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>-列表</title>
- <meta charset="utf-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css & js 资源 -->
- <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <style>
- .car-size .el-input__inner {
- width: 130px;
- }
- </style>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <div class="c-panel">
- <div class="fast-btn">
- <el-button size="mini" type="primary" @click="add()"
- v-if="sa.isAuth('tb-flex-business-edit')&&confirm==0">
- 新增
- </el-button>
- <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
- </div>
- <!-- ------------- 数据列表 ------------- -->
- <el-table class="data-table" ref="data-table" :data="dataList">
- <sa-td name="车牌号" prop="carNo" width=120></sa-td>
- <sa-td name="入场时间" prop="realInTime" width=160></sa-td>
- <sa-td name="离场时间" prop="realOutTime" width=160></sa-td>
- <sa-td name="入场通道" prop="inChannel" width=180></sa-td>
- <sa-td name="离场通道" prop="outChannel" width=180></sa-td>
- <el-table-column label="停车费">
- <template slot-scope="s">
- <label v-if="s.row.money">{{s.row.money}}</label>
- <label v-else>-</label>
- </template>
- </el-table-column>
- <sa-td width="130" name="支付状态" prop="payType">
- </sa-td>
- <el-table-column label="操作" width="100px" fixed="right">
- <template slot-scope="s">
- <el-button v-if="sa.isAuth('tb-flex-business-edit')
- &&s.row.pay==0
- &&s.row.payUnloadMoney==0" class="c-btn" type="danger" @click="del(s.row)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-dialog title="添加车辆" :visible.sync="modal.visible" width="400px">
- <el-form>
- <sa-item type="text" name="车牌号" v-model="modal.form.carNo" br need></sa-item>
- <div class="c-item">
- <label class="c-label">车辆类型:</label>
- <el-select v-model="modal.form.carType" placeholder="请选择">
- <el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
- </el-option>
- </el-select>
- </div>
- <div class="c-item">
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="modal.visible = false">取 消</el-button>
- <el-button type="primary" @click="sureAddFn">确 认</el-button>
- </span>
- </el-dialog>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
- },
- el: '.vue-box',
- data: {
- report: {
- visible: false,
- business: {},
- },
- payStatus: sa.p('payStatus', 1),
- confirm: sa.p('confirm', 0),
- p: { // 查询参数
- businessId: sa.p('id', ''), //
- carNo: '', //
- },
- dataCount: 0,
- dataList: [], // 数据集合
- carTypeList: [],
- modal: {
- visible: false,
- form: {
- carNo: '',
- carSize: 13,
- carType: '载重',
- netWeight: 0
- }
- },
- },
- methods: {
- getItemType() {
- sa.ajax('/TbItem/getItemType', function(resp) {
- let list = resp.data;
- if (list.length > 0) {
- this.modal.form.carType = list[0].name;
- }
- this.carTypeList = list;
- }.bind(this))
- },
- sureAddFn() {
- let data = this.modal.form;
- if (!data.carNo) {
- sa.error('请填写车牌号')
- return;
- }
- data.businessId = this.p.businessId;
- sa.ajax('/TbBusiness/addCar', data, function(res) {
- sa.alert('添加成功');
- this.modal.visible = false;
- this.f5();
- }.bind(this));
- },
- // 刷新
- f5: function() {
- sa.ajax('/TbBusinessCar/getBusinessByBusinessCarId', sa.removeNull(this.p), function(res) {
- this.dataList = res.data; // 数据
- this.dataCount = res.dataCount; // 数据总数
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this));
- },
- // 查看
- get: function(data) {
- sa.showIframe('数据详情', 'tb-business-car-info.html?id=' + data.id + '&businessId=' + this.p
- .businessId, '800px', '80%');
- },
- // 修改
- update: function(data) {
- sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
- .businessId, '500px', '70%');
- },
- // 新增
- add: function(data) {
- Object.assign(this.modal, {
- visible: true,
- form: {
- carNo: '',
- carSize: 13,
- carType: '重车',
- netWeight: 0
- }
- })
- },
- // 删除
- del: function(data) {
- sa.confirm('是否删除,此操作不可撤销', function() {
- sa.ajax('/TbBusiness/deleteBusinessCar?id=' + data.id + '&businessId=' + this.p
- .businessId,
- function(res) {
- sa.arrayDelete(this.dataList, data);
- sa.ok('删除成功');
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this))
- }.bind(this));
- },
- // 改 - 状态(0=否,1=是)
- updateStatus: function(data) {
- if (!sa.isAuth('tb-business-car-change')) {
- sa.error('无权限')
- return false;
- }
- // 声明变量记录是否成功
- var isOk = false;
- var oldValue = data.isLock;
- var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
- id: data.id,
- value: data.isLock
- }, function(res) {
- isOk = true;
- sa.msg('修改成功');
- }.bind(this));
- // 如果未能修改成功, 则回滚
- $.when(ajax).done(function() {
- if (isOk == false) {
- data.isLock = oldValue;
- }
- })
- },
- },
- created: function() {
- this.f5();
- this.getItemType();
- sa.onInputEnter();
- }
- })
- </script>
- </body>
- </html>
|