zgg il y a 1 jour
Parent
commit
68c7ab96fb

+ 25 - 15
application/admin/controller/DailyStatistics.php

@@ -100,29 +100,39 @@ class DailyStatistics extends Auth {
         $end = input('end', date('Y-m-d'));
         $start1 = $start . ' 00:00:00';
         $end1 = $end . ' 00:00:00';
-        $map1[] = ['create_time', '>=', $start1];
-        $map1[] = ['create_time', '<=', $end1];
-        $map[] = ['org_id', '=', $this->orgId];
+        $map1[] = ['dr.create_time', '>=', $start1];
+        $map1[] = ['dr.create_time', '<=', $end1];
+        $map[] = ['dr.org_id', '=', $this->orgId];
 //        $list = Db::name('daily_record')
 //            ->where($map)
 //            ->group('daily_id')
 //            ->select();
 
         $addrList =  model('Address')->getListByType(10,$this->orgId);
-        foreach ($addrList as $k => $v) {
-            $dailyIds = Db::name('daily')
-                ->where('enable',1)
-                ->where('del',0)
-                ->where('address_id',$v['id'])
-                ->column('id');
+        $addrIds = array_column($addrList, 'id');
+        $dailyCounts = Db::name('daily_record')
+            ->alias('dr')
+            ->join('daily d', 'dr.daily_id = d.id')
+            ->where('d.enable', 1)
+            ->where('d.del', 0)
+            ->where('d.address_id', 'in', $addrIds)
+            ->where($map)
+            ->where($map1)
+            ->field('d.address_id, COUNT(dr.id) as count')
+            ->group('d.address_id')
+            ->select();
 
-            $count = Db::name('daily_record')
-                ->where($map)
-                ->where('daily_id','in', $dailyIds)
-                ->where($map1)
-                ->count();
-            $addrList[$k]['count'] = $count ? $count : 0;
+        $countMap = [];
+        foreach ($dailyCounts as $item) {
+            $countMap[$item['address_id']] = $item['count'];
+        }
+        $total = 0;
+        foreach ($addrList as $k => $v) {
+            $count = $countMap[$v['id']] ?? 0;
+            $total += $count;
+            $addrList[$k]['count'] = $count;
         }
+        $addrList[] = ['title'=>'合计','count' => $total];
         $this->assign('list', $addrList);
         $this->assign('start', $start);
         $this->assign('end', $end);

+ 7 - 2
application/admin/controller/DepCate.php

@@ -39,7 +39,10 @@ class DepCate extends Auth
             $map= empty($map) ? true: $map;
             //数据查询
             $lists = db($this->table)->where($map)->limit($start,$length)->order($order)->select();
-
+            foreach ($lists as $k=>$v){
+                $deps = Db::name('dep')->where('cate_id',$v['id'])->column('title');
+                $lists[$k]['deps'] =  $deps ?implode(',',$deps) : '';
+            }
             //数据返回
             $totalCount = db($this->table)->where($map)->count();
             $totalPage = ceil($totalCount/$length);
@@ -67,9 +70,11 @@ class DepCate extends Auth
         }else{
             if($id){
                 $info =db($this->table)->where('id',$id)->find();
+                $info['deps'] = Db::name('dep')->where('cate_id',$info['id'])->column('id');
                 $this->assign('info',$info);
             }
-
+            $deps = model('Dep')->getList();
+            $this->assign('depList',$deps);
             return $this->fetch();
         }
     }

+ 2 - 0
application/admin/controller/Device.php

@@ -140,6 +140,8 @@ class Device extends Auth
             exit('数据不存在');
         }
         $code = get_qrcode_str('device', $id);
+        $config = config('app.device_url');
+        $code = $config.$code;
         $this->assign('code',$code);
         $this->assign('info',$info);
         return $this->fetch();

+ 48 - 4
application/admin/controller/Orders.php

@@ -192,6 +192,8 @@ class Orders extends Auth {
         $order = $this->model->formatOrder($order, 1);
         $order['images'] = !empty($order['images']) ? explode(',', $order['images']) : '';
 
+        $is_ch = $order['order_mode'] == 4 ? 1 : 0;
+        $order['is_ch'] =  $is_ch;
         if($order['work_type_mode'] == 3){
             // 地点路径
             $conveyends = Db::name('order_convey_end')
@@ -391,6 +393,10 @@ class Orders extends Auth {
                     $map[] = ['from','=',$from];
                 }
             }
+            $mark = input('mark', '', 'trim');
+            if ($mark != ''){
+                $map[] = ['is_marked','=',$mark];
+            }
             $map = empty($map) ? true : $map;
             //数据查询
             $lists = db($this->table)->where($map)
@@ -664,10 +670,11 @@ class Orders extends Auth {
 
         $is_ch = 0;
         if($order['order_mode'] == 4){
-            $todoInfo = Db::name('todo')->where('order_id',$order['id'])->where('del',0)->where('todo_mode','>',1)->find();
-            if(!$todoInfo){
-                $is_ch = 1;
-            }
+//            $todoInfo = Db::name('todo')->where('order_id',$order['id'])->where('del',0)->where('todo_mode','>',1)->find();
+//            if(!$todoInfo){
+//                $is_ch = 1;
+//            }
+            $is_ch = 1;
         }
         $order['is_ch'] =  $is_ch;
 
@@ -1674,6 +1681,8 @@ class Orders extends Auth {
                 if ($turnoff && $level1 && $v['order_mode'] == 1 && $v['is_deal'] == 1) {
                     $lists[$k]['order_mode_text'] = '已派发';
                 }
+                $content = removeEmojiChar($v['content']);
+                $lists[$k]['content'] =  preg_replace('/[^\p{L}\p{N}\p{P}\p{Z}^\n]/u', '', $content);
             }
             include_once env('root_path') . '/extend/phpexcel/Classes/PHPExcel.php';
             //实例化PHPExcel类
@@ -2134,4 +2143,39 @@ class Orders extends Auth {
 
     }
 
+    //调度附言
+    public function ps($id) {
+        if (request()->isGet()) {
+            $this->assign('id', $id);
+            $ps = Db::name('orders')
+                ->where('id', $id)
+                ->value('ps');
+            $this->assign('ps', $ps);
+            $this->assign('id', $id);
+            return $this->fetch();
+        }else {
+            $ps = input('ps');
+            $res = Db::name('orders')
+                ->where('id', $id)
+                ->update(['ps'=>$ps,'update_time'=>getTime()]);
+            if (!$res) {
+                $this->error('操作失败');
+            }
+            $this->success('操作成功');
+        }
+    }
+
+    //标记订单
+    public function mark($id=0,$value=''){
+        if($value == '' || !$id){
+            $this->error('参数错误');
+        }
+        $res = db('orders')->where('id',$id)->setField('is_marked',$value);
+        if($res){
+            $this->success('操作成功');
+        }else{
+            $this->error('操作失败');
+        }
+    }
+
 }

+ 62 - 17
application/admin/controller/PatrolStatistics.php

@@ -30,24 +30,69 @@ class PatrolStatistics extends Auth {
             ->group('patrol_addr_id')
             ->distinct(true)
             ->select();
-        foreach ($list as $k => $v) {
-            $list[$k]['title'] = Db::name('address')
-                ->where('id', $v['patrol_addr_id'])
-                ->value('title');
-            $c = Db::name('patrol_record')
-                ->where($map1)
-                ->where('is_normal', 0)
-                ->where('patrol_addr_id', $v['patrol_addr_id'])
-                ->where('patrol_mode', $type)
-                ->count();
-            $list[$k]['count'] = $c ? $c : 0;
-            $normal = Db::name('patrol_record')
-                ->where($map1)
-                ->where('is_normal', 1)
-                ->where('patrol_addr_id', $v['patrol_addr_id'])
+//        foreach ($list as $k => $v) {
+//            $list[$k]['title'] = Db::name('address')
+//                ->where('id', $v['patrol_addr_id'])
+//                ->value('title');
+//            $c = Db::name('patrol_record')
+//                ->where($map1)
+//                ->where('is_normal', 0)
+//                ->where('patrol_addr_id', $v['patrol_addr_id'])
+//                ->where('patrol_mode', $type)
+//                ->count();
+//            $list[$k]['count'] = $c ? $c : 0;
+//            $normal = Db::name('patrol_record')
+//                ->where($map1)
+//                ->where('is_normal', 1)
+//                ->where('patrol_addr_id', $v['patrol_addr_id'])
+//                ->where('patrol_mode', $type)
+//                ->count();
+//            $list[$k]['normal'] = $normal ? $normal : 0;
+//        }
+        $addrIds = array_unique(array_column($list, 'patrol_addr_id'));
+        $addrIds = is_array($addrIds) ? array_filter($addrIds) : [];
+
+        $addressTitles = [];
+        if (!empty($addrIds)) {
+            $addressTitles = Db::name('address')
+                ->whereIn('id', $addrIds)
+                ->column('title', 'id');
+        }
+
+        $stats = [];
+        if (!empty($addrIds)) {
+            $query = Db::name('patrol_record')
+                ->field([
+                    'patrol_addr_id',
+                    'SUM(CASE WHEN is_normal = 0 THEN 1 ELSE 0 END) as abnormal_count',
+                    'SUM(CASE WHEN is_normal = 1 THEN 1 ELSE 0 END) as normal_count'
+                ])
+                ->whereIn('patrol_addr_id', $addrIds)  // 确保 $addrIds 是数组
                 ->where('patrol_mode', $type)
-                ->count();
-            $list[$k]['normal'] = $normal ? $normal : 0;
+                ->where($map1);
+
+            $results = $query->group('patrol_addr_id')->select();
+
+            foreach ($results as $row) {
+                $stats[$row['patrol_addr_id']] = [
+                    'abnormal_count' => (int)$row['abnormal_count'],
+                    'normal_count' => (int)$row['normal_count']
+                ];
+            }
+
+            foreach ($addrIds as $id) {
+                if (!isset($stats[$id])) {
+                    $stats[$id] = ['abnormal_count' => 0, 'normal_count' => 0];
+                }
+            }
+        }
+
+        foreach ($list as $k => $v) {
+            $addrId = $v['patrol_addr_id'];
+
+            $list[$k]['title']   = $addressTitles[$addrId] ?? '';
+            $list[$k]['count']   = $stats[$addrId]['abnormal_count'] ?? 0;
+            $list[$k]['normal']  = $stats[$addrId]['normal_count'] ?? 0;
         }
         return $list;
     }

+ 49 - 46
application/admin/controller/WasteRecord.php

@@ -225,16 +225,19 @@ class WasteRecord extends Auth {
             $map = empty($map) ? true : $map;
             //数据查询
             $lists = db($this->table)->where($map)->select();
+            $addrs = Db::name('address')
+                ->whereIn('id',array_unique(array_column($lists, 'waste_device_id')))
+                ->column('title','id');
+            $users = Db::name('user')
+                ->whereIn('id',array_unique(array_column($lists, 'user_id')))
+                ->column('real_name','id');
+            $types = Db::name('waste_type')
+                ->whereIn('id',array_unique(array_column($lists, 'cateid')))
+                ->column('title','id');
             foreach ($lists as $k => $v) {
-                $lists[$k]['waste_device'] = db('address')
-                    ->where('id', $v['waste_device_id'])
-                    ->value('title');
-                $lists[$k]['real_name'] = db('user')
-                    ->where('id', $v['user_id'])
-                    ->value('real_name');
-                $lists[$k]['cate'] = db('waste_type')
-                    ->where('id', $v['cateid'])
-                    ->value('title');
+                $lists[$k]['waste_device'] = $addrs[$v['waste_device_id']] ?? '';
+                $lists[$k]['real_name'] = $users[$v['user_id']] ?? '';
+                $lists[$k]['cate'] = $types[$v['cateid']] ?? '';
                 $lists[$k]['weight'] = round($v['weight'] / 1000, 2);
                 $lists[$k]['serial_number_path'] = url('Qrcode/qrcode') . '?code=' . $v['serial_number'];
                 $lists[$k]['status'] = $this->model->status[$v['status']];
@@ -315,44 +318,44 @@ class WasteRecord extends Auth {
                     $sign_text = '是';
                 }
                 $objPHPExcel->getActiveSheet()->setCellValue('I' . ($i + 2), $sign_text);
+                $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 2), $lists[$i]['sign_path']);
 
-                $signList = explode(".",$lists[$i]['sign_path']);
-                if($signList){
-                    $ext = end($signList);
-                    $img ='';
-                    if ($ext == 'jpg' || $ext == 'jpeg'){
-                        $img = @imagecreatefromjpeg($lists[$i]['sign_path']);
-                    }
-                    if ($ext == 'png'){
-                        $img = @imagecreatefrompng($lists[$i]['sign_path']);
-                    }
-                    if($img){
-                        //实例化图片操作类
-                        $objDrawing = new \PHPExcel_Worksheet_MemoryDrawing();
-                        $objDrawing->setImageResource($img);
-                        $objDrawing->setRenderingFunction(\PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT);//渲染方法
-
-                        $objDrawing->setMimeType(\PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
-
-                        $objDrawing->setHeight(40);//照片高度
-                        $objDrawing->setWidth(40); //照片宽度
-                        $objDrawing->setCoordinates('J'.($i+2));//图片要插入的单元格
-
-                        $objDrawing->setOffsetX(8);//图片X轴偏移
-                        $objDrawing->setOffsetY(8);//图片Y轴偏移
-                        $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
-                        //设置每一行高度
-
-                    }else{
-                        $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 2), '');
-                    }
-
-
-                }else{
-                    $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 2), '');
-                }
-
-                $objActSheet->getRowDimension($i + 2)->setRowHeight(40); // 行高
+//                $signList = explode(".",$lists[$i]['sign_path']);
+//                if($signList){
+//                    $ext = end($signList);
+//                    $img ='';
+//                    if ($ext == 'jpg' || $ext == 'jpeg'){
+//                        $img = @imagecreatefromjpeg($lists[$i]['sign_path']);
+//                    }
+//                    if ($ext == 'png'){
+//                        $img = @imagecreatefrompng($lists[$i]['sign_path']);
+//                    }
+//                    if($img){
+//                        //实例化图片操作类
+//                        $objDrawing = new \PHPExcel_Worksheet_MemoryDrawing();
+//                        $objDrawing->setImageResource($img);
+//                        $objDrawing->setRenderingFunction(\PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT);//渲染方法
+//
+//                        $objDrawing->setMimeType(\PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
+//
+//                        $objDrawing->setHeight(40);//照片高度
+//                        $objDrawing->setWidth(40); //照片宽度
+//                        $objDrawing->setCoordinates('J'.($i+2));//图片要插入的单元格
+//
+//                        $objDrawing->setOffsetX(8);//图片X轴偏移
+//                        $objDrawing->setOffsetY(8);//图片Y轴偏移
+//                        $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+//                        //设置每一行高度
+//
+//                    }else{
+//                        $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 2), '');
+//                    }
+//
+//
+//                }else{
+//                    $objPHPExcel->getActiveSheet()->setCellValue('J' . ($i + 2), '');
+//                }
+//                $objActSheet->getRowDimension($i + 2)->setRowHeight(40); // 行高
             }
             //设置保存的Excel表格名称
             $filename = $meta_title.'_' . date('YmdHis', time()) . '.xls';

+ 37 - 2
application/admin/view/daily_statistics/daily.html

@@ -19,7 +19,10 @@
 			</span>&nbsp;
                 <span class="input-group-btn">
                      <button class="btn-sm btn-warning" type="reset" onclick="empty_search()"><i class="fa fa-undo"></i></button>
-            </span>
+            </span>&nbsp;
+                <span class="input-group-btn">
+                    <button title="导出" class="btn-sm btn-primary"  onclick="exportTableToExcel(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
+                </span>
             </div>
         </form>
     </div>
@@ -32,7 +35,7 @@
                 </div>
             </div>
             <div class="panel-body" id="printer">
-                <table class="table table-bordered">
+                <table class="table table-bordered" id="table">
                     <thead>
                     <tr>
                         <th>序号</th>
@@ -60,6 +63,7 @@
 <script src="/static/layDate-v5.0.9/laydate.js"></script>
 <script src="/static/browser.js"></script>
 <script src="/static/jquery.jqprint-0.3.js"></script>
+<script src="/static/xlsx.full.min.js"></script>
 <script>
     $(function () {
         laydate.render({
@@ -80,7 +84,38 @@
         $('#printer').jqprint();
     }
 
+    function exportTableToExcel() {
+        // 获取表格元素
+        const table = document.getElementById('table');
+        // 将表格转换为工作表
+        const ws = XLSX.utils.table_to_sheet(table);
+        const filename = '日常工作统计'+'.xlsx';
+
+        // 设置单元格宽度
+        // 示例:设置每列的宽度
+        ws['!cols'] = [
+            { wch: 5 },
+            { wch: 10 },
+            { wch: 10 },
+            // 根据需要继续添加更多列的宽度设置
+        ];
+        // 设置订单编号列的格式为文本
+        // 假设订单编号在第1列(A列)
+        const range = XLSX.utils.decode_range(ws['!ref']);
+        for (let row = range.s.r; row <= range.e.r; row++) {
+            const cellAddress = { c: 1, r: row }; // 第1列(A列)
+            const cellRef = XLSX.utils.encode_cell(cellAddress);
+            if (ws[cellRef]) {
+                ws[cellRef].t = 's'; // 设置单元格类型为字符串
+            }
+        }
+        // 创建工作簿并添加工作表
+        const wb = XLSX.utils.book_new();
+        XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
 
+        // 导出为 Excel 文件
+        XLSX.writeFile(wb, filename || 'tableExport.xlsx');
+    }
 
 </script>
 {/block}

+ 2 - 2
application/admin/view/dep_cate/add.html

@@ -15,9 +15,9 @@
 
 
                     <div class="form-group">
-                        <label class="col-sm-2 control-label">备注</label>
+                        <label class="col-sm-2 control-label">管理部门<span class="text-danger">*</span></label>
                         <div class="col-sm-6">
-                            <input type="text" class="form-control" name="remark" value="{$info.remark||default=''}">
+                            {:widget('common/multiselect',['name'=>'deps','lists'=>$depList,'val'=>isset($info['deps'])?$info['deps']:[]])}
                         </div>
                     </div>
 

+ 5 - 8
application/admin/view/dep_cate/index.html

@@ -53,13 +53,10 @@
             url:"{:url('index')}",
             datatype: "json",
             colModel:[
-                {label:'ID',name:'id',index:'id', width:30,sortable: false},
-                {label:'名称',name:'title',index:'title',width:150,editable: false,sortable: false,formatter:function (a,b,c){
-                        var url = "{:url('Dep/index',[],'')}?cate_id="+c.id;
-                        return '<a href="'+url+'">'+a+'</a>';
-
-                    }},
-                {label:'状态',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
+                {label:'ID',name:'id',index:'id', width:15,sortable: false},
+                {label:'名称',name:'title',index:'title',width:30,editable: false,sortable: false},
+                {label:'管理部门',name:'deps',index:'deps',width:250,editable: false,sortable: false},
+                {label:'状态',name:'enable',index:'enable',width:30,editable: false,sortable: false,formatter:function (a,b,c){
                     if(a == 0){
                         var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
                         return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
@@ -69,7 +66,7 @@
                     }
                 }},
 
-                {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
+                {label:'操作',width:30,sortable: false,formatter: function (a, b, c) {
                     var editurl = "{:url('add',[],'')}/id/"+c.id;
                     var delurl = "{:url('del',[],'')}/id/"+c.id;
                     var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';

+ 7 - 0
application/admin/view/orders/detail.html

@@ -337,6 +337,10 @@
                         </td>
                     </tr>
                     {/if}
+                    <tr>
+                        <th>订单说明</th>
+                        <td>{$info['ps']}</td>
+                    </tr>
                     {if in_array($info['order_mode'],[1])}
                     <tr>
                         <th>操作</th><td>
@@ -344,6 +348,9 @@
                         {if $info.order_mode==1}
                         <a href="{:url('cancel',[],'')}/id/{$info['id']}" class="confirm ajax-get"  data-confirm="确定要取消吗?"><span class="btn btn-sm btn-default">取消订单</span></a> &nbsp;
                         {/if}
+                        {if $info['is_ch'] == 1}
+                        <a href="{:url('withdraw',[],'')}/id/{$info['id']}"  class="confirm ajax-get" data-confirm="是否确认撤回订单?"><span class="btn btn-sm btn-danger">撤回</span></a> &nbsp;
+                        {/if}
                     </td>
                     </tr>
                     {/if}

+ 9 - 3
application/admin/view/orders/detail2.html

@@ -331,9 +331,14 @@
                         </td>
                     </tr>
                     {/if}
-                    {if in_array($info['order_mode'],[1,4]) && $info['del']==0}
                     <tr>
-                        <th>操作</th><td>
+                        <th>订单说明</th>
+                        <td>{$info['ps']}</td>
+                    </tr>
+                    <tr>
+                        <th>操作</th>
+                        <td>
+                        {if in_array($info['order_mode'],[1,4]) && $info['del']==0}
                         {if condition="($info['is_deal']==0 and $info['order_mode']==1) or (!$turnoff and $info['order_mode']==1) or ($turnoff and $level2 and $info['is_deal']==1 and $info['order_mode']==1)"}
                         <a url="{:url('send',[],'')}/id/{$info['id']}/mode/{$info['work_type_mode']}" href="javascript:;"  onclick="layer_open(this,2)"><span class="btn btn-sm btn-primary">转任务</span></a> &nbsp;
                         {/if}
@@ -369,9 +374,10 @@
                         {if $info.order_mode==4}
 <!--                        <a href="{:url('finish',[],'')}/id/{$info['id']}" class="confirm ajax-get" data-confirm="是否确认完成订单?" data-reload="1"><span class="btn btn-sm btn-primary" title="完成订单">完成订单</span></a>-->
                         {/if}
+                        {/if}
+                        <a url="{:url('ps',[],'')}/id/{$info['id']}" href="javascript:;" data-title="订单说明"  onclick="layer_open(this,2)"><span class="btn btn-sm btn-warning">订单说明</span></a> &nbsp;
                     </td>
                     </tr>
-                    {/if}
                     </tbody>
                 </table>
 

+ 23 - 3
application/admin/view/orders/index0.html

@@ -57,6 +57,13 @@
                             <option value="3">投诉</option>
                         </select>
                     </div>
+                    <div class="input-group">
+                        <select name="mark" class="form-control" >
+                            <option value="">是否标记</option>
+                            <option value="1">已标记</option>
+                            <option value="0">未标记</option>
+                        </select>
+                    </div>
                     <br/>
                     <br/>
 <!--                    <div class="input-group">-->
@@ -148,7 +155,13 @@
             url:"{:url('index')}?mode={$mode}",
             datatype: "json",
             colModel:[
-                {label:'编号',name:'sn',index:'sn', width:80,sortable: false},
+                {label:'编号',name:'sn',index:'sn', width:80,sortable: false,formatter:function (a, b, c) {
+                    if (c.is_marked == 0){
+                        return a;
+                    }else{
+                        return '⭐'+a;
+                    }
+                }},
                 {label:'申请时间',name:'create_time',index:'create_time',width:50,sortable: true},
                 {label:'内容',name:'content',index:'content',width:60,sortable: true},
                 {label:'订单类型',name:'work_type_mode_text',index:'work_type_mode_text',width:50,sortable: true},
@@ -169,17 +182,24 @@
                             }
                         }
                     }},
-                {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
+                {label:'操作',width:70,sortable: false,formatter: function (a, b, c) {
                     var detail_url = "{:url('detail2',[],'')}/id/"+c.id;
                     var reject_url =  "{:url('rejectTodoList',[],'')}/orderId/"+c.id;
                     var del_url = "{:url('del',[],'')}/id/"+c.id;
+                    var mark_url = "{:url('mark',[],'')}/value/1/id/"+c.id;
+                    var unmark_url = "{:url('mark',[],'')}/value/0/id/"+c.id;
                   //  var btn = '<a  href="'+detail_url+'" ><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
                         var btn = '<a url="'+detail_url+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
 
                         if(c.order_mode == 4 && c.bh_nums >0){
                         btn += '<a url="'+reject_url+'" href="javascript:;" onclick="layer_open(this,1)" ><span class="label label-success" data-title="驳回工单">驳回工单</span></a>&nbsp;';
                     }
-                        btn += '<a {if !btnAuth(session("user_auth.id"),"Orders/del?mode=$mode")} style="display:none"  {/if} href="'+del_url+'" class="confirm ajax-get" data-confirm="确定要删除吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
+                        btn += '<a {if !btnAuth(session("user_auth.id"),"Orders/del?mode=$mode")} style="display:none"  {/if} href="'+del_url+'" class="confirm ajax-get" data-confirm="确定要删除吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>&nbsp;';
+                        if (c.is_marked == 0){
+                            btn += '<a href="'+mark_url+'" class="confirm ajax-get" data-confirm="确定要标记此订单吗?" data-table="1"><span class="label label-warning" title="标记">标记</span></a>';
+                        }else{
+                            btn += '<a href="'+unmark_url+'" class="confirm ajax-get" data-confirm="确定要取消标记此订单吗?" data-table="1"><span class="label label-warning" title="取消标记">取消标记</span></a>';
+                        }
                     return btn;
                 }},
             ],

+ 33 - 0
application/admin/view/orders/ps.html

@@ -0,0 +1,33 @@
+{extend name="common/common2" /}
+{block name="main"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-content">
+                <form method="post" action="{:url('ps',[],'')}/id/{$id}" class="form-horizontal">
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">订单说明</label>
+                        <div class="col-sm-6">
+                            <textarea name="ps" class="form-control" cols="30" rows="10" id="myInput" >{$ps|default=''}</textarea>
+                        </div>
+                    </div>
+                    <div class="hr-line-dashed"></div>
+                    <div class="form-group">
+                        <div class="col-sm-6 col-sm-offset-2">
+                            <button class="btn btn-primary ajax-post" data-layer="1" data-reload="1" target-form="form-horizontal" type="submit">确 定</button>
+                            <button  class="btn cancel-btn btn-default" type="button">取 消</button>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    document.addEventListener('DOMContentLoaded', function() {
+        document.getElementById('myInput').focus();
+    });
+</script>
+{/block}

+ 57 - 10
application/admin/view/statistics/daily_work.html

@@ -1,13 +1,23 @@
 {extend name="common/common2" /}
 {block name="main"}
 <div class="ibox-content">
-<div class="row">
-    <div class="col-sm-12">
-        <div class="ibox float-e-margins">
-            <h5>{$meta_title}</h5>
-
+<div class="ibox">
+    <div class="alert">
+        <form action="daily" method="GET" id='search_form' class="form-inline">
+                <span class="input-group-btn">
+                    <button title="导出" class="btn-sm btn-primary"  onclick="exportTableToExcel(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
+                </span>
+        </form>
+    </div>
+    <div class="panel-group">
+        <div class="panel panel-default">
+            <div class="panel-heading clearfix">
+                <div class="btn-group pull-left">
+                    {$meta_title}
+                </div>
+            </div>
             <div class="panel-body" id="printer">
-                <table class="table table-bordered">
+                <table class="table table-bordered" id="table">
                     <thead>
                     <tr>
                         <th>任务地点</th>
@@ -38,17 +48,14 @@
                     </tbody>
                 </table>
             </div>
-
-
         </div>
     </div>
 </div>
 </div>
 {/block}
 {block name="script"}
-<script src="/static/echarts.js"></script>
 <script src="/static/browser.js"></script>
-<script src="/static/layDate-v5.0.9/laydate.js"></script>
+<script src="/static/xlsx.full.min.js"></script>
 <script type="text/javascript">
     function empty_search(){
         window.location.href = 'duration';
@@ -60,5 +67,45 @@
             theme:'#284a94'
         });
     })
+    function exportTableToExcel() {
+        // 获取表格元素
+        const table = document.getElementById('table');
+        // 将表格转换为工作表
+        const ws = XLSX.utils.table_to_sheet(table);
+        const filename = '日常工作量统计'+'.xlsx';
+
+        // 设置单元格宽度
+        // 示例:设置每列的宽度
+        ws['!cols'] = [
+            { wch: 20 },
+            { wch: 10 },
+            { wch: 10 },
+            { wch: 10 },
+            // 根据需要继续添加更多列的宽度设置
+        ];
+        // 设置订单编号列的格式为文本
+        // 假设订单编号在第1列(A列)
+        const range = XLSX.utils.decode_range(ws['!ref']);
+        for (let R = range.s.r; R <= range.e.r; ++R) {
+            for (let C = range.s.c; C <= range.e.c; ++C) {
+                const cellRef = XLSX.utils.encode_cell({ r: R, c: C });
+                if (!ws[cellRef]) continue;
+
+                // 设置样式
+                ws[cellRef].s = {
+                    alignment: {
+                        horizontal: 'left',
+                        vertical: 'center'  // 可选:垂直居中
+                    }
+                };
+            }
+        }
+        // 创建工作簿并添加工作表
+        const wb = XLSX.utils.book_new();
+        XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
+
+        // 导出为 Excel 文件
+        XLSX.writeFile(wb, filename || 'tableExport.xlsx');
+    }
 </script>
 {/block}

+ 16 - 14
application/admin/view/user/add.html

@@ -46,24 +46,26 @@
                     <div class="form-group">
                         <label class="col-sm-2 control-label">所在科室/部门<span class="text-danger">*</span></label>
                         <div class="col-sm-6">
-                            <select name="depId" class="form-control">
-                                <option value="0">选择科室/部门</option>
-                                {volist name="deps" id="v"}
-                                <option value="{$v.id}">{$v.title}</option>
-                                {/volist}
-                            </select>
+<!--                            <select name="depId" class="form-control">-->
+<!--                                <option value="0">选择科室/部门</option>-->
+<!--                                {volist name="deps" id="v"}-->
+<!--                                <option value="{$v.id}">{$v.title}</option>-->
+<!--                                {/volist}-->
+<!--                            </select>-->
+                            {:widget('common/select',['name'=>'depId','lists'=>$deps,'value'=>isset($info['dep_id'])?$info['dep_id']:''])}
                         </div>
                     </div>
 
                     <div class="form-group">
                         <label class="col-sm-2 control-label">角色<span class="text-danger">*</span></label>
                         <div class="col-sm-6">
-                            <select name="rolesId" onchange="setBx(this.value)" class="form-control">
-                                <option value="0">选择角色</option>
-                                {volist name="roles" id="v"}
-                                <option value="{$v.id}">{$v.title}</option>
-                                {/volist}
-                            </select>
+<!--                            <select name="rolesId" onchange="setBx(this.value)" class="form-control">-->
+<!--                                <option value="0">选择角色</option>-->
+<!--                                {volist name="roles" id="v"}-->
+<!--                                <option value="{$v.id}">{$v.title}</option>-->
+<!--                                {/volist}-->
+<!--                            </select>-->
+                            {:widget('common/select',['name'=>'rolesId','lists'=>$roles,'value'=>isset($info['roles_id'])?$info['roles_id']:''])}
                         </div>
                     </div>
                     <div class="form-group">
@@ -123,8 +125,8 @@
     }
     $(document).ready(function(){
         formSetValue("enable", {$info.enable|default=1});
-        formSetValue("depId", {$info.dep_id|default=0});
-        formSetValue("rolesId", {$info.roles_id|default=0});
+        // formSetValue("depId", {$info.dep_id|default=0});
+        // formSetValue("rolesId", {$info.roles_id|default=0});
     });
 
 </script>

+ 12 - 0
application/api/controller/v1/Dep.php

@@ -6,10 +6,22 @@ use think\Db;
 
 class Dep extends Base
 {
+    public function cateList(){
+        $lists = Db::name('dep_cate')
+            ->field('id,title')
+            ->where('org_id',$this->orgId)
+            ->where('enable',1)
+            ->where('del',0)
+            ->select();
+        array_unshift($lists,['id'=>0,'title'=>'未分组']);
+        HelpHander::success($lists);
+    }
     public function list(){
+        $cateId = input('cate_id',-1);
         $lists = Db::name('dep')
             ->field('id,title')
             ->where('org_id',$this->orgId)
+            ->where('cate_id',$cateId)
             ->where('enable',1)
             ->where('del',0)
             ->where('is_show',0)

+ 2 - 1
application/api/controller/v1/Orders.php

@@ -504,7 +504,8 @@ class Orders extends Base {
         $currOrderMode = input('currOrderMode');
         $beginTime = input('beginTime');
         $endTime = input('endTime');
-        $list = $this->model->queryAllOrder($this->orgId,$page,$size,$workTypeMode,$currOrderMode,$beginTime,$endTime);
+        $content = input('content');
+        $list = $this->model->queryAllOrder($this->orgId,$page,$size,$workTypeMode,$currOrderMode,$beginTime,$endTime,$content);
         HelpHander::success($list);
     }
 

+ 1 - 0
application/api/controller/v1/User.php

@@ -14,6 +14,7 @@ class User extends Base
                 ->value('name');
             $info['orgName'] = $orgName;
             $info['h5pre'] = config('app.addr_url');
+            $info['h5dev'] = config('app.device_url');
             HelpHander::success($info);
         }else{
             HelpHander::error(model('User')->getError());

+ 15 - 0
application/common.php

@@ -1643,3 +1643,18 @@ function getMinFromRange($startdate, $enddate){
 
     return $date;
 }
+
+//过了emoji等表情包
+function removeEmojiChar($str)
+{
+    $mbLen = mb_strlen($str);
+    $strArr = [];
+    for ($i = 0; $i < $mbLen; $i++) {
+        $mbSubstr = mb_substr($str, $i, 1, 'utf-8');
+        if (strlen($mbSubstr) >= 4) {
+            continue;
+        }
+        $strArr[] = $mbSubstr;
+    }
+    return implode('', $strArr);
+}

+ 101 - 24
application/common/model/Daily.php

@@ -294,36 +294,113 @@ class Daily extends Base {
             ->where('org_id',$orgId)
             ->select();
 
-        $list = $list?$list:array();
+        $list = $list?$list->toArray():array();
         $count = $count1 = $count2 =$count3 = 0;
 
-        foreach ($list as $k=>$v){
-            $list[$k]['title'] = '';
-            if($v['address_id'] >0){
-                $list[$k]['title'] = Db::name('address')
-                    ->where('id',$v['address_id'])
-                    ->value('title');
+//        foreach ($list as $k=>$v){
+//            $list[$k]['title'] = '';
+//            if($v['address_id'] >0){
+//                $list[$k]['title'] = Db::name('address')
+//                    ->where('id',$v['address_id'])
+//                    ->value('title');
+//            }
+//            $query = Db::name('daily_record')
+//                ->where('org_id',$orgId)
+//                ->where('daily_id',$v['id']);
+//            $list[$k]['count'] = $query
+//                ->count();
+//            $count += $list[$k]['count'];
+//            //本月
+//            $list[$k]['count1'] = $query
+//                ->where('create_yyyymm',date('Ym'))
+//                ->count();
+//            $count1 += $list[$k]['count1'];
+//            //本周
+//            $list[$k]['count2'] = $query
+//                ->whereIn('create_yyyymmdd',get_week_date())
+//                ->count();
+//            $count2 += $list[$k]['count2'];
+//            //今天
+//            $list[$k]['count3'] = $query
+//                ->where('create_yyyymmdd',date('Ymd'))
+//                ->count();
+//            $count3 += $list[$k]['count3'];
+//        }
+        $addressIds = array_column($list, 'address_id');
+        $addressIds = array_filter(array_unique($addressIds)); // 去重并过滤0值
+        $addressTitles = [];
+        if (!empty($addressIds)) {
+            $addressTitles = Db::name('address')
+                ->where('id', 'in', $addressIds)
+                ->column('title', 'id');
+        }
+
+        $dailyIds = array_column($list, 'id');
+
+        $totalCounts = [];
+        $totalResults = Db::name('daily_record')
+            ->where('org_id', $orgId)
+            ->where('daily_id', 'in', $dailyIds)
+            ->field('daily_id, COUNT(*) as count')
+            ->group('daily_id')
+            ->select();
+        foreach ($totalResults as $item) {
+            $totalCounts[$item['daily_id']] = $item['count'];
+        }
+
+        $currentMonth = date('Ym');
+        $monthCounts = [];
+        $monthResults = Db::name('daily_record')
+            ->where('org_id', $orgId)
+            ->where('daily_id', 'in', $dailyIds)
+            ->where('create_yyyymm', $currentMonth)
+            ->field('daily_id, COUNT(*) as count')
+            ->group('daily_id')
+            ->select();
+        foreach ($monthResults as $item) {
+            $monthCounts[$item['daily_id']] = $item['count'];
+        }
+
+        $weekDates = get_week_date();
+        $weekCounts = [];
+        if (!empty($weekDates)) {
+            $weekResults = Db::name('daily_record')
+                ->where('org_id', $orgId)
+                ->where('daily_id', 'in', $dailyIds)
+                ->where('create_yyyymmdd', 'in', $weekDates)
+                ->field('daily_id, COUNT(*) as count')
+                ->group('daily_id')
+                ->select();
+            foreach ($weekResults as $item) {
+                $weekCounts[$item['daily_id']] = $item['count'];
             }
-            $query = Db::name('daily_record')
-                ->where('org_id',$orgId)
-                ->where('daily_id',$v['id']);
-            $list[$k]['count'] = $query
-                ->count();
+        }
+
+        $today = date('Ymd');
+        $todayCounts = [];
+        $todayResults = Db::name('daily_record')
+            ->where('org_id', $orgId)
+            ->where('daily_id', 'in', $dailyIds)
+            ->where('create_yyyymmdd', $today)
+            ->field('daily_id, COUNT(*) as count')
+            ->group('daily_id')
+            ->select();
+        foreach ($todayResults as $item) {
+            $todayCounts[$item['daily_id']] = $item['count'];
+        }
+
+        $count = $count1 = $count2 = $count3 = 0;
+        foreach ($list as $k => $v) {
+            $list[$k]['title'] = $addressTitles[$v['address_id']] ?? '';
+
+            $list[$k]['count'] = $totalCounts[$v['id']] ?? 0;
+            $list[$k]['count1'] = $monthCounts[$v['id']] ?? 0;
+            $list[$k]['count2'] = $weekCounts[$v['id']] ?? 0;
+            $list[$k]['count3'] = $todayCounts[$v['id']] ?? 0;
+
             $count += $list[$k]['count'];
-            //本月
-            $list[$k]['count1'] = $query
-                ->where('create_yyyymm',date('Ym'))
-                ->count();
             $count1 += $list[$k]['count1'];
-            //本周
-            $list[$k]['count2'] = $query
-                ->whereIn('create_yyyymmdd',get_week_date())
-                ->count();
             $count2 += $list[$k]['count2'];
-            //今天
-            $list[$k]['count3'] = $query
-                ->where('create_yyyymmdd',date('Ymd'))
-                ->count();
             $count3 += $list[$k]['count3'];
         }
         return array('list'=>$list,'count'=>$count,'count1'=>$count1,'count2'=>$count2,'count3'=>$count3);

+ 22 - 10
application/common/model/DepCate.php

@@ -2,6 +2,7 @@
 namespace app\common\model;
 
 use think\Db;
+use think\Exception;
 
 class DepCate extends Base
 {
@@ -18,19 +19,30 @@ class DepCate extends Base
             return false;
         }
         $id = $data['id'];
-        unset($data['id']);
-        if($id > 0){
-            $data['update_time'] = date('Y-m-d H:i:s');
-            $ret = $this->allowField(true)->save($data,['id'=>$id]);
-        }else{
-            $data['create_time'] = date('Y-m-d H:i:s');
-            $ret = $this->allowField(true)->save($data);
+        $depIds = $data['deps'];
+        unset($data['id'],$data['deps']);
+        Db::startTrans();
+        try{
+            if($id > 0){
+                Db::name('dep')->where('cate_id',$id)->update(['cate_id'=>0]);
+                $data['update_time'] = date('Y-m-d H:i:s');
+                $res = Db::name('dep')->whereIn('id',$depIds)->update(['cate_id'=>$id]);
+                $ret = $this->allowField(true)->save($data,['id'=>$id]);
+            }else{
+                $data['create_time'] = date('Y-m-d H:i:s');
+                $res = $this->insertGetId($data);
+                $ret = Db::name('dep')->whereIn('id',$depIds)->update(['cate_id'=>$res]);
+            }
+        if (!$ret || !$res){
+            \exception('操作失败');
         }
-        if(!$ret){
-            $this->error = '操作失败';
+            Db::commit();
+            return true;
+        }catch (Exception $e){
+            Db::rollback();
+            $this->error = $e->getMessage();
             return false;
         }
-        return true;
     }
     public function getList($orgId=0){
         if($orgId==0){

+ 5 - 1
application/common/model/Orders.php

@@ -696,6 +696,7 @@ class Orders extends Base {
         $v['videos'] = $v['videos']?$v['videos']:'';
         $v['voices'] = $v['voices']?$v['voices']:'';
         $v['images'] = $v['images']?$v['images']:'';
+        $v['ps'] = $v['ps']??'';
         $v['repair'] = null;
         if ($v['work_type_mode'] == 1) {
             $v['repair'] = [];
@@ -2404,7 +2405,7 @@ class Orders extends Base {
         return $data;
     }
     //所有订单列表
-    public function queryAllOrder($orgId,$page,$size,$workTypeMode,$currOrderMode,$beginTime,$endTime){
+    public function queryAllOrder($orgId,$page,$size,$workTypeMode,$currOrderMode,$beginTime,$endTime,$content){
         if(in_array($workTypeMode,[0,1,2,3,4,15])){
             $map[] = ['work_type_mode','=',$workTypeMode];
         }
@@ -2417,6 +2418,9 @@ class Orders extends Base {
         if($endTime){
             $map[] = ['create_time','<=',$endTime.' 23:59:59'];
         }
+        if($content){
+            $map[] = ['content','like','%'.$content.'%'];
+        }
         $map[] = ['del', '=', 0];
         $map[] = ['org_id', '=', $orgId];
         $offset = ($page - 1) * $size;

+ 1 - 0
application/common/validate/DepCate.php

@@ -7,6 +7,7 @@ class DepCate extends Validate{
 
     protected $rule = [
         'title|名称'  =>  'require|length:1,200',
+        'deps|管理部门'  =>  'require',
     ];
 
     protected $message = [

+ 81 - 0
application/h5/controller/Device.php

@@ -0,0 +1,81 @@
+<?php
+namespace app\h5\controller;
+
+use think\Controller;
+use think\Db;
+use think\facade\Cookie;
+
+class Device extends Controller
+{
+    protected $deviceId = 0;
+
+
+    public function __construct()
+    {
+        parent::__construct();
+
+        $code = input('code','','trim');
+
+        if($code){
+            Cookie::set('code',$code);
+        }
+
+        $nCode = Cookie::get('code');
+
+        if(!$nCode){
+            $this->redirect(url('/h5/index/errortxt'));
+        }
+
+        $arr = get_qrcode_arr($nCode);
+
+        if(!isset($arr['type'])){
+            $this->redirect(url('/h5/index/errortxt'));
+        }
+        $this->deviceId = $arr['id'];
+    }
+
+
+    public function index(){
+            $info = Db::name('device')
+                ->where('id',$this->deviceId)
+                ->find();
+            $info['imgs'] = $info['imgs']?explode(',',$info['imgs']):[];
+            $df = $info['device_form']?explode(',',$info['device_form']):[];
+            $deviceForm = Db::name('device_form')->whereIn('id',$df)->column('title');
+            $info['device_form'] = $deviceForm ? implode(',',$deviceForm):'';
+            $users = Db::name('device_user')
+                ->alias('du')
+                ->join('user u','u.id=du.user_id')
+                ->where('u.enable',1)
+                ->where('u.del',0)
+                ->where('du.device_id',$info['id'])
+                ->column('u.real_name');
+            $info['device_form'] = $deviceForm ? implode(',',$deviceForm):'';
+            $info['users'] = $users ? implode(',',$users):'';
+            $lists = Db::name('device_record')
+            ->where('device_id',$this->deviceId)
+            ->order('id desc')
+            ->field('id,user_id,create_time')
+            ->paginate(10,true)
+            ->each(function($item,$key){
+                $item['userName'] = Db::name('user')->where('id',$item['user_id'])->value('real_name');
+                return $item;
+            });
+            $page = $lists->render();
+            $this->assign('page',$page);
+            $this->assign('lists',$lists);
+            $this->assign('info',$info);
+            return  $this->fetch();
+    }
+    public function detail($id){
+        $info = Db::name('device_record')->where('id',$id)->find();
+        $info['userName'] = Db::name('user')->where('id',$info['user_id'])->value('real_name');
+        $info['images'] = $info['images'] ? explode(',',$info['images']):[];
+        $info['content'] = strip_tags($info['content']);
+        $info['check_json'] = json_decode($info['check_json'],true);
+        $this->assign('info',$info);
+        return $this->fetch();
+    }
+}
+
+

+ 132 - 0
application/h5/view/device/detail.html

@@ -0,0 +1,132 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>检查记录详情</title>
+    <link rel="stylesheet" href="/static/bootstrap-3.3.7/css/bootstrap.min.css" />
+    <style>
+        table{
+            font-size: 1.8rem;
+        }
+        tr{
+            cursor: pointer;
+        }
+        td{
+            max-width: 200px;
+        }
+    </style>
+</head>
+<body>
+<div>
+    <div class="ibox-content">
+    </div>
+    <table class="table table-bordered text-center" style="width: 100%;">
+        <tr>
+            <th class="text-center" colspan="3">详情信息</th>
+        </tr>
+        <tr>
+            <td>记录ID:</td>
+            <td>{$info['id']}</td>
+        </tr>
+        <tr>
+            <td>检查时间:</td>
+            <td>{$info['create_time']}</td>
+        </tr>
+        <tr>
+            <td>检查人员:</td>
+            <td>{$info['userName']}</td>
+        </tr>
+        <tr>
+            <td>检查内容:</td>
+            <td>{$info['content']}</td>
+        </tr>
+        <tr>
+            <td>检查图片:</td>
+            <td>
+                {if $info['images'] }
+                {foreach $info['images'] as $k=>$v}
+                <img src="{$v}" alt="" width="50px" height="50px" onclick="open_img(this)">
+                {/foreach}
+                {/if}
+            </td>
+        </tr>
+        <tr>
+            <td>维护表单:</td><td>
+            <table class="table table-bordered">
+                <thead>
+                <tr>
+                    <th>序号</th>
+                    <th>内容</th>
+                    <th>完成</th>
+                </tr>
+                </thead>
+                <tbody>
+                {foreach $info['check_json'] as $k=>$v}
+                <tr>
+                    <td>{$k+1}</td>
+                    <td>{$v['title']}</td>
+                    {if ($v['result']  == 1)}
+                    <td><input type="checkbox" checked disabled></td>
+                    {else}
+                    <td><input type="checkbox"  disabled></td>
+                    {/if}
+                </tr>
+                {/foreach}
+                </tbody>
+            </table>
+        </td>
+        </tr>
+    </table>
+    <p><br></p>
+</div>
+<script src="/static/jquery-1.11.3.min.js"></script>
+<script src="/static/layer3.2.0/layer.js"></script>
+<script>
+    //打开查看图片
+    function open_img(_self) {
+        var src = $(_self).attr('src');
+        var img = new Image();
+        img.src = src;
+        var width = $(window).width()*0.8;
+        var height = $(window).height()*0.8;
+        img.onload = function(){
+            var imgw = img.width;
+            var imgh = img.height;
+            if(imgw > width&&imgh < height){
+                imgh = imgh*width/imgw;
+                imgw = width;
+            }else if(imgw < width&&imgh > height){
+                imgw = imgw*height/imgh;
+                imgh = height;
+            }else if(imgw > width&&imgh > height){
+                var bl1 = width/height;
+                var bl2 = imgw/imgh;
+                if(bl1 < bl2){
+                    imgh = imgh*width/imgw;
+                    imgw = width;
+                }else if(bl1 > bl2){
+                    imgw = imgw*height/imgh;
+                    imgh = height;
+                }else{
+                    imgh = height;
+                    imgw = width;
+                }
+            }
+            var imgs = '<img width="'+imgw+'" height="'+imgh+'" src="'+src+'" />';
+            layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 1,
+                area: [imgw+'px', imgh+'px'],
+                skin: 'layui-layer-nobg', //没有背景色
+                shadeClose: true,
+                content: imgs
+            });
+        };
+    }
+</script>
+</body>
+</html>

+ 154 - 0
application/h5/view/device/index.html

@@ -0,0 +1,154 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>{$info['title']}设备信息</title>
+    <link rel="stylesheet" href="/static/bootstrap-3.3.7/css/bootstrap.min.css" />
+    <style>
+        table{
+            font-size: 1.8rem;
+        }
+        tr{
+            cursor: pointer;
+        }
+        .form-group{
+            margin-top: 10px;
+        }
+    </style>
+</head>
+<body>
+<div>
+    <div class="ibox-content">
+        <div class="form-group">
+            <label class="col-xs-12 control-label">
+                {if $info['imgs'] }
+                {foreach $info['imgs'] as $k=>$v}
+                <img src="{$v}" alt="" width="100px" height="100px" onclick="open_img(this)">
+                {/foreach}
+                {/if}
+            </label>
+        </div>
+    </div>
+    <p><br></p>
+    <table class="table table-bordered text-center" style="width: 100%;">
+        <tr>
+            <th class="text-center" colspan="3">设备信息</th>
+        </tr>
+        <tr>
+            <td>设备名称:</td>
+            <td>{$info['title']}</td>
+        </tr>
+        <tr>
+            <td>设备编号:</td>
+            <td>{$info['sn']}</td>
+        </tr>
+        <tr>
+            <td>设备型号:</td>
+            <td>{$info['spec']}</td>
+        </tr>
+        <tr>
+            <td>服务区域:</td>
+            <td>{$info['area']}</td>
+        </tr>
+        <tr>
+            <td>生产厂家:</td>
+            <td>{$info['producer']}</td>
+        </tr>
+        <tr>
+            <td>维保项:</td>
+            <td style="max-width: 200px">{$info['device_form']}</td>
+        </tr>
+        <tr>
+            <td>维修人员:</td>
+            <td style="max-width: 200px">{$info['users']}</td>
+        </tr>
+        <tr>
+            <td>设备详情:</td>
+            <td style="max-width: 200px">{$info['content']}</td>
+        </tr>
+    </table>
+    <table class="table table-striped text-center" style="width: 100%;">
+        <tr>
+            <th class="text-center" colspan="4" >
+                工作任务
+            </th>
+        </tr>
+        <tr>
+            <th class="text-center">编号</th>
+            <th class="text-center">检查人员</th>
+            <th class="text-center">检查时间</th>
+            <th class="text-center">操作</th>
+        </tr>
+        {notempty name="lists"}
+        {volist name="lists" id="v"}
+        <tr>
+
+            <td>{$v.id}</td>
+            <td>{$v.userName}</td>
+            <td>{$v.create_time}</td>
+            <td><a href="{:url('detail',['id'=>$v['id']])}">详情</a></td>
+        </tr>
+        {/volist}
+        {else /}
+        <tr>
+            <td colspan="7">暂无数据</td>
+        </tr>
+        {/notempty}
+    </table>
+    {$page|raw}
+    <p><br></p>
+</div>
+<script src="/static/jquery-1.11.3.min.js"></script>
+<script src="/static/layer3.2.0/layer.js"></script>
+<script>
+    function gotourl(_self) {
+        window.location.href = $(_self).attr('data-url');
+    }
+    //打开查看图片
+    function open_img(_self) {
+        var src = $(_self).attr('src');
+        var img = new Image();
+        img.src = src;
+        var width = $(window).width()*0.8;
+        var height = $(window).height()*0.8;
+        img.onload = function(){
+            var imgw = img.width;
+            var imgh = img.height;
+            if(imgw > width&&imgh < height){
+                imgh = imgh*width/imgw;
+                imgw = width;
+            }else if(imgw < width&&imgh > height){
+                imgw = imgw*height/imgh;
+                imgh = height;
+            }else if(imgw > width&&imgh > height){
+                var bl1 = width/height;
+                var bl2 = imgw/imgh;
+                if(bl1 < bl2){
+                    imgh = imgh*width/imgw;
+                    imgw = width;
+                }else if(bl1 > bl2){
+                    imgw = imgw*height/imgh;
+                    imgh = height;
+                }else{
+                    imgh = height;
+                    imgw = width;
+                }
+            }
+            var imgs = '<img width="'+imgw+'" height="'+imgh+'" src="'+src+'" />';
+            layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 1,
+                area: [imgw+'px', imgh+'px'],
+                skin: 'layui-layer-nobg', //没有背景色
+                shadeClose: true,
+                content: imgs
+            });
+        };
+    }
+</script>
+</body>
+</html>

+ 1 - 0
config/app.php

@@ -250,6 +250,7 @@ return [
     ],
 
     'addr_url' => request()->domain().'/h5/repair/index?code=',
+    'device_url' => request()->domain().'/h5/device/index?code=',
 
 
     // 上传excel文件

Fichier diff supprimé car celui-ci est trop grand
+ 24 - 0
public/static/xlsx.full.min.js