设备信息页面与大屏接口

This commit is contained in:
猫猫guowen
2025-06-12 15:06:57 +08:00
parent 20e6ddfe30
commit 0f094e2d59
11 changed files with 1139 additions and 2 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.device.DeviceCar.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设备信息Controller
*
* @author ruoyi
* @date 2025-06-12
*/
@RestController
@RequestMapping("/device/DeviceCar")
public class DeviceCarController extends BaseController
{
@Autowired
private IDeviceCarService deviceCarService;
/**
* 查询设备信息列表
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:list')")
@GetMapping("/list")
public TableDataInfo list(DeviceCar deviceCar)
{
startPage();
List<DeviceCar> list = deviceCarService.selectDeviceCarList(deviceCar);
return getDataTable(list);
}
/**
* 导出设备信息列表
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:export')")
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeviceCar deviceCar)
{
List<DeviceCar> list = deviceCarService.selectDeviceCarList(deviceCar);
ExcelUtil<DeviceCar> util = new ExcelUtil<DeviceCar>(DeviceCar.class);
util.exportExcel(response, list, "设备信息数据");
}
/**
* 获取设备信息详细信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(deviceCarService.selectDeviceCarById(id));
}
/**
* 新增设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:add')")
@Log(title = "设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeviceCar deviceCar)
{
return toAjax(deviceCarService.insertDeviceCar(deviceCar));
}
/**
* 修改设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:edit')")
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeviceCar deviceCar)
{
return toAjax(deviceCarService.updateDeviceCar(deviceCar));
}
/**
* 删除设备信息
*/
@PreAuthorize("@ss.hasPermi('device:DeviceCar:remove')")
@Log(title = "设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceCarService.deleteDeviceCarByIds(ids));
}
}

View File

@@ -0,0 +1,233 @@
package com.ruoyi.device.DeviceCar.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 设备信息对象 device_car
*
* @author ruoyi
* @date 2025-06-12
*/
public class DeviceCar extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 设备唯一编码 */
@Excel(name = "设备唯一编码")
private String deviceCode ;
/** 设备名称 */
@Excel(name = "设备名称")
private String name ;
/** 1-AGV 2-CTU 3-SSJ */
@Excel(name = "1-AGV 2-CTU 3-SSJ")
private String type;
/** 设备IP */
@Excel(name = "设备IP")
private String ipAddress;
/** 关联缓冲区 */
@Excel(name = "关联缓冲区")
private String bufferAreaId ;
/** 0-F 1-T */
@Excel(name = "0-F 1-T")
private String isActive;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare1;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare2;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare3;
/** 备用字段 */
@Excel(name = "备用字段")
private String spare4;
/** 任务号 */
@Excel(name = "任务号")
private String taskNo;
/** 执行阶段 */
@Excel(name = "执行阶段")
private String zxjd;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeviceCode (String deviceCode )
{
this.deviceCode = deviceCode ;
}
public String getDeviceCode ()
{
return deviceCode ;
}
public void setName (String name )
{
this.name = name ;
}
public String getName ()
{
return name ;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}
public String getIpAddress()
{
return ipAddress;
}
public void setBufferAreaId (String bufferAreaId )
{
this.bufferAreaId = bufferAreaId ;
}
public String getBufferAreaId ()
{
return bufferAreaId ;
}
public void setIsActive(String isActive)
{
this.isActive = isActive;
}
public String getIsActive()
{
return isActive;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setSpare1(String spare1)
{
this.spare1 = spare1;
}
public String getSpare1()
{
return spare1;
}
public void setSpare2(String spare2)
{
this.spare2 = spare2;
}
public String getSpare2()
{
return spare2;
}
public void setSpare3(String spare3)
{
this.spare3 = spare3;
}
public String getSpare3()
{
return spare3;
}
public void setSpare4(String spare4)
{
this.spare4 = spare4;
}
public String getSpare4()
{
return spare4;
}
public void setTaskNo(String taskNo)
{
this.taskNo = taskNo;
}
public String getTaskNo()
{
return taskNo;
}
public void setZxjd(String zxjd)
{
this.zxjd = zxjd;
}
public String getZxjd()
{
return zxjd;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deviceCode ", getDeviceCode ())
.append("name ", getName ())
.append("type", getType())
.append("ipAddress", getIpAddress())
.append("bufferAreaId ", getBufferAreaId ())
.append("isActive", getIsActive())
.append("createTime", getCreateTime())
.append("status", getStatus())
.append("spare1", getSpare1())
.append("spare2", getSpare2())
.append("spare3", getSpare3())
.append("spare4", getSpare4())
.append("taskNo", getTaskNo())
.append("zxjd", getZxjd())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.DeviceCar.mapper;
import java.util.List;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
/**
* 设备信息Mapper接口
*
* @author ruoyi
* @date 2025-06-12
*/
public interface DeviceCarMapper
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public DeviceCar selectDeviceCarById(Long id);
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息集合
*/
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar);
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int insertDeviceCar(DeviceCar deviceCar);
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int updateDeviceCar(DeviceCar deviceCar);
/**
* 删除设备信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteDeviceCarById(Long id);
/**
* 批量删除设备信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeviceCarByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.DeviceCar.service;
import java.util.List;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
/**
* 设备信息Service接口
*
* @author ruoyi
* @date 2025-06-12
*/
public interface IDeviceCarService
{
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
public DeviceCar selectDeviceCarById(Long id);
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息集合
*/
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar);
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int insertDeviceCar(DeviceCar deviceCar);
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
public int updateDeviceCar(DeviceCar deviceCar);
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键集合
* @return 结果
*/
public int deleteDeviceCarByIds(Long[] ids);
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
public int deleteDeviceCarById(Long id);
}

View File

@@ -0,0 +1,95 @@
package com.ruoyi.device.DeviceCar.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.DeviceCar.mapper.DeviceCarMapper;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
/**
* 设备信息Service业务层处理
*
* @author ruoyi
* @date 2025-06-12
*/
@Service
public class DeviceCarServiceImpl implements IDeviceCarService
{
@Autowired
private DeviceCarMapper deviceCarMapper;
/**
* 查询设备信息
*
* @param id 设备信息主键
* @return 设备信息
*/
@Override
public DeviceCar selectDeviceCarById(Long id)
{
return deviceCarMapper.selectDeviceCarById(id);
}
/**
* 查询设备信息列表
*
* @param deviceCar 设备信息
* @return 设备信息
*/
@Override
public List<DeviceCar> selectDeviceCarList(DeviceCar deviceCar)
{
return deviceCarMapper.selectDeviceCarList(deviceCar);
}
/**
* 新增设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
@Override
public int insertDeviceCar(DeviceCar deviceCar)
{
deviceCar.setCreateTime(DateUtils.getNowDate());
return deviceCarMapper.insertDeviceCar(deviceCar);
}
/**
* 修改设备信息
*
* @param deviceCar 设备信息
* @return 结果
*/
@Override
public int updateDeviceCar(DeviceCar deviceCar)
{
return deviceCarMapper.updateDeviceCar(deviceCar);
}
/**
* 批量删除设备信息
*
* @param ids 需要删除的设备信息主键
* @return 结果
*/
@Override
public int deleteDeviceCarByIds(Long[] ids)
{
return deviceCarMapper.deleteDeviceCarByIds(ids);
}
/**
* 删除设备信息信息
*
* @param id 设备信息主键
* @return 结果
*/
@Override
public int deleteDeviceCarById(Long id)
{
return deviceCarMapper.deleteDeviceCarById(id);
}
}

View File

@@ -18,6 +18,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.device.api.domain.RequestLog;
import com.ruoyi.device.api.service.IRequestLogService;
import com.ruoyi.device.DeviceCar.domain.DeviceCar;
import com.ruoyi.device.DeviceCar.service.IDeviceCarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -34,6 +36,19 @@ public class RequestLogController extends BaseController
@Autowired
private IRequestLogService requestLogService;
@Autowired
private IDeviceCarService deviceCarService;
/**
* 查询所有设备信息
*/
@GetMapping("/devicecar/list")
public AjaxResult listAllDeviceCar()
{
List<DeviceCar> list = deviceCarService.selectDeviceCarList(new DeviceCar());
return success(list);
}
/**
* 查询接口记录列表
*/

View File

@@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8080
port: 8081
servlet:
# 应用的访问路径
context-path: /

View File

@@ -0,0 +1,120 @@
<?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="com.ruoyi.device.DeviceCar.mapper.DeviceCarMapper">
<resultMap type="DeviceCar" id="DeviceCarResult">
<result property="id" column="id" />
<result property="deviceCode " column="device_code " />
<result property="name " column="name " />
<result property="type" column="type" />
<result property="ipAddress" column="ip_address" />
<result property="bufferAreaId " column="buffer_area_id " />
<result property="isActive" column="is_active" />
<result property="createTime" column="create_time" />
<result property="status" column="status" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare3" column="spare3" />
<result property="spare4" column="spare4" />
<result property="taskNo" column="task_no" />
<result property="zxjd" column="zxjd" />
</resultMap>
<sql id="selectDeviceCarVo">
select id, device_code , name , type, ip_address, buffer_area_id , is_active, create_time, status, spare1, spare2, spare3, spare4, task_no, zxjd from device_car
</sql>
<select id="selectDeviceCarList" parameterType="DeviceCar" resultMap="DeviceCarResult">
<include refid="selectDeviceCarVo"/>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode }</if>
<if test="name != null and name != ''"> and name like concat('%',#{name },'%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address like concat('%',#{ipAddress},'%')</if>
<if test="bufferAreaId != null and bufferAreaId != ''"> and buffer_area_id like concat('%',#{bufferAreaId },'%')</if>
<if test="isActive != null and isActive != ''"> and is_active like concat('%',#{isActive},'%')</if>
<if test="status != null and status != ''"> and status like concat('%',#{status},'%')</if>
<if test="spare1 != null and spare1 != ''"> and spare1 like concat('%',#{spare1},'%')</if>
<if test="spare2 != null and spare2 != ''"> and spare2 like concat('%',#{spare2},'%')</if>
<if test="spare3 != null and spare3 != ''"> and spare3 like concat('%',#{spare3},'%')</if>
<if test="spare4 != null and spare4 != ''"> and spare4 like concat('%',#{spare4},'%')</if>
<if test="taskNo != null and taskNo != ''"> and task_no like concat('%',#{taskNo},'%')</if>
<if test="zxjd != null and zxjd != ''"> and zxjd = #{zxjd}</if>
</where>
</select>
<select id="selectDeviceCarById" parameterType="Long" resultMap="DeviceCarResult">
<include refid="selectDeviceCarVo"/>
where id = #{id}
</select>
<insert id="insertDeviceCar" parameterType="DeviceCar" useGeneratedKeys="true" keyProperty="id">
insert into device_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceCode != null">device_code ,</if>
<if test="name != null">name ,</if>
<if test="type != null">type,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="bufferAreaId != null">buffer_area_id ,</if>
<if test="isActive != null">is_active,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="taskNo != null">task_no,</if>
<if test="zxjd != null">zxjd,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceCode != null">#{deviceCode },</if>
<if test="name != null">#{name },</if>
<if test="type != null">#{type},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="bufferAreaId != null">#{bufferAreaId },</if>
<if test="isActive != null">#{isActive},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="taskNo != null">#{taskNo},</if>
<if test="zxjd != null">#{zxjd},</if>
</trim>
</insert>
<update id="updateDeviceCar" parameterType="DeviceCar">
update device_car
<trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null">device_code = #{deviceCode },</if>
<if test="name != null">name = #{name },</if>
<if test="type != null">type = #{type},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="bufferAreaId != null">buffer_area_id = #{bufferAreaId },</if>
<if test="isActive != null">is_active = #{isActive},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="taskNo != null">task_no = #{taskNo},</if>
<if test="zxjd != null">zxjd = #{zxjd},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDeviceCarById" parameterType="Long">
delete from device_car where id = #{id}
</delete>
<delete id="deleteDeviceCarByIds" parameterType="String">
delete from device_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询设备信息列表
export function listDeviceCar(query) {
return request({
url: '/device/DeviceCar/list',
method: 'get',
params: query
})
}
// 查询设备信息详细
export function getDeviceCar(id) {
return request({
url: '/device/DeviceCar/' + id,
method: 'get'
})
}
// 新增设备信息
export function addDeviceCar(data) {
return request({
url: '/device/DeviceCar',
method: 'post',
data: data
})
}
// 修改设备信息
export function updateDeviceCar(data) {
return request({
url: '/device/DeviceCar',
method: 'put',
data: data
})
}
// 删除设备信息
export function delDeviceCar(id) {
return request({
url: '/device/DeviceCar/' + id,
method: 'delete'
})
}

View File

@@ -0,0 +1,404 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备唯一编码" prop="deviceCode ">
<el-input
v-model="queryParams.deviceCode "
placeholder="请输入设备唯一编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="name ">
<el-input
v-model="queryParams.name "
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备IP" prop="ipAddress">
<el-input
v-model="queryParams.ipAddress"
placeholder="请输入设备IP"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="类型" prop="ipAddress">
<el-input
v-model="queryParams.type"
placeholder="请输入设备类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="关联缓冲区" prop="bufferAreaId ">
<el-input
v-model="queryParams.bufferAreaId "
placeholder="请输入关联缓冲区"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="0-F 1-T" prop="isActive">
<el-input
v-model="queryParams.isActive"
placeholder="请输入0-F 1-T"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段" prop="spare1">
<el-input
v-model="queryParams.spare1"
placeholder="请输入备用字段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段" prop="spare2">
<el-input
v-model="queryParams.spare2"
placeholder="请输入备用字段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段" prop="spare3">
<el-input
v-model="queryParams.spare3"
placeholder="请输入备用字段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="备用字段" prop="spare4">
<el-input
v-model="queryParams.spare4"
placeholder="请输入备用字段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="任务号" prop="taskNo">
<el-input
v-model="queryParams.taskNo"
placeholder="请输入任务号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="执行阶段" prop="zxjd">
<el-input
v-model="queryParams.zxjd"
placeholder="请输入执行阶段"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['device:DeviceCar:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:DeviceCar:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['device:DeviceCar:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['device:DeviceCar:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="DeviceCarList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="设备唯一编码" align="center" prop="deviceCode" />
<el-table-column label="设备名称" align="center" prop="name" />
<el-table-column label="类型" align="center" prop="type" />
<el-table-column label="设备IP" align="center" prop="ipAddress" />
<el-table-column label="关联缓冲区" align="center" prop="bufferAreaId" />
<el-table-column label="0-F 1-T" align="center" prop="isActive" />
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="备用字段" align="center" prop="spare1" />
<el-table-column label="备用字段" align="center" prop="spare2" />
<el-table-column label="备用字段" align="center" prop="spare3" />
<el-table-column label="备用字段" align="center" prop="spare4" />
<el-table-column label="任务号" align="center" prop="taskNo" />
<el-table-column label="执行阶段" align="center" prop="zxjd" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['device:DeviceCar:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['device:DeviceCar:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备唯一编码" prop="deviceCode ">
<el-input v-model="form.deviceCode " placeholder="请输入设备唯一编码" />
</el-form-item>
<el-form-item label="设备名称" prop="name ">
<el-input v-model="form.name " placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备IP" prop="ipAddress">
<el-input v-model="form.ipAddress" placeholder="请输入设备IP" />
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-input v-model="form.type" placeholder="请输入设备类型" />
</el-form-item>
<el-form-item label="关联缓冲区" prop="bufferAreaId ">
<el-input v-model="form.bufferAreaId " placeholder="请输入关联缓冲区" />
</el-form-item>
<el-form-item label="0-F 1-T" prop="isActive">
<el-input v-model="form.isActive" placeholder="请输入0-F 1-T" />
</el-form-item>
<el-form-item label="备用字段" prop="spare1">
<el-input v-model="form.spare1" placeholder="请输入备用字段" />
</el-form-item>
<el-form-item label="备用字段" prop="spare2">
<el-input v-model="form.spare2" placeholder="请输入备用字段" />
</el-form-item>
<el-form-item label="备用字段" prop="spare3">
<el-input v-model="form.spare3" placeholder="请输入备用字段" />
</el-form-item>
<el-form-item label="备用字段" prop="spare4">
<el-input v-model="form.spare4" placeholder="请输入备用字段" />
</el-form-item>
<el-form-item label="任务号" prop="taskNo">
<el-input v-model="form.taskNo" placeholder="请输入任务号" />
</el-form-item>
<el-form-item label="执行阶段" prop="zxjd">
<el-input v-model="form.zxjd" placeholder="请输入执行阶段" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDeviceCar, getDeviceCar, delDeviceCar, addDeviceCar, updateDeviceCar } from "@/api/device/DeviceCar"
export default {
name: "DeviceCar",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 设备信息表格数据
DeviceCarList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceCode : null,
name : null,
type: null,
ipAddress: null,
bufferAreaId : null,
isActive: null,
status: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
taskNo: null,
zxjd: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询设备信息列表 */
getList() {
this.loading = true
listDeviceCar(this.queryParams).then(response => {
console.log(response)
this.DeviceCarList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
deviceCode : null,
name : null,
type: null,
ipAddress: null,
bufferAreaId : null,
isActive: null,
createTime: null,
status: null,
spare1: null,
spare2: null,
spare3: null,
spare4: null,
taskNo: null,
zxjd: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加设备信息"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getDeviceCar(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改设备信息"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDeviceCar(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addDeviceCar(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除设备信息编号为"' + ids + '"的数据项?').then(function() {
return delDeviceCar(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('device/DeviceCar/export', {
...this.queryParams
}, `DeviceCar_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
const baseUrl = 'http://localhost:8080' // 后端接口
const baseUrl = 'http://localhost:8081' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口