From 4fdf407c315aa4e0fb25e87419f441a0d7c3a8c2 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Thu, 05 Jan 2023 17:26:09 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/srs-police-affairs

---
 src/views/home/components/bottomContainer.vue |  238 ++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 137 insertions(+), 101 deletions(-)

diff --git a/src/views/home/components/bottomContainer.vue b/src/views/home/components/bottomContainer.vue
index 351871a..0ded159 100644
--- a/src/views/home/components/bottomContainer.vue
+++ b/src/views/home/components/bottomContainer.vue
@@ -8,9 +8,17 @@
                     <span class="beforetime" :class="{ choosed: timetype == 1 }" @click="timeTabClick(1)">月</span>
                 </div>
                 <div class="timeSeclect" v-show="historytype">
-                    <el-date-picker v-model="eventTime" type="daterange" align="right" unlink-panels range-separator="至"
-                        start-placeholder="开始日期" end-placeholder="结束日期"
-                        :picker-options="pickerOptions"></el-date-picker>
+                    <!-- <el-date-picker v-model="eventTime" type="daterange" align="right" unlink-panels range-separator="至"
+                        start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> -->
+
+
+                    <el-date-picker @change="datePickerChange" v-show="timetype == 0" v-model="currentTime" type="week"
+                        format="yyyy 第 WW 周" :picker-options="pickerOptions" placeholder="选择周">
+                    </el-date-picker>
+
+                    <el-date-picker @change="datePickerChange" v-show="timetype == 1" v-model="currentTime" type="month"
+                        :picker-options="pickerOptions" placeholder="选择月">
+                    </el-date-picker>
                 </div>
                 <div class="history-tab">
                     <span class="beforetime" :class="{ choosed: historytype == 0 }"
@@ -25,34 +33,40 @@
                 <ul class="title-header">
                     <li>
                         <span class="num">序号</span>
-                        <span class="type">警情类别</span>
-                        <span class="dealTime">接警时间</span>
-                        <span class="state">警情状态</span>
-                        <span class="dealPolice">经办民警</span>
-                        <span class="callPeople">报警人</span>
-                        <span class="comingPhone">报警电话</span>
-                        <span class="callPhone">报警人联系人</span>
-                        <span class="callContent">报警内容</span>
+                        <span class="receiving-alarm-unit">接警单位</span>
+                        <span class="receiving-alarm-people">接警员</span>
+                        <span class="receiving-alarm-time">接警时间</span>
+                        <span class="call-people">报警人</span>
+                        <span class="call-phone">联系电话</span>
+                        <span class="call-police-content">报警内容</span>
+                        <span class="incident-site">事发地址</span>
+                        <span class="call-police-type">报警类型</span>
+                        <span class="alarm-bz">备注</span>
                     </li>
                 </ul>
-                <vue-seamless-scroll :data="historytype == 0 ? policeSituationRealtimeArr : policeSituationHistoryArr"
-                    class="warp" :class-option="classOption">
+
+                <vue-seamless-scroll v-if="currentUseDataLength > 0" :data="listCurrentData" class="warp"
+                    :class-option="classOption">
                     <ul class="item">
-                        <li v-for="(item, index) in (historytype == 0 ? policeSituationRealtimeArr : policeSituationHistoryArr)"
-                            :key="index" :data-obj="JSON.stringify(item)" class="row">
-                            <!-- <span class="num" v-text="item.num"></span> -->
+                        <li v-for="(item, index) in listCurrentData" :key="index" :data-obj="JSON.stringify(item)"
+                            class="row">
                             <span class="num" v-text="index + 1"></span>
-                            <span class="type" v-text="item.type"></span>
-                            <span class="dealTime" v-text="item.dealTime"></span>
-                            <span class="state" v-text="item.state"></span>
-                            <span class="dealPolice" v-text="item.dealPolice"></span>
-                            <span class="callPeople" v-text="item.callPeople"></span>
-                            <span class="comingPhone" v-text="item.comingPhone"></span>
-                            <span class="callPhone" v-text="item.callPhone"></span>
-                            <span class="callContent" v-text="item.callContent"></span>
+                            <span class="receiving-alarm-unit" v-text="JJDWMC"></span>
+                            <span class="receiving-alarm-people" v-text="JJYXM"></span>
+                            <span class="receiving-alarm-time" v-text="JJSJ"></span>
+                            <span class="call-people" v-text="BJRXM"></span>
+                            <span class="call-phone" v-text="LXDH"></span>
+                            <span class="call-police-content" v-text="BJNR"></span>
+                            <span class="incident-site" v-text="SFDZ"></span>
+                            <span class="call-police-type" v-text="BJLX"></span>
+                            <span class="alarm-bz" v-text="MEMO"></span>
                         </li>
                     </ul>
                 </vue-seamless-scroll>
+
+                <div class="warp no-data" v-else>
+                    暂无数据
+                </div>
             </div>
         </div>
 
@@ -89,10 +103,9 @@
 
 <script>
 import vueSeamlessScroll from 'vue-seamless-scroll'
-import realtimeArr from '@/assets/data/policeSituationArr/realtimeArr.js'
 import historyArr from '@/assets/data/policeSituationArr/historyArr.js'
 
-import { getCallPolices } from "@/api/home/index.js"
+import { getCallPolices, getAnswerPolices } from "@/api/home/index.js"
 
 export default {
     data () {
@@ -103,33 +116,8 @@
             policeSituationHistoryArr: [],
             policeSituationHistorySaveArr: [],
             eventTime: '',
-            pickerOptions: {
-                shortcuts: [{
-                    text: '最近一周',
-                    onClick (picker) {
-                        const end = new Date()
-                        const start = new Date()
-                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-                        picker.$emit('pick', [start, end])
-                    }
-                }, {
-                    text: '最近一个月',
-                    onClick (picker) {
-                        const end = new Date()
-                        const start = new Date()
-                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-                        picker.$emit('pick', [start, end])
-                    }
-                }, {
-                    text: '最近三个月',
-                    onClick (picker) {
-                        const end = new Date()
-                        const start = new Date()
-                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
-                        picker.$emit('pick', [start, end])
-                    }
-                }]
-            },
+            currentTime: '',
+            pickerOptions: {}, // 日期设置对象
             classOption: {
                 step: 1
             }
@@ -142,12 +130,43 @@
         vueSeamlessScroll
     },
 
+    computed: {
+        listCurrentData () {
+            if (this.historytype == 0) {
+                return this.policeSituationRealtimeArr
+            } else {
+                return this.policeSituationHistoryArr
+            }
+        },
+
+        currentUseDataLength () {
+            if (this.historytype == 0) {
+                return this.policeSituationRealtimeArr.length
+            } else {
+                return this.policeSituationHistoryArr.length
+            }
+        }
+    },
+
     created () {
-        this.policeSituationRealtimeArr = realtimeArr
         this.policeSituationHistoryArr = historyArr
         this.policeSituationHistorySaveArr = historyArr
 
         this.getCallPolices()
+
+        setInterval(() => {
+            console.log(this.currentTime)
+        }, 5000)
+
+        // disabledDate 为true表示不可选,false表示可选
+        this.pickerOptions = {
+            disabledDate (time) {
+                // 设置可选择的日期为今天之后的一个月内
+                let curDate = (new Date()).getTime()
+                return time.getTime() > curDate
+            }
+
+        }
     },
 
     mounted () {
@@ -163,12 +182,44 @@
     },
 
     methods: {
+        datePickerChange (e) {
+            // this.timetype
+            const dateStr = this.dateFormat(e)
+
+        },
+
+        // 获取当前日期
+        dateFormat (dateData) {
+            var date = new Date(dateData)
+            var y = date.getFullYear()
+            var m = date.getMonth() + 1
+            m = m < 10 ? ('0' + m) : m
+            var d = date.getDate()
+            d = d < 10 ? ('0' + d) : d
+            const time = y + '-' + m + '-' + d
+            return time
+        },
+
         getCallPolices () {
-            getCallPolices().thne(res => {
-                setTimeout(() => {
-                    console.log(res, 465464)
-                }, 5000)
-            })
+            // getCallPolices().then(res => {
+            //     res.data.result
+            // })
+
+            // getAnswerPolices().then(res => {
+            //     this.policeSituationRealtimeArr = res.data.result
+            // })
+
+            this.policeSituationRealtimeArr = [
+                {
+                    JJDW: '公安局',
+                    lat: 28,
+                    lng: 112
+                },
+                {
+                    JJDW: '派出所'
+                },
+            ]
+
         },
 
         timeTabClick (type) {
@@ -186,31 +237,6 @@
             this.historytype = type
             this.$emit('changePoliceSituationHistoryType', type)
             this.$emit('policeSituationChange')
-        },
-
-        selectPoliceSituatiionArr (name) {
-            if (name == '全部') {
-                this.policeSituationRealtimeArr = realtimeArr
-                this.policeSituationHistoryArr = historyArr
-                this.timeTabClick(this.timetype)
-            } else {
-                let realtimeNewArr = []
-                let historyNewArr = []
-                realtimeArr.forEach(item => {
-                    if (item.policeName == name) {
-                        realtimeNewArr.push(item)
-                    }
-                })
-                this.policeSituationRealtimeArr = realtimeNewArr
-                historyArr.forEach(item => {
-                    if (item.policeName == name) {
-                        historyNewArr.push(item)
-                    }
-                })
-                this.policeSituationHistorySaveArr = historyNewArr
-                this.policeSituationHistoryArr = historyNewArr
-                this.timeTabClick(this.timetype)
-            }
         },
 
         chooseWeekTimeDate (arr) {
@@ -399,6 +425,12 @@
             height: calc(100% - 44px);
         }
 
+        .warp.no-data {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+        }
+
         ul {
             li {
                 height: 44px;
@@ -407,38 +439,42 @@
                 cursor: pointer;
 
                 .num {
+                    width: 6%;
+                }
+
+                .receiving-alarm-unit {
+                    width: 12%;
+                }
+
+                .receiving-alarm-people {
                     width: 8%;
                 }
 
-                .type {
+                .receiving-alarm-time {
                     width: 10%;
                 }
 
-                .state {
+                .call-people {
                     width: 8%;
                 }
 
-                .comingPhone {
-                    width: 14%;
-                }
-
-                .dealTime {
-                    width: 14%;
-                }
-
-                .dealPolice {
+                .call-phone {
                     width: 8%;
                 }
 
-                .callPeople {
+                .call-police-content {
+                    width: 12%;
+                }
+
+                .incident-site {
+                    width: 12%;
+                }
+
+                .call-police-type {
                     width: 8%;
                 }
 
-                .callPhone {
-                    width: 14%;
-                }
-
-                .callContent {
+                .alarm-bz {
                     flex: 1;
                 }
             }

--
Gitblit v1.9.3