@@ -398,7 +415,7 @@ import {Form, message} from "ant-design-vue";
import FJUpload from "@/components/common/FJUpload";
import CheckBox from "@/components/common/CheckBox";
import RangePicker from "@/components/common/RangePicker";
-import ProjectManager from "@/components/project/ProjectManagerNew";
+import ProjectManager from "@/components/project/ProjectManagerNewTeacher";
import AddHomework from "@/components/drawers/CommonHomework.vue";
import AddTest from "@/components/drawers/CommonTest.vue";
import NameInput from "@/components/project/NameInput";
@@ -410,7 +427,7 @@ import {request,useRowsPageNoInit} from "@/api/request";
import dialog from "@/utils/dialog";
import {useResetRef} from "@/utils/useCommon";
import { validateName } from "@/api/index1";
-
+import moment from 'moment';
const props = defineProps({
type: Number,
});
@@ -446,6 +463,19 @@ const columns = ref([
key: "teacher",
width: "20%",
align: "center",
+ customRender: ({ record }) => {
+ const teachers = record.offteachers;
+ return teachers.map((teacher, index) => {
+ // 如果需要显示为列表形式
+ return (
+
+ {teacher.teacherName}
+ {index !== teachers.length - 1 && ', '}
+
+ );
+ });
+ },
+
},
{
title: "学员数",
@@ -484,6 +514,13 @@ const params = ref({
taskId: "",
createBeginTime: '',
createEndTime: '',
+ offteachers:[
+ {
+ teacherId: '',
+ teacherName: '',
+ weight: '',
+ }
+ ]
});
const validated = ref(0);
const dateTime = ref([]);
@@ -493,7 +530,7 @@ const formData = useResetRef({
name: "",
address: "",
teacherId: "",
- teacher: "",
+ // teacher: "",
beforeValue: "",
afterStartValue: "",
applyFlag: 0,
@@ -510,6 +547,13 @@ const formData = useResetRef({
offcourseId: "",
draftTaskId: "",
taskId: "",
+ offteachers: [
+ {
+ teacherId: "",
+ teacherName: "",
+ weight:''
+ }
+ ],
});
const formDataRule = {
name: [
@@ -530,35 +574,102 @@ const formDataRule = {
message: "请选择结束时间",
},
],
- teacher: [
+ offteachers: [
{
- required: true,
- message: "请选择教师",
+ validator: (rule, value, callback) => {
+ if (!value.every(item => item.teacherName)) {
+ callback(new Error('请选择教师'));
+ } else {
+ callback();
+ }
+ },
+ message: '请选择教师',
+ fields: {
+ teacherName: [
+ {
+ required: true,
+ message: "请选择教师",
+ },
+ ],
+ },
},
],
- teacherId: [
- {
- required: true,
- message: "请选择教师",
- },
- ],
- // duration: [
- // {
- // required: true,
- // message: "请输入持续时间",
- // },
- // ],
};
const { validate } = Form.useForm(formData, formDataRule);
const durationText = computed(() => dateTime.value?.length?dayjs(dateTime.value[1]).diff(dayjs(dateTime.value[0]),'minute'):'请输入持续时间');
-function timeChange(time, timeStr) {
+
+function inputAdd() {
+ formData.value.offteachers.push({
+ teacherId: "",
+ teacherName: "",
+ weight: '',
+ });
+}
+function inputRemove(index) {
+ dialog({
+ content: "确定删除此授课教师吗?",
+ ok: async () => {
+ formData.value.offteachers.splice(index, 1);
+ message.success("删除成功");
+ },
+ });
+}
+const totalWeightSum = ref(0)
+function inputWeightChange(index) {
+ let totalWeight = 0
+ formData.value.offteachers.forEach(item => {
+ totalWeight += Number(item.weight);
+ });
+ if (totalWeight > 100) {
+ formData.value.offteachers[index].weight -= totalWeight - 100;
+ totalWeight = 100;
+ }
+ totalWeightSum.value = totalWeight
+ }
+function timeChange(timeStr) {
+ console.log(timeStr,'timeStr')
formData.value.beginTime = timeStr;
// formData.value.duration = durationText.value
// formData.value.duration || (formData.value.duration = dayjs(timeStr[1]).diff(dayjs(timeStr[0]),'minute'))
}
-function timeChangeEnd(time,timeStr){
+ function onDateSelect(date) {
+ const month = String(date.$M+1).padStart(2, '0')
+ const day = String(date.$D).padStart(2, '0')
+ dateTime.value[0]=date.$y+'-'+month+'-'+day+' '+date.$H+':'+date.$m
+ }
+function onBlurStart(){
+ onFocusStart()
+ console.log(dateTime.value[0],'dateTime')
+}
+function onFocusStart(){
+ if(!dateTime.value[0]){
+ let now=new Date()
+ let start=new Date(now.setFullYear(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0))
+ dateTime.value = [
+ moment(start).format('YYYY-MM-DD HH:mm'),
+ dateTime.value[1]
+ ];
+ }
+}
+function timeChangeEnd(timeStr){
formData.value.endTime = timeStr;
}
+function onDateEnd(date) {
+ const month = String(date.$M+1).padStart(2, '0')
+ const day = String(date.$D).padStart(2, '0')
+ dateTime.value[1]=date.$y+'-'+month+'-'+day+' '+date.$H+':'+date.$m
+ }
+function onFocusEnd(){
+ if(!dateTime.value[1]){
+ let now=new Date()
+ let start=new Date()
+ let end=new Date(now.setFullYear(now.getFullYear()))
+ dateTime.value = [
+ dateTime.value[0],
+ moment(end).format('YYYY-MM-DD HH:mm')
+ ];
+ }
+}
function search() {
tableRef.value.fetch();
}
@@ -597,6 +708,13 @@ const createNewCourse = () => {
dateTime.value = [];
validated.value = 0;
onceName.value = "";
+ formData.value.offteachers = [
+ {
+ teacherId: "",
+ teacherName: "",
+ weight: '',
+ },
+ ];
offCourseNewVisiable.value = true;
};
const handleCancelStu = () => offCourseNewVisiable.value = false;
@@ -622,18 +740,26 @@ const del = (id,record) => {
};
async function coursePlanConfirm() {
- if(editBeginClass.value){
- message.info('讲师费已进入审批阶段,无法编辑')
- return
- }
- if(dateTime.value.length<2){
- message.info('请选择开始时间和结束时间')
- return
- }
+ console.log({ ...formData.value },'{ ...formData.value }')
await validate().catch(({ errorFields }) => {
message.warning(errorFields[0].errors.join());
throw Error("数据校验不通过");
});
+ if(dateTime.value.length<2){
+ message.info('请选择开始时间和结束时间')
+ return
+ }
+ if(formData.value.offteachers.length==1&& totalWeightSum.value!=100){
+ message.error('单名教师您设置的权重应该是100%')
+ return
+ }else if(formData.value.offteachers.length>1&& totalWeightSum.value!=100){
+ message.error('多名教师权重合计值为100%')
+ return
+ }
+ if(editBeginClass.value){
+ message.info('讲师费已进入审批阶段,无法编辑')
+ return
+ }
const offName = await validateName({
name: formData.value.name,
type: 5,
@@ -652,6 +778,8 @@ async function coursePlanConfirm() {
// TODO 当点击选择了是否评估按钮 点击保存的时候没有选择评估 则是否需要评估重置为 0 不需要
formData.value.evalFlag = formData.value.assessmentName ? 1 : 0;
formData.value.duration = formData.value.duration ? formData.value.duration : durationText.value
+ formData.value.beginTime = dateTime.value[0]
+ formData.value.endTime = dateTime.value[1]
await request(COURSE_PLAN_EDIT, { ...formData.value });
handleCancelStu();
tableRef.value.fetch();
@@ -666,6 +794,7 @@ function planEdit(record) {
}
onceName.value = record.name;
formData.value = { ...record };
+ console.log({ ...record },'{ ...record }')
validated.value = 0;
formData.value.homeWorkId && request(WORK_DETAIL(formData.value.homeWorkId), {}).then(res => formData.value.workInfo = res.data);
formData.value.testId && request(EXAM_DETAIL(formData.value.testId), {}).then(res => formData.value.examInfo = res.data);
@@ -1161,7 +1290,28 @@ defineExpose({ openDrawer });
margin: auto;
align-items: center;
margin-bottom: 23px;
-
+ .teacher_input{
+ .ant-input-number{
+ width: 15%;
+ height: 40px !important;
+ border-radius: 8px !important;
+ border: 1px solid #C7CBD2 !important;
+ margin: 0 10px 0 10px;
+ }
+ }
+ .btn-add{
+ margin: 0 10px 0 10px;
+ }
+ .btn-circle{
+ text-align: center;
+ line-height: 100%;
+ margin-top: 5px;
+ span{
+ width: 100%;
+ height: 100%;
+ font-size: 33px;
+ }
+ }
.signbox {
display: flex;
justify-content: end;
diff --git a/src/components/drawers/router/RouterFaceStu.vue b/src/components/drawers/router/RouterFaceStu.vue
index cfc8c996..30ca2244 100644
--- a/src/components/drawers/router/RouterFaceStu.vue
+++ b/src/components/drawers/router/RouterFaceStu.vue
@@ -81,7 +81,7 @@