basicInfo.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 :style="{'color': statusInfo.color,'font-size': '14px'}">{{ 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 { t } = useI18n()
  43. const CtFormRef = ref()
  44. const query = reactive({})
  45. const formItems = ref({
  46. options: [
  47. {
  48. type: 'text',
  49. key: 'name',
  50. value: '',
  51. label: '企业全称 *',
  52. slotName: 'name',
  53. rules: [v => !!v || '请输入企业全称']
  54. },
  55. {
  56. type: 'text',
  57. key: 'anotherName',
  58. value: '',
  59. col: 6,
  60. flexStyle: 'mr-3',
  61. label: '企业别名 *',
  62. rules: [v => !!v || '请输入企业别名']
  63. },
  64. {
  65. type: 'text',
  66. key: 'website',
  67. value: '',
  68. col: 6,
  69. label: '企业官网'
  70. },
  71. {
  72. type: 'text',
  73. key: 'contact',
  74. value: '',
  75. col: 6,
  76. flexStyle: 'mr-3',
  77. label: '联系人'
  78. },
  79. {
  80. type: 'text',
  81. key: 'phoneNumber',
  82. value: '',
  83. col: 6,
  84. label: '联系电话'
  85. },
  86. {
  87. slotName: 'industryId',
  88. key: 'industryId',
  89. value: null,
  90. label: '所在行业 *',
  91. outlined: true,
  92. clearable: false,
  93. itemText: 'label',
  94. itemValue: 'value',
  95. col: 6,
  96. noParam: true,
  97. flexStyle: 'mr-3',
  98. rules: [v => !!v || '请选择所在行业']
  99. },
  100. {
  101. type: 'autocomplete',
  102. key: 'financingStatus',
  103. value: null,
  104. label: '融资阶段 *',
  105. outlined: true,
  106. clearable: false,
  107. itemText: 'label',
  108. itemValue: 'value',
  109. col: 6,
  110. dictTypeName: 'menduner_financing_status',
  111. rules: [v => !!v || '请选择融资阶段'],
  112. items: []
  113. },
  114. {
  115. type: 'autocomplete',
  116. key: 'scale',
  117. value: null,
  118. label: '企业规模 *',
  119. outlined: true,
  120. clearable: false,
  121. itemText: 'label',
  122. itemValue: 'value',
  123. col: 6,
  124. flexStyle: 'mr-3',
  125. dictTypeName: 'menduner_scale',
  126. rules: [v => !!v || '请选择企业规模'],
  127. items: []
  128. },
  129. {
  130. type: 'text',
  131. key: 'workTime',
  132. value: null,
  133. col: 6,
  134. class: 'mb-3',
  135. label: '上班时间(示例:上午09:00 - 下午17:00) *',
  136. rules: [v => !!v || '请填写上班时间']
  137. },
  138. {
  139. type: 'datePicker',
  140. key: 'openTime',
  141. value: null,
  142. col: 6,
  143. class: 'mb-3',
  144. flexStyle: 'mr-3',
  145. rules: [v => !!v || '请选择开业时间'],
  146. options: {
  147. type: 'date',
  148. format: 'timestamp',
  149. placeholder: '开业时间 *',
  150. clearable: false
  151. },
  152. },
  153. {
  154. slotName: 'prepare',
  155. key: 'prepare',
  156. value: true,
  157. col: 6
  158. },
  159. {
  160. type: 'textarea',
  161. key: 'introduce',
  162. value: null,
  163. counter: 2000,
  164. rows: 6,
  165. label: '企业介绍 *',
  166. outlined: true,
  167. rules: [v => !!v || '请输入企业介绍']
  168. },
  169. ]
  170. })
  171. const setValue = (key, value) => {
  172. formItems.value.options.find(e => e.key === key).value = value
  173. }
  174. // 行业列表
  175. const industryList = ref([])
  176. getDict('menduner_industry_type', {}, 'industryList').then(({ data }) => {
  177. data = data?.length && data || []
  178. industryList.value = data
  179. })
  180. // 获取企业实名信息
  181. const authInfo = ref({})
  182. const statusList = [
  183. { label: '未认证', color: '#fb8c00', value: null, mdi: 'mdi-shield-remove' },
  184. { label: '审核中', color: '#fb8c00', value: '0', mdi: 'mdi-shield-half-full' },
  185. { label: '已认证', color: '#00897B', value: '1', mdi: 'mdi-shield-check' },
  186. { label: '已驳回', color: '#fe574a', value: '2', mdi: 'mdi-shield-off' }
  187. ]
  188. const getAuthInfo = async () => {
  189. const data = await getEnterpriseAuth()
  190. if (!data) return
  191. authInfo.value = data
  192. }
  193. getAuthInfo()
  194. const statusInfo = computed(() => {
  195. const obj = (authInfo.value && Object.keys(authInfo.value).length) ? statusList.find(e => e.value === authInfo.value.status) : statusList[0]
  196. return obj
  197. })
  198. // 获取基本信息
  199. const getBaseInfo = async () => {
  200. const data = await getEnterpriseBaseInfo()
  201. if (!data) return
  202. query.id = data.id
  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. }
  216. getBaseInfo()
  217. // 所在行业
  218. const handleIndustry = (list, arr) => {
  219. if (!list.length) return
  220. query.industryId = list[0]
  221. const str = arr.map(e => e.nameCn).join('、')
  222. setValue('industryId', str)
  223. }
  224. const handleSave = async () => {
  225. const { valid } = await CtFormRef.value.formRef.validate()
  226. if (!valid) return
  227. formItems.value.options.forEach(e => {
  228. if (e.noParam) return
  229. query[e.key] = e.value
  230. })
  231. await updateEnterpriseBaseInfo(query)
  232. Snackbar.success(t('common.saveMsg'))
  233. getBaseInfo()
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .topTip {
  238. background-color: #f7f8fa;
  239. color: #2f3640;
  240. padding: 12px 20px;
  241. margin: 10px 0 40px;
  242. font-size: 14px;
  243. }
  244. </style>