layui.define([ 'form', 'laydate', 'table','teacherOpenCourseNoticeStudentApi'], function(exports) { var form = layui.form; var teacherOpenCourseNoticeStudentApi = layui.teacherOpenCourseNoticeStudentApi; var index = layui.index; var view = { init:function(){ Lib.initGenrealForm($("#addForm"),form); this.initSubmit(); }, initSubmit:function(){ $("#addButton").click(function(){ form.on('submit(form)', function(){ var teacherOpenCourseNoticeStudentId = $("#addForm input[name='teacherOpenCourseNoticeStudentId']").val(); if(!$.isEmpty(teacherOpenCourseNoticeStudentId)){ teacherOpenCourseNoticeStudentApi.updateTeacherOpenCourseNoticeStudent($('#addForm'),function(){ parent.window.dataReload(); Common.info("更新成功"); Lib.closeFrame(); }); }else{ teacherOpenCourseNoticeStudentApi.addTeacherOpenCourseNoticeStudent($('#addForm'),function(){ parent.window.dataReload(); Common.info("添加成功"); Lib.closeFrame(); }); } }); }); $("#addButton-cancel").click(function(){ Lib.closeFrame(); }); } } exports('add',view); });