shuishen
2023-01-06 05eae3efbb38ef2c71791a5619a0115c9eb5f4ed
src/views/home/components/bottomContainer.vue
@@ -12,12 +12,12 @@
                        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 @change="datePickerChange" v-show="timetype == 0" v-model="currentWeekTime"
                        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 @change="datePickerChange" v-show="timetype == 1" v-model="currentMonthTime"
                        type="month" :picker-options="pickerOptions" placeholder="选择月">
                    </el-date-picker>
                </div>
                <div class="history-tab">
@@ -51,15 +51,15 @@
                        <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="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>
                            <span class="receiving-alarm-unit" v-text="item.JJDWMC"></span>
                            <span class="receiving-alarm-people" v-text="item.JJYXM"></span>
                            <span class="receiving-alarm-time" v-text="item.JJSJ"></span>
                            <span class="call-people" v-text="item.BJRXM"></span>
                            <span class="call-phone" v-text="item.LXDH"></span>
                            <span class="call-police-content" v-text="item.BJNR"></span>
                            <span class="incident-site" v-text="item.SFDZ"></span>
                            <span class="call-police-type" v-text="item.BJLX"></span>
                            <span class="alarm-bz" v-text="item.MEMO"></span>
                        </li>
                    </ul>
                </vue-seamless-scroll>
@@ -105,7 +105,7 @@
import vueSeamlessScroll from 'vue-seamless-scroll'
import historyArr from '@/assets/data/policeSituationArr/historyArr.js'
import { getCallPolices, getAnswerPolices } from "@/api/home/index.js"
import { getCallPolices, getAnswerPolices, getAlarmList } from "@/api/home/index.js"
export default {
    data () {
@@ -118,7 +118,8 @@
            policeSituationHistoryArr: [],
            policeSituationHistorySaveArr: [],
            eventTime: '',
            currentTime: '',
            currentWeekTime: '',
            currentMonthTime: '',
            pickerOptions: {}, // 日期设置对象
            classOption: {
                step: 1
@@ -151,14 +152,7 @@
    },
    created () {
        this.policeSituationHistoryArr = historyArr
        this.policeSituationHistorySaveArr = historyArr
        this.getAnswerPolices()
        setInterval(() => {
            console.log(this.currentTime)
        }, 5000)
        // disabledDate 为true表示不可选,false表示可选
        this.pickerOptions = {
@@ -178,10 +172,12 @@
    },
    methods: {
        // 时间改变事件
        datePickerChange (e) {
            // this.timetype
            const dateStr = this.dateFormat(e)
            this.getAlarmList(this.timetype, dateStr)
        },
        // 获取当前日期
@@ -196,94 +192,72 @@
            return time
        },
        // 获取实时接警记录
        getAnswerPolices () {
            // getCallPolices().then(res => {
            //     res.data.result
            // })
            // getAnswerPolices().then(res => {
            //     this.policeSituationRealtimeArr = res.data.result
            // })
            this.policeSituationRealtimeArr = [
                {
                    JJDW: '公安局',
                    position: [112, 28]
                },
                {
                    JJDW: '派出所'
                },
            ]
            this.policeSituationRealtimeArr = [{
                ZDDWXZB: 112,
                ZDDWYZB: 25,
                JJDWMC: '公安局'
            },
            {
                JJDWMC: '公安局'
            }]
        },
        // 获取历史接警记录
        getAlarmList (type, time) {
            getAlarmList(type, time).then(res => {
                this.policeSituationHistoryArr = res.data.result
            })
        },
        // 周月选择
        timeTabClick (type) {
            this.timetype = type
            if (type == 0) {
                this.getAlarmList(type, this.dateFormat(this.currentWeekTime))
            } else {
                this.currentMonthTime == '' ? this.currentMonthTime = new Date() : ''
                this.getAlarmList(type, this.dateFormat(this.currentMonthTime))
            }
            this.$emit('changePoliceSituationTimeType', type)
            this.$emit('policeSituationChange')
        },
        // 实时历史选择
        historyTabClick (type) {
            this.historytype = type
            this.currentWeekTime = new Date()
            if (type == 0) {
                this.getAnswerPolices()
            } else {
                this.policeSituationHistoryArr = this.chooseMouthTimeDate(this.policeSituationHistorySaveArr)
                this.getAlarmList(type, this.dateFormat(this.currentWeekTime))
            }
        },
        historyTabClick (type) {
            this.historytype = type
            this.$emit('changePoliceSituationHistoryType', type)
            this.$emit('policeSituationChange')
        },
        chooseWeekTimeDate (arr) {
            let lastWeekArr = []
            let realtimeTimeStamp = new Date().valueOf() - 24 * 60 * 60 * 1000
            let lastWeekTimeStamp = new Date().valueOf() - 7 * 24 * 60 * 60 * 1000
            arr.forEach(item => {
                if (new Date(item.dealTime).valueOf() < realtimeTimeStamp && new Date(item.dealTime).valueOf() > lastWeekTimeStamp) {
                    lastWeekArr.push(item)
                }
            })
            return lastWeekArr
        chooseWeekTimeDate () {
            return this.policeSituationHistoryArr
        },
        chooseMouthTimeDate (arr) {
            let lastMouthArr = []
            let realtimeTimeStamp = new Date().valueOf() - 24 * 60 * 60 * 1000
            let lastMouthTimeStamp = new Date().valueOf() - 30 * 24 * 60 * 60 * 1000
            arr.forEach(item => {
                if (new Date(item.dealTime).valueOf() < realtimeTimeStamp && new Date(item.dealTime).valueOf() > lastMouthTimeStamp) {
                    lastMouthArr.push(item)
                }
            })
            return lastMouthArr
        chooseMouthTimeDate () {
            return this.policeSituationHistoryArr
        },
        policeSituationClick (item) {
            if (item.position) {
                this.$EventBus.$emit('toPosition', {
                    layerName: 'policeSituationyLayers',
                    siteJd: Number(item.position[0]),
                    siteWd: Number(item.position[1])
                })
                this.$store.commit('SET_DETAILSPOPUP', true)
                this.$store.commit('SET_DATAPOPUP', item)
                var popup = new global.DC.DivForms(global.viewer, {
                    domId: 'divFormsDomBox',
                    position: [
                        global.DC.Transform.transformWGS84ToCartesian(
                            new global.DC.Position(
                                Number(item.position[0]),
                                Number(item.position[1]),
                                0
                            )
                        )
                    ]
                })
            } else {
                this.$emit('policeSituationSiteClick', item)
            }
        },
        // 列表行选择
        handleSelectClick (e) {
            let element
            for (let i = 0; i < e.path.length; i++) {
@@ -296,8 +270,36 @@
            let currentItem = JSON.parse(element.dataset.obj)
            this.policeSituationClick(currentItem)
        }
        },
        // 点击定位或者显示弹窗
        policeSituationClick (item) {
            if (item.ZDDWXZB && item.ZDDWXZB != 0 && item.ZDDWYZB && item.ZDDWYZB != 0) {
                this.$EventBus.$emit('toPosition', {
                    layerName: 'policeSituationyLayers',
                    siteJd: Number(item.ZDDWXZB),
                    siteWd: Number(item.ZDDWYZB)
                })
                this.$store.commit('SET_DETAILSPOPUP', true)
                this.$store.commit('SET_DATAPOPUP', item)
                var popup = new global.DC.DivForms(global.viewer, {
                    domId: 'divFormsDomBox',
                    position: [
                        global.DC.Transform.transformWGS84ToCartesian(
                            new global.DC.Position(
                                Number(item.ZDDWXZB),
                                Number(item.ZDDWYZB),
                                0
                            )
                        )
                    ]
                })
            } else {
                this.$emit('policeSituationSiteClick', item)
            }
        }
    }
}
</script>