From 8fea79cbfdc01d6d64c910e0f483f3acb6ec1b0d Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Wed, 9 Nov 2022 21:55:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E8=AF=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/js/common.js | 28 +++++++++++++++++++ .../teacherOpenCourseScheduleSession/add.js | 25 +++++++++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/admin-core/src/main/resources/static/js/common.js b/admin-core/src/main/resources/static/js/common.js index 24562e7a..f95a1930 100644 --- a/admin-core/src/main/resources/static/js/common.js +++ b/admin-core/src/main/resources/static/js/common.js @@ -163,6 +163,34 @@ var Common = { } }) + }, + postJSON: function (url, paras, next) { + $.ajax({ + url: Common.ctxPath + url, + type: "POST", + contentType:'application/json;charset=utf-8', + dataType:'json', + data: paras, + success: function (rsp) { + if (rsp.code != 0) { + Common.error(rsp.msg); + } else { + //成功 + if (next != null) { + next(rsp.data); + } else { + Common.success(rsp.responseJSON.msg); + } + } + }, + error: function (rsp) { + if(rsp.responseJSON && rsp.responseJSON.msg) + Common.error(rsp.responseJSON.msg); + else + Common.error('服务器错误,请联系管理员'); + } + }) + }, downLoad: function (url, data, method) { if(!method) { diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseScheduleSession/add.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseScheduleSession/add.js index 2b2663d7..86a97401 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseScheduleSession/add.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseScheduleSession/add.js @@ -145,13 +145,16 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule }); form.on('select(select_)', function (obj) { + debugger table.cache['kkJieciTable'][$(this).parents("tr").data("index")].teacherOpenCourseScheduleSessionClassId = obj.value; var teacherOpenCourseScheduleSessionClassIsMultiple = $("#addForm input:radio[name='teacherOpenCourseScheduleSessionClassIsMultiple']:checked").val(); - if (teacherOpenCourseScheduleSessionClassIsMultiple == 'false') { + // if (teacherOpenCourseScheduleSessionClassIsMultiple == 'false') { kkJieciTableData.forEach(function (item, index) { - item.teacherOpenCourseScheduleSessionClassId = obj.value; + if(item.LAY_CHECKED === true) { + item.teacherOpenCourseScheduleSessionClassId = obj.value; + } }); - } + // } }); //设置时间弹窗 $("#setTime").click(function () { @@ -372,13 +375,25 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule layer.msg('开课星期必选', {icon: 5}); return; } + + // 构建后台所需要的开课节次List数据 + var sessionTagListMap = {}; + kkJieciTableData.forEach(item => { + var sessionClassId = item.teacherOpenCourseScheduleSessionClassId + if(!sessionClassId) { return; } + if(sessionTagListMap.hasOwnProperty(sessionClassId)) { + sessionTagListMap[sessionClassId].push(item) + }else { + sessionTagListMap[sessionClassId] = [] + } + }) var param = { teacherOpenCourseScheduleSessionId: teacherOpenCourseScheduleSessionId, teacherOpenCourseId: teacherOpenCourseId, teacherId: teacherId, schoolClassIdPlural: schoolClassIds, teacherOpenCourseScheduleSessionClassIsMultiple: teacherOpenCourseScheduleSessionClassIsMultiple, - sessionTagList: sessionTagList, + sessionTagList: sessionTagListMap, startTime: teacherOpenCourseScheduleSessionDayTime, weekNum: teacherOpenCourseScheduleSessionWeekNum, openOnHolidays: teacherOpenCourseScheduleSessionOpenOnHolidays, @@ -388,7 +403,7 @@ layui.define(['form', 'laydate', 'table', 'xmSelect', 'teacherOpenCourseSchedule if(!$.isEmpty(teacherOpenCourseScheduleSessionId)){ url = "/jlw/teacherOpenCourseScheduleSession/editSession.json"; } - var ret = Common.postAjax(url,JSON.stringify(param)); + var ret = Common.postJSON(url,JSON.stringify(param)); layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { offset: ['50%'], icon: ret.code == 0 ? 1 : 2,