CapUserForm.jsp 9.9 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%--
- Author(s): 54915
- Date: 2024-03-29 14:57:04
- Description:
    --%>
    <head>
        <title>
            CapUser录入
        </title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <script src="<%= request.getContextPath() %>/common/nui/nui.js" type="text/javascript">
        </script>
    </head>
    <body>
        <!-- 标识页面是查看(query)、修改(edit)、新增(add) -->
        <input name="pageType" class="nui-hidden"/>
        <div id="dataform1" style="padding-top:5px;">
            <!-- hidden域 -->
            <input class="nui-hidden" name="capuser.operatorId"/>
            <table style="width:100%;height:100%;table-layout:fixed;" class="nui-form-table">
                <tr>
                    <td class="form_label">
                        tenantId:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.tenantId"/>
                    </td>
                    <td class="form_label">
                        userId:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.userId"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        password:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.password"/>
                    </td>
                    <td class="form_label">
                        invaldate:
                    </td>
                    <td colspan="1">
                        <input class="nui-datepicker" name="capuser.invaldate"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        userName:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.userName"/>
                    </td>
                    <td class="form_label">
                        authmode:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.authmode"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        status:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.status"/>
                    </td>
                    <td class="form_label">
                        unlocktime:
                    </td>
                    <td colspan="1">
                        <input class="nui-datepicker" name="capuser.unlocktime"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        menutype:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.menutype"/>
                    </td>
                    <td class="form_label">
                        lastlogin:
                    </td>
                    <td colspan="1">
                        <input class="nui-datepicker" name="capuser.lastlogin"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        errcount:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.errcount"/>
                    </td>
                    <td class="form_label">
                        startdate:
                    </td>
                    <td colspan="1">
                        <input class="nui-datepicker" name="capuser.startdate"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        enddate:
                    </td>
                    <td colspan="1">
                        <input class="nui-datepicker" name="capuser.enddate"/>
                    </td>
                    <td class="form_label">
                        validtime:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.validtime"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        maccode:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.maccode"/>
                    </td>
                    <td class="form_label">
                        ipaddress:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.ipaddress"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        email:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.email"/>
                    </td>
                    <td class="form_label">
                        createuser:
                    </td>
                    <td colspan="1">
                        <input class="nui-textbox" name="capuser.createuser"/>
                    </td>
                </tr>
                <tr>
                    <td class="form_label">
                        createtime:
                    </td>
                    <td colspan="3">
                        <input class="nui-datepicker" name="capuser.createtime"/>
                    </td>
                </tr>
            </table>
            <div class="nui-toolbar" style="padding:0px;" borderStyle="border:0;">
                <table width="100%">
                    <tr>
                        <td style="text-align:center;" colspan="4">
                            <a class="nui-button" iconCls="icon-save" onclick="onOk()">
                                保存
                            </a>
                            <span style="display:inline-block;width:25px;">
                            </span>
                            <a class="nui-button" iconCls="icon-cancel" onclick="onCancel()">
                                取消
                            </a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <script type="text/javascript">
            nui.parse();

            function saveData(){

                var form = new nui.Form("#dataform1");
                form.setChanged(false);
                //保存
                var urlStr = "com.huaheng.wms.capuserbiz.addCapUser.biz.ext";
                var pageType = nui.getbyName("pageType").getValue();//获取当前页面是编辑还是新增状态
                //编辑
                if(pageType=="edit"){
                    urlStr = "com.huaheng.wms.capuserbiz.updateCapUser.biz.ext";
                }
                form.validate();
                if(form.isValid()==false) return;

                var data = form.getData(false,true);
                var json = nui.encode(data);

                $.ajax({
                    url:urlStr,
                    type:'POST',
                    data:json,
                    cache:false,
                    contentType:'text/json',
                    success:function(text){
                        var returnJson = nui.decode(text);
                        if(returnJson.exception == null){
                            CloseWindow("saveSuccess");
                        }else{
                            nui.alert("保存失败", "系统提示", function(action){
                                if(action == "ok" || action == "close"){
                                    //CloseWindow("saveFailed");
                                }
                                });
                            }
                        }
                        });
                    }

                    //页面间传输json数据
                    function setFormData(data){
                        //跨页面传递的数据对象,克隆后才可以安全使用
                        var infos = nui.clone(data);

                        //保存list页面传递过来的页面类型:add表示新增、edit表示编辑
                        nui.getbyName("pageType").setValue(infos.pageType);

                        //如果是点击编辑类型页面
                        if (infos.pageType == "edit") {
                            var json = infos.record;

                            var form = new nui.Form("#dataform1");//将普通form转为nui的form
                            form.setData(json);
                            form.setChanged(false);
                        }
                    }

                    //关闭窗口
                    function CloseWindow(action) {
                        if (action == "close" && form.isChanged()) {
                            if (confirm("数据被修改了,是否先保存?")) {
                                saveData();
                            }
                        }
                        if (window.CloseOwnerWindow)
                        return window.CloseOwnerWindow(action);
                        else window.close();
                    }

                    //确定保存或更新
                    function onOk() {
                        saveData();
                    }

                    //取消
                    function onCancel() {
                        CloseWindow("cancel");
                    }
                </script>
            </body>
        </html>