New file |
| | |
| | | import http from '@/http' |
| | | |
| | | export default { |
| | | // 获取所属单位 |
| | | findCustomerList: (params) => { |
| | | return http.get('/sccg/smoke/customer/list', params); |
| | | }, |
| | | // 查询实时数据 |
| | | findInTimeList: (params) => { |
| | | return http.get('/sccg/smoke/inTime/list', params); |
| | | }, |
| | | // 获取设备在线情况 |
| | | getInTimeCount: () => { |
| | | return http.get('/sccg/smoke/inTime/count'); |
| | | }, |
| | | } |
New file |
| | |
| | | <template> |
| | | <div class="header"> |
| | | <el-form :inline="true" :model="seachData" class="demo-form-inline"> |
| | | <el-form-item label=""> |
| | | <el-select |
| | | style="width: 140px" |
| | | v-model="seachData.ownerIndex" |
| | | placeholder="所属单位" |
| | | > |
| | | <el-option |
| | | v-for="(item, index) in ownerOptions" |
| | | :key="item.Id" |
| | | :label="item.Name" |
| | | :value="index" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-select |
| | | style="width: 120px" |
| | | v-model="seachData.status" |
| | | placeholder="排放状态" |
| | | > |
| | | <el-option |
| | | v-for="item in statusOptions" |
| | | :key="item.label" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-select |
| | | style="width: 120px" |
| | | v-model="seachData.onlineStatus" |
| | | placeholder="整体状态" |
| | | > |
| | | <el-option |
| | | v-for="item in onlineStatusOptions" |
| | | :key="item.label" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-radio v-model="seachData.type" label="1">监控设备</el-radio> |
| | | <el-radio v-model="seachData.type" label="2">监测设备</el-radio> |
| | | </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 type="primary" @click="resetAll">导出</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import realTimeApi from "@/api/smoke/realTime"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | onlineStatusOptions: [ |
| | | { |
| | | label: "正常", |
| | | value: "NORMAL", |
| | | }, |
| | | { |
| | | label: "预警", |
| | | value: "ALARM", |
| | | }, |
| | | { |
| | | label: "超标", |
| | | value: "EXCESS", |
| | | }, |
| | | { |
| | | label: "离线", |
| | | value: "DOWN", |
| | | }, |
| | | { |
| | | label: "异常离线", |
| | | value: "OFF", |
| | | }, |
| | | ], |
| | | statusOptions: [ |
| | | { |
| | | label: "正常", |
| | | value: 1, |
| | | }, |
| | | { |
| | | label: "离线", |
| | | value: 2, |
| | | }, |
| | | { |
| | | label: "异常离线", |
| | | value: 3, |
| | | }, |
| | | ], |
| | | ownerOptions: [], |
| | | seachData: {}, |
| | | 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.getOwnerOptions(); |
| | | }, |
| | | methods: { |
| | | // 获取所属单位 |
| | | getOwnerOptions() { |
| | | const param = { pageSize: 100, pageNum: 1 }; |
| | | realTimeApi |
| | | .findCustomerList(param) |
| | | .then((res) => { |
| | | this.ownerOptions = res.list; |
| | | }) |
| | | .catch((err) => this.$message.error(err)); |
| | | }, |
| | | |
| | | getUserList() { |
| | | const ownerItem = this.ownerOptions[this.seachData.ownerIndex]; |
| | | this.seachData.owner = ownerItem.Pid + ownerItem.Id; |
| | | console.log(this.seachData); |
| | | this.$emit("getList", { seachData: this.seachData }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .header { |
| | | line-height: normal; |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div>实时管理</div> |
| | | <MyHeader @getList="getRealTimeList"></MyHeader> |
| | | </template> |
| | | |
| | | <script> |
| | | import MyHeader from "./components/header"; |
| | | import realTimeApi from "@/api/smoke/realTime"; |
| | | export default { |
| | | |
| | | data() { |
| | | return { |
| | | tableData: [], |
| | | totalNum: 0, |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | }; |
| | | }, |
| | | components: { MyHeader }, |
| | | created() { |
| | | this.getRealTimeList(); |
| | | }, |
| | | methods: { |
| | | getRealTimeList(seachData) { |
| | | let params; |
| | | if (seachData) { |
| | | params = { |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | resource: |
| | | seachData.seachData.resource == undefined |
| | | ? null |
| | | : seachData.seachData.resource, |
| | | region: |
| | | seachData.seachData.region == undefined |
| | | ? null |
| | | : seachData.seachData.region, |
| | | type: this.statusArr[1] ?? null, |
| | | code: |
| | | seachData.seachData.code == undefined |
| | | ? null |
| | | : seachData.seachData.code, |
| | | categoryBig: |
| | | seachData.seachData.categoryBig == undefined |
| | | ? null |
| | | : seachData.seachData.categoryBig, |
| | | categorySmall: |
| | | seachData.seachData.categorySmall == undefined |
| | | ? null |
| | | : seachData.seachData.categorySmall, |
| | | site: |
| | | seachData.seachData.site == undefined |
| | | ? null |
| | | : seachData.seachData.site, |
| | | street: |
| | | seachData.seachData.street == undefined |
| | | ? null |
| | | : seachData.seachData.street, |
| | | alarmTime: |
| | | seachData.seachData.alarmTime == undefined |
| | | ? null |
| | | : seachData.seachData.alarmTime, |
| | | }; |
| | | } else { |
| | | params = { |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | }; |
| | | } |
| | | |
| | | realTimeApi |
| | | .findInTimeList(params) |
| | | .then(({ records, total }) => { |
| | | debugger; |
| | | this.tableData = records; |
| | | this.totalNum = total; |
| | | }) |
| | | .catch((err) => this.$message.error(err)); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |