<template>
  <el-dialog title="记账信息" v-model="visible" width="90%" append-to-body draggable @close="close" class="dialog-form" :close-on-click-modal = "false">
    <!-- <div slot="title" class="dialog-title-container">
      <span class="title-label"><i class="el-icon-document" /> 工资信息</span>
      <i class="el-icon-close" @click="close" />
    </div> -->
    <!-- 功能按钮 -->
    <div style="padding: 8px 24px 16px 24px">
      <el-form size="small" label-width="140px" v-model="form">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="客户名称">
              <div>{{ form.companyName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所属月份">
              <div>{{ form.year }}-{{ form.month }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="服务状态">
              <el-select v-model="form.status" placeholder="请选择">
                <el-option v-for="item in selectStatus" :key="item.value" :value="item.value" :label="item.label" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-divider content-position="left">工资</el-divider>
          <el-col :span="24" class="details-container">
            <!--操作按钮 开始-->
            <div class="details-head" style="margin-bottom: 15px; " >
              <div class="title">
                <i class="fa fa-th-list" aria-hidden="true" /> 工资人员信息
              </div>
              <el-button type="primary"  style="margin-top: 15px;" size="small" icon="plus" @click="handleEmployeeCreate">新增</el-button>
              <el-button v-if="selections.length > 0" type="danger" size="small" icon="delete" style="margin-top: 15px;"
                @click="handleEmployeeBatchDelete">
                删除</el-button>
            </div>
            <div class="details-body">
              <div>
                <el-table ref="sourceTable" :data="form.salary.details" size="small" max-height="490px" border
                  show-summary :summary-method="getSummaries" highlight-current-row
                  header-row-class-name="list-header-row" row-class-name="list-row" class="salary-table"
                  @selection-change="handleCheckChange" @current-change="handleCurrentChange">
                  <el-table-column type="selection" width="50" align="center" />
                  <el-table-column type="index" label="序号" width="50" align="center" />
                  <el-table-column label="员工姓名" width="80" align="center">
                    <template #default="scope">
                      <div>
                        <el-input v-model="scope.row.employeeName" size="small" placeholder="员工姓名"
                          style="width: 100%" />
                      </div>
                      <span style="
                          color: red;
                          position: absolute;
                          z-index: 10;
                          top: 4px;
                          right: 12px;
                        ">*</span>
                    </template>
                  </el-table-column>
                  <el-table-column label="身份证号" width="150" align="center">
                    <template #default="scope">
                      <div>
                        <el-input v-model="scope.row.idCode" size="small" placeholder="身份证号" style="width: 100%" />
                      </div>
                      <span style="
                          color: red;
                          position: absolute;
                          z-index: 10;
                          top: 4px;
                          right: 12px;
                        ">*</span>
                    </template>
                  </el-table-column>
                  <el-table-column label="应发工资" width="140" align="center" prop="planSalary">
                    <template #default="scope">
                      <div>
                        <el-input-number v-model="scope.row.planSalary" size="small" placeholder="应发工资" :precision="2"
                          :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="实发工资" width="140" align="center" prop="actuallySalary">
                    <template #default="scope">
                      <div>
                        <!-- <el-input-number
                          v-model="scope.row.actuallySalary"
                          size="small"
                          placeholder="实发工资"
                          :precision="2"
                          :controls="false"
                          style="width: 100%"
                        /> -->
                        {{ rowNum(scope.row.actuallySalary) }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="奖金及其他" width="120" align="center" prop="bonusAmount">
                    <template #default="scope">
                      <div>
                        <el-input-number v-model="scope.row.bonusAmount" size="small" placeholder="奖金及其他" :precision="2"
                          :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="社保" align="center">
                    <el-table-column label="养老保险" width="120" align="center" prop="endowmentInsurance">
                      <template #default="scope">
                        <div>
                          <el-input-number v-model="scope.row.endowmentInsurance" size="small" placeholder="养老保险"
                            :precision="2" :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column label="医疗保险" width="120" align="center" prop="medicalInsurance">
                      <template #default="scope">
                        <div>
                          <el-input-number v-model="scope.row.medicalInsurance" size="small" placeholder="医疗保险"
                            :precision="2" :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column label="失业险" width="120" align="center" prop="unemploymentBenefit">
                      <template #default="scope">
                        <div>
                          <el-input-number v-model="scope.row.unemploymentBenefit" size="small" placeholder="失业险"
                            :precision="2" :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                        </div>
                      </template>
                    </el-table-column>
                    <el-table-column label="大病险" width="120" align="center" prop="seriousIllnessInsurance">
                      <template #default="scope">
                        <div>
                          <el-input-number v-model="scope.row.seriousIllnessInsurance" size="small" placeholder="大病险"
                            :precision="2" :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                        </div>
                      </template>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column label="公积金" width="120" align="center" prop="housingFund">
                    <template #default="scope">
                      <div>
                        <el-input-number v-model="scope.row.housingFund" size="small" placeholder="住房公积金" :precision="2"
                          :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="个税" align="center" width="90" prop="currentIndividualIncomeTax">
                    <template #default="scope">
                      <div>
                        <el-input-number v-model="scope.row.currentIndividualIncomeTax" size="small" placeholder="个税"
                          :precision="2" :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                      </div>
                    </template></el-table-column>
                  <el-table-column label="其他扣款" width="120" align="center" prop="otherCut">
                    <template #default="scope">
                      <div>
                        <el-input-number v-model="scope.row.otherCut" size="small" placeholder="其他扣款" :precision="2"
                          :controls="false" style="width: 100%" @change="rowChangeSum(scope.row)" />
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="备注" width="85" header-align="center">
                    <template #default="scope">
                      <div>
                        <el-input v-model="scope.row.remark" size="small" placeholder="备注" />
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </el-col>
          <el-col :span="24">
            <el-divider />
          </el-col>
          <el-col :span="24">
            <el-form-item label="合计工资">
              {{ form.salary.amount }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="工资备注">
              <el-input v-model.trim="form.salary.content" maxlength="200" show-word-limit type="textarea" rows="2" />
            </el-form-item>
          </el-col>
          <el-divider content-position="left">收票</el-divider>
          <el-col :span="12">
            <el-form-item label="收入票">
              <el-input-number v-model="form.ticket.incomeTicket" size="small" placeholder="收入票" :step="1" step-strictly
                :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="成本票">
              <el-input-number v-model="form.ticket.costTicket" size="small" placeholder="成本票" :step="1" step-strictly
                :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="费用票">
              <el-input-number v-model="form.ticket.feeTicketNumber" size="small" placeholder="费用票" :step="1"
                step-strictly :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行对账">
              <el-input-number v-model="form.ticket.bankCopyNumber" size="small" placeholder="银行回单" :step="1"
                step-strictly :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行回单">
              <el-input-number v-model="form.ticket.bankSlipsNumber" size="small" placeholder="银行回单" :step="1"
                step-strictly :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工资单">
              <el-input-number v-model="form.ticket.salaryTicket" size="small" placeholder="工资单" :step="1" step-strictly
                :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="社保公积金">
              <el-input-number v-model="form.ticket.ssafTicket" size="small" placeholder="社保公积金" :step="1" step-strictly
                :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="其他票">
              <el-input-number v-model="form.ticket.otherTicket" size="small" placeholder="其他票" :step="1" step-strictly
                :controls="false" style="width: 100%" @change="ticketNumberChange" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合计">
              <div>{{ form.ticket.sumNumber }}</div>
              <!-- <el-input-number
                v-model="form.ticket.sumNumber"
                size="small"
                placeholder="合计"
                :step="1"
                step-strictly
                :controls="false"
                style="width: 100%"
              /> -->
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注">
              <el-input v-model.trim="form.ticket.content" maxlength="200" show-word-limit type="textarea" rows="2" />
            </el-form-item>
          </el-col>
          <el-divider content-position="left">记账</el-divider>
          <el-col :span="12">
            <el-form-item label="本期收入">
              <el-input-number v-model="form.keepAccount.currentIncome" size="small" placeholder="本期收入" :precision="2"
                :controls="false" style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本年收入">
              <el-input-number v-model="form.keepAccount.currentYearIncome" size="small" placeholder="本年收入"
                :precision="2" :controls="false" style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本年累计成本">
              <el-input-number v-model="form.keepAccount.cumulativeCost" size="small" placeholder="本年累计成本"
                :precision="2" :controls="false" style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="本年利润总额">
              <el-input-number v-model="form.keepAccount.currentYearProfit" size="small" placeholder="本年利润总额"
                :precision="2" :controls="false" style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否暂估">
              <el-checkbox v-model="form.keepAccount.isProvisionalEstimate" :true-label="1" :false-label="0" />
            </el-form-item>
          </el-col>
          <el-col v-if="form.keepAccount.isProvisionalEstimate === 1" :span="12">
            <el-form-item label="暂估金额">
              <el-input-number v-model="form.keepAccount.provisionalEstimateAmount" size="small" placeholder="暂估金额"
                :precision="2" :controls="false" style="width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="备注">
              <el-input v-model.trim="form.keepAccount.content" maxlength="200" show-word-limit type="textarea"
                rows="2" />
            </el-form-item>
          </el-col>
          <el-divider content-position="left">报税</el-divider>
          <el-col :span="12">
            <el-form-item label="可弥补之前年度亏损">
              <el-input-number size="small" placeholder="可弥补之前年度亏损" v-model="form.reportTax.previousAnnualLosses"
                :precision="2" :controls="false" style="align: right; text-align: right; width: 100%" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="增值税">
              <el-input-number placeholder="增值税" v-model="form.reportTax.valueAddedTax" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :controls="false" :precision="2" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="城建税">
              <el-input-number placeholder="城建税" v-model="form.reportTax.cityConstructTax" :precision="2" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="教育费附加">
              <el-input-number placeholder="教育费附加" v-model="form.reportTax.additionsTaxOfEducation" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="地方教育费附加">
              <el-input-number placeholder="地方教育费附加" v-model="form.reportTax.ladditionsTaxOfEducation" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="企业所得税">
              <el-input-number placeholder="企业所得税" v-model="form.reportTax.businessIncomeTax" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="印花税">
              <el-input-number placeholder="印花税" v-model="form.reportTax.stampTax" style="
                  display: flex;
                  align-items: center;
                  width: 100%;
                  justify-content: center;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="文化事业建设税">
              <el-input-number placeholder="文化事业建设税" v-model="form.reportTax.culturalConstructTax" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="消费税">
              <el-input-number placeholder="消费税" v-model="form.reportTax.excise" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " @change="taxChangeHandler" :precision="2" :controls="false" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合计">
              <span>{{ rowNum(form.reportTax.sumTax) }}</span>
            </el-form-item>
          </el-col>
          <el-divider content-position="left">个税</el-divider>
          <el-col :span="12">
            <el-form-item label="个税金额">
              <el-input-number placeholder="个税金额" v-model="form.individual.amount" style="
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  width: 100%;
                " :controls="false" :precision="2" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="备注">
              <el-input type="textarea" maxlength="200" show-word-limit rows="2" v-model="form.individual.remark" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="form-btns-container" style="height: 40px">
      <el-button size="small" icon="close" @click="close" style="float: right; margin-left: 12px; margin-right: 12px">
        取消</el-button>
      <el-button type="primary" size="small" icon="Finished" style="float: right" @click="handleSave">
        保存</el-button>
    </div>
    <!-- <feedback-dialog ref="feedbackDialogView" :parent="this" />
    <print-dialog ref="printDialog" :parent="this" /> -->
  </el-dialog>
</template>
<script setup>
  import {
    getDetail,
    saveDetail,
    updateDetail,
  } from "@/api/business/crm/serviceWorkOrder";
  import { rowNum, numberToCurrencyNo } from "@/utils/index";
  import { ref } from "vue";
  const { proxy } = getCurrentInstance();
  const visible = ref(false);
  const width = ref(1430);
  const selections = ref([]);
  const currentSource = ref(null);

  const props = defineProps({
    getList: {
      type: Function,
      default: () => { },
    },
  });
  const selectStatus = ref([
    {
      label: "未开始",
      value: 0,
      color: "#fff",
    },
    {
      label: "进行中",
      value: 1,
      color: "#FFB836",
    },
    {
      label: "已完成",
      value: 3,
      color: "#2FCB81",
    },
  ]);
  const { getList } = toRefs(props);
  const total = ref(0);

  const employeeEmptyData = {
    id: null,
    title: "",
    remark: "",
    employeeName: "",
    departmentName: "",
    idCode: "",
    salaryAmount: "",
    bonusAmount: "",
    allowanceAmount: "",
    subsidyAmount: "",
    absenceCut: "",
    planSalary: 0,
    actuallySalary: 0,
    endowmentInsurance: 0,
    medicalInsurance: 0,
    unemploymentBenefit: 0,
    seriousIllnessInsurance: 0,
    housingFund: 0,
    otherCut: 0,
    cumulativeIncome: 0,
    cumulativeSpecialCut: 0,
    cumulativeChildEduCut: 0,
    cumulativeHouseLoanInterestCut: 0,
    cumulativeHouseRentCut: 0,
    cumulativeSupportElderCut: 0,
    cumulativeContinuingEduCut: 0,
    cumulativeBabyCareCut: 0,
    sumSpecialCumulativeCut: 0,
    cumulativeOtherCut: 0,
    cumulativeIndividualIncomeTax: 0,
    cumulativeHasPaidIit: 0,
    currentIndividualIncomeTax: 0,
    idiograph: "",
    details: [],
    editStatus: true,
  };

  const form = ref({});

  const emptyForm = {
    salary: {
      details: [],
    },
    ticket: {},
    keepAccount: {},
    reportTax: {},
    individual: {},
    details: [],
  };

  function open(detail) {
    visible.value = true;
    form.value = { ...emptyForm, ...detail };
    loadData();
  }

  function loadData() {
    getDetail(form.value).then((res) => {
      form.value = { ...proxy.deepClone(emptyForm), ...res.data };
      computeTotal();
    });
  }

  function close() {
    visible.value = false;
    reset();
  }

  function reset() {
    form.value = proxy.deepClone(emptyForm);
  }

  function printSalary() { }
  function exportSalary() { }

  function handleCurrentChange(row) {
    currentSource.value = row;
  }

  function handleCheckChange(selection) {
    selections.value = selection.map((item) => item);
  }

  function handleEmployeeCreate() {
    // 此处必须进行深拷贝，否则添加的明细，将都指向了一个对象
    const _newSource = JSON.parse(JSON.stringify(employeeEmptyData));
    form.value.salary.details.push(_newSource);
    handleCurrentChange(_newSource);
  }

  function handleEmployeeBatchDelete() {
    proxy.$modal
      .confirm("确定删除?")
      .then(() => {
        form.value.salary.details = form.value.salary.details.filter(
          (item) => selections.value.indexOf(item) === -1
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消删除");
      });
  }

  function rowChangeSum(row) {
    let actuallySalary = 0;
    actuallySalary += row.planSalary == null ? 0 : row.planSalary;
    actuallySalary += row.bonusAmount == null ? 0 : row.bonusAmount;
    actuallySalary -= row.endowmentInsurance == null ? 0 : row.endowmentInsurance;
    actuallySalary -= row.medicalInsurance == null ? 0 : row.medicalInsurance;
    actuallySalary -=
      row.unemploymentBenefit == null ? 0 : row.unemploymentBenefit;
    actuallySalary -=
      row.seriousIllnessInsurance == null ? 0 : row.seriousIllnessInsurance;
    actuallySalary -= row.housingFund == null ? 0 : row.housingFund;
    actuallySalary -=
      row.currentIndividualIncomeTax == null ? 0 : row.currentIndividualIncomeTax;
    actuallySalary -= row.otherCut == null ? 0 : row.otherCut;
    row.actuallySalary = actuallySalary;
    computeTotal();
  }

  function computeTotal() {
    let totalSalay = 0;
    form.value.salary.details.forEach((l) => {
      totalSalay += l.actuallySalary == null ? 0 : l.actuallySalary;
    });
    form.value.salary.amount = totalSalay.toFixed(2);
  }

  function getSummaries(param) {
    const { columns, data } = param;
    const sums = [];
    columns.forEach((column, index) => {
      if (index === 0) {
        sums[index] = "合计";
        return;
      } else if (index === 1) {
        sums[index] = "";
        return;
      }
      const values = data.map((item) => Number(item[column.property]));

      if (!values.every((value) => isNaN(value))) {
        sums[index] = values.reduce((prev, curr) => {
          const value = Number(curr);
          if (!isNaN(value)) {
            return (Number(prev) + Number(curr)).toFixed(2);
          } else {
            return Number(prev).toFixed(2);
          }
        }, 0);
        sums[index] = numberToCurrencyNo(sums[index]);
      } else {
        sums[index] = "";
      }
    });
    return sums;
  }

  function handleSave() {
    proxy.$modal
      .confirm("确认保存么？")
      .then(() => {
        const saveValue = proxy.deepClone(form.value);
        saveDetail(saveValue).then((res) => {
          proxy.$modal.msgSuccess("保存成功");
          reset();
          close();
          getList.value();
        });
      })
      .catch((err) => {
        proxy.$modal.msg("取消保存");
      });
  }

  function ticketNumberChange() {
    let amount = 0;
    amount +=
      form.value.ticket.incomeTicket == null ? 0 : form.value.ticket.incomeTicket;
    amount +=
      form.value.ticket.costTicket == null ? 0 : form.value.ticket.costTicket;
    amount +=
      form.value.ticket.feeTicketNumber == null
        ? 0
        : form.value.ticket.feeTicketNumber;
    amount +=
      form.value.ticket.ssafTicket == null ? 0 : form.value.ticket.ssafTicket;
    amount +=
      form.value.ticket.salaryTicket == null ? 0 : form.value.ticket.salaryTicket;
    amount +=
      form.value.ticket.bankSlipsNumber == null
        ? 0
        : form.value.ticket.bankSlipsNumber;
    amount +=
      form.value.ticket.bankCopyNumber == null
        ? 0
        : form.value.ticket.bankCopyNumber;
    amount += form.value.ticket.bankCopy == null ? 0 : form.value.ticket.bankCopy;
    amount +=
      form.value.ticket.otherTicket == null ? 0 : form.value.ticket.otherTicket;
    form.value.ticket.sumNumber = amount;
    console.log("合计", amount);
    console.log("合计1", form.value.ticket.costTicket);
  }

  /** 计算税额 */
  function taxChangeHandler() {
    let amount = 0;

    amount +=
      form.value.reportTax.ladditionsTaxOfEducation == null
        ? 0
        : form.value.reportTax.ladditionsTaxOfEducation;
    amount +=
      form.value.reportTax.valueAddedTax == null
        ? 0
        : form.value.reportTax.valueAddedTax;
    amount +=
      form.value.reportTax.cityConstructTax == null
        ? 0
        : form.value.reportTax.cityConstructTax;
    amount +=
      form.value.reportTax.additionsTaxOfEducation == null
        ? 0
        : form.value.reportTax.additionsTaxOfEducation;
    amount +=
      form.value.reportTax.businessIncomeTax == null
        ? 0
        : form.value.reportTax.businessIncomeTax;
    amount +=
      form.value.reportTax.stampTax == null ? 0 : form.value.reportTax.stampTax;
    amount +=
      form.value.reportTax.culturalConstructTax == null
        ? 0
        : form.value.reportTax.culturalConstructTax;
    amount +=
      form.value.reportTax.excise == null ? 0 : form.value.reportTax.excise;
    form.value.reportTax.sumTax = amount;
  }

  // 暴露给父组件的方法
  defineExpose({
    open,
  });
</script>