basicInfo.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!-- 基本信息 -->
  2. <template>
  3. <div>
  4. <div class="topTip">丰富详尽的企业介绍能提高求职者对贵企业的关注和了解,有助于达到更好的招聘效果</div>
  5. <CtForm ref="CtFormRef" :items="formItems" style="width: 900px;margin: 0 auto">
  6. <template #name="{ item }">
  7. <div v-show="!item.show" class="text-right" style="width: 80px; line-height: 40px;">
  8. <v-icon :color="statusInfo.color" size="20">{{ statusInfo.mdi }}</v-icon>
  9. <span class="cursor-pointer text-decoration-underline" :style="{'color': statusInfo.color,'font-size': '14px'}" @click="emit('change', 6)">{{ statusInfo.label }}</span>
  10. </div>
  11. </template>
  12. <template #industryId="{ item }">
  13. <v-menu :close-delay="1" :open-delay="0" v-bind="$attrs" :close-on-content-click="true">
  14. <template v-slot:activator="{ props }">
  15. <TextInput
  16. v-model="item.value"
  17. :item="item"
  18. v-bind="props"
  19. ></TextInput>
  20. </template>
  21. <industryTypeCard :limit="1" :select="[query.industryId].filter(Boolean)" @handleClickIndustry="handleIndustry"></industryTypeCard>
  22. </v-menu>
  23. </template>
  24. <template #prepare="{ item }">
  25. <v-checkbox v-model="item.value" label="筹建中(如果贵企业正在筹建,请勾选)" color="primary"></v-checkbox>
  26. </template>
  27. </CtForm>
  28. <div class="text-center">
  29. <v-btn color="primary" class="buttons mt-3 mb-10" @click.stop="handleSave">{{ $t('common.save') }}</v-btn>
  30. </div>
  31. </div>
  32. </template>
  33. <script setup>
  34. defineOptions({name: 'informationSettingsComponents-basicInfo'})
  35. import { ref, reactive, computed } from 'vue'
  36. import { getEnterpriseBaseInfo, updateEnterpriseBaseInfo } from '@/api/enterprise'
  37. import { getEnterpriseAuth } from '@/api/recruit/enterprise/information'
  38. import { getDict } from '@/hooks/web/useDictionaries'
  39. import { useI18n } from '@/hooks/web/useI18n'
  40. import industryTypeCard from '@/components/industryTypeCard'
  41. import Snackbar from '@/plugins/snackbar'
  42. const emit = defineEmits(['complete', 'change'])
  43. const { t } = useI18n()
  44. const CtFormRef = ref()
  45. const query = reactive({})
  46. const formItems = ref({
  47. options: [
  48. {
  49. type: 'text',
  50. key: 'name',
  51. value: '',
  52. label: '企业全称 *',
  53. slotName: 'name',
  54. rules: [v => !!v || '请输入企业全称']
  55. },
  56. {
  57. type: 'text',
  58. key: 'anotherName',
  59. value: '',
  60. col: 6,
  61. flexStyle: 'mr-3',
  62. label: '企业别名 *',
  63. rules: [v => !!v || '请输入企业别名']
  64. },
  65. {
  66. type: 'text',
  67. key: 'website',
  68. value: '',
  69. col: 6,
  70. label: '企业官网'
  71. },
  72. {
  73. type: 'text',
  74. key: 'contact',
  75. value: '',
  76. col: 6,
  77. flexStyle: 'mr-3',
  78. label: '联系人'
  79. },
  80. {
  81. type: 'phoneNumber',
  82. key: 'phone',
  83. value: '',
  84. col: 6,
  85. label: '联系电话'
  86. },
  87. {
  88. slotName: 'industryId',
  89. key: 'industryId',
  90. value: null,
  91. label: '所在行业 *',
  92. outlined: true,
  93. clearable: false,
  94. itemText: 'label',
  95. itemValue: 'value',
  96. col: 6,
  97. noParam: true,
  98. flexStyle: 'mr-3',
  99. rules: [v => !!v || '请选择所在行业']
  100. },
  101. {
  102. type: 'autocomplete',
  103. key: 'financingStatus',
  104. value: null,
  105. label: '融资阶段 *',
  106. outlined: true,
  107. clearable: false,
  108. itemText: 'label',
  109. itemValue: 'value',
  110. col: 6,
  111. dictTypeName: 'menduner_financing_status',
  112. rules: [v => !!v || '请选择融资阶段'],
  113. items: []
  114. },
  115. {
  116. type: 'autocomplete',
  117. key: 'scale',
  118. value: null,
  119. label: '企业规模 *',
  120. outlined: true,
  121. clearable: false,
  122. itemText: 'label',
  123. itemValue: 'value',
  124. col: 6,
  125. flexStyle: 'mr-3',
  126. dictTypeName: 'menduner_scale',
  127. rules: [v => !!v || '请选择企业规模'],
  128. items: []
  129. },
  130. {
  131. type: 'text',
  132. key: 'workTime',
  133. value: null,
  134. col: 6,
  135. class: 'mb-3',
  136. label: '上班时间(示例:上午09:00 - 下午17:00)',
  137. placeholder: '请输入上班时间'
  138. },
  139. {
  140. type: 'datePicker',
  141. key: 'openTime',
  142. dateType: 'date', // 时间类型 year month date time
  143. value: null,
  144. label: '开业时间 *',
  145. col: 6,
  146. flexStyle: 'mr-3',
  147. outlined: true,
  148. rules: [v => !!v || '请选择开业时间']
  149. // options: {},
  150. },
  151. {
  152. slotName: 'prepare',
  153. key: 'prepare',
  154. value: true,
  155. col: 6
  156. },
  157. {
  158. type: 'textarea',
  159. key: 'introduce',
  160. value: null,
  161. counter: 2000,
  162. rows: 6,
  163. label: '企业介绍 *',
  164. outlined: true,
  165. rules: [v => !!v || '请输入企业介绍']
  166. },
  167. ]
  168. })
  169. const setValue = (key, value) => {
  170. formItems.value.options.find(e => e.key === key).value = value
  171. }
  172. // 行业列表
  173. const industryList = ref([])
  174. getDict('menduner_industry_type', {}, 'industryList').then(({ data }) => {
  175. data = data?.length && data || []
  176. industryList.value = data
  177. })
  178. // 获取企业实名信息
  179. const authInfo = ref({})
  180. const statusList = [
  181. { label: '未认证', color: '#fb8c00', value: null, mdi: 'mdi-shield-remove' },
  182. { label: '审核中', color: '#fb8c00', value: '0', mdi: 'mdi-shield-half-full' },
  183. { label: '已认证', color: '#00897B', value: '1', mdi: 'mdi-shield-check' },
  184. { label: '已驳回', color: '#fe574a', value: '2', mdi: 'mdi-shield-off' }
  185. ]
  186. const getAuthInfo = async () => {
  187. const data = await getEnterpriseAuth()
  188. if (!data) return
  189. authInfo.value = data
  190. }
  191. getAuthInfo()
  192. const statusInfo = computed(() => {
  193. const obj = (authInfo.value && Object.keys(authInfo.value).length) ? statusList.find(e => e.value === authInfo.value.status) : statusList[0]
  194. return obj
  195. })
  196. let completeStatus = false
  197. // 获取基本信息
  198. const getBaseInfo = async () => {
  199. const data = await getEnterpriseBaseInfo()
  200. if (!data) return
  201. query.id = data.id
  202. completeStatus = true
  203. formItems.value.options.forEach(item => {
  204. if (item.dictTypeName) {
  205. getDict(item.dictTypeName).then(({ data }) => {
  206. data = data?.length && data || []
  207. item.items = data
  208. })
  209. }
  210. query.industryId = data.industryId
  211. if (item.key === 'industryId') {
  212. item.value = industryList.value.find(e => e.id === data[item.key])?.nameCn
  213. } else item.value = data[item.key]
  214. // 完成度展示
  215. if (item.value === undefined || item.value === null || item.value === '') completeStatus = false
  216. })
  217. // 完成度展示
  218. emit('complete', { status: completeStatus, id: 'basicInfo' })
  219. }
  220. getBaseInfo()
  221. // 所在行业
  222. const handleIndustry = (list, arr) => {
  223. if (!list.length) return
  224. query.industryId = list[0]
  225. const str = arr.map(e => e.nameCn).join('、')
  226. setValue('industryId', str)
  227. }
  228. const handleSave = async () => {
  229. const { valid } = await CtFormRef.value.formRef.validate()
  230. if (!valid) return
  231. formItems.value.options.forEach(e => {
  232. if (e.noParam) return
  233. query[e.key] = e.value
  234. })
  235. await updateEnterpriseBaseInfo(query)
  236. Snackbar.success(t('common.saveMsg'))
  237. getBaseInfo()
  238. }
  239. defineExpose({
  240. getAuthInfo
  241. })
  242. </script>
  243. <style lang="scss" scoped>
  244. .topTip {
  245. background-color: #f7f8fa;
  246. color: #2f3640;
  247. padding: 12px 20px;
  248. margin: 10px 0 40px;
  249. font-size: 14px;
  250. }
  251. </style>