basicInfo.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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="primary" size="20">mdi-shield-check</v-icon> <!-- mdi-shield-remove -->
  9. <span style="color: var(--v-primary-base);font-size: 14px;">已认证</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. </CtForm>
  25. <div class="text-center">
  26. <v-btn color="primary" class="buttons mt-3 mb-10" @click.stop="handleSave">{{ $t('common.save') }}</v-btn>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup>
  31. defineOptions({name: 'informationSettingsComponents-basicInfo'})
  32. import { ref, reactive } from 'vue'
  33. import { getEnterpriseBaseInfo, updateEnterpriseBaseInfo } from '@/api/enterprise'
  34. import { getDict } from '@/hooks/web/useDictionaries'
  35. import { useI18n } from '@/hooks/web/useI18n'
  36. import industryTypeCard from '@/components/industryTypeCard'
  37. import Snackbar from '@/plugins/snackbar'
  38. const { t } = useI18n()
  39. const CtFormRef = ref()
  40. const query = reactive({})
  41. const formItems = ref({
  42. options: [
  43. {
  44. type: 'text',
  45. key: 'name',
  46. value: '',
  47. label: '企业全称 *',
  48. slotName: 'name',
  49. rules: [v => !!v || '请输入企业全称']
  50. },
  51. {
  52. type: 'text',
  53. key: 'anotherName',
  54. value: '',
  55. col: 6,
  56. flexStyle: 'mr-3',
  57. label: '企业别名 *',
  58. rules: [v => !!v || '请输入企业别名']
  59. },
  60. {
  61. type: 'text',
  62. key: 'website',
  63. value: '',
  64. col: 6,
  65. label: '企业官网'
  66. },
  67. {
  68. type: 'text',
  69. key: 'contact',
  70. value: '',
  71. col: 6,
  72. flexStyle: 'mr-3',
  73. label: '联系人'
  74. },
  75. {
  76. type: 'text',
  77. key: 'phone',
  78. value: '',
  79. col: 6,
  80. label: '联系电话'
  81. },
  82. {
  83. slotName: 'industryId',
  84. key: 'industryId',
  85. value: null,
  86. label: '所在行业 *',
  87. outlined: true,
  88. clearable: false,
  89. itemText: 'label',
  90. itemValue: 'value',
  91. col: 6,
  92. noParam: true,
  93. flexStyle: 'mr-3',
  94. rules: [v => !!v || '请选择所在行业']
  95. },
  96. {
  97. type: 'autocomplete',
  98. key: 'financingStatus',
  99. value: null,
  100. label: '融资阶段 *',
  101. outlined: true,
  102. clearable: false,
  103. itemText: 'label',
  104. itemValue: 'value',
  105. col: 6,
  106. dictTypeName: 'menduner_financing_status',
  107. rules: [v => !!v || '请选择融资阶段'],
  108. items: []
  109. },
  110. {
  111. type: 'autocomplete',
  112. key: 'scale',
  113. value: null,
  114. label: '企业规模 *',
  115. outlined: true,
  116. clearable: false,
  117. itemText: 'label',
  118. itemValue: 'value',
  119. col: 6,
  120. flexStyle: 'mr-3',
  121. dictTypeName: 'menduner_scale',
  122. rules: [v => !!v || '请选择企业规模'],
  123. items: []
  124. },
  125. {
  126. type: 'text',
  127. key: 'workTime',
  128. value: null,
  129. col: 6,
  130. class: 'mb-3',
  131. label: '上班时间(示例:上午09:00 - 下午17:00) *',
  132. rules: [v => !!v || '请填写上班时间']
  133. },
  134. {
  135. type: 'textarea',
  136. key: 'introduce',
  137. value: null,
  138. counter: 2000,
  139. rows: 6,
  140. label: '企业介绍 *',
  141. outlined: true,
  142. rules: [v => !!v || '请输入企业介绍']
  143. },
  144. ]
  145. })
  146. const setValue = (key, value) => {
  147. formItems.value.options.find(e => e.key === key).value = value
  148. }
  149. // 行业列表
  150. const industryList = ref([])
  151. getDict('menduner_industry_type', {}, 'industryList').then(({ data }) => {
  152. data = data?.length && data || []
  153. industryList.value = data
  154. })
  155. // 获取基本信息
  156. const getBaseInfo = async () => {
  157. const data = await getEnterpriseBaseInfo()
  158. if (!data) return
  159. query.id = data.id
  160. formItems.value.options.forEach(item => {
  161. if (item.dictTypeName) {
  162. getDict(item.dictTypeName).then(({ data }) => {
  163. data = data?.length && data || []
  164. item.items = data
  165. })
  166. }
  167. query.industryId = data.industryId
  168. if (item.key === 'industryId') {
  169. item.value = industryList.value.find(e => e.id === data[item.key])?.nameCn
  170. } else item.value = data[item.key]
  171. })
  172. }
  173. getBaseInfo()
  174. // 所在行业
  175. const handleIndustry = (list, arr) => {
  176. if (!list.length) return
  177. query.industryId = list[0]
  178. const str = arr.map(e => e.nameCn).join('、')
  179. setValue('industryId', str)
  180. }
  181. const handleSave = async () => {
  182. const { valid } = await CtFormRef.value.formRef.validate()
  183. if (!valid) return
  184. formItems.value.options.forEach(e => {
  185. if (e.noParam) return
  186. query[e.key] = e.value
  187. })
  188. await updateEnterpriseBaseInfo(query)
  189. Snackbar.success(t('common.saveMsg'))
  190. getBaseInfo()
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .topTip {
  195. background-color: #f7f8fa;
  196. color: #2f3640;
  197. padding: 12px 20px;
  198. margin: 10px 0 40px;
  199. font-size: 14px;
  200. }
  201. </style>