<template>
  <!-- 添加或修改项目信息对话框 -->
  <div class="el-drawer__wrapper">
    <el-drawer :title="title" v-model="visible" direction="rtl" size="100%">
      <div class="page-container form-container">
        <div class="form-btns-container">
          <span class="title-label"
            ><el-icon>
              <Document />
            </el-icon>
            项目信息</span
          >
          <el-button-group>
            <el-button
              v-if="editStatus"
              type="primary"
              size="small"
              icon="Finished"
              @click="submitForm"
              >保存</el-button
            >
            <el-button
              v-else
              type="warning"
              size="small"
              icon="Edit"
              @click="editStatus = true"
              >修改</el-button
            >
            <el-button
              v-if="form.id && editStatus"
              type="info"
              size="small"
              icon="Close"
              @click="editStatus = false"
              >取消修改</el-button
            >
            <el-button
              v-if="form.id"
              type="success"
              size="small"
              @click="getForm"
            >
              <i class="fa fa-refresh" aria-hidden="true" /> 刷新
            </el-button>
          </el-button-group>
          <div class="screen-btn" @click="handleScreen">
            <template v-if="!isFullscreen">
              <i class="fa fa-window-maximize" aria-hidden="true" />
              <!-- <span>全屏</span> -->
            </template>
            <template v-else>
              <i class="fa fa-window-restore" aria-hidden="true" />
              <!-- <span>还原</span> -->
            </template>
          </div>
          <div class="close-btn" @click="cancel">
            <i class="fa fa-times" aria-hidden="true" />
            <!-- <span>关闭</span> -->
          </div>
        </div>
        <div
          class="Y-scrollbar"
          style="
            position: absolute;
            top: 32px;
            bottom: 0;
            width: 100%;
            overflow: auto;
          "
        ></div>
        <el-form
          ref="companyRef"
          class="master-container"
          :model="form"
          :rules="rules"
          label-width="120px"
        >
          <el-row :gutter="30">
            <el-col :span="6">
              <el-form-item
                label="合作伙伴分类：1、客户；2、供应商；3、外协商"
                prop="category"
              >
                <el-input
                  v-if="editStatus"
                  v-model="form.category"
                  placeholder="请输入合作伙伴分类：1、客户；2、供应商；3、外协商"
                />
                <span v-else>{{ form.category }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="客户编码" prop="code">
                <el-input
                  v-if="editStatus"
                  v-model="form.code"
                  placeholder="请输入客户编码"
                />
                <span v-else>{{ form.code }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="客户名称" prop="name">
                <el-input
                  v-if="editStatus"
                  v-model="form.name"
                  placeholder="请输入客户名称"
                />
                <span v-else>{{ form.name }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="客户简称" prop="shortName">
                <el-input
                  v-if="editStatus"
                  v-model="form.shortName"
                  placeholder="请输入客户简称"
                />
                <span v-else>{{ form.shortName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="曾用名" prop="oldName">
                <el-input
                  v-if="editStatus"
                  v-model="form.oldName"
                  placeholder="请输入曾用名"
                />
                <span v-else>{{ form.oldName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="所有权人" prop="owner">
                <el-input
                  v-if="editStatus"
                  v-model="form.owner"
                  placeholder="请输入所有权人"
                />
                <span v-else>{{ form.owner }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="企业电话" prop="phone">
                <el-input
                  v-if="editStatus"
                  v-model="form.phone"
                  placeholder="请输入企业电话"
                />
                <span v-else>{{ form.phone }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="企业邮箱" prop="email">
                <el-input
                  v-if="editStatus"
                  v-model="form.email"
                  placeholder="请输入企业邮箱"
                />
                <span v-else>{{ form.email }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="联系地址" prop="contactAddress">
                <el-input
                  v-if="editStatus"
                  v-model="form.contactAddress"
                  placeholder="请输入联系地址"
                />
                <span v-else>{{ form.contactAddress }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="客户来源" prop="source">
                <el-input
                  v-if="editStatus"
                  v-model="form.source"
                  placeholder="请输入客户来源"
                />
                <span v-else>{{ form.source }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="备注" prop="remark">
                <el-input
                  v-if="editStatus"
                  v-model="form.remark"
                  type="textarea"
                  placeholder="请输入内容"
                />
                <span v-else>{{ form.remark }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="社会信用代码" prop="socialCreditCode">
                <el-input
                  v-if="editStatus"
                  v-model="form.socialCreditCode"
                  placeholder="请输入社会信用代码"
                />
                <span v-else>{{ form.socialCreditCode }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="主营业务" prop="mainBusiness">
                <el-input
                  v-if="editStatus"
                  v-model="form.mainBusiness"
                  placeholder="请输入主营业务"
                />
                <span v-else>{{ form.mainBusiness }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="法定代表人" prop="legalRepresentative">
                <el-input
                  v-if="editStatus"
                  v-model="form.legalRepresentative"
                  placeholder="请输入法定代表人"
                />
                <span v-else>{{ form.legalRepresentative }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="成立日期" prop="foundationDate">
                <el-input
                  v-if="editStatus"
                  v-model="form.foundationDate"
                  placeholder="请输入成立日期"
                />
                <span v-else>{{ form.foundationDate }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="出执照日期" prop="licenceDate">
                <el-input
                  v-if="editStatus"
                  v-model="form.licenceDate"
                  placeholder="请输入出执照日期"
                />
                <span v-else>{{ form.licenceDate }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="营业开始时间" prop="businessStartDate">
                <el-input
                  v-if="editStatus"
                  v-model="form.businessStartDate"
                  placeholder="请输入营业开始时间"
                />
                <span v-else>{{ form.businessStartDate }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="营业结束时间" prop="businessEndDate">
                <el-input
                  v-if="editStatus"
                  v-model="form.businessEndDate"
                  placeholder="请输入营业结束时间"
                />
                <span v-else>{{ form.businessEndDate }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="长期有效否" prop="isPermanentlyEffective">
                <el-input
                  v-if="editStatus"
                  v-model="form.isPermanentlyEffective"
                  placeholder="请输入长期有效否"
                />
                <span v-else>{{ form.isPermanentlyEffective }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册资金" prop="registerMoney">
                <el-input
                  v-if="editStatus"
                  v-model="form.registerMoney"
                  placeholder="请输入注册资金"
                />
                <span v-else>{{ form.registerMoney }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册资金单位" prop="registerMoneyUnit">
                <el-input
                  v-if="editStatus"
                  v-model="form.registerMoneyUnit"
                  placeholder="请输入注册资金单位"
                />
                <span v-else>{{ form.registerMoneyUnit }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册省份编码" prop="provinceCode">
                <el-input
                  v-if="editStatus"
                  v-model="form.provinceCode"
                  placeholder="请输入注册省份编码"
                />
                <span v-else>{{ form.provinceCode }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="省" prop="province">
                <el-input
                  v-if="editStatus"
                  v-model="form.province"
                  placeholder="请输入省"
                />
                <span v-else>{{ form.province }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册城市编码" prop="cityCode">
                <el-input
                  v-if="editStatus"
                  v-model="form.cityCode"
                  placeholder="请输入注册城市编码"
                />
                <span v-else>{{ form.cityCode }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="市" prop="city">
                <el-input
                  v-if="editStatus"
                  v-model="form.city"
                  placeholder="请输入市"
                />
                <span v-else>{{ form.city }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册行政区编码" prop="districtCode">
                <el-input
                  v-if="editStatus"
                  v-model="form.districtCode"
                  placeholder="请输入注册行政区编码"
                />
                <span v-else>{{ form.districtCode }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="区" prop="district">
                <el-input
                  v-if="editStatus"
                  v-model="form.district"
                  placeholder="请输入区"
                />
                <span v-else>{{ form.district }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="注册详细地址" prop="address">
                <el-input
                  v-if="editStatus"
                  v-model="form.address"
                  placeholder="请输入注册详细地址"
                />
                <span v-else>{{ form.address }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="经营范围" prop="businessField">
                <el-input
                  v-if="editStatus"
                  v-model="form.businessField"
                  type="textarea"
                  placeholder="请输入内容"
                />
                <span v-else>{{ form.businessField }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="是否零申报" prop="isZero">
                <el-input
                  v-if="editStatus"
                  v-model="form.isZero"
                  placeholder="请输入是否零申报"
                />
                <span v-else>{{ form.isZero }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="主管税务机关" prop="competentTaxAuthority">
                <el-input
                  v-if="editStatus"
                  v-model="form.competentTaxAuthority"
                  placeholder="请输入主管税务机关"
                />
                <span v-else>{{ form.competentTaxAuthority }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="税务专管员" prop="taxCollectorName">
                <el-input
                  v-if="editStatus"
                  v-model="form.taxCollectorName"
                  placeholder="请输入税务专管员"
                />
                <span v-else>{{ form.taxCollectorName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="专管员电话" prop="taxCollectorPhone">
                <el-input
                  v-if="editStatus"
                  v-model="form.taxCollectorPhone"
                  placeholder="请输入专管员电话"
                />
                <span v-else>{{ form.taxCollectorPhone }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="核税月份" prop="taxMonth">
                <el-date-picker
                  v-if="editStatus"
                  clearable
                  v-model="form.taxMonth"
                  type="date"
                  value-format="YYYY-MM-DD"
                  placeholder="请选择核税月份"
                >
                </el-date-picker>
                <span v--else>{{ form.taxMonth }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="开户行" prop="openingBank">
                <el-input
                  v-if="editStatus"
                  v-model="form.openingBank"
                  placeholder="请输入开户行"
                />
                <span v-else>{{ form.openingBank }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="银行账户" prop="bankAccount">
                <el-input
                  v-if="editStatus"
                  v-model="form.bankAccount"
                  placeholder="请输入银行账户"
                />
                <span v-else>{{ form.bankAccount }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="年收入" prop="annualIncome">
                <el-input
                  v-if="editStatus"
                  v-model="form.annualIncome"
                  placeholder="请输入年收入"
                />
                <span v-else>{{ form.annualIncome }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="政务网账号" prop="governmentAccountNo">
                <el-input
                  v-if="editStatus"
                  v-model="form.governmentAccountNo"
                  placeholder="请输入政务网账号"
                />
                <span v-else>{{ form.governmentAccountNo }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="政务网密码" prop="governmentPassword">
                <el-input
                  v-if="editStatus"
                  v-model="form.governmentPassword"
                  placeholder="请输入政务网密码"
                />
                <span v-else>{{ form.governmentPassword }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="社保账号" prop="socialSecurityAccountNo">
                <el-input
                  v-if="editStatus"
                  v-model="form.socialSecurityAccountNo"
                  placeholder="请输入社保账号"
                />
                <span v-else>{{ form.socialSecurityAccountNo }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="社保密码" prop="socialSecurityPassword">
                <el-input
                  v-if="editStatus"
                  v-model="form.socialSecurityPassword"
                  placeholder="请输入社保密码"
                />
                <span v-else>{{ form.socialSecurityPassword }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="用工密码" prop="employeePassword">
                <el-input
                  v-if="editStatus"
                  v-model="form.employeePassword"
                  placeholder="请输入用工密码"
                />
                <span v-else>{{ form.employeePassword }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="公积金密码" prop="housingFundPassword">
                <el-input
                  v-if="editStatus"
                  v-model="form.housingFundPassword"
                  placeholder="请输入公积金密码"
                />
                <span v-else>{{ form.housingFundPassword }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="公积金单位账号"
                prop="housingFundUnitAccount"
              >
                <el-input
                  v-if="editStatus"
                  v-model="form.housingFundUnitAccount"
                  placeholder="请输入公积金单位账号"
                />
                <span v-else>{{ form.housingFundUnitAccount }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="公积金划款密码"
                prop="housingFundDeductionPassword"
              >
                <el-input
                  v-if="editStatus"
                  v-model="form.housingFundDeductionPassword"
                  placeholder="请输入公积金划款密码"
                />
                <span v-else>{{ form.housingFundDeductionPassword }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="征收方式" prop="collectionMethod">
                <el-input
                  v-if="editStatus"
                  v-model="form.collectionMethod"
                  placeholder="请输入征收方式"
                />
                <span v-else>{{ form.collectionMethod }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="定额金额" prop="quotaAmount">
                <el-input
                  v-if="editStatus"
                  v-model="form.quotaAmount"
                  placeholder="请输入定额金额"
                />
                <span v-else>{{ form.quotaAmount }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="窗口现金交" prop="isPayOnWindow">
                <el-input
                  v-if="editStatus"
                  v-model="form.isPayOnWindow"
                  placeholder="请输入窗口现金交"
                />
                <span v-else>{{ form.isPayOnWindow }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="初次社保信息保存"
                prop="isFirstSocialSecurity"
              >
                <el-input
                  v-if="editStatus"
                  v-model="form.isFirstSocialSecurity"
                  placeholder="请输入初次社保信息保存"
                />
                <span v-else>{{ form.isFirstSocialSecurity }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="初次公积金信息保存"
                prop="isFirstHousingFund"
              >
                <el-input
                  v-if="editStatus"
                  v-model="form.isFirstHousingFund"
                  placeholder="请输入初次公积金信息保存"
                />
                <span v-else>{{ form.isFirstHousingFund }}</span>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </el-drawer>
  </div>
</template>
<script setup>
import { getCompany } from "@/api/business/company";
const { proxy } = getCurrentInstance();
/** 父组件传参 */
const props = defineProps({
  getList: {
    type: Function,
    default: () => {},
  },
});
const { getList } = toRefs(props);
/** 字典数组区 */
/** 表单抽屉 页变量 */
const title = ref("");
const loading = ref(false);
const multiple = ref(true);
const visible = ref(false);
const editStatus = ref(false);
const isFullscreen = ref(false);
const webHost = import.meta.env.VITE_APP_BASE_API;
const data = reactive({
  form: {},
  rules: {
    category: [
      {
        required: true,
        message: "合作伙伴分类：1、客户；2、供应商；3、外协商不能为空",
        trigger: "blur",
      },
    ],
    code: [{ required: true, message: "客户编码不能为空", trigger: "blur" }],
    name: [{ required: true, message: "客户名称不能为空", trigger: "blur" }],
    shortName: [
      { required: true, message: "客户简称不能为空", trigger: "blur" },
    ],
    oldName: [{ required: true, message: "曾用名不能为空", trigger: "blur" }],
    owner: [{ required: true, message: "所有权人不能为空", trigger: "blur" }],
    phone: [{ required: true, message: "企业电话不能为空", trigger: "blur" }],
    email: [{ required: true, message: "企业邮箱不能为空", trigger: "blur" }],
    contactAddress: [
      { required: true, message: "联系地址不能为空", trigger: "blur" },
    ],
    source: [{ required: true, message: "客户来源不能为空", trigger: "blur" }],
    type: [{ required: true, message: "企业类型不能为空", trigger: "change" }],
    socialCreditCode: [
      { required: true, message: "社会信用代码不能为空", trigger: "blur" },
    ],
    mainBusiness: [
      { required: true, message: "主营业务不能为空", trigger: "blur" },
    ],
    legalRepresentative: [
      { required: true, message: "法定代表人不能为空", trigger: "blur" },
    ],
    foundationDate: [
      { required: true, message: "成立日期不能为空", trigger: "blur" },
    ],
    licenceDate: [
      { required: true, message: "出执照日期不能为空", trigger: "blur" },
    ],
    businessStartDate: [
      { required: true, message: "营业开始时间不能为空", trigger: "blur" },
    ],
    businessEndDate: [
      { required: true, message: "营业结束时间不能为空", trigger: "blur" },
    ],
    isPermanentlyEffective: [
      { required: true, message: "长期有效否不能为空", trigger: "blur" },
    ],
    registerMoney: [
      { required: true, message: "注册资金不能为空", trigger: "blur" },
    ],
    registerMoneyUnit: [
      { required: true, message: "注册资金单位不能为空", trigger: "blur" },
    ],
    provinceCode: [
      { required: true, message: "注册省份编码不能为空", trigger: "blur" },
    ],
    province: [{ required: true, message: "省不能为空", trigger: "blur" }],
    cityCode: [
      { required: true, message: "注册城市编码不能为空", trigger: "blur" },
    ],
    city: [{ required: true, message: "市不能为空", trigger: "blur" }],
    districtCode: [
      { required: true, message: "注册行政区编码不能为空", trigger: "blur" },
    ],
    district: [{ required: true, message: "区不能为空", trigger: "blur" }],
    address: [
      { required: true, message: "注册详细地址不能为空", trigger: "blur" },
    ],
    businessField: [
      { required: true, message: "经营范围不能为空", trigger: "blur" },
    ],
    taxType: [
      { required: true, message: "纳税类型不能为空", trigger: "change" },
    ],
    isZero: [
      { required: true, message: "是否零申报不能为空", trigger: "blur" },
    ],
    competentTaxAuthority: [
      { required: true, message: "主管税务机关不能为空", trigger: "blur" },
    ],
    taxCollectorName: [
      { required: true, message: "税务专管员不能为空", trigger: "blur" },
    ],
    taxCollectorPhone: [
      { required: true, message: "专管员电话不能为空", trigger: "blur" },
    ],
    taxMonth: [
      { required: true, message: "核税月份不能为空", trigger: "blur" },
    ],
    openingBank: [
      { required: true, message: "开户行不能为空", trigger: "blur" },
    ],
    bankAccount: [
      { required: true, message: "银行账户不能为空", trigger: "blur" },
    ],
    annualIncome: [
      { required: true, message: "年收入不能为空", trigger: "blur" },
    ],
    governmentAccountNo: [
      { required: true, message: "政务网账号不能为空", trigger: "blur" },
    ],
    governmentPassword: [
      { required: true, message: "政务网密码不能为空", trigger: "blur" },
    ],
    socialSecurityAccountNo: [
      { required: true, message: "社保账号不能为空", trigger: "blur" },
    ],
    socialSecurityPassword: [
      { required: true, message: "社保密码不能为空", trigger: "blur" },
    ],
    employeePassword: [
      { required: true, message: "用工密码不能为空", trigger: "blur" },
    ],
    housingFundPassword: [
      { required: true, message: "公积金密码不能为空", trigger: "blur" },
    ],
    housingFundUnitAccount: [
      { required: true, message: "公积金单位账号不能为空", trigger: "blur" },
    ],
    housingFundDeductionPassword: [
      { required: true, message: "公积金划款密码不能为空", trigger: "blur" },
    ],
    collectionMethod: [
      { required: true, message: "征收方式不能为空", trigger: "blur" },
    ],
    quotaAmount: [
      { required: true, message: "定额金额不能为空", trigger: "blur" },
    ],
    isPayOnWindow: [
      { required: true, message: "窗口现金交不能为空", trigger: "blur" },
    ],
    isFirstSocialSecurity: [
      { required: true, message: "初次社保信息保存不能为空", trigger: "blur" },
    ],
    isFirstHousingFund: [
      {
        required: true,
        message: "初次公积金信息保存不能为空",
        trigger: "blur",
      },
    ],
  },
});
const { form, rules } = toRefs(data);
/***********************  方法区  ****************************/
/** 打开抽屉 */
function open(id) {
  reset();
  visible.value = true;
  if (id) {
    getCompany(id).then((response) => {
      form.value = response.data;
      editStatus.value = false;
      title.value = "修改项目信息";
    });
  } else {
    editStatus.value = true;
    title.value = "添加项目信息";
  }
}

/** 取消按钮 */
function cancel() {
  visible.value = false;
  reset();
}

/** 表单重置 */
function reset() {
  form.value = {
    id: null,
    category: null,
    code: null,
    name: null,
    shortName: null,
    oldName: null,
    owner: null,
    ownerId: null,
    phone: null,
    email: null,
    contactAddress: null,
    stageId: null,
    companyLevelId: null,
    sourceCategoryId: null,
    source: null,
    sourceId: null,
    remark: null,
    type: null,
    typeId: null,
    socialCreditCode: null,
    mainBusiness: null,
    mainBusinessId: null,
    legalRepresentative: null,
    foundationDate: null,
    licenceDate: null,
    businessStartDate: null,
    businessEndDate: null,
    isPermanentlyEffective: null,
    registerMoney: null,
    registerMoneyUnit: null,
    registerMoneyUnitId: null,
    provinceCode: null,
    province: null,
    cityCode: null,
    city: null,
    districtCode: null,
    district: null,
    address: null,
    businessField: null,
    taxType: null,
    taxTypeId: null,
    taxDeclarationCategoryId: null,
    isZero: null,
    taxDishId: null,
    competentTaxAuthority: null,
    taxCollectorName: null,
    taxCollectorPhone: null,
    taxMonth: null,
    openingBank: null,
    bankAccount: null,
    createTime: null,
    creatorId: null,
    updateTime: null,
    updaterId: null,
    deleted: null,
    version: null,
    accountSetsId: null,
    mainAccountSetsId: null,
    annualIncome: null,
    governmentAccountNo: null,
    governmentPassword: null,
    socialSecurityAccountNo: null,
    socialSecurityPassword: null,
    employeePassword: null,
    housingFundPassword: null,
    housingFundUnitAccount: null,
    housingFundDeductionPassword: null,
    collectionMethod: null,
    quotaAmount: null,
    isPayOnWindow: null,
    isFirstSocialSecurity: null,
    isFirstHousingFund: null,
  };
  proxy.resetForm("companyRef");
}

/** 全屏缩放 */
function handleScreen() {
  const dom = document.querySelector(
    ".list-container > .el-drawer__wrapper > .el-overlay"
  );
  isFullscreen.value = !isFullscreen.value;
  dom.style.position = isFullscreen.value ? "fixed" : "absolute";
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs["companyRef"].validate((valid) => {
    if (valid) {
      if (form.value.id != null) {
        updateCompany(form.value).then((response) => {
          proxy.$modal.msgSuccess("修改成功");
          visible.value = false;
          getList.value();
        });
      } else {
        addCompany(form.value).then((response) => {
          proxy.$modal.msgSuccess("新增成功");
          visible.value = false;
          getList.value();
        });
      }
    }
  });
}

/** 查询表单信息  */
function getForm() {
  loading.value = true;
  getCompany(form.value.id).then((response) => {
    loading.value = false;
    form.value = response.data;
  });
}

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