前台展示详细信息的增删改操作

2017-12-25 21:17:33来源:CSDN作者:wilson_m人点击

分享

前台展示详细信息的增删改操作

        本次的内容承接上次博客的后续。前驱博客链接:
http://blog.csdn.net/wilson_m/article/details/78864579

        因为信息在前台进行显示的时候,显示的数据是从数据库中的视图中获取到的数据信息,而不是在数据库中的表进行获取到的。通过创建视图实现了几张表的拼接。

        在前台进行页面按钮显示增删改操作的时候,操作的对象将不再试数据库中的视图,数据库中的支持信息的修改,但是不支持在视图中进行删除和添加的操作(支持更新操作)。问题便转移到了对原有表格的增删操作。

所要实现的页面功能如下图所示:

这里写图片描述


mapper代码

//获取默认添加信息时候的第一个教学评价编号@Select("select evaluate_no from teaching_evaluate limit 1")    public String getTeachingEvaluateFirstTrainNo();@Update("update teaching_evaluate set evaluate_name=#{evaluate_name},start_time=#{start_time},end_time=#{end_time},state=#{state},url=#{url},remarks=#{remarks} where evaluate_no=#{evaluate_no}")    public void saveevaluateinfo(@Param("evaluate_no") String evaluate_no,@Param("evaluate_name") String evaluate_name ,@Param("start_time") String start_time,                              @Param("end_time") String end_time,@Param("state") String state,@Param("url") String url,@Param("remarks") String remarks);    @Delete("delete from teaching_evaluate where evaluate_no=#{evaluate_no}")    public void removeevaluateinfo(@Param("evaluate_no") String evaluate_no);    @Insert("insert into teaching_evaluate(evaluate_no,evaluate_name,start_time,end_time,state,url,remarks) values(#{evaluate_no},#{evaluate_name},#{start_time},#{end_time},#{state},#{url},#{remarks})")    public void addevaluateinfo(@Param("evaluate_no") String evaluate_no,@Param("evaluate_name") String evaluate_name ,@Param("start_time") String start_time,                             @Param("end_time") String end_time,@Param("state") String state,@Param("url") String url,@Param("remarks") String remarks);    @Update("update teachingevaluate set teacherName=#{teacherName},teacherGender=#{teacherGender},workUnit=#{workUnit},teacherAge=#{teacherAge},promotedTitle=#{promotedTitle},teacherTitle=#{teacherTitle},teacherEducationBG=#{teacherEducationBG},teacherAge=#{teacherAge},teacherDegree=#{teacherDegree},teacherGrade=#{teacherGrade},teacherState=#{teacherState} where teacherNo=#{teacherNo}")    public void saveevaluateteacherinfo(@Param("teacherNo") String teacherNo,@Param("teacherName") String teacherName ,@Param("teacherGender") String teacherGender,@Param("workUnit") String workUnit,@Param("teacherAge") String teacherAge,@Param("promotedTitle") String promotedTitle,@Param("teacherTitle") String teacherTitle,@Param("teacherEducationBG") String teacherEducationBG,                                        @Param("teacherDegree") String teacherDegree,@Param("teacherGrade") String teacherGrade,@Param("teacherState") String teacherState);    @Delete("delete from teachingevalute_teacher where tno=#{tno} and evaluate_no=#{evaluate_no}")    public void removeevaluateteacherinfo(@Param("tno") String tno,@Param("evaluate_no") String evaluate_no);    @Select("select * from teachingevaluate  where evaluateNo=#{evaluateNo}")    public TeachingEvaluate getTeachingEvaluateListByTnoByPage1(@Param("evaluateNo") String evaluateNo);    @Insert("insert into teachingevalute_teacher (tno,evaluate_no, tname, gender, work_unit,promoted_title,age, title, education_background, degree, grade, state) values (#{tno},#{evaluate_no},#{tname},#{gender},#{work_unit},#{promoted_title},#{age},#{title},#{education_background},#{degree},#{grade},#{state})")    public void addevaluateteacher(@Param("tno") String tno,@Param("evaluate_no") String evaluate_no ,@Param("tname") String tname,@Param("gender") String gender ,@Param("work_unit") String work_unit,@Param("promoted_title") String promoted_title,@Param("age") String age,@Param("title") String title,@Param("education_background") String education_background,@Param("degree") String degree,                                   @Param("grade") String grade,@Param("state") String state);

service代码

 public String getTeachingEvaluateFirstTrainNo(){        return managemapper.getTeachingEvaluateFirstTrainNo();    }public void saveevaluateinfo(String evaluate_no,String evaluate_name ,String start_time, String end_time,String state, String url,String remarks){        managemapper.saveevaluateinfo(evaluate_no, evaluate_name, start_time, end_time, state, url, remarks);    }    public void removeevaluateinfo(String evaluate_no){        managemapper.removeevaluateinfo(evaluate_no);    }    public void addevaluateinfo(String evaluate_no,String evaluate_name ,String start_time,String end_time,String state, String url,String remarks){        managemapper.addevaluateinfo(evaluate_no, evaluate_name, start_time, end_time, state, url, remarks);    }    public TeachingEvaluate getTeachingEvaluateListByTnoByPage1(String evaluateNo){        return managemapper.getTeachingEvaluateListByTnoByPage1(evaluateNo);    }    public void addevaluateteacher(String tno,String evaluate_no ,String tname,String gender ,String work_unit,String promoted_title,String age,String title,String education_background, String degree,                                   String grade,String state){        managemapper.addevaluateteacher(tno, evaluate_no, tname, gender, work_unit, promoted_title, age, title, education_background, degree, grade, state);    }    public void saveevaluateteacherinfo(String teacherNo,String teacherName ,String teacherGender,String workUnit,String teacherAge,String promotedTitle, String teacherTitle,String teacherEducationBG,                                        String teacherDegree,String teacherGrade, String teacherState){        managemapper.saveevaluateteacherinfo(teacherNo, teacherName, teacherGender, workUnit, teacherAge, promotedTitle, teacherTitle, teacherEducationBG, teacherDegree, teacherGrade, teacherState);    }    public void removeevaluateteacherinfo(String tno,String evaluate_no){        managemapper.removeevaluateteacherinfo(tno, evaluate_no);    }

controller代码

 /**     * 保存修改的教学评价信息     * @param request     * @return     */    @RequestMapping(value = "/save_evaluateinfo", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> save_evaluateinfo(HttpServletRequest request,                                             @RequestParam("evaluate_no") String evaluate_no,                                             @RequestParam("evaluate_name") String evaluate_name,                                             @RequestParam("start_time") String start_time,                                             @RequestParam("end_time") String end_time,                                             @RequestParam("state") String state,                                             @RequestParam("url") String url,                                             @RequestParam("remarks") String remarks){        manageservice.saveevaluateinfo(evaluate_no,evaluate_name,start_time,end_time,state,url,remarks);        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }    /**     * 添加教学评价信息     * @param request     * @return     */    @RequestMapping(value = "/add_evaluateinfo", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> add_evaluateinfo(HttpServletRequest request,                                               @RequestParam("evaluate_no") String evaluate_no,                                               @RequestParam("evaluate_name") String evaluate_name,                                               @RequestParam("start_time") String start_time,                                               @RequestParam("end_time") String end_time,                                               @RequestParam("state") String state,                                               @RequestParam("url") String url,                                               @RequestParam("remarks") String remarks){//        manageservice.addevaluateinfo(evaluate_no,evaluate_name,start_time,end_time,state,url,remarks);        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }    /**     * 删除教学评价项目     * @param request     * @return     */    @RequestMapping(value = "/remove_evaluateinfo", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> remove_evaluateinfo(HttpServletRequest request){        String train_no=request.getParameter("evaluate_no");        manageservice.removeevaluateinfo(train_no);        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }    /**     * 添加参加某一个教学评价中的教师信息     * @param request     * @return     */    @RequestMapping(value = "/addevaluateteacherinformation", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> addevaluateteacher(HttpServletRequest request,HttpSession session,                                                 @RequestParam("teacherNo") String teacherNo,                                                 @RequestParam("teacherName") String teacherName,                                                 @RequestParam("teacherGender") String teacherGender,                                                 @RequestParam("workUnit") String workUnit,                                                 @RequestParam("teacherAge") String teacherAge,                                                 @RequestParam("promotedTitle") String promotedTitle,                                                 @RequestParam("teacherTitle") String teacherTitle,                                                 @RequestParam("teacherEducationBG") String teacherEducationBG,                                                 @RequestParam("teacherDegree") String teacherDegree,                                                 @RequestParam("teacherGrade") String teacherGrade,                                                 @RequestParam("teacherState") String teacherState){        String evaluateNoinfo;        evaluateNoinfo=(String) session.getAttribute("evaluateNoinfo");        //这里的if语句用来判断用户是否双击左边一栏,如果双击则获得改行的教学编号        //如果没双击,则通过session绑定获取左边第一栏中的评价编号        if(evaluateNoinfo==null){            evaluateNoinfo=(String) session.getAttribute("FirstEvaluateNo");;        }        manageservice.addevaluateteacher(teacherNo,evaluateNoinfo,teacherName,teacherGender,workUnit,promotedTitle,teacherAge,teacherTitle,teacherEducationBG,teacherDegree,teacherGrade,teacherState);        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }    /**     * 保存参加的教学评价中的教师的信息     * @param request     * @return     */    @RequestMapping(value = "/saveevaluateteacherinfo", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> save_evaluateteacherinfo(HttpServletRequest request,HttpSession session,                                                @RequestParam("teacherNo") String teacherNo,                                                @RequestParam("teacherName") String teacherName,                                                @RequestParam("teacherGender") String teacherGender,                                                @RequestParam("workUnit") String workUnit,                                                @RequestParam("teacherAge") String teacherAge,                                                @RequestParam("promotedTitle") String promotedTitle,                                                @RequestParam("teacherTitle") String teacherTitle,                                                @RequestParam("teacherEducationBG") String teacherEducationBG,                                                @RequestParam("teacherDegree") String teacherDegree,                                                @RequestParam("teacherGrade") String teacherGrade,                                                @RequestParam("teacherState") String teacherState){        manageservice.saveevaluateteacherinfo(teacherNo,teacherName,teacherGender,workUnit,teacherAge,promotedTitle,teacherTitle,teacherEducationBG,teacherDegree,teacherGrade,teacherState);       System.out.println("信息修改成功");        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }    /**     * 删除教学评价张的某个教师的信息     * @param request     * @return     */    @RequestMapping(value = "/remove_evaluateteacherinfo", method = {RequestMethod.GET, RequestMethod.POST})    @ResponseBody    public Map<String,String> remove_evaluateteacherinfo(HttpServletRequest request,HttpSession session){        String evaluateNoinfo=(String) session.getAttribute("evaluateNoinfo");        String teacherNo=request.getParameter("teacherNo");        manageservice.removeevaluateteacherinfo(teacherNo,evaluateNoinfo);        Map<String,String> map=new HashMap<>();        map.put("success","true");        return map;    }

html页面

<body><div class="easyui-layout" data-options="fit:true">    <div data-options="region:'north'" style="height:50px">        <table border="0" align="center">            <tr>                <td><a href="#" class="easyui-linkbutton"   onclick="newevaluate()">添加评价</a></td>                <td><a href="#" class="easyui-linkbutton" onclick="editevaluateinfo()">修改评价</a></td>                <td><a href="#" class="easyui-linkbutton" onclick="removeevaluateinfo()">删除评价</a></td>                <td><a href="#" class="easyui-linkbutton"   onclick="newevaluateteacher()">添加教师信息</a></td>                <td><a href="#" class="easyui-linkbutton" onclick="editevaluateteacherinfo()">修改教师信息</a></td>                <td><a href="#" class="easyui-linkbutton" onclick="remove()">删除教师信息</a></td>            </tr>        </table>    </div>    <div id="tt1" data-options="region:'east',split:true" title="教学评价详细信息" style="width:50%;">        <table id="aa1" class="easyui-datagrid"               data-options="            method:'get',            border:false,            singleSelect:true,            fit:true,            collapsible:false,            pagination:true,            fitColumns:true">            <thead>            <tr>                <th data-options="field:'teacherNo',align:'center',width:'15%'">工号</th>                <th data-options="field:'teacherName',align:'center',width:'9%'">姓名</th>                <th data-options="field:'teacherGender',align:'center',width:'8%'">性别</th>                <th data-options="field:'workUnit',align:'center'">工作单位</th>                <th data-options="field:'teacherAge',align:'center',width:'7%'">年龄</th>                <th data-options="field:'promotedTitle',align:'center'">拟晋升职称</th>                <th data-options="field:'teacherTitle',align:'center',width:'10%'">职称</th>                <th data-options="field:'teacherEducationBG',align:'center',width:'13%'">学历</th>                <th data-options="field:'teacherDegree',align:'center',width:'14%'">学位</th>                <th data-options="field:'teacherGrade',align:'center',width:'9%'">成绩</th>                <th data-options="field:'teacherState',align:'center',width:'9%'">状态</th>            </tr>            </thead>        </table>    </div>    <div style="width:100%;" data-options="region:'center',title:'教学评价信息',iconCls:'icon-ok'">        <table id="ddg1" class="easyui-datagrid"               data-options="               url:'/getteaching_evaluate',               method:'get',               border:false,               singleSelect:true,               fit:true,               collapsible:false,               pagination:true,               fitColumns:true">            <thead>            <tr>                <th data-options="field:'evaluate_no',align:'center',width:'12%'">评价编号</th>                <th data-options="field:'evaluate_name',align:'center'">培训名称</th>                <th data-options="field:'start_time',align:'center',width:'15%'">起始时间</th>                <th data-options="field:'end_time',align:'center',width:'15%'">结束时间</th>                <th data-options="field:'state',align:'center',width:'8%'">状态</th>                <th data-options="field:'url',align:'center',width:'12%'">状态</th>                <th data-options="field:'remarks',align:'center',width:'12%'">状态</th>            </tr>            </thead>        </table>    </div></div><div id="modifydg" class="easyui-dialog" style="width:400px;height:580px;padding:10px 20px"     closed="true" buttons="#modifydg-buttonss">    <form id="fim" method="post" >        <table border="0" style="margin-top:4px; margin-left: 18px">            <tr>                <td><label>评价编号:</label></td>                <td><input class="easyui-textbox" readOnly="true" type="text" name="evaluate_no" ></input></td>            </tr>            <tr>                <td><label>名称:</label></td>                <td><input name="evaluate_name" class="easyui-textbox" style="height:20px" /></td>            </tr>            <tr>                <td><label>起始时间:</label></td>                <td><input name="start_time" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'}) "/></td>            </tr>            <tr>                <td><label>结束时间:</label></td>                <td><input name="end_time" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'}) "/></td>            </tr>            <tr>                <td><label>状态:</label></td>                <td><select class="easyui-combobox" name="state" style="width:174px; height: 26px;" >                    <option value ="开放" >开放</option>                    <option value ="结束">结束</option>                </select>                </td>            </tr>            <tr>                <td><label>通知URL:</label></td>                <td><input name="url" class="easyui-textbox" /></td>            </tr>            <tr>                <td><label>备注:</label></td>                <td><input name="remarks" class="easyui-textbox" style="height:60px" /></td>            </tr>        </table>    </form></div><div id="modifydg-buttonss">    <a href="#" class="easyui-linkbutton"  onclick="saveevaluateinfo()">保存</a>    <a href="#" class="easyui-linkbutton"  onclick="javascript:$('#modifydg').dialog('close')">取消</a></div><div id="adddg" class="easyui-dialog" style="width:400px;height:580px;padding:10px 20px"     closed="true" buttons="#adddg-buttonsinfo">    <form id="fam" method="post" >        <table border="0" style="margin-top:4px; margin-left: 18px">            <tr>                <td><label>评价编号:</label></td>                <td><input class="easyui-textbox"  type="text" name="evaluate_no" ></input></td>            </tr>            <tr>                <td><label>名称:</label></td>                <td><input name="evaluate_name" class="easyui-textbox" style="height:20px" /></td>            </tr>            <tr>                <td><label>起始时间:</label></td>                <td><input name="start_time" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'}) "/></td>            </tr>            <tr>                <td><label>结束时间:</label></td>                <td><input name="end_time" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'}) "/></td>            </tr>            <tr>                <td><label>状态:</label></td>                <td><select class="easyui-combobox" name="state" style="width:174px; height: 26px;" >                    <option value ="开放" >开放</option>                    <option value ="结束">结束</option>                </select>                </td>            </tr>            <tr>                <td><label>通知URL:</label></td>                <td><input name="url" class="easyui-textbox" /></td>            </tr>            <tr>                <td><label>备注:</label></td>                <td><input name="remarks" class="easyui-textbox" style="height:60px" /></td>            </tr>        </table>    </form></div><div id="adddg-buttonsinfo">    <a href="#" class="easyui-linkbutton"  onclick="addevaluate()">添加</a>    <a href="#" class="easyui-linkbutton"  onclick="javascript:$('#adddg').dialog('close')">取消</a></div><!--修改教学评价中的教师信息--><div id="modifydg1" class="easyui-dialog" style="width:400px;height:580px;padding:10px 20px"     closed="true" buttons="#modifydg-buttons1">    <form id="fiminfo" method="post" >        <table border="0" style="margin-top:4px; margin-left: 18px">            <tr>                <td><label>工号:</label></td>                <td><input class="easyui-textbox" readOnly="true" type="text" name="teacherNo" ></input></td>            </tr>            <tr>                <td><label>姓名:</label></td>                <td><input name="teacherName" class="easyui-textbox" readOnly="true"  /></td>            </tr>            <tr>                <td><label>性别:</label></td>                <!--<td><input /></td>-->                <td><select class="easyui-combobox" name="teacherGender" style="width:174px; height: 26px;" >                    <option value ="男性" >男性</option>                    <option value ="女性">女性</option>                </select>                </td>            </tr>            <tr>                <td><label>工作单位:</label></td>                <td><input name="workUnit" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>年龄:</label></td>                <td><input name="teacherAge" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>拟晋升职称:</label></td>                <td><input name="promotedTitle" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>职称:</label></td>                <td><input name="teacherTitle" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>学历:</label></td>                <td><select class="easyui-combobox" name="teacherEducationBG" style="width:174px; height: 26px;" >                    <option value ="博士研究生" >博士研究生</option>                    <option value ="硕士研究生">硕士研究生</option>                    <option value ="本科生">本科生</option>                    <option value ="本科生以下">本科生以下</option>                </select>                </td>            </tr>            <tr>                <td><label>学位:</label></td>                <td><select class="easyui-combobox" name="teacherDegree" style="width:174px; height: 26px;" >                    <option value ="博士学位" >博士学位</option>                    <option value ="硕士学位">硕士学位</option>                    <option value ="学士学位">学士学位</option>                </select>                </td>            </tr>            <tr>            <td><label>成绩:</label></td>            <td><input name="teacherGrade" class="easyui-textbox" /></td>            </tr>            <tr>                <td><label>状态:</label></td>                <td><select class="easyui-combobox" name="teacherState" style="width:174px; height: 26px;" >                    <option value =" &nbsp;" >&nbsp;</option>                    <option value ="已完成">已完成</option>                    <option value ="报名未审核">报名未审核</option>                    <option value ="报名已审核">报名已审核</option>                </select>                </td>            </tr>        </table>    </form></div><div id="modifydg-buttons1">    <a href="#" class="easyui-linkbutton"  onclick="saveinfo()">保存</a>    <a href="#" class="easyui-linkbutton"  onclick="javascript:$('#modifydg1').dialog('close')">取消</a></div><div id="adddg1" class="easyui-dialog" style="width:400px;height:580px;padding:10px 20px"     closed="true" buttons="#adddgbuttons">    <form id="faminfor" method="post" >        <table border="0" style="margin-top:4px; margin-left: 18px">            <tr>                <td><label>工号:</label></td>                <td><input class="easyui-textbox"  type="text" name="teacherNo" data-options="required:true"></input></td>            </tr>            <tr>                <td><label>姓名:</label></td>                <td><input name="teacherName" class="easyui-textbox"  data-options="required:true" /></td>            </tr>            <tr>                <td><label>性别:</label></td>                <!--<td><input /></td>-->                <td><select class="easyui-combobox" name="teacherGender" style="width:174px; height: 26px;"  data-options="editable:false,panelHeight:'auto'">                    <option value ="男性" >男性</option>                    <option value ="女性">女性</option>                </select>                </td>            </tr>            <tr>                <td><label>工作单位:</label></td>                <td><input name="workUnit" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>年龄:</label></td>                <td><input name="teacherAge" class="easyui-textbox" data-options="required:true"/></td>            </tr>            <tr>                <td><label>拟晋升职称:</label></td>                <td><input name="promotedTitle" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>职称:</label></td>                <td><input name="teacherTitle" class="easyui-textbox"/></td>            </tr>            <tr>                <td><label>学历:</label></td>                <td><select class="easyui-combobox" name="teacherEducationBG" style="width:174px; height: 26px;" >                    <option value ="博士研究生" >博士研究生</option>                    <option value ="硕士研究生">硕士研究生</option>                    <option value ="本科生">本科生</option>                    <option value ="本科生以下">本科生以下</option>                </select>                </td>            </tr>            <tr>                <td><label>学位:</label></td>                <td><select class="easyui-combobox" name="teacherDegree" style="width:174px; height: 26px;" >                    <option value ="博士学位" >博士学位</option>                    <option value ="硕士学位">硕士学位</option>                    <option value ="学士学位">学士学位</option>                </select>                </td>            </tr>            <tr>                <td><label>成绩:</label></td>                <td><input name="teacherGrade" class="easyui-textbox" data-options="required:true"/></td>            </tr>            <tr>                <td><label>状态:</label></td>                <td><select class="easyui-combobox" name="teacherState" style="width:174px; height: 26px;" >                    <option value =" &nbsp;" >&nbsp;</option>                    <option value ="已完成">已完成</option>                    <option value ="报名未审核">报名未审核</option>                    <option value ="报名已审核">报名已审核</option>                </select>                </td>            </tr>        </table>    </form></div><div id="adddgbuttons">    <a href="#" class="easyui-linkbutton"  onclick="addevaluateteacherinfo()">添加</a>    <a href="#" class="easyui-linkbutton"  onclick="javascript:$('#adddg1').dialog('close')">取消</a></div></body>

js代码

function newevaluate(){        $('#adddg').dialog('open').dialog('setTitle','添加教学评价');        $('#fam').form('clear');    }    function editevaluateinfo() {        var row = $('#ddg1').datagrid('getSelected');        if (row){            $('#modifydg').dialog('open').dialog('setTitle','修改信息');            //显示未修改前的用户信息            $('#fim').form('load',row);        }    }    function saveevaluateinfo() {        var row = $('#ddg1').datagrid('getSelected');        $('#fim').form('submit',{            url: '/save_evaluateinfo',            onSubmit: function(){                return $(this).form('validate');            },            success: function(result){                var result = eval('('+result+')');                if (result.success){                    $('#modifydg').dialog('close');        // close the dialog                    $('#ddg1').datagrid('reload'); // reload the user data                    $.messager.show({                        title: 'Success',                        msg: '保存成功'                    });                } else {                    $.messager.show({                        title: 'Error',                        msg: result.msg                    });                }            }        });    }    function addevaluate(){        var add="/add_evaluateinfo";        $('#fam').form('submit',{            url: add,            onSubmit: function(){                return $(this).form('validate');            },            success: function(result){                var result = eval('('+result+')');                if (result.success){                    $('#adddg').dialog('close');       // close the dialog                    $('#ddg1').datagrid('reload'); // reload the user data                    $.messager.show({                        title: 'Success',                        msg: '添加成功'                    });                } else {                    $.messager.show({                        title: 'Error',                        msg: result.msg                    });                }            }        });    }    function removeevaluateinfo() {        var row = $('#ddg1').datagrid('getSelected');        if (row){            $.messager.confirm('删除提示','确定要删除该评价?',function(r){                if (r){                    $.post('remove_evaluateinfo',{evaluate_no:row.evaluate_no},function(result){                        if (result.success){//                            $('#ddg1').datagrid('reload'); // reload the user data                            $('#aa1').datagrid('reload');                            $.messager.show({                                title: 'Success',                                msg: '删除成功'                            });                        } else {                            $.messager.show({  // show error message                                title: 'Error',                                msg: result.msg                            });                        }                    },'json');                }            });        }    }    function newevaluateteacher() {        $('#adddg1').dialog('open').dialog('setTitle','添加教师');        $('#faminfor').form('clear');    }    function editevaluateteacherinfo() {        var row = $('#aa1').datagrid('getSelected');        if (row){            $('#modifydg1').dialog('open').dialog('setTitle','修改教师信息');            //显示未修改前的用户信息            $('#fiminfo').form('load',row);        }    }    function addevaluateteacherinfo(){        var add="/addevaluateteacherinformation";        $('#faminfor').form('submit',{            url: add,            onSubmit: function(){                return $(this).form('validate');            },            success: function(result){                var result = eval('('+result+')');                if (result.success){                    $('#adddg1').dialog('close');      // close the dialog                    $('#aa1').datagrid('reload');  // reload the user data                    $.messager.show({                        title: 'Success',                        msg: '添加成功'                    });                } else {                    $.messager.show({                        title: 'Error',                        msg: result.msg                    });                }            }        });    }    function saveinfo (){        var row = $('#aa1').datagrid('getSelected');        $('#fiminfo').form('submit',{            url: '/saveevaluateteacherinfo',            onSubmit: function(){                return $(this).form('validate');            },            success: function(result){                var result = eval('('+result+')');                if (result.success){                    $('#modifydg1').dialog('close');        // close the dialog                    $('#aa1').datagrid('reload'); // reload the user data                    $.messager.show({                        title: 'Success',                        msg: '保存成功'                    });                } else {                    $.messager.show({                        title: 'Error',                        msg: result.msg                    });                }            }        });    }    function remove() {        var row = $('#aa1').datagrid('getSelected');        if (row){            $.messager.confirm('Confirm','确定要删除该信息?',function(r){                if (r){                    $.post('remove_evaluateteacherinfo',{teacherNo:row.teacherNo},function(result){                        if (result.success){                            $('#aa1').datagrid('reload');                            $.messager.show({                                title: 'Success',                                msg: '删除成功'                            });                        } else {                            $.messager.show({  // show error message                                title: 'Error',                                msg: result.msg                            });                        }                    },'json');                }            });        }    }

通过上述的代码,可以能够实现对左边和右边两栏信息中的增删改操作。

相关文章

    无相关信息

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台