opt:设备状态监控wql改成mybatis plus
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -61,8 +62,13 @@ public class UserController {
|
||||
return new ResponseEntity(TableDataInfo.build(userService.getUserDetail(query, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增用户")
|
||||
@PostMapping(value = "/getUserList")
|
||||
public ResponseEntity<Object> query() {
|
||||
List<SysUser> userList = userService.list(new QueryWrapper<SysUser>().eq("is_used", true));
|
||||
return new ResponseEntity(userList, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增用户")
|
||||
@PostMapping
|
||||
// @SaCheckPermission("user:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Map user) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.DeviceStatusService;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/devicestatus")
|
||||
@Slf4j
|
||||
public class DeviceStatusController {
|
||||
|
||||
private final DeviceStatusService deviceStatusService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备状态监控")
|
||||
public ResponseEntity<Object> query(DeviceStatusQuery whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(deviceStatusService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增客户基础表")
|
||||
public ResponseEntity<Object> create(@RequestBody DeviceStatus jo) {
|
||||
deviceStatusService.create(jo);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户基础表")
|
||||
public ResponseEntity<Object> update(@RequestBody DeviceStatus jo) {
|
||||
deviceStatusService.update(jo);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
public interface DeviceStatusService extends IService<DeviceStatus> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
IPage<DeviceStatus> queryAll(DeviceStatusQuery whereJson, PageQuery page);
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param jo /
|
||||
*/
|
||||
void create(DeviceStatus jo);
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
*/
|
||||
void update(DeviceStatus jo);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("em_bi_devicestatus")
|
||||
public class DeviceStatus implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "devicestatus_id", type = IdType.NONE)
|
||||
private String devicestatus_id;
|
||||
|
||||
private String device_code;
|
||||
|
||||
private String device_name;
|
||||
|
||||
private String product_area;
|
||||
|
||||
private String plan;
|
||||
|
||||
private String device_type;
|
||||
|
||||
private String mode;
|
||||
|
||||
private String mode_update_time;
|
||||
|
||||
private String error;
|
||||
|
||||
private String error_msg;
|
||||
|
||||
private String error_update_time;
|
||||
|
||||
private String is_upload;
|
||||
|
||||
private String upload_time;
|
||||
|
||||
private String upload_flag;
|
||||
|
||||
private String upload_user;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
|
||||
import org.nl.wms.basedata.master.faultdevice.service.dao.FaultDevice;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
public interface DeviceStatusMapper extends BaseMapper<DeviceStatus> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author: zds
|
||||
* @date: 2024-09-27
|
||||
* @description:
|
||||
*/
|
||||
@Data
|
||||
public class DeviceStatusQuery implements Serializable {
|
||||
//设备编码或设备名称
|
||||
private String search;
|
||||
//车间区域
|
||||
private String product_area;
|
||||
//类型
|
||||
private String device_type;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.nl.wms.basedata.master.devicestatus.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.DeviceStatusService;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dao.DeviceStatus;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dao.mapper.DeviceStatusMapper;
|
||||
import org.nl.wms.basedata.master.devicestatus.service.dto.DeviceStatusQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2023-04-20
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DeviceStatusServiceImpl extends ServiceImpl<DeviceStatusMapper, DeviceStatus> implements DeviceStatusService {
|
||||
|
||||
@Autowired
|
||||
private DeviceStatusMapper deviceStatusMapper;
|
||||
|
||||
@Override
|
||||
public IPage<DeviceStatus> queryAll(DeviceStatusQuery whereJson, PageQuery page) {
|
||||
|
||||
IPage<DeviceStatus> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
|
||||
|
||||
lam.eq(ObjectUtil.isNotEmpty(whereJson.getDevice_type()), DeviceStatus::getDevice_type, whereJson.getDevice_type())
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getProduct_area()), DeviceStatus::getProduct_area, whereJson.getProduct_area())
|
||||
.and(ObjectUtil.isNotEmpty(whereJson.getSearch()),blam -> blam.like(DeviceStatus::getDevice_code, whereJson.getSearch()).or()
|
||||
.like(DeviceStatus::getDevice_name, whereJson.getSearch()))
|
||||
.orderByDesc(DeviceStatus::getDevice_code);
|
||||
deviceStatusMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DeviceStatus jo) {
|
||||
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
|
||||
lam.eq(DeviceStatus::getDevice_code,jo.getDevice_code());
|
||||
DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(deviceStatus)) {
|
||||
throw new BadRequestException("已存在相同的设备编码!");
|
||||
}else{//新增
|
||||
deviceStatusMapper.insert(jo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DeviceStatus jo) {
|
||||
LambdaQueryWrapper<DeviceStatus> lam = new LambdaQueryWrapper<DeviceStatus>();
|
||||
lam.eq(DeviceStatus::getDevice_code,jo.getDevice_code());
|
||||
DeviceStatus deviceStatus = deviceStatusMapper.selectOne(lam);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(deviceStatus)) {
|
||||
String devicestatus_id = deviceStatus.getDevicestatus_id();
|
||||
if(devicestatus_id.equals(jo.getDevicestatus_id())){
|
||||
deviceStatusMapper.updateById(jo);
|
||||
}else{
|
||||
throw new BadRequestException("已存在相同的设备编码!");
|
||||
}
|
||||
}else{//新增
|
||||
deviceStatusMapper.insert(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package org.nl.wms.basedata.master.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.master.service.DeviceStatusService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/devicestatus")
|
||||
@Slf4j
|
||||
public class DeviceStatusController {
|
||||
|
||||
private final DeviceStatusService deviceStatusService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备状态监控")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(deviceStatusService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:add')")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject jo) {
|
||||
deviceStatusService.create(jo);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:edit')")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject jo) {
|
||||
deviceStatusService.update(jo);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除客户基础表")
|
||||
|
||||
//@PreAuthorize("@el.check('customerbase:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
deviceStatusService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务接口
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
public interface DeviceStatusService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CustomerbaseDto>
|
||||
*/
|
||||
List<CustomerbaseDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param jo /
|
||||
*/
|
||||
void create(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param jo /
|
||||
*/
|
||||
void update(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package org.nl.wms.basedata.master.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.DeviceStatusService;
|
||||
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @description 服务实现
|
||||
* @date 2021-12-06
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceStatusServiceImpl implements DeviceStatusService {
|
||||
@Autowired
|
||||
private DeviceStatusService deviceStatusService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String where = "1=1";
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String search = (String) whereJson.get("search");
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
where += " AND (device_code like '%" + search + "%' OR device_name like '%" + search + "%')";
|
||||
}
|
||||
String product_area = (String) whereJson.get("product_area");
|
||||
if (!StrUtil.isEmpty(product_area)) {
|
||||
where += " AND product_area = '" + product_area + "'";
|
||||
}
|
||||
String device_type = (String) whereJson.get("device_type");
|
||||
if (!StrUtil.isEmpty(device_type)) {
|
||||
where += " AND device_type = '" + device_type + "'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "device_code desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerbaseDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<CustomerbaseDto> list = arr.toJavaList(CustomerbaseDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject jo) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
if (ObjectUtil.isNotEmpty(jo.getJSONArray("upload_user"))) {
|
||||
JSONArray rows = jo.getJSONArray("upload_user");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
String msg = "";
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
if (i != rows.size() - 1) {
|
||||
msg += rows.getString(i) + ",";
|
||||
} else {
|
||||
msg += rows.getString(i);
|
||||
}
|
||||
}
|
||||
jo.put("upload_user", msg);
|
||||
}
|
||||
try {
|
||||
wo.insert(jo);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("存在相同的设备编码!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject jo) {
|
||||
WQLObject wo = WQLObject.getWQLObject("em_bi_devicestatus");
|
||||
String device_code = jo.getString("device_code");
|
||||
try {
|
||||
if (!jo.containsKey("need_update_flag")) {
|
||||
JSONArray rows = jo.getJSONArray("upload_user");
|
||||
if (ObjectUtil.isEmpty(rows)) {
|
||||
rows = new JSONArray();
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
String msg = "";
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
if (i != rows.size() - 1) {
|
||||
msg += rows.getString(i) + ",";
|
||||
} else {
|
||||
msg += rows.getString(i);
|
||||
}
|
||||
}
|
||||
map.put("upload_user", msg);
|
||||
wo.update(map, "device_code = '" + device_code + "'");
|
||||
} else {
|
||||
wo.update(jo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("存在相同的设备编码!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
|
||||
for (Long cust_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("cust_id", String.valueOf(cust_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,8 +137,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系人" prop="upload_user">
|
||||
<el-select v-model="form.upload_user" placeholder="请选择" filterable multiple clearable
|
||||
style="width: 200px">
|
||||
<el-select v-model="form.upload_user" placeholder="请选择" filterable multiple clearable style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.username"
|
||||
@@ -146,7 +145,7 @@
|
||||
:value="item.username"
|
||||
>
|
||||
<span style="float: left">{{ item.username }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.personName }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.person_name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -167,16 +166,15 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip width="150px"/>
|
||||
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip width="150px"/>
|
||||
<el-table-column prop="product_area" label="区域" show-overflow-tooltip/>
|
||||
<el-table-column prop="device_type" label="设备类型" :formatter="typeFormatter" show-overflow-tooltip/>
|
||||
<el-table-column prop="mode" label="工作状态" :formatter="modeFormatter" show-overflow-tooltip/>
|
||||
<el-table-column prop="mode_update_time" label="工作状态变更时间" show-overflow-tooltip width="150px"/>
|
||||
<el-table-column prop="error" label="故障状态" :formatter="erroFormatter" show-overflow-tooltip/>
|
||||
<el-table-column prop="error_msg" label="故障信息" width="180px" show-overflow-tooltip/>
|
||||
<el-table-column prop="error_update_time" label="故障状态更新时间" width="150px" show-overflow-tooltip/>
|
||||
<el-table-column prop="error_update_time" label="故障状态更新时间" width="150px" show-overflow-tooltip/>
|
||||
<el-table-column prop="device_code" label="设备编码" :min-width="flexWidth('device_code',crud.data,'故障编码')" />
|
||||
<el-table-column prop="device_name" label="设备名称" :min-width="flexWidth('device_name',crud.data,'设备名称')" />
|
||||
<el-table-column prop="product_area" label="区域" :min-width="flexWidth('product_area',crud.data,'区域')" />
|
||||
<el-table-column prop="device_type" label="设备类型" :formatter="typeFormatter" :min-width="flexWidth('device_type',crud.data,'设备类型')" />
|
||||
<el-table-column prop="mode" label="工作状态" :formatter="modeFormatter" :min-width="flexWidth('mode',crud.data,'工作状态')" />
|
||||
<el-table-column prop="mode_update_time" label="工作状态变更时间" :min-width="flexWidth('mode_update_time',crud.data,'工作状态变更时间')" />
|
||||
<el-table-column prop="error" label="故障状态" :formatter="erroFormatter" :min-width="flexWidth('error',crud.data,'故障状态')" />
|
||||
<el-table-column prop="error_msg" label="故障信息" width="180px" show-overflow-tooltip />
|
||||
<el-table-column prop="error_update_time" label="故障状态更新时间" :min-width="flexWidth('error_update_time',crud.data,'故障编码')" />
|
||||
<el-table-column label="是否上报" align="center" prop="upload_flag">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
@@ -189,11 +187,11 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="upload_user" label="负责人" width="150px" show-overflow-tooltip/>
|
||||
<el-table-column prop="upload_user" label="负责人" width="150px" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
v-permission="['admin','customerbase:edit','customerbase:del']"
|
||||
v-permission="['admin','devicestatus:edit','devicestatus:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
width="120px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
@@ -222,7 +220,11 @@ import crudUser from '@/views/system/user/user'
|
||||
|
||||
const defaultForm = {
|
||||
device_code: null,
|
||||
upload_user: null
|
||||
device_name: null,
|
||||
product_area: null,
|
||||
device_type: null,
|
||||
upload_flag: null,
|
||||
upload_user: []
|
||||
}
|
||||
export default {
|
||||
name: 'DeviceStatus',
|
||||
@@ -244,7 +246,25 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {},
|
||||
permission: {
|
||||
add: ['admin', 'devicestatus:add'],
|
||||
edit: ['admin', 'devicestatus:edit'],
|
||||
del: ['admin', 'devicestatus:del']
|
||||
},
|
||||
rules: {
|
||||
device_code: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
device_name: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
product_area: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
device_type: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
classes: [],
|
||||
userList: [],
|
||||
agvRegionList: [
|
||||
@@ -264,8 +284,7 @@ export default {
|
||||
{ 'label': '四向车', 'value': '3' },
|
||||
{ 'label': 'AGV', 'value': '4' },
|
||||
{ 'label': '其他', 'value': '5' }
|
||||
],
|
||||
rules: {}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -273,15 +292,19 @@ export default {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
[CRUD.HOOK.afterToEdit](crud, form) {
|
||||
this.getUserList()
|
||||
debugger
|
||||
if (form.upload_user && form.upload_user !== '') {
|
||||
form.upload_user = form.upload_user.split(',')
|
||||
} else {
|
||||
form.upload_user = null
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit](crud) {
|
||||
const arr = crud.form.upload_user
|
||||
const regionCodes = arr.map(user => user).join(',')
|
||||
this.crud.form.upload_user = regionCodes
|
||||
},
|
||||
// 改变状态
|
||||
getUserList() {
|
||||
crudUser.getUserList().then(res => {
|
||||
|
||||
@@ -106,14 +106,14 @@
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="fault_code" label="故障编码" show-overflow-tooltip />
|
||||
<el-table-column prop="fault_info" label="故障信息 " show-overflow-tooltip width="150px" />
|
||||
<el-table-column prop="fault_type" label="异常类型 " show-overflow-tooltip width="100px" :formatter="formatType" />
|
||||
<el-table-column prop="solve_mode" label="解决方式" show-overflow-tooltip width="300px" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150" />
|
||||
<el-table-column prop="update_name" label="修改者" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="150" />
|
||||
<el-table-column prop="fault_code" label="故障编码" :min-width="flexWidth('fault_code',crud.data,'故障编码')" />
|
||||
<el-table-column prop="fault_info" label="故障信息" :min-width="flexWidth('fault_info',crud.data,'故障信息')" />
|
||||
<el-table-column prop="fault_type" label="异常类型" :min-width="flexWidth('fault_type',crud.data,'异常类型')" :formatter="formatType" />
|
||||
<el-table-column prop="solve_mode" label="解决方式" :min-width="flexWidth('solve_mode',crud.data,'解决方式')" />
|
||||
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="update_name" label="修改者" :min-width="flexWidth('update_name',crud.data,'修改者')" />
|
||||
<el-table-column prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
|
||||
<el-table-column
|
||||
v-permission="['admin','faultdevice:edit','faultdevice:del']"
|
||||
label="操作"
|
||||
|
||||
Reference in New Issue
Block a user