|
|
|
|
@ -63,6 +63,65 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="direction" label="课酬" width="120" align="left">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="cc-item" v-for="(item, index) in scope.row.course_contents" :key="index">
|
|
|
|
|
<div class="salary-display">
|
|
|
|
|
<el-popover
|
|
|
|
|
:ref="`popover-${item.id}`"
|
|
|
|
|
placement="top"
|
|
|
|
|
width="200"
|
|
|
|
|
trigger="click"
|
|
|
|
|
@show="startEdit(item)"
|
|
|
|
|
>
|
|
|
|
|
<div class="salary-edit-popover">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="editingSalary"
|
|
|
|
|
placeholder="请输入课酬"
|
|
|
|
|
size="small"
|
|
|
|
|
style="margin-bottom: 10px;"
|
|
|
|
|
@keyup.enter.native="saveSalary(item)"
|
|
|
|
|
/>
|
|
|
|
|
<div class="popover-buttons">
|
|
|
|
|
<el-button size="mini" type="primary" @click="saveSalary(item)">确认</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span slot="reference">{{ item.salary ? item.salary : '' }}<i class="el-icon-edit salary-edit-icon" ></i></span>
|
|
|
|
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="tutor" label="导师" width="120" align="left">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="cc-item" v-for="(item, index) in scope.row.course_contents" :key="index">
|
|
|
|
|
<div class="salary-display">
|
|
|
|
|
<el-popover
|
|
|
|
|
:ref="`tutor-popover-${item.id}`"
|
|
|
|
|
placement="top"
|
|
|
|
|
width="200"
|
|
|
|
|
trigger="click"
|
|
|
|
|
@show="startEditTutor(item)"
|
|
|
|
|
>
|
|
|
|
|
<div class="salary-edit-popover">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="editingTutor"
|
|
|
|
|
placeholder="请输入导师"
|
|
|
|
|
size="small"
|
|
|
|
|
style="margin-bottom: 10px;"
|
|
|
|
|
@keyup.enter.native="saveTutor(item)"
|
|
|
|
|
/>
|
|
|
|
|
<div class="popover-buttons">
|
|
|
|
|
<el-button size="mini" type="primary" @click="saveTutor(item)">确认</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span slot="reference">{{ item.tutor ? item.tutor : '' }}<i class="el-icon-edit salary-edit-icon"></i></span>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="remark" label="备注" width="240" align="left">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div class="cc-item" v-for="(item, index) in scope.row.course_contents" :key="index">
|
|
|
|
|
@ -104,6 +163,9 @@
|
|
|
|
|
import {
|
|
|
|
|
saveAs
|
|
|
|
|
} from "file-saver";
|
|
|
|
|
import {
|
|
|
|
|
save as saveCourseContent
|
|
|
|
|
} from '@/api/course/courseContent.js'
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
addTeacher,
|
|
|
|
|
@ -119,6 +181,10 @@
|
|
|
|
|
|
|
|
|
|
list: [],
|
|
|
|
|
total: 0,
|
|
|
|
|
editingItem: null,
|
|
|
|
|
editingSalary: '',
|
|
|
|
|
editingTutorItem: null,
|
|
|
|
|
editingTutor: '',
|
|
|
|
|
table_item: [{
|
|
|
|
|
type: 'index',
|
|
|
|
|
align: 'center',
|
|
|
|
|
@ -240,6 +306,68 @@
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
startEdit(item) {
|
|
|
|
|
this.editingItem = item
|
|
|
|
|
this.editingSalary = item.salary || ''
|
|
|
|
|
},
|
|
|
|
|
cancelEdit() {
|
|
|
|
|
this.editingItem = null
|
|
|
|
|
this.editingSalary = ''
|
|
|
|
|
// 关闭所有popover
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
if (this.editingItem) {
|
|
|
|
|
const popoverRef = this.$refs[`popover-${this.editingItem.id}`]
|
|
|
|
|
if (popoverRef && popoverRef[0]) {
|
|
|
|
|
popoverRef[0].doClose()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async saveSalary(item) {
|
|
|
|
|
try {
|
|
|
|
|
await saveCourseContent({
|
|
|
|
|
id: item.id,
|
|
|
|
|
salary: this.editingSalary
|
|
|
|
|
})
|
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
|
this.cancelEdit()
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$message.error('保存失败')
|
|
|
|
|
console.error('保存课酬失败:', error)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
startEditTutor(item) {
|
|
|
|
|
this.editingTutorItem = item
|
|
|
|
|
this.editingTutor = item.tutor || ''
|
|
|
|
|
},
|
|
|
|
|
cancelEditTutor() {
|
|
|
|
|
this.editingTutorItem = null
|
|
|
|
|
this.editingTutor = ''
|
|
|
|
|
// 关闭所有tutor popover
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
if (this.editingTutorItem) {
|
|
|
|
|
const popoverRef = this.$refs[`tutor-popover-${this.editingTutorItem.id}`]
|
|
|
|
|
if (popoverRef && popoverRef[0]) {
|
|
|
|
|
popoverRef[0].doClose()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async saveTutor(item) {
|
|
|
|
|
try {
|
|
|
|
|
await saveCourseContent({
|
|
|
|
|
id: item.id,
|
|
|
|
|
tutor: this.editingTutor
|
|
|
|
|
})
|
|
|
|
|
this.$message.success('保存成功')
|
|
|
|
|
this.cancelEditTutor()
|
|
|
|
|
this.getList()
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$message.error('保存失败')
|
|
|
|
|
console.error('保存导师失败:', error)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
importTable() {
|
|
|
|
|
this.$refs.imports.show()
|
|
|
|
|
}
|
|
|
|
|
@ -276,4 +404,32 @@
|
|
|
|
|
.cc-item:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 课酬编辑样式 */
|
|
|
|
|
.salary-display {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.salary-edit-icon {
|
|
|
|
|
margin-left: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: #409eff;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.salary-edit-icon:hover {
|
|
|
|
|
color: #66b1ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.salary-edit-popover {
|
|
|
|
|
padding: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.popover-buttons {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|