code.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  5. %>
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  10. <!-- 避免IE使用兼容模式 -->
  11. <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
  12. <meta name="renderer" content="webkit">
  13. <!-- 导入公共样式 -->
  14. <%@ include file="ap.jsp" %>
  15. <title>工序列表</title>
  16. </head>
  17. <body id="body">
  18. <div data-toggle="topjui-layout" data-options="fit:true">
  19. <div data-options="region:'center',iconCls:'icon-reload',title:'',split:true,border:false,bodyCls:'border_left_right'">
  20. <!-- datagrid表格 -->
  21. <table data-toggle="topjui-datagrid"
  22. data-options="id:'userDg',
  23. ">
  24. </table>
  25. </div>
  26. </div>
  27. <!-- 表格工具栏开始 -->
  28. <div id="userDg-toolbar" class="topjui-toolbar"
  29. data-options="grid:{
  30. type:'datagrid',
  31. id:'userDg'
  32. }">
  33. <form action="codemakecode.action" method="post">
  34. <input style="width:250px;height:30px" id="linkDataProperty" name="customer" value="${model.user_id}" autocomplete="off" type="text" placeholder="请输入客户名称查找要生成的订单"/> <!-- onkeyup="getLinkData();" -->
  35. <div id="popup" style="position: absolute; z-index:9999;">
  36. <table width="100%" bgcolor="#fffafa">
  37. <tbody id="popupBody"></tbody>
  38. </table>
  39. </div>
  40. <input type="hidden" id="plan_num" name="plan_num">
  41. <a id="add" href="javascript:void(0)">添加信息</a>
  42. <input style="width:175px;height:30px" id="sub" name="sub" value="生成二维码" type="submit" />
  43. </form>
  44. </div>
  45. <!-- 表格工具栏结束 -->
  46. <script type="text/javascript">
  47. var skt;
  48. $(function(){
  49. var loseInputMillsecs = 700;
  50. var clocker = null;
  51. $("#add").iMenubutton({
  52. method: 'openDialog',
  53. extend: '#productDg-toolbar',
  54. iconCls: 'fa fa-plus',
  55. dialog: {
  56. id: 'userAddDialog',
  57. height: 250,
  58. width:550,
  59. href: 'add_info.jsp',
  60. buttonsGroup: [
  61. {
  62. text: '保存',
  63. url: 'codetoSubcontract.action',
  64. iconCls: 'fa fa-plus',
  65. handler: 'ajaxForm',
  66. btnCls: 'topjui-btn-normal'
  67. }
  68. ]
  69. }
  70. });
  71. $("#userDg").iDatagrid({
  72. id: 'userDg',
  73. url: 'codefindById.action?place_num='+skt,
  74. columns: [[
  75. {field: 'id', title: 'UID', checkbox: true},
  76. {field: 'P_color', title: '颜色', sortable: true},
  77. {field: 'P_size', title: '尺码', sortable: true},
  78. {field: 'packe_num', title: '包数', sortable: true},
  79. {field: 'P_number', title: '件数', sortable: true},
  80. {field: 'Cylinder', title: '缸号', sortable: true}
  81. ]]
  82. });
  83. //输入键盘后隔段时间的方法
  84. function loadData()
  85. {
  86. /* console.info("do load data list"); */
  87. //联想文本框
  88. var popupDiv = document.getElementById("popup");//获得对应的div对象
  89. var popupBody = document.getElementById("popupBody");//获得对应的tbody对象
  90. var linkDataProperty = document.getElementById("linkDataProperty"); //获得对应的输入框对象
  91. var myString = linkDataProperty.value.trim();
  92. var judge = myString.indexOf("客户名:");
  93. if(judge > -1){
  94. var newString = myString.substring(judge+4);
  95. linkDataProperty = newString;
  96. }else{
  97. linkDataProperty = linkDataProperty.value.trim();
  98. }
  99. if(linkDataProperty != null && linkDataProperty != ""){
  100. clearModels();//清除联想输入提示框的内容
  101. //利用ajax获取后台的模糊查询的数据,并且封装成下拉列表的形式展现出来
  102. $.ajax({
  103. type : "post",//提交的方法为post
  104. url : '${pageContext.request.contextPath}/placefindByCustomer.action',//对应的Action提交的路径
  105. data:{st:linkDataProperty},//从前台传递到后台的查询语句的参数
  106. dataType: 'json',
  107. error:function(){
  108. /* alert("没有对应的数据,请查看输入的查询条件!"); */
  109. },
  110. success : function(data) {//当Ajax提交成功时调用的方法
  111. if(data.placeList.length==0 ){return;}
  112. setOffsets();//设置联想输入下拉列表提示框的位置
  113. var tr,td,text;
  114. for (var i = 0; i < data.placeList.length; i++) {//根据返回的值,手动的拼tbody的内容
  115. text = document.createTextNode("订单号:"+data.placeList[i].plan_num+" 客户名:"+data.placeList[i].customer);//从Action中返回的数据中取出linkDataProperty的值
  116. td = document.createElement("td");//创建一个td的对象
  117. tr = document.createElement("tr");//创建一个tr的对象
  118. inp= document.createElement("a");//创建一个a链接对象
  119. /* tex=document.createTextNode(data.placeList[i].id); */
  120. /* inp.appendChild(tex); */
  121. inp.appendChild(text);
  122. td.mouseOver = function(){this.className="mouseOver;";};
  123. td.mouseOut = function(){this.className="mouseOut;";};
  124. td.onclick = function(){populateModel(this);};//单击td是的方法为populateModel
  125. td.appendChild(inp);
  126. /* td.appendChild(text); */
  127. tr.appendChild(td);
  128. popupBody.appendChild(tr);
  129. }
  130. }
  131. });
  132. }else{
  133. clearModels();//清除自动完成行
  134. }
  135. //点击下拉列表中的某个选项时调用的方法
  136. function populateModel(cell) {
  137. clearSelect();
  138. $("#linkDataProperty").val(cell.firstChild.firstChild.nodeValue);
  139. //initOtherData(linkDataProperty.value);利用输入框中的数据调用其他方法,初始化其他数据
  140. clearModels();//清除自动完成行
  141. var kt = cell.firstChild.firstChild.nodeValue;
  142. var rng = kt.indexOf("客户名:");
  143. skt = kt.substring(4,rng);
  144. $("#plan_num").val(skt);//页面保存订单号
  145. }
  146. //清除自动完成行,只要tbody有子节点就删除掉,并且将将外围的div的边框属性设置为不可见的
  147. function clearModels() {
  148. while (popupBody.childNodes.length > 0) {
  149. popupBody.removeChild(popupBody.firstChild);
  150. }
  151. popupDiv.style.border = "none";
  152. }
  153. //设置下拉列表的位置和样式
  154. function setOffsets() {
  155. var width = linkDataProperty.offsetWidth;//获取linkDataProperty输入框的相对宽度
  156. var left = getLeft(linkDataProperty);
  157. var top = getTop(linkDataProperty) + linkDataProperty.offsetHeight;
  158. popupDiv.style.border = "black 0px solid";
  159. popupDiv.style.left = left + "px";
  160. popupDiv.style.top = top + "px";
  161. popupDiv.style.width = width + "px";
  162. }
  163. //获取指定元素在页面中的宽度起始位置
  164. function getLeft(e) {
  165. var offset = e.offsetLeft;
  166. if (e.offsetParent != null) {
  167. offset += getLeft(e.offsetParent);
  168. }
  169. return offset;
  170. }
  171. //获取指定元素在页面中的高度起始位置
  172. function getTop(e) {
  173. var offset = e.offsetTop;
  174. if (e.offsetParent != null) {
  175. offset += getTop(e.offsetParent);
  176. }
  177. return offset;
  178. }
  179. clocker = null;
  180. }
  181. function innerKeydown()
  182. {
  183. if(null == clocker)
  184. {
  185. clocker = setTimeout(loadData,loseInputMillsecs);
  186. }
  187. else //连续击键,重新开始计时
  188. {
  189. clearTimeout(clocker);
  190. clocker = setTimeout(loadData,loseInputMillsecs);
  191. }
  192. }
  193. $('#linkDataProperty').keydown(function(){
  194. innerKeydown();
  195. });
  196. // alert("4164553453534");
  197. //测试
  198. $("#treetab th").tabs({
  199. onClick:function(node){
  200. alert(node.text);
  201. }
  202. });
  203. $('#queryBtn').iMenubutton({
  204. method: 'query',
  205. iconCls: 'fa fa-search',
  206. btnCls: 'topjui-btn-danger',
  207. form: {id: 'queryForm'},
  208. grid: {type: 'datagrid', 'id': 'productDg'}
  209. });
  210. // var body = $("#body").html();
  211. // console.info(body);
  212. });
  213. function addCartonType(){ //打开对话框,添加箱型
  214. var linkDataProperty = $("#plan_num").val();
  215. if(linkDataProperty != null && linkDataProperty != ""){
  216. }else{
  217. alert("您还未输入客户名选中订单!");
  218. }
  219. }
  220. function quxiao(){ //关闭对话框
  221. layer.close(layer.index);
  222. }
  223. //联想文本框
  224. function getLinkData() {
  225. var popupDiv = document.getElementById("popup");//获得对应的div对象
  226. var popupBody = document.getElementById("popupBody");//获得对应的tbody对象
  227. var linkDataProperty = document.getElementById("linkDataProperty"); //获得对应的输入框对象
  228. linkDataProperty = linkDataProperty.value.trim();
  229. clearModels();//清除联想输入提示框的内容
  230. //利用ajax获取后台的模糊查询的数据,并且封装成下拉列表的形式展现出来
  231. $.ajax({
  232. type : "post",//提交的方法为post
  233. url : '${pageContext.request.contextPath}/placefindByCustomer.action',//对应的Action提交的路径
  234. data:{st:linkDataProperty},//从前台传递到后台的查询语句的参数
  235. dataType: 'json',
  236. error:function(){
  237. alert("没有对应的数据,请查看输入的查询条件!");
  238. },
  239. success : function(data) {//当Ajax提交成功时调用的方法
  240. if(data.userlist.length==0){return;}
  241. setOffsets();//设置联想输入下拉列表提示框的位置
  242. var tr,td,text;
  243. for (var i = 0; i < data.userlist.length; i++) {//根据返回的值,手动的拼tbody的内容
  244. text = document.createTextNode("用户名:"+data.userlist[i].user_name);//从Action中返回的数据中取出linkDataProperty的值
  245. td = document.createElement("td");//创建一个td的对象
  246. tr = document.createElement("tr");//创建一个tr的对象
  247. inp= document.createElement("a");//创建一个a链接对象
  248. tex=document.createTextNode(data.userlist[i].user_id);
  249. inp.appendChild(tex);
  250. td.mouseOver = function(){this.className="mouseOver;";};
  251. td.mouseOut = function(){this.className="mouseOut;";};
  252. td.onclick = function(){populateModel(this);};//单击td是的方法为populateModel
  253. td.appendChild(inp);
  254. td.appendChild(text);
  255. tr.appendChild(td);
  256. popupBody.appendChild(tr);
  257. }
  258. }
  259. });
  260. //点击下拉列表中的某个选项时调用的方法
  261. function populateModel(cell) {
  262. clearSelect();
  263. $("#linkDataProperty").val(cell.firstChild.firstChild.nodeValue);
  264. //initOtherData(linkDataProperty.value);利用输入框中的数据调用其他方法,初始化其他数据
  265. clearModels();//清除自动完成行
  266. }
  267. //清除自动完成行,只要tbody有子节点就删除掉,并且将将外围的div的边框属性设置为不可见的
  268. function clearModels() {
  269. while (popupBody.childNodes.length > 0) {
  270. popupBody.removeChild(popupBody.firstChild);
  271. }
  272. popupDiv.style.border = "none";
  273. }
  274. //设置下拉列表的位置和样式
  275. function setOffsets() {
  276. var width = linkDataProperty.offsetWidth;//获取linkDataProperty输入框的相对宽度
  277. var left = getLeft(linkDataProperty);
  278. var top = getTop(linkDataProperty) + linkDataProperty.offsetHeight;
  279. popupDiv.style.border = "black 0px solid";
  280. popupDiv.style.left = left + "px";
  281. popupDiv.style.top = top + "px";
  282. popupDiv.style.width = width + "px";
  283. }
  284. //获取指定元素在页面中的宽度起始位置
  285. function getLeft(e) {
  286. var offset = e.offsetLeft;
  287. if (e.offsetParent != null) {
  288. offset += getLeft(e.offsetParent);
  289. }
  290. return offset;
  291. }
  292. //获取指定元素在页面中的高度起始位置
  293. function getTop(e) {
  294. var offset = e.offsetTop;
  295. if (e.offsetParent != null) {
  296. offset += getTop(e.offsetParent);
  297. }
  298. return offset;
  299. }
  300. }
  301. //清空输入框中的数据
  302. function clearSelect() {
  303. var linkDataProperty=document.getElementById(linkDataProperty);
  304. // linkDataProperty.value="";
  305. }
  306. /* $.ajax({
  307. url:remoteHost+'/system/organization/getListByCodeSetIdAndLevelId?codeSetId=A&levelId=1',
  308. data:null,
  309. type:"post",
  310. dataType:"json",
  311. success:function(data){
  312. console.info(JSON.stringify(data));
  313. }
  314. });
  315. $.ajax({
  316. url:remoteHost+'/system/organization/getListByPid?pid=3',
  317. data:null,
  318. type:"post",
  319. dataType:"json",
  320. success:function(data){
  321. console.info(JSON.stringify(data));
  322. }
  323. }); */
  324. </script>
  325. </body>
  326. </html>