Compare commits
2 Commits
ed18b3f855
...
a8f8e92e4a
Author | SHA1 | Date | |
---|---|---|---|
a8f8e92e4a | |||
e369c5293b |
@ -0,0 +1,98 @@
|
||||
package com.god.web.controller.wlsbEqInfo;
|
||||
|
||||
import com.god.common.annotation.Log;
|
||||
import com.god.common.core.controller.BaseController;
|
||||
import com.god.common.core.domain.AjaxResult;
|
||||
import com.god.common.core.page.TableDataInfo;
|
||||
import com.god.common.enums.BusinessType;
|
||||
import com.god.common.utils.poi.ExcelUtil;
|
||||
import com.god.wlsbEqInfo.domain.WlsbEqInfo;
|
||||
import com.god.wlsbEqInfo.service.IWlsbEqInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备管理Controller
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wlsbEqInfo/eqInfo")
|
||||
public class WlsbEqInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWlsbEqInfoService wlsbEqInfoService;
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WlsbEqInfo wlsbEqInfo)
|
||||
{
|
||||
startPage();
|
||||
List<WlsbEqInfo> list = wlsbEqInfoService.selectWlsbEqInfoList(wlsbEqInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:export')")
|
||||
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WlsbEqInfo wlsbEqInfo)
|
||||
{
|
||||
List<WlsbEqInfo> list = wlsbEqInfoService.selectWlsbEqInfoList(wlsbEqInfo);
|
||||
ExcelUtil<WlsbEqInfo> util = new ExcelUtil<WlsbEqInfo>(WlsbEqInfo.class);
|
||||
util.exportExcel(response, list, "设备管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(wlsbEqInfoService.selectWlsbEqInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:add')")
|
||||
@Log(title = "设备管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WlsbEqInfo wlsbEqInfo)
|
||||
{
|
||||
return toAjax(wlsbEqInfoService.insertWlsbEqInfo(wlsbEqInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:edit')")
|
||||
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WlsbEqInfo wlsbEqInfo)
|
||||
{
|
||||
return toAjax(wlsbEqInfoService.updateWlsbEqInfo(wlsbEqInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqInfo:eqInfo:remove')")
|
||||
@Log(title = "设备管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(wlsbEqInfoService.deleteWlsbEqInfoByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.god.web.controller.wlsbEqState;
|
||||
|
||||
import com.god.common.annotation.Log;
|
||||
import com.god.common.core.controller.BaseController;
|
||||
import com.god.common.core.domain.AjaxResult;
|
||||
import com.god.common.core.page.TableDataInfo;
|
||||
import com.god.common.enums.BusinessType;
|
||||
import com.god.common.utils.poi.ExcelUtil;
|
||||
import com.god.wlsbEqState.domain.WlsbEqState;
|
||||
import com.god.wlsbEqState.service.IWlsbEqStateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备运行分析Controller
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wlsbEqState/eqState")
|
||||
public class WlsbEqStateController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWlsbEqStateService wlsbEqStateService;
|
||||
|
||||
/**
|
||||
* 查询设备运行分析列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WlsbEqState wlsbEqState)
|
||||
{
|
||||
startPage();
|
||||
List<WlsbEqState> list = wlsbEqStateService.selectWlsbEqStateList(wlsbEqState);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备运行分析列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:export')")
|
||||
@Log(title = "设备运行分析", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WlsbEqState wlsbEqState)
|
||||
{
|
||||
List<WlsbEqState> list = wlsbEqStateService.selectWlsbEqStateList(wlsbEqState);
|
||||
ExcelUtil<WlsbEqState> util = new ExcelUtil<WlsbEqState>(WlsbEqState.class);
|
||||
util.exportExcel(response, list, "设备运行分析数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备运行分析详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(wlsbEqStateService.selectWlsbEqStateById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备运行分析
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:add')")
|
||||
@Log(title = "设备运行分析", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WlsbEqState wlsbEqState)
|
||||
{
|
||||
return toAjax(wlsbEqStateService.insertWlsbEqState(wlsbEqState));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备运行分析
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:edit')")
|
||||
@Log(title = "设备运行分析", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WlsbEqState wlsbEqState)
|
||||
{
|
||||
return toAjax(wlsbEqStateService.updateWlsbEqState(wlsbEqState));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备运行分析
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wlsbEqState:eqState:remove')")
|
||||
@Log(title = "设备运行分析", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(wlsbEqStateService.deleteWlsbEqStateByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.god.utils;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 错误码对象
|
||||
|
||||
* TODO 错误码设计成对象的原因,为未来的 i18 国际化做准备
|
||||
*/
|
||||
@Data
|
||||
public class ErrorCode {
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private final Integer code;
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private final String msg;
|
||||
|
||||
public ErrorCode(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.msg = message;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
package com.god.wlsbEqInfo.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.god.common.annotation.Excel;
|
||||
import com.god.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备管理对象 wlsb_eq_info
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public class WlsbEqInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private String id;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String eqNum;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String eqName;
|
||||
|
||||
/** 设备类型 */
|
||||
@Excel(name = "设备类型")
|
||||
private String eqType;
|
||||
|
||||
/** 设备状态 */
|
||||
@Excel(name = "设备状态")
|
||||
private String eqState;
|
||||
|
||||
/** 启停状态 */
|
||||
@Excel(name = "启停状态")
|
||||
private String starrtStop;
|
||||
|
||||
/** 设备图片 */
|
||||
@Excel(name = "设备图片")
|
||||
private String eqImg;
|
||||
|
||||
/** 设备简述 */
|
||||
@Excel(name = "设备简述")
|
||||
private String eqSay;
|
||||
|
||||
/** 备注1 */
|
||||
@Excel(name = "备注1")
|
||||
private String note1;
|
||||
|
||||
/** 备注2 */
|
||||
@Excel(name = "备注2")
|
||||
private String note2;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setEqNum(String eqNum)
|
||||
{
|
||||
this.eqNum = eqNum;
|
||||
}
|
||||
|
||||
public String getEqNum()
|
||||
{
|
||||
return eqNum;
|
||||
}
|
||||
public void setEqName(String eqName)
|
||||
{
|
||||
this.eqName = eqName;
|
||||
}
|
||||
|
||||
public String getEqName()
|
||||
{
|
||||
return eqName;
|
||||
}
|
||||
public void setEqType(String eqType)
|
||||
{
|
||||
this.eqType = eqType;
|
||||
}
|
||||
|
||||
public String getEqType()
|
||||
{
|
||||
return eqType;
|
||||
}
|
||||
public void setEqState(String eqState)
|
||||
{
|
||||
this.eqState = eqState;
|
||||
}
|
||||
|
||||
public String getEqState()
|
||||
{
|
||||
return eqState;
|
||||
}
|
||||
public void setStarrtStop(String starrtStop)
|
||||
{
|
||||
this.starrtStop = starrtStop;
|
||||
}
|
||||
|
||||
public String getStarrtStop()
|
||||
{
|
||||
return starrtStop;
|
||||
}
|
||||
public void setEqImg(String eqImg)
|
||||
{
|
||||
this.eqImg = eqImg;
|
||||
}
|
||||
|
||||
public String getEqImg()
|
||||
{
|
||||
return eqImg;
|
||||
}
|
||||
public void setEqSay(String eqSay)
|
||||
{
|
||||
this.eqSay = eqSay;
|
||||
}
|
||||
|
||||
public String getEqSay()
|
||||
{
|
||||
return eqSay;
|
||||
}
|
||||
public void setNote1(String note1)
|
||||
{
|
||||
this.note1 = note1;
|
||||
}
|
||||
|
||||
public String getNote1()
|
||||
{
|
||||
return note1;
|
||||
}
|
||||
public void setNote2(String note2)
|
||||
{
|
||||
this.note2 = note2;
|
||||
}
|
||||
|
||||
public String getNote2()
|
||||
{
|
||||
return note2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("eqNum", getEqNum())
|
||||
.append("eqName", getEqName())
|
||||
.append("eqType", getEqType())
|
||||
.append("eqState", getEqState())
|
||||
.append("starrtStop", getStarrtStop())
|
||||
.append("eqImg", getEqImg())
|
||||
.append("eqSay", getEqSay())
|
||||
.append("note1", getNote1())
|
||||
.append("note2", getNote2())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.god.wlsbEqInfo.mapper;
|
||||
|
||||
import com.god.wlsbEqInfo.domain.WlsbEqInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备管理Mapper接口
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface WlsbEqInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 设备管理
|
||||
*/
|
||||
public WlsbEqInfo selectWlsbEqInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 设备管理集合
|
||||
*/
|
||||
public List<WlsbEqInfo> selectWlsbEqInfoList(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWlsbEqInfo(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWlsbEqInfo(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 删除设备管理
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqInfoById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除设备管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqInfoByIds(String[] ids);
|
||||
|
||||
String getMaxSnByPrefix(String yyyyMM);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.god.wlsbEqInfo.service;
|
||||
|
||||
import com.god.wlsbEqInfo.domain.WlsbEqInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备管理Service接口
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface IWlsbEqInfoService
|
||||
{
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 设备管理
|
||||
*/
|
||||
public WlsbEqInfo selectWlsbEqInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 设备管理集合
|
||||
*/
|
||||
public List<WlsbEqInfo> selectWlsbEqInfoList(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWlsbEqInfo(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWlsbEqInfo(WlsbEqInfo wlsbEqInfo);
|
||||
|
||||
/**
|
||||
* 批量删除设备管理
|
||||
*
|
||||
* @param ids 需要删除的设备管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除设备管理信息
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqInfoById(String id);
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package com.god.wlsbEqInfo.service.impl;
|
||||
|
||||
import com.god.common.utils.serialNumber.SerialNumberService;
|
||||
import com.god.common.utils.uuid.IdUtils;
|
||||
import com.god.wlsbEqInfo.domain.WlsbEqInfo;
|
||||
import com.god.wlsbEqInfo.mapper.WlsbEqInfoMapper;
|
||||
import com.god.wlsbEqInfo.service.IWlsbEqInfoService;
|
||||
import com.god.wlsbEqState.domain.WlsbEqState;
|
||||
import com.god.wlsbEqState.mapper.WlsbEqStateMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备管理Service业务层处理
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@Service
|
||||
public class WlsbEqInfoServiceImpl implements IWlsbEqInfoService {
|
||||
@Autowired
|
||||
private WlsbEqInfoMapper wlsbEqInfoMapper;
|
||||
@Resource
|
||||
private SerialNumberService serialNumberService;
|
||||
@Autowired
|
||||
private WlsbEqStateMapper wlsbEqStateMapper;
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 设备管理
|
||||
*/
|
||||
@Override
|
||||
public WlsbEqInfo selectWlsbEqInfoById(String id) {
|
||||
return wlsbEqInfoMapper.selectWlsbEqInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 设备管理
|
||||
*/
|
||||
@Override
|
||||
public List<WlsbEqInfo> selectWlsbEqInfoList(WlsbEqInfo wlsbEqInfo) {
|
||||
return wlsbEqInfoMapper.selectWlsbEqInfoList(wlsbEqInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWlsbEqInfo(WlsbEqInfo wlsbEqInfo) {
|
||||
wlsbEqInfo.setId(IdUtils.fastUUID());
|
||||
wlsbEqInfo.setEqNum(serialNumberService.generateSn("SBBH", 3, wlsbEqInfoMapper.getMaxSnByPrefix("SBBH" + new SimpleDateFormat("yyyyMM").format(new Date()))));
|
||||
//判断eq_state为0(使用中)
|
||||
if ("0".equals(wlsbEqInfo.getEqState())) {
|
||||
instertWlsbEqState(wlsbEqInfo);
|
||||
}
|
||||
return wlsbEqInfoMapper.insertWlsbEqInfo(wlsbEqInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*
|
||||
* @param wlsbEqInfo 设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWlsbEqInfo(WlsbEqInfo wlsbEqInfo) {
|
||||
if (wlsbEqInfo.getEqState().equals("0")) {
|
||||
instertWlsbEqState(wlsbEqInfo);
|
||||
}
|
||||
return wlsbEqInfoMapper.updateWlsbEqInfo(wlsbEqInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备管理
|
||||
*
|
||||
* @param ids 需要删除的设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWlsbEqInfoByIds(String[] ids) {
|
||||
return wlsbEqInfoMapper.deleteWlsbEqInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备管理信息
|
||||
*
|
||||
* @param id 设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWlsbEqInfoById(String id) {
|
||||
return wlsbEqInfoMapper.deleteWlsbEqInfoById(id);
|
||||
}
|
||||
|
||||
//以下是插入设备运行记录
|
||||
void instertWlsbEqState(WlsbEqInfo wlsbEqInfo) {
|
||||
String formattedDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
//插入数据
|
||||
WlsbEqState wlsbEqState = new WlsbEqState();
|
||||
wlsbEqState.setId(IdUtils.fastUUID());
|
||||
wlsbEqState.setStateTime(formattedDate);
|
||||
wlsbEqState.setEqNum(wlsbEqInfo.getEqNum());
|
||||
wlsbEqState.setNote1(wlsbEqInfo.getEqName());
|
||||
wlsbEqState.setState(wlsbEqInfo.getStarrtStop());
|
||||
//查询运行时间
|
||||
WlsbEqState wlsbEqState1 = wlsbEqStateMapper.selectWlsbEqStateByEqNum(wlsbEqInfo.getEqNum());
|
||||
wlsbEqState.setNote2(
|
||||
(wlsbEqState1 != null && "0".equals(wlsbEqState1.getState()))
|
||||
? wlsbEqState1.getNote2()
|
||||
: "0"
|
||||
);
|
||||
wlsbEqStateMapper.insertWlsbEqState(wlsbEqState);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.god.wlsbEqState.domain;
|
||||
|
||||
import com.god.common.annotation.Excel;
|
||||
import com.god.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 设备运行分析对象 wlsb_eq_state
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class WlsbEqState extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@Excel(name = "设备编号")
|
||||
private String eqNum;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 状态时间
|
||||
*/
|
||||
@Excel(name = "状态时间")
|
||||
private String stateTime;
|
||||
|
||||
/**
|
||||
* 备注1
|
||||
*/
|
||||
@Excel(name = "备注1")
|
||||
private String note1;
|
||||
|
||||
/**
|
||||
* 备注2
|
||||
*/
|
||||
@Excel(name = "备注2")
|
||||
private String note2;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.god.wlsbEqState.mapper;
|
||||
|
||||
import com.god.wlsbEqState.domain.WlsbEqState;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备运行分析Mapper接口
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface WlsbEqStateMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备运行分析
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 设备运行分析
|
||||
*/
|
||||
public WlsbEqState selectWlsbEqStateById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备运行分析列表
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 设备运行分析集合
|
||||
*/
|
||||
public List<WlsbEqState> selectWlsbEqStateList(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 新增设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWlsbEqState(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 修改设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWlsbEqState(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 删除设备运行分析
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqStateById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除设备运行分析
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqStateByIds(String[] ids);
|
||||
//查询运行时间
|
||||
WlsbEqState selectWlsbEqStateByEqNum(String eqNum);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.god.wlsbEqState.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.god.wlsbEqState.domain.WlsbEqState;
|
||||
|
||||
/**
|
||||
* 设备运行分析Service接口
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
public interface IWlsbEqStateService
|
||||
{
|
||||
/**
|
||||
* 查询设备运行分析
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 设备运行分析
|
||||
*/
|
||||
public WlsbEqState selectWlsbEqStateById(String id);
|
||||
|
||||
/**
|
||||
* 查询设备运行分析列表
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 设备运行分析集合
|
||||
*/
|
||||
public List<WlsbEqState> selectWlsbEqStateList(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 新增设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWlsbEqState(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 修改设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWlsbEqState(WlsbEqState wlsbEqState);
|
||||
|
||||
/**
|
||||
* 批量删除设备运行分析
|
||||
*
|
||||
* @param ids 需要删除的设备运行分析主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqStateByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除设备运行分析信息
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWlsbEqStateById(String id);
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.god.wlsbEqState.service.impl;
|
||||
|
||||
import com.god.common.utils.uuid.IdUtils;
|
||||
import com.god.wlsbEqState.domain.WlsbEqState;
|
||||
import com.god.wlsbEqState.mapper.WlsbEqStateMapper;
|
||||
import com.god.wlsbEqState.service.IWlsbEqStateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备运行分析Service业务层处理
|
||||
*
|
||||
* @author Lxz
|
||||
* @date 2024-09-02
|
||||
*/
|
||||
@Service
|
||||
public class WlsbEqStateServiceImpl implements IWlsbEqStateService {
|
||||
@Autowired
|
||||
private WlsbEqStateMapper wlsbEqStateMapper;
|
||||
|
||||
/**
|
||||
* 查询设备运行分析
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 设备运行分析
|
||||
*/
|
||||
@Override
|
||||
public WlsbEqState selectWlsbEqStateById(String id) {
|
||||
return wlsbEqStateMapper.selectWlsbEqStateById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备运行分析列表
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 设备运行分析
|
||||
*/
|
||||
@Override
|
||||
public List<WlsbEqState> selectWlsbEqStateList(WlsbEqState wlsbEqState) {
|
||||
List<WlsbEqState> wlsbEqStates = wlsbEqStateMapper.selectWlsbEqStateList(wlsbEqState);
|
||||
wlsbEqStates.forEach(state -> {
|
||||
String note2 = state.getNote2();
|
||||
if (note2 != null && !note2.isEmpty()) {
|
||||
int totalSeconds = Integer.parseInt(note2);
|
||||
String formattedTime = String.format("%02d小时%02d分钟%02d秒", totalSeconds / 3600, (totalSeconds % 3600) / 60, totalSeconds % 60);
|
||||
state.setNote2(formattedTime);
|
||||
}
|
||||
});
|
||||
return wlsbEqStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWlsbEqState(WlsbEqState wlsbEqState) {
|
||||
wlsbEqState.setId(IdUtils.fastUUID());
|
||||
return wlsbEqStateMapper.insertWlsbEqState(wlsbEqState);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备运行分析
|
||||
*
|
||||
* @param wlsbEqState 设备运行分析
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWlsbEqState(WlsbEqState wlsbEqState) {
|
||||
return wlsbEqStateMapper.updateWlsbEqState(wlsbEqState);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备运行分析
|
||||
*
|
||||
* @param ids 需要删除的设备运行分析主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWlsbEqStateByIds(String[] ids) {
|
||||
return wlsbEqStateMapper.deleteWlsbEqStateByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备运行分析信息
|
||||
*
|
||||
* @param id 设备运行分析主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWlsbEqStateById(String id) {
|
||||
return wlsbEqStateMapper.deleteWlsbEqStateById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
<?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.wlsbEqInfo.mapper.WlsbEqInfoMapper">
|
||||
|
||||
<resultMap type="WlsbEqInfo" id="WlsbEqInfoResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="eqNum" column="eq_num"/>
|
||||
<result property="eqName" column="eq_name"/>
|
||||
<result property="eqType" column="eq_type"/>
|
||||
<result property="eqState" column="eq_state"/>
|
||||
<result property="starrtStop" column="starrt_stop"/>
|
||||
<result property="eqImg" column="eq_img"/>
|
||||
<result property="eqSay" column="eq_say"/>
|
||||
<result property="note1" column="note1"/>
|
||||
<result property="note2" column="note2"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWlsbEqInfoVo">
|
||||
select id,
|
||||
eq_num,
|
||||
eq_name,
|
||||
eq_type,
|
||||
eq_state,
|
||||
starrt_stop,
|
||||
eq_img,
|
||||
eq_say,
|
||||
note1,
|
||||
note2
|
||||
from wlsb_eq_info
|
||||
</sql>
|
||||
|
||||
<select id="selectWlsbEqInfoList" parameterType="WlsbEqInfo" resultMap="WlsbEqInfoResult">
|
||||
<include refid="selectWlsbEqInfoVo"/>
|
||||
<where>
|
||||
<if test="eqNum != null and eqNum != ''"> and eq_num =
|
||||
#{eqNum}</if>
|
||||
<if test="eqName != null and eqName != ''"> and eq_name like concat('%',
|
||||
#{eqName},
|
||||
'%'
|
||||
)</if>
|
||||
<if test="eqType != null and eqType != ''"> and eq_type like concat('%',
|
||||
#{eqType},
|
||||
'%'
|
||||
)</if>
|
||||
<if test="note1 != null and note1 != ''"> and note1 like concat('%',
|
||||
#{note1},
|
||||
'%'
|
||||
)</if>
|
||||
<if test="eqState != null and eqState != ''"> and eq_state =
|
||||
#{eqState}</if>
|
||||
<if test="starrtStop != null and starrtStop != ''"> and starrt_stop =
|
||||
#{starrtStop}</if>
|
||||
<if test="eqImg != null and eqImg != ''"> and eq_img =
|
||||
#{eqImg}</if>
|
||||
<if test="eqSay != null and eqSay != ''"> and eq_say =
|
||||
#{eqSay}</if>
|
||||
<if test="note2 != null and note2 != ''"> and note2 =
|
||||
#{note2}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWlsbEqInfoById" parameterType="String" resultMap="WlsbEqInfoResult">
|
||||
<include refid="selectWlsbEqInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="getMaxSnByPrefix" resultType="java.lang.String">
|
||||
SELECT eq_num
|
||||
FROM wlsb_eq_info
|
||||
WHERE eq_num LIKE CONCAT(#{prefix}, '%')
|
||||
order by eq_num desc limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertWlsbEqInfo" parameterType="WlsbEqInfo">
|
||||
insert into wlsb_eq_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id
|
||||
,</if>
|
||||
<if test="eqNum != null">eq_num
|
||||
,</if>
|
||||
<if test="eqName != null">eq_name
|
||||
,</if>
|
||||
<if test="eqType != null">eq_type
|
||||
,</if>
|
||||
<if test="eqState != null">eq_state
|
||||
,</if>
|
||||
<if test="starrtStop != null">starrt_stop
|
||||
,</if>
|
||||
<if test="eqImg != null">eq_img
|
||||
,</if>
|
||||
<if test="eqSay != null">eq_say
|
||||
,</if>
|
||||
<if test="note1 != null">note1
|
||||
,</if>
|
||||
<if test="note2 != null">note2
|
||||
,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id}
|
||||
,</if>
|
||||
<if test="eqNum != null">#{eqNum}
|
||||
,</if>
|
||||
<if test="eqName != null">#{eqName}
|
||||
,</if>
|
||||
<if test="eqType != null">#{eqType}
|
||||
,</if>
|
||||
<if test="eqState != null">#{eqState}
|
||||
,</if>
|
||||
<if test="starrtStop != null">#{starrtStop}
|
||||
,</if>
|
||||
<if test="eqImg != null">#{eqImg}
|
||||
,</if>
|
||||
<if test="eqSay != null">#{eqSay}
|
||||
,</if>
|
||||
<if test="note1 != null">#{note1}
|
||||
,</if>
|
||||
<if test="note2 != null">#{note2}
|
||||
,</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWlsbEqInfo" parameterType="WlsbEqInfo">
|
||||
update wlsb_eq_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="eqNum != null">eq_num
|
||||
=
|
||||
#{eqNum},</if>
|
||||
<if test="eqName != null">eq_name
|
||||
=
|
||||
#{eqName},</if>
|
||||
<if test="eqType != null">eq_type
|
||||
=
|
||||
#{eqType},</if>
|
||||
<if test="eqState != null">eq_state
|
||||
=
|
||||
#{eqState},</if>
|
||||
<if test="starrtStop != null">starrt_stop
|
||||
=
|
||||
#{starrtStop},</if>
|
||||
<if test="eqImg != null">eq_img
|
||||
=
|
||||
#{eqImg},</if>
|
||||
<if test="eqSay != null">eq_say
|
||||
=
|
||||
#{eqSay},</if>
|
||||
<if test="note1 != null">note1
|
||||
=
|
||||
#{note1},</if>
|
||||
<if test="note2 != null">note2
|
||||
=
|
||||
#{note2},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWlsbEqInfoById" parameterType="String">
|
||||
delete
|
||||
from wlsb_eq_info
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWlsbEqInfoByIds" parameterType="String">
|
||||
delete from wlsb_eq_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,87 @@
|
||||
<?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.wlsbEqState.mapper.WlsbEqStateMapper">
|
||||
|
||||
<resultMap type="WlsbEqState" id="WlsbEqStateResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="eqNum" column="eq_num" />
|
||||
<result property="state" column="state" />
|
||||
<result property="stateTime" column="state_time" />
|
||||
<result property="note1" column="note1" />
|
||||
<result property="note2" column="note2" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWlsbEqStateVo">
|
||||
select id, eq_num, state, state_time, note1, note2 from wlsb_eq_state ORDER BY state_time DESC
|
||||
</sql>
|
||||
|
||||
<select id="selectWlsbEqStateList" parameterType="WlsbEqState" resultMap="WlsbEqStateResult">
|
||||
<include refid="selectWlsbEqStateVo"/>
|
||||
<where>
|
||||
<if test="eqNum != null and eqNum != ''"> and eq_num = #{eqNum}</if>
|
||||
<if test="state != null and state != ''"> and state = #{state}</if>
|
||||
<if test="stateTime != null and stateTime != ''"> and state_time = #{stateTime}</if>
|
||||
<if test="note1 != null and note1 != ''"> and note1 = #{note1}</if>
|
||||
<if test="note2 != null and note2 != ''"> and note2 = #{note2}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWlsbEqStateById" parameterType="String" resultMap="WlsbEqStateResult">
|
||||
<include refid="selectWlsbEqStateVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectWlsbEqStateByEqNum" resultType="com.god.wlsbEqState.domain.WlsbEqState">
|
||||
SELECT TIMESTAMPDIFF(
|
||||
SECOND, state_time,
|
||||
NOW()) AS note2 ,state
|
||||
FROM (SELECT id, eq_num, state, state_time, note1, note2
|
||||
FROM wlsb_eq_state
|
||||
where eq_num = #{eqNum}
|
||||
ORDER BY state_time DESC LIMIT 1) AS latest_record
|
||||
</select>
|
||||
|
||||
<insert id="insertWlsbEqState" parameterType="WlsbEqState">
|
||||
insert into wlsb_eq_state
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="eqNum != null">eq_num,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="stateTime != null">state_time,</if>
|
||||
<if test="note1 != null">note1,</if>
|
||||
<if test="note2 != null">note2,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="eqNum != null">#{eqNum},</if>
|
||||
<if test="state != null">#{state},</if>
|
||||
<if test="stateTime != null">#{stateTime},</if>
|
||||
<if test="note1 != null">#{note1},</if>
|
||||
<if test="note2 != null">#{note2},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWlsbEqState" parameterType="WlsbEqState">
|
||||
update wlsb_eq_state
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="eqNum != null">eq_num = #{eqNum},</if>
|
||||
<if test="state != null">state = #{state},</if>
|
||||
<if test="stateTime != null">state_time = #{stateTime},</if>
|
||||
<if test="note1 != null">note1 = #{note1},</if>
|
||||
<if test="note2 != null">note2 = #{note2},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWlsbEqStateById" parameterType="String">
|
||||
delete from wlsb_eq_state where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWlsbEqStateByIds" parameterType="String">
|
||||
delete from wlsb_eq_state where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
god-ui/src/api/wlsbEqInfo/eqInfo.js
Normal file
44
god-ui/src/api/wlsbEqInfo/eqInfo.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询设备管理列表
|
||||
export function listEqInfo(query) {
|
||||
return request({
|
||||
url: '/wlsbEqInfo/eqInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备管理详细
|
||||
export function getEqInfo(id) {
|
||||
return request({
|
||||
url: '/wlsbEqInfo/eqInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备管理
|
||||
export function addEqInfo(data) {
|
||||
return request({
|
||||
url: '/wlsbEqInfo/eqInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备管理
|
||||
export function updateEqInfo(data) {
|
||||
return request({
|
||||
url: '/wlsbEqInfo/eqInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备管理
|
||||
export function delEqInfo(id) {
|
||||
return request({
|
||||
url: '/wlsbEqInfo/eqInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
god-ui/src/api/wlsbEqState/eqState.js
Normal file
44
god-ui/src/api/wlsbEqState/eqState.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询设备运行分析列表
|
||||
export function listEqState(query) {
|
||||
return request({
|
||||
url: '/wlsbEqState/eqState/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备运行分析详细
|
||||
export function getEqState(id) {
|
||||
return request({
|
||||
url: '/wlsbEqState/eqState/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备运行分析
|
||||
export function addEqState(data) {
|
||||
return request({
|
||||
url: '/wlsbEqState/eqState',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备运行分析
|
||||
export function updateEqState(data) {
|
||||
return request({
|
||||
url: '/wlsbEqState/eqState',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备运行分析
|
||||
export function delEqState(id) {
|
||||
return request({
|
||||
url: '/wlsbEqState/eqState/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
412
god-ui/src/views/wlsbEqInfo/eqInfo/index.vue
Normal file
412
god-ui/src/views/wlsbEqInfo/eqInfo/index.vue
Normal file
@ -0,0 +1,412 @@
|
||||
<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="eqName">
|
||||
<el-input
|
||||
v-model="queryParams.eqName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="eqType">
|
||||
<el-input
|
||||
v-model="queryParams.eqType"
|
||||
placeholder="请输入设备类型"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备型号" prop="note1">
|
||||
<el-input
|
||||
v-model="queryParams.note1"
|
||||
placeholder="请输入设备型号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态" prop="eqState">
|
||||
<el-select v-model="queryParams.eqState" placeholder="请选择设备状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.wlsb_eq_state"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="启停状态" prop="starrtStop">
|
||||
<el-select v-model="queryParams.starrtStop" placeholder="请选择启停状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.industrial_equ_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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="['wlsbEqInfo:eqInfo: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="['wlsbEqInfo:eqInfo: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="['wlsbEqInfo:eqInfo: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="['wlsbEqInfo:eqInfo:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="eqInfoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<!-- <el-table-column label="主键" align="center" prop="id" />-->
|
||||
<el-table-column label="设备编号" align="center" prop="eqNum"/>
|
||||
<el-table-column label="设备名称" align="center" prop="eqName"/>
|
||||
<el-table-column label="设备型号" align="center" prop="note1"/>
|
||||
<el-table-column label="设备类型" align="center" prop="eqType"/>
|
||||
<el-table-column label="设备状态" align="center" prop="eqState">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.wlsb_eq_state" :value="scope.row.eqState"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="启停状态" align="center" prop="starrtStop">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <dict-tag :options="dict.type.industrial_equ_status" :value="scope.row.starrtStop"/>-->
|
||||
<!-- </template>-->
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.starrtStop"
|
||||
active-value="0"
|
||||
inactive-value="1"
|
||||
:disabled="scope.row.eqState !== '0'"
|
||||
@change="handleStatusChange(scope.row)"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备图片" align="center" prop="eqImg" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.eqImg" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备简述" align="center" prop="eqSay" show-overflow-tooltip/>
|
||||
|
||||
<!-- <el-table-column label="备注2" align="center" prop="note2" />-->
|
||||
<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="['wlsbEqInfo:eqInfo:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['wlsbEqInfo:eqInfo: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="eqNum">
|
||||
<el-input v-model="form.eqNum" placeholder="*后台自动生成设备编号*" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="eqName">
|
||||
<el-input v-model="form.eqName" placeholder="请输入设备名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备型号" prop="note1">
|
||||
<el-input v-model="form.note1" placeholder="请输入设备型号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="eqType">
|
||||
<el-input v-model="form.eqType" placeholder="请输入设备类型"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态" prop="eqState">
|
||||
<el-select v-model="form.eqState" placeholder="请选择设备状态">
|
||||
<el-option
|
||||
v-for="dict in dict.type.wlsb_eq_state"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="启停状态" prop="starrtStop">
|
||||
<el-select v-model="form.starrtStop" placeholder="请选择启停状态">
|
||||
<el-option
|
||||
v-for="dict in dict.type.industrial_equ_status"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备图片" prop="eqImg">
|
||||
<image-upload v-model="form.eqImg"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备简述" prop="eqSay">
|
||||
<el-input v-model="form.eqSay" type="textarea" placeholder="请输入设备简述"/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="备注2" prop="note2">-->
|
||||
<!-- <el-input v-model="form.note2" placeholder="请输入备注2"/>-->
|
||||
<!-- </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 { listEqInfo, getEqInfo, delEqInfo, addEqInfo, updateEqInfo } from '@/api/wlsbEqInfo/eqInfo'
|
||||
|
||||
export default {
|
||||
name: 'EqInfo',
|
||||
dicts: ['industrial_equ_status', 'wlsb_eq_state'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备管理表格数据
|
||||
eqInfoList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
eqNum: null,
|
||||
eqName: null,
|
||||
eqType: null,
|
||||
eqState: null,
|
||||
starrtStop: null,
|
||||
eqImg: null,
|
||||
eqSay: null,
|
||||
note1: null,
|
||||
note2: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
eqName: [
|
||||
{ required: true, message: '设备名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
eqType: [
|
||||
{ required: true, message: '设备类型不能为空', trigger: 'change' }
|
||||
],
|
||||
eqState: [
|
||||
{ required: true, message: '设备状态不能为空', trigger: 'change' }
|
||||
],
|
||||
starrtStop: [
|
||||
{
|
||||
trigger: 'change',
|
||||
validator: (rule, value, callback) => {
|
||||
if (!value) return callback(new Error('设备状态不能为空'))
|
||||
if (this.form.eqState === "0" ) {
|
||||
return callback()
|
||||
} else {
|
||||
if (value === '0') return callback(new Error('设备状态不能为启用'))
|
||||
else return callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 设备状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.starrtStop === "0" ? "启用" : "停用";
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.eqName + '"设备吗?').then(function () {
|
||||
const param = { ...row };
|
||||
if (param.id) {
|
||||
updateEqInfo(param).then(response => {
|
||||
this.$modal.msgSuccess("更新状态成功");
|
||||
});
|
||||
}
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function () {
|
||||
row.starrtStop = row.starrtStop === "0" ? "1" : "0";
|
||||
});
|
||||
},
|
||||
/** 查询设备管理列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listEqInfo(this.queryParams).then(response => {
|
||||
this.eqInfoList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
eqNum: null,
|
||||
eqName: null,
|
||||
eqType: null,
|
||||
eqState: null,
|
||||
starrtStop: null,
|
||||
eqImg: null,
|
||||
eqSay: null,
|
||||
note1: null,
|
||||
note2: 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
|
||||
getEqInfo(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) {
|
||||
updateEqInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addEqInfo(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 delEqInfo(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('wlsbEqInfo/eqInfo/export', {
|
||||
...this.queryParams
|
||||
}, `eqInfo_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
309
god-ui/src/views/wlsbEqState/eqState/index.vue
Normal file
309
god-ui/src/views/wlsbEqState/eqState/index.vue
Normal file
@ -0,0 +1,309 @@
|
||||
<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="eqNum">
|
||||
<el-input
|
||||
v-model="queryParams.eqNum"
|
||||
placeholder="请输入设备编号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-input
|
||||
v-model="queryParams.state"
|
||||
placeholder="请输入状态"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态时间" prop="stateTime">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.stateTime"-->
|
||||
<!-- placeholder="请输入状态时间"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="备注1" prop="note1">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.note1"-->
|
||||
<!-- placeholder="请输入备注1"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="备注2" prop="note2">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.note2"-->
|
||||
<!-- placeholder="请输入备注2"-->
|
||||
<!-- 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="['wlsbEqState:eqState: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="['wlsbEqState:eqState: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="['wlsbEqState:eqState: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="['wlsbEqState:eqState:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="eqStateList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<!-- <el-table-column label="主键" align="center" prop="id" />-->
|
||||
<el-table-column label="设备编号" align="center" prop="eqNum"/>
|
||||
<el-table-column label="设备名称" align="center" prop="note1"/>
|
||||
<el-table-column label="本次在线时长" align="center" prop="note2"/>
|
||||
<el-table-column label="状态" align="center" prop="state">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.industrial_equ_status" :value="scope.row.state"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态时间" align="center" prop="stateTime"/>
|
||||
<!-- <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="['wlsbEqState:eqState:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- @click="handleDelete(scope.row)"-->
|
||||
<!-- v-hasPermi="['wlsbEqState:eqState: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="eqNum">
|
||||
<el-input v-model="form.eqNum" placeholder="请输入设备编号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-input v-model="form.state" placeholder="请输入状态"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态时间" prop="stateTime">
|
||||
<el-input v-model="form.stateTime" placeholder="请输入状态时间"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注1" prop="note1">
|
||||
<el-input v-model="form.note1" placeholder="请输入备注1"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注2" prop="note2">
|
||||
<el-input v-model="form.note2" placeholder="请输入备注2"/>
|
||||
</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 { listEqState, getEqState, delEqState, addEqState, updateEqState } from '@/api/wlsbEqState/eqState'
|
||||
import dict from '../../../utils/dict'
|
||||
|
||||
export default {
|
||||
name: 'EqState',
|
||||
dicts: ['industrial_equ_status', 'wlsb_eq_state'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 设备运行分析表格数据
|
||||
eqStateList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
eqNum: null,
|
||||
state: null,
|
||||
stateTime: null,
|
||||
note1: null,
|
||||
note2: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
dict,
|
||||
/** 查询设备运行分析列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listEqState(this.queryParams).then(response => {
|
||||
this.eqStateList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
eqNum: null,
|
||||
state: null,
|
||||
stateTime: null,
|
||||
note1: null,
|
||||
note2: 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
|
||||
getEqState(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) {
|
||||
updateEqState(this.form).then(response => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addEqState(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 delEqState(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('wlsbEqState/eqState/export', {
|
||||
...this.queryParams
|
||||
}, `eqState_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user