layui 添加功能


  

case 'add':
                layer.open({
                    type : 1,
                    title : "添加頁面",
                    area : [ '580px', '640px' ],    //設置彈出頁面的寬高
                    offset : '20px',                //設置相對位置(偏移)
                    content : $("#add_project"),    //表單所在的那個ID,簡單的來說就是要填寫的input框等
                    cancel : function() {
                        // 你點擊右上角 X 取消后要做什么
                        setTimeout('window.location.reload()', 1); //點擊右上角的X,關閉頁面。然后進行刷新頁面;
                        
                    },
                    success : function() {                            //回調
                        $(':input', '#add_project').not(':button,:submit,:hidden,:radio').val('').removeAttr('checked').removeAttr('selected'); 
                        form.render();                                //重新渲染
                        form.on('submit(submitUpdProject)', function() { //點擊提交后,回調;
                            var jsonEntity = {};
                            var entity = $("form").serializeArray()
                            $.each(entity, function() {
                                if (this.name == "createTime") {
                                    var a = new Date();
                                    jsonEntity[this.name] = timeDate(a);
                                } else {
                                    jsonEntity[this.name] = this.value;
                                }
                            });

                            zsg(_url, jsonEntity);                 //url是路徑,調用后台方法的路徑
                            setTimeout('window.location.reload()', 1000);    //刷新頁面
                            layer.closeAll();
                            return false;
                        });

                    }
                });
                break;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM