odc.xiaohui
2023-02-24 cec9008c7bdbb373c400d53330642be3891a84d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<template>
    <div class="header">
        <el-form :inline="true" :model="seachData" class="demo-form-inline">
            <el-form-item label="事件编号">
                <el-input
                    v-model="seachData.code"
                    placeholder="事件编号"
                ></el-input>
            </el-form-item>
            <el-form-item label="来源查询">
                <el-select
                    v-model="seachData.resource"
                    placeholder="请选择来源"
                >
                    <el-option
                        v-for="item in eventSourceOptions"
                        :key="item.label"
                        :label="item.label"
                        :value="item.value"
                    >
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="大类名称">
                <el-input
                    v-model="seachData.categoryBig"
                    placeholder="大类名称"
                ></el-input>
            </el-form-item>
            <el-form-item label="小类名称">
                <el-input
                    v-model="seachData.categorySmall"
                    placeholder="小类名称"
                ></el-input>
            </el-form-item>
            <el-form-item label="报警点位">
                <el-input
                    v-model="seachData.site"
                    placeholder="报警点位"
                ></el-input>
            </el-form-item>
            <el-form-item label="所属区域">
                <el-cascader
                    v-model="seachData.street"
                    :options="communityOptions"
                    :props="options"
                    clearable
                    @change="handleChange"
                ></el-cascader>
            </el-form-item>
            <el-form-item label="报警时间">
                <el-date-picker
                    v-model="seachData.alarmTime"
                    type="daterange"
                    align="right"
                    unlink-panels
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    :picker-options="pickerOptions"
                >
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="getUserList">查询</el-button>
                <el-button
                    v-if="addData"
                    class="addBtn button-addition"
                    type="primary"
                    @click="dialogCreate()"
                    >添加</el-button
                >
              <el-button type="primary" @click="resetAll">重置</el-button>
            </el-form-item>
        </el-form>
        <!--      <div>-->
        <!--        <el-button type="primary" @click="getUserList">查询</el-button>-->
        <!--        <el-button-->
        <!--            class="addBtn button-addition"-->
        <!--            type="primary"-->
        <!--            @click="dialogCreate()"-->
        <!--        >添加</el-button-->
        <!--        >-->
        <!--      </div>-->
    </div>
</template>
 
<script>
import { RESOURCE_OPTIONS } from "@/utils/helper";
import department from "@/api/system/department";
 
export default {
    data() {
        return {
            options: {
                label: 'regionName',
                value: 'id',
            },
            communityOptions: [],
            eventSourceOptions: RESOURCE_OPTIONS,
            seachData: {
 
            },
            addData: false,
            alarmTime: '',
            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]);
                    }
                }]
            },
        }
    },
    created() {
    },
    mounted() {
        this.getPool()
        this.getCommunityOptions()
    },
    methods: {
      resetAll(){
        this.seachData = {}
        this.$emit('getUserList', { seachData: this.seachData });
      },
        handleChange(value) {
            console.log(value);
        },
        // 获取社区和街道
        getCommunityOptions() {
            department.getDepartmentList()
                .then(res => {
                    this.communityOptions = res;
                })
                .catch(err => this.$message.error(err))
        },
        getPool() {
            console.log(this.$route.name);
            let name = this.$route.name
            this.addData = name == 'pool';
        },
        onSubmit() {
 
        },
        getUserList() {
            console.log(this.seachData)
            this.seachData.street = this.seachData.street ? this.seachData.street[this.seachData.street.length - 1] : null;
            this.$emit('getUserList', { seachData: this.seachData });
        },
        dialogCreate() {
            this.$emit('dialogCreatepro')
        },
    },
}
</script>
 
<style lang="scss" scoped>
.header {
    line-height: normal;
}
</style>