excel.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="ctx" content="" />
  6. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="/static/easyui/themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="/static/styles/demo.css">
  9. <link rel="stylesheet" type="text/css" href="/static/uploadify/uploadify.css">
  10. <link rel="stylesheet" type="text/css" href="/Public/libs/css/export.css">
  11. <script type="text/javascript" src="/static/basejs/jquery-1.8.0.min.js"></script>
  12. <script type="text/javascript" src="/static/easyui/jquery.easyui.min.js"></script>
  13. <script type="text/javascript" src="/static/easyui/easyui-lang-zh_CN.js"></script>
  14. <script type="text/javascript" src="/static/uploadify/jquery.uploadify.js"></script>
  15. <script type="text/javascript" src="/static/basejs/th.js"></script>
  16. <script type="text/javascript" src="/static/easyui/src/jquery.window.js"></script>
  17. <script type="text/javascript" src="/static/easyui/formatter.js"></script>
  18. <script type="text/javascript" src="/static/easyui/easyui-extend.js"></script>
  19. <script type="text/javascript" src="/static/easyui/easyui-validatebox-extend.js"></script>
  20. <script type="text/javascript" src="/static/easyui/easyui-loading.js"></script>
  21. <script type="text/javascript" src="/static/basejs/jquery.qrcode.min.js"></script>
  22. <script type="text/javascript" src="/static/basejs/LodopFuncs.js"></script>
  23. <script type="text/javascript" src="/static/basejs/newqcode.js"></script>
  24. <script type="text/javascript" src="/static/basejs/template.js"></script>
  25. </head>
  26. <body class="easyui-layout">
  27. <div data-options="region:'north',title:'',split:true" style="height: 540px;border:none">
  28. <div id="excelListToolbar">
  29. <form id="searchBthForm" class="smShow">
  30. <table style="width:100%;white-space: nowrap;padding:10px;">
  31. <tr>
  32. <td align="left">
  33. 辅料名称:
  34. </td>
  35. <td>
  36. <select name="sysCdNm" style="height:30px;" >
  37. <option value="0">全部</option>
  38. <volist name="productlist" id="val">
  39. <option value="{$val.product_name}">{$val.product_name}</option>
  40. </volist>
  41. </select>
  42. </td>
  43. <td align="left">
  44. 公司名称:
  45. </td>
  46. <td>
  47. <select name="user_name" style="height:30px;">
  48. <volist name="userlist" id="val">
  49. <option value="{$val.nickname}">{$val.nickname}</option>
  50. </volist>
  51. </select>
  52. </td>
  53. <td align="left">
  54. 批次发货状态:
  55. </td>
  56. <td align="left">
  57. <select name="status" style="height:30px;width:150px">
  58. <option value="0">待发货</option>
  59. <option value="1">已删除</option>
  60. </select>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td align="left">
  65. 导出开始时间:
  66. </td>
  67. <td>
  68. <input id ="startDate" name="startDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  69. </td>
  70. <td align="left">
  71. 导出结束时间:
  72. </td>
  73. <td>
  74. <input id ="endDate" name="endDate" class="easyui-datebox" style="width:150px" type="text" value="" data-options="editable:false"/>
  75. </td>
  76. <td colspan="2" align="left">
  77. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchBthFun()">查询</a>
  78. </td>
  79. <tr/>
  80. <tr>
  81. <td colspan="10" class="export-tips"></td>
  82. </tr>
  83. <tr>
  84. <td align="left">
  85. 请输入订单号:
  86. </td>
  87. <td>
  88. <!--<input id="order_num" name="order_num" class="easyui-numberbox" style="width:150px" type="text" value="" data-options="min:0"/>-->
  89. <input id="order_num" name="order_num" style="width:150px" type="text" value=""/>
  90. </td>
  91. <td align="left">
  92. 请输入司机:
  93. </td>
  94. <td>
  95. <input name="deliveryman" class="" style="width:150px" type="text" value="" />
  96. </td>
  97. <td align="left">
  98. 请输入司机电话:
  99. </td>
  100. <td>
  101. <input name="shr_phone" class="" style="width:150px" type="text" value=""/>
  102. </td>
  103. </tr>
  104. <tr>
  105. <td align="left">
  106. 请输入车牌号:
  107. </td>
  108. <td>
  109. <input name="plate_number" class="" style="width:150px" type="text" value=""/>
  110. </td>
  111. <td align="left">
  112. 备注:
  113. </td>
  114. <td>
  115. <input name="note" style="width:420px" type="text" value="" >
  116. </td>
  117. <td>
  118. <a href="#" class="easyui-linkbutton addBthFahuo" data-options="iconCls:'icon-search'">发货</a>
  119. </td>
  120. </tr>
  121. <!--<tr>-->
  122. <!--<td colspan="4" align="right">-->
  123. <!--<a href="#" class="easyui-linkbutton addBthFahuo" data-options="iconCls:'icon-search'">发货</a>-->
  124. <!--</td>-->
  125. <!--</tr>-->
  126. </table>
  127. </form>
  128. </div>
  129. <table id="excelList">
  130. </table>
  131. <div class="body"></div>
  132. </div>
  133. <script>
  134. var excelList;
  135. bt_is_load=true;//定义防重复弹出小标签全局变量
  136. $(document).ready(function () {
  137. //初始化日期输入框
  138. initDateBox();
  139. excelList = $('#excelList').datagrid({
  140. url: '/index.php?s=/Admin/Export/getExcelData',
  141. method: 'post',
  142. toolbar: '#excelListToolbar',
  143. striped : true,
  144. showFooter:false,
  145. rownumbers: false, // 如果为true,则显示一个行号列。
  146. singleSelect: false, // 如果为true,则只允许选择一行。
  147. nowrap: false, // 如果为true,则在同一行中显示数据。设置为true可以提高加载性能。
  148. fit: true, // datagrid自适应宽高
  149. fitColumns: true, // 使列自动展开/收缩到合适的数据表格宽度。
  150. autoRowHeight: false, // 定义设置行的高度,根据该行的内容。设置为false可以提高负载性能。
  151. sortName: 'id', // 排序字段
  152. sortOrder: 'desc', // 排序方式
  153. pagination: true, // 显示分页工具条
  154. pageSize: 100,//初始化页面大小
  155. pageList: [10, 20, 30, 50, 100, 500,1000,2000,5000,10000],// 初始化页面大小选择列表
  156. queryParams: $('#searchBthForm').serializeObject(),
  157. columns: [[
  158. {field: 'ck', checkbox: true},
  159. {field: 'matter_name', title: '辅料名称', sortable: true, width: 200},
  160. {field: 'matter_no', title: '辅料编码', sortable: true, width: 200},
  161. {field: 'username', title: '所属用户', width: 200},
  162. {field: 'large_num', title: '大件数量', align: 'center', sortable: true, width: 100},
  163. {field: 'small_num', title: '小件数量', align: 'center', sortable: true, width: 100},
  164. {field: 'date', title: '创建日期', align: 'center', sortable: true, width: 150,
  165. formatter: function(value,row,index){
  166. return UnixToDate(value,true,8);
  167. }
  168. },
  169. {field:'id',title:'ID',align:'center',sortable:false,width:100,hidden:true},
  170. {field: 'file_dir', title: '下载路径', align: 'center', sortable: true, width: 200,
  171. formatter: function(value,row,index){
  172. if(row.status==0){
  173. return "<a href="+value+">点击下载</a>";
  174. }else{
  175. return "不支持下载";
  176. }
  177. }
  178. },
  179. {field:'status',title:'状态',align:'center',sortable:false,width:100,
  180. formatter: function(value,row,index){
  181. if(value==0){
  182. return '待发货';
  183. }else{
  184. return '已删除';
  185. }
  186. }
  187. },
  188. {field:'option',title:'操作',align:'center',sortable:false,width:100,
  189. formatter: function(value,row,index){
  190. if(row.status==0){
  191. return '<a class="red" data-id='+value+' onclick="deal('+row.id+')">删除</a>';
  192. }else{
  193. //return '<a class="green" data-id='+value+' onclick="fa('+value+')">发货</a>';
  194. }
  195. }
  196. }
  197. ]],
  198. onClickRow: function (rowIndex, rowData) {
  199. $('#excelList').datagrid('unselectRow', rowIndex);
  200. },
  201. onClickCell:function(rowIndex, field, value){
  202. },
  203. onLoadError: function () {
  204. $.messager.alert('系统提示', '数据加载错误,请刷新重试!', 'error');
  205. return false;
  206. },
  207. onBeforeLoad: function (param,data) {
  208. if (excelList != null) {
  209. excelList.datagrid('loadData', {total: 0, rows: []});
  210. }
  211. /*if (supTgGrid != null) {
  212. supTgGrid.datagrid('loadData', {total: 0, rows: []});
  213. }
  214. return true;*/
  215. },
  216. onLoadSuccess: function(data,options){
  217. }
  218. });
  219. });
  220. $('.addBthFahuo').click(function(){
  221. var id_str = '';
  222. var order_num = $('input[name="order_num"]').val();
  223. var deliveryman = $('input[name="deliveryman"]').val();
  224. var plate_number = $('input[name="plate_number"]').val();
  225. var shr_phone = $('input[name="shr_phone"]').val();
  226. var note = $('input[name="note"]').val();
  227. $('.datagrid-row-checked').each(function (i, item) {
  228. id_str += $(this).children('td:nth-child(8)').children().text() + ',';
  229. });
  230. if (order_num == ''){
  231. $.messager.alert('系统提示', '请填写订单号', 'warning',function(){
  232. });
  233. return false;
  234. }
  235. if (deliveryman == ''){
  236. $.messager.alert('系统提示', '请填写司机', 'warning',function(){
  237. });
  238. return false;
  239. }
  240. if (plate_number == ''){
  241. $.messager.alert('系统提示', '请填写车牌号', 'warning',function(){
  242. });
  243. return false;
  244. }
  245. if (shr_phone == ''){
  246. $.messager.alert('系统提示', '请填写司机电话', 'warning',function(){
  247. });
  248. return false;
  249. }
  250. if(id_str == ''){
  251. $.messager.alert('系统提示', '请至少选择一个选项', 'warning',function(){
  252. });
  253. return false;
  254. }else {
  255. // $('.body').loading();
  256. $.ajax({
  257. url: "/index.php?s=/Admin/Export/addFahuo",
  258. type: "post",
  259. dataType: "json",
  260. data: {id: id_str, order_num: order_num, deliveryman: deliveryman,plate_number: plate_number,shr_phone: shr_phone,note: note},
  261. success: function (data) {
  262. // console.log(data);
  263. if (data != null) {
  264. $('.body').loadend();
  265. if (data.status == 0) {
  266. $.messager.alert('系统提示', data.msg, 'warning',function(){
  267. });
  268. return false;
  269. } else {
  270. // window.location.href = data.url;
  271. excelList.datagrid('load', $('#searchBthForm').serializeObject());
  272. }
  273. }
  274. },
  275. error: function (error) {
  276. }
  277. })
  278. }
  279. })
  280. function deal(id){
  281. $.messager.confirm('再次确认', '温馨提示:删除后无法恢复,确定删除请选择“确定”', function(r){
  282. if (r){
  283. // exit action;
  284. $('.body').loading();
  285. $.ajax({
  286. url: "/index.php?s=/Admin/Export/changeExcelData",
  287. type: "post",
  288. dataType: "json",
  289. data: {id:id},
  290. success: function (data) {
  291. $('.body').loadend();
  292. if (data != null) {
  293. if (data.status == 0) {
  294. $.messager.alert('系统提示', data.msg, 'error');
  295. excelList.datagrid('load', $('#searchBthForm').serializeObject());
  296. } else {
  297. $.messager.alert('系统提示', data.msg, 'info',function(){
  298. excelList.datagrid('load', $('#searchBthForm').serializeObject());
  299. });
  300. }
  301. }
  302. },
  303. error: function (error) {
  304. }
  305. })
  306. }
  307. });
  308. return false;
  309. }
  310. function fa(id){
  311. }
  312. //初始化日期输入框
  313. function initDateBox() {
  314. var nowDate = new Date;
  315. $('#endDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  316. nowDate.setMonth(nowDate.getMonth() - 1);
  317. nowDate.setDate(nowDate.getDay() +1);
  318. $('#startDate').datebox('setValue', nowDate.Format("yyyy-MM-dd"));
  319. }
  320. function searchBthFun() {
  321. if ($('#searchBthForm').form('validate')) {
  322. //var obj = $('#searchBthForm').serializeObject();
  323. excelList.datagrid('load', $('#searchBthForm').serializeObject());
  324. }
  325. }
  326. function UnixToDate(unixTime, isFull, timeZone) {
  327. if (typeof (timeZone) == 'number') {
  328. unixTime = parseInt(unixTime) + parseInt(timeZone) * 60 * 60;
  329. }
  330. var time = new Date(unixTime * 1000);
  331. var ymdhis = "";
  332. ymdhis += time.getUTCFullYear() + "-";
  333. ymdhis += (time.getUTCMonth() + 1) + "-";
  334. ymdhis += time.getUTCDate();
  335. if (isFull === true) {
  336. ymdhis += " " + time.getUTCHours() + ":";
  337. ymdhis += time.getUTCMinutes() + ":";
  338. ymdhis += time.getUTCSeconds();
  339. }
  340. return ymdhis;
  341. }
  342. </script>
  343. </body>
  344. </html>