UID020050.xrw 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  3. <xhtml:head>
  4. <xhtml:title>我的测试</xhtml:title>
  5. <model id="model1">
  6. <instance id="instance1">
  7. <root xmlns="">
  8. <formData>
  9. <id/>
  10. <name/>
  11. <birthday/>
  12. <address/>
  13. <phone/>
  14. <email/>
  15. </formData>
  16. <resData/>
  17. <reqData/>
  18. <gridData>
  19. </gridData>
  20. </root>
  21. </instance>
  22. </model>
  23. <script type="javascript" src="../../js/boaMsg.js"/>
  24. <script type="javascript" src="../../js/boaCommon.js"/>
  25. <script type="javascript" src="../../js/dCommon.js"/>
  26. <script type="javascript">
  27. <![CDATA[
  28. function click()
  29. {
  30. var str=model.getValue("/root/formData/id");
  31. if(str=="")
  32. find();
  33. else
  34. find1();
  35. }
  36. function find()
  37. {
  38. model.reset();
  39. //alert("Hello");
  40. datagrid1.nodeset="/root/gridData/ResultList1_Row";
  41. commSubmit("UID020050-service","find","glueAction.do");
  42. model.copyNode("/root/gridData","/root/resData/ResultList1_VO");
  43. model.refresh();
  44. }
  45. function find1()
  46. {
  47. //alert("World");
  48. model.removenode("/root/reqData");
  49. datagrid1.nodeset="/root/gridData/ResultList2_Row";
  50. model.makeValue("/root/reqData/id",model.getValue("/root/formData/id"));
  51. commSubmit("UID020050-service","find1","glueAction.do");
  52. model.copyNode("/root/gridData","/root/resData/ResultList2_VO");
  53. model.refresh();
  54. }
  55. function insert()
  56. {
  57. var id=model.getValue("/root/formData/id");
  58. var name=model.getValue("/root/formData/name");
  59. var birthday=model.getValue("/root/formData/birthday");
  60. var address=model.getValue("/root/formData/address");
  61. var phone=model.getValue("/root/formData/phone");
  62. var email=model.getValue("/root/formData/email");
  63. if(id==""||name==""||birthday==""||address=="",phone=="",email=="")
  64. alert("请输入数据");
  65. model.removenode("/root/reqData");
  66. model.makeValue("/root/reqData/id",id);
  67. model.makeValue("/root/reqData/name", name);
  68. model.makeValue("/root/reqData/birthday", birthday);
  69. model.makeValue("/root/reqData/address", address);
  70. model.makeValue("/root/reqData/phone",phone);
  71. model.makeValue("/root/reqData/email",email);
  72. commSubmit("UID020050-service","insert","glueAction.do");
  73. alert("数据插入成功");
  74. model.reset();
  75. find();
  76. model.refresh();
  77. }
  78. function update()
  79. {
  80. var id=model.getValue("/root/formData/id");
  81. var name=model.getValue("/root/formData/name");
  82. var birthday=model.getValue("/root/formData/birthday");
  83. var address=model.getValue("/root/formData/address");
  84. var phone=model.getValue("/root/formData/phone");
  85. var email=model.getValue("/root/formData/email");
  86. if(id==""||name==""||birthday==""||address=="",phone=="",email=="")
  87. alert("请输入数据");
  88. model.removenode("/root/reqData");
  89. model.makeValue("/root/reqData/id", id);
  90. model.makeValue("/root/reqData/name", name);
  91. model.makeValue("/root/reqData/birthday", birthday);
  92. model.makeValue("/root/reqData/address", address);
  93. model.makeValue("/root/reqData/phone",phone);
  94. model.makeValue("/root/reqData/email",email);
  95. commSubmit("UID020050-service","update","glueAction.do");
  96. alert("数据更新成功");
  97. model.reset();
  98. find();
  99. model.refresh();
  100. }
  101. function deleteData()
  102. {
  103. var id=input1.value;
  104. //alert(id);
  105. if(id=="")
  106. {
  107. window.alert("请输入你要删除的数据ID或者选择一条你要删除的数据","提示");
  108. return;
  109. }
  110. model.removenode("/root/reqData");
  111. model.makeValue("/root/reqData/id", id);
  112. commSubmit("UID020050-service","deleteData","glueAction.do");
  113. alert("数据删除成功");
  114. model.reset();
  115. find();
  116. model.refresh();
  117. }
  118. ]]>
  119. </script>
  120. </xhtml:head>
  121. <xhtml:body guideline="1366;1400;">
  122. <input id="input1" ref="/root/formData/id" style="left:55px; top:30px; width:165px; height:30px; "/>
  123. <caption id="ID" style="left:15px; top:30px; width:35px; height:30px; vertical-align:middle; ">I D</caption>
  124. <caption id="caption1" style="left:240px; top:30px; width:40px; height:30px; vertical-align:middle; ">姓名</caption>
  125. <input id="input2" ref="/root/formData/name" style="left:290px; top:30px; width:170px; height:30px; "/>
  126. <caption id="caption2" style="left:470px; top:30px; width:50px; height:30px; vertical-align:middle; ">生日</caption>
  127. <input id="input3" ref="/root/formData/birthday" inputtype="date" style="left:500px; top:30px; width:170px; height:30px; "/>
  128. <caption id="caption3" style="left:240px; top:85px; width:40px; height:30px; vertical-align:middle; ">电话</caption>
  129. <caption id="caption4" style="left:470px; top:85px; width:50px; height:30px; vertical-align:middle; ">邮箱</caption>
  130. <input id="input4" ref="/root/formData/address" style="left:55px; top:85px; width:165px; height:30px; "/>
  131. <input id="input5" ref="/root/formData/phone" style="left:290px; top:85px; width:170px; height:30px; "/>
  132. <caption id="caption5" style="left:10px; top:85px; width:40px; height:30px; vertical-align:middle; ">地址</caption>
  133. <input id="input6" ref="/root/formData/email" style="left:500px; top:85px; width:170px; height:30px; "/>
  134. <button id="button1" style="left:700px; top:30px; width:50px; height:30px; ">
  135. <caption>查询</caption>
  136. <script type="javascript" ev:event="onclick">
  137. <![CDATA[
  138. click();
  139. ]]>
  140. </script>
  141. </button>
  142. <button id="button2" style="left:775px; top:30px; width:50px; height:30px; ">
  143. <caption>添加</caption>
  144. <script type="javascript" ev:event="onclick">
  145. <![CDATA[
  146. insert();
  147. ]]>
  148. </script>
  149. </button>
  150. <button id="button3" style="left:700px; top:85px; width:50px; height:30px; ">
  151. <caption>修改</caption>
  152. <script type="javascript" ev:event="onclick">
  153. <![CDATA[
  154. update();
  155. ]]>
  156. </script>
  157. </button>
  158. <button id="button4" style="left:775px; top:85px; width:50px; height:30px; ">
  159. <caption>删除</caption>
  160. <script type="javascript" ev:event="onclick">
  161. <![CDATA[
  162. deleteData();
  163. ]]>
  164. </script>
  165. </button>
  166. <datagrid id="datagrid1" nodeset="/root/gridData" caption="ID^姓名^生日^地址^电话^邮箱" colsep="^" colwidth="100, 100, 100, 124, 100, 180" mergecellsfixedrows="bycolrec" rowsep="|" style="left:55px; top:140px; width:725px; height:240px; ">
  167. <col ref="ID" type="input"/>
  168. <col ref="NAME" type="input"/>
  169. <col ref="BIRTHDAY" type="inputdate"/>
  170. <col ref="ADDRESS" type="input"/>
  171. <col ref="PHONE" type="input"/>
  172. <col ref="EMAIL" type="input"/>
  173. <script type="javascript" ev:event="onclick">
  174. <![CDATA[
  175. var i=datagrid1.row;
  176. //alert(i);
  177. if(i==0)
  178. return;
  179. input1.value=datagrid1.valueMatrix(i,0);
  180. input2.value=datagrid1.valueMatrix(i,1);
  181. var birthday=datagrid1.valueMatrix(i,2);
  182. //alert(birthday);
  183. birthday=birthday.substr(0,10);
  184. var year=birthday.substr(0,4);
  185. var month=birthday.substr(5,2);
  186. var day=birthday.substr(8,2);
  187. birthday=year+month+day;
  188. //alert(birthday);
  189. input3.value=birthday;
  190. input4.value=datagrid1.valueMatrix(i,3);
  191. input5.value=datagrid1.valueMatrix(i,4);
  192. input6.value=datagrid1.valueMatrix(i,5);
  193. ]]>
  194. </script>
  195. </datagrid>
  196. </xhtml:body>
  197. </xhtml:html>