✨ feat: 报警分析-厂界在线 功能1:下发通知权限,功能2:设备下拉
This commit is contained in:
parent
9bd6e4317e
commit
2abd8ade56
|
@ -20,9 +20,9 @@ public class OilAnalysisController extends BaseController {
|
||||||
private IOilThDeviceReportService oilThDeviceReportService;
|
private IOilThDeviceReportService oilThDeviceReportService;
|
||||||
|
|
||||||
@GetMapping("/factoryBoundaryOnline")
|
@GetMapping("/factoryBoundaryOnline")
|
||||||
public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate) {
|
public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||||
List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate);
|
List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn);
|
||||||
List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate);
|
List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn);
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("alarmCount", alarmCount);
|
resultMap.put("alarmCount", alarmCount);
|
||||||
resultMap.put("alarmCountDesc", alarmCountDesc);
|
resultMap.put("alarmCountDesc", alarmCountDesc);
|
||||||
|
|
|
@ -43,6 +43,12 @@ public class OilStatisticsController extends BaseController {
|
||||||
return getDataTable(devices);
|
return getDataTable(devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/getDeviceListByDeptId")
|
||||||
|
public TableDataInfo getDeviceListByDeptId(Long deptId) {
|
||||||
|
List<ThDevice> devices = oilThDeviceService.selectDeviceListByDeptId(deptId);
|
||||||
|
return getDataTable(devices);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getDeviceReport")
|
@GetMapping("/getDeviceReport")
|
||||||
public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) {
|
public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) {
|
||||||
if ("page".equals(thDeviceReport.getRemark())) {
|
if ("page".equals(thDeviceReport.getRemark())) {
|
||||||
|
|
|
@ -76,10 +76,10 @@ public interface ThDeviceReportMapper {
|
||||||
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day);
|
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String day);
|
||||||
|
|
||||||
@MapKey("day")
|
@MapKey("day")
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn);
|
||||||
|
|
||||||
@MapKey("sn")
|
@MapKey("sn")
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn);
|
||||||
|
|
||||||
@MapKey("sn")
|
@MapKey("sn")
|
||||||
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year);
|
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year);
|
||||||
|
|
|
@ -12,9 +12,9 @@ public interface IOilThDeviceReportService {
|
||||||
|
|
||||||
List<Map<String, Object>> dailyReportDataOverview(String day);
|
List<Map<String, Object>> dailyReportDataOverview(String day);
|
||||||
|
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn);
|
||||||
|
|
||||||
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate);
|
List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn);
|
||||||
|
|
||||||
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year);
|
List<Map<String, Object>> selectOverLimitCountByYearAndDeptId(Long deptId, String year);
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,13 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate) {
|
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate));
|
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate) {
|
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate));
|
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -201,6 +201,9 @@
|
||||||
CONNECT BY PRIOR dept_id = parent_id))
|
CONNECT BY PRIOR dept_id = parent_id))
|
||||||
AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
|
AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
|
||||||
AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD')
|
AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD')
|
||||||
|
<if test="deviceSn != null and deviceSn != ''">
|
||||||
|
AND d.sn = #{deviceSn}
|
||||||
|
</if>
|
||||||
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD')
|
GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD')
|
||||||
ORDER BY day
|
ORDER BY day
|
||||||
</select>
|
</select>
|
||||||
|
@ -230,6 +233,9 @@
|
||||||
AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
|
AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
|
||||||
AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD')
|
AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD')
|
||||||
AND (d.zt = '一级报警' OR d.zt = '二级报警')
|
AND (d.zt = '一级报警' OR d.zt = '二级报警')
|
||||||
|
<if test="deviceSn != null and deviceSn != ''">
|
||||||
|
AND d.sn = #{deviceSn}
|
||||||
|
</if>
|
||||||
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt
|
GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt
|
||||||
ORDER BY count DESC
|
ORDER BY count DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -116,4 +116,13 @@ export function deviceBackAdd(data) {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据部门id查询设备列表
|
||||||
|
export function getDeviceListByDeptId(query) {
|
||||||
|
return request({
|
||||||
|
url: '/statistics/getDeviceListByDeptId',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-select
|
||||||
|
v-model="deviceValue"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:disabled="disabled"
|
||||||
|
:clearable="clearable"
|
||||||
|
:filterable="filterable"
|
||||||
|
:multiple="multiple"
|
||||||
|
@change="handleChange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceList"
|
||||||
|
:key="item.sn"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.sn"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getDeviceListByDeptId } from '@/api/oil/device.js';
|
||||||
|
import to from "@/utils/await-to.js";
|
||||||
|
export default {
|
||||||
|
name: "DeviceSelect",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
deptId: {
|
||||||
|
type: [Number, String],
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: "请选择设备",
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
clearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
filterable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
deviceList: [],
|
||||||
|
deviceListCopy: [],
|
||||||
|
deviceValue: this.value,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
deptId(val) {
|
||||||
|
this.getDeviceList();
|
||||||
|
},
|
||||||
|
value(val) {
|
||||||
|
this.deviceValue = val;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleChange(val) {
|
||||||
|
this.$emit("input", val);
|
||||||
|
this.$emit("change", val);
|
||||||
|
},
|
||||||
|
async getDeviceList() {
|
||||||
|
if (!this.deptId) return;
|
||||||
|
const [err, res] = await to(getDeviceListByDeptId({ deptId: this.deptId }));
|
||||||
|
if (err) return this.$message.error(err.message);
|
||||||
|
this.deviceList = res.rows;
|
||||||
|
this.deviceListCopy = JSON.parse(JSON.stringify(this.deviceList));
|
||||||
|
// 如果传入的 value 在新的 deviceList 中不存在,则清空 deviceValue
|
||||||
|
if (!this.deviceList.some(item => item.sn === this.deviceValue)) {
|
||||||
|
this.deviceValue = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getDeviceList();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -18,6 +18,14 @@
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<device-select
|
||||||
|
v-model="queryDeviceSn"
|
||||||
|
:deptId="dept ? dept.deptId : ''"
|
||||||
|
placeholder="请选择设备"
|
||||||
|
@change="handleDeviceSelectChange"
|
||||||
|
/>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<div style="display: flex; height: 700px; margin-top: 10px;">
|
<div style="display: flex; height: 700px; margin-top: 10px;">
|
||||||
|
@ -37,6 +45,7 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
v-if="checkRole(['admin', 'notice'])"
|
||||||
label="操作"
|
label="操作"
|
||||||
align="center"
|
align="center"
|
||||||
class-name="small-padding fixed-width"
|
class-name="small-padding fixed-width"
|
||||||
|
@ -69,14 +78,16 @@
|
||||||
import { queryAlarmChart } from "@/api/demostrate/monitor";
|
import { queryAlarmChart } from "@/api/demostrate/monitor";
|
||||||
import { queryMonitorPrediction } from "@/api/demostrate/monitor";
|
import { queryMonitorPrediction } from "@/api/demostrate/monitor";
|
||||||
import sendMsg from "@/views/demostrate/alarm/sendMsg.vue";
|
import sendMsg from "@/views/demostrate/alarm/sendMsg.vue";
|
||||||
|
import DeviceSelect from '@/components/DeviceSelect/index.vue';
|
||||||
const echarts = require("echarts");
|
const echarts = require("echarts");
|
||||||
import { factoryBoundaryOnline } from "@/api/analysis"
|
import { factoryBoundaryOnline } from "@/api/analysis"
|
||||||
import to from '@/utils/await-to.js';
|
import to from '@/utils/await-to.js';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { debounce } from '@/utils';
|
import { debounce } from '@/utils';
|
||||||
|
import { checkRole } from "@/utils/permission";
|
||||||
export default {
|
export default {
|
||||||
name: "alarm",
|
name: "alarm",
|
||||||
components: { sendMsg },
|
components: { sendMsg, DeviceSelect },
|
||||||
dicts: [],
|
dicts: [],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -112,11 +123,13 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
isOpenMsg: false,
|
isOpenMsg: false,
|
||||||
deviceInfo: {},
|
deviceInfo: {},
|
||||||
|
queryDeviceSn: "",
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
deptId: null,
|
deptId: null,
|
||||||
beginDate: null,
|
beginDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
|
deviceSn: null,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -142,11 +155,13 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
checkRole,
|
||||||
dateChange() {
|
dateChange() {
|
||||||
this.queryDebounce();
|
this.queryDebounce();
|
||||||
},
|
},
|
||||||
handleDeptChange(dept) {
|
handleDeptChange(dept) {
|
||||||
this.dept = dept;
|
this.dept = dept;
|
||||||
|
this.queryDeviceSn = "";
|
||||||
this.queryDebounce();
|
this.queryDebounce();
|
||||||
},
|
},
|
||||||
async query() {
|
async query() {
|
||||||
|
@ -154,7 +169,7 @@ export default {
|
||||||
this.queryParams.deptId = this.dept.deptId;
|
this.queryParams.deptId = this.dept.deptId;
|
||||||
this.queryParams.beginDate = this.dateList[0];
|
this.queryParams.beginDate = this.dateList[0];
|
||||||
this.queryParams.endDate = this.dateList[1];
|
this.queryParams.endDate = this.dateList[1];
|
||||||
console.log(this.queryParams);
|
this.queryParams.deviceSn = this.queryDeviceSn || '';
|
||||||
const [err, res] = await to(factoryBoundaryOnline(this.queryParams));
|
const [err, res] = await to(factoryBoundaryOnline(this.queryParams));
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -165,7 +180,6 @@ export default {
|
||||||
this.$message.error(res.msg);
|
this.$message.error(res.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(res);
|
|
||||||
this.alarmCount = res.data.alarmCount;
|
this.alarmCount = res.data.alarmCount;
|
||||||
this.alarmCountDesc = res.data.alarmCountDesc;
|
this.alarmCountDesc = res.data.alarmCountDesc;
|
||||||
this.queryChart();
|
this.queryChart();
|
||||||
|
@ -328,6 +342,9 @@ export default {
|
||||||
this.myChart = echarts.init(this.$refs.qdCityMap1);
|
this.myChart = echarts.init(this.$refs.qdCityMap1);
|
||||||
this.myChart.setOption(option);
|
this.myChart.setOption(option);
|
||||||
},
|
},
|
||||||
|
handleDeviceSelectChange() {
|
||||||
|
this.queryDebounce();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue