工程机械数字服务平台设备管理9210-设备数据模块开发
This commit is contained in:
parent
f896d78f3b
commit
08d7cb3d41
@ -0,0 +1,98 @@
|
||||
package com.god.web.controller.deviceData;
|
||||
|
||||
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.god.common.annotation.Log;
|
||||
import com.god.common.core.controller.BaseController;
|
||||
import com.god.common.core.domain.AjaxResult;
|
||||
import com.god.common.enums.BusinessType;
|
||||
import com.god.deviceData.domain.GcjxDeviceData;
|
||||
import com.god.deviceData.service.IGcjxDeviceDataService;
|
||||
import com.god.common.utils.poi.ExcelUtil;
|
||||
import com.god.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备数据Controller
|
||||
*
|
||||
* @author god
|
||||
* @date 2023-12-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/deviceData/deviceData")
|
||||
public class GcjxDeviceDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IGcjxDeviceDataService gcjxDeviceDataService;
|
||||
|
||||
/**
|
||||
* 查询设备数据列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
startPage();
|
||||
List<GcjxDeviceData> list = gcjxDeviceDataService.selectGcjxDeviceDataList(gcjxDeviceData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备数据列表
|
||||
*/
|
||||
@Log(title = "设备数据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
List<GcjxDeviceData> list = gcjxDeviceDataService.selectGcjxDeviceDataList(gcjxDeviceData);
|
||||
ExcelUtil<GcjxDeviceData> util = new ExcelUtil<GcjxDeviceData>(GcjxDeviceData.class);
|
||||
util.exportExcel(response, list, "设备数据数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备数据详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(gcjxDeviceDataService.selectGcjxDeviceDataById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备数据
|
||||
*/
|
||||
@Log(title = "设备数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
return toAjax(gcjxDeviceDataService.insertGcjxDeviceData(gcjxDeviceData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备数据
|
||||
*/
|
||||
@Log(title = "设备数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
return toAjax(gcjxDeviceDataService.updateGcjxDeviceData(gcjxDeviceData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备数据
|
||||
*/
|
||||
@Log(title = "设备数据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(gcjxDeviceDataService.deleteGcjxDeviceDataByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.god.deviceData.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.god.common.annotation.Excel;
|
||||
import com.god.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
/**
|
||||
* 设备数据对象 gcjx_device_data
|
||||
*
|
||||
* @author god
|
||||
* @date 2023-12-04
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class GcjxDeviceData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@Excel(name = "主键")
|
||||
private String id;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
private String deviceCode;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 设备状态 */
|
||||
@Excel(name = "设备状态")
|
||||
private String deviceStatus;
|
||||
|
||||
/** 故障类型 */
|
||||
@Excel(name = "故障类型")
|
||||
private String faultType;
|
||||
|
||||
/** 故障描述 */
|
||||
@Excel(name = "故障描述")
|
||||
private String faultDetail;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
|
||||
/** 工作时间 */
|
||||
@Excel(name = "工作时间")
|
||||
private String workTime;
|
||||
|
||||
/** 接口名称 */
|
||||
@Excel(name = "接口名称")
|
||||
private String interfaceType;
|
||||
|
||||
/** 时间日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "时间日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deviceTime;
|
||||
|
||||
/** 设备油耗 */
|
||||
@Excel(name = "设备油耗")
|
||||
private String deviceFuel;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.god.deviceData.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.god.deviceData.domain.GcjxDeviceData;
|
||||
|
||||
/**
|
||||
* 设备数据Mapper接口
|
||||
*
|
||||
* @author god
|
||||
* @date 2023-12-04
|
||||
*/
|
||||
public interface GcjxDeviceDataMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备数据
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 设备数据
|
||||
*/
|
||||
public GcjxDeviceData selectGcjxDeviceDataById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备数据列表
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 设备数据集合
|
||||
*/
|
||||
public List<GcjxDeviceData> selectGcjxDeviceDataList(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 新增设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGcjxDeviceData(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 修改设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGcjxDeviceData(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 删除设备数据
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGcjxDeviceDataById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除设备数据
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGcjxDeviceDataByIds(String[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.god.deviceData.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.god.deviceData.domain.GcjxDeviceData;
|
||||
|
||||
/**
|
||||
* 设备数据Service接口
|
||||
*
|
||||
* @author god
|
||||
* @date 2023-12-04
|
||||
*/
|
||||
public interface IGcjxDeviceDataService
|
||||
{
|
||||
/**
|
||||
* 查询设备数据
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 设备数据
|
||||
*/
|
||||
public GcjxDeviceData selectGcjxDeviceDataById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备数据列表
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 设备数据集合
|
||||
*/
|
||||
public List<GcjxDeviceData> selectGcjxDeviceDataList(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 新增设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGcjxDeviceData(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 修改设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGcjxDeviceData(GcjxDeviceData gcjxDeviceData);
|
||||
|
||||
/**
|
||||
* 批量删除设备数据
|
||||
*
|
||||
* @param ids 需要删除的设备数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGcjxDeviceDataByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除设备数据信息
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGcjxDeviceDataById(String id);
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.god.deviceData.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.god.common.utils.uuid.Seq;
|
||||
import com.god.deviceData.mapper.GcjxDeviceDataMapper;
|
||||
import com.god.deviceData.domain.GcjxDeviceData;
|
||||
import com.god.deviceData.service.IGcjxDeviceDataService;
|
||||
|
||||
|
||||
/**
|
||||
* 设备数据Service业务层处理
|
||||
*
|
||||
* @author god
|
||||
* @date 2023-12-04
|
||||
*/
|
||||
@Service
|
||||
public class GcjxDeviceDataServiceImpl implements IGcjxDeviceDataService
|
||||
{
|
||||
@Autowired
|
||||
private GcjxDeviceDataMapper gcjxDeviceDataMapper;
|
||||
private final String CODE_PREFIX = "GCJX";
|
||||
|
||||
/**
|
||||
* 查询设备数据
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 设备数据
|
||||
*/
|
||||
@Override
|
||||
public GcjxDeviceData selectGcjxDeviceDataById(String id)
|
||||
{
|
||||
return gcjxDeviceDataMapper.selectGcjxDeviceDataById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备数据列表
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 设备数据
|
||||
*/
|
||||
@Override
|
||||
public List<GcjxDeviceData> selectGcjxDeviceDataList(GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
return gcjxDeviceDataMapper.selectGcjxDeviceDataList(gcjxDeviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertGcjxDeviceData(GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
gcjxDeviceData.setId(UUID.randomUUID().toString());
|
||||
gcjxDeviceData.setDeviceCode(CODE_PREFIX + Seq.getId(CODE_PREFIX));
|
||||
return gcjxDeviceDataMapper.insertGcjxDeviceData(gcjxDeviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备数据
|
||||
*
|
||||
* @param gcjxDeviceData 设备数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateGcjxDeviceData(GcjxDeviceData gcjxDeviceData)
|
||||
{
|
||||
return gcjxDeviceDataMapper.updateGcjxDeviceData(gcjxDeviceData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备数据
|
||||
*
|
||||
* @param ids 需要删除的设备数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGcjxDeviceDataByIds(String[] ids)
|
||||
{
|
||||
return gcjxDeviceDataMapper.deleteGcjxDeviceDataByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备数据信息
|
||||
*
|
||||
* @param id 设备数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGcjxDeviceDataById(String id)
|
||||
{
|
||||
return gcjxDeviceDataMapper.deleteGcjxDeviceDataById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
<?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.god.deviceData.mapper.GcjxDeviceDataMapper">
|
||||
|
||||
<resultMap type="GcjxDeviceData" id="GcjxDeviceDataResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deviceCode" column="device_code" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="deviceStatus" column="device_status" />
|
||||
<result property="faultType" column="fault_type" />
|
||||
<result property="faultDetail" column="fault_detail" />
|
||||
<result property="longitude" column="longitude" />
|
||||
<result property="latitude" column="latitude" />
|
||||
<result property="workTime" column="work_time" />
|
||||
<result property="interfaceType" column="interface_type" />
|
||||
<result property="deviceTime" column="device_time" />
|
||||
<result property="deviceFuel" column="device_fuel" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGcjxDeviceDataVo">
|
||||
select id, device_code, device_name, device_status, fault_type, fault_detail, longitude, latitude, work_time, interface_type, device_time, device_fuel from gcjx_device_data
|
||||
</sql>
|
||||
|
||||
<select id="selectGcjxDeviceDataList" parameterType="GcjxDeviceData" resultMap="GcjxDeviceDataResult">
|
||||
<include refid="selectGcjxDeviceDataVo"/>
|
||||
<where>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
|
||||
<if test="faultType != null and faultType != ''"> and fault_type = #{faultType}</if>
|
||||
<if test="faultDetail != null and faultDetail != ''"> and fault_detail like concat('%', #{faultDetail}, '%')</if>
|
||||
<if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
|
||||
<if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
|
||||
<if test="workTime != null and workTime != ''"> and work_time like concat('%', #{workTime}, '%')</if>
|
||||
<if test="interfaceType != null and interfaceType != ''"> and interface_type = #{interfaceType}</if>
|
||||
<if test="deviceTime != null "> and DATE_FORMAT(device_time,'%Y-%m-%d') like DATE_FORMAT(#{deviceTime},'%Y-%m-%d')</if>
|
||||
<if test="deviceFuel != null and deviceFuel != ''"> and device_fuel like concat('%', #{deviceFuel}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectGcjxDeviceDataById" parameterType="String" resultMap="GcjxDeviceDataResult">
|
||||
<include refid="selectGcjxDeviceDataVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertGcjxDeviceData" parameterType="GcjxDeviceData">
|
||||
insert into gcjx_device_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="deviceCode != null">device_code,</if>
|
||||
<if test="deviceName != null">device_name,</if>
|
||||
<if test="deviceStatus != null">device_status,</if>
|
||||
<if test="faultType != null">fault_type,</if>
|
||||
<if test="faultDetail != null">fault_detail,</if>
|
||||
<if test="longitude != null">longitude,</if>
|
||||
<if test="latitude != null">latitude,</if>
|
||||
<if test="workTime != null">work_time,</if>
|
||||
<if test="interfaceType != null">interface_type,</if>
|
||||
<if test="deviceTime != null">device_time,</if>
|
||||
<if test="deviceFuel != null">device_fuel,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="deviceCode != null">#{deviceCode},</if>
|
||||
<if test="deviceName != null">#{deviceName},</if>
|
||||
<if test="deviceStatus != null">#{deviceStatus},</if>
|
||||
<if test="faultType != null">#{faultType},</if>
|
||||
<if test="faultDetail != null">#{faultDetail},</if>
|
||||
<if test="longitude != null">#{longitude},</if>
|
||||
<if test="latitude != null">#{latitude},</if>
|
||||
<if test="workTime != null">#{workTime},</if>
|
||||
<if test="interfaceType != null">#{interfaceType},</if>
|
||||
<if test="deviceTime != null">#{deviceTime},</if>
|
||||
<if test="deviceFuel != null">#{deviceFuel},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateGcjxDeviceData" parameterType="GcjxDeviceData">
|
||||
update gcjx_device_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
||||
<if test="deviceName != null">device_name = #{deviceName},</if>
|
||||
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
|
||||
<if test="faultType != null">fault_type = #{faultType},</if>
|
||||
<if test="faultDetail != null">fault_detail = #{faultDetail},</if>
|
||||
<if test="longitude != null">longitude = #{longitude},</if>
|
||||
<if test="latitude != null">latitude = #{latitude},</if>
|
||||
<if test="workTime != null">work_time = #{workTime},</if>
|
||||
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
|
||||
<if test="deviceTime != null">device_time = #{deviceTime},</if>
|
||||
<if test="deviceFuel != null">device_fuel = #{deviceFuel},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteGcjxDeviceDataById" parameterType="String">
|
||||
delete from gcjx_device_data where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteGcjxDeviceDataByIds" parameterType="String">
|
||||
delete from gcjx_device_data where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
god-ui/src/api/deviceData/deviceData.js
Normal file
44
god-ui/src/api/deviceData/deviceData.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询设备数据列表
|
||||
export function listDeviceData(query) {
|
||||
return request({
|
||||
url: '/deviceData/deviceData/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备数据详细
|
||||
export function getDeviceData(id) {
|
||||
return request({
|
||||
url: '/deviceData/deviceData/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备数据
|
||||
export function addDeviceData(data) {
|
||||
return request({
|
||||
url: '/deviceData/deviceData',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备数据
|
||||
export function updateDeviceData(data) {
|
||||
return request({
|
||||
url: '/deviceData/deviceData',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备数据
|
||||
export function delDeviceData(id) {
|
||||
return request({
|
||||
url: '/deviceData/deviceData/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
314
god-ui/src/views/deviceData/exponentCondition/index.vue
Normal file
314
god-ui/src/views/deviceData/exponentCondition/index.vue
Normal file
@ -0,0 +1,314 @@
|
||||
<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="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="故障类型" prop="faultType">
|
||||
<el-select v-model="queryParams.faultType" placeholder="请选择故障类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.gcjx_fault_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="故障时间" prop="deviceTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.deviceTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择故障时间">
|
||||
</el-date-picker>
|
||||
</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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceDataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="deviceCode" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="故障类型" align="center" prop="faultType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.gcjx_fault_type" :value="scope.row.faultType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="故障时间" align="center" prop="deviceTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deviceTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="故障描述" align="center" prop="faultDetail" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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" disabled placeholder="自动生成..." />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="故障类型" prop="faultType">
|
||||
<el-select v-model="form.faultType" style="width: 100%" placeholder="请选择故障类型">
|
||||
<el-option
|
||||
v-for="dict in dict.type.gcjx_fault_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="故障时间" prop="deviceTime">
|
||||
<el-date-picker clearable
|
||||
style="width: 100%"
|
||||
v-model="form.deviceTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择故障时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="故障描述" prop="faultDetail">
|
||||
<el-input type="textarea" v-model="form.faultDetail" 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 { listDeviceData, getDeviceData, delDeviceData, addDeviceData, updateDeviceData } from "@/api/deviceData/deviceData";
|
||||
|
||||
export default {
|
||||
name: "DeviceData",
|
||||
dicts: ['gcjx_fault_type', 'gcjx_action'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备数据表格数据
|
||||
deviceDataList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: "设备指数情况",
|
||||
deviceTime: null,
|
||||
deviceFuel: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备数据列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceData(this.queryParams).then(response => {
|
||||
this.deviceDataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: "设备指数情况",
|
||||
deviceTime: null,
|
||||
deviceFuel: 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
|
||||
getDeviceData(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) {
|
||||
updateDeviceData(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDeviceData(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 delDeviceData(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('deviceData/deviceData/export', {
|
||||
...this.queryParams
|
||||
}, `deviceData_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
311
god-ui/src/views/deviceData/fuelCondition/index.vue
Normal file
311
god-ui/src/views/deviceData/fuelCondition/index.vue
Normal file
@ -0,0 +1,311 @@
|
||||
<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="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备油耗" prop="deviceFuel">
|
||||
<el-input
|
||||
v-model="queryParams.deviceFuel"
|
||||
placeholder="请输入设备油耗"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="运行时长" prop="workTime">
|
||||
<el-input
|
||||
v-model="queryParams.workTime"
|
||||
placeholder="请输入运行时长"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期" prop="deviceTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.deviceTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择日期">
|
||||
</el-date-picker>
|
||||
</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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceDataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="deviceCode" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备油耗" align="center" prop="deviceFuel" />
|
||||
<el-table-column label="运行时长" align="center" prop="workTime" />
|
||||
<el-table-column label="日期" align="center" prop="deviceTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deviceTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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" disabled placeholder="自动生成..." />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备油耗" prop="deviceFuel">
|
||||
<el-input v-model="form.deviceFuel" placeholder="请输入设备油耗" />
|
||||
</el-form-item>
|
||||
<el-form-item label="运行时长" prop="workTime">
|
||||
<el-input v-model="form.workTime" placeholder="请输入运行时长" />
|
||||
</el-form-item>
|
||||
<el-form-item label="日期" prop="deviceTime">
|
||||
<el-date-picker clearable style="width: 100%"
|
||||
v-model="form.deviceTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择日期">
|
||||
</el-date-picker>
|
||||
</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 { listDeviceData, getDeviceData, delDeviceData, addDeviceData, updateDeviceData } from "@/api/deviceData/deviceData";
|
||||
import {parseTime} from "@/utils/god";
|
||||
|
||||
export default {
|
||||
name: "DeviceData",
|
||||
dicts: ['gcjx_fault_type', 'gcjx_action'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备数据表格数据
|
||||
deviceDataList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: "设备油耗情况",
|
||||
deviceTime: null,
|
||||
deviceFuel: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备数据列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceData(this.queryParams).then(response => {
|
||||
this.deviceDataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: null,
|
||||
deviceTime: parseTime(new Date()),
|
||||
deviceFuel: 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
|
||||
getDeviceData(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) {
|
||||
this.form.interfaceType="设备油耗情况"
|
||||
updateDeviceData(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.form.interfaceType="设备油耗情况"
|
||||
addDeviceData(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 delDeviceData(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('deviceData/deviceData/export', {
|
||||
...this.queryParams
|
||||
}, `deviceData_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
315
god-ui/src/views/deviceData/workCondition/index.vue
Normal file
315
god-ui/src/views/deviceData/workCondition/index.vue
Normal file
@ -0,0 +1,315 @@
|
||||
<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="deviceName">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备动作" prop="deviceStatus">
|
||||
<el-select v-model="queryParams.deviceStatus" placeholder="请选择设备动作" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.gcjx_action"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间日期" prop="deviceTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.deviceTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择时间日期">
|
||||
</el-date-picker>
|
||||
</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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceDataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备编码" align="center" prop="deviceCode" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备动作" align="center" prop="deviceStatus">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.gcjx_action" :value="scope.row.deviceStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时间日期" align="center" prop="deviceTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.deviceTime, '{y}-{m}-{d} {h}:{mi}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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 disabled v-model="form.deviceCode" placeholder="自动生成..." />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备动作" prop="deviceStatus">
|
||||
<el-select v-model="form.deviceStatus" placeholder="请选择设备状态" style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in dict.type.gcjx_action"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间日期" prop="deviceTime">
|
||||
<el-date-picker clearable style="width: 100%"
|
||||
v-model="form.deviceTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择时间日期">
|
||||
</el-date-picker>
|
||||
</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 { listDeviceData, getDeviceData, delDeviceData, addDeviceData, updateDeviceData } from "@/api/deviceData/deviceData";
|
||||
import {parseTime} from "@/utils/god";
|
||||
|
||||
export default {
|
||||
name: "DeviceData",
|
||||
dicts: ['gcjx_fault_type', 'gcjx_action'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备数据表格数据
|
||||
deviceDataList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: "设备工作情况",
|
||||
deviceTime: null,
|
||||
deviceFuel: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询设备数据列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDeviceData(this.queryParams).then(response => {
|
||||
this.deviceDataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deviceCode: null,
|
||||
deviceName: null,
|
||||
deviceStatus: null,
|
||||
faultType: null,
|
||||
faultDetail: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
workTime: null,
|
||||
interfaceType: null,
|
||||
deviceTime: parseTime(new Date()),
|
||||
deviceFuel: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.daterangeReAssessTime = [];
|
||||
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
|
||||
getDeviceData(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) {
|
||||
this.form.interfaceType="设备工作情况"
|
||||
updateDeviceData(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.form.interfaceType="设备工作情况"
|
||||
addDeviceData(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 delDeviceData(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('deviceData/deviceData/export', {
|
||||
...this.queryParams
|
||||
}, `deviceData_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user