zhongrj
2024-03-19 f712cae55d8274c93aa0e89a2f8ac32d53608bb5
警情处置列表查询完善,警情处置完成
3 files modified
438 ■■■■■ changed files
api/police/police.js 18 ●●●●● patch | view | raw | blame | history
subPackage/police/policeSituation.vue 39 ●●●●● patch | view | raw | blame | history
subPackage/police/policeSituationDetail.vue 381 ●●●●● patch | view | raw | blame | history
api/police/police.js
@@ -7,4 +7,22 @@
        method: 'get',
        params: params
    })
}
// 查询警情处理记录
export const getPoliceDetail = (params) => {
    return http.request({
        url: '/blade-policeAlarmRecords/policeAlarmRecords/detail',
        method: 'get',
        params: params
    })
}
// 查询警情处理记录
export const updateInfo = (data) => {
    return http.request({
        url: '/blade-policeAlarmRecords/policeAlarmRecords/update',
        method: 'post',
        data: data
    })
}
subPackage/police/policeSituation.vue
@@ -6,14 +6,14 @@
                    <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="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>
            </view>
        </u-sticky>
@@ -21,23 +21,22 @@
        <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>
                    <text class="f-32 fw">{{i.alarmTypeName==null?'':i.alarmTypeName}}</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">报警时间</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="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>
@@ -54,7 +53,6 @@
        data() {
            return {
                tabList: [
                    {
                        name: "全部",
                        status: "",
@@ -66,8 +64,7 @@
                    {
                        name: "已处置",
                        status: 2
                    },
                    }
                ],
                tabIndex: 0,
                currentStatus: "",
@@ -117,6 +114,7 @@
                this.currentPage = 1;
            },
            getList() {
                this.$nextTick(() => {
                    this.loadingStatus = 'loadingmore'
                    this.$refs.uToast.show({
@@ -129,22 +127,13 @@
                    current: this.currentPage,
                    size: 20,
                    status: this.currentStatus,
                    frequency: this.frequency
                    searchKey: this.keyword
                }
                // 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;
                // }
                if (this.selectDate.length) {
                    params.startTime = this.selectDate[0],
                    params.endTime = this.selectDate[1]
                }
                getPoliceAlarmRecords(params).then(res => {
                    if (res.code != 200) {
@@ -164,7 +153,7 @@
            },
            navTo(id, status) {
                uni.navigateTo({
                    url: './policeSituationDetail',
                    url: `./policeSituationDetail?id=${id}`,
                    complete: (res) => {
                        console.log(res)
                    }
subPackage/police/policeSituationDetail.vue
@@ -1,22 +1,399 @@
<template>
    <view>
        <view class="content bgc-ff">
            <u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
                :labelStyle="{fontSize:'28rpx'}">
                <u-form-item label="报警人时间" prop="createTime" :borderBottom="false" required>
                    <u-input v-model="info.createTime" disabled disabledColor="#ffffff" border="none" placeholder="请选择"
                        placeholderClass="f-28 c-99" inputAlign="right"></u-input>
                </u-form-item>
                <u-form-item label="报警地址" borderBottom required prop="address" :borderBottom="false">
                    <u-input type="textarea" v-model="info.address" border="none" placeholderClass="f-28 c-99"
                        inputAlign="right" placeholder="请输入报警地址">
                    </u-input>
                </u-form-item>
                <u-form-item @click="showSelectBus('报警类型','alarmType')" label="报警类型" prop="alarmType" :borderBottom="false" required >
                    <u-input v-model="selectDefaultName.alarmType" disabled disabledColor="#fff" border="none" placeholder="请选择"
                        placeholderClass="f-28 c-99" inputAlign="right"></u-input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
                <u-form-item label="报警人姓名" prop="name" :borderBottom="false" required>
                    <u--input border="none" v-model="info.name"
                            placeholder="请输入报警人姓名" inputAlign="right" placeholderClass="f-28 c-99"></u--input>
                </u-form-item>
                <u-form-item @click="showSelectBus('性别','gender')" class="form-item" labelWidth="110" label="报警人性别"
                    prop="gender">
                    <u--input border="none" v-model="selectDefaultName.gender" disabled disabledColor="#ffffff"
                        placeholder="请选择报警人性别" inputAlign="right">
                    </u--input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
                <u-form-item label="报警人电话" prop="phone" :borderBottom="false" required>
                    <u--input border="none" type="number" v-model="info.phone"
                            placeholder="请输入报警人电话" inputAlign="right" placeholderClass="f-28 c-99"></u--input>
                </u-form-item>
                <u-form-item label="报警内容" borderBottom required prop="alarmDescribe" :borderBottom="false">
                    <u-input type="textarea" v-model="info.alarmDescribe" border="none" placeholderClass="f-28 c-99"
                        inputAlign="right" placeholder="请输入报警内容">
                    </u-input>
                </u-form-item>
                <u-form-item label="接警人姓名" prop="policeName" :borderBottom="false" required>
                    <u-input v-model="info.policeName" disabled disabledColor="#fff" border="none"
                        placeholder="请输入接警人姓名" placeholderClass="f-28 c-99" inputAlign="right"></u-input>
                </u-form-item>
                <u-form-item label="接警人电话" prop="policePhone" :borderBottom="false" required>
                    <u--input border="none" type="number" v-model="info.policePhone"
                            placeholder="请输入接警人电话" inputAlign="right"></u--input>
                </u-form-item>
                <u-form-item label="接警时间" prop="alarmResponseTime" :borderBottom="false" required @click="showSelectDate = true">
                    <u-input v-model="info.alarmResponseTime" disabled disabledColor="#ffffff" border="none" placeholder="请选择"
                        placeholderClass="f-28 c-99" inputAlign="right"></u-input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
                <u-form-item @click="showSelectBus('是否有人受伤','injuryFlag')" label="是否有人受伤" prop="injuryFlag" :borderBottom="false" required>
                    <u--input border="none" v-model="selectDefaultName.injuryFlag" disabled
                        disabledColor="#ffffff" placeholder="请选择是否有人受伤" inputAlign="right">
                    </u--input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
                <u-form-item @click="showSelectBus('公安事件','publicIncidents')" label="公安事件" prop="publicIncidents" :borderBottom="false" required>
                    <u--input border="none" v-model="selectDefaultName.publicIncidents" disabled
                        disabledColor="#ffffff" placeholder="请选择公安事件" inputAlign="right">
                    </u--input>
                    <u-icon slot="right" name="arrow-right"></u-icon>
                </u-form-item>
            </u-form>
        </view>
        <u-picker :defaultIndex="[selectDefaultIndex[selectBusKey]]" :closeOnClickOverlay="true" v-if="typeShow"
            :show="typeShow" :columns="[selectBusList]" @close="typeShow = false" @cancel="typeShow = false"
            keyName="name" @confirm="typeSelect"></u-picker>
        <u-datetime-picker ref="datetimePicker" :show="showSelectDate" v-model="workTime" mode="datetime"
            :formatter="formatter" @confirm="confirmDate" @cancel="showSelectDate = false"></u-datetime-picker>
        <footer-btn @click="submitInfo" text="保存" />
    </view>
</template>
<script>
    import {
        getPoliceDetail,updateInfo
    } from "@/api/police/police"
    import uploadMixin from "@/mixin/uploadMixin";
    import {
        bizDictionary,
        update
    } from '@/api/system/dict.js'
    export default {
        mixins: [uploadMixin],
        data() {
            return {
                typeShow:false,
                form: {},
                // formatter:"",
                info: {
                    name: "",
                    phone: "",
                    alarmType: "",
                    gender: "",
                    policeName: "",
                    policePhone: "",
                    createTime: "",
                    injuryFlag:"",
                    publicIncidents:""
                },
                rules: {
                    type: [{
                        type: 'number',
                        required: true,
                        message: '请选择走访类型',
                        trigger: ['blur', 'change']
                    }],
                    householdId: [{
                        type: 'string',
                        required: true,
                        message: '请选择被访问人',
                        trigger: ['blur', 'change']
                    }],
                    context: [{
                        type: 'string',
                        required: true,
                        message: '请输入工作内容',
                        trigger: ['blur', 'change']
                    }],
                },
                dataList: {
                    alarmType:[],
                    gender: [{
                            value: 1,
                            name: '男',
                        },
                        {
                            value: 2,
                            name: '女',
                        }
                    ],
                    publicIncidents: [
                        {
                            value: 2,
                            name: '是',
                        },{
                            value: 1,
                            name: '否',
                        }
                    ],
                    injuryFlag: [{
                            value: 1,
                            name: '是',
                        },
                        {
                            value: 0,
                            name: '否',
                        }
                    ],
                },
                // 下拉变量
                selectBusList: [],
                selectBusVal: '',
                selectBusTitle: '',
                selectBusModel: '',
                selectBusKey: "",
                selectDefaultIndex: {
                    gender: 0,
                    injuryFlag: 0,
                    publicIncidents: 0,
                    alarmType:0
                },
                selectDefaultName: {
                    alermType:"",
                    gender: "",
                    injuryFlag: "",
                    publicIncidents: "",
                },
                showSelectDate: false,
                workTime: Number(new Date()),
                isShowPicker: false,
                houseIndex: [0],
                isShowTypePicker: false,
                isShowLabelPicker: false,
                keyword: "",
                isShowPopup: false,
                isEdit: false,
                id: ""
            }
        },
        async onLoad(option) {
            if (option.id) {
                this.isEdit = true;
                this.id = option.id;
                setTimeout(() => {
                    this.getDetail(option.id)
                }, 200)
            }
        },
        onReady() {
            //onReady 为uni-app支持的生命周期之一
            this.$refs.form.setRules(this.rules)
        },
        methods: {
            async getAllBizDict() {
                //报警类型字典
                await this.getBizDict('applyAlarmType', this.dataList.alarmType)
            },
            // 获取业务字典
            async getBizDict(code, list) {
                const param = {
                    code: code
                }
                const res = await bizDictionary(param)
                res.data.forEach(e => {
                    list.push({
                        name: e.dictValue,
                        value: Number(e.dictKey)
                    })
                })
            },
            //类型选择确认
            typeSelect(item) {
                const [result] = item.value
                // this[this.selectBusModel] = result.name
                this.info[this.selectBusKey] = result.value
                this.selectDefaultName[this.selectBusKey] = result.name;
                this.selectDefaultIndex[this.selectBusKey] = item.indexs[0];
                this.typeShow = !this.typeShow
            },
            // 显示选择弹框
            showSelectBus(title, key) {
                this.selectBusList = this.dataList[key]
                this.selectBusTitle = title
                // this.selectBusModel = model
                this.selectBusKey = key
                this.typeShow = true
            },
            // 字典值匹配
            findObjValue(value, obj, key = "value") {
                let data = {
                    index: "",
                    name: ""
                }
                for (let i = 0, ii = obj.length; i < ii; i++) {
                    if (value == obj[i][key]) {
                        data.index = i;
                        data.name = obj[i].name;
                    }
                }
                return data;
            },
            async getDetail(id) {
                // 获取所有字典
                await this.getAllBizDict();
                getPoliceDetail({
                    id
                }).then(res => {
                    console.log(res);
                    if (res.code == 200) {
                        this.info = res.data;
                        if(this.info.alarmResponseTime){
                            this.info.alarmResponseTime = this.info.alarmResponseTime.substring(0,16)
                        }
                        let data = res.data;
                        for (let i in this.selectDefaultIndex) {
                            let {
                                index,
                                name
                            } = this.findObjValue(data[i], this.dataList[i])
                            this.selectDefaultIndex[i] = index || 0;
                            this.selectDefaultName[i] = name;
                        }
                    }
                })
            },
            confirmDate(e) {
                this.showSelectDate = false;
                this.info.alarmResponseTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
            },
            submitInfo() {
                this.$refs.form.validate().then(valid => {
                    this.info.status = 2;
                    if(this.info.alarmResponseTime){
                        this.info.alarmResponseTime = this.info.alarmResponseTime + ":00"
                    }
                    updateInfo(this.info).then(res => {
                        uni.showToast({
                            icon: 'success',
                            title: '保存成功',
                        })
                        setTimeout(() => {
                            this.reLoadPrePage()
                        }, 300)
                    })
                })
            },
            //刷新上一页数据后返回
            reLoadPrePage() {
                let pages = getCurrentPages();
                let prePage = pages[pages.length - 2];
                prePage.$vm.resetParams();
                prePage.$vm.list= [];
                uni.navigateBack();
            },
        }
    }
</script>
<style>
<style lang="less">
    page {
        background-color: #F5F5F5;
    }
    .content {
        margin: 20rpx 30rpx;
        padding: 0 30rpx;
    }
    .row {
        padding: 20rpx 0;
        border-bottom: 1px solid
    }
    .location-btn {
        width: 116rpx;
        height: 46rpx;
        line-height: 46rpx;
        border-radius: 4rpx;
        border: 1px solid currentColor;
        padding: 0;
        background-color: #fff;
    }
    .upload {
        margin: 0 30rpx;
        padding: 30rpx;
        .upload-item {
            width: 140rpx;
            height: 140rpx;
            border: 1px solid #EEEEEE;
        }
    }
    .footer {
        width: 100%;
        padding: 30rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 10;
        box-sizing: border-box;
        .footer-btn {
            width: 100%;
            height: 78rpx;
            line-height: 78rpx;
            background: linear-gradient(163deg, #01BDFC 0%, #017BFC 100%);
            border-radius: 8rpx;
            color: #fff;
            font-size: 32rpx;
        }
    }
    .popup-content {
        width: 100%;
        padding: 0 30rpx 30rpx;
        box-sizing: border-box;
        .popup-title {
            padding: 30rpx 0;
            text-align: center;
            font-weight: bold;
        }
        .popup-list {
            height: 650rpx;
        }
        .popup-list-item {
            padding: 20rpx 0;
            border-bottom: 1px solid #f1f1f1;
            position: relative;
        }
        .check-icon {
            position: absolute;
            right: 20rpx;
            top: 20rpx;
        }
    }
    .address-content {
        flex: 1;
        background-color: #F5F5F5;
        font-size: 28rpx;
        padding: 2rpx 10rpx;
    }
</style>