✨ feat: 报警分析-厂界在线 功能1:下发通知权限,功能2:设备下拉
This commit is contained in:
parent
9bd6e4317e
commit
2abd8ade56
|
@ -20,9 +20,9 @@ public class OilAnalysisController extends BaseController {
|
|||
private IOilThDeviceReportService oilThDeviceReportService;
|
||||
|
||||
@GetMapping("/factoryBoundaryOnline")
|
||||
public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate) {
|
||||
List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate);
|
||||
List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate);
|
||||
public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||
List<Map<String, Object>> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn);
|
||||
List<Map<String, Object>> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("alarmCount", alarmCount);
|
||||
resultMap.put("alarmCountDesc", alarmCountDesc);
|
||||
|
|
|
@ -43,6 +43,12 @@ public class OilStatisticsController extends BaseController {
|
|||
return getDataTable(devices);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getDeviceListByDeptId")
|
||||
public TableDataInfo getDeviceListByDeptId(Long deptId) {
|
||||
List<ThDevice> devices = oilThDeviceService.selectDeviceListByDeptId(deptId);
|
||||
return getDataTable(devices);
|
||||
}
|
||||
|
||||
@GetMapping("/getDeviceReport")
|
||||
public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) {
|
||||
if ("page".equals(thDeviceReport.getRemark())) {
|
||||
|
|
|
@ -76,10 +76,10 @@ public interface ThDeviceReportMapper {
|
|||
List<Map<String, Object>> dailyReportDataOverview(@Param("day") String 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")
|
||||
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")
|
||||
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>> 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);
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@ public class OilThDeviceReportService implements IOilThDeviceReportService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate) {
|
||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate));
|
||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate) {
|
||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate));
|
||||
public List<Map<String, Object>> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn) {
|
||||
return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -201,6 +201,9 @@
|
|||
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(#{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')
|
||||
ORDER BY day
|
||||
</select>
|
||||
|
@ -230,6 +233,9 @@
|
|||
AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD')
|
||||
AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD')
|
||||
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
|
||||
ORDER BY count DESC
|
||||
</select>
|
||||
|
|
|
@ -116,4 +116,13 @@ export function deviceBackAdd(data) {
|
|||
method: 'post',
|
||||
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-col>
|
||||
<el-col :span="6">
|
||||
<device-select
|
||||
v-model="queryDeviceSn"
|
||||
:deptId="dept ? dept.deptId : ''"
|
||||
placeholder="请选择设备"
|
||||
@change="handleDeviceSelectChange"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<div style="display: flex; height: 700px; margin-top: 10px;">
|
||||
|
@ -37,6 +45,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="checkRole(['admin', 'notice'])"
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
|
@ -69,14 +78,16 @@
|
|||
import { queryAlarmChart } from "@/api/demostrate/monitor";
|
||||
import { queryMonitorPrediction } from "@/api/demostrate/monitor";
|
||||
import sendMsg from "@/views/demostrate/alarm/sendMsg.vue";
|
||||
import DeviceSelect from '@/components/DeviceSelect/index.vue';
|
||||
const echarts = require("echarts");
|
||||
import { factoryBoundaryOnline } from "@/api/analysis"
|
||||
import to from '@/utils/await-to.js';
|
||||
import moment from 'moment';
|
||||
import { debounce } from '@/utils';
|
||||
import { checkRole } from "@/utils/permission";
|
||||
export default {
|
||||
name: "alarm",
|
||||
components: { sendMsg },
|
||||
components: { sendMsg, DeviceSelect },
|
||||
dicts: [],
|
||||
data() {
|
||||
return {
|
||||
|
@ -112,11 +123,13 @@ export default {
|
|||
total: 0,
|
||||
isOpenMsg: false,
|
||||
deviceInfo: {},
|
||||
queryDeviceSn: "",
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
deptId: null,
|
||||
beginDate: null,
|
||||
endDate: null,
|
||||
deviceSn: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
@ -142,11 +155,13 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
checkRole,
|
||||
dateChange() {
|
||||
this.queryDebounce();
|
||||
},
|
||||
handleDeptChange(dept) {
|
||||
this.dept = dept;
|
||||
this.queryDeviceSn = "";
|
||||
this.queryDebounce();
|
||||
},
|
||||
async query() {
|
||||
|
@ -154,7 +169,7 @@ export default {
|
|||
this.queryParams.deptId = this.dept.deptId;
|
||||
this.queryParams.beginDate = this.dateList[0];
|
||||
this.queryParams.endDate = this.dateList[1];
|
||||
console.log(this.queryParams);
|
||||
this.queryParams.deviceSn = this.queryDeviceSn || '';
|
||||
const [err, res] = await to(factoryBoundaryOnline(this.queryParams));
|
||||
if (err) {
|
||||
console.error(err);
|
||||
|
@ -165,7 +180,6 @@ export default {
|
|||
this.$message.error(res.msg);
|
||||
return;
|
||||
}
|
||||
console.log(res);
|
||||
this.alarmCount = res.data.alarmCount;
|
||||
this.alarmCountDesc = res.data.alarmCountDesc;
|
||||
this.queryChart();
|
||||
|
@ -328,6 +342,9 @@ export default {
|
|||
this.myChart = echarts.init(this.$refs.qdCityMap1);
|
||||
this.myChart.setOption(option);
|
||||
},
|
||||
handleDeviceSelectChange() {
|
||||
this.queryDebounce();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue