Explorar el Código

Merge branch 'jobFair' of https://git.citupro.com/zhengnaiwen_citu/menduner into jobFair

Xiao_123 hace 4 semanas
padre
commit
51f4595750

+ 67 - 3
src/views/recruit/enterprise/hirePosition/components/baseInfo.vue

@@ -39,6 +39,21 @@
     <CtDialog :visible="show" :widthType="1" titleClass="text-h6" title="全员猎寻岗位规则说明" :footer="false" @close="show = false">
       <RulePage />
     </CtDialog>
+
+    <CtDialog :visible="showDialog" :widthType="1" titleClass="text-h6" :footer="false" title="重复职位列表" @close="showDialog = false">
+      <CtTable
+        :items="tableItems"
+        :headers="headers"
+        :loading="false"
+        :elevation="0"
+        :isTools="false"
+        :showPage="false"
+      >
+        <template #actions="{ item }">
+          <v-btn :disabled="!item.id" color="primary" variant="text" @click="handleDetails(item)">详情</v-btn>
+        </template>
+      </CtTable>
+    </CtDialog>
   </div>
 </template>
 
@@ -50,6 +65,13 @@ import textUI from '@/components/FormUI/TextInput'
 import jobTypeCard from '@/components/jobTypeCard'
 import RulePage from './rule.vue'
 import { commissionCalculation } from '@/utils/position'
+import Confirm from '@/plugins/confirm'
+import Snackbar from '@/plugins/snackbar'
+import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
+import { getJobAdvertised } from '@/api/enterprise'
+import { formatName } from '@/utils/getText'
+import { dealDictArrayData } from '@/utils/position'
+import { timesTampChange } from '@/utils/date'
 import { getPublicRatio, getRecruitPositionDetails } from '@/api/recruit/enterprise/position'
 
 const props = defineProps({
@@ -72,6 +94,50 @@ const getValue = (key) => {
 const formPageRef = ref()
 let query = reactive({})
 
+// 重复职位弹窗
+const showDialog = ref(false)
+const tableItems = ref([])
+const headers = [
+  { title: '职位名称', key: 'name', sortable: false, value: item => formatName(item.name) },
+  { title: '薪资', key: 'payTo', sortable: false, value: item => !item.payFrom && !item.payTo ? '面议' : `${item.payFrom}-${item.payTo}/${item.payName}` },
+  { title: '学历要求', key: 'eduName', sortable: false },
+  { title: '工作经验', key: 'expName', sortable: false },
+  { title: '地区', key: 'area', sortable: false, value: item => !item.areaId ? '全国' : item.area?.str },
+  { title: '状态', key: 'status', sortable: false, value: item => !item.status ? '' : item.status === '0' ? '招聘中' : '已关闭' },
+  { title: '创建时间', key: 'createTime', sortable: false, value: item => timesTampChange(item.createTime) },
+  { title: '更新时间', key: 'updateTime', sortable: false, value: item => timesTampChange(item.updateTime) },
+  { title: '操作', key: 'actions', sortable: false }
+]
+
+const handleDetails = (item) => {
+  window.open(`/recruit/enterprise/position/details?id=${item.id}`)
+}
+
+let showConfirm = false
+// 效验职位名称是否重复
+const handleValidName = async (item, val) => {
+  if (!val || showConfirm) return
+  try {
+    const data = await getJobAdvertised({ jobName: val })
+    tableItems.value = data ? dealDictArrayData([], data) : []
+
+    if (data && data.length > 0) {
+      showConfirm = true // 避免快速点击出现多个弹窗提示
+      Confirm(
+        t('common.confirmTitle'), 
+        '该职位名称已在您的招聘职位列表中存在,是否继续发布?', 
+        { sureText: '查看已有职位', cancelText: '继续发布', cancelCallback: true }
+      ).then(() => {
+        // 弹窗查看已有职位
+        showDialog.value = true
+        showConfirm = false
+      }).catch(() => {
+        showConfirm = false
+      })
+    }
+  } catch {}
+}
+
 const items = ref({
   options: [
     {
@@ -103,6 +169,7 @@ const items = ref({
       key: 'name',
       value: '',
       label: '职位名称 *',
+      blur: handleValidName, // 效验职位名称是否重复
       rules: [v => !!v || '请填写职位名称']
     },
     {
@@ -167,9 +234,6 @@ const handleJobClickItem = (list, name) => {
 }
 
 // 职位模板
-import Confirm from '@/plugins/confirm'
-import Snackbar from '@/plugins/snackbar'
-import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
 const useJobTemplate = async () => {
   if (!query.positionId) return Snackbar.warning('请先选择职位类型')
   // 获取职位模板内容-赋值

+ 7 - 2
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -100,21 +100,26 @@ const handleDetails = (item) => {
   window.open(`/recruit/enterprise/position/details?id=${item.id}`)
 }
 
+let showConfirm = false
 // 效验职位名称是否重复
 const handleValidName = async (item, val) => {
-  if (!val) return
+  if (!val || showConfirm) return
   try {
     const data = await getJobAdvertised({ jobName: val })
     tableItems.value = data ? dealDictArrayData([], data) : []
 
     if (data && data.length > 0) {
+      showConfirm = true // 避免快速点击出现多个弹窗提示
       Confirm(
         t('common.confirmTitle'), 
         '该职位名称已在您的招聘职位列表中存在,是否继续发布?', 
-        { sureText: '查看已有职位', cancelText: '继续发布' }
+        { sureText: '查看已有职位', cancelText: '继续发布', cancelCallback: true }
       ).then(() => {
         // 弹窗查看已有职位
         showDialog.value = true
+        showConfirm = false
+      }).catch(() => {
+        showConfirm = false
       })
     }
   } catch {}