Ver código fonte

订单扫码统计

ANG YU 4 anos atrás
pai
commit
b71c03489c

+ 5 - 0
app/Http/Controllers/ScanInfoDetailController.php

@@ -11,4 +11,9 @@ class ScanInfoDetailController extends Controller
     {
         return view('personnel.scanInfo.index');
     }
+
+    public function detailIndex()
+    {
+        return view('personnel.scanInfo.detail.index');
+    }
 }

+ 203 - 0
resources/views/personnel/scanInfo/detail/index.blade.php

@@ -0,0 +1,203 @@
+@extends('layouts.app')
+@section('title')扫描计件-详情@endsection
+@section('content')
+    <div class="d-none" id="list">
+        <!--查询            -->
+        <div class="row m-3" style="background-color: #fff;">
+            <!-- 分页数量            -->
+            <div class="form-group m-2">
+                <select class="form-control selectpicker" title="分页大小" v-model="size">
+                    <option value="50">50</option>
+                    <option value="100">100</option>
+                    <option value="200">200</option>
+                    <option value="500">500</option>
+                    <option value="1000">1000</option>
+                </select>
+            </div>
+            <!--用户-->
+            <div class="form-group m-2" style="max-width: 200px !important;">
+                <select v-model="search.userIds" class="selectpicker form-control" multiple title="选择用户"
+                        data-actions-box="true"
+                        data-live-search="true"
+                        data-live-search-placeholder="搜索"
+                >
+                    <option v-for="(v,k) of users" :value="v.id" :key="v.id">@{{ v.name }}</option>
+                </select>
+            </div>
+            <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="起始日期">
+                <input v-model="search.startTime" class="form-control" type="date">
+            </div>
+
+            <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="截止日期">
+                <input v-model="search.endTime" class="form-control" type="date">
+            </div>
+
+            <div class="form-group m-2">
+                <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
+            </div>
+
+            <div class="form-group m-2">
+                <button class="form-control btn btn-sm btn-success" @click="resetSearch()">重置</button>
+            </div>
+        </div>
+
+        <!--            导出-->
+        <span class="dropdown"></span>
+        <!--            表格-->
+        <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
+               style="background: #fff;" id="table">
+            <tr v-for="(item,i) in details.data" :key="i">
+                <td class="td-warm text-muted"><span>@{{ i+1 }}</span></td>
+                <td class="td-warm text-muted"><span>@{{ item.username }}</span></td>
+                <td class="td-warm text-muted"><span>@{{ item.macAddress }}</span></td>
+                <td class="td-warm text-muted"><span>@{{ item.content }}</span></td>
+                <td class="td-warm text-muted"><span>@{{ item.createTime }}</span></td>
+            </tr>
+        </table>
+        <nav aria-label="...">
+            <ul class="pagination">
+                <li class="page-item" :class="current===1?'disabled':''">
+                    <button class="page-link" @click="pagination('pre')">上一页</button>
+                </li>
+                <li class="page-item" :class="current===details.pages?'disabled':''">
+                    <button class="page-link" @click="pagination('next')">下一页</button>
+                </li>
+            </ul>
+        </nav>
+    </div>
+
+
+@endsection
+
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                users: [],
+                selectTr: '',
+                details: {
+                    data: [],
+                    total: null,
+                    current: null,
+                    pages: null,
+                    size: null
+                },
+                size: 50,
+                current: 1,
+                search: {
+                    startTime: '',
+                    endTime: '',
+                    userIds: [],
+                }
+            },
+            created() {
+                this.initData();
+                let url = this.getBaseUrl();
+                url += `/api/device/listPage?size=${this.size}&current=${this.current}`;
+                axios.post(url, this.search).then(res => {
+                    this.details.data = res.data.data.list;
+                    this.details.total = res.data.data.page.total;
+                    this.details.current = res.data.data.page.pageNum;
+                    this.details.pages = res.data.data.page.pages
+                    this.details.size = res.data.data.page.pageSize;
+                });
+            },
+            mounted: function () {
+                $('#list').removeClass('d-none');
+                let column = [
+                    {name: 'username', value: '用户'},
+                    {name: 'macAddress', value: 'MAC地址'},
+                    {name: 'content', value: '单号'},
+                    {name: 'createTime', value: '时间'},
+                ];
+                new Header({
+                    el: "table",
+                    name: "details",
+                    column: column,
+                    data: this.details.data,
+                    restorationColumn: 'addtime',
+                    fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
+                }).init();
+            },
+            methods: {
+                resetSearch() {
+                    this.current = 1;
+                    this.size = 50;
+                    this.search = {
+                        startTime: null,
+                        endTime: null,
+                        customerCodeList: [],
+                    };
+                },
+                searchData() {
+                    this.current = 1;
+                    this.pagination();
+                },
+                //根据环境获取不同的url
+                getBaseUrl() {
+                    let url = '';
+                    let env = "{{ config('app.env') }}";
+                    if (env === 'local') {
+                        url = 'http://127.0.0.1:8116'
+                    } else if (env === 'production') {
+                        url = 'https://device.baoshi56.com'
+                    }
+                    return url;
+                },
+                pagination(flag) {
+                    if (flag === 'pre' && this.current > 1) {
+                        this.current--;
+                    } else if (flag === 'next' && this.current < this.details.pages) {
+                        this.current++;
+                    }
+                    let env = "{{ config('env') }}";
+                    console.log(env);
+                    let url = this.getBaseUrl();
+
+                    url += `/api/device/listPage?size=${this.size}&current=${this.current}`;
+                    let search = Object.assign({}, this.search)
+                    if (search.startTime != null && search.startTime !== '') {
+                        search.startTime += " 00:00:00";
+                    }
+                    if (search.endTime != null && search.endTime !== '') {
+                        search.endTime += " 23:59:59";
+                    }
+                    axios.post(url, search).then(res => {
+                        if (res.data.data === undefined) {
+                            this.details.data = [];
+                            this.details.total = 0
+                            this.details.current = 1
+                            this.details.pages = 0
+                            this.details.size = 50;
+                        } else {
+                            this.details.data = res.data.data.list;
+                            this.details.total = res.data.data.page.total;
+                            this.details.current = res.data.data.page.pageNum;
+                            this.details.pages = res.data.data.page.pages
+                            this.details.size = res.data.data.page.pageSize;
+                        }
+                    });
+                },
+
+                //初始化数据 大类型和小类型的初始化,完成后才可以渲染页面
+                initData() {
+                    let names = ['device/users'];
+                    let requests = names.map(name => axios.get(this.getBaseUrl() + "/api/" + name));
+                    Promise.all(requests).then(resList => {
+                        for (let res of resList) {
+                            if ((res.config.url + '').endsWith('users')) {
+                                this.users = res.data.data;
+                            }
+                        }
+                        setTimeout(() => {
+                            $(".selectpicker").selectpicker('refresh');
+                            $('#list').removeClass('d-none');
+                        }, 50);
+                    });
+                },
+            },
+        });
+    </script>
+@endsection

+ 10 - 7
resources/views/personnel/scanInfo/index.blade.php

@@ -25,7 +25,7 @@
                 </select>
             </div>
             <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="起始日期">
-                <input v-model="search.startTime" class="form-control" type="date" >
+                <input v-model="search.startTime" class="form-control" type="date">
             </div>
 
             <div class="form-group m-2" data-toggle="tooltip" data-placement="top" title="截止日期">
@@ -93,7 +93,7 @@
             created() {
                 this.initData();
                 let url = this.getBaseUrl();
-                url += `/api/device/listPage?size=${this.size}&current=${this.current}`;
+                url += `/api/device/group/listPage?size=${this.size}&current=${this.current}`;
                 axios.post(url, this.search).then(res => {
                     this.details.data = res.data.data.list;
                     this.details.total = res.data.data.page.total;
@@ -152,11 +152,14 @@
                     console.log(env);
                     let url = this.getBaseUrl();
 
-                    url += `/api/device/listPage?size=${this.size}&current=${this.current}`;
-                    let search =  Object.assign({}, this.search)
-
-                    search.startTime += " 00:00:00";
-                    search.endTime += " 23:59:59";
+                    url += `/api/device/group/listPage?size=${this.size}&current=${this.current}`;
+                    let search = Object.assign({}, this.search)
+                    if (search.startTime != null && search.startTime !== '') {
+                        search.startTime += " 00:00:00";
+                    }
+                    if (search.endTime != null && search.endTime !== '') {
+                        search.endTime += " 23:59:59";
+                    }
                     axios.post(url, search).then(res => {
                         if (res.data.data === undefined) {
                             this.details.data = [];

Diferenças do arquivo suprimidas por serem muito extensas
+ 506 - 466
routes/web.php


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff