<!--车辆排班   保养弹框-->
<template>
  <el-dialog :title="currentItem.title" :visible.sync="jinyong" width="10%">
    <el-form :model="currentItem"  ref="currentItem" label-width="120px">
      <el-form-item label="车牌号:">
        <span>{{currentItem.item.numberPlate}}</span>
      </el-form-item>
      <el-form-item label="当前停靠公司:">
        <span>{{currentItem.item.parkCompanyName}}</span>
      </el-form-item>
      <el-form-item label="还车公司:">
        <span>{{currentItem.ii.vehicleBookRecord.retCompanyName}}</span>
      </el-form-item>
      <el-form-item label="申请人:">
        <span>{{currentItem.ii.vehicleBookRecord.bookUserName}}</span>
      </el-form-item>
      <el-form-item label="禁用时间:">
        <span>{{currentItem.ii.vehicleBookRecord.bookStartDate}}~{{currentItem.ii.vehicleBookRecord.bookEndDate}}</span>
      </el-form-item>
      <el-form-item label="禁用说明:">
        <span>{{currentItem.ii.vehicleBookRecord.remark}}</span>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel()" v-if="bookRecord_btn_unbook">取消禁用</el-button>
    </div>
  </el-dialog>
</template>
<script>
  import {mapGetters} from 'vuex';
  import ElRow from "element-ui/packages/row/src/row";
  import ElCol from "element-ui/packages/col/src/col";
  import ElFormItem from "../../../../node_modules/element-ui/packages/form/src/form-item.vue";
  import {
    agreeBook,
    cancleBook,
    rejectBook
  } from 'api/vehicle/vehicleSchedulManage';
  export default {
    components: {
      ElFormItem,
      ElCol,
      ElRow},
    props: ["currentItem"],
    name: 'disableModal',
    data() {
      return {
        jinyong:false,
        bookRecord_btn_unbook:false,
      }
    },
    created() {
      this.bookRecord_btn_unbook = this.elements['bookRecord:btn_unbook'];
    },
    computed: {
      ...mapGetters([
        'elements',
      ]),
    },
    watch: {
      jinyong(newValue, oldValue){
        if(!newValue){
          this.$emit("jinyongDialogEvent", false);
        }
      },
    },
    mounted() {
      this.jinyong = true;
    },
    methods: {
      /**
       * 弹框-取消
       * */
      cancel() {
        console.log("取消禁用");
				var data = {
					"vehicleBookRecordId":this.currentItem.ii.vehicleBookRecord.id
				}
        cancleBook(data).then(response => {this.$emit("jinyongDialogEvent", true);});
      }
    }
  }
</script>

