Commit b8ecda3e by 416409548@qq.com

报警查询

parent 8c23ccfa
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="4" :sm="8">
<a-form-item label="设备类型">
<j-dict-select-tag v-model="queryParam.equipmentType" placeholder="请选择设备类型" dict-code="alarm_query_equipmentType"/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="创建时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-range-picker
style="width: 210px"
v-model="queryParam.createTimeRange"
format="YYYY-MM-DD"
:placeholder="['开始时间', '结束时间']"
@change="onDateChange"
@ok="onDateOk"
/>
</a-form-item>
</a-col>
<a-col :md="4" :sm="8">
<a-space style="float: left">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button type="default" @click="searchReset">重置</a-button>
</a-space>
</a-col>
<a-col :md="10" :sm="8">
<a-space style="float: right">
<a-button @click="handleExportXls('报警查询导出')" type="primary">导出</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<!-- <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('报警查询')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload> -->
<!-- 高级查询区域 -->
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div> -->
<!-- table区域-begin -->
<div>
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div> -->
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<alarm-query-modal ref="modalForm" @ok="modalFormOk"></alarm-query-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import AlarmQueryModal from './modules/AlarmQueryModal'
export default {
name: 'AlarmQueryList',
mixins:[JeecgListMixin, mixinDevice],
components: {
AlarmQueryModal
},
data () {
return {
description: '报警查询管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'设备编码',
align:"center",
dataIndex: 'equipmentNumber'
},
{
title:'设备类型',
align:"center",
dataIndex: 'equipmentType_dictText'
},
{
title:'设备名称',
align:"center",
dataIndex: 'equipmentName'
},
{
title:'区域名称',
align:"center",
dataIndex: 'districtName'
},
{
title:'ip地址',
align:"center",
dataIndex: 'ipAddress'
},
{
title:'报警时间',
align:"center",
dataIndex: 'createTime',
customRender:function (text) {
return !text?"":(text)
}
},
{
title:'状态',
align:"center",
dataIndex: 'status_dictText',
customRender: (text, row, index) => {
return <div style='color:red'>{{text}}</div>;
}
},
// {
// title:'删除状态',
// align:"center",
// dataIndex: 'deleted'
// },
// {
// title: '操作',
// dataIndex: 'action',
// align:"center",
// fixed:"right",
// width:147,
// scopedSlots: { customRender: 'action' }
// }
],
url: {
list: "/pm/alarmQuery/list",
delete: "/pm/alarmQuery/delete",
deleteBatch: "/pm/alarmQuery/deleteBatch",
exportXlsUrl: "/pm/alarmQuery/exportXls",
importExcelUrl: "pm/alarmQuery/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'equipmentNumber',text:'设备编码'})
fieldList.push({type:'int',value:'equipmentType',text:'设备类型 1:出入口闸机 2:访客一体机 3:自助访客机 4:身份证读卡器 5:人脸识别'})
fieldList.push({type:'string',value:'equipmentName',text:'设备名称'})
fieldList.push({type:'string',value:'districtName',text:'区域名称'})
fieldList.push({type:'string',value:'ipAddress',text:'ip地址'})
fieldList.push({type:'int',value:'status',text:'状态 1:报警'})
fieldList.push({type:'date',value:'modifyTime',text:'修改时间'})
fieldList.push({type:'int',value:'deleted',text:'删除状态'})
this.superFieldList = fieldList
},
onDateChange: function (value, dateString) {
this.queryParam.createTime_begin=dateString[0];
this.queryParam.createTime_end=dateString[1];
},
onDateOk(value) {
console.log(value);
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
\ No newline at end of file
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="设备编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentNumber">
<a-input v-model="model.equipmentNumber" placeholder="请输入设备编码" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="设备类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentType">
<a-input-number v-model="model.equipmentType" placeholder="请输入设备类型" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentName">
<a-input v-model="model.equipmentName" placeholder="请输入设备名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="区域名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="districtName">
<a-input v-model="model.districtName" placeholder="请输入区域名称" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="ip地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ipAddress">
<a-input v-model="model.ipAddress" placeholder="请输入ip地址" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="状态 1:报警" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<a-input-number v-model="model.status" placeholder="请输入状态 1:报警" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="修改时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modifyTime">
<j-date placeholder="请选择修改时间" v-model="model.modifyTime" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="删除状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="deleted">
<a-input-number v-model="model.deleted" placeholder="请输入删除状态" style="width: 100%" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'AlarmQueryForm',
components: {
},
props: {
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/org.jeecg.pm/alarmQuery/add",
edit: "/org.jeecg.pm/alarmQuery/edit",
queryById: "/org.jeecg.pm/alarmQuery/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>
\ No newline at end of file
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<alarm-query-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></alarm-query-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import AlarmQueryForm from './AlarmQueryForm'
export default {
name: 'AlarmQueryModal',
components: {
AlarmQueryForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
\ No newline at end of file
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<alarm-query-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></alarm-query-form>
</j-modal>
</template>
<script>
import AlarmQueryForm from './AlarmQueryForm'
export default {
name: 'AlarmQueryModal',
components: {
AlarmQueryForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>
\ No newline at end of file
package org.jeecg.pm.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.pm.entity.AlarmQuery;
import org.jeecg.pm.service.IAlarmQueryService;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 报警查询
* @Author: jeecg-boot
* @Date: 2022-04-25
* @Version: V1.0
*/
@Api(tags="报警查询")
@RestController
@RequestMapping("/pm/alarmQuery")
@Slf4j
public class AlarmQueryController extends JeecgController<AlarmQuery, IAlarmQueryService> {
@Autowired
private IAlarmQueryService alarmQueryService;
/**
* 分页列表查询
*
* @param alarmQuery
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "报警查询-分页列表查询")
@ApiOperation(value="报警查询-分页列表查询", notes="报警查询-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<AlarmQuery>> queryPageList(AlarmQuery alarmQuery,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<AlarmQuery>> result = new Result<IPage<AlarmQuery>>();
QueryWrapper<AlarmQuery> queryWrapper = QueryGenerator.initQueryWrapper(alarmQuery, req.getParameterMap());
Page<AlarmQuery> page = new Page<AlarmQuery>(pageNo, pageSize);
IPage<AlarmQuery> pageList = alarmQueryService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 添加
*
* @param alarmQuery
* @return
*/
@AutoLog(value = "报警查询-添加")
@ApiOperation(value="报警查询-添加", notes="报警查询-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody AlarmQuery alarmQuery) {
alarmQueryService.save(alarmQuery);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param alarmQuery
* @return
*/
@AutoLog(value = "报警查询-编辑")
@ApiOperation(value="报警查询-编辑", notes="报警查询-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody AlarmQuery alarmQuery) {
alarmQueryService.updateById(alarmQuery);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "报警查询-通过id删除")
@ApiOperation(value="报警查询-通过id删除", notes="报警查询-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
alarmQueryService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "报警查询-批量删除")
@ApiOperation(value="报警查询-批量删除", notes="报警查询-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.alarmQueryService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "报警查询-通过id查询")
@ApiOperation(value="报警查询-通过id查询", notes="报警查询-通过id查询")
@GetMapping(value = "/queryById")
public Result<AlarmQuery> queryById(@RequestParam(name="id",required=true) String id) {
AlarmQuery alarmQuery = alarmQueryService.getById(id);
if(alarmQuery==null) {
return Result.error("未找到对应数据",null);
}
return Result.OK(alarmQuery);
}
/**
* 导出excel
*
* @param request
* @param alarmQuery
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AlarmQuery alarmQuery) {
return super.exportXls(request, alarmQuery, AlarmQuery.class, "报警查询");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, AlarmQuery.class);
}
}
package org.jeecg.pm.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 报警查询
* @Author: jeecg-boot
* @Date: 2022-04-25
* @Version: V1.0
*/
@Data
@TableName("alarm_query")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="alarm_query对象", description="报警查询")
public class AlarmQuery implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private Integer id;
/**设备编码*/
@Excel(name = "设备编码", width = 15)
@ApiModelProperty(value = "设备编码")
private String equipmentNumber;
/**设备类型 1:出入口闸机 2:访客一体机 3:自助访客机 4:身份证读卡器 5:人脸识别*/
@Excel(name = "设备类型", width = 15,dicCode = "alarm_query_equipmentType")
@Dict(dicCode = "alarm_query_equipmentType")
private Integer equipmentType;
/**设备名称*/
@Excel(name = "设备名称", width = 15)
@ApiModelProperty(value = "设备名称")
private String equipmentName;
/**区域名称*/
@Excel(name = "区域名称", width = 15)
@ApiModelProperty(value = "区域名称")
private String districtName;
/**ip地址*/
@Excel(name = "ip地址", width = 15)
@ApiModelProperty(value = "ip地址")
private String ipAddress;
/**状态 1:报警*/
@Excel(name = "状态", width = 15,dicCode = "alarm_query_status")
@Dict(dicCode = "alarm_query_status")
@ApiModelProperty(value = "状态 1:报警")
private Integer status;
/**创建时间*/
@Excel(name = "报警时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "报警时间")
private Date createTime;
/**修改时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
/**删除状态*/
@Excel(name = "删除状态", width = 15)
@ApiModelProperty(value = "删除状态")
private Boolean deleted;
}
package org.jeecg.pm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.pm.entity.AlarmQuery;
/**
* @Description: 报警查询
* @Author: jeecg-boot
* @Date: 2022-04-25
* @Version: V1.0
*/
public interface AlarmQueryMapper extends BaseMapper<AlarmQuery> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.pm.mapper.AlarmQueryMapper">
</mapper>
\ No newline at end of file
package org.jeecg.pm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.pm.entity.AlarmQuery;
/**
* @Description: 报警查询
* @Author: jeecg-boot
* @Date: 2022-04-25
* @Version: V1.0
*/
public interface IAlarmQueryService extends IService<AlarmQuery> {
}
package org.jeecg.pm.service.impl;
import org.jeecg.pm.entity.AlarmQuery;
import org.jeecg.pm.mapper.AlarmQueryMapper;
import org.jeecg.pm.service.IAlarmQueryService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 报警查询
* @Author: jeecg-boot
* @Date: 2022-04-25
* @Version: V1.0
*/
@Service
public class AlarmQueryServiceImpl extends ServiceImpl<AlarmQueryMapper, AlarmQuery> implements IAlarmQueryService {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment