<%@ page language="java" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>吃点儿吧</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta> <meta http-equiv="Program" content="No-cache"></meta> <meta http-equiv="Cache-Control" content="No-cache"></meta> <meta http-equiv="Expires" content="0"></meta> <meta http-equiv="Page-Enter" CONTENT="revealtrans(duration=6.0,transition=23)"></meta> <meta http-equiv="Page-Exit" CONTENT="revealtrans(duration=6.0,transition=23)"></meta> <style type="text/css"> @import "js/dojo/resources/dojo.css";
@import "js/dijit/themes/tundra/tundra.css";
@import "js/dojox/grid/resources/tundraGrid.css";
@import "js/dojox/grid/enhanced/resources/tundraEnhancedGrid.css";
@import "js/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";
body { font-size: 0.9em; font-family: Geneva,Arial,Helvetica,sans-serif; padding: 0.5em; }
.title { text-align: center; }
#grid1 { width: 32.2em; height: 40em; }
#grid2 { width: 45.2em; height: 40em; } </style>
</head> <body style="background-color: #C5DFEE" class="tundra" onmouSEOver="MM_displayStatusMsg('由E-LINK 杨永滨 提供');"> <div style="font-size: 40px; background-color:#4E8EBC; color: #C5DFEE; text-align: center;font-weight: bold">吃点儿吧</div> <div style="margin: 10px auto"> <div style="float: left; "> <div style="font-size: 15px; font-weight: bold;"> 点菜区 </div> <br /> 日期: <input id="selDate" readonly="readonly" dojoType="dijit.form.TextBox" name="orderDate" type="text" size="11" > <br /> <br /> 姓名: <select id="cusSel" name="cName" dojoType="dijit.form.ComboBox"> <option value="0"> --请选择-- </option> <option value="0"> .....
</option>
</select> <br /> <br /> <span dojoType="dojo.data.ItemFileWriteStore" jsId="jsonStore" url="gridData.json"> </span> 菜单: <div id="grid1" dojoType="dojox.grid.DataGrid" structure="layout_check" plugins='{nestedSorting: true,dnd: true,indirectSelection: true}' jsid="grid" store="jsonStore" query="{ name: '*' }" selectionMode="single" rowsPerPage="40" rowSelector="30px">
</div> <br> <button id="saveBtn" type="button" dojoType="dijit.form.Button"> 保存 </button> <br /> <br /> <br />
</div> <div style="float: left; margin-left: 20px"> <div style="font-size: 15px; font-weight: bold;"> 查询区 </div> <br /> 订单日期: <input id="searchDate" name="selDate" type="text" size="11" dojoType="dijit.form.DateTextBox"> <button id="searchBtn" dojoType="dijit.form.Button"> 查询 </button> <div style="margin-top: 42px">
订单: </div> <span dojoType="dojo.data.ItemFileWriteStore" jsId="loadOrder" url="loadOrderAction.do"></span> <table id="grid2" dojoType="dojox.grid.DataGrid" store="loadOrder" preventCache=true urlPreventCache=true plugins='{nestedSorting: true,indirectSelection: true}' jsid="showOrder" query="{ orderDate: '*' }" rowsPerPage="20" rowSelector="20px"> <thead> <tr> <th field="CName" width="100"> 客户名称 </th> <th field="type" width="100"> 类别 </th> <th field="orderName" width="150"> 名称 </th> <th field="price" width="50"> 价格 </th> <th field="orderDate" width="100"> 订单日期 </th> </tr> </thead> </table> <br> </div> </div> <%-- <button dojoType="dijit.form.Button">删除</button>--%>
<script type="text/javascript" src="js/dojo/dojo.js" djConfig="parSEOnLoad: true"></script> <script type="text/javascript"> function MM_displayStatusMsg(msgStr) { window.status=msgStr; } var selDate,cusSel,grid1,saveBtn,searchBtn,searchDate,grid2; dojo.require("dojo.data.ItemFileWriteStore"); dojo.require("dojo.parser"); dojo.require("dijit.form.DateTextBox"); dojo.require("dijit.form.ComboBox"); dojo.require("dijit.form.Button"); dojo.require("dojox.grid.EnhancedGrid"); dojo.require("dojox.grid.enhanced.plugins.NestedSorting"); dojo.require("dojox.grid.enhanced.plugins.DnD"); dojo.require("dojox.grid.enhanced.plugins.IndirectSelection"); dojo.require("dojox.grid.Selection"); dojo.require("dojox.grid._RadioSelector"); dojo.require("dijit.form.TextBox"); dojo.addOnLoad(init); dojo.preventCache = true; userCache = false; function init() { saveBtn = dojo.byId("saveBtn"); selDate = dojo.byId("selDate"); cusSel = dojo.byId("cusSel"); grid1 = dijit.byId("grid1"); grid2 = dijit.byId("grid2"); searchDate = dojo.byId("searchDate"); searchBtn = dojo.byId("searchBtn"); dojo.connect(saveBtn,"onclick",saveOrder); dojo.connect(searchBtn,searchOrder); selDate.value = dojo.date.locale.format(new Date(),{formatLength:'long',selector:'date',locale:'zh-cn',datePattern:'yyyy-M-d'}); dojo.xhrGet({ url:"loadOrderAction.do", preventCache:true, load:function(reLoad) { var da = eval("("+reLoad+")"); var store = new dojo.data.ItemFileWriteStore({data:da}); showOrder.setStore(store); }, error:function(error) { alert(error); } }); } var layout_check = [{ type: "dojox.grid._RadioSelector",width:"2" },{ cells: [[ {name: '类别',field: 'type',width:"10"}, {name: '名称',field: 'name', {name: '价格',field: 'price',width:"5"} ]]}]; function saveOrder() { if(dojo.trim(selDate.value)=="") { alert("请选择日期"); return false; } else if(cusSel.value=='--请选择--') { alert("请选择姓名"); return false; } else { var items=grid1.selection.getSelected(); var res=""; var result = []; dojo.forEach(items,function(item,i){ dojo.forEach(grid1.layout.cells,function(cell){ result.push(cell.format(i,item)); }); res += result.join(',') + "/n"; });
if(dojo.trim(res)=="") { alert("请先选择菜单!"); return false; } else { dojo.xhrPost({ url:"saveOrder.do", content:{ "orderDate":selDate.value, "cName":cusSel.value, "type":result[0], "orderName":result[1], "price":result[2] }, load:function(response) { if(response == 2) { alert("更新失败!您今天已订过菜,同一天您只能订菜一次!"); return false; } else if(response==1||response == 3) { dojo.xhrGet({ url:"loadOrderAction.do",preventCache:true,load:function(reLoad) { var da = eval("("+reLoad+")"); var store = new dojo.data.ItemFileWriteStore({data:da}); showOrder.setStore(store); },error:function(error) { alert(error); } }); if(response ==1) alert("订单成功"); else alert("更新成功"); } else alert("订单失败"); },error:function(error) { alert(error.message); } }); } } } function searchOrder() { if(dojo.trim(searchDate.value)=="") { alert("请选择日期"); return false; } else { var value = searchDate.value; showOrder.filter({ orderDate: value },true); } }</script></body></html> (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|