21 changed files with 1628 additions and 1 deletions
@ -0,0 +1,66 @@ |
|||
package org.nl.system.controller.trajectory; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.system.service.trajectory.TrajectoryBackgroundService; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryBackground; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/trajectoryBackground") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
@SaIgnore |
|||
public class TrajectoryBackgroundController { |
|||
|
|||
@Resource |
|||
private TrajectoryBackgroundService trajectoryBackgroundService; |
|||
|
|||
@GetMapping |
|||
@Log("查询轨迹背景图") |
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(trajectoryBackgroundService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增轨迹背景图") |
|||
public ResponseEntity<Object> create(@Validated @RequestBody TrajectoryBackground trajectoryBackground) { |
|||
trajectoryBackgroundService.create(trajectoryBackground); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改轨迹背景图") |
|||
public ResponseEntity<Object> update(@Validated @RequestBody TrajectoryBackground entity) { |
|||
trajectoryBackgroundService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
@Log("删除轨迹背景图") |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
trajectoryBackgroundService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/queryAllEnable") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> queryAllEnable() { |
|||
return new ResponseEntity<>(TableDataInfo.build(trajectoryBackgroundService.queryAllEnable()), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
package org.nl.system.controller.trajectory; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.system.service.trajectory.TrajectoryConfigurationService; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/trajectoryConfiguration") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
@SaIgnore |
|||
public class TrajectoryConfigurationController { |
|||
|
|||
@Resource |
|||
private TrajectoryConfigurationService trajectoryConfigurationService; |
|||
|
|||
@GetMapping |
|||
@Log("查询轨迹设备配置") |
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(trajectoryConfigurationService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增轨迹设备配置") |
|||
public ResponseEntity<Object> create(@Validated @RequestBody TrajectoryConfiguration trajectoryConfiguration) { |
|||
trajectoryConfigurationService.create(trajectoryConfiguration); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改轨迹设备配置") |
|||
public ResponseEntity<Object> update(@Validated @RequestBody TrajectoryConfiguration entity) { |
|||
trajectoryConfigurationService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
@Log("删除轨迹设备配置") |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
trajectoryConfigurationService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/queryAllEnable") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> queryAllEnable() { |
|||
return new ResponseEntity<>(TableDataInfo.build(trajectoryConfigurationService.queryAllEnable()), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
package org.nl.system.controller.trajectory; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.system.service.trajectory.TrajectoryService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/trajectory") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
@SaIgnore |
|||
public class TrajectoryController { |
|||
|
|||
@Resource |
|||
private TrajectoryService trajectoryService; |
|||
|
|||
@PostMapping("/queryDevice") |
|||
@Log(value = "查询设备状态") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> queryDevice(@RequestBody String whereJson) throws Exception { |
|||
return new ResponseEntity<>(trajectoryService.queryDevice(whereJson), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
package org.nl.system.service.trajectory; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.common.base.CommonService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryBackground; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
public interface TrajectoryBackgroundService extends CommonService<TrajectoryBackground> { |
|||
|
|||
/** |
|||
* 分页 |
|||
* @param whereJson |
|||
* @param page |
|||
* @return |
|||
*/ |
|||
IPage<TrajectoryBackground> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 创建 |
|||
* @param entity |
|||
*/ |
|||
void create(TrajectoryBackground entity); |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param entity |
|||
*/ |
|||
void update(TrajectoryBackground entity); |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 查询所有已启用的配置设备 |
|||
* @return List<TrajectoryConfiguration> |
|||
*/ |
|||
List<TrajectoryBackground> queryAllEnable(); |
|||
|
|||
} |
@ -0,0 +1,50 @@ |
|||
package org.nl.system.service.trajectory; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.common.base.CommonService; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
public interface TrajectoryConfigurationService extends CommonService<TrajectoryConfiguration> { |
|||
|
|||
/** |
|||
* 分页 |
|||
* @param whereJson |
|||
* @param page |
|||
* @return |
|||
*/ |
|||
IPage<TrajectoryConfiguration> queryAll(Map whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 创建 |
|||
* @param entity |
|||
*/ |
|||
void create(TrajectoryConfiguration entity); |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param entity |
|||
*/ |
|||
void update(TrajectoryConfiguration entity); |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 查询所有已启用的配置设备 |
|||
* @return List<TrajectoryConfiguration> |
|||
*/ |
|||
List<TrajectoryConfiguration> queryAllEnable(); |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package org.nl.system.service.trajectory; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
public interface TrajectoryService { |
|||
|
|||
/** |
|||
* 查询设备状态 |
|||
* |
|||
* @param jsonObject 条件 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
Map<String, Object> queryDevice(String jsonObject) throws Exception; |
|||
} |
@ -0,0 +1,103 @@ |
|||
package org.nl.system.service.trajectory.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author liejiu |
|||
*/ |
|||
@Data |
|||
@TableName("trajectory_background") |
|||
public class TrajectoryBackground implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 背景图标识 |
|||
*/ |
|||
@TableId |
|||
private String background_uuid; |
|||
|
|||
/** |
|||
* 背景图名称 |
|||
*/ |
|||
private String background_code; |
|||
|
|||
/** |
|||
* 背景图片编码 |
|||
*/ |
|||
private String image_code; |
|||
|
|||
/** |
|||
* 背景图片地址 |
|||
*/ |
|||
private String image_name; |
|||
|
|||
/** |
|||
* 缩放比例(0-1之间 百分比) |
|||
*/ |
|||
private String zoom_ratio; |
|||
|
|||
/** |
|||
* 坐标原点(1左上 2左下 3右上 4右下) |
|||
*/ |
|||
private String coordinate_origin; |
|||
|
|||
/** |
|||
* X坐标最大值 |
|||
*/ |
|||
private String max_x; |
|||
|
|||
|
|||
/** |
|||
* Y坐标最大值 |
|||
*/ |
|||
private String max_y; |
|||
|
|||
/** |
|||
* 刷新时间(秒) |
|||
*/ |
|||
private Integer refresh_time; |
|||
|
|||
|
|||
/** |
|||
* 是否启用 |
|||
*/ |
|||
private String is_active; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private String create_id; |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改者 |
|||
*/ |
|||
private String update_id; |
|||
private String update_name; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,86 @@ |
|||
package org.nl.system.service.trajectory.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author liejiu |
|||
*/ |
|||
@Data |
|||
@TableName("trajectory_configuration") |
|||
public class TrajectoryConfiguration implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 配置标识 |
|||
*/ |
|||
@TableId |
|||
private String configuration_uuid; |
|||
|
|||
/** |
|||
* 配置名称 |
|||
*/ |
|||
private String configuration_code; |
|||
|
|||
/** |
|||
* 图标编码 |
|||
*/ |
|||
private String image_code; |
|||
|
|||
/** |
|||
* 图标名称 |
|||
*/ |
|||
private String image_name; |
|||
|
|||
/** |
|||
* 图标高度 |
|||
*/ |
|||
private String image_height; |
|||
|
|||
/** |
|||
* 图标宽度 |
|||
*/ |
|||
private String image_width; |
|||
|
|||
/** |
|||
* 绑定设备编码 |
|||
*/ |
|||
private String device_code; |
|||
|
|||
/** |
|||
* 是否启用 |
|||
*/ |
|||
private String is_active; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
/** |
|||
* 创建者 |
|||
*/ |
|||
private String create_id; |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改者 |
|||
*/ |
|||
private String update_id; |
|||
private String update_name; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package org.nl.system.service.trajectory.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
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.conditions.query.LambdaQueryChainWrapper; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.nl.acs.common.base.impl.CommonServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.system.service.trajectory.TrajectoryBackgroundService; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryBackground; |
|||
import org.nl.system.service.trajectory.mapper.TrajectoryBackgroundMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@Service |
|||
public class TrajectoryBackgroundImpl extends CommonServiceImpl<TrajectoryBackgroundMapper, TrajectoryBackground> implements TrajectoryBackgroundService { |
|||
|
|||
@Resource |
|||
private TrajectoryBackgroundMapper trajectoryBackgroundMapper; |
|||
|
|||
@Override |
|||
public IPage<TrajectoryBackground> queryAll(Map whereJson, PageQuery page) { |
|||
LambdaQueryWrapper<TrajectoryBackground> lam = new LambdaQueryWrapper<>(); |
|||
IPage<TrajectoryBackground> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
trajectoryBackgroundMapper.selectPage(pages,lam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(TrajectoryBackground entity) { |
|||
TrajectoryBackground stage = trajectoryBackgroundMapper.selectOne(new LambdaQueryWrapper<TrajectoryBackground>().eq(TrajectoryBackground::getBackground_code, entity.getBackground_code())); |
|||
if (ObjectUtil.isNotEmpty(stage)) { |
|||
throw new BadRequestException("背景图名称[" + entity.getBackground_code() + "]已存在"); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
entity.setIs_active("1"); |
|||
entity.setIs_delete("0"); |
|||
entity.setBackground_uuid(IdUtil.simpleUUID()); |
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
trajectoryBackgroundMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(TrajectoryBackground entity) { |
|||
TrajectoryBackground trajectoryBackground = trajectoryBackgroundMapper.selectOne(new LambdaQueryWrapper<TrajectoryBackground>().eq(TrajectoryBackground::getBackground_uuid, entity.getBackground_uuid())); |
|||
if (trajectoryBackground == null) { |
|||
throw new BadRequestException("未找到这条数据"); |
|||
} |
|||
|
|||
String currentUsername = SecurityUtils.getCurrentNickName(); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(currentUsername); |
|||
trajectoryBackgroundMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
trajectoryBackgroundMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<TrajectoryBackground> queryAllEnable() { |
|||
return new LambdaQueryChainWrapper<>(trajectoryBackgroundMapper) |
|||
.apply("is_delete= '0' AND is_active= '1'") |
|||
.orderByAsc(TrajectoryBackground::getBackground_uuid) |
|||
.list(); |
|||
} |
|||
} |
@ -0,0 +1,91 @@ |
|||
package org.nl.system.service.trajectory.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
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.conditions.query.LambdaQueryChainWrapper; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.nl.acs.common.base.impl.CommonServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.nl.system.service.trajectory.TrajectoryConfigurationService; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration; |
|||
import org.nl.system.service.trajectory.mapper.TrajectoryConfigurationMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@Service |
|||
public class TrajectoryConfigurationImpl extends CommonServiceImpl<TrajectoryConfigurationMapper, TrajectoryConfiguration> implements TrajectoryConfigurationService { |
|||
|
|||
@Resource |
|||
private TrajectoryConfigurationMapper trajectoryConfigurationMapper; |
|||
|
|||
@Override |
|||
public IPage<TrajectoryConfiguration> queryAll(Map whereJson, PageQuery page) { |
|||
LambdaQueryWrapper<TrajectoryConfiguration> lam = new LambdaQueryWrapper<>(); |
|||
IPage<TrajectoryConfiguration> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
trajectoryConfigurationMapper.selectPage(pages,lam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(TrajectoryConfiguration entity) { |
|||
TrajectoryConfiguration stage = trajectoryConfigurationMapper.selectOne(new LambdaQueryWrapper<TrajectoryConfiguration>().eq(TrajectoryConfiguration::getConfiguration_code, entity.getConfiguration_code())); |
|||
if (ObjectUtil.isNotEmpty(stage)) { |
|||
throw new BadRequestException("轨迹图配置编码[" + entity.getConfiguration_code() + "]已存在"); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
entity.setIs_delete("0"); |
|||
entity.setConfiguration_uuid(IdUtil.simpleUUID()); |
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
trajectoryConfigurationMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(TrajectoryConfiguration entity) { |
|||
TrajectoryConfiguration trajectoryBackground = trajectoryConfigurationMapper.selectOne(new LambdaQueryWrapper<TrajectoryConfiguration>().eq(TrajectoryConfiguration::getConfiguration_uuid, entity.getConfiguration_uuid())); |
|||
if (trajectoryBackground == null) { |
|||
throw new BadRequestException("未找到这条数据"); |
|||
} |
|||
|
|||
String currentUsername = SecurityUtils.getCurrentNickName(); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(currentUsername); |
|||
trajectoryConfigurationMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
trajectoryConfigurationMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<TrajectoryConfiguration> queryAllEnable() { |
|||
return new LambdaQueryChainWrapper<>(trajectoryConfigurationMapper) |
|||
.apply("is_delete= '0' AND is_active= '1'") |
|||
.orderByAsc(TrajectoryConfiguration::getConfiguration_uuid) |
|||
.list(); |
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
package org.nl.system.service.trajectory.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.system.service.trajectory.TrajectoryService; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.Map; |
|||
import java.util.Random; |
|||
|
|||
/** |
|||
* @author dsh |
|||
* 2025/6/19 |
|||
*/ |
|||
@Service |
|||
public class TrajectoryImpl implements TrajectoryService { |
|||
|
|||
@Override |
|||
public Map<String, Object> queryDevice(String jsonObject) throws Exception { |
|||
JSONArray backja = new JSONArray(); |
|||
JSONArray datas = JSONArray.parseArray(jsonObject); |
|||
//agv
|
|||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; |
|||
|
|||
if (datas.size() == 0) { |
|||
throw new BadRequestException("缺少输入参数!"); |
|||
} |
|||
|
|||
// for (int i = 0; i < datas.size(); i++) {
|
|||
// JSONObject jo = new JSONObject();
|
|||
// JSONObject ja = new JSONObject();
|
|||
// JSONObject data = datas.getJSONObject(i);
|
|||
// String device_code = data.getString("device_code");
|
|||
// Device device = deviceAppService.findDeviceByCode(device_code);
|
|||
// if (ObjectUtil.isEmpty(device)) {
|
|||
// throw new Exception("未找到对应设备:" + device_code);
|
|||
// }
|
|||
// if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
|||
// agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
|||
// jo.put("device_code", agvNdcOneDeviceDriver.getDevice().getDevice_code());
|
|||
// jo.put("x", agvNdcOneDeviceDriver.getX());
|
|||
// jo.put("y", agvNdcOneDeviceDriver.getY());
|
|||
// jo.put("angle", agvNdcOneDeviceDriver.getAngle());
|
|||
// ja.put(agvNdcOneDeviceDriver.getDevice().getDevice_code(),jo);
|
|||
// }
|
|||
// backja.add(ja);
|
|||
// }
|
|||
// JSONObject resultJson = new JSONObject();
|
|||
// resultJson.put("status", HttpStatus.OK.value());
|
|||
// resultJson.put("message", "操作成功");
|
|||
// resultJson.put("data", backja);
|
|||
// return resultJson;
|
|||
JSONObject resultJson = new JSONObject(); |
|||
Random rand = new Random(); |
|||
for (int i = 0; i < datas.size(); i++) { |
|||
JSONObject jo = new JSONObject(); |
|||
JSONObject data = datas.getJSONObject(i); |
|||
String device_code = data.getString("device_code"); |
|||
jo.put("x", rand.nextInt(1001)); |
|||
jo.put("y", rand.nextInt(1001)); |
|||
jo.put("angle", rand.nextInt(361)); |
|||
jo.put("device_code", device_code); |
|||
backja.add(jo); |
|||
} |
|||
resultJson.put("status", HttpStatus.OK.value()); |
|||
resultJson.put("message", "操作成功"); |
|||
resultJson.put("data", backja); |
|||
return resultJson; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package org.nl.system.service.trajectory.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryBackground; |
|||
|
|||
/** |
|||
* @author liejiu |
|||
*/ |
|||
@Mapper |
|||
public interface TrajectoryBackgroundMapper extends BaseMapper<TrajectoryBackground> { |
|||
} |
@ -0,0 +1,11 @@ |
|||
package org.nl.system.service.trajectory.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.system.service.trajectory.dto.TrajectoryConfiguration; |
|||
|
|||
/** |
|||
* @author liejiu |
|||
*/ |
|||
public interface TrajectoryConfigurationMapper extends BaseMapper<TrajectoryConfiguration> { |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/trajectoryConfiguration', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/trajectoryConfiguration/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/trajectoryConfiguration', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
@ -0,0 +1,27 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function add(data) { |
|||
return request({ |
|||
url: 'api/trajectoryBackground', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function del(ids) { |
|||
return request({ |
|||
url: 'api/trajectoryBackground/', |
|||
method: 'delete', |
|||
data: ids |
|||
}) |
|||
} |
|||
|
|||
export function edit(data) { |
|||
return request({ |
|||
url: 'api/trajectoryBackground', |
|||
method: 'put', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export default { add, edit, del } |
@ -0,0 +1,164 @@ |
|||
<template> |
|||
<div class="container"> |
|||
<div class="canvas-wrap" :style="getBgStyle(configInfo)"> |
|||
<div v-for="e in carData" :key="e.device_code" class="car-wrap" :style="getCarWrapStyle(e)"> |
|||
<div class="car_img" :style="getCarImgStyle(e)" /> |
|||
<div class="car_name">{{ e.configuration_code }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import apiTrack from '@/components/ShowTrack/track' |
|||
// const fullDomain = window.location.protocol + '//' + window.location.host |
|||
export default { |
|||
data() { |
|||
return { |
|||
configInfo: { refresh_time: 1000 }, |
|||
carData: [], |
|||
deviceData: [], |
|||
carCoor: [] |
|||
} |
|||
}, |
|||
computed: { |
|||
...mapGetters([ |
|||
'baseApi' |
|||
]) |
|||
}, |
|||
async created() { |
|||
const res1 = await apiTrack.trackEdit() |
|||
this.configInfo = [...res1.content][0] |
|||
const res2 = await apiTrack.carEdit() |
|||
this.carData = [...res2.content] |
|||
this.deviceData = this.carData.map(e => { return { device_code: e.device_code } }) |
|||
this._queryDevice(this.deviceData) |
|||
this.timerFun(this._queryDevice, this.configInfo.refresh_time * 1000)() |
|||
}, |
|||
methods: { |
|||
timerFun(f, time) { |
|||
const _this = this |
|||
return function backFun() { |
|||
clearTimeout(_this.intervalId) |
|||
_this.intervalId = setTimeout(function() { |
|||
f(_this.deviceData) |
|||
backFun() |
|||
}, time) |
|||
} |
|||
}, |
|||
_queryDevice(arr) { |
|||
apiTrack.queryDevice(arr).then(res => { |
|||
this.carCoor = [...res.data] |
|||
}) |
|||
}, |
|||
getBgStyle(obj) { |
|||
if (obj.image_code) { |
|||
const width = parseFloat(obj.max_x) * parseFloat(obj.zoom_ratio) |
|||
const height = parseFloat(obj.max_y) * parseFloat(obj.zoom_ratio) |
|||
// const fullImageUrl = require('@/assets/images/background.jpg') |
|||
const fullImageUrl = `${this.baseApi}/file/图片/${obj.image_code}` |
|||
return { |
|||
width: `${width}px`, |
|||
height: `${height}px`, |
|||
backgroundImage: `url(${fullImageUrl})` |
|||
} |
|||
} |
|||
}, |
|||
getPositionById(code) { |
|||
const position = this.carCoor.find((p) => p.device_code === code) |
|||
return position || { x: 0, y: 0 } |
|||
}, |
|||
getCarWrapStyle(el) { |
|||
const width = el.image_width |
|||
const height = el.image_height |
|||
const position = this.getPositionById(el.device_code) |
|||
const x = position.x * parseFloat(this.configInfo.zoom_ratio) |
|||
const y = position.y * parseFloat(this.configInfo.zoom_ratio) |
|||
let sty = {} |
|||
switch (this.configInfo.coordinate_origin) { |
|||
case '1': |
|||
sty = { |
|||
width: `${width}px`, |
|||
height: `${height}px`, |
|||
left: `${x}px`, |
|||
top: `${y}px` |
|||
} |
|||
break |
|||
case '2': |
|||
sty = { |
|||
width: `${width}px`, |
|||
height: `${height}px`, |
|||
left: `${x}px`, |
|||
bottom: `${y}px` |
|||
} |
|||
break |
|||
case '3': |
|||
sty = { |
|||
width: `${width}px`, |
|||
height: `${height}px`, |
|||
right: `${x}px`, |
|||
top: `${y}px` |
|||
} |
|||
break |
|||
case '4': |
|||
sty = { |
|||
width: `${width}px`, |
|||
height: `${height}px`, |
|||
right: `${x}px`, |
|||
bottom: `${y}px` |
|||
} |
|||
break |
|||
default: |
|||
sty = {} |
|||
} |
|||
return sty |
|||
}, |
|||
getCarImgStyle(el) { |
|||
// const fullImageUrl = require('@/assets/images/avatar.png') |
|||
const fullImageUrl = `${this.baseApi}/file/图片/${el.image_code}` |
|||
const position = this.getPositionById(el.device_code) |
|||
const angle = parseFloat(position.angle) |
|||
return { |
|||
backgroundImage: `url(${fullImageUrl})`, |
|||
transform: `rotate(-${angle}deg)` |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.container { |
|||
overflow: auto; |
|||
scrollbar-width: none; |
|||
} |
|||
.container::-webkit-scrollbar { |
|||
display: none; |
|||
} |
|||
.canvas-wrap { |
|||
position: relative; |
|||
background: #f3f3f3 top center / 100% auto no-repeat; |
|||
} |
|||
.car-wrap { |
|||
position: absolute; |
|||
transform: translate(-50%, -50%); |
|||
transform-origin: center; |
|||
} |
|||
.car_img { |
|||
width: 100%; |
|||
height: 100%; |
|||
background: top center / 100% auto no-repeat; |
|||
} |
|||
.car_name { |
|||
position: absolute; |
|||
width: 100%; |
|||
bottom: -20px; |
|||
font-size: 12px; |
|||
color: #fff; |
|||
line-height: 16px; |
|||
display: flex; |
|||
justify-content: center; |
|||
white-space: nowrap; |
|||
} |
|||
</style> |
@ -0,0 +1,87 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
export function trackEdit(data) { |
|||
return request({ |
|||
url: 'api/trajectoryBackground/queryAllEnable', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function carEdit(data) { |
|||
return request({ |
|||
url: 'api/trajectoryConfiguration/queryAllEnable', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
export function queryDevice(data) { |
|||
return request({ |
|||
url: 'api/trajectory/queryDevice', |
|||
method: 'post', |
|||
data |
|||
}) |
|||
} |
|||
|
|||
// export function trackEdit() {
|
|||
// const res = {
|
|||
// code: 200,
|
|||
// msg: 'ok',
|
|||
// content: [{
|
|||
// background_code: '图片',
|
|||
// image_code: 'aaa.jpg',
|
|||
// zoom_ratio: '0.5',
|
|||
// coordinate_origin: '4',
|
|||
// max_x: '1000',
|
|||
// max_y: '1000',
|
|||
// refresh_time: 10000
|
|||
// }]
|
|||
// }
|
|||
// return new Promise((resolve, reject) => {
|
|||
// resolve(res)
|
|||
// })
|
|||
// }
|
|||
|
|||
// export function carEdit() {
|
|||
// const res = {
|
|||
// code: 200,
|
|||
// msg: 'ok',
|
|||
// content: [{
|
|||
// configuration_code: '1号agv',
|
|||
// image_code: 'aaa.jpg',
|
|||
// image_width: '20',
|
|||
// image_height: '20',
|
|||
// device_code: '1',
|
|||
// x: 100,
|
|||
// y: 100,
|
|||
// angle: 90
|
|||
// }, {
|
|||
// configuration_code: '2号agv',
|
|||
// image_code: 'aaa.jpg',
|
|||
// image_width: '20',
|
|||
// image_height: '20',
|
|||
// device_code: '2',
|
|||
// x: 200,
|
|||
// y: 200,
|
|||
// angle: 0
|
|||
// }]
|
|||
// }
|
|||
// return new Promise((resolve, reject) => {
|
|||
// resolve(res)
|
|||
// })
|
|||
// }
|
|||
|
|||
// export function queryDevice() {
|
|||
// const res = {
|
|||
// data: [{ device_code: '1', x: Math.floor(Math.random() * 10) * 100, y: Math.floor(Math.random() * 10) * 100, angle: 90 }, { device_code: '2', x: Math.floor(Math.random() * 10) * 100, y: Math.floor(Math.random() * 10) * 100, angle: 0 }],
|
|||
// data1: [{ device_code: '1', x: 100, y: 100, angle: 90 }, { device_code: '2', x: 200, y: 200, angle: 0 }],
|
|||
// status: '200',
|
|||
// message: '操作成功'
|
|||
// }
|
|||
// return new Promise((resolve, reject) => {
|
|||
// resolve(res)
|
|||
// })
|
|||
// }
|
|||
|
|||
export default { trackEdit, carEdit, queryDevice } |
@ -0,0 +1,270 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<!-- <div v-if="crud.props.searchToggle">--> |
|||
<!-- <!– 搜索 –>--> |
|||
<!-- <el-select--> |
|||
<!-- v-model="query.device_type"--> |
|||
<!-- class="filter-item"--> |
|||
<!-- clearable--> |
|||
<!-- placeholder="设备类型"--> |
|||
<!-- size="small"--> |
|||
<!-- style="width: 450px"--> |
|||
<!-- >--> |
|||
<!-- <el-option v-for="item in device_types" :key="item.id" :label="item.label" :value="item.value" />--> |
|||
<!-- </el-select>--> |
|||
<!-- <rrOperation />--> |
|||
<!-- </div>--> |
|||
<crudOperation :permission="permission" /> |
|||
<!--表单组件--> |
|||
<el-dialog |
|||
:before-close="crud.cancelCU" |
|||
:close-on-click-modal="false" |
|||
:title="crud.status.title" |
|||
:visible.sync="crud.status.cu > 0" |
|||
width="500px" |
|||
> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small"> |
|||
<el-form-item label="图片上传" prop="image_code"> |
|||
<el-upload |
|||
:action="imagesUploadApi" |
|||
:before-upload="beforeUpload_u" |
|||
:file-list="fileList" |
|||
:headers="headers" |
|||
:limit="1" |
|||
list-type="picture" |
|||
:on-success="handleSuccess" |
|||
class="upload-demo" |
|||
multiple |
|||
> |
|||
<el-button size="small" type="primary">点击上传</el-button> |
|||
</el-upload> |
|||
</el-form-item> |
|||
<el-form-item label="图标高度" prop="image_height"> |
|||
<el-input v-model="form.image_height" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="图标宽度" prop="image_width"> |
|||
<el-input v-model="form.image_width" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="配置名称" prop="configuration_code"> |
|||
<el-input v-model="form.configuration_code" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="绑定设备" prop="device_code"> |
|||
<el-select v-model="form.device_code" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in options" |
|||
:key="item.device_code" |
|||
:label="item.device_name" |
|||
:value="item.device_code"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="是否启用"> |
|||
<el-switch |
|||
v-model="form.is_active" |
|||
active-value="1" |
|||
inactive-value="0" |
|||
active-color="#13ce66" |
|||
inactive-color="#ff4949"> |
|||
</el-switch> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="text" @click="crud.cancelCU">取消</el-button> |
|||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
size="small" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column label="图标" prop="image_name"> |
|||
<template slot-scope="{row}"> |
|||
<el-image |
|||
:preview-src-list="[baseApi + '/file/图片/' + row.image_code]" |
|||
:src=" baseApi + '/file/图片/' + row.image_code" |
|||
class="el-avatar" |
|||
fit="contain" |
|||
lazy |
|||
> |
|||
<div slot="error"> |
|||
<i class="el-icon-document" /> |
|||
</div> |
|||
</el-image> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="配置名称" prop="configuration_code" /> |
|||
<el-table-column label="图标编号" prop="image_code" /> |
|||
<el-table-column label="图标高度" prop="image_height" /> |
|||
<el-table-column label="图标宽度" prop="image_width" /> |
|||
<el-table-column label="绑定设备编号" prop="device_code" /> |
|||
<el-table-column label="是否启用" prop="is_active"> |
|||
<template slot-scope="{row}"> |
|||
<span v-if="row.is_active === '1'"><el-tag type="success">启用</el-tag></span> |
|||
<span v-else><el-tag type="warning">未启用</el-tag></span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="create_name" label="创建人" /> |
|||
<el-table-column prop="create_time" label="创建时间" min-width="135" /> |
|||
<el-table-column |
|||
v-permission="['admin','stageImage:edit','stageImage:del']" |
|||
align="center" |
|||
label="操作" |
|||
width="150px" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<udOperation |
|||
:data="scope.row" |
|||
:permission="permission" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CRUD, { crud, form, header, presenter } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import udOperation from '@crud/UD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import { mapGetters } from 'vuex' |
|||
import { getToken } from '@/utils/auth' |
|||
import { selectDeviceList } from '@/api/acs/device/device' |
|||
import crudTrajectoryConfiguration from '@/api/trajectory/configuration/trajectory_configuration' |
|||
|
|||
const defaultForm = { |
|||
configuration_uuid: null, |
|||
configuration_code: null, |
|||
image_code: null, |
|||
image_name: null, |
|||
image_height: null, |
|||
image_width: null, |
|||
device_code: null, |
|||
is_active: '1', |
|||
is_delete: null, |
|||
create_by: null, |
|||
create_time: null, |
|||
update_by: null, |
|||
update_time: null |
|||
} |
|||
export default { |
|||
name: 'TrajectoryConfiguration', |
|||
components: { pagination, crudOperation, udOperation }, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '设备配置', |
|||
url: 'api/trajectoryConfiguration', |
|||
idField: 'configuration_uuid', |
|||
sort: 'configuration_uuid,desc', |
|||
crudMethod: { ...crudTrajectoryConfiguration }, |
|||
optShow: { |
|||
add: true, |
|||
edit: true, |
|||
del: true |
|||
} |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
value: [], |
|||
permission: { |
|||
add: ['admin', 'TrajectoryConfiguration:add'], |
|||
edit: ['admin', 'TrajectoryConfiguration:edit'], |
|||
del: ['admin', 'TrajectoryConfiguration:del'] |
|||
}, |
|||
headers: { 'Authorization': getToken() }, |
|||
rules: { |
|||
configuration_code: [ |
|||
{ required: true, message: '配置名称不能为空', trigger: 'blur' } |
|||
], |
|||
image_code: [ |
|||
{ required: true, message: '图标编号不能为空', trigger: 'blur' } |
|||
], |
|||
image_name: [ |
|||
{ required: true, message: '图标名称不能为空', trigger: 'blur' } |
|||
], |
|||
image_height: [ |
|||
{ required: true, message: '图标高度不能为空', trigger: 'blur' } |
|||
], |
|||
image_width: [ |
|||
{ required: true, message: '图标宽度不能为空', trigger: 'blur' } |
|||
], |
|||
device_code: [ |
|||
{ required: true, message: '绑定设备不能为空', trigger: 'blur' } |
|||
] |
|||
}, |
|||
fileList: [], |
|||
options: [] |
|||
} |
|||
}, |
|||
computed: { |
|||
...mapGetters([ |
|||
'imagesUploadApi', |
|||
'baseApi' |
|||
]) |
|||
}, |
|||
mounted() { |
|||
// 获取所有设备 |
|||
selectDeviceList().then(data => { |
|||
console.log(data) |
|||
this.options = data |
|||
}) |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
}, |
|||
[CRUD.HOOK.afterSubmit]() { |
|||
this.fileList = [] |
|||
}, [CRUD.HOOK.beforeToAdd]() { |
|||
this.fileList = [] |
|||
}, |
|||
[CRUD.HOOK.afterToEdit]() { |
|||
let new_lst = [] |
|||
const image_code = this.form.image_code |
|||
const image_name = this.baseApi + '/file/图片/' + image_code |
|||
new_lst = [{ name: image_code, url: image_name }] |
|||
this.fileList = new_lst |
|||
}, |
|||
beforeUpload_u(file) { |
|||
const testmsg = file.name.substring(file.name.lastIndexOf('.') + 1) |
|||
const extension = (testmsg === 'png' || testmsg === 'jpg' || testmsg === 'svg') |
|||
|
|||
let bool = false |
|||
if (extension) { |
|||
bool = true |
|||
} else { |
|||
bool = false |
|||
} |
|||
if (!extension) { |
|||
this.$confirm(`上传文件只能是png/jpg/svg格式!`) |
|||
} |
|||
|
|||
return bool |
|||
}, |
|||
handleSuccess(response) { |
|||
console.log(response) |
|||
this.form.image_code = response.real_name |
|||
this.form.image_name = response.path |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,270 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
|||
<crudOperation :permission="permission" /> |
|||
<!--表单组件--> |
|||
<el-dialog |
|||
:close-on-click-modal="false" |
|||
:before-close="crud.cancelCU" |
|||
:visible.sync="crud.status.cu > 0" |
|||
:title="crud.status.title" |
|||
width="500px" |
|||
> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small"> |
|||
<el-form-item label="图片上传" prop="image_code"> |
|||
<el-upload |
|||
:action="imagesUploadApi" |
|||
:before-upload="beforeUpload_u" |
|||
:file-list="fileList" |
|||
:headers="headers" |
|||
:limit="1" |
|||
list-type="picture" |
|||
:on-success="handleSuccess" |
|||
class="upload-demo" |
|||
multiple |
|||
> |
|||
<el-button size="small" type="primary">点击上传</el-button> |
|||
</el-upload> |
|||
</el-form-item> |
|||
<el-form-item label="背景图名称" prop="background_code"> |
|||
<el-input v-model="form.background_code" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="缩放比例" prop="zoom_ratio"> |
|||
<el-input v-model="form.zoom_ratio" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="坐标原点" prop="coordinate_origin"> |
|||
<el-select v-model="form.coordinate_origin" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in options" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="X坐标最大值" prop="max_x"> |
|||
<el-input v-model="form.max_x" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="Y坐标最大值" prop="max_y"> |
|||
<el-input v-model="form.max_y" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="刷新时间(秒)" prop="refresh_time"> |
|||
<el-input v-model="form.refresh_time" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="图片描述" prop="remark"> |
|||
<el-input v-model="form.remark" style="width: 370px;" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="text" @click="crud.cancelCU">{{ $t('auto.common.Cancel') }}</el-button> |
|||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{ $t('auto.common.Confirm') }}</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
size="small" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column label="背景图" prop="image_name"> |
|||
<template slot-scope="{row}"> |
|||
<el-image |
|||
:preview-src-list="[baseApi + '/file/图片/' + row.image_code]" |
|||
:src=" baseApi + '/file/图片/' + row.image_code" |
|||
class="el-avatar" |
|||
fit="contain" |
|||
lazy |
|||
> |
|||
<div slot="error"> |
|||
<i class="el-icon-document" /> |
|||
</div> |
|||
</el-image> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="background_code" label="背景图名称" /> |
|||
<el-table-column prop="image_code" label="背景图片编码" /> |
|||
<el-table-column prop="image_name" label="背景图片地址" /> |
|||
<el-table-column prop="zoom_ratio" label="缩放比例" /> |
|||
<el-table-column prop="coordinate_origin" label="坐标原点"> |
|||
<template slot-scope="{row}"> |
|||
<span v-if="options.length!==0">{{ getCoordinateOrigin(row.coordinate_origin) }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="max_x" label="X坐标最大值" /> |
|||
<el-table-column prop="max_y" label="Y坐标最大值" /> |
|||
<el-table-column prop="refresh_time" label="刷新时间(秒)" /> |
|||
<el-table-column label="是否启用" prop="is_active"> |
|||
<template slot-scope="{row}"> |
|||
<span v-if="row.is_active === '1'"><el-tag type="success">启用</el-tag></span> |
|||
<span v-else><el-tag type="warning">未启用</el-tag></span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="create_name" label="创建人" /> |
|||
<el-table-column prop="create_time" label="创建时间" min-width="135" /> |
|||
<el-table-column label="备注" prop="remark" /> |
|||
<el-table-column v-permission="['admin','stage:edit','stage:del']" :label="$t('task.select.Operation')" width="150px" align="center"> |
|||
<template slot-scope="scope"> |
|||
<udOperation |
|||
:data="scope.row" |
|||
:permission="permission" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import crudTrajectory from '@/api/trajectory/trajectory_background' |
|||
import { get } from '@/views/system/dict/dictDetail' |
|||
|
|||
import CRUD, { presenter, header, form, crud } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import udOperation from '@crud/UD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
// import i18n from '@/i18n' |
|||
import { mapGetters } from 'vuex' |
|||
import { getToken } from '@/utils/auth' |
|||
|
|||
const defaultForm = { |
|||
background_uuid: null, |
|||
background_code: null, |
|||
image_code: null, |
|||
image_name: null, |
|||
zoom_ratio: null, |
|||
coordinate_origin: null, |
|||
max_x: null, |
|||
max_y: null, |
|||
refresh_time: null, |
|||
is_active: null, |
|||
is_delete: null, |
|||
create_by: null, |
|||
create_time: null, |
|||
update_by: null, |
|||
update_time: null, |
|||
remark: null |
|||
} |
|||
export default { |
|||
name: 'Trajectory', |
|||
components: { pagination, crudOperation, udOperation }, |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '轨迹背景图', |
|||
url: 'api/trajectoryBackground', |
|||
idField: 'background_uuid', |
|||
sort: 'background_uuid,desc', |
|||
crudMethod: { ...crudTrajectory }, |
|||
optShow: { |
|||
add: true, |
|||
edit: true, |
|||
del: true |
|||
} |
|||
}) |
|||
}, |
|||
mounted() { |
|||
// 获取坐标原点字典 |
|||
get('coordinate_origin').then(data => { |
|||
console.log(data) |
|||
this.options = data.content |
|||
}) |
|||
}, |
|||
data() { |
|||
return { |
|||
permission: { |
|||
add: ['admin', 'Trajectory:add'], |
|||
edit: ['admin', 'Trajectory:edit'], |
|||
del: ['admin', 'Trajectory:del'] |
|||
}, |
|||
rules: { |
|||
background_code: [ |
|||
{ required: true, message: '背景图名称不能为空', trigger: 'blur' } |
|||
], |
|||
image_code: [ |
|||
{ required: true, message: '背景图不能为空', trigger: 'blur' } |
|||
], |
|||
zoom_ratio: [ |
|||
{ required: true, message: '缩放比例不能为空,范围0-1', trigger: 'blur' } |
|||
], |
|||
coordinate_origin: [ |
|||
{ required: true, message: '坐标原点不能为空', trigger: 'blur' } |
|||
], |
|||
max_x: [ |
|||
{ required: true, message: 'X坐标最大值不能为空', trigger: 'blur' } |
|||
], |
|||
max_y: [ |
|||
{ required: true, message: 'Y坐标最大值不能为空', trigger: 'blur' } |
|||
], |
|||
refresh_time: [ |
|||
{ required: true, message: '刷新时间不能为空', trigger: 'blur' } |
|||
] |
|||
}, |
|||
fileList: [], |
|||
headers: { 'Authorization': getToken() }, |
|||
options: [] |
|||
} |
|||
}, |
|||
computed: { |
|||
...mapGetters([ |
|||
'imagesUploadApi', |
|||
'baseApi' |
|||
]) |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
}, |
|||
[CRUD.HOOK.afterSubmit]() { |
|||
this.fileList = [] |
|||
}, [CRUD.HOOK.beforeToAdd]() { |
|||
this.fileList = [] |
|||
}, |
|||
[CRUD.HOOK.afterToEdit]() { |
|||
let new_lst = [] |
|||
const image_code = this.form.image_code |
|||
const image_name = this.baseApi + '/file/图片/' + image_code |
|||
new_lst = [{ name: image_code, url: image_name }] |
|||
this.fileList = new_lst |
|||
}, |
|||
beforeUpload_u(file) { |
|||
const testmsg = file.name.substring(file.name.lastIndexOf('.') + 1) |
|||
const extension = (testmsg === 'png' || testmsg === 'jpg' || testmsg === 'svg') |
|||
|
|||
let bool = false |
|||
if (extension) { |
|||
bool = true |
|||
} else { |
|||
bool = false |
|||
} |
|||
if (!extension) { |
|||
this.$confirm(`上传文件只能是png/jpg/svg格式!`) |
|||
} |
|||
|
|||
return bool |
|||
}, |
|||
handleSuccess(response) { |
|||
console.log(response) |
|||
this.form.image_code = response.real_name |
|||
this.form.image_name = response.path |
|||
}, |
|||
getCoordinateOrigin(value) { |
|||
const item = this.options.find(item => item.value === value) |
|||
return item ? item.label : '' |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,24 @@ |
|||
<template> |
|||
<div style="padding: 20px 20px 45px 20px;"> |
|||
<el-row :gutter="24"> |
|||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24"> |
|||
<el-card class="box-card"> |
|||
<div slot="header" class="clearfix"> |
|||
<span style="font-weight: bold;color: #666;font-size: 15px">AGV运行轨迹图</span> |
|||
</div> |
|||
<div> |
|||
<showTrack /> |
|||
</div> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import showTrack from '@/components/ShowTrack/index.vue' |
|||
|
|||
export default { |
|||
components: { showTrack } |
|||
} |
|||
</script> |
Loading…
Reference in new issue