<template>
  <div class="app-container calendar-list-container">
    <div class="filter-container" ref="filter-container">
      <el-form :rules="rules4Query" ref="queryForm" :inline="inline" :model="listQuery">
        <el-form-item label="分公司" prop="subordinateBranch">
          <el-select class="filter-item" v-model="listQuery.subordinateBranch" placeholder="请选择分公司">
            <el-option :key="undefined" label="无" :value="undefined"></el-option>
            <el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="">
          <el-input v-model="listQuery.numberPlate" placeholder="请输入车牌"></el-input>
        </el-form-item>

        <el-form-item label="">
          <el-input v-model="listQuery.vehicleCode" placeholder="请输入车辆编码"></el-input>
        </el-form-item>

        <el-form-item label="申请状态">
          <el-select class="filter-item" v-model="listQuery.status" placeholder="请选择申请状态">
            <el-option :key="undefined" label="无" :value="undefined"></el-option>
            <el-option v-for="(val, key, index)   in getAllBookRecordStatus() " :key="val.code" :label="val.val"
                       :value="val.code"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="请选择预订月份" prop="selectedMonth4Query">
          <el-date-picker
            v-model="selectedMonth4Query"
            type="month"
            :editable="true"
            format="yyyy-MM"
            placeholder="请选择预订月份">
          </el-date-picker>
        </el-form-item>

        <el-button class="filter-item" type="primary" v-waves icon="search" @click="handleFilter">搜索</el-button>
      </el-form>
    </div>


    <el-table :key='tableKey' :data="list" v-loading.body="listLoading" border fit highlight-current-row
              style="width: 100%">
      <el-table-column align="center" label="车辆编号" width="65">
        <template scope="scope">
          <span>{{scope.row.vehicleCode}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="车牌号" width="120">
        <template scope="scope">
          <span>{{scope.row.numberPlate}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="所属公司" width="120">
        <template scope="scope">
          <span>{{scope.row.subBranchName}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="申请状态" width="65">
        <template scope="scope">
          <span>{{getBookRecordStatus(scope.row.status)}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="申请用户" width="65">
        <template scope="scope">
          <span>{{scope.row.bookUserName}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="预定日期" width="220">
        <template scope="scope">
        <span
          v-if="checkIfApply(scope.row.status) && checkIfBooked(scope.row.bookedDate, [scope.row.bookStartDate, scope.row.bookEndDate])"
          style="color: red">
          {{getDatePeriodStr([scope.row.bookStartDate, scope.row.bookEndDate])}}(已被预订)
        </span>
          <span v-else>{{getDatePeriodStr([scope.row.bookStartDate, scope.row.bookEndDate])}}</span>

        </template>
      </el-table-column>

      <!--      <el-table-column align="center" label="提车地址" width="200">-->
      <!--        <template scope="scope">-->
      <!--          <span>{{scope.row.liftAddr}}</span>-->
      <!--        </template>-->
      <!--      </el-table-column>-->

      <el-table-column align="center" label="目的地" width="200">
        <template scope="scope">
          <span>{{scope.row.destination}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="备注" width="200">
        <template scope="scope">
          <span>{{scope.row.remark}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="申请审核人" width="120">
        <template scope="scope">
          <span>{{scope.row.reviewerNameApply}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="取消人" width="100">
        <template scope="scope">
          <span>{{scope.row.reviewerNameCancel}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="提车地点" width="120">
        <template scope="scope">
          <span>{{scope.row.liftCompanyName}}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="提车审核人" width="120">
        <template scope="scope">
          <span>{{scope.row.reviewerNameLift}}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="提车时间" width="120">
        <template scope="scope">
          <span>{{scope.row.actualStartDate}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="还车地点" width="120">
        <template scope="scope">
          <span>{{scope.row.retCompanyName}}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="还车审核人" width="120">
        <template scope="scope">
          <span>{{scope.row.reviewerNameReturn}}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="还车时间" width="120">
        <template scope="scope">
          <span>{{scope.row.actualEndDate}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="随车物品" width="120">
        <template scope="scope">
          <el-button size="small" type="success" @click="handleAccItemInfo(scope.row)">查看随车物品</el-button>
        </template>
      </el-table-column>


      <el-table-column align="center" label="提车里程数" width="100">
        <template scope="scope">
          <span>{{scope.row.mileageLift}}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="还车里程数" width="100">
        <template scope="scope">
          <span>{{scope.row.mileageRet}}</span>
        </template>
      </el-table-column>

      <el-table-column width="65" align="center" label="是否违章">
        <template scope="scope">
          <span>{{scope.row.haveViolation?'是':'否'}}</span>
        </template>
      </el-table-column>


      <el-table-column align="center" label="操作" width="250">
        <template scope="scope">
          <el-button size="small" type="success" @click="handleBookInfo(scope.row)">预订信息</el-button>
          <el-button
            v-if="bookRecord_btn_prove && checkIfApply(scope.row.status) && !checkIfBooked(scope.row.bookedDate, [scope.row.bookStartDate, scope.row.bookEndDate])"
            size="small" type="success" @click="handleProve(scope.row)">通过
          </el-button>
          <el-button
            v-if="bookRecord_btn_reject && checkIfApply(scope.row.status)  && !checkIfBooked(scope.row.bookedDate, [scope.row.bookStartDate, scope.row.bookEndDate]) "
            size="small" type="danger" @click="handleReject(scope.row)">拒绝
          </el-button>
          <el-button v-if="bookRecord_btn_lift  && checkIfProved(scope.row.status)" size="small" type="success"
                     @click="handleLift(scope.row)">提车
          </el-button>
          <el-button v-if="bookRecord_btn_ret  && checkIfLift(scope.row.status)" size="small" type="success"
                     @click="handleRet(scope.row)">还车
          </el-button>
          <el-button v-if="bookRecord_btn_unbook  && checkIfProved(scope.row.status)" size="small" type="danger"
                     @click="handleUnbook(scope.row)">取消预定
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <div v-show="!listLoading" class="pagination-container">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                     :current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit"
                     layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
    </div>

    <book-info-viewer ref="bookInfoViewer"></book-info-viewer>
    <acc-item-selector :selectedAccItem="selectedAccItem" :isReadOnly="true" ref="accItemSelector"></acc-item-selector>


    <!--     提车对话框相关html元素  -->
    <el-dialog title="提车" :visible.sync="dialogForm4LiftVisible">

      <el-form :model="form4Lift" :rules="rules4Lift" ref="form4Lift" label-width="120px">

        <el-form-item label="提车分公司" prop="liftCompany">
          <el-select class="filter-item" v-model="form4Lift.liftCompany" placeholder="请选择提车分公司">
            <el-option :key="undefined" label="无" :value="undefined"></el-option>
            <el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="提车里程数" prop="mileageLift">
          <el-input v-model.number="form4Lift.mileageLift" placeholder="请输入当前车辆里程数"></el-input>
        </el-form-item>

        <el-form-item label="提车备注" prop="liftRemark">
          <el-input v-model="form4Lift.liftRemark" placeholder="请输入备注信息"></el-input>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelDialog4Lift('form4Lift')">取 消</el-button>
        <el-button type="primary" @click="lift('form4Lift')">确 定</el-button>
      </div>
    </el-dialog>

    <!--     提车对话框相关html元素  -->
    <el-dialog title="还车" :visible.sync="dialogForm4RetVisible">

      <el-form :model="form4Ret" :rules="rules4Ret" ref="form4Ret" label-width="120px">

        <el-form-item label="还车分公司" prop="retCompany">
          <el-select class="filter-item" v-model.number="form4Ret.retCompany" placeholder="请选择还车分公司">
            <el-option :key="undefined" label="无" :value="undefined"></el-option>
            <el-option v-for="item in allCompanies" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="还车里程数" prop="mileageRet">
          <el-input v-model.number="form4Ret.mileageRet" placeholder="请输入当前车辆里程数"></el-input>
        </el-form-item>

        <el-form-item label="是否违章" prop="haveViolation">
          <el-select class="filter-item" v-model="form4Ret.haveViolation" placeholder="请选择是否违章">
            <el-option key="1" label="是" value="1"></el-option>
            <el-option key="0" label="否" value="0"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="还车备注" prop="retRemark">
          <el-input v-model="form4Ret.retRemark" placeholder="请输入备注信息"></el-input>
        </el-form-item>


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelDialog4Ret('form4Ret')">取 消</el-button>
        <el-button type="primary" @click="ret('form4Ret')">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import {
    page,
    prove,
    reject,
    getObj,
    lift,
    ret,
    unbook
  } from 'api/vehicle/bookRecord';


  import {
    getAllCompany
  } from 'api/base_info/branch_company/';

  import {
    formatDate
  } from 'utils/dateFormattor';

  import rsCode from '../../../utils/rsCode';

  import {mapGetters} from 'vuex';

  import {
    toEast8Date,
    deepCopyDate,
    newEast8Date
  } from 'utils/dateUtils';

  import {
    BOOK_RECORD_STATUS_APPLY,
    BOOK_RECORD_STATUS_PROVED,
    BOOK_RECORD_STATUS_LIFT
  } from '../../../store/modules/baseInfo';

  import bookInfoViewer from '../bookInfoViewer';
  import accItemSelector from '../accompanyingItem/accItemSelector.vue';

  export default {
    name: 'bookRecord',
    components: {
      bookInfoViewer,
      accItemSelector
    },
    data() {
      return {
        rules4Query: {
          selectedMonth4Query: [
            {
              validator: (rule, value, callback) => {
                if (this.$utils.isUndefined(this.selectedMonth4Query) || !this.$utils.isDate(this.selectedMonth4Query)) {
                  return callback(new Error('请选择月份'));
                }
                callback();
              },
              trigger: 'blur'
            }
          ]
        },
        list: null,
        total: null,
        listLoading: true,
        listQuery: {
          page: 1,
          limit: 20,
          subordinateBranch: undefined,
          numberPlate: undefined,
          selectedMonth: formatDate(newEast8Date(), 'yyyy-MM'),
          vehicleCode: undefined,
          status: undefined
        },
        inline: true,
        dialogFormVisible: false,
        dialogStatus: '',
        bookRecord_btn_prove: false,
        bookRecord_btn_unbook: false,
        bookRecord_btn_reject: false,
        bookRecord_btn_lift: false,
        bookRecord_btn_ret: false,
        dialogForm4LiftVisible: false,
        dialogForm4RetVisible: false,
        allCompanies: {},
        tableKey: 0,
        form4Lift: {
          id: undefined,
          mileageLift: undefined,
          liftCompany: undefined,
          liftRemark: undefined
        },
        rules4Lift: {
          liftCompany: [
            {
              required: true,
              message: '请选择提车分公司',
              trigger: 'blur',
              type: 'integer'
            }
          ],
          mileageLift: [
            {
              required: true,
              message: '请输入当前里程数',
              trigger: 'blur',
              type: 'integer'
            },
            {
              validator: (rule, value, callback) => {
                if (this.$utils.isUndefined(value) || this.$utils.isNull(value)) {
                  return callback();
                }
                if (!this.$utils.isInteger(value)) {
                  return callback(new Error('里程数必须为整数'));
                }
                if (value < 0 || value > 9999999999) {
                  return callback(new Error('里程数合法范围：[0 - 9999999999]'));
                }
                callback();
              },
              trigger: 'blur'
            }
          ],
          retRemark: [
            {
              min: 0,
              max: 2000,
              message: '长度小于 2000 个字符',
              trigger: 'blur'
            }
          ]
        },
        form4Ret: {
          id: undefined,
          mileageRet: undefined,
          haveViolation: undefined,
          retCompany: undefined,
          retRemark: undefined
        },
        rules4Ret: {
          retCompany: [
            {
              required: true,
              message: '请选择提车分公司',
              trigger: 'blur',
              type: 'integer'
            }
          ],
          mileageRet: [
            {
              required: true,
              message: '请输入当前里程数',
              trigger: 'blur',
              type: 'integer'
            },
            {
              validator: (rule, value, callback) => {
                if (this.$utils.isUndefined(value) || this.$utils.isNull(value)) {
                  return callback();
                }
                if (!this.$utils.isInteger(value)) {
                  return callback(new Error('里程数必须为整数'));
                }
                if (value < 0 || value > 9999999999) {
                  return callback(new Error('里程数合法范围：[0 - 9999999999]'));
                }
                callback();
              },
              trigger: 'blur'
            }
          ],
          retRemark: [
            {
              min: 0,
              max: 2000,
              message: '长度小于 2000 个字符',
              trigger: 'blur'
            }
          ]
        },
        selectedAccItem: undefined
      }
    },
    created() {
      this.getList();
      getAllCompany(codeAndBranchCompany => {//初始化公司列表
        this.allCompanies = codeAndBranchCompany;
      });
      this.bookRecord_btn_prove = this.elements['bookRecord:btn_prove'];
      this.bookRecord_btn_unbook = this.elements['bookRecord:btn_unbook'];
      this.bookRecord_btn_reject = this.elements['bookRecord:btn_reject'];
      this.bookRecord_btn_lift = this.elements['bookRecord:btn_lift'];
      this.bookRecord_btn_ret = this.elements['bookRecord:btn_ret'];
    },
    computed: {
      ...mapGetters([
        'elements',
        'bookRecordStatus'
      ]),
      selectedMonth4Query: {
        get: function () {
          if (this.$utils.isString(this.listQuery.selectedMonth) && this.listQuery.selectedMonth !== '') {
            return toEast8Date(this.listQuery.selectedMonth);
          }
          return undefined;
        },
        set: function (date) {
          if (this.$utils.isDate(date)) {
            this.listQuery.selectedMonth = formatDate(date, 'yyyy-MM');
          } else {
            this.listQuery.selectedMonth = undefined;
          }
        }
      }
    },
    methods: {
      cancelDialog4Lift(formName) {
        this.dialogForm4LiftVisible = false;
        this.$refs[formName].resetFields();
      },
      cancelDialog4Ret(formName) {
        this.dialogForm4RetVisible = false;
        this.$refs[formName].resetFields();
      },
      lift(formName) {
        const set = this.$refs;
        set[formName].validate(valid => {
          if (valid) {
            lift(this.form4Lift).then((response) => {
              if (response.code === rsCode.code.VEHICLE_BOOKED_RECORD_STATUS_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_RECORD_STATUS_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.RS_CODE_SUC) {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
                this.dialogForm4LiftVisible = false;
                this.getList();
              } else {
                this.$notify({
                  title: '失败',
                  message: '操作失败',
                  type: 'error',
                  duration: 2000
                });
              }
            });
          } else {
            return false;
          }
        });
      },
      handleBookInfo(row) {
        this.$refs.bookInfoViewer.handleBookInfo(row.vehicle);
      },
      handleAccItemInfo(row) {
        this.selectedAccItem = row.accItemAndAmount;
        this.$refs.accItemSelector.show();
      },
      checkIfBooked(bookedDate, [startDateStr, endDateStr]) {
        if (this.$utils.isInteger(bookedDate) &&
          this.$utils.isString(startDateStr) && startDateStr !== '' &&
          this.$utils.isString(endDateStr) && endDateStr !== '') {
          let startDate = toEast8Date(startDateStr);
          let endDate = toEast8Date(endDateStr);
          for (; this.$utils.toDateString(startDate, 'yyyy-MM-dd') <= this.$utils.toDateString(endDate, 'yyyy-MM-dd');
                 startDate.setDate(startDate.getDate() + 1)) {
            if ((bookedDate & (1 << (startDate.getDate() - 1))) !== 0) {
              return true;
            }
          }
        }
        return false;
      },
      checkIfApply(code) {
        return code === BOOK_RECORD_STATUS_APPLY;
      },
      checkIfProved(code) {
        return code === BOOK_RECORD_STATUS_PROVED;
      },
      checkIfLift(code) {
        return code === BOOK_RECORD_STATUS_LIFT;
      },
      getList() {
        this.listLoading = true;
        page(this.listQuery)
          .then(response => {
            this.list = response.data.data;
            this.total = response.data.totalCount;
            this.listLoading = false;
          })
      },
      getBookRecordStatus: function (code) {
        if (!this.$utils.isInteger(code)) {
          return '未知';
        }
        return this.bookRecordStatus[code + ''].val;
      },
      getAllBookRecordStatus: function () {
        return this.bookRecordStatus;
      },
      getDatePeriodStr([startDate, endDate]) {
        if (this.$utils.isString(startDate) && startDate !== '' &&
          this.$utils.isString(endDate) && endDate !== '') {
          return formatDate(toEast8Date(startDate), 'yyyy-MM-dd') + ' 至 ' + formatDate(toEast8Date(endDate), 'yyyy-MM-dd');
        }
        return '未知';
      },
      handleFilter() {
        this.$refs.queryForm.validate(valid => {

          if (valid) {
            this.getList();
          } else {
            return false;
          }
        });
      },
      handleSizeChange(val) {
        this.listQuery.limit = val;
        this.getList();
      },
      handleCurrentChange(val) {
        this.listQuery.page = val;
        this.getList();
      },
      handleProve(row) {
        this.$confirm('确定批准申请?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          prove(row.id)
            .then(response => {
              if (response.code === rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.code.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.RS_CODE_SUC) {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
              }
              this.getList();
            });
        });
      },
      handleReject(row) {
        this.$confirm('确定拒绝申请?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          reject(row.id)
            .then(response => {
              if (response.code === rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.code.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.RS_CODE_SUC) {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
              }
              this.getList();
            });
        });
      },
      handleLift(row) {
        this.resetTemp4Lift();
        getObj(row.id, row.bookEndDate)
          .then(response => {
            if (!this.$utils.isEmpty(response.data) && this.$utils.isInteger(response.data.liftCompany)) {
              this.form4Lift.liftCompany = response.data.liftCompany;
            }
            this.form4Lift.id = row.id;
            this.dialogForm4LiftVisible = true;
          });
      },
      handleRet(row) {
        this.resetTemp4Ret();
        getObj(row.id, row.bookEndDate)
          .then(response => {
            if (!this.$utils.isEmpty(response.data) && this.$utils.isInteger(response.data.retCompany)) {
              this.form4Ret.retCompany = response.data.retCompany;
            }
            this.form4Ret.id = row.id;
            this.dialogForm4RetVisible = true;
          });
      },
      ret(formName) {
        const set = this.$refs;
        set[formName].validate(valid => {
          if (valid) {
            ret(this.form4Ret).then((response) => {
              if (response.code === rsCode.code.VEHICLE_BOOKED_RECORD_STATUS_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_RECORD_STATUS_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.RS_CODE_SUC) {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
                this.dialogForm4RetVisible = false;
                this.getList();
              } else {
                this.$notify({
                  title: '失败',
                  message: '操作失败',
                  type: 'error',
                  duration: 2000
                });
              }
            });
          } else {
            return false;
          }
        });
      },
      handleUnbook(row) {
        this.$confirm('确定取消预定?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          unbook(row.id)
            .then(response => {
              if (response.code === rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_INFO_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.code.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED) {
                this.$notify({
                  title: '失败',
                  message: rsCode.msg[rsCode.code.VEHICLE_BOOKED_RECORD_ALREADY_CHANGED],
                  type: 'error',
                  duration: 2000
                });
              } else if (response.code === rsCode.RS_CODE_SUC) {
                this.$notify({
                  title: '成功',
                  message: '操作成功',
                  type: 'success',
                  duration: 2000
                });
              }
              this.getList();
            });
        });
      },
      resetTemp4Lift() {
        this.form4Lift = {
          id: undefined,
          mileageLift: undefined,
          liftCompany: undefined,
          liftRemark: undefined
        };
      },
      resetTemp4Ret() {
        this.form4Ret = {
          id: undefined,
          mileageRet: undefined,
          haveViolation: undefined,
          retCompany: undefined,
          retRemark: undefined
        };
      }
    }
  }
</script>
