0
0

convey.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .ys-color1{
  5. color: #ffffff;
  6. background-color: #acb3d8;
  7. }
  8. .ys-color2{
  9. color: #ffffff;
  10. background-color: #fff500;
  11. }
  12. .ys-color3{
  13. color: #ffffff;
  14. background-color: #ec891a;
  15. }
  16. .ys-color4{
  17. color: #ffffff;
  18. background-color: #e45946;
  19. }
  20. .ys-yellow{
  21. /*color: #CC6600;*/
  22. }
  23. .input-group{
  24. margin-bottom: 10px;
  25. }
  26. </style>
  27. <div class="ibox">
  28. <div class="ibox-content">
  29. <div class="row">
  30. <div class="col-xs-12" style="text-align: right;">
  31. <form class="form-inline" id="form-search" action="{:url('convey')}?mode={$mode}">
  32. <div class="input-group">
  33. <input type="text" class="form-control" name="ysname" placeholder="运送员">
  34. </div>
  35. <div class="input-group">
  36. <input class="form-control" id="start" readonly placeholder="需求时间" name="xqtime" >
  37. </div>
  38. <div class="input-group">
  39. <input class="form-control" id="end" readonly placeholder="应完成时间" name="ywctime" >
  40. </div>
  41. <div class="input-group">
  42. <select name="priority" class="form-control">
  43. <option value="">优先级</option>
  44. <option value="1">可延缓的</option>
  45. <option value="2">常规</option>
  46. <option value="3">紧急</option>
  47. <option value="4">预约</option>
  48. </select>
  49. </div>
  50. <div class="input-group">
  51. <select name="type" class="form-control">
  52. <option value="">运送类型</option>
  53. {foreach $order_type_list as $k=>$v}
  54. <option value="{$v['id']}">{$v['title']}</option>
  55. {/foreach}
  56. </select>
  57. </div>
  58. <div class="input-group">
  59. <select name="status" class="form-control">
  60. <option value="">选择状态</option>
  61. <option value="1">新任务</option>
  62. <option value="2">进行中</option>
  63. <option value="3">延时中</option>
  64. </select>
  65. </div>
  66. <div class="input-group">
  67. <select name="start" class="form-control">
  68. <option value="">始发空间</option>
  69. {foreach $address as $k=>$v}
  70. <option value="{$v['id']}">{$v['title']}</option>
  71. {/foreach}
  72. </select>
  73. </div>
  74. <div class="input-group">
  75. <select name="end" class="form-control">
  76. <option value="">目的空间</option>
  77. {foreach $address as $k=>$v}
  78. <option value="{$v['id']}">{$v['title']}</option>
  79. {/foreach}
  80. </select>
  81. </div>
  82. <div class="input-group">
  83. <span class="input-group-btn">
  84. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  85. </span> &nbsp;
  86. <span class="input-group-btn">
  87. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  88. </span>
  89. </div>
  90. </form>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="ibox-content">
  95. <a href="javascript:;" url="{:url('dispatchAdd',[],'')}/mode/3" data-title="创建运送订单" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
  96. <a href="javascript:;" url="{:url('batchsend',[],'')}/mode/3" data-title="派工" class="btn btn-sm btn-primary paiGong">派工</a>
  97. <a href="javascript:;" class="btn btn-sm btn-primary finish">完成</a>
  98. <a href="javascript:;" class="btn btn-sm btn-primary quxiao">取消</a>
  99. <a href="javascript:;" class="btn btn-sm btn-primary yanchi">延迟</a>
  100. <a href="javascript:;" class="btn btn-sm btn-primary quxiaoyanchi">取消延迟</a>
  101. <a href="javascript:;" class="btn btn-sm btn-primary ysystatus">运送员状态</a>
  102. <a href="javascript:;" class="btn btn-sm btn-primary bhgd">驳回工单{if $count>0}({$count}){/if}</a>
  103. <br/>
  104. <br/>
  105. <div style="line-height: 30px; height: 30px;">
  106. <a style="float:left;" href="javascript:;" class="btn btn-sm btn-primary off">{if $refresh>0}关闭刷新{else}开启刷新{/if}</a>
  107. <span id="timermsglabel" {if $refresh==0} style="display: none" {else} style="color:black;margin-left: 10px" {/if} >30秒后自动刷新页面</span>
  108. </div>
  109. </div>
  110. <div class="ibox-content">
  111. <div class="jqGrid_wrapper">
  112. <table id="table" style="border-collapse: collapse"></table>
  113. <div id="pager"></div>
  114. </div>
  115. </div>
  116. </div>
  117. {/block}
  118. {block name="script"}
  119. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  120. <script>
  121. $ppp=30;
  122. $(function () {
  123. laydate.render({
  124. elem: '#start',
  125. trigger: 'click' ,
  126. theme: '#148d8f',
  127. range:true
  128. });
  129. laydate.render({
  130. elem: '#end',
  131. trigger: 'click' ,
  132. theme: '#148d8f',
  133. range:true
  134. });
  135. $(window).bind("resize",function(){
  136. var width=$(".jqGrid_wrapper").width();
  137. $("#table").setGridWidth(width);
  138. });
  139. $.jgrid.defaults.styleUI="Bootstrap";
  140. $("#table").jqGrid({
  141. url:"{:url('convey')}?mode={$mode}",
  142. datatype: "json",
  143. colModel:[
  144. {label:'状态',name:'status',index:'status',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
  145. if(a===1){
  146. if(c.ss >0){
  147. return '<span class="label ys-color'+c.ss+'">新订单</span>'
  148. }else {
  149. return '<span class="label">新订单<i class="fa fa-exclamation-triangle-fill"></i></span>'
  150. }
  151. }
  152. if(a===2){
  153. if(c.ss >0){
  154. return '<span class="label ys-color'+c.ss+'">进行中</span>'
  155. }else {
  156. return '<span class="label">进行中</span>'
  157. }
  158. }
  159. if(a===3){
  160. if(c.ss >0){
  161. return '<span class="label ys-color'+c.ss+'">延迟中</span>'
  162. }else {
  163. return '<span class="label">延迟中</span>'
  164. }
  165. }
  166. }},
  167. {label:'运送',name:'type_name',index:'type_name',width:40,editable: false,sortable: false},
  168. {label:'描述',name:'content',index:'content',width:50,sortable: false},
  169. {label:'始发',name:'start_name',index:'start_name',width:60,sortable: false},
  170. {label:'到达',name:'end_name',index:'end_name',width:60,sortable: false},
  171. {label:'运送员',name:'real_names',index:'real_names',width:60,sortable: false},
  172. {label:'需求',name:'xtime',index:'xtime',width:40,sortable: false},
  173. {label:'派工',name:'stime',index:'stime',width:40,sortable: false},
  174. {label:'接受',name:'ctime',index:'ctime',width:40,sortable: false},
  175. {label:'优先级',name:'priorityName',index:'priorityName',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
  176. if(c.priority==3){
  177. return "<span class='label' style='color: red'>"+a+"</span><img src='/admin/img/jj.png' style='width: 20px !important;height: 20px !important;' alt=''>";
  178. }else {
  179. return a;
  180. }
  181. }},
  182. {label:'运送设备',name:'device_name',index:'device_name',width:60,sortable: false},
  183. {label:'创建人',name:'real_name',index:'real_name',width:60,sortable: false},
  184. {label:'延迟原因',name:'delay_reason',index:'delay_reason',width:60,sortable: false},
  185. {label:'延迟时间',name:'delay_diff',index:'delay_diff',width:60,sortable: false},
  186. {label:'剩余时间',name:'last_time',index:'last_time',width:60,sortable: false},
  187. {label:'操作',width:100,sortable: false,formatter: function (a, b, c) {
  188. var detail_url = "{:url('detail2',[],'')}/id/"+c.id;
  189. var print = "{:url('print',[],'')}/id/"+c.id;
  190. var btn = '<a url="'+detail_url+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  191. // var btn = '<a href="'+detail_url+'" ><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  192. btn += '<a url="'+print+'" href="javascript:;" onclick="layer_open(this,1)" ><span class="label label-success" data-title="打印">打印</span></a>';
  193. return btn;
  194. }},
  195. ],
  196. rowNum:1000,
  197. rowList:[1000],
  198. pager: '#pager',
  199. sortname: '',
  200. viewrecords: true,
  201. autowidth:true,
  202. mtype: 'post',
  203. height: 'auto',
  204. emptyrecords: "暂无数据",
  205. sortorder: "",
  206. multiselect: true,//可多选
  207. caption:"运送调度订单列表",
  208. loadComplete: function (xhr) {
  209. if(xhr.code==0){
  210. layer.msg(xhr.msg);
  211. return false;
  212. }
  213. },
  214. });
  215. var interval = function () {
  216. if($ppp<1)
  217. {
  218. // clearInterval(interval);
  219. $ppp = 30;
  220. $("#search-btn").click();
  221. }else{
  222. $("#timermsglabel").html($ppp+"秒后自动刷新页面");
  223. $ppp--;
  224. }
  225. }
  226. if(parseInt('{$refresh}') >0){
  227. var time1 = setInterval(interval,1000);
  228. }
  229. //派工
  230. $('.paiGong').click(function (res) {
  231. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  232. if(rowIds.length <=0){
  233. updateAlert('请选择订单','alert-danger');
  234. setTimeout(function(){
  235. $('#top-alert').find('button').click();
  236. },1500);
  237. return;
  238. }
  239. clearInterval(time1);
  240. var url = "{:url('batchsend',[],'')}/id/"+rowIds.join(',')+"/mode/3";
  241. var title = '派工';
  242. layer.open({
  243. type: 2,
  244. shade: 0.8,
  245. title: title,
  246. area: ['800px', '90%'],
  247. fix: false, //不固定
  248. maxmin: true,
  249. content: url,
  250. skin: 'layer-ext-moon',
  251. success: function(layero, index) {
  252. },
  253. end:function () {
  254. time1 = setInterval(interval,1000);
  255. }
  256. });
  257. })
  258. //完成
  259. $('.finish').click(function (res) {
  260. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  261. if(rowIds.length <=0){
  262. updateAlert('请选择订单','alert-danger');
  263. setTimeout(function(){
  264. $('#top-alert').find('button').click();
  265. },1500);
  266. return;
  267. }
  268. var url = "{:url('batchfinish',[],'')}/id/"+rowIds.join(',');
  269. layer.confirm('确定要完成选中的订单吗?', {
  270. icon: 3,
  271. btn: ['确定', '取消'],
  272. skin: 'layer-ext-moon'
  273. }, function(index) {
  274. $.post(url,{},function (res) {
  275. if(res.code==1){
  276. layer.msg('完成成功', {
  277. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  278. }, function () {
  279. location.reload();
  280. });
  281. }else {
  282. layer.msg(res.msg);
  283. }
  284. })
  285. });
  286. })
  287. //取消
  288. $('.quxiao').click(function (res) {
  289. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  290. if(rowIds.length <=0){
  291. updateAlert('请选择订单','alert-danger');
  292. setTimeout(function(){
  293. $('#top-alert').find('button').click();
  294. },1500);
  295. return;
  296. }
  297. if(rowIds.length >1){
  298. updateAlert('每次只能取消一条','alert-danger');
  299. setTimeout(function(){
  300. $('#top-alert').find('button').click();
  301. },1500);
  302. return;
  303. }
  304. clearInterval(time1);
  305. var url = "{:url('disCancel',[],'')}/id/"+rowIds.join(',');
  306. var title = '取消';
  307. layer.open({
  308. type: 2,
  309. shade: 0.8,
  310. title: title,
  311. area: ['800px', '90%'],
  312. fix: false, //不固定
  313. maxmin: true,
  314. content: url,
  315. skin: 'layer-ext-moon',
  316. success: function(layero, index) {
  317. },
  318. end:function () {
  319. time1 = setInterval(interval,1000);
  320. }
  321. });
  322. })
  323. //延迟
  324. $('.yanchi').click(function (res) {
  325. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  326. if(rowIds.length <=0){
  327. updateAlert('请选择订单','alert-danger');
  328. setTimeout(function(){
  329. $('#top-alert').find('button').click();
  330. },1500);
  331. return;
  332. }
  333. clearInterval(time1);
  334. var url = "{:url('batchdelay',[],'')}/id/"+rowIds.join(',');
  335. var title = '延迟';
  336. layer.open({
  337. type: 2,
  338. shade: 0.8,
  339. title: title,
  340. area: ['800px', '90%'],
  341. fix: false, //不固定
  342. maxmin: true,
  343. content: url,
  344. skin: 'layer-ext-moon',
  345. success: function(layero, index) {
  346. },
  347. end:function () {
  348. time1 = setInterval(interval,1000);
  349. }
  350. });
  351. })
  352. //取消延迟
  353. $('.quxiaoyanchi').click(function (res) {
  354. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  355. if(rowIds.length <=0){
  356. updateAlert('请选择订单','alert-danger');
  357. setTimeout(function(){
  358. $('#top-alert').find('button').click();
  359. },1500);
  360. return;
  361. }
  362. var url = "{:url('batchcanceldelay',[],'')}/id/"+rowIds.join(',');
  363. layer.confirm('确定要取消延迟选中的订单吗?', {
  364. icon: 3,
  365. btn: ['确定', '取消'],
  366. skin: 'layer-ext-moon'
  367. }, function(index) {
  368. $.post(url,{},function (res) {
  369. if(res.code==1){
  370. layer.msg('取消成功', {
  371. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  372. }, function () {
  373. location.reload();
  374. });
  375. }else {
  376. layer.msg(res.msg);
  377. }
  378. })
  379. });
  380. })
  381. //运送员状态
  382. $('.ysystatus').click(function (res) {
  383. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  384. // if(rowIds.length <=0){
  385. // updateAlert('请选择订单','alert-danger');
  386. // setTimeout(function(){
  387. // $('#top-alert').find('button').click();
  388. // },1500);
  389. // return;
  390. // }
  391. var url = "{:url('conveystatus',[],'')}/id/"+rowIds.join(',');
  392. var title = '运送员状态';
  393. clearInterval(time1);
  394. layer.open({
  395. type: 2,
  396. shade: 0.8,
  397. title: title,
  398. area: ['800px', '90%'],
  399. fix: false, //不固定
  400. maxmin: true,
  401. content: url,
  402. skin: 'layer-ext-moon',
  403. success: function(layero, index) {
  404. }, end:function () {
  405. time1 = setInterval(interval,1000);
  406. }
  407. });
  408. })
  409. //驳回工单
  410. $('.bhgd').click(function (res) {
  411. $ppp = 3000;
  412. var url = "{:url('bhTodoList')}";
  413. var title = '驳回工单';
  414. layer.open({
  415. type: 2,
  416. shade: 0.8,
  417. title: title,
  418. area: ['90%', '90%'],
  419. fix: false, //不固定
  420. maxmin: true,
  421. content: url,
  422. skin: 'layer-ext-moon',
  423. success: function(layero, index) {
  424. }
  425. });
  426. })
  427. $('.off').click(function () {
  428. $.post('{:url("orderRefreshOff")}',{},function (res) {
  429. if(res.code==1){
  430. if(res.data.status==1){
  431. time1 = setInterval(interval,1000);
  432. $("#timermsglabel").css('display','');
  433. $("#timermsglabel").css('margin-left','10px');
  434. $(".off").html('关闭刷新');
  435. }else {
  436. clearInterval(time1);
  437. $("#timermsglabel").css('display','none');
  438. $(".off").html('开启刷新');
  439. }
  440. }else {
  441. layer.msg(res.msg);
  442. }
  443. })
  444. })
  445. });
  446. </script>
  447. {/block}