<template>
|
<div class="notice">
|
<el-dialog
|
v-model="dialogVisible"
|
:title="title"
|
width="900px"
|
:before-close="handleClose"
|
:close-on-press-escape="false"
|
:close-on-click-modal="false"
|
>
|
<el-form :model="state.form" size="default" ref="busRef" :rules="state.rules" label-position="right" label-width="110" >
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="单位名称:" prop="companyId" v-if="state.isAdmin">
|
<el-select v-model="state.form.companyId" placeholder="请选择" filterable clearable style="width: 100%" :disabled="title == '查看' || title == '编辑' || !state.isAdmin" @change="selectValueCom">
|
<el-option
|
v-for="item in state.companyList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="课程:" prop="planId" >
|
<el-select v-model="state.form.planId" placeholder="请选择" filterable clearable style="width: 100%" :disabled="title == '查看'">
|
<el-option
|
v-for="item in state.planList"
|
:key="item.id"
|
:label="item.trainName"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="12">
|
<el-form-item label="讲师:" prop="teacherId" >
|
<el-select
|
clearable
|
v-model="state.form.teacherId"
|
:disabled="title =='查看'"
|
filterable
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in state.peopleList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="开课日期:" prop="openTime" >
|
<el-date-picker
|
:disabled="title === '查看'"
|
v-model="state.form.openTime"
|
type="date"
|
placeholder="请选择"
|
value-format="YYYY-MM-DD"
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="12">
|
<el-form-item label="所属部门:" prop="deptId" >
|
<el-select
|
v-model="state.form.deptId"
|
placeholder="请选择部门"
|
filterable
|
clearable
|
style="width: 100%"
|
:disabled="title == '查看'"
|
>
|
<el-option
|
v-for="item in state.deptList"
|
:key="item.deptId"
|
:label="item.deptName"
|
:value="item.deptId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="员工:" prop="staffs" >
|
<el-select
|
clearable
|
multiple
|
collapse-tags
|
collapse-tags-tooltip
|
v-model="state.staffs"
|
:disabled="title == '查看'"
|
filterable
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in state.peopleList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="评价表:">
|
<!--个人素养-->
|
<el-table
|
:data="state.tableData"
|
border
|
:span-method="objectSpanMethod"
|
style="width: 100%; margin-bottom: 15px;"
|
>
|
|
<el-table-column align="center">
|
<template #header>
|
<div>1、讲师的个人素养</div>
|
</template>
|
<el-table-column align="center" prop="item" min-width="150">
|
<template #header>
|
<div></div>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column
|
align="center"
|
v-for="(col, idx) in scoreCols"
|
:key="idx"
|
>
|
<template #header>
|
<div>{{ col.label }}</div>
|
</template>
|
<el-table-column
|
align="center"
|
:prop="col.prop"
|
min-width="100"
|
>
|
<template #header>
|
<div>{{ col.score }}分</div>
|
</template>
|
<template #default="scope">
|
<el-checkbox
|
|
v-if="!scope.row.isTotal"
|
:disabled="isView"
|
v-model="scope.row[col.prop]"
|
@change="handleRadio(scope.row, col.prop,'1')"
|
/>
|
<span v-if="scope.row.isTotal" style="font-size: 16px">
|
{{ scope.row.total }}分
|
</span>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
</el-table>
|
<!--准备工作-->
|
<el-table
|
:data="state.tableDataWork"
|
border
|
:span-method="objectSpanMethod"
|
style="width: 100%; margin-bottom: 15px;"
|
>
|
|
<el-table-column align="center">
|
<template #header>
|
<div>2、授课前准备工作</div>
|
</template>
|
<el-table-column align="center" prop="item" min-width="150">
|
<template #header>
|
<div></div>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column
|
align="center"
|
v-for="(col, idx) in scoreCols"
|
:key="idx"
|
>
|
<template #header>
|
<div>{{ col.label }}</div>
|
</template>
|
<el-table-column
|
align="center"
|
:prop="col.prop"
|
min-width="100"
|
>
|
<template #header>
|
<div>{{ col.score }}分</div>
|
</template>
|
<template #default="scope">
|
<el-checkbox
|
|
v-if="!scope.row.isTotal"
|
:disabled="isViewWork"
|
v-model="scope.row[col.prop]"
|
@change="handleRadio(scope.row, col.prop,'2')"
|
/>
|
<span v-if="scope.row.isTotal" style="font-size: 16px">
|
{{ scope.row.total }}分
|
</span>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
</el-table>
|
<!--课程内容-->
|
<el-table
|
:data="state.tableDataContent"
|
border
|
:span-method="objectSpanMethod"
|
style="width: 100%; margin-bottom: 15px;"
|
>
|
|
<el-table-column align="center">
|
<template #header>
|
<div>3、授课前准备工作</div>
|
</template>
|
<el-table-column align="center" prop="item" min-width="150">
|
<template #header>
|
<div></div>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
<el-table-column
|
align="center"
|
v-for="(col, idx) in scoreCols"
|
:key="idx"
|
>
|
<template #header>
|
<div>{{ col.label }}</div>
|
</template>
|
<el-table-column
|
align="center"
|
:prop="col.prop"
|
min-width="100"
|
>
|
<template #header>
|
<div>{{ col.score }}分</div>
|
</template>
|
<template #default="scope">
|
<el-checkbox
|
|
v-if="!scope.row.isTotal"
|
:disabled="isViewContent"
|
v-model="scope.row[col.prop]"
|
@change="handleRadio(scope.row, col.prop,'3')"
|
/>
|
<span v-if="scope.row.isTotal" style="font-size: 16px">
|
{{ scope.row.total }}分
|
</span>
|
</template>
|
</el-table-column>
|
</el-table-column>
|
</el-table>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="您的建议:">
|
<el-input style="margin-top: 5px" :disabled="title === '查看'" v-model="state.form.suggest" type="textarea" :rows="4"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="关于讲师:">
|
<el-input style="margin-top: 5px" :disabled="title === '查看'" v-model="state.form.aboutTeacher" type="textarea" :rows="4"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="关于内容:">
|
<el-input style="margin-top: 5px" :disabled="title === '查看'" v-model="state.form.aboutContent" type="textarea" :rows="4"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="关于授课形式:">
|
<el-input style="margin-top: 5px" :disabled="title === '查看'" v-model="state.form.teachForm" type="textarea" :rows="4"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="24">
|
<el-col :span="24">
|
<el-form-item label="其他:">
|
<el-input style="margin-top: 5px" :disabled="title === '查看'" v-model="state.form.other" type="textarea" :rows="4"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template #footer v-if="title !== '查看'">
|
<span class="dialog-footer">
|
<el-button @click="handleClose" size="default">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
<script setup>
|
import {onMounted, reactive, ref, toRefs} from 'vue'
|
import Cookies from "js-cookie";
|
import {getCompany} from "@/api/onlineEducation/company";
|
import {ElMessage} from "element-plus";
|
import {getUser} from "@/api/onlineEducation/user";
|
import {getDept, getObject, getObjectPage} from "@/api/qualityObjectives/object";
|
import {addTable, editTable, getTargetById} from "@/api/qualityObjectives/table";
|
import {addNeedDiscren, editNeedDiscren} from "@/api/need/need";
|
import {verifyPhone} from "@/utils/validate";
|
import {developList} from "@/views/work/qualityInfo/supplierQuality/supplierList/components/qualityDatas";
|
import {addDelivery, editDelivery} from "@/api/satisfiedNew/satisfiedNew";
|
import {getCustomer, getCustomerAll} from "@/api/customerList";
|
import {getTrainPlanAll, getTrainPlanPage} from "@/api/onlineEducation/trainPlan";
|
import {getStudent} from "@/api/onlineEducation/student";
|
import {addCourseEvaluate, editCourseEvaluate} from "@/api/courseEvaluate";
|
|
const dialogVisible = ref(false);
|
const title = ref("");
|
const busRef = ref();
|
const length = ref()
|
const selectPopperClass = "max-width-select";
|
const emit = defineEmits(["getList"]);
|
const dataRef = ref();
|
const state = reactive({
|
form: {
|
id: '',
|
companyId: null,
|
planId: null,
|
teacherId: null,
|
deptId: null,
|
openTime: "",
|
staffs: '',
|
personalQuality: "",
|
preparatory: "",
|
courseContent: "",
|
suggest: "",
|
aboutTeacher: "",
|
aboutContent: "",
|
teachForm: "",
|
other: ""
|
},
|
rules: {
|
companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
|
planId: [{ required: true, message: '请选择计划', trigger: 'blur' }],
|
teacherId: [{ required: true, message: '请选择讲师', trigger: 'blur' }],
|
deptId: [{ required: true, message: '请选择部门', trigger: 'blur' }],
|
openTime: [{ required: true, message: '请选择开课日期', trigger: 'blur' }],
|
staffs: [{ required: true, message: '请选择员工', trigger: 'blur' }],
|
},
|
staffs:[],
|
isAdmin: false,
|
companyList: [],
|
planList: [],
|
deptList: [],
|
peopleList:[],
|
supplierList: [],
|
tableData: [
|
{ item: '1)礼貌礼仪/精神面貌', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)表达能力(语速/吐字清晰度等)', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)耐心程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)专业知识', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)幽默感', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '个人素养综合得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
],
|
tableDataWork:[
|
{ item: '1)是否准时开课/结课', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)是否按计划授课', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)授课的资料、辅助工具等的准备工作', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)课程时间安排的合理程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)授课过程中的活动安排合理性', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '授课前准备工作得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
],
|
tableDataContent:[
|
{ item: '1)课件内容正确性', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)授课内容能否结合实际工作', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)课程内容是否做到条理清晰,重点突出,描述准确', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)在讲授过程中能引进更多的知识和信息', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)有案例分析,能有效鼓励新员工参与和互动', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '6)对于学员提出问题回答的准确程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '课程内容得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
]
|
})
|
// 控制是否为“查看”模式(禁用单选框)
|
const isView = ref(false);
|
const isViewWork = ref(false);
|
const isViewContent = ref(false);
|
// 评分列配置:标签、绑定属性、分值
|
const scoreCols = reactive([
|
{ label: '非常好', prop: 'well', score: 5 },
|
{ label: '比较好', prop: 'good', score: 4 },
|
{ label: '一般', prop: 'fine', score: 3 },
|
{ label: '较不好', prop: 'notGood', score: 2 },
|
{ label: '不好', prop: 'bad', score: 1 },
|
]);
|
|
const handleRadio = (row, currentProp,type) => {
|
if(type == '1'){
|
if (isView.value) return;
|
for (const col of scoreCols) {
|
if (col.prop !== currentProp) {
|
row[col.prop] = false;
|
}
|
}
|
calculateTotalScore('1');
|
}else if(type == '2') {
|
if (isViewWork.value) return;
|
for (const col of scoreCols) {
|
if (col.prop !== currentProp) {
|
row[col.prop] = false;
|
}
|
}
|
calculateTotalScore('2');
|
}else if(type=='3'){
|
if (isViewContent.value) return;
|
for (const col of scoreCols) {
|
if (col.prop !== currentProp) {
|
row[col.prop] = false;
|
}
|
}
|
calculateTotalScore('3');
|
}
|
};
|
// 计算总分
|
const calculateTotalScore = (type) => {
|
let data = []
|
if(type == '1'){
|
data = state.tableData
|
}else if(type == '2'){
|
data = state.tableDataWork
|
}else if(type == '3'){
|
data = state.tableDataContent
|
}
|
let total = 0;
|
let answeredCount = 0;
|
// 遍历所有评分项(除了总分行)
|
for (let i = 0; i < data.length - 1; i++) {
|
const row = data[i];
|
for (const col of scoreCols) {
|
if (row[col.prop]) {
|
total += col.score;
|
answeredCount++;
|
break;
|
}
|
}
|
}
|
data[data.length - 1].total = answeredCount > 0 ? total : 0;
|
};
|
|
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
|
if (row.isTotal) {
|
if (columnIndex === 0) {
|
return {
|
rowspan: 1,
|
colspan: 1,
|
};
|
}
|
|
// 第二列开始合并所有评分列
|
if (columnIndex === 1) {
|
return {
|
rowspan: 1,
|
colspan: scoreCols.length, // 动态合并所有评分列
|
style: { textAlign: 'center', fontWeight: 'bold' },
|
};
|
}
|
|
// 合并列之外的其他列不显示内容
|
if (columnIndex > 1) {
|
return {
|
rowspan: 0,
|
colspan: 0,
|
};
|
}
|
}
|
|
return { rowspan: 1, colspan: 1 };
|
};
|
|
onMounted(() => {
|
|
|
});
|
const openDialog = async (type, value,companyList) => {
|
|
const userInfo = JSON.parse(Cookies.get('userInfo'))
|
state.isAdmin = userInfo.userType === 0;
|
state.form.companyName = userInfo.companyName
|
state.form.companyId = userInfo.companyId
|
if(state.isAdmin){
|
state.form.companyId = value.companyId
|
state.form.companyName = value.companyName
|
state.companyList = companyList
|
}
|
title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
|
if(type === 'edit' || type === 'review') {
|
state.form = JSON.parse(JSON.stringify(value));
|
if(state.isAdmin){
|
state.form.companyId = value.companyId
|
state.form.companyName = value.companyName
|
}
|
//解析json
|
state.tableData = value.personalQuality ? JSON.parse(value.personalQuality) :[]
|
state.tableDataWork = value.preparatory?JSON.parse(value.preparatory):[]
|
state.tableDataContent = value.courseContent ?JSON.parse(value.courseContent):[]
|
state.staffs = value.staffs.split(',').map(Number)
|
}
|
await getPlanList()
|
await getPeopleList()
|
await getDeptList()
|
dialogVisible.value = true;
|
}
|
|
const getDeptList = async () => {
|
if(state.isAdmin && (state.form.companyId == 0 || state.form.companyId == null)){
|
return
|
}
|
const param = {
|
pageNum: 1,
|
pageSize: 999,
|
companyId: state.form.companyId
|
}
|
const res = await getDept(param)
|
if(res.code === 200){
|
state.deptList = res.data
|
}
|
}
|
const getPeopleList = async ()=> {
|
if(state.isAdmin && !state.form.companyId && (state.form.companyId == 0 || state.form.companyId == null)){
|
return
|
}
|
const queryParams = {
|
pageNum: 1,
|
pageSize: 9999,
|
companyId: state.form.companyId
|
}
|
const res = await getUser(queryParams)
|
if(res.code == 200){
|
state.peopleList = res.data.list?res.data.list:[]
|
}else{
|
ElMessage.warning(res.message)
|
}
|
};
|
const getPlanList = async ()=> {
|
if(state.isAdmin && !state.form.companyId && (state.form.companyId == 0 || state.form.companyId == null)){
|
return
|
}
|
const queryParams = {
|
companyId: state.form.companyId
|
}
|
const res = await getTrainPlanAll(queryParams);
|
if(res.code === 200){
|
state.planList = res.data.data
|
}else{
|
ElMessage.warning(res.message)
|
}
|
};
|
const onSubmit = async () => {
|
state.form.personalQuality = JSON.stringify(state.tableData)
|
state.form.preparatory = JSON.stringify(state.tableDataWork)
|
state.form.courseContent = JSON.stringify(state.tableDataContent)
|
state.form.staffs = state.staffs.join(',')
|
const valid = await busRef.value.validate();
|
if(valid){
|
if(title.value === '新增'){
|
console.log('sta',state.form)
|
const {id, ...data} = JSON.parse(JSON.stringify(state.form))
|
const res = await addCourseEvaluate(data)
|
if(res.code === 200){
|
ElMessage({
|
type: 'success',
|
message: '新增成功'
|
});
|
}else{
|
ElMessage.warning(res.message)
|
}
|
emit("getList")
|
busRef.value.clearValidate();
|
reset();
|
dialogVisible.value = false;
|
}else if(title.value === '编辑'){
|
const {...data} = JSON.parse(JSON.stringify(state.form))
|
const res = await editCourseEvaluate(data)
|
if(res.code === 200){
|
ElMessage({
|
type: 'success',
|
message: '编辑成功'
|
});
|
}else{
|
ElMessage.warning(res.message)
|
}
|
emit("getList")
|
busRef.value.clearValidate();
|
reset();
|
dialogVisible.value = false;
|
}
|
}
|
}
|
|
const handleClose = () => {
|
busRef.value.clearValidate();
|
reset();
|
dialogVisible.value = false;
|
emit("getList")
|
|
}
|
const reset = () => {
|
state.form = {
|
id: '',
|
companyId: null,
|
planId: null,
|
teacherId: null,
|
deptId: null,
|
openTime: "",
|
staffs: '',
|
personalQuality: "",
|
preparatory: "",
|
courseContent: "",
|
suggest: "",
|
aboutTeacher: "",
|
aboutContent: "",
|
teachForm: "",
|
other: ""
|
}
|
state.companyList = []
|
state.tableData =[
|
{ item: '1)礼貌礼仪/精神面貌', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)表达能力(语速/吐字清晰度等)', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)耐心程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)专业知识', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)幽默感', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '个人素养综合得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
]
|
state.tableDataWork =[
|
{ item: '1)是否准时开课/结课', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)是否按计划授课', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)授课的资料、辅助工具等的准备工作', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)课程时间安排的合理程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)授课过程中的活动安排合理性', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '授课前准备工作得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
]
|
state.tableDataContent = [
|
{ item: '1)课件内容正确性', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '2)授课内容能否结合实际工作', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '3)课程内容是否做到条理清晰,重点突出,描述准确', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '4)在讲授过程中能引进更多的知识和信息', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '5)有案例分析,能有效鼓励新员工参与和互动', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '6)对于学员提出问题回答的准确程度', well: false, good: false, fine: false, notGood: false, bad: false },
|
{ item: '课程内容得分', isTotal: true, total: 0 }, // 综合得分行,标记isTotal以便合并
|
]
|
state.staffs = []
|
}
|
|
|
|
const selectValueCom = async (val) => {
|
state.form.planId = null
|
state.form.teacherId = null
|
state.form.deptId = null
|
state.staffs = []
|
state.companyList.forEach(item => {
|
if(item.name === val){
|
state.form.companyId = item.id
|
}
|
})
|
await getPeopleList()
|
await getPlanList()
|
await getDeptList()
|
}
|
|
|
|
defineExpose({
|
openDialog
|
});
|
|
</script>
|
|
<style scoped lang="scss">
|
.notice{
|
:deep(.el-form .el-form-item__label) {
|
font-size: 15px;
|
}
|
:deep(.el-table .cell){
|
font-size: small;
|
}
|
.file {
|
display: flex;
|
flex-direction: column;
|
align-items: flex-start;
|
}
|
}
|
</style>
|