|
@@ -1,101 +1,110 @@
|
|
|
<template>
|
|
|
- <el-tag
|
|
|
- type="primary"
|
|
|
- size="large"
|
|
|
- effect="plain"
|
|
|
- v-if="!tableData.length && !onlyRead"
|
|
|
- @click="onAddItem(0)"
|
|
|
- >增加一行</el-tag
|
|
|
- >
|
|
|
- <el-table
|
|
|
- class="detail-table"
|
|
|
- :header-cell-style="{
|
|
|
- background: '#F2F4F8',
|
|
|
- color: '#000000'
|
|
|
- }"
|
|
|
- :data="tableData"
|
|
|
- v-else
|
|
|
- >
|
|
|
- <el-table-column prop="workLocation" label="工作单位">
|
|
|
- <template #default="scope">
|
|
|
- <el-input v-model="scope.row.workLocation" v-if="scope.row.isEdit" />
|
|
|
- <span v-else>{{ scope.row.workLocation }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="post" label="职位">
|
|
|
- <template #default="scope">
|
|
|
- <el-input v-model="scope.row.post" v-if="scope.row.isEdit" />
|
|
|
- <span v-else>{{ scope.row.post }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="startTime" label="开始时间">
|
|
|
- <template #default="scope">
|
|
|
- <el-date-picker
|
|
|
- v-model="scope.row.startTime"
|
|
|
- type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- />
|
|
|
- <span v-else>{{ scope.row.startTime }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="endTime" label="结束时间">
|
|
|
- <template #default="scope">
|
|
|
- <el-date-picker
|
|
|
- v-model="scope.row.endTime"
|
|
|
- type="date"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- />
|
|
|
- <span v-else>{{ scope.row.endTime }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="resignReason" label="离职原因">
|
|
|
- <template #default="scope">
|
|
|
- <el-input v-model="scope.row.resignReason" v-if="scope.row.isEdit" />
|
|
|
- <span v-else>{{ scope.row.resignReason }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="jyxy" label="是否有竞业限制/未尽法律事宜">
|
|
|
- <template #default="scope">
|
|
|
- <el-input v-model="scope.row.jyxy" v-if="scope.row.isEdit" />
|
|
|
- <span v-else>{{ scope.row.jyxy }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="competitionDetail" label="具体条款">
|
|
|
- <template #default="scope">
|
|
|
- <el-input v-model="scope.row.competitionDetail" v-if="scope.row.isEdit" />
|
|
|
- <span v-else>{{ scope.row.competitionDetail }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column fixed="right" label="操作" width="140">
|
|
|
- <template #default="scope">
|
|
|
- <el-button
|
|
|
- link
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="onSaveItem(scope.$index)"
|
|
|
- v-if="scope.row.isEdit"
|
|
|
- >
|
|
|
- 保存
|
|
|
- </el-button>
|
|
|
- <el-button link type="primary" size="small" @click="onEditItem(scope.$index)" v-else>
|
|
|
- 编辑
|
|
|
- </el-button>
|
|
|
- <el-button link type="primary" size="small" @click="deleteRow(scope.$index)">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
- <el-button link type="primary" size="small" @click="onAddItem(scope.$index)">
|
|
|
- 新增
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <div class="casually-name">
|
|
|
+ <div class="star-title">
|
|
|
+ <i></i>
|
|
|
+ <span>工作经历</span>
|
|
|
+ </div>
|
|
|
+ <el-tag
|
|
|
+ class="add-tag"
|
|
|
+ type="primary"
|
|
|
+ effect="plain"
|
|
|
+ v-if="!tableData.length && !onlyRead"
|
|
|
+ @click="onAddItem(-1)"
|
|
|
+ >+ 新增</el-tag
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ class="detail-table"
|
|
|
+ :header-cell-style="{
|
|
|
+ background: '#F2F4F8',
|
|
|
+ color: '#000000'
|
|
|
+ }"
|
|
|
+ :data="tableData"
|
|
|
+ v-else
|
|
|
+ >
|
|
|
+ <el-table-column prop="workLocation" label="工作单位">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.workLocation" v-if="scope.row.isEdit" />
|
|
|
+ <span v-else>{{ scope.row.workLocation }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="post" label="职位">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.post" v-if="scope.row.isEdit" />
|
|
|
+ <span v-else>{{ scope.row.post }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="startTime" label="开始时间">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="scope.row.startTime"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ v-if="scope.row.isEdit"
|
|
|
+ />
|
|
|
+ <span v-else>{{ scope.row.startTime }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="endTime" label="结束时间">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="scope.row.endTime"
|
|
|
+ type="date"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ v-if="scope.row.isEdit"
|
|
|
+ />
|
|
|
+ <span v-else>{{ scope.row.endTime }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="resignReason" label="离职原因">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.resignReason" v-if="scope.row.isEdit" />
|
|
|
+ <span v-else>{{ scope.row.resignReason }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="jyxy" label="是否有竞业限制/未尽法律事宜">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.jyxy" v-if="scope.row.isEdit" />
|
|
|
+ <span v-else>{{ scope.row.jyxy }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="competitionDetail" label="具体条款">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.competitionDetail" v-if="scope.row.isEdit" />
|
|
|
+ <span v-else>{{ scope.row.competitionDetail }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" label="操作" width="140">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="onSaveItem(scope.$index)"
|
|
|
+ v-if="scope.row.isEdit"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" size="small" @click="onEditItem(scope.$index)" v-else>
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" size="small" @click="deleteRow(scope.$index)">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" size="small" @click="onAddItem(scope.$index)">
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
/**
|
|
|
* @description 工作经历
|
|
|
*/
|
|
|
+
|
|
|
+import { cloneDeep } from 'lodash-es'
|
|
|
+
|
|
|
interface ITable {
|
|
|
id?: string
|
|
|
userId?: string
|
|
@@ -133,7 +142,7 @@ onMounted(() => {
|
|
|
|
|
|
// 新增行
|
|
|
const onAddItem = (index: number) => {
|
|
|
- tableData.value.splice(index - 1, 0, {
|
|
|
+ tableData.value.splice(index + 1, 0, {
|
|
|
workLocation: '',
|
|
|
post: '',
|
|
|
startTime: '',
|
|
@@ -147,9 +156,12 @@ const onAddItem = (index: number) => {
|
|
|
|
|
|
// 保存行
|
|
|
const onSaveItem = (index: number) => {
|
|
|
- tableData.value[index].isEdit = false
|
|
|
- // console.log('tableData.value', tableData.value)
|
|
|
- const changeData = tableData.value.map((item: any) => {
|
|
|
+ tableData.value.forEach((item: any, num: number) => {
|
|
|
+ if (num == index) {
|
|
|
+ item.isEdit = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const changeData = cloneDeep(tableData.value).map((item: any) => {
|
|
|
delete item.isEdit
|
|
|
return item
|
|
|
})
|
|
@@ -167,6 +179,35 @@ const deleteRow = (index: number) => {
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
+.casually-name {
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+.star-title {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 8px;
|
|
|
+
|
|
|
+ i {
|
|
|
+ display: block;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin-right: 9px;
|
|
|
+ background: url('../../../../assets/imgs/OA/mine/star.png') center no-repeat;
|
|
|
+ background-size: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ span {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #000000;
|
|
|
+ }
|
|
|
+}
|
|
|
+.add-tag {
|
|
|
+ position: absolute;
|
|
|
+ top: 2px;
|
|
|
+ left: 120px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
.detail-table {
|
|
|
width: 100%;
|
|
|
min-height: 100px;
|