wangsaitao il y a 10 mois
Parent
commit
418749bfd6

+ 1 - 1
application/api/controller/screen/Order.php

@@ -239,7 +239,7 @@ class Order extends Index
             }
             $lists = Db::name('orders')
                 ->where('org_id',$this->orgId)
-                ->where('order_mode','in',[1,4])
+             //   ->where('order_mode','in',[1,4])
                 ->where('work_type_mode',$mode)
                 ->where('del',0)
                 ->order('id desc')

+ 11 - 1
application/api/controller/screen/Project.php

@@ -421,6 +421,16 @@ class Project extends Controller
     }
 
     public function ystask(){
+        $size = input('size')?input('size'):20;
+        $data = model('Orders')->get_cur_day_lists($this->orgId,$size);
+        foreach ($data as $k=>$v){
+            $data[$k]['create_time'] = date('H:i',strtotime($v['create_time']));
+            $data[$k]['send_time'] = $v['send_time']?date('H:i',strtotime($v['send_time'])):'';
+            $data[$k]['confirm_time'] = $v['confirm_time']?date('H:i',strtotime($v['confirm_time'])):'';
+        }
+        HelpHander::success($data,'成功');
+    }
+    public function ystask_bak(){
         $size = input('size')?input('size'):5;
         $data = model('Orders')->get_cur_day_lists($this->orgId,$size);
         foreach ($data as $k=>$v){
@@ -482,7 +492,7 @@ class Project extends Controller
             ->where('pr.org_id',$this->orgId)
             ->where('pr.images','<>','null')
             ->where('pr.create_yyyymmdd',date('Ymd'))
-            ->limit(4)
+            ->limit(9)
             ->field('pt.title as task_title,pr.images')
             ->order('pr.id','DESC')
             ->select();

+ 46 - 0
application/common/model/Orders.php

@@ -3071,6 +3071,52 @@ class Orders extends Base {
     {
         $ret = Db::name('orders')
             ->alias('o')
+            ->where('o.org_id',$org)
+            ->where('o.del',0)
+           // ->where('o.order_mode','in',[1,4])
+            //->where('o.work_type_mode',3)
+            ->where('o.create_yyyymmdd',date('Ymd'))
+            ->order('o.id','desc')
+            ->limit($limit)->select();
+        foreach ($ret as $k=>$v){
+
+            $todo =Db::name('todo')
+                ->alias('t')
+                ->where('t.order_id',$v['id'])
+                ->join('user u','u.id = t.to_user_id')
+               // ->where('t.todo_mode','in',[1,2,3])
+                ->where('t.del',0)
+                ->field('u.real_name,t.create_time,t.confirm_time')
+                ->order('t.id','asc')
+                ->select();
+
+            $users = [];
+            $confirmTime = '';
+            foreach ($todo as $kk=>$vv){
+                $users[] = $vv['real_name'];
+                if(!$confirmTime && $vv['confirm_time']){
+                    $confirmTime = $vv['confirm_time'];
+                }else if($confirmTime && $vv['confirm_time'] && $vv['confirm_time'] < $confirmTime){
+                    $confirmTime = $vv['confirm_time'];
+                }
+            }
+
+            $ret[$k]['real_names'] = implode(',',$users);
+            $ret[$k]['send_time'] = $todo?$todo[0]['create_time']:'';
+            $ret[$k]['confirm_time'] = $confirmTime;
+            $ret[$k]['order_model_txt'] = Db::name('order_mode')
+                ->where('id',$v['order_mode'])
+                ->value('out_content');
+
+
+        }
+
+        return $ret?$ret:[];
+    }
+    public function get_cur_day_lists_bak($org,$limit=5)
+    {
+        $ret = Db::name('orders')
+            ->alias('o')
             ->join('order_convey oc','oc.order_id = o.id')
             ->field('o.*,oc.type,oc.start,oc.end,oc.xq_time,oc.ywc_time,oc.device_id,oc.name,oc.phone,oc.priority')
             ->where('o.org_id',$org)

+ 17 - 19
application/h5/view/screen/project.html

@@ -153,10 +153,8 @@
                 <thead>
                 <tr>
                     <th>任务状态</th>
-                    <th>任务类型</th>
-                    <th>始发地</th>
-                    <th>目的地</th>
-                    <th>需求时间</th>
+                    <th>任务内容</th>
+                    <th>发单时间</th>
                     <th>执行人</th>
                     <th>派工时间</th>
                     <th>接收时间</th>
@@ -383,27 +381,27 @@
 
     function getYsTask() {
         var url = '/api/screen/project/ystask';
-        $.post(url,{orgid:orgid,size:5},function (res) {
+        $.post(url,{orgid:orgid,size:20},function (res) {
             if(res.code == 0){
                 var str = '';
                 var lists = res.data;
 
                 for (let o in lists){
-                    if(lists[o].orderMode == 1){
-                        str += '<tr>';
-                        str += '<td>新任务</td>';
-                    }else if(lists[o].orderMode == 5 && !lists[o].confirmTime){
-                        str += '<tr class="table-color2">';
-                        str += '<td>已派工</td>';
-                    }else{
-                        str += '<tr class="table-color3">';
-                        str += '<td>进行中</td>';
-                    }
+                    // if(lists[o].orderMode == 1){
+                    //     str += '<tr>';
+                    //     str += '<td>新任务</td>';
+                    // }else if(lists[o].orderMode == 5 && !lists[o].confirmTime){
+                    //     str += '<tr class="table-color2">';
+                    //     str += '<td>已派工</td>';
+                    // }else{
+                    //     str += '<tr class="table-color3">';
+                    //     str += '<td>进行中</td>';
+                    // }
 
-                    str += '<td>'+lists[o].typeName+'</td>';
-                    str += '<td>'+lists[o].startName+'</td>';
-                    str += '<td>'+lists[o].endName+'</td>';
-                    str += '<td>'+lists[o].xqTime+'</td>';
+                    str += '<tr>';
+                    str += '<td>'+lists[o].orderModelTxt+'</td>';
+                    str += '<td>'+lists[o].content+'</td>';
+                    str += '<td>'+lists[o].createTime+'</td>';
                     str += '<td>'+lists[o].realNames+'</td>';
                     str += '<td>'+lists[o].sendTime+'</td>';
                     str += '<td>'+lists[o].confirmTime+'</td>';