浏览代码

发布众聘职位

Xiao_123 10 月之前
父节点
当前提交
6b4eae2774

+ 18 - 15
src/components/FormUI/checkbox/index.vue

@@ -1,24 +1,27 @@
 <template>
-  <v-checkbox
-    v-model="value"
-    v-for="k in item.items"
-    :key="k.key"
-    :label="k.label"
-    :value="k.value"
-    :disabled="k.disabled"
-    :color="item.color || 'primary'"
-    :density="k.density || 'compact'"
-    :multiple="k.multiple === false ? false : true"
-    class="mr-3"
-    hide-details
-    @update:modelValue="modelValueUpDate"
-  ></v-checkbox>
+  <div class="d-flex align-center">
+    <div class="mr-5 color-999" :style="`width: ${item.width || 120}px;`">{{ item.label }}</div>
+    <v-checkbox
+      v-model="value"
+      v-for="k in item.items"
+      :key="k.key"
+      :label="k.label"
+      :value="k.value"
+      :disabled="k.disabled"
+      :color="item.color || 'primary'"
+      :density="k.density || 'compact'"
+      :multiple="k.multiple === false ? false : true"
+      class="mr-3"
+      hide-details
+      @update:modelValue="modelValueUpDate"
+    ></v-checkbox>
+  </div>
 </template>
 <script setup>
 import { ref, defineEmits } from 'vue';
 defineOptions({ name:'FormUI-v-checkbox'})
 
-const props = defineProps({item: Object, modelValue: [String, Number, Boolean]})
+const props = defineProps({item: Object, modelValue: Array})
 const emit = defineEmits(['update:modelValue', 'change'])
 const item = props.item
 const value = ref(props.modelValue)

+ 8 - 1
src/views/recruit/enterprise/positionManagement/components/add.vue

@@ -98,8 +98,15 @@ const handleSave = async () => {
   const baseInfo = await baseInfoRef.value[0].getQuery()
   const requirement = await jobRequirementsRef.value[0].getQuery()
   if (!baseInfo || !requirement) return Snackbar.warning('请将信息填写完整')
+  // 判断是否有选择众聘岗位,选择了是否有填赏金或积分
+  if (baseInfo.hire) {
+    if (!baseInfo.hirePrice && !baseInfo.hirePoint) return Snackbar.warning('您选择的是众聘岗位,请填写奖励赏金或积分!')
+    if (Number(baseInfo.hirePrice) === 0 && Number(baseInfo.hirePoint) === 0) return Snackbar.warning('填写的赏金/积分不得小于1')
+  }
+
   const query = Object.assign(baseInfo, requirement)
-  // 有id则为编辑
+
+  // // 有id则为编辑
   if (route.query && route.query.id) query.id = route.query.id
   try {
     await saveJobAdvertised(query)

+ 38 - 78
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -1,15 +1,21 @@
 <template>
   <div>
-    <CtForm ref="formPageRef" :items="items" style="width: 600px;">
+    <CtForm ref="formPageRef" :items="items" style="width: 650px;">
       <template #explain>
-        <span style="color: var(--v-error-base); cursor: pointer;" @click="handleViewRule">
-          <v-icon size="25" color="error">mdi-help-circle-outline</v-icon>
-          众聘岗位规则说明
-        </span>
+        <div class="d-flex align-center font-size-13">
+          <div style="color: var(--v-error-base); cursor: pointer;" @click="handleViewRule">
+            <v-icon size="20" color="error">mdi-help-circle-outline</v-icon>
+            众聘岗位规则说明;
+          </div>
+          <div class=" ml-5" style="color: var(--v-error-base);">
+            众聘岗位分配比例:推荐人占比{{ ratio.recommendRate }}%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 平台占比{{ ratio.headhuntRate }}%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 投递人占比{{ ratio.cvRate }}%
+          </div>
+        </div>
       </template>
-      <template #ratio>
-        <div class="font-size-13 mb-3" style="color: red;">
-          众聘岗位分配比例:平台占比{{ ratio.headhuntRate }}%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 推荐人占比{{ ratio.recommendRate }}%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 投递人占比{{ ratio.cvRate }}%
+      <template #numericalValue>
+        <div class="font-size-14 color-error my-1">
+          <div>按众聘岗位分配比例计算后的赏金: 推荐人{{ calculation('hirePrice', 1) }}元、平台{{ calculation('hirePrice', 0) }}元、投递人{{ calculation('hirePrice', 2) }}元</div>
+          <div>按众聘岗位分配比例计算后的积分: 推荐人{{ calculation('hirePoint', 1) }}点、平台{{ calculation('hirePoint', 0) }}点、投递人{{ calculation('hirePoint', 2) }}点</div>
         </div>
       </template>
       <template #positionId="{ item }">
@@ -40,6 +46,7 @@ import { reactive, ref, defineExpose, watch } from 'vue'
 import textUI from '@/components/FormUI/TextInput'
 import jobTypeCard from '@/components/jobTypeCard'
 import RulePage from './rule.vue'
+import { commissionCalculation } from '@/utils/position'
 import { getPublicRatio } from '@/api/recruit/enterprise/position'
 
 const props = defineProps({
@@ -49,42 +56,26 @@ const props = defineProps({
 const show = ref(false)
 const ratio = ref({})
 
-const getValue = (key) => {
-  return items.value.options.find(e => e.key === key)
+// 按分配比例计算金额积分
+const calculation = (key, type) => {
+  const value = items.value.options.find(e => e.key === key).value
+  return commissionCalculation(value, type)
 }
 
-// 众聘奖励类型
-const handleChangeHireType = () => {
-  const hireType = getValue('hireType')
-  let hirePrice = getValue('hirePrice')
-  let hirePoint = getValue('hirePoint')
-  if (hireType.value) {
-    hirePrice.hide = false
-    hirePoint.hide = true
-    hirePoint.value = null
-  } else {
-    hirePoint.hide = false
-    hirePrice.hide = true
-    hirePrice.value = null
-  }
+const getValue = (key) => {
+  return items.value.options.find(e => e.key === key)
 }
 
 // 是否众聘岗位
 const handleChangePublic = (val) => {
-  let hireType
   items.value.options.forEach(e => {
     if (!val && Object.prototype.hasOwnProperty.call(e, 'hide')) {
       e.hide = true
       e.value = null
       return
     }
-    if (e.key === 'hireType') {
-      e.hide = !val
-      e.value = props.itemData && props.itemData.hirePoint ? false : true
-      hireType = e
-    }
-    if (Object.prototype.hasOwnProperty.call(e, 'show')) {
-      if (hireType.value === e.show) e.hide = false
+    if (val && Object.prototype.hasOwnProperty.call(e, 'show')) {
+      e.hide = false
       return
     }
     if (e.slotName === 'explain') e.hide = val ? false : true
@@ -118,68 +109,37 @@ const items = ref({
       hide: true,
       flexStyle: 'mb-3'
     },
-    {
-      type: 'ifRadio',
-      key: 'hireType',
-      value: null,
-      label: '众聘奖励类型 *',
-      width: 120,
-      hide: true,
-      disabled: false,
-      noParam: true,
-      hideDetails: true,
-      items: [
-        { label: '赏金', value: true },
-        { label: '积分', value: false }
-      ],
-      change: handleChangeHireType
-    },
-    {
-      slotName: 'ratio',
-      noParam: true,
-      show: true,
-      hide: true
-    },
     {
       type: 'number',
       key: 'hirePrice',
       value: null,
-      label: '众聘赏金 *',
+      label: '众聘赏金',
       suffix: '元',
       hide: true,
       show: true,
-      rules: [
-        value => {
-          if (value) return true
-          return '请填写众聘赏金'
-        },
-        value => {
-          if (value >= 1) return true
-          return '赏金金额不得小于1'
-        }
-      ]
+      disabled: false,
+      hideDetails: true,
+      col: 6,
+      flexStyle: 'mr-3'
     },
     {
       type: 'number',
       key: 'hirePoint',
       value: null,
-      label: '众聘奖励积分数 *',
+      label: '众聘奖励积分数',
       suffix: '点',
       hide: true,
+      col: 6,
       disabled: false,
-      show: false,
-      rules: [
-        value => {
-          if (value) return true
-          return '请填写众聘众聘奖励积分数'
-        },
-        value => {
-          if (value >= 1) return true
-          return '积分数不得小于1'
-        }
-      ]
+      hideDetails: true,
+      show: false
+    },
+    {
+      slotName: 'numericalValue',
+      noParam: true,
+      show: true,
+      hide: true
     },
-    
     {
       type: 'text',
       key: 'name',