<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
      <el-form-item label="报修单号" prop="repairNumber">
        <el-input
          v-model="queryParams.repairNumber"
          placeholder="请输入报修单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="车牌号" prop="plateNumber">
        <el-input
          v-model="queryParams.plateNumber"
          placeholder="请输入车牌号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="结算状态" prop="state">-->
<!--        <el-input-->
<!--          v-model="queryParams.state"-->
<!--          placeholder="请输入结算状态"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="客户名称" prop="clientName">
        <el-input
          v-model="queryParams.clientName"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系方式" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入联系方式"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否交车" prop="isDelivery">
        <el-select v-model="queryParams.isDelivery" placeholder="请选择是否交车">
          <el-option v-for="item in dict.type.repair_form_is_delivery" :key="item.value" :value="item.value" :label="item.label" />
        </el-select>
      </el-form-item>
      <el-form-item label="交车时间" prop="deliveryTime">
        <el-date-picker value-format="yyyy-MM-dd HH:mm:ss"
                        v-model="deliveryTime"
                        type="datetimerange"
                        :default-time="['00:00:00', '23:59:59']"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-check"
          size="mini"
          :disabled="multiple"
          @click="handleSettle"
        >结算</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="repairFormList" ref="table" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" fixed="left"/>
      <el-table-column label="序号" align="center" type="index" fixed="left" />
      <el-table-column label="报修单号" align="center" prop="repairNumber" fixed="left" />
      <el-table-column label="客户类型" align="center" prop="client.type" fixed="left">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.client_type" :value="scope.row.client.type"/>
        </template>
      </el-table-column>
      <el-table-column label="客户名称" align="center" prop="client.name" width="120" fixed="left" show-overflow-tooltip/>
      <el-table-column label="联系方式" align="center" prop="client.phone" min-width="130px" show-overflow-tooltip />
      <el-table-column label="车辆品牌" align="center" prop="car.carBrand" />
      <el-table-column label="车牌号" align="center" prop="car.plateNumber" width="100" />
      <el-table-column label="总工时" align="center" prop="totalActualTime" />
      <el-table-column label="工时费用（元）" align="center" prop="totalActualTimeMoney" min-width="120px" />
      <el-table-column label="材料费用（元）" align="center" prop="totalMaterialMoney" min-width="120px" />
      <el-table-column label="拖车费用（元）" align="center" prop="trailerMoney" min-width="120px" />
      <el-table-column label="结算总价（元）" align="center" prop="totalMoney" min-width="120px" />
      <el-table-column label="交工时间" align="center" prop="deliveryTime" min-width="150px" />
      <el-table-column label="结算时间" align="center" prop="settlementTime" min-width="150px" />
      <el-table-column label="登记时间" align="center" prop="createTime" min-width="150px" />
      <el-table-column label="登记人员" align="center" prop="createBy" min-width="100px" />
      <el-table-column label="是否交车" align="center" prop="isDelivery" width="50" fixed="right">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.repair_form_is_delivery" :value="scope.row.isDelivery" />
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="state" width="60" fixed="right">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.repair_form_state" :value="scope.row.state" />
        </template>
      </el-table-column>
      <el-table-column label="结算状态" align="center" prop="settlementState" width="60" fixed="right">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.repair_form_settlement_state" :value="scope.row.settlementState" />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-document"
            @click="handleDetail(scope.row)"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改报修单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
      <el-scrollbar style="height: 75vh;">
        <el-form ref="form" :model="form" :rules="rules" label-width="110px">
          <span style="font-weight: bold; font-size: 18px">客户信息</span>
          <el-divider />
          <el-row>
            <el-col :span="6">
              <el-form-item label="客户" prop="clientId">
                <el-select v-model="form.clientId" filterable @change="clientChange" placeholder="请选择客户">
                  <el-option v-for="item in clientOpt" :key="item.id" :value="item.id" :label="item.name" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="客户手机号" prop="clientPhone">
                <el-input v-model="form.clientPhone" disabled placeholder="请输入客户手机号" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件类型" prop="clientCertificateType">
                <el-select v-model="form.clientCertificateType" disabled placeholder="请选择证件类型">
                  <el-option v-for="item in dict.type.zhengjianleixing" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件号" prop="clientCertificateNumber">
                <el-input v-model="form.clientCertificateNumber" disabled placeholder="请输入证件号" />
              </el-form-item>
            </el-col>
          </el-row>
          <span style="font-weight: bold; font-size: 18px">报修信息</span>
          <el-divider />
          <el-table v-loading="loading" :data="settlementRepairFormList">
            <!--          <el-table-column type="selection" width="55" align="center" />-->
            <el-table-column label="序号" align="center" type="index" />
            <el-table-column label="报修单号" align="center" prop="repairNumber" />
            <el-table-column label="客户类型" align="center" prop="repairNumber">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.client_type" :value="scope.row.client.type"/>
              </template>
            </el-table-column>
            <el-table-column label="客户名称" align="center" prop="client.name" />
            <el-table-column label="联系方式" align="center" prop="client.phone" min-width="130px" show-overflow-tooltip />
            <el-table-column label="车辆品牌" align="center" prop="car.carBrand" />
            <el-table-column label="车牌号" align="center" prop="car.plateNumber" />
            <el-table-column label="总工时" align="center" prop="totalActualTime" />
            <el-table-column label="工时费用（元）" align="center" prop="totalActualTimeMoney" min-width="120px" />
            <el-table-column label="材料费用（元）" align="center" prop="totalMaterialMoney" min-width="120px" />
            <el-table-column label="拖车费用（元）" align="center" prop="trailerMoney" min-width="120px" />
            <el-table-column label="结算总价（元）" align="center" prop="totalMoney" min-width="120px" />
            <el-table-column label="交工时间" align="center" prop="deliveryTime" min-width="150px" />
            <el-table-column label="结算时间" align="center" prop="settlementTime" min-width="150px" />
            <el-table-column label="登记时间" align="center" prop="createTime" min-width="150px" />
            <el-table-column label="登记人员" align="center" prop="createBy" min-width="100px" />
            <el-table-column label="是否交车" align="center" prop="isDelivery" fixed="right">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.repair_form_is_delivery" :value="scope.row.isDelivery" />
              </template>
            </el-table-column>
            <el-table-column label="状态" align="center" prop="state" fixed="right">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.repair_form_state" :value="scope.row.state" />
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button size="mini" type="text" icon="el-icon-delete" @click="handleRowDelete(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <span style="font-weight: bold; font-size: 18px">结算信息</span>
          <el-divider />
          <el-row>
            <el-col :span="6">
              <el-form-item label="工时费" prop="totalActualTimeMoney">
                <el-input-number v-model="form.totalActualTimeMoney" :min="0" disabled style="width: 100%" placeholder="请输入工时费" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="原料费" prop="totalMaterialMoney">
                <el-input-number v-model="form.totalMaterialMoney" :min="0" disabled style="width: 100%" placeholder="请输入原料费" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="拖车费" prop="totalTrailerMoney">
                <el-input-number v-model="form.totalTrailerMoney" :min="0" disabled style="width: 100%" placeholder="请输入拖车费" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="总费用" prop="totalMoney">
                <el-input-number v-model="form.totalMoney" :min="0" disabled style="width: 100%" placeholder="请输入总费用" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <!--          <el-col :span="6">-->
            <!--            <el-form-item label="结算单号" prop="settlementNumber">-->
            <!--              <el-input v-model="form.settlementNumber" disabled placeholder="自动生成" />-->
            <!--            </el-form-item>-->
            <!--          </el-col>-->
            <el-col :span="6">
              <el-form-item label="工时费优惠" prop="manHourDiscountMoney">
                <el-input-number v-model="form.manHourDiscountMoney" :min="0" :max="form.totalActualTimeMoney" @change="moneyChange" style="width: 100%" placeholder="请输入工时费优惠" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="原料费优惠" prop="materialDiscountMoney">
                <el-input-number v-model="form.materialDiscountMoney" :min="0" :max="form.totalMaterialMoney" @change="moneyChange" style="width: 100%" placeholder="请输入原料费优惠" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="应收金额" prop="receivableMoney">
                <el-input-number v-model="form.receivableMoney" disabled :min="0" style="width: 100%" placeholder="请输入应收金额" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="结算金额" prop="practicalMoney">
                <el-input-number v-model="form.practicalMoney" disabled :min="0" style="width: 100%" placeholder="请输入结算金额" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row >
            <el-col :span="6">
              <el-form-item label="支付方式" prop="paymentMethod">
                <el-select v-model="form.paymentMethod" placeholder="请选择支付方式">
                  <el-option v-for="item in dict.type.settlement_payment_method" :key="item.value" :value="parseInt(item.value)" :label="item.label" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="结算时间" prop="settlementTime">
                <el-date-picker clearable
                                v-model="form.settlementTime"
                                type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                style="width: 100%"
                                placeholder="请选择结算时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="clientType == 2">
              <el-form-item label="付款账号" prop="paymentAccount">
                <el-input v-model="form.paymentAccount" placeholder="请输入付款账号"/>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="clientType == 2">
              <el-form-item label="账号名称" prop="paymentAccountName">
                <el-input v-model="form.paymentAccountName" placeholder="请输入账号名称"/>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="结算单备注" prop="settlementRemark">
                <el-input v-model="form.settlementRemark" type="textarea" rows="2" placeholder="请输入结算单备注" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="付款凭证" prop="paymentVoucher">
                <ImageUpload v-model="form.paymentVoucher" :limit="1" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-scrollbar>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 详情对话框 -->
    <el-dialog :title="title" :visible.sync="open1" width="80%" append-to-body>
      <el-scrollbar style="height: 75vh;">
        <detail :repairFormId="repairFormId" />
      </el-scrollbar>
    </el-dialog>

  </div>
</template>

<script>
import { getRepairForm, listRepairForm } from '@/api/business/repairForm'
import { listClient } from '@/api/business/client'
import {
  addSettlementMaintain,
  delSettlementMaintain,
  updateSettlementMaintain
} from '@/api/business/settlementMaintain'
import Detail from '@/views/business/repairForm/detail.vue'

export default {
  name: "RepairForm",
  components: { Detail },
  dicts: ['client_type', 'zhengjianleixing', 'settlement_payment_method', 'repair_form_is_delivery','repair_form_state', 'repair_form_settlement_state'],
  props: {
    clientType:{}
  },
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      repairFormId: undefined,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报修单表格数据
      repairFormList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        repairNumber: undefined,
        plateNumber: undefined,
        clientName: undefined,
        clientPhone: undefined,
        isDelivery: undefined,
        stateList: [1, 2],
        settlementState: 1
      },
      // 表单参数
      form: {},
      deliveryTime: [],
      settlementRepairFormList: [],
      clientOpt: [],
      // 表单校验
      rules: {
        clientId: [
          { required: true, message: "客户不能为空", trigger: "blur" }
        ],
        clientName: [
          { required: true, message: "客户名称不能为空", trigger: "blur" }
        ],
        clientPhone: [
          { required: true, message: "客户手机号不能为空", trigger: "blur" }
        ],
        clientType: [
          { required: true, message: "客户类型不能为空", trigger: "change" }
        ],
        clientCertificateType: [
          { required: true, message: "证件类型不能为空", trigger: "change" }
        ],
        clientCertificateNumber: [
          { required: true, message: "证件号不能为空", trigger: "blur" }
        ],
        manHourDiscountMoney: [
          { required: true, message: "工时费优惠不能为空", trigger: "blur" }
        ],
        materialDiscountMoney: [
          { required: true, message: "原料费优惠不能为空", trigger: "blur" }
        ],
        settlementTime: [
          { required: true, message: "结算时间不能为空", trigger: "blur" }
        ],
        paymentMethod: [
          { required: true, message: "支付方式不能为空", trigger: "blur" }
        ],
        paymentAccount: [
          { required: true, message: "付款账号不能为空", trigger: "blur" }
        ],
        paymentAccountName: [
          { required: true, message: "账号名称不能为空", trigger: "blur" }
        ],
        paymentVoucher: [
          { required: true, message: "付款凭证不能为空", trigger: "blur" }
        ],
      },
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            start.setHours(0, 0, 0, 0); // 时分秒毫秒归零
            end.setHours(23, 59, 59, 999); // 23:59:59.999
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            start.setHours(0, 0, 0, 0); // 时分秒毫秒归零
            end.setHours(23, 59, 59, 999); // 23:59:59.999
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            start.setHours(0, 0, 0, 0); // 时分秒毫秒归零
            end.setHours(23, 59, 59, 999); // 23:59:59.999
            picker.$emit('pick', [start, end]);
          }
        }]
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询报修单列表 */
    getList() {
      this.loading = true;
      this.queryParams.clientType = this.clientType
      if (this.deliveryTime.length > 0) {
        this.queryParams.deliveryStartTime = this.deliveryTime[0]
        this.queryParams.deliveryEndTime = this.deliveryTime[1]
      }else {
        this.queryParams.deliveryStartTime = undefined
        this.queryParams.deliveryEndTime = undefined
      }
      listRepairForm(this.queryParams).then(response => {
        this.repairFormList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        clientId: undefined,
        clientName: undefined,
        clientPhone: undefined,
        clientType: undefined,
        clientCertificateType: undefined,
        clientCertificateNumber: undefined,
        totalActualTimeMoney: 0,
        totalMaterialMoney: 0,
        totalTrailerMoney: 0,
        totalMoney: 0,
        receivableMoney: 0,
        practicalMoney: 0,
        settlementNumber: undefined,
        settlementTime: undefined,
        manHourDiscountMoney: 0,
        materialDiscountMoney: 0,
        paymentMethod: undefined,
        paymentVoucher: undefined,
        settlementRemark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.deliveryTime = []
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selectedRows) {
      this.ids = selectedRows.map(item => item.id)
      this.multiple = !selectedRows.length
      if (selectedRows.length === 0) {
        this.settlementRepairFormList = [];
        return;
      }
      const firstCustomerId = selectedRows[0].clientId;
      const clientName = selectedRows[0].client.name;
      this.form.clientId = firstCustomerId
      this.form.clientName = clientName
      const allSame = selectedRows.every(row => row.clientId === firstCustomerId);
      if (!allSame) {
        this.$modal.msgError('请勾选相同客户报修单')
        // 恢复到上一次有效的选中状态
        this.$nextTick(() => {
          this.$refs.table.clearSelection();
          this.settlementRepairFormList.forEach(row => {
            this.$refs.table.toggleRowSelection(row, true);
          });
        });
      } else {
        this.settlementRepairFormList = [...selectedRows];
      }
    },
    /** 结算按钮操作 */
    handleSettle() {
      // this.reset();
      // this.open = true;
      // this.title = "结算报修单";
      // this.getClientList()
      this.form.totalActualTimeMoney = this.settlementRepairFormList.reduce((sum, item) => Number(sum) + Number(item.totalActualTimeMoney), 0);
      this.form.totalMaterialMoney = this.settlementRepairFormList.reduce((sum, item) => Number(sum) + Number(item.totalMaterialMoney), 0);
      this.form.totalTrailerMoney = this.settlementRepairFormList.reduce((sum, item) => Number(sum) + Number(item.trailerMoney), 0);
      let totalMoney = this.settlementRepairFormList.reduce((sum, item) => Number(sum) + Number(item.totalMoney), 0);
      this.form.totalMoney = totalMoney
      this.form.receivableMoney = totalMoney
      this.form.practicalMoney = totalMoney
      this.$router.push({name: "settlementMaintainAdd", params:{...this.form, settlementRepairFormList: this.settlementRepairFormList}});
    },
    // 客户改变
    clientChange(id) {
      let client = this.clientOpt.find(item => item.id === id)
      this.form.clientId = client.id
      this.form.clientType = client.type
      this.form.clientName = client.name
      this.form.clientPhone = client.phone
      this.form.clientCertificateType = client.certificateType
      this.form.clientCertificateNumber = client.certificateNumber
    },
    // 工时费或原料费优惠金额更改
    moneyChange() {
      this.form.practicalMoney = this.form.receivableMoney - this.form.manHourDiscountMoney - this.form.materialDiscountMoney
    },
    // 结算明细删除
    handleRowDelete(row) {
      this.settlementRepairFormList = this.settlementRepairFormList.filter(item => item.id !== row.id);
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加报修单";
      this.getClientList()
    },
    /** 客户列表 */
    getClientList() {
      listClient().then(res =>{
        this.clientOpt = res.rows
      })
    },
    /** 详情按钮操作 */
    handleDetail(row) {
      this.open1 = true
      this.title = '报修单详情'
      this.repairFormId = row.id
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getRepairForm(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改报修单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          this.form.repairFormIds = this.settlementRepairFormList.map(item => item.id)
          if (this.form.id != null) {
            updateSettlementMaintain(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addSettlementMaintain(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除报修单编号为"' + ids + '"的数据项？').then(() => {
        this.loading = true;
        return delSettlementMaintain(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/repairForm/settlement/export', {
        ...this.queryParams
      }, `待结算报修单_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
