Lou
2024-03-19 69ec1e45b56d3b6083bb5cbb102fc0a745e21574
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jczz_app
4 files modified
4 files added
608 ■■■■■ changed files
api/police/police.js 10 ●●●●● patch | view | raw | blame | history
api/user.js 1 ●●●● patch | view | raw | blame | history
manifest.json 8 ●●●● patch | view | raw | blame | history
pages.json 23 ●●●●● patch | view | raw | blame | history
pages/home/index.vue 125 ●●●●● patch | view | raw | blame | history
subPackage/police/onLine.vue 156 ●●●●● patch | view | raw | blame | history
subPackage/police/policeSituation.vue 263 ●●●●● patch | view | raw | blame | history
subPackage/police/policeSituationDetail.vue 22 ●●●●● patch | view | raw | blame | history
api/police/police.js
New file
@@ -0,0 +1,10 @@
import http from '@/http/api.js'
// 查询警情处理记录
export const getPoliceAlarmRecords = (params) => {
    return http.request({
        url: '/blade-policeAlarmRecords/policeAlarmRecords/page',
        method: 'get',
        params: params
    })
}
api/user.js
@@ -97,6 +97,7 @@
// 获取用户信息
export const getUser = (id) => {
    console.log('************************', id)
    return http.request({
        url: '/blade-system/user/detail',
        method: 'GET',
manifest.json
@@ -156,7 +156,13 @@
        "uniStatistics" : {
            "enable" : false
        },
        "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ],
        "requiredPrivateInfos" : [
            "getLocation",
            "chooseLocation",
            "onLocationChange",
            "startLocationUpdateBackground"
        ],
        "requiredBackgroundModes" : [ "location" ], //必填
        "permission" : {
            "scope.userLocation" : {
                "desc" : "定位"
pages.json
@@ -75,6 +75,29 @@
                "navigationBarBackgroundColor": "#fff",
                "navigationBarTextStyle": "black"
            }
        }, {
            "path": "subPackage/police/policeSituation",
            "style": {
                "navigationBarTitleText": "警情处置",
                // "enablePullDownRefresh": false
                "navigationBarBackgroundColor": "#fff",
                "navigationBarTextStyle": "black"
            }
        }, {
            "path": "subPackage/police/policeSituationDetail",
            "style": {
                "navigationBarTitleText": "警情处置详情",
                "enablePullDownRefresh": false
            }
        }, {
            "path": "subPackage/police/onLine",
            "style": {
                "navigationBarTitleText": "巡逻打卡",
                "enablePullDownRefresh": false
            }
        }
    ],
    "subPackages": [
pages/home/index.vue
@@ -275,7 +275,10 @@
        getFuncList,
        getHouseList
    } from "@/api/doorplateAddress/doorplateAddress";
    import {
        getUser,
        updateUserInfo
    } from "@/api/user.js"
    import {
        getPage
    } from "@/api/article/article";
@@ -537,12 +540,20 @@
            })
            //选择位置刷新楼盘表
            uni.$on('refreshPage', (val) => {
                console.log("refreshPage=>", val);
                // console.log("refreshPage=>", val);
                this.curSelectSite = val
                this.getHouseDataList(val.id)
                this.curHouseCode = this.curSelectSite.houseCode
                uni.setStorageSync("curHouseCode", this.curSelectSite.houseCode)
            })
        },
        onShow() {
            if (uni.getStorageSync('activeRole').roleAlias === 'mj' &&
                uni.getStorageSync("userInfo").status &&
                uni.getStorageSync("userInfo").status == 2) {
                console.log("*******status*****", uni.getStorageSync("userInfo").status)
                this.getRealTimeLocaltion()
            }
        },
        onShareAppMessage() {
@@ -639,7 +650,7 @@
                    neiCode: this.curSelectSite.id,
                    roleType: this.selectRole.roleName == "网格员" ? 1 : 0
                }).then(res => {
                    console.log(res);
                    // console.log(res);
                    let data = res.data;
                    let count = 0;
                    count += Number(data.bqsj) + Number(data.xfzc) + Number(data.xfyhzg) + Number(data.qbhs);
@@ -838,13 +849,13 @@
            },
            // 回调参数为包含columnIndex、value、values
            confirmSite(e) {
                console.log('confirm', e)
                // console.log('confirm', e)
                this.selectSiteIndex = e.indexs;
                this.curSelectSite = e.value[e.value.length - 1]
                this.selectBoxShow = false
                this.getHouseDataList(e.value[1]?.id)
                this.curHouseCode = e.value[0].id
                console.log("curSite=>", this.curSelectSite);
                // console.log("curSite=>", this.curSelectSite);
            },
            getMenu(menuName) {
@@ -888,7 +899,7 @@
                        if (this.sectionList.length) {
                            let list = this.sectionList.filter(item => item.name == "日常办公");
                            let taskList = list[0].children.filter(item => item.name == "待办事项");
                            console.log("taskList===>", taskList)
                            // console.log("taskList===>", taskList)
                            if (taskList.length) {
                                uni.setStorageSync("taskMenu", taskList[0].children);
                            } else {
@@ -900,7 +911,7 @@
                    }
                    if (this.roleType == 3) {
                        console.log("taskMenuList==>", taskMenuList);
                        // console.log("taskMenuList==>", taskMenuList);
                        if (taskMenuList.length) {
                            uni.setStorageSync("taskMenu", taskMenuList);
                        } else {
@@ -1061,10 +1072,10 @@
                const that = this
                uni.scanCode({
                    success: function(res) {
                        console.log("扫码结果", res)
                        // console.log("扫码结果", res)
                        let eventType = 0;
                        let obj = that.getUrlParams(res.result)
                        console.log(obj)
                        // console.log(obj)
                        if (!that.isLogin) {
                            let data = res.data;
                            that.$u.func.globalNavigator(
@@ -1181,7 +1192,101 @@
                uni.navigateTo({
                    url: `/subPackage/workbench/views/auditSite?code=${houseCode}&from=index`
                })
            }
            },
            getRealTimeLocaltion() {
                this.getDeviceGPS() //获取本机GPS状态
                wx.startLocationUpdateBackground({
                    type: 'wgs84',
                    success: (res) => {
                        console.log('res***************', res)
                        this.getBackgroundLocation();
                    },
                    fail: (err) => {
                        //授权失败后引导用户打开定位信息
                        uni.getSetting({
                            success: (res) => {
                                var statu = res.authSetting;
                                if (!statu["scope.userLocationBackground"]) {
                                    uni.showModal({
                                        title: "是否授权在使用期间和离开后!",
                                        content: "需要获取您当前的位置信息,请在位置信息中选择",
                                        success: (tip) => {
                                            if (tip.confirm) {
                                                uni.openSetting({
                                                    success: (data) => {
                                                        if (data
                                                            .authSetting[
                                                                "scope.userLocationBackground"
                                                            ] == true
                                                        ) {
                                                            this
                                                                .getBackgroundLocation();
                                                        }
                                                    }
                                                });
                                            } else {
                                                console.log('用户拒绝打开设置界面')
                                            }
                                        }
                                    });
                                }
                            }
                        });
                    }
                });
            },
            // 获取本机设备的GPS信息
            getDeviceGPS() {
                let system = uni.getSystemInfoSync();
                //如果设备的GPS未开启,locationEnabled这里会返回false,以此判断
                if (system.locationEnabled == false) {
                    //GPS未开启,返回false
                    this.userGPS = false
                    return uni.showModal({
                        content: '请在系统设置中开启GPS定位权限',
                        showCancel: false,
                        confirmText: '确认',
                        success: (res) => {
                            console.log('res:', res)
                        },
                    })
                } else {
                    //已开启,返回true
                    this.userGPS = true
                }
            },
            getBackgroundLocation() {
                //判断是否也开通了wx.onLocationChange接口且检测本机GPS功能是否开启,GPS不开启不会间接获取
                if (wx.onLocationChange && this.userGPS != false) {
                    wx.onLocationChange((data) => {
                        console.log('onLocationChange***************', data)
                        //微信开发工具上面只能触发一次,真机上面是循环获取
                        //设置一个公共时间,原因是时间间隔太短,自己设置时间,然后去操作相应的逻辑
                        if (this.time == 11) {
                            // 调取实时位置
                            this.reportLocation(this.location);
                            this.time = 0;
                        }
                        this.time++;
                        this.location = data;
                    });
                }
            },
            //调取位置后的操作逻辑
            reportLocation(location) {
                // 更新民警位置
                let param = {
                    id: uni.getStorageSync("userInfo").user_id,
                    deptId: uni.getStorageSync("userInfo").dept_id,
                    lng: data.longitude,
                    lat: data.latitude,
                }
                updateUserInfo(param).then(res => {
                    console.log(res)
                })
                console.log('********************location****************************************', location)
            },
        }
    }
</script>
subPackage/police/onLine.vue
New file
@@ -0,0 +1,156 @@
<template>
    <view class="container">
        <u-row customStyle="margin-bottom: 10px">
            <u-col span="6">
                <view class="demo-layout bg-purple-light">
                    在线状态:
                </view>
            </u-col>
            <u-col span="6">
                <u-switch v-model="onLine" asyncChange @change="asyncChange"></u-switch>
            </u-col>
        </u-row>
        <!-- <view> -->
        <!-- <role-list :roleData="roleData" :current-id="selectRole.id" @select="select"></role-list> -->
        <!-- <u-switch v-model="value13" asyncChange @change="asyncChange"></u-switch> -->
        <!-- </view> -->
        <!-- <footer-btn v-if="roleData.length" text="确定" @click="submit" /> -->
        <u-loading-page :loading="loading"></u-loading-page>
    </view>
</template>
<script>
    import {
        getUser,
        updateUserInfo
    } from "@/api/user.js"
    // import roleList from "@/subPackage/user/components/roleList.vue"
    // import {
    //     dynamicMenu,
    //     getRoleListByIds,
    // } from "@/api/system/role.js"
    export default {
        components: {
            // roleList
        },
        data() {
            return {
                onLine: false,
                userInfo: {},
                loading: false,
            }
        },
        created() {
            // this.selectRole = uni.getStorageSync("activeRole")
        },
        onShow() {
            this.getUserInfo()
        },
        methods: {
            asyncChange(e) {
                uni.showModal({
                    content: e ? '确定是否上线?' : '确定是否下线?',
                    success: (res) => {
                        if (res.confirm) {
                            this.onLine = e
                            if (e) {
                                this.userInfo.status = 2
                            } else {
                                this.userInfo.status = 1
                            }
                            updateUserInfo(this.userInfo).then(res => {
                                console.log(res)
                            })
                        }
                    }
                })
            },
            //获取当前角色的所有权限列表
            getUserInfo() {
                this.loading = !this.loading
                getUser(
                    uni.getStorageSync("userInfo").user_id
                ).then(res => {
                    this.userInfo = res.data
                    if (res.data.status && res.data.status == 2) {
                        this.onLine = true
                    } else {
                        this.onLine = false
                    }
                    // console.log(data)
                });
                // data.forEach((item, index) => {
                //     if (item.roleName == "居民") {
                //         item.icon = "/static/icon/user-01.png"
                //     }
                // })
                // this.roleData = data;
                this.loading = !this.loading
            },
            select(item) {
                this.selectRole = item
                console.log("当前选中角色", this.selectRole)
            },
            async submit() {
                //保存当前激活的角色
                this.$store.commit("setActiveRole", this.selectRole)
                // const res = await dynamicMenu(this.selectRole.id)
                // let data = res.data
                // const appMenu = data.filter(e => e.name == 'app')[0].children
                // console.log("菜单:", appMenu)
                // store.commit("SET_MENU", appMenu)
                this.$store.dispatch("getMenuList").then(res => {
                    uni.showToast({
                        title: "切换身份成功",
                        icon: "success",
                        duration: 1500,
                        success: () => {
                            uni.$emit("refresh")
                            setTimeout(() => {
                                this.$u.func.globalNavigator(
                                    "/pages/home/index",
                                    "switchTab")
                            }, 500)
                        }
                    })
                });
            }
        }
    }
</script>
<style lang="scss" scoped>
    .container {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        // background: #F9F9FA;
    }
    .cur-btn {
        width: 100%;
        padding: 20rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        box-sizing: border-box;
        z-index: 10;
    }
</style>
subPackage/police/policeSituation.vue
New file
@@ -0,0 +1,263 @@
<template>
    <view>
        <u-sticky>
            <view class="bgc-ff">
                <view class="tab">
                    <u-tabs :list="tabList" :current="tabIndex" @click="changeTab" :inactiveStyle="{color:'#999999'}"
                        :activeStyle="{color:'#017BFC'}">
                    </u-tabs>
                    <!-- <view class="search flex j-c-s-b a-i-c">
                        <view class="tab-filter flex j-c-c a-i-c" @click="showDateModal">
                            <text class="f-28">时间筛选</text>
                            <u-icon name="arrow-down"></u-icon>
                        </view>
                        <u-search placeholder="请输入需要查询信息的名称" v-model="keyword" :clearabled="true" :showAction="true"
                            :animation="true" @search="searchConfirm" @clear="clearConfirm"></u-search>
                    </view> -->
                </view>
            </view>
        </u-sticky>
        <view class="list">
            <view class="list-item bgc-ff mb-20" v-for="(i,k) in list" :key="k" @click="navTo(i.id,i.status)">
                <view class="item-title flex a-i-c j-c-s-b mb-20">
                    <text class="f-32 fw">{{i.alarmType}}</text>
                    <u-tag v-if="i.status == 1" text="待处置" type="warning" plain plainFill></u-tag>
                    <u-tag v-if="i.status == 2" text="已处置" type="success" plain plainFill></u-tag>
                </view>
                <view class="item-row flex a-i-c j-c-s-b">
                    <text class="f-28">时间</text>
                    <text class="f-28 c-66">{{i.createTime}}</text>
                </view>
                <view class="item-row flex a-i-c j-c-s-b">
                    <text class="f-28">地址</text>
                    <text class="address f-28 c-66">{{i.address || ""}}</text>
                </view>
            </view>
        </view>
        <u-toast ref="uToast"></u-toast>
        <u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
        <date-range-modal ref="dateRane" @comfirm="handleComfirmDate" @rest="handleRestDate" />
    </view>
</template>
<script>
    import {
        getPoliceAlarmRecords
    } from "@/api/police/police"
    import dateRangeModal from '@/components/dateRangeModal/modal.vue';
    export default {
        components: {
            dateRangeModal
        },
        data() {
            return {
                tabList: [
                    {
                        name: "全部",
                        status: "",
                    },
                    {
                        name: "待处置",
                        status: 1,
                    },
                    {
                        name: "已处置",
                        status: 2
                    },
                ],
                tabIndex: 0,
                currentStatus: "",
                list: [],
                loadingStatus: 'nomore',
                currentPage: 1,
                frequency: '',
                reportType: "",
                selectDate: [],
                houseCode: "",
                keyword: ""
            }
        },
        onLoad(option) {
            console.log(option);
            // this.getList()
        },
        onShow() {
            this.resetParams();
            this.getList()
        },
        onReachBottom() {
            this.currentPage++
            this.getList()
        },
        methods: {
            searchConfirm() {
                this.resetParams()
                this.getList()
            },
            clearConfirm() {
                this.keyword = ''
                this.searchConfirm()
            },
            changeTab(e) {
                this.tabIndex = e.index;
                this.currentStatus = e.status;
                this.resetParams();
                this.getList();
            },
            resetParams() {
                this.list = [];
                this.currentPage = 1;
            },
            getList() {
                this.$nextTick(() => {
                    this.loadingStatus = 'loadingmore'
                    this.$refs.uToast.show({
                        type: 'loading',
                        message: '正在加载',
                        duration: 9999999
                    })
                })
                let params = {
                    current: this.currentPage,
                    size: 20,
                    status: this.currentStatus,
                    frequency: this.frequency
                }
                // if (this.selectDate.length) {
                //     params.startTime = this.selectDate[0]
                //     params.endTime = this.selectDate[1]
                // }
                // if (this.houseCode) {
                //     params.houseCode = this.houseCode;
                // }
                // if (this.reportType) {
                //     params.reportType = this.reportType
                // }
                // if (this.keyword) {
                //     params.name = this.keyword;
                // }
                getPoliceAlarmRecords(params).then(res => {
                    if (res.code != 200) {
                        uni.showToast({
                            title: '数据请求失败',
                            icon: 'error'
                        })
                        return
                    }
                    let records = res.data.records;
                    this.list = [...this.list, ...records]
                    this.$nextTick(() => {
                        this.$refs.uToast.isShow = false
                    })
                    this.loadingStatus = 'nomore'
                })
            },
            navTo(id, status) {
                uni.navigateTo({
                    url: './policeSituationDetail',
                    complete: (res) => {
                        console.log(res)
                    }
                })
                // this.navToDetail(reportType, id)
            },
            navToEdit(reportType, id, type) {
                if (reportType == 1) {
                    this.$u.func.globalNavigator(`/subPackage/label/bail?id=${id}`)
                } else if (reportType == 2) {
                    this.$u.func.globalNavigator(`/subPackage/label/check?id=${id}`)
                } else if (reportType == 5) {
                    this.$u.func.globalNavigator(`/subPackage/label/form?id=${id}`)
                }
            },
            navToDetail(reportType, id, type) {
                if (reportType == 1) {
                    this.$u.func.globalNavigator(`bailReportDetail?id=${id}`)
                } else if (reportType == 7) {
                    this.$u.func.globalNavigator(`selfCheckDetail?id=${id}`)
                } else if (reportType == 5) {
                    this.$u.func.globalNavigator(`labelReportDetail?id=${id}`)
                } else {
                    this.$u.func.globalNavigator(`checkReform?id=${id}`)
                }
            },
            showDateModal() {
                this.$refs.dateRane.open();
            },
            handleRestDate() {
                this.selectDate = [];
                this.resetParams();
                this.getList()
            },
            handleComfirmDate(val) {
                this.selectDate = val;
                this.resetParams();
                this.getList()
            }
        }
    }
</script>
<style lang="scss">
    page {
        background-color: #F5F5F5;
    }
    .tab {
        // width: 100%;
    }
    .search {
        padding: 20rpx 20rpx;
    }
    // .tab /deep/.u-tabs__wrapper__nav__item {
    //     flex: 1;
    // }
    .tab-filter {
        padding: 0 20rpx;
    }
    .list {
        margin: 20rpx 30rpx 0;
    }
    .list-item {
        padding: 0 30rpx 20rpx;
        border-radius: 8rpx;
        .item-title {
            padding: 30rpx 0;
            border-bottom: 1px solid #F5F5F5;
        }
        .item-row {
            padding: 10rpx 0;
            .address {
                width: 65%;
                text-align: right;
            }
        }
    }
</style>
subPackage/police/policeSituationDetail.vue
New file
@@ -0,0 +1,22 @@
<template>
    <view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
            }
        },
        methods: {
        }
    }
</script>
<style>
</style>