1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <!-- -->
- <template>
- <view class="f-straight wrapper">
- <uni-forms ref="form" :modelValue="formData" validateTrigger="bind" label-width="90px" label-align="right">
- <uni-forms-item label="招聘部门" name="dept">
- <uni-easyinput v-model="formData.dept" placeholder="请填写招聘部门"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item label="专业要求" name="majorName">
- <uni-combox placeholder="请选择专业要求" v-model="majorName" :candidates="majorData" @input="handleSearchMajor"></uni-combox>
- </uni-forms-item>
- <uni-forms-item label="工作频率" name="dateType">
- <uni-data-picker popup-title="请选择工作频率" v-model="formData.dateType" :localdata="dateTypeArr" :clear-icon="false" :map="{ text: 'label', value: 'value'}"></uni-data-picker>
- </uni-forms-item>
- <uni-forms-item label="出勤天数" name="frequendayay">
- <uni-number-box v-model="formData.day" :width="100"></uni-number-box>
- </uni-forms-item>
- </uni-forms>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { schoolMajorByName, schoolMajorById } from '@/api/resume'
- const props = defineProps({
- data: {
- type: Object,
- default: () => {}
- }
- })
- const formData = ref({
- dept: props.data?.dept || '',
- dateType: props.data?.frequency?.dateType || '',
- day: props.data?.frequency?.day-0 || 0,
- })
- const dateTypeArr = [
- { label: '每周', value: 'week' },
- { label: '每月', value: 'month' },
- { label: '每年', value: 'year' }
- ]
- const majorData = ref([])
- const majorDataClone = ref([])
- const majorName = ref(props.data?.major || '')
- const handleSearchMajor = (e) => {
- if (!e) return majorData.value = []
- schoolMajorByName({ name: e }).then(res => {
- const list = res?.data && res.data?.length ? res.data : []
- setMajorData(list)
- if (!list?.length) {
- // majorName.value = ''
- uni.showToast({ title: '未找到相关专业,请重新输入', icon: 'none', duration: 2000 })
- }
- })
- }
- function setMajorData (list) {
- majorData.value = list.map(e => e.nameCn)
- majorDataClone.value = list
- }
- // if (majorName.value) handleSearchMajor(majorName.value)
- async function getMajorById (id) {
- if (!id) return
- const { data } = await schoolMajorById({ id })
- if (!data) return
- majorName.value = data.nameCn
- setMajorData([data])
- }
- if (props.data?.majorId) getMajorById(props.data.majorId)
- const form = ref()
- const getQuery = () => {
- const obj = {
- dept: formData.value.dept,
- frequency: {
- dateType: formData.value.dateType,
- day: formData.value.day
- },
- major: majorDataClone.value?.length ? majorName.value : '',
- majorId: majorDataClone.value?.length ? majorDataClone.value.find(e => e.nameCn === majorName.value)?.id : ''
- }
- console.log('扩展信息:', obj)
- return obj
- }
- defineExpose({
- getQuery
- })
- </script>
- <style lang="scss" scoped>
- </style>
|