<!-- 基本信息 -->
<template>
  <div>
    <div class="topTip">丰富详尽的企业介绍能提高求职者对贵企业的关注和了解，有助于达到更好的招聘效果</div>
    <CtForm ref="CtFormRef" :items="formItems" style="width: 900px;margin: 0 auto">
      <template #name="{ item }">
        <div v-show="!item.show" class="text-right" style="width: 80px; line-height: 40px;">
          <v-icon color="primary" size="20">mdi-shield-check</v-icon> <!-- mdi-shield-remove -->
          <span style="color: var(--v-primary-base);font-size: 14px;">已认证</span>
        </div>
      </template>
    </CtForm>
    <div class="text-center">
      <v-btn color="primary" class="buttons mt-3 mb-10" @click="handleSave">{{ $t('common.save') }}</v-btn>
    </div>
  </div>
</template>

<script setup>
import { inject, ref } from 'vue';

defineOptions({name: 'informationSettingsComponents-basicInfo'})
const infoData = JSON.parse(inject('infoData'))
const formItems = ref({
  options: [
    {
      type: 'text',
      key: 'name',
      value: '',
      label: '企业名称 *',
      disabled: true,
      slotName: 'name',
      rules: [v => !!v || '请输入企业名称']
    },
    {
      type: 'text',
      key: 'suoZaiDi',
      value: '',
      label: '企业所在地 *',
      disabled: true,
      rules: [v => !!v || '请输入企业所在地']
    },
    {
      type: 'text',
      key: 'diZhi',
      value: '',
      label: '企业地址 *',
      rules: [v => !!v || '请输入企业地址']
    },
    {
      type: 'text',
      key: 'key1',
      value: '',
      label: '区域定位',
    },
    {
      type: 'autocomplete',
      key: 'select',
      value: null,
      label: '行业类别 *',
      outlined: true,
      clearable: false,
      disabled: true,
      itemText: 'label',
      itemValue: 'value',
      col: 6,
      flexStyle: 'mr-3',
      rules: [v => !!v || '请选择行业类别'],
      items: [{ label: '餐饮业', value: '1' }]
    },
    {
      type: 'autocomplete',
      key: 'select',
      value: null,
      label: '企业类型 *',
      outlined: true,
      clearable: false,
      itemText: 'label',
      itemValue: 'value',
      col: 6,
      rules: [v => !!v || '请选择企业类型'],
      items: [{ label: '西餐餐饮', value: '1' }]
    },
    {
      type: 'autocomplete',
      key: 'select',
      value: null,
      label: '所属类别 *',
      outlined: true,
      clearable: false,
      itemText: 'label',
      itemValue: 'value',
      col: 6,
      flexStyle: 'mr-3',
      rules: [v => !!v || '请选择所属类别'],
      items: [{ label: '总部', value: '1' }]
    },
    {
      type: 'autocomplete',
      key: 'select',
      value: null,
      label: '企业规模 *',
      outlined: true,
      clearable: false,
      itemText: 'label',
      itemValue: 'value',
      col: 6,
      rules: [v => !!v || '请选择企业规模'],
      items: [{ label: '50-99人', value: '1' }]
    },
    {
      type: 'autocomplete',
      key: 'select',
      value: null,
      label: '企业性质 *',
      outlined: true,
      clearable: false,
      itemText: 'label',
      itemValue: 'value',
      rules: [v => !!v || '请选择企业性质'],
      items: [{ label: '民营、私营企业', value: '1' }]
    },
    {
      type: 'datePicker',
      key: 'time',
      value: null,
      col: 6,
      flexStyle: 'mr-3',
      class: 'mb-3',
      options: {
        // type: 'time',
        format: 'timestamp',
        placeholder: '开业时间 *',
      },
      rules: [v => !!v || '请选择开业时间']
    },
    {
      type: 'checkbox',
      key: 'select',
      value: '1',
      // label: '筹建中',
      col: 6,
      items: [
        { key: '1', label: '筹建中', value: '1' }
      ]
    },
    {
      type: 'text',
      key: 'net',
      value: '',
      label: '企业网址',
    },
    {
      type: 'textarea',
      key: 'content',
      value: null,
      counter: 2000,
      label: '企业介绍 *',
      outlined: true,
      rules: [v => !!v || '请输入企业介绍']
    },
  ]
})
formItems.value.options.forEach(e => { if (infoData[e.key]) e.value = infoData[e.key] })
const handleSave = async () => {
  // const { valid } = await formPageRef.value.formRef.validate()
  // if (!valid) return
  // items.value.options.forEach(e => {
  //   if (arr.includes(e.key)) query[e.key] = e.value 
  // })
  // if (editId.value) query.id = editId.value
  // await saveResumeJobInterested(query)
  // Snackbar.success('保存成功')
  // isAdd.value = false
  // resetForm()
  // getJobInterested()
}
</script>
<style lang="scss" scoped>
.topTip {
  background-color: #f7f8fa;
  color: #2f3640;
  padding: 12px 20px;
  margin: 10px 0 40px;
  font-size: 14px;
}
</style>
