<template>
  <div>
    <div v-if="processedFanFormData.length > 0">
      <el-row>
        <el-col :span="24">
          <div class="topBtn">
            <el-button
              v-if="props.fnaFormBizId"
              type="primary"
              icon="EditPen"
              @click="handleEditStatus"
              >编辑</el-button
            >
          </div>
        </el-col>
      </el-row>
      <el-form ref="fanFormRef" :model="form" :rules="rules">
        <el-row v-for="father in processedFanFormData" style="margin-bottom: 10px">
          <div class="formBox formFna">
            <div class="fatherLable">{{ father.fatherTitle }}</div>
            <div class="subTitle" v-if="father.subTitle">{{ father.subTitle }}</div>

            <el-row v-if="father.child == 'no'">
              <template v-for="child in father.data" :key="child.key">
                <el-col :sm="child.sm" :lg="child.lg" class="formItem" v-if="child.show">
                  <div>
                    <el-form-item
                      :label="child.label"
                      :prop="father.key + '.' + child.key"
                      :key="child.key"
                      :label-width="child.labelWidth"
                      :label-position="child.labelPosition"
                    >
                      <el-input
                        v-if="child.domType === 'Input'"
                        :type="child.inputType"
                        v-model="form[father.key][child.key]"
                        :placeholder="child.placeholder"
                        maxlength="30"
                        :disabled="child.disabled"
                        :style="{ width: child.inputWidth ? child.inputWidth : '100%' }"
                      />
                      <el-select
                        v-if="child.domType === 'Select'"
                        v-model="form[father.key][child.key]"
                        :placeholder="child.placeholder"
                        @change="handleSelectChange(father, child)"
                        :disabled="child.disabled"
                      >
                        <el-option
                          v-for="item in child.options"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        />
                      </el-select>
                      <el-date-picker
                        style="width: 100%"
                        v-if="child.domType === 'DatePicker'"
                        v-model="form[father.key][child.key]"
                        type="date"
                        :placeholder="child.placeholder"
                        :disabled="child.disabled"
                      />
                      <el-checkbox-group
                        v-if="child.domType === 'Checkbox'"
                        v-model="form[father.key][child.key]"
                        :disabled="child.disabled"
                      >
                        <el-checkbox
                          v-for="item in child.options"
                          :key="item.value"
                          :label="item.value"
                        >
                          {{ item.label }}
                        </el-checkbox>
                      </el-checkbox-group>
                      <el-select
                        v-model="form[father.key][child.key]"
                        v-if="child.domType === 'SearchSelect'"
                        filterable
                        remote
                        reserve-keyword
                        placeholder="请输入关键词搜索"
                        :remote-method="query => searchSelectList(query, child.key)"
                        :loading="searchLoadingStates[child.key]"
                        :disabled="child.disabled"
                      >
                        <el-option
                          v-for="item in searchOptions[child.key] || []"
                          :key="item.userBizId"
                          :label="item.realName"
                          :value="item.userBizId"
                        />
                      </el-select>
                    </el-form-item>
                  </div>
                </el-col>
              </template>
            </el-row>
            <!-- 有子孙的dom -->
            <el-row v-if="father.child == 'yes'">
              <template v-for="(child, childIndex) in father.data" :key="child.id">
                <el-col :span="child.span">
                  <div class="childLabel" v-if="father.key == 'familyMembers'">
                    {{
                      child.type == '4' ? `${child.childTitle}-${childIndex - 2}` : child.childTitle
                    }}
                  </div>
                  <div
                    class="childLabel"
                    v-if="
                      father.key == 'existingSecurityOwner' ||
                      father.key == 'existingSecurityInsured' ||
                      father.key == 'investment'
                    "
                  >
                    {{ `${child.childTitle}-${childIndex + 1}` }}
                  </div>
                </el-col>
                <template v-for="grandchildren in child.children" :key="grandchildren.key">
                  <el-col
                    :sm="grandchildren.sm"
                    :lg="grandchildren.lg"
                    class="formItem"
                    v-if="grandchildren.show && form[father.key] && form[father.key][childIndex]"
                  >
                    <el-form-item
                      :label="grandchildren.label"
                      :prop="grandchildren.key"
                      :key="grandchildren.key"
                      :label-width="grandchildren.labelWidth"
                    >
                      <el-input
                        v-if="grandchildren.domType === 'Input'"
                        :type="grandchildren.inputType"
                        v-model="form[father.key][childIndex][grandchildren.key]"
                        :placeholder="grandchildren.placeholder"
                        maxlength="30"
                        :disabled="grandchildren.disabled"
                      />
                      <el-select
                        v-if="grandchildren.domType === 'Select'"
                        v-model="form[father.key][childIndex][grandchildren.key]"
                        :placeholder="grandchildren.placeholder"
                        :disabled="grandchildren.disabled"
                      >
                        <el-option
                          v-for="item in grandchildren.options"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        />
                      </el-select>
                      <el-date-picker
                        style="width: 100%"
                        v-if="grandchildren.domType === 'DatePicker'"
                        v-model="form[father.key][childIndex][grandchildren.key]"
                        type="date"
                        :placeholder="grandchildren.placeholder"
                        :disabled="grandchildren.disabled"
                      />
                    </el-form-item>
                  </el-col>
                </template>
                <el-col
                  v-if="child.delete"
                  :span="3"
                  style="margin-left: 10px"
                  @click="deleteChildren(father, childIndex)"
                >
                  <el-icon style="color: red; font-size: 18px; padding-top: 15px"
                    ><Delete
                  /></el-icon>
                </el-col>
              </template>
              <el-col
                :span="24"
                v-if="father.addFamilyChildren"
                style="display: flex; justify-content: flex-end"
              >
                <el-button type="primary" icon="Plus" @click="addChildren(father)"
                  >添加儿女</el-button
                >
              </el-col>
            </el-row>
          </div>
        </el-row>

        <el-row>
          <el-col>
            <div class="tabButton">
              <el-button
                type="primary"
                icon="RefreshRight"
                size="large"
                @click="submitForm('temp')"
                :disabled="editStatus"
                >暂存</el-button
              >
              <el-button
                type="success"
                icon="Check"
                @click="submitForm('save')"
                size="large"
                :disabled="editStatus"
                >立即预约</el-button
              >
            </div>
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>
<script setup name="customer">
import useDictStore from '@/store/modules/dict'
import fanFormDomData from '@/formJson/fnaForm'
import { getDicts } from '@/api/system/dict/data'
import { watch } from 'vue'
import { addfanForm, getfanFormDetail, editFanForm, getCustomerList } from '@/api/sign/fna'
import { listTenantUser } from '@/api/common'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const dictStore = useDictStore() //获取字典数据
const props = defineProps({
  activeName: { type: String, default: '' }, //tab名称
  fearthStatus: { type: String, default: '' }, //父组件状态，新增、修改
  fnaFormBizId: { type: String, default: '' }, //提交状态，新增、修改
  customerBizId: { type: String, default: '' }, //提交状态，新增、修改
  dictTypeLists: { type: Array, default: () => [] } //多个字典值数据
})
const emit = defineEmits(['handleSuccess'])
const { proxy } = getCurrentInstance()
// const { sys_no_yes } = proxy.useDict('sys_no_yes')
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const errorFields = ref([]) // 存储校验失败的字段信息
const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑
const openList = ref(false) // 客户列表弹窗
const oldObjInfo = ref({}) // 修改时存储原始数据，便于撤销操作
const noYesList = ref([]) // 是否列表
const searchOptions = ref({}) // 存储不同key对应的选项
const searchLoadingStates = ref({}) // 存储不同key对应的加载状态
const data = reactive({
  form: {},
  processedFanFormData: [], // 处理后的表单数据
  oldFanFormData: [], // 保存旧的表单Dom,便于撤销操作
  rules: {}, //表单验证规则,
  queryParams: {
    pageNo: 1,
    pageSize: 4,
    name: undefined
  }
})
const { form, rules, processedFanFormData, queryParams, oldFanFormData } = toRefs(data)
// 下拉框搜索方法
// 搜索方法
const searchSelectList = async (query, fieldKey) => {
  // 设置该字段的加载状态
  searchLoadingStates.value[fieldKey] = true

  try {
    // 根据不同的字段key调用不同的API
    if (fieldKey === 'accountName') {
      const params = {
        tenantBizId: userStore.projectInfo.tenantBizId,
        realName: query.trim(),
        pageNo: 1,
        pageSize: 10
      }

      const response = await listTenantUser(params)
      searchOptions.value[fieldKey] = response.data.records
    }
    // 可以添加其他字段的处理,可以放其他的字段得请求，目前只有accountName，以后有了其他的在填充
    else if (fieldKey === 'otherField') {
      console.log('otherField')
    }
  } catch (error) {
    console.error(`${fieldKey} 搜索失败`, error)
    searchOptions.value[fieldKey] = []
  } finally {
    searchLoadingStates.value[fieldKey] = false
  }
}

// 获取字典数据
const fetchDictData = dictType => {
  let options = []
  try {
    dictStore.dictTypeLists.forEach(item => {
      if (item.dictType == dictType) {
        options = item.dictItemList
      }
    })
    return options
  } catch (error) {
    console.error('获取字典数据失败:', error)
    return []
  }
}
// 处理表单配置，添加字典数据
const processFormData = async () => {
  // 深拷贝原始数据
  const processedData = JSON.parse(JSON.stringify(fanFormDomData))

  for (const section of processedData) {
    if (section.fatherRequired) {
      rules.value[section.key] = {}
    }
    //给表单赋值各模块key,对应表单的father.key便于收集值
    if (section.keyType == 'Array') {
      form.value[section.key] = []
    } else if (section.keyType == 'Object') {
      form.value[section.key] = {}
    }
    if (section.data) {
      for (const formKey in form.value) {
        if (section.key == formKey) {
          if (section.dataLength) {
            for (let i = 1; i < section.dataLength; i++) {
              section.data.push(JSON.parse(JSON.stringify(section.data[0])))
            }
          }
          for (const field of section.data) {
            // 为下拉搜索框加options
            if (field.domType == 'SearchSelect') {
              if (field.key == 'accountName') {
                searchOptions.value[field.key] = dictStore.tenantUserList
              }
            }
            if (section.key == formKey && field.children) {
              for (const child of field.children) {
                if (child.dictType) {
                  child.options = fetchDictData(child.dictType)
                  if (child.dictType == 'sys_no_yes') {
                    noYesList.value = child.options
                  }
                }
                if (props.fnaFormBizId) {
                  child.disabled = true
                } else {
                  child.disabled = false
                }
              }
            }
            if (field.dictType) {
              // 获取字典数据
              field.options = fetchDictData(field.dictType)
            }
            //
            /*
            1.没有嵌套子级的也就是没有children的数据加rules，根据data中的required字段判断是否必填
            2.有嵌套子级的也就是有children的数据，根据children中的required字段判断是否必填，现在没这个需求，所以先注释
            */
            if (field.required && section.child == 'no') {
              rules.value[section.key][field.key] = [
                { required: true, message: `${field.label}不能为空`, trigger: 'blur' }
              ]
            }
            if (props.fnaFormBizId) {
              field.disabled = true
            } else {
              field.disabled = false
            }
          }
          if (section.child == 'yes') {
            form.value[formKey] = section.data //便于表单收集值
          }
        }
      }
    }
  }

  if (props.fnaFormBizId) {
    getFanformInfo(props.fnaFormBizId, processedData)
    editStatus.value = true
  } else {
    processedFanFormData.value = oldFanFormData.value = processedData
    editStatus.value = false
  }
}
// 添加表单子级dom
const addChildren = father => {
  const processedData = JSON.parse(JSON.stringify(processedFanFormData.value))
  let obj = {
    type: '4',
    childTitle: '儿女',
    span: 24, //栅格布局份数
    id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
    delete: true, //是否显示删除按钮
    age: '',
    needProvide: '',
    children: [
      {
        label: '年龄',
        key: 'age',
        domType: 'Input',
        inputType: 'number',
        required: false,
        maxLength: 30,
        disabled: false,
        placeholder: '请输入',
        show: true,
        labelWidth: '120px', //标签宽度
        sm: 10, //栅格布局份数
        lg: 8 //栅格布局份数
      },
      {
        label: '是否需要供养',
        key: 'needProvide',
        domType: 'Select',
        required: false,
        maxLength: 30,
        disabled: false,
        placeholder: '请输入',
        show: true,
        dictType: 'sys_no_yes',
        options: noYesList.value,
        labelWidth: '120px', //标签宽度
        sm: 10, //栅格布局份数
        lg: 8 //栅格布局份数
      }
    ]
  }
  for (const section of processedData) {
    if (father.key == 'familyMembers' && section.key == father.key) {
      section.data.push(obj)
    }
  }
  //更新form表单对应的数据，以便收集填写的值
  form.value[father.key].push(obj)
  processedFanFormData.value = processedData
}
const deleteChildren = (father, childIndex) => {
  const processedData = JSON.parse(JSON.stringify(processedFanFormData.value))
  for (const section of processedData) {
    if (father.key == 'familyMembers' && section.key == father.key) {
      section.data.splice(childIndex, 1)
    }
  }
  //更新form表单对应的数据，以便收集填写的值
  form.value[father.key].splice(childIndex, 1)

  processedFanFormData.value = processedData
}
// 根据联动重置表单项的显示与否
const resetShow = (childKey, status) => {
  console.log(childKey, status)

  for (const section of processedFanFormData.value) {
    // 暂时没考虑data里嵌套children的情况
    if (section.data) {
      for (const field of section.data) {
        if (field.key == childKey) {
          // 获取字典数据
          field.show = status
        }
      }
    }
  }
}
const handleSelectChange = (father, child) => {
  switch (child.key) {
    case 'employment':
      // 选择吸烟，展示吸烟数量
      if (form.value[father.key][child.key] == 'OTHER') {
        resetShow('otherEmployment', true)
        form.value[father.key]['otherEmployment'] = ''
      } else {
        resetShow('otherEmployment', false)
      }

      break

    default:
      break
  }
}
// 改变编辑状态
const handleEditStatus = () => {
  editStatus.value = !editStatus.value
  // 深拷贝原始数据
  const processedData = JSON.parse(JSON.stringify(processedFanFormData.value))
  for (const section of processedData) {
    if (section.data) {
      for (const field of section.data) {
        // 改变data中字段得编辑状态
        if (editStatus.value) {
          field.disabled = true
        } else {
          field.disabled = false
        }
        // 改变data中的children字段得编辑状态
        if (field.children) {
          for (const child of field.children) {
            if (editStatus.value) {
              child.disabled = true
            } else {
              child.disabled = false
            }
          }
        }
      }
    }
  }
  processedFanFormData.value = processedData
}
//给表单赋值 方便表单回显 obj 为表单数据
const setFormValue = (obj, formData) => {
  // 写到给家人赋值了，家人传值也不太对
  let newForm = JSON.parse(JSON.stringify(form.value))
  // 1.先正确的拿到表单的回显值
  for (const key in newForm) {
    for (const key2 in obj) {
      if (isObject(newForm[key]) && key == key2) {
        newForm[key] = obj[key2]
      }
      if (isArray(newForm[key]) && key == key2 && obj[key2] && obj[key2].length > 0) {
        newForm[key] = obj[key2]
      }
    }
  }
  // 2.根据最新的表单数据更新processedFanFormData的值,因为有些模块是多项的，所以表单数据要和dom对应上，防止dom有form表单里没有对应的数据会报错
  let newChildren = {
    type: '4',
    childTitle: '儿女',
    span: 24, //栅格布局份数
    delete: true, //是否显示删除按钮
    age: '',
    needProvide: '',
    children: [
      {
        label: '年龄',
        key: 'age',
        domType: 'Input',
        inputType: 'number',
        required: false,
        maxLength: 30,
        disabled: false,
        placeholder: '请输入',
        show: true,
        labelWidth: '120px', //标签宽度
        sm: 10, //栅格布局份数
        lg: 8 //栅格布局份数
      },
      {
        label: '是否需要供养',
        key: 'needProvide',
        domType: 'Select',
        required: false,
        maxLength: 30,
        disabled: false,
        placeholder: '请输入',
        show: true,
        dictType: 'sys_no_yes',
        options: noYesList.value,
        labelWidth: '120px', //标签宽度
        sm: 10, //栅格布局份数
        lg: 8 //栅格布局份数
      }
    ]
  }
  // 深拷贝原始表单dom数据
  const processedData = JSON.parse(JSON.stringify(formData))
  for (const section of processedData) {
    for (const key in newForm) {
      //回显的数据有的没填写就会是null,收集表单值得时候和dom对应不上，对于null值得项要根据section得keyType给form正确得数据类型
      if (!newForm[key]) {
        if (section.keyType == 'Array') {
          newForm[key] = []
        } else if (section.keyType == 'Object') {
          newForm[key] = {}
        }
      }
      if (section.data) {
        if (section.key == 'familyMembers' && section.key == key) {
          // 根据家人得type对应，如果填写得有儿女processedFanFormData和form应该加上对应得值
          newForm[key].forEach((item, index) => {
            // 儿女特殊处理，因为可能有多个儿女为了区分是哪个儿女，所以加上id
            if (item.type == '4') {
              item.id = index + 1
              section.data.push({ id: index + 1, ...newChildren })
              form.value[key].push({ id: index + 1, ...newChildren })
            }
          })
        } else if (key !== 'familyMembers' && section.key == key) {
          if (isArray(newForm[key]) && newForm[key].length <= section.dataLength) {
            let num = section.dataLength - newForm[key].length
            for (let i = 0; i < num; i++) {
              newForm[key].push(section.data[0])
            }
          }
        }

        if (section.key == 'personalData' && key == section.key) {
          if (isObject(newForm[key])) {
            for (const key2 in newForm[key]) {
              // 如果就业情况为其他，显示其他就业情况
              if (key2 == 'employment' && newForm[key][key2] == 'OTHER') {
                for (const item of section.data) {
                  if (item.key == 'otherEmployment') {
                    item.show = true
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  // 回显表单值特殊处理
  for (const key in form.value) {
    for (const key2 in newForm) {
      if (key == key2 && key == 'familyMembers') {
        if (newForm[key2].length > 0) {
          form.value[key] = form.value[key].map(item1 => {
            newForm[key2].forEach(item2 => {
              if (item1.type == '4' && item1.id == item2.id) {
                item1.age = item2.age
                item1.needProvide = item2.needProvide
              } else {
                if (item1.type == item2.type && !item2.id) {
                  item1.age = item2.age
                  item1.needProvide = item2.needProvide
                }
              }
            })
            return item1
          })
        }
      } else if (key == key2 && key !== 'familyMembers') {
        if (isArray(newForm[key2]) && newForm[key].length > 0) {
          form.value[key] = newForm[key2]
        } else if (isObject(newForm[key2])) {
          for (const key3 in newForm[key2]) {
            if (!newForm[key2][key3]) {
              if (key3 == 'premiumFundingSource' || key3 == 'liquidAssetType') {
                newForm[key2][key3] = []
              } else {
                newForm[key2][key3] = ''
              }
            } else {
              if (key3 == 'premiumFundingSource' || key3 == 'liquidAssetType') {
                newForm[key2][key3] = newForm[key2][key3].split(',')
              }
            }
          }
          form.value[key] = newForm[key2]
        }
      }
    }
  }
  console.log('====================================')
  console.log('回显form.value', form.value)
  console.log('====================================')
  // if (!exportValue) {
  //   // 保存一份就得表单数据便于做撤销操作
  //   oldObjInfo.value = JSON.parse(JSON.stringify(form.value))
  // }
  processedFanFormData.value = processedData
  console.log('====================================')
  console.log('processedFanFormData.value', processedFanFormData.value)
  console.log('====================================')
}

// 获取校验失败的字段信息
const getInvalidFields = fields => {
  const errors = []
  for (const field in fields) {
    if (fields[field] && fields[field].length > 0) {
      errors.push({
        field: field,
        message: fields[field][0].message
      })
    }
  }
  return errors
}
// 判断是否为数组
const isArray = value => {
  return Array.isArray(value)
}

// 判断是否为对象
const isObject = value => {
  return typeof value === 'object' && value !== null && !Array.isArray(value)
}

// 表单提交
const submitForm = saveType => {
  console.log('form.value', form.value)
  // 深拷贝原始数据
  let result = JSON.parse(JSON.stringify(form.value))
  // return

  proxy.$refs['fanFormRef'].validate((valid, fields) => {
    if (valid) {
      for (const key in result) {
        if (isObject(result[key])) {
          for (const key2 in result[key]) {
            if (isArray(result[key][key2])) {
              result[key][key2] = result[key][key2].join(',')
            }
          }
        }
        if (isArray(result[key])) {
          result[key] = result[key]
            .map(item => {
              // 删除指定字段
              delete item.childTitle
              delete item.children
              delete item.disabled
              delete item.id
              delete item.span
              if (item.policyIssueDate) {
                item.policyIssueDate = proxy.formatToDate(item.policyIssueDate)
              }
              return item
            })
            .filter(item => Object.keys(item).length > 0) // 过滤空对象
        }
        if (key == 'familyMembers') {
          result[key] = result[key].filter(item => {
            if (item.age || item.needProvide) return item
          })
        }
      }
      result.saveType = saveType
      result.customerBizId = props.customerBizId
      console.log('====================================')
      console.log('提交的数据', result)
      console.log('====================================')
      if (props.fnaFormBizId) {
        result.fnaFormBizId = props.fnaFormBizId
        editFanForm(result).then(res => {
          if (res.code == 200) {
            handleEditStatus()
            proxy.$message.success('fanForm修改成功')
            emit('handleSuccess', {
              tab: 'fnaform',
              fnaFormBizId: props.fnaFormBizId,
              type: 'edit'
            })
          }
        })
      } else {
        addfanForm(result).then(res => {
          if (res.code == 200) {
            proxy.$message.success('客户新增成功')
            emit('handleSuccess', {
              tab: 'fnaform',
              fnaFormBizId: res.data.fnaFormBizId,
              type: 'add'
            })
          }
        })
      }
      errorFields.value = [] // 清空错误信息
    } else {
      // 获取校验失败的字段信息
      errorFields.value = getInvalidFields(fields)
      if (errorFields.value.length > 0) {
        proxy.$message.error(errorFields.value[0].message)
      }
    }
  })
}

// 获取流程详情
function getFanformInfo(fnaFormBizId, formData) {
  getfanFormDetail(fnaFormBizId).then(async res => {
    if (res.code == 200) {
      // 回显值
      setFormValue(res.data, formData)
    }
  })
}
watch(
  () => props.activeName,
  newVal => {
    if (newVal === 'fnaform') {
      openList.value = false
      processFormData()
    }
  }
)
</script>
<style lang="scss" scoped>
.topBtn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.formBox {
  width: 100%;
  .fatherLable {
    font-size: 18px;
    border-left: 4px solid #165dff;
    padding-left: 5px;
    margin-bottom: 5px;
  }
  .subTitle {
    font-size: 16px;
    padding-left: 8px;
    margin-bottom: 10px;
  }
  .childLabel {
    font-size: 14px;
    padding-left: 15px;
    margin-bottom: 15px;
  }
  .fatherDes {
    font-size: 14px;
    color: #a8abb2;
    margin-top: 5px;
    margin-bottom: 20px;
  }
  .inputBox {
    width: 100%;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 0px 11px;
    .rightArrow {
      font-size: 14px;
      color: #a8abb2;
    }
  }
}
.tabButton {
  box-shadow: 0 -1px 14px #00000014;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
  .sumbitBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    height: 60px;
    background-color: #165dff;
    color: #fff;
    padding: 0 30px;
    .buttonIcon {
      font-size: 16px;
      color: #fff;
    }
  }
}
.customerBox {
  .customerItem {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 0 -1px 14px #00000014;
    .top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      .left {
        width: 40%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        .gender {
          display: flex;
          align-items: center;
        }
      }
    }
    .bottom {
      .infoItem {
        display: flex;
        align-items: center;
        margin: 5px 0;
      }
    }
  }
  .customerItem:last-child {
    margin-bottom: 0px;
  }
}
/* 新增的样式：防止label换行并显示省略号 */
.formFna :deep(.el-checkbox) {
  margin-right: 10px;
}

/* 确保标签对齐方式正确 */
/* :deep(.el-form-item) {
  display: flex;
  align-items: center;
} */

/* :deep(.el-form-item__content) {
  flex: 1;
  margin-left: 0 !important;
} */
</style>
