|
@@ -8,8 +8,8 @@
|
|
<h4 class="label-title my-3 mx-2"> {{ type === 'add' ? $t('common.add') : $t('common.edit') }}{{ $t('resume.projectExperience') }}</h4>
|
|
<h4 class="label-title my-3 mx-2"> {{ type === 'add' ? $t('common.add') : $t('common.edit') }}{{ $t('resume.projectExperience') }}</h4>
|
|
<CtForm ref="formPageRef" :items="items" style="width: 100%;"></CtForm>
|
|
<CtForm ref="formPageRef" :items="items" style="width: 100%;"></CtForm>
|
|
<div class="text-end">
|
|
<div class="text-end">
|
|
- <v-btn class="half-button mr-3" variant="tonal" @click="isEdit = false; type = ''">{{ $t('common.cancel') }}</v-btn>
|
|
|
|
- <v-btn color="primary" class="half-button" @click="handleSave">{{ $t('common.save') }}</v-btn>
|
|
|
|
|
|
+ <v-btn class="half-button mr-3" variant="tonal" @click="handleCancel">{{ $t('common.cancel') }}</v-btn>
|
|
|
|
+ <v-btn color="primary" class="half-button" :loading="loading" @click="handleSave">{{ $t('common.save') }}</v-btn>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-else v-for="(k, i) in projectExp" :key="i" class="exp mx-n2 mt-5" @mouseenter="k.active = true" @mouseleave="k.active = false">
|
|
<div v-else v-for="(k, i) in projectExp" :key="i" class="exp mx-n2 mt-5" @mouseenter="k.active = true" @mouseleave="k.active = false">
|
|
@@ -21,9 +21,9 @@
|
|
<div>
|
|
<div>
|
|
<span style="font-size: 18px; font-weight: bold;">{{ k.name }}</span>
|
|
<span style="font-size: 18px; font-weight: bold;">{{ k.name }}</span>
|
|
<span class="label-title ml-5">
|
|
<span class="label-title ml-5">
|
|
- <span>{{ timesTampChange(k.startTime).slice(0, 10) }}</span>
|
|
|
|
|
|
+ <span>{{ timesTampChange(k.startTime).slice(0, 7) }}</span>
|
|
<span class="mx-1">至</span>
|
|
<span class="mx-1">至</span>
|
|
- <span>{{ timesTampChange(k.endTime).slice(0, 10) }}</span>
|
|
|
|
|
|
+ <span>{{ timesTampChange(k.endTime).slice(0, 7) }}</span>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -36,8 +36,8 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup name="projectExperience">
|
|
<script setup name="projectExperience">
|
|
-import { ref, shallowRef } from 'vue'
|
|
|
|
-import { getTimeStamp, timesTampChange } from '@/utils/date'
|
|
|
|
|
|
+import { ref } from 'vue'
|
|
|
|
+import { timesTampChange } from '@/utils/date'
|
|
import { saveResumeProjectExp, getResumeProjectExp, deleteResumeProjectExp } from '@/api/resume'
|
|
import { saveResumeProjectExp, getResumeProjectExp, deleteResumeProjectExp } from '@/api/resume'
|
|
import CtForm from '@/components/CtForm'
|
|
import CtForm from '@/components/CtForm'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
@@ -47,6 +47,8 @@ const isEdit = ref(false)
|
|
const formPageRef = ref()
|
|
const formPageRef = ref()
|
|
const type = ref('')
|
|
const type = ref('')
|
|
const editId = ref(null)
|
|
const editId = ref(null)
|
|
|
|
+const loading = ref(false)
|
|
|
|
+
|
|
const items = ref({
|
|
const items = ref({
|
|
options: [
|
|
options: [
|
|
{
|
|
{
|
|
@@ -57,20 +59,30 @@ const items = ref({
|
|
rules: [v => !!v || '请输入项目名称']
|
|
rules: [v => !!v || '请输入项目名称']
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- type: 'datepicker',
|
|
|
|
|
|
+ type: 'datePicker',
|
|
key: 'startTime',
|
|
key: 'startTime',
|
|
- value: shallowRef(null),
|
|
|
|
|
|
+ value: null,
|
|
col: 6,
|
|
col: 6,
|
|
- label: '项目开始时间 *',
|
|
|
|
|
|
+ class: 'mb-3',
|
|
|
|
+ options: {
|
|
|
|
+ type: 'month',
|
|
|
|
+ format: 'timestamp',
|
|
|
|
+ placeholder: '项目开始时间 *',
|
|
|
|
+ },
|
|
flexStyle: 'mr-3',
|
|
flexStyle: 'mr-3',
|
|
rules: [v => !!v || '请选择项目开始时间']
|
|
rules: [v => !!v || '请选择项目开始时间']
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- type: 'datepicker',
|
|
|
|
|
|
+ type: 'datePicker',
|
|
key: 'endTime',
|
|
key: 'endTime',
|
|
- value: shallowRef(null),
|
|
|
|
|
|
+ value: null,
|
|
col: 6,
|
|
col: 6,
|
|
- label: '项目结束时间 *',
|
|
|
|
|
|
+ class: 'mb-3',
|
|
|
|
+ options: {
|
|
|
|
+ type: 'month',
|
|
|
|
+ format: 'timestamp',
|
|
|
|
+ placeholder: '项目结束时间 *',
|
|
|
|
+ },
|
|
rules: [v => !!v || '请选择项目结束时间']
|
|
rules: [v => !!v || '请选择项目结束时间']
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -93,6 +105,16 @@ const items = ref({
|
|
]
|
|
]
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+const handleCancel = () => {
|
|
|
|
+ isEdit.value = false
|
|
|
|
+ type.value = ''
|
|
|
|
+ editId.value = null
|
|
|
|
+ items.value.options.forEach(e => {
|
|
|
|
+ if (e.type === 'datePicker') e.value = {}
|
|
|
|
+ else e.value = null
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
// 获取项目经历
|
|
// 获取项目经历
|
|
const projectExp = ref([])
|
|
const projectExp = ref([])
|
|
const getResumeTrainExpData = async () => {
|
|
const getResumeTrainExpData = async () => {
|
|
@@ -105,26 +127,26 @@ getResumeTrainExpData()
|
|
const handleSave = async () => {
|
|
const handleSave = async () => {
|
|
const { valid } = await formPageRef.value.formRef.validate()
|
|
const { valid } = await formPageRef.value.formRef.validate()
|
|
if (!valid) return
|
|
if (!valid) return
|
|
|
|
+ loading.value = true
|
|
const obj = {}
|
|
const obj = {}
|
|
items.value.options.forEach(e => {
|
|
items.value.options.forEach(e => {
|
|
- if (e.type === 'datepicker') obj[e.key] = getTimeStamp(e.value)
|
|
|
|
- else obj[e.key] = e.value
|
|
|
|
|
|
+ obj[e.key] = e.value
|
|
})
|
|
})
|
|
if (editId.value) obj.id = editId.value
|
|
if (editId.value) obj.id = editId.value
|
|
- await saveResumeProjectExp(obj)
|
|
|
|
- Snackbar.success('保存成功!')
|
|
|
|
- isEdit.value = false
|
|
|
|
- type.value = ''
|
|
|
|
- editId.value = null
|
|
|
|
- getResumeTrainExpData()
|
|
|
|
|
|
+ try {
|
|
|
|
+ await saveResumeProjectExp(obj)
|
|
|
|
+ Snackbar.success('保存成功!')
|
|
|
|
+ handleCancel()
|
|
|
|
+ getResumeTrainExpData()
|
|
|
|
+ } finally {
|
|
|
|
+ loading.value = false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const handleEdit = (item) => {
|
|
const handleEdit = (item) => {
|
|
editId.value = item.id
|
|
editId.value = item.id
|
|
items.value.options.forEach(e => {
|
|
items.value.options.forEach(e => {
|
|
- // 日期相关
|
|
|
|
- if (e.type === 'datepicker') e.value = timesTampChange(item[e.key]).slice(0, 10)
|
|
|
|
- else e.value = item[e.key]
|
|
|
|
|
|
+ e.value = item[e.key]
|
|
})
|
|
})
|
|
isEdit.value = true
|
|
isEdit.value = true
|
|
}
|
|
}
|