small.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <extend name="$_admin_public_layout"/>
  2. <block name="main">
  3. <?php if (C('ADMIN_TABS')): ?>
  4. <!-- 多标签后台 -->
  5. <nav class="navbar navbar-default ct-tab-nav" role="navigation">
  6. <div class="collapse navbar-collapse">
  7. <ul class="nav navbar-nav navbar-left">
  8. <li><a href="#" id="tab-left"><i class="fa fa-caret-left"></i></a></li>
  9. </ul>
  10. <div class="ct-tab-wrap clearfix">
  11. <ul class="nav navbar-nav nav-close ct-tab">
  12. <li href="#home" role="tab" data-toggle="tab">
  13. <a href="#"><i class="fa fa-dashboard"></i> <span>首页</span></a>
  14. </li>
  15. </ul>
  16. </div>
  17. <ul class="nav navbar-nav navbar-right">
  18. <li><a href="#" id="tab-right"><i class="fa fa-caret-right"></i></a></li>
  19. <li class="dropdown">
  20. <a href="#" class="dropdown-toggle" data-toggle="dropdown">关闭操作 <b class="caret"></b></a>
  21. <ul class="dropdown-menu">
  22. <li><a href="#" class="close-all">关闭所有</a></li>
  23. </ul>
  24. </li>
  25. </ul>
  26. </div>
  27. </nav>
  28. <?php else: ?>
  29. <!-- 面包屑导航 -->
  30. <ul class="breadcrumb">
  31. <li><i class="fa fa-map-marker"></i></li>
  32. <li class="text-muted">大件</li>
  33. </ul>
  34. <?php endif; ?>
  35. <!-- 多标签后台内容部分 -->
  36. <div data-options="region:'north',title:'批次信息',split:true" style="height: 300px;">
  37. <div id="supBthGridToolbar">
  38. <form id="searchBthForm" class="smShow">
  39. <table width=1000px style="white-space: nowrap;border-collapse:separate; border-spacing:0px 5px;">
  40. <tr>
  41. <td align="right">
  42. 标签代码:
  43. </td>
  44. <td colspan="3">
  45. <input name="sqrcd" class="easyui-textbox" style="width:403px" type="text"/>
  46. </td>
  47. <td align="right">
  48. 标签标识:
  49. </td>
  50. <td>
  51. <input name="scd" class="easyui-validatebox" style="width:150px;" type="text" data-options="validType:'reqLength[8]'"/>
  52. </td>
  53. <td align="right">
  54. 标签类型:
  55. </td>
  56. <td>
  57. <select id="tgTp" name="tgTp" style="width:150px;"></select>
  58. </td>
  59. <tr/>
  60. <tr>
  61. <td align="right">
  62. 一级产品分类:
  63. </td>
  64. <td width="150px" id="aadd">
  65. <select id="sysUserCdOne" name="sysUserCdOne" style="width:150px;"></select>&emsp;
  66. </td>
  67. <td align="right">
  68. 二级产品分类:
  69. </td>
  70. <td width="150px">
  71. <select id="sysUserCdTwo" name="sysUserCdTwo" style="width:150px;"></select>&emsp;
  72. </td>
  73. <td align="right">
  74. 产品名称:
  75. </td>
  76. <td>
  77. <input name="sysCdNm" class="easyui-textbox" style="width:150px;" type="text"/>
  78. </td>
  79. <td align="right">
  80. 生产批次:
  81. </td>
  82. <td>
  83. <input name="prodBth" class="easyui-textbox" style="width:150px" type="text"/>
  84. </td>
  85. <tr/>
  86. <tr>
  87. <td align="right">
  88. 打印开始时间:
  89. </td>
  90. <td>
  91. <input id ="startDate" name="startDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  92. </td>
  93. <td align="right">
  94. 打印结束时间:
  95. </td>
  96. <td>
  97. <input id ="endDate" name="endDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  98. </td>
  99. <td align="right">
  100. 包装/生产日期:
  101. </td>
  102. <td width="150px">
  103. <input id="prodDt" name="prodDt" class="easyui-datebox" style="width:150px;" type="text" data-options="editable:false"/>
  104. </td>
  105. <td colspan="2" align="center">
  106. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  107. </td>
  108. <tr/>
  109. </table>
  110. </form>
  111. <div style="margin:10px;">
  112. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-QRCode',plain:true" onclick="rePrintFun(2)">批次补打</a>
  113. <!-- <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-delete',plain:true" onclick="delTgFun()">删除标签</a> -->
  114. </div>
  115. </div>
  116. <table id="supBthGrid"></table>
  117. </div>
  118. <div data-options="region:'center',title:'标签信息',split:true" >
  119. <div id="supTgGridToolbar">
  120. <form id="searchTgForm">
  121. <input name="tgTp" type="text" style="display: none;"/><!-- 标签类型 -->
  122. <input name="product_id" type="text" style="display:none;">
  123. <input name="lgBthId" type="text" style="display: none;"/><!-- 大批次ID -->
  124. <input name="smBthId" type="text" style="display: none;"/><!-- 小批次ID -->
  125. <input name="sqrcd" type="text" style="display: none;"/>
  126. <input name="scd" type="text" style="display: none;"/>
  127. </form>
  128. <div style="margin:10px;">
  129. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true" onclick="rePrintFun(1)">标签补打</a>
  130. </div>
  131. </div>
  132. <table id=supTgGrid></table>
  133. </div>
  134. <div id="reptWin">
  135. <form id="reptForm" style="padding: 10px;">
  136. <input id="printType" name="printType" style="display: none;"/>
  137. 重复打印数量:<input id="reptQty" name="reptQty" data-options="required:true,validType:['int','minValue[1]','maxValue[10]']" class="easyui-validatebox"/>
  138. </form>
  139. </div>
  140. <script src="__PUBLIC__/libs/guide/bootstrap-tour.js"></script>
  141. <script src="__PUBLIC__/libs/My97DatePicker/WdatePicker.js"></script>
  142. <script src="__PUBLIC__/libs/guide/guide_index.js?_t=2016121401"></script>
  143. <script>
  144. var supBthGrid,supTgGrid,printType;
  145. //定义serializeObject方法,序列化表单
  146. $.fn.serializeObject = function() {
  147. var o = {};
  148. var a = this.serializeArray();
  149. $.each(a, function() {
  150. if (o[this.name]) {
  151. if (!o[this.name].push) {
  152. o[this.name] = [ o[this.name] ];
  153. }
  154. o[this.name].push(this.value || '');
  155. } else {
  156. o[this.name] = this.value || '';
  157. }
  158. });
  159. return o;
  160. };
  161. Date.prototype.Format = function (fmt) { //author: meizz
  162. var o = {
  163. "M+": this.getMonth() + 1, //月份
  164. "d+": this.getDate(), //日
  165. "h+": this.getHours(), //小时
  166. "m+": this.getMinutes(), //分
  167. "s+": this.getSeconds(), //秒
  168. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  169. "S": this.getMilliseconds() //毫秒
  170. };
  171. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  172. for (var k in o)
  173. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  174. return fmt;
  175. }
  176. function splitEmVal(str){
  177. console.log(str);
  178. var n1 = str.indexOf("[");
  179. if( n1 >= 0 ){
  180. var n2 = str.indexOf("]");
  181. if( n2 > 1 ){
  182. return str.substr(n1+1,n2-1);
  183. }
  184. }
  185. return "";
  186. };
  187. $(document).ready(function(){
  188. supBthGrid=$('#supBthGrid').datagrid({
  189. url:'/index.php?s=/Admin/Qcode/ProductApi',
  190. method:'get',
  191. toolbar:'#supBthGridToolbar',
  192. rownumbers : true, // 如果为true,则显示一个行号列。
  193. singleSelect : true, // 如果为true,则只允许选择一行。
  194. nowrap : false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  195. fit : true, // datagrid自适应宽高
  196. fitColumns : true, // 使列自动展开/收缩到合适的数据表格宽度。
  197. autoRowHeight : false, // 定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  198. pagination : true, // 显示分页工具条
  199. sortName:'crtDt', // 排序字段
  200. sortOrder:'desc', // 排序方式
  201. pageSize:20,//初始化页面大小
  202. pageList:[20,30,50,100,500],// 初始化页面大小选择列表
  203. queryParams:$('#searchBthForm').serializeObject(),
  204. striped:true,
  205. columns:[[
  206. {field:'id',title:'产品id',sortable:true,width:300,hidden:true},
  207. {field:'product_name',title:'产品名称',sortable:true,width:300},
  208. {field:'labelcode',title:'标签类型',align:'center',sortable:false,width:100},
  209. {field:'product_batch',title:'生产批次',sortable:true,width:100},
  210. {field:'pack_time',title:'包装日期/生产日期',align:'center',sortable:true,width:150},
  211. {field:'product_num',title:'打印个数',align:'center',sortable:true,width:100},
  212. {field:'print_time',title:'打印日期',align:'center',sortable:true,width:150}
  213. ]],
  214. onClickRow:function(rowIndex, rowData){
  215. if($('#searchBthForm').form('validate')){
  216. var bthForm=$('#searchBthForm').serializeObject();
  217. var formData=new Object();
  218. formData.product_id = rowData.id;
  219. formData.labelcode=splitEmVal(rowData.labelcode);
  220. formData.lgBthId=rowData.lgBthId;
  221. formData.smBthId=rowData.smBthId;
  222. formData.sqrcd=bthForm.sqrcd;
  223. formData.scd=bthForm.scd;
  224. $('#searchTgForm').form('load',formData);
  225. supTgGrid.datagrid('load',$('#searchTgForm').serializeObject());
  226. }
  227. },
  228. onLoadError:function(){
  229. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');
  230. },
  231. onBeforeLoad:function(param){
  232. if(supBthGrid!=null){
  233. supBthGrid.datagrid('loadData',{total:0,rows:[]});
  234. }
  235. if(supTgGrid!=null){
  236. supTgGrid.datagrid('loadData',{total:0,rows:[]});
  237. }
  238. return true;
  239. }
  240. });
  241. supTgGrid=$('#supTgGrid').datagrid({
  242. url:'index.php?s=/Admin/Qcode/PrintListApi',
  243. method:'get',
  244. toolbar:'#supTgGridToolbar',
  245. rownumbers : true, // 如果为true,则显示一个行号列。
  246. //singleSelect : false, // 如果为true,则只允许选择一行。
  247. nowrap : false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  248. fit : true, // datagrid自适应宽高
  249. fitColumns : true, // 使列自动展开/收缩到合适的数据表格宽度。
  250. autoRowHeight : false, //定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  251. pagination : true, // 显示分页工具条
  252. sortName:'sqrcd', // 排序字段
  253. sortOrder:'asc', // 排序方式
  254. pageSize:20,//初始化页面大小
  255. pageList:[20,30,50,100,500],// 初始化页面大小选择列表
  256. columns:[[
  257. {field:'ck',checkbox:true},
  258. {field:'labelcode',title:'标签代码',align:'center',sortable:true,width:250},
  259. {field:'print_time',title:'打印时间',align:'center',sortable:true,width:100},
  260. {field:'bd_num',title:'补打次数',align:'right',sortable:true,width:50},
  261. {field:'last_time',title:'最近补打时间',align:'center',sortable:true,width:100}
  262. ]],
  263. onLoadError:function(){
  264. $.messager.alert('系统提示','数据加载错误,请刷新重试!','error');
  265. },
  266. onBeforeLoad:function(param){
  267. var selecteRow=$('#supBthGrid').datagrid('getSelected');
  268. $('#supTgGrid').datagrid('clearChecked');
  269. if(selecteRow==null){
  270. return false;
  271. }
  272. return true;
  273. }
  274. });
  275. //初始化日期输入框
  276. initDateBox();
  277. $('#reptWin').dialog({
  278. title: '确认对话框',
  279. width: 300,
  280. height: 130,
  281. closed: true,
  282. cache: false,
  283. modal: true,
  284. buttons:[{
  285. text:'打印',
  286. handler:function(){
  287. startPrint();
  288. $('#reptWin').window('close');
  289. }
  290. },{
  291. text:'取消',
  292. handler:function(){
  293. $('#reptWin').window('close');
  294. }
  295. }]
  296. });
  297. });
  298. //初始化日期输入框
  299. function initDateBox(){
  300. var nowDate=new Date;
  301. $('#endDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  302. nowDate.setMonth(nowDate.getMonth()-1);
  303. $('#startDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  304. }
  305. function searchBthFun(){
  306. if($('#searchBthForm').form('validate')){
  307. supBthGrid.datagrid('load',$('#searchBthForm').serializeObject());
  308. }
  309. }
  310. </script>
  311. </block>