Browse Source

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

Xiao_123 6 tháng trước cách đây
mục cha
commit
8e10a1f54a

+ 23 - 2
src/utils/dealData.js

@@ -1,5 +1,5 @@
 // 获取所有的叶子节点
-export const  getLeafNodes = (tree) => {
+export const getLeafNodes = (tree) => {
   const leafNodes = []
   function traverse(node) {
     if (!node.children || node.children.length === 0) {
@@ -19,10 +19,31 @@ export const  getLeafNodes = (tree) => {
 }
 
 // 获取所有二级节点
-export const  getSecondNodes = (tree) => {
+export const getSecondNodes = (tree) => {
   let nodes = []
   for (const rootNode of tree) {
     if (rootNode.children?.length) nodes = [...nodes, ...rootNode.children]
   }
   return nodes
+}
+
+// 找到数组中第一对重复的元素并返回元素及元素在原数组的下标
+export const findFirstDuplicateWithIndices = (arr) => {
+  const elementIndices = new Map();
+  for (let i = 0; i < arr.length; i++) {
+    const element = arr[i];
+    if (elementIndices.has(element)) {
+      // 如果元素已经在 elementIndices 中,返回元素和它的两个下标
+      return {
+        element: element,
+        firstIndex: elementIndices.get(element),
+        secondIndex: i
+      };
+    } else {
+      // 如果元素不在 elementIndices 中,存储它的下标
+      elementIndices.set(element, i);
+    }
+  }
+  // 如果没有找到重复元素,返回 null 或其他表示未找到的值
+  return null;
 }

+ 13 - 2
src/views/recruit/entRegister/register.vue

@@ -80,7 +80,7 @@
           <div v-for="(item, index) in contactCopy" :key="index" class="contactItemCard">
             <div class="d-flex justify-space-between pb-2">
               <div class="mb-3 pl-3" style="font-size: 13px; color: 00897B; border-left: 5px solid #00897B;">{{ index ? '联系人' + index : '管理员' }}</div>
-              <v-btn v-if="index" color="error" density="compact" variant="text" @click="delContact(index)">删除</v-btn>
+              <v-btn v-if="index > 1" color="error" density="compact" variant="text" @click="delContact(index)">删除</v-btn>
               <div v-else style="font-size: 12px; color: #999">不可删除</div>
             </div>
             <TextUI v-model="item.contactName" :item="{...contactNameObj}"></TextUI>
@@ -111,6 +111,7 @@ import { checkCompanyEmail } from '@/utils/validate'
 import { getBusinessLicenseOCR } from '@/api/common'
 import Confirm from '@/plugins/confirm'
 import TextUI from '@/components/FormUI/TextInput'
+import { findFirstDuplicateWithIndices } from '@/utils/dealData'
 
 const { t } = useI18n()
 const CtFormRef = ref()
@@ -341,6 +342,7 @@ if (info && Object.keys(info).length && info.status === '2') {
 const contactSubmit = () => {
   let falseValueIndex = null
   let falseKey = null
+  let emailList = []
   contactCopy.value.forEach((e, index) => {
     if (falseValueIndex !== null) return
     if (e && Object.keys(e).length) {
@@ -356,6 +358,7 @@ const contactSubmit = () => {
       falseValueIndex = index
       falseKey = 'compareFalse'
     }
+    if (e.email) emailList.push(e.email)
   })
   const textList =  {
     contactName: '姓名',
@@ -374,13 +377,21 @@ const contactSubmit = () => {
     }
     Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
     return
-  } 
+  }
+  // 邮箱不能相同
+  const duplicates = findFirstDuplicateWithIndices(emailList)
+  if (duplicates) {
+    let text = duplicates.firstIndex ? `联系人${duplicates.firstIndex}的企业邮箱和联系人${duplicates.secondIndex}的企业邮箱重复,请修改!` : `管理员的企业邮箱和联系人${duplicates.secondIndex}的企业邮箱重复,请修改!`
+    Confirm(t('common.confirmTitle'), text, { hideCancelBtn: true })
+    return
+  }
   contactList = [...contactCopy.value]
   showContactList.value = false
   saveRegisterInfo()
 }
 const handleAddContact = () => {
   contactCopy.value = [...contactList]
+  if (contactCopy.value?.length < 2) addMore() // 至少填写两个联系人
   showContactList.value = true
 }
 const addMore = () => {

+ 1 - 0
src/views/recruit/enterprise/interviewManagement/index.vue

@@ -6,6 +6,7 @@
         <Autocomplete v-model="query.status" :item="statusItem"></Autocomplete>
         <v-btn color="primary" class="half-button ml-3" @click="handleSearch">查 询</v-btn>
         <v-btn class="half-button ml-3" variant="outlined" color="primary" @click="handleReset">重 置</v-btn>
+        <v-btn class="half-button ml-10" prepend-icon="mdi-refresh" variant="outlined" color="primary" @click="handleReset">刷 新</v-btn>
       </div>
     </div>
     <v-divider class="mb-3"></v-divider>