lifanagju_citu il y a 9 mois
Parent
commit
aedf852282

+ 9 - 1
src/api/enterprise.js

@@ -148,8 +148,16 @@ export const updateEnterpriseWelfare = async (data) => {
   })
 }
 
+// 招聘端-企业信息-修改企业标签
+export const updateEnterpriseTag = async (data) => {
+  return await request.post({
+    url: '/app-admin-api/menduner/system/enterprise/tag/update',
+    data
+  })
+}
+
 // 根据类型获取标签信息
-export const getTagDataApi = async (params) => {
+export const getTagTreeDataApi = async (params) => {
   return await request.get({
     url: '/admin-api/menduner/system/tag/get/by/type',
     params

+ 2 - 0
src/views/recruit/enterprise/informationManagement/informationSettings.vue

@@ -20,6 +20,7 @@ import basicInfo from './informationSettingsComponents/basicInfo.vue'
 import enterpriseLogo from './informationSettingsComponents/enterpriseLogo.vue'
 import enterpriseAlbum from './informationSettingsComponents/enterpriseAlbum.vue'
 import welfareLabel from './informationSettingsComponents/welfareLabel.vue'
+import enterpriseLabel from './informationSettingsComponents/enterpriseLabel.vue'
 import businessInformation from './informationSettingsComponents/businessInformation.vue'
 import authentication from './informationSettingsComponents/authentication.vue'
 import { ref, watch } from 'vue'
@@ -40,6 +41,7 @@ const tabList = [
   { label: t('enterprise.infoSetting.enterpriseLogo'), value: 2, path: enterpriseLogo },
   { label: t('enterprise.infoSetting.enterpriseAlbum'), value: 3, path: enterpriseAlbum },
   { label: t('enterprise.infoSetting.welfareLabel'), value: 4, path: welfareLabel },
+  { label: t('enterprise.infoSetting.enterpriseLabel'), value: 7, path: enterpriseLabel },
   { label: t('enterprise.infoSetting.businessInformation'), value: 5, path: businessInformation },
   { label: t('setting.realNameAuthentication'), value: 6, path: authentication },
 ]

+ 116 - 0
src/views/recruit/enterprise/informationManagement/informationSettingsComponents/enterpriseLabel.vue

@@ -0,0 +1,116 @@
+<!-- 企业标签 -->
+<template>
+  <span style="font-size: 16px;" class="mr-1">已选择标签</span>
+  <span style="font-size: 14px; color: var(--color-666);">(最多10个标签)</span>
+  <div class="mb-15">
+    <v-chip
+      v-for="(item, index) in chosen" :key="index"
+      class="chip mx-2 mt-4"
+      label color="primary"
+    >
+      {{ item }}
+      <v-icon size="18" color="primary" style="margin-left: 6px;" @click="closeClick(item)">mdi-close-circle</v-icon>
+    </v-chip>
+    <div>
+      <div v-if="customTag" class="d-flex align-center mx-2 mt-4">
+        <TextUI class="mr-2" :item="textItem" @appendInnerClick.stop="appendInnerClick"></TextUI>
+        <v-icon size="22" color="#ccc" style="cursor: pointer;" @click="customTag = false">mdi-close</v-icon>
+      </div>
+      <div v-else @click="customTag = true">
+        <v-chip class="chip mx-2 mt-4" label color="orange"><v-icon icon="mdi-plus" start></v-icon>自定义标签</v-chip>
+      </div>
+    </div>
+  </div>
+  <div v-for="(val, index) in chipList" :key="'enterpriseLabel' + index" class="mb-8">
+    <span style="font-size: 16px;">{{ val?.nameCn || '--' }}</span>
+    <div v-if="val?.children?.length">
+      <v-chip
+        v-for="(item, index) in val.children" :key="index"
+        class="chip mx-2 mt-4"
+        label color="primary"
+        :disabled="chosen.includes(item?.nameCn )"
+        @click="choseClick(item?.nameCn )"
+      >
+        <v-icon icon="mdi-plus" start></v-icon>
+        {{ item?.nameCn || '--' }}
+      </v-chip>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import TextUI from '@/components/FormUI/TextInput'
+import Snackbar from '@/plugins/snackbar'
+import Confirm from '@/plugins/confirm'
+import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
+import { getEnterpriseBaseInfo, updateEnterpriseTag, getTagTreeDataApi } from '@/api/enterprise'
+import { ref } from 'vue';
+defineOptions({name: 'informationSettingsComponents-enterpriseLabel'})
+const customTag = ref(false)
+const limitNum = ref(10)
+let chosen = ref([])
+// 删除
+const closeClick = (item) => {
+  Confirm('系统提示', '是否确认删除?').then(async () => {
+    chosen.value = chosen.value.filter(e => e !== item)
+    handleSave('删除')
+  })
+}
+// 从推荐标签添加
+const choseClick = (item) => {
+  if (chosen.value?.length >= limitNum.value) return Snackbar.warning('最多可加10个标签')
+  chosen.value.push(item)
+  handleSave('添加')
+}
+// 保存自定义
+const appendInnerClick = (value) => {
+  if (chosen.value?.length >= limitNum.value) return Snackbar.warning('最多可加10个标签')
+  if (!value) return Snackbar.warning(t('common.pleaseEnter')+t('enterprise.infoSetting.enterpriseLabel'))
+  const index = chosen.value.findIndex(e => e === value)
+  if (index !== -1) return Snackbar.warning(t('common.alreadyExists'))
+  chosen.value.push(value)
+  handleSave('保存')
+}
+// 保存
+const handleSave = async (type) => {
+  const appAdminEnterpriseWelfareReqVO = { tagList: chosen.value }
+  await updateEnterpriseTag(appAdminEnterpriseWelfareReqVO)
+  customTag.value = false
+  Snackbar.success(`${type}成功`)
+  setTimeout(() => { // 马上获取数据数据会不同步故setTimeout
+    getData()
+  }, 5000)
+}
+
+// 推荐标签
+const chipList = ref([])
+// 根据类型获取标签信息
+const getTagTreeData = async () => { // type: 标签类型-> 0人员画像标签 1职位标签 2招聘职位标签 3企业福利标签 4企业标签 
+  const data = await getTagTreeDataApi({ type: 4 })
+  chipList.value = data || []
+}
+getTagTreeData()
+
+// 获取数据
+const getData = async () => {
+  const data = await getEnterpriseBaseInfo()
+  chosen.value = data?.tagList || []
+}
+getData()
+const textItem = ref({
+  type: 'text',
+  width: 250,
+  hideDetails: true,
+  autofocus: true, // 聚焦。
+  value: '',
+  label: '请输入自定义标签',
+  // appendInnerIcon: 'mdi-content-save-outline',
+  appendInnerIcon: 'mdi-checkbox-marked-circle',
+  appendInnerClick: appendInnerClick,
+})
+</script>
+<style lang="scss" scoped>
+.chip {
+  cursor: pointer;
+}
+</style>

+ 4 - 4
src/views/recruit/enterprise/informationManagement/informationSettingsComponents/welfareLabel.vue

@@ -43,7 +43,7 @@ import TextUI from '@/components/FormUI/TextInput'
 import Snackbar from '@/plugins/snackbar'
 import Confirm from '@/plugins/confirm'
 import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
-import { getEnterpriseBaseInfo, updateEnterpriseWelfare, getTagDataApi } from '@/api/enterprise'
+import { getEnterpriseBaseInfo, updateEnterpriseWelfare, getTagTreeDataApi } from '@/api/enterprise'
 import { ref } from 'vue';
 defineOptions({name: 'informationSettingsComponents-welfareLabel'})
 const customTag = ref(false)
@@ -85,11 +85,11 @@ const handleSave = async (type) => {
 // 推荐标签
 const chipList = ref([])
 // 根据类型获取标签信息
-const getTagData = async () => { // type: 标签类型-> 0人员画像标签 1职位标签 2招聘职位标签 3企业福利标签 4企业标签 
-  const data = await getTagDataApi({ type: 3 })
+const getTagTreeData = async () => { // type: 标签类型-> 0人员画像标签 1职位标签 2招聘职位标签 3企业福利标签 4企业标签 
+  const data = await getTagTreeDataApi({ type: 3 })
   chipList.value = data || []
 }
-getTagData()
+getTagTreeData()
 
 // 获取数据
 const getData = async () => {