|
@@ -7,7 +7,7 @@
|
|
|
<!-- 编辑-表单 -->
|
|
|
<div v-if="isEdit" class="educExpItem-edit">
|
|
|
<h4 class="color6 my-3 mx-2"> {{ titleStatus ? $t('common.edit') : $t('common.add') }}{{ $t('resume.educationExp') }}</h4>
|
|
|
- <CtForm :items="formItems" style="width: 100%;"></CtForm>
|
|
|
+ <CtForm ref="CtFormRef" :items="formItems" style="width: 100%;"></CtForm>
|
|
|
<div class="text-end mt-3">
|
|
|
<v-btn class="half-button mr-3" variant="tonal" @click="isEdit = false">{{ $t('common.cancel') }}</v-btn>
|
|
|
<v-btn color="primary" class="half-button" @click="handleSave">{{ $t('common.save') }}</v-btn>
|
|
@@ -16,13 +16,13 @@
|
|
|
<!-- 展示 -->
|
|
|
<div
|
|
|
v-else
|
|
|
- v-for="(item, index) in items" :key="'educationExp' + index"
|
|
|
+ v-for="(item, index) in projectExp" :key="'educationExp' + index"
|
|
|
:class="[' mx-n2', {'mt-5': index }]"
|
|
|
>
|
|
|
<div class="educExpItem" @mouseenter="item.active = true" @mouseleave="item.active = false">
|
|
|
<div class="level1 d-flex align-center justify-space-between" style="height: 40px;">
|
|
|
<div>
|
|
|
- <span style="font-size: 18px; font-weight: bold;">{{ item.universityText }}</span>
|
|
|
+ <span style="font-size: 18px; font-weight: bold;">{{ item.schoolName }}</span>
|
|
|
<span class="color6 font15 ml-5">
|
|
|
<span>{{ item.eduStartText }}</span>
|
|
|
<span class="mx-1">至</span>
|
|
@@ -36,12 +36,12 @@
|
|
|
</div>
|
|
|
<div class="level2 my-2">
|
|
|
<span class="color6 font15">{{ item.major }}</span>
|
|
|
- <span class="vline" v-if="item.eduTypeText"></span>
|
|
|
- <span class="color6 font15">{{ item.eduTypeText }}</span>
|
|
|
+ <span class="vline" v-if="item.educationTypeText"></span>
|
|
|
+ <span class="color6 font15">{{ item.educationTypeText }}</span>
|
|
|
</div>
|
|
|
<div class="level3">
|
|
|
- <span class="color6 font15">主修科目:</span>
|
|
|
- <span class="color6 font15">{{ item.majors }}</span>
|
|
|
+ <span class="color6 font15">在校经历:</span>
|
|
|
+ <span class="color6 font15">{{ item.content }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -50,16 +50,20 @@
|
|
|
|
|
|
<script setup name="educationExp">
|
|
|
import CtForm from '@/components/CtForm'
|
|
|
-import { getYearMonth20YearsAgo, generateYearMonthDataArray } from './../utils/generateYearMonthData'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
+import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
+import { getTimeStamp, timesTampChange } from '@/utils/date'
|
|
|
+import { saveResumeEduExp, getResumeEduExp, deleteResumeEduExp } from '@/api/resume'
|
|
|
+import Confirm from '@/plugins/confirm'
|
|
|
import { nextTick, ref } from 'vue'
|
|
|
-const yearMonth = ref(generateYearMonthDataArray())
|
|
|
+import { shallowRef } from 'vue'
|
|
|
+const CtFormRef = ref()
|
|
|
|
|
|
const formItems = ref({
|
|
|
options: [
|
|
|
{
|
|
|
type: 'autocomplete',
|
|
|
- key: 'university',
|
|
|
+ key: 'schoolName',
|
|
|
value: null,
|
|
|
default: null,
|
|
|
label: '学校名称 *',
|
|
@@ -68,7 +72,7 @@ const formItems = ref({
|
|
|
itemText: 'label',
|
|
|
itemValue: 'value',
|
|
|
rules: [v => !!v || '请选择学校名称'],
|
|
|
- items: [{ label: '广州大学', value: '01111'}, { label: '同济大学', value: '01112'}]
|
|
|
+ items: [{ label: '广州大学', value: '广州大学'}, { label: '同济大学', value: '同济大学'}]
|
|
|
},
|
|
|
{
|
|
|
type: 'text',
|
|
@@ -82,139 +86,85 @@ const formItems = ref({
|
|
|
},
|
|
|
{
|
|
|
type: 'autocomplete',
|
|
|
- key: 'eduType',
|
|
|
- value: '4',
|
|
|
+ key: 'educationType',
|
|
|
+ value: null,
|
|
|
default: null,
|
|
|
- label: '最高学历 *',
|
|
|
+ label: '学历 *',
|
|
|
col: 6,
|
|
|
outlined: true,
|
|
|
itemText: 'label',
|
|
|
itemValue: 'value',
|
|
|
- rules: [v => !!v || '请选择最高学历'],
|
|
|
- items: [
|
|
|
- {
|
|
|
- id: 1552,
|
|
|
- label: "初中及以下",
|
|
|
- value: "0"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1553,
|
|
|
- label: "中专/中技",
|
|
|
- value: "1"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1554,
|
|
|
- label: "高中",
|
|
|
- value: "2"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1555,
|
|
|
- label: "大专",
|
|
|
- value: "3"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1556,
|
|
|
- label: "本科",
|
|
|
- value: "4"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1557,
|
|
|
- label: "硕士",
|
|
|
- value: "5"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1558,
|
|
|
- label: "博士",
|
|
|
- value: "6"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 1559,
|
|
|
- label: "其他",
|
|
|
- value: "99"
|
|
|
- }
|
|
|
- ]
|
|
|
+ rules: [v => !!v || '请选择学历'],
|
|
|
+ items: []
|
|
|
},
|
|
|
- { col: 6, },
|
|
|
{
|
|
|
type: 'autocomplete',
|
|
|
- key: 'eduStart',
|
|
|
+ key: 'educationSystemType',
|
|
|
value: null,
|
|
|
- default: getYearMonth20YearsAgo(20),
|
|
|
- label: '起始时间 *',
|
|
|
+ default: null,
|
|
|
+ label: '学制类型 *',
|
|
|
col: 6,
|
|
|
outlined: true,
|
|
|
itemText: 'label',
|
|
|
itemValue: 'value',
|
|
|
- rules: [v => !!v || '请选择起始时间'],
|
|
|
- items: yearMonth
|
|
|
+ rules: [v => !!v || '请选择学制类型'],
|
|
|
+ items: [{ label: '全日制', value: '0' }, { label: '非全日制', value: '1' }],
|
|
|
},
|
|
|
{
|
|
|
- type: 'autocomplete',
|
|
|
- key: 'eduEnd',
|
|
|
- value: null,
|
|
|
- default: getYearMonth20YearsAgo(20-4),
|
|
|
- label: '结束时间 *',
|
|
|
+ type: 'datepicker',
|
|
|
+ key: 'startTime',
|
|
|
+ value: shallowRef(null),
|
|
|
col: 6,
|
|
|
- outlined: true,
|
|
|
- itemText: 'label',
|
|
|
- itemValue: 'value',
|
|
|
- rules: [v => !!v || '请选择结束时间'],
|
|
|
- items: yearMonth
|
|
|
+ label: '起始时间 *',
|
|
|
+ rules: [v => !!v || '请选择起始时间']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'datepicker',
|
|
|
+ key: 'endTime',
|
|
|
+ value: shallowRef(null),
|
|
|
+ col: 6,
|
|
|
+ label: '结束时间 *',
|
|
|
+ rules: [v => !!v || '请选择结束时间']
|
|
|
},
|
|
|
{
|
|
|
type: 'textarea',
|
|
|
- key: 'majors',
|
|
|
+ key: 'content',
|
|
|
value: null,
|
|
|
default: null,
|
|
|
counter: 200,
|
|
|
- label: '主修科目 *',
|
|
|
+ label: '在校经历 *',
|
|
|
col: 12,
|
|
|
outlined: true,
|
|
|
- rules: [v => !!v || '请输入主修科目']
|
|
|
+ rules: [v => !!v || '请输入在校经历']
|
|
|
},
|
|
|
]
|
|
|
})
|
|
|
-const items = ref([
|
|
|
- {
|
|
|
- university: '01112',
|
|
|
- universityText: '同济大学',
|
|
|
- eduStart: 201909,
|
|
|
- eduEnd: 202307,
|
|
|
- eduStartText: '2019-09',
|
|
|
- eduEndText: '2023-07',
|
|
|
- major: '酒店管理',
|
|
|
- eduType: '5',
|
|
|
- eduTypeText: '硕士',
|
|
|
- majors: '现代酒店管理、酒店心理、旅游学概论、前厅客房服务与管理、餐饮服务与管理、酒店英语、现代酒店营销、酒店财务管理、会议服务与管理、康乐服务与管理、酒店实用英语。',
|
|
|
- },
|
|
|
- {
|
|
|
- university: '01111',
|
|
|
- universityText: '广州大学',
|
|
|
- eduStart: 201509,
|
|
|
- eduEnd: 201907,
|
|
|
- eduStartText: '2015-09',
|
|
|
- eduEndText: '2019-07',
|
|
|
- major: '软件工程',
|
|
|
- eduType: '4',
|
|
|
- eduTypeText: '本科',
|
|
|
- majors: '程序设计基础、面向对象程序设计、软件工程导论、离散结构、数据结构与算法、工程经济学、团队激励与沟通、软件工程职业实践、计算机系统基础、操作系统、数据库概论、网络及其计算、人机交互的软件工程方法、软件工程综合实践、软件构造、软件设计与体系结构、软件质量保证与测试等。',
|
|
|
- }
|
|
|
-])
|
|
|
+
|
|
|
+const dictList = [
|
|
|
+ { type: 'menduner_education_type', key: 'educationType' }
|
|
|
+]
|
|
|
|
|
|
// 左侧加mr
|
|
|
formItems.value.options.forEach((_e, index) => {
|
|
|
if ((index + 2) % 2 === 0 && !(!_e.col || _e.col >= 12)) _e.flexStyle = 'mr-3'
|
|
|
})
|
|
|
|
|
|
-// const handleIndustry = (list) => {
|
|
|
-// console.log(list, 'industry')
|
|
|
-// }
|
|
|
+// 获取数据
|
|
|
+const projectExp = ref([])
|
|
|
+const getData = async () => {
|
|
|
+ const data = await getResumeEduExp()
|
|
|
+ projectExp.value = data
|
|
|
+}
|
|
|
+getData()
|
|
|
+
|
|
|
// 新增 或 编辑
|
|
|
const isEdit = ref(false)
|
|
|
const titleStatus = ref(0)
|
|
|
+const rowObj = ref({})
|
|
|
const handle = (item) => {
|
|
|
titleStatus.value = item ? 1 : 0
|
|
|
if (item) { // 编辑
|
|
|
+ rowObj.value = item
|
|
|
formItems.value.options.forEach(_i => { if (item[_i.key]) _i.value = item[_i.key] })
|
|
|
} else { // 新增
|
|
|
formItems.value.options.forEach(_i => _i.value = _i.default || null)
|
|
@@ -224,16 +174,57 @@ const handle = (item) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const transformItems = ['educationType', 'educationSystemType']
|
|
|
+formItems.value.options.forEach((e, index) => {
|
|
|
+ if ((index + 2) % 2 === 0) e.flexStyle = 'mr-3'
|
|
|
+ // 回显
|
|
|
+ if (rowObj.value[e.key]) e.value = rowObj.value[e.key]
|
|
|
+ // 数字转为字符串
|
|
|
+ if (transformItems.includes(e.key) && e.value && e.value !== 0) e.value = e.value.toString()
|
|
|
+ // 日期相关
|
|
|
+ if (e.type === 'datepicker') e.value = timesTampChange(e.value).slice(0, 10)
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+// 保存-基础信息
|
|
|
const handleSave = async () => {
|
|
|
- // if (!advantage.value) return Snackbar.warning('请先输入个人优势!')
|
|
|
- // await saveResumeAdvantage({ content: advantage.value })
|
|
|
+ const { valid } = await CtFormRef.value.formRef.validate()
|
|
|
+ if (!valid) return
|
|
|
+ const obj = {}
|
|
|
+ formItems.value.options.forEach(e => {
|
|
|
+ if (e.noReturn) return
|
|
|
+ else if (e.type === 'datepicker') obj[e.key] = getTimeStamp(e.value)
|
|
|
+ else if (transformItems.includes(e.key) && e.value && e.value !== 0) obj[e.key] = e.value - 0
|
|
|
+ else obj[e.key] = e.value
|
|
|
+ })
|
|
|
+ await saveResumeEduExp(obj)
|
|
|
+ Snackbar.success('保存成功!')
|
|
|
isEdit.value = false
|
|
|
- Snackbar.success('编辑成功')
|
|
|
+ // 获取当前登录账户信息
|
|
|
+ await getData()
|
|
|
+}
|
|
|
+
|
|
|
+// 删除数据
|
|
|
+const handleDelete = ({ id }) => {
|
|
|
+ Confirm('系统提示', '是否确认删除此教育经历?').then(async () => {
|
|
|
+ await deleteResumeEduExp(id)
|
|
|
+ Snackbar.success('删除成功!')
|
|
|
+ getData()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 获取字典内容
|
|
|
+const getDictData = async (obj) => {
|
|
|
+ const item = formItems.value.options.find(e => e.key === obj.key)
|
|
|
+ if (item) { // && !item.items?.length
|
|
|
+ const { data } = await getDict(obj.type)
|
|
|
+ item.items = data
|
|
|
+ }
|
|
|
}
|
|
|
-const handleDelete = async (item) => {
|
|
|
- console.log('1', item)
|
|
|
- Snackbar.success('删除成功')
|
|
|
+const getOptions = () => {
|
|
|
+ dictList.forEach(obj => getDictData(obj))
|
|
|
}
|
|
|
+getOptions()
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|