main #3

Merged
zhurui merged 3 commits from F/management:main into main 2024-01-16 12:28:31 +08:00
30 changed files with 2186 additions and 0 deletions

View File

@ -0,0 +1,108 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.controller;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.excel.ExcelUtils;
import com.dkha.commons.tools.utils.Result;
import com.dkha.commons.tools.validator.AssertUtils;
import com.dkha.commons.tools.validator.ValidatorUtils;
import com.dkha.commons.tools.validator.group.AddGroup;
import com.dkha.commons.tools.validator.group.UpdateGroup;
import com.dkha.commons.tools.validator.group.DefaultGroup;
import com.dkha.guide.declaration.dto.GuideDeclarationDTO;
import com.dkha.guide.declaration.excel.GuideDeclarationExcel;
import com.dkha.guide.declaration.service.GuideDeclarationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@RestController
@RequestMapping("guidedeclaration")
@Api(tags="项目申报指南")
public class GuideDeclarationController {
@Autowired
private GuideDeclarationService GuideDeclarationService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<GuideDeclarationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<GuideDeclarationDTO> page = GuideDeclarationService.page(params);
return new Result<PageData<GuideDeclarationDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<GuideDeclarationDTO> get(@PathVariable("id") String id){
GuideDeclarationDTO data = GuideDeclarationService.get(id);
return new Result<GuideDeclarationDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody GuideDeclarationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
GuideDeclarationService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody GuideDeclarationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
GuideDeclarationService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
GuideDeclarationService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<GuideDeclarationDTO> list = GuideDeclarationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, GuideDeclarationExcel.class);
}
}

View File

@ -0,0 +1,20 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.dao;
import com.dkha.commons.mybatis.dao.BaseDao;
import com.dkha.guide.declaration.entity.GuideDeclarationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Mapper
public interface GuideDeclarationDao extends BaseDao<GuideDeclarationEntity> {
}

View File

@ -0,0 +1,49 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
@ApiModel(value = "项目申报指南")
public class GuideDeclarationDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "项目指南名称")
private String guideName;
@ApiModelProperty(value = "类别(0算法类、1科研类、2技术开发类")
private Integer guideType;
@ApiModelProperty(value = "级别(0区级、1市级、2省级、3国家级")
private Integer guideLevel;
@ApiModelProperty(value = "附件地址")
private String attachmentUrl;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createDate;
}

View File

@ -0,0 +1,48 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dkha.commons.mybatis.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("zhyy_project_guide_declaration")
public class GuideDeclarationEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String guideName;
/**
* (012
*/
private Integer guideType;
/**
* (0123
*/
private Integer guideLevel;
/**
*
*/
private String attachmentUrl;
}

View File

@ -0,0 +1,33 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
public class GuideDeclarationExcel {
@Excel(name = "")
private Long id;
@Excel(name = "项目指南名称")
private String guideName;
@Excel(name = "类别(0算法类、1科研类、2技术开发类")
private Integer guideType;
@Excel(name = "级别(0区级、1市级、2省级、3国家级")
private Integer guideLevel;
@Excel(name = "附件地址")
private String attachmentUrl;
@Excel(name = "日期")
private Date creationDate;
}

View File

@ -0,0 +1,34 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.redis;
import com.dkha.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Component
public class GuideDeclarationRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

View File

@ -0,0 +1,34 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.service;
import com.dkha.commons.mybatis.service.BaseService;
import com.dkha.commons.tools.page.PageData;
import com.dkha.guide.declaration.dto.GuideDeclarationDTO;
import com.dkha.guide.declaration.entity.GuideDeclarationEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
public interface GuideDeclarationService extends BaseService<GuideDeclarationEntity> {
PageData<GuideDeclarationDTO> page(Map<String, Object> params);
List<GuideDeclarationDTO> list(Map<String, Object> params);
GuideDeclarationDTO get(String id);
void save(GuideDeclarationDTO dto);
void update(GuideDeclarationDTO dto);
void delete(String[] ids);
}

View File

@ -0,0 +1,106 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.guide.declaration.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dkha.commons.fileupload.minio.MinioUtil;
import com.dkha.commons.mybatis.enums.DelFlagEnum;
import com.dkha.commons.mybatis.service.impl.BaseServiceImpl;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.exception.RenException;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.utils.ConvertUtils;
import com.dkha.guide.declaration.dao.GuideDeclarationDao;
import com.dkha.guide.declaration.dto.GuideDeclarationDTO;
import com.dkha.guide.declaration.entity.GuideDeclarationEntity;
import com.dkha.guide.declaration.redis.GuideDeclarationRedis;
import com.dkha.guide.declaration.service.GuideDeclarationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Service
public class GuideDeclarationServiceImpl extends BaseServiceImpl<GuideDeclarationDao, GuideDeclarationEntity> implements GuideDeclarationService {
@Autowired
private GuideDeclarationRedis GuideDeclarationRedis;
@Autowired
private MinioUtil minioUtil;
@Override
public PageData<GuideDeclarationDTO> page(Map<String, Object> params) {
IPage<GuideDeclarationEntity> page = baseDao.selectPage(
getPage(params, Constant.CREATE_DATE, false),
getWrapper(params)
);
return getPageData(page, GuideDeclarationDTO.class);
}
@Override
public List<GuideDeclarationDTO> list(Map<String, Object> params) {
List<GuideDeclarationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, GuideDeclarationDTO.class);
}
private QueryWrapper<GuideDeclarationEntity> getWrapper(Map<String, Object> params) {
String guideName = (String) params.get("guideName");
String createDate = (String) params.get("createDate");
QueryWrapper<GuideDeclarationEntity> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(guideName), "guide_name", guideName);
wrapper.like(params.get("guideType") != null, "guide_type", params.get("guideType"));
wrapper.like(params.get("guideLevel") != null, "guide_level", params.get("guideLevel"));
wrapper.like(StringUtils.isNotBlank(createDate), "create_date", createDate);
return wrapper;
}
@Override
public GuideDeclarationDTO get(String id) {
GuideDeclarationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, GuideDeclarationDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(GuideDeclarationDTO dto) {
GuideDeclarationEntity entity = ConvertUtils.sourceToTarget(dto, GuideDeclarationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(GuideDeclarationDTO dto) {
GuideDeclarationEntity entity = ConvertUtils.sourceToTarget(dto, GuideDeclarationEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
//逻辑删除
//logicDelete(ids, GuideDeclarationEntity.class);
//物理删除
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

View File

@ -0,0 +1,108 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.controller;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.excel.ExcelUtils;
import com.dkha.commons.tools.utils.Result;
import com.dkha.commons.tools.validator.AssertUtils;
import com.dkha.commons.tools.validator.ValidatorUtils;
import com.dkha.commons.tools.validator.group.AddGroup;
import com.dkha.commons.tools.validator.group.UpdateGroup;
import com.dkha.commons.tools.validator.group.DefaultGroup;
import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO;
import com.dkha.researchProjectInformation.excel.ResearchProjectInformationExcel;
import com.dkha.researchProjectInformation.service.ResearchProjectInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@RestController
@RequestMapping("researchProjectInformation")
@Api(tags="科研项目信息")
public class ResearchProjectInformationController {
@Autowired
private ResearchProjectInformationService researchProjectInformationService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<ResearchProjectInformationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ResearchProjectInformationDTO> page = researchProjectInformationService.page(params);
return new Result<PageData<ResearchProjectInformationDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<ResearchProjectInformationDTO> get(@PathVariable("id") String id){
ResearchProjectInformationDTO data = researchProjectInformationService.get(id);
return new Result<ResearchProjectInformationDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody ResearchProjectInformationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
researchProjectInformationService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody ResearchProjectInformationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
researchProjectInformationService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
researchProjectInformationService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ResearchProjectInformationDTO> list = researchProjectInformationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ResearchProjectInformationExcel.class);
}
}

View File

@ -0,0 +1,20 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.dao;
import com.dkha.commons.mybatis.dao.BaseDao;
import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Mapper
public interface ResearchProjectInformationDao extends BaseDao<ResearchProjectInformationEntity> {
}

View File

@ -0,0 +1,44 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
@ApiModel(value = "科研项目信息")
public class ResearchProjectInformationDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long id;
@ApiModelProperty(value = "科研编号")
private String researchId;
@ApiModelProperty(value = "项目编号")
private String projectId;
@ApiModelProperty(value = "预算余额")
private Double budgetBalance;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
}

View File

@ -0,0 +1,45 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dkha.commons.mybatis.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("zhyy_research_project_information")
public class ResearchProjectInformationEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String researchId;
/**
*
*/
private String projectId;
/**
*
*/
private Double budgetBalance;
/**
*
*/
private Date createDate;
}

View File

@ -0,0 +1,31 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Data
public class ResearchProjectInformationExcel {
@Excel(name = "主键ID")
private Long id;
@Excel(name = "科研编号")
private String researchId;
@Excel(name = "项目编号")
private String projectId;
@Excel(name = "预算余额")
private Double budgetBalance;
@Excel(name = "创建时间")
private Date createDate;
}

View File

@ -0,0 +1,34 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.redis;
import com.dkha.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Component
public class ResearchProjectInformationRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

View File

@ -0,0 +1,33 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.service;
import com.dkha.commons.mybatis.service.BaseService;
import com.dkha.commons.tools.page.PageData;
import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO;
import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
public interface ResearchProjectInformationService extends BaseService<ResearchProjectInformationEntity> {
PageData<ResearchProjectInformationDTO> page(Map<String, Object> params);
List<ResearchProjectInformationDTO> list(Map<String, Object> params);
ResearchProjectInformationDTO get(String id);
void save(ResearchProjectInformationDTO dto);
void update(ResearchProjectInformationDTO dto);
void delete(String[] ids);
}

View File

@ -0,0 +1,106 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.researchProjectInformation.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dkha.commons.mybatis.service.impl.BaseServiceImpl;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.utils.ConvertUtils;
import com.dkha.researchProjectInformation.dao.ResearchProjectInformationDao;
import com.dkha.researchProjectInformation.dto.ResearchProjectInformationDTO;
import com.dkha.researchProjectInformation.entity.ResearchProjectInformationEntity;
import com.dkha.researchProjectInformation.redis.ResearchProjectInformationRedis;
import com.dkha.researchProjectInformation.service.ResearchProjectInformationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-09
*/
@Service
public class ResearchProjectInformationServiceImpl extends BaseServiceImpl<ResearchProjectInformationDao, ResearchProjectInformationEntity> implements ResearchProjectInformationService {
@Autowired
private ResearchProjectInformationRedis researchProjectInformationRedis;
@Override
public PageData<ResearchProjectInformationDTO> page(Map<String, Object> params) {
IPage<ResearchProjectInformationEntity> page = baseDao.selectPage(
getPage(params, Constant.CREATE_DATE, false),
getWrapper(params)
);
return getPageData(page, ResearchProjectInformationDTO.class);
}
@Override
public List<ResearchProjectInformationDTO> list(Map<String, Object> params) {
List<ResearchProjectInformationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ResearchProjectInformationDTO.class);
}
private QueryWrapper<ResearchProjectInformationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String researchId = (String)params.get("researchId");
String projectId = (String)params.get("projectId");
String startTime = (String)params.get("startTime");
String endTime = (String)params.get("endTime");
QueryWrapper<ResearchProjectInformationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.like(StringUtils.isNotBlank(researchId), "research_id", researchId);
wrapper.like(StringUtils.isNotBlank(projectId), "project_id", projectId);
wrapper.gt(StringUtils.isNotBlank(startTime),"create_date",startTime);
wrapper.lt(StringUtils.isNotBlank(endTime),"create_date",endTime);
//wrapper.eq(Constant.DEL_FLAG, DelFlagEnum.NORMAL.value());
return wrapper;
}
@Override
public ResearchProjectInformationDTO get(String id) {
ResearchProjectInformationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ResearchProjectInformationDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ResearchProjectInformationDTO dto) {
ResearchProjectInformationEntity entity = ConvertUtils.sourceToTarget(dto, ResearchProjectInformationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ResearchProjectInformationDTO dto) {
ResearchProjectInformationEntity entity = ConvertUtils.sourceToTarget(dto, ResearchProjectInformationEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
//逻辑删除
//logicDelete(ids, ResearchProjectInformationEntity.class);
//物理删除
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

View File

@ -0,0 +1,107 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.controller;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.excel.ExcelUtils;
import com.dkha.commons.tools.utils.Result;
import com.dkha.commons.tools.validator.AssertUtils;
import com.dkha.commons.tools.validator.ValidatorUtils;
import com.dkha.commons.tools.validator.group.AddGroup;
import com.dkha.commons.tools.validator.group.UpdateGroup;
import com.dkha.commons.tools.validator.group.DefaultGroup;
import com.dkha.scheme.dto.ApplicationSchemeDTO;
import com.dkha.scheme.excel.ApplicationSchemeExcel;
import com.dkha.scheme.service.ApplicationSchemeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@RestController
@RequestMapping("scheme")
@Api(tags="")
public class ApplicationSchemeController {
@Autowired
private ApplicationSchemeService ApplicationSchemeService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<ApplicationSchemeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ApplicationSchemeDTO> page = ApplicationSchemeService.page(params);
return new Result<PageData<ApplicationSchemeDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<ApplicationSchemeDTO> get(@PathVariable("id") String id){
ApplicationSchemeDTO data = ApplicationSchemeService.get(id);
return new Result<ApplicationSchemeDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody ApplicationSchemeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
ApplicationSchemeService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody ApplicationSchemeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
ApplicationSchemeService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
ApplicationSchemeService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ApplicationSchemeDTO> list = ApplicationSchemeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ApplicationSchemeExcel.class);
}
}

View File

@ -0,0 +1,20 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.dao;
import com.dkha.commons.mybatis.dao.BaseDao;
import com.dkha.scheme.entity.ApplicationSchemeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Mapper
public interface ApplicationSchemeDao extends BaseDao<ApplicationSchemeEntity> {
}

View File

@ -0,0 +1,58 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Data
@ApiModel(value = "")
public class ApplicationSchemeDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
@ApiModelProperty(value = "计划名称")
private String schemeName;
@ApiModelProperty(value = "类别(1算法类、2科研类、3技术开发类")
private Integer schemeType;
@ApiModelProperty(value = "级别(0区级、1市级、2省级、3国家级")
private Integer schemeLevel;
@ApiModelProperty(value = "计划开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startDate;
@ApiModelProperty(value = "计划结束时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endDate;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "申报指南id")
private Long guideId;
}

View File

@ -0,0 +1,59 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dkha.commons.mybatis.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("zhyy_project_application_scheme")
public class ApplicationSchemeEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String schemeName;
/**
* (123
*/
private Integer schemeType;
/**
* (0123
*/
private Integer schemeLevel;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startDate;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;
/**
* id
*/
private Long guideId;
}

View File

@ -0,0 +1,39 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Data
public class ApplicationSchemeExcel {
@Excel(name = "")
private Long id;
@Excel(name = "计划名称")
private Long schemeName;
@Excel(name = "类别(1算法类、2科研类、3技术开发类")
private Integer schemeType;
@Excel(name = "级别(0区级、1市级、2省级、3国家级")
private Integer schemeLevel;
@Excel(name = "计划开始时间")
private Date startDate;
@Excel(name = "计划结束时间")
private Date endDate;
@Excel(name = "创建人")
private String creator;
@Excel(name = "创建时间")
private Date createDate;
@Excel(name = "申报指南id")
private Long guideId;
}

View File

@ -0,0 +1,34 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.redis;
import com.dkha.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Component
public class ApplicationSchemeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

View File

@ -0,0 +1,34 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.service;
import com.dkha.commons.mybatis.service.BaseService;
import com.dkha.commons.tools.page.PageData;
import com.dkha.scheme.dto.ApplicationSchemeDTO;
import com.dkha.scheme.entity.ApplicationSchemeEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
public interface ApplicationSchemeService extends BaseService<ApplicationSchemeEntity> {
PageData<ApplicationSchemeDTO> page(Map<String, Object> params);
List<ApplicationSchemeDTO> list(Map<String, Object> params);
ApplicationSchemeDTO get(String id);
void save(ApplicationSchemeDTO dto);
void update(ApplicationSchemeDTO dto);
void delete(String[] ids);
}

View File

@ -0,0 +1,99 @@
/**
* Copyright 2023 UESTC
*/
package com.dkha.scheme.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dkha.commons.mybatis.service.impl.BaseServiceImpl;
import com.dkha.commons.tools.constant.Constant;
import com.dkha.commons.tools.page.PageData;
import com.dkha.commons.tools.utils.ConvertUtils;
import com.dkha.scheme.dao.ApplicationSchemeDao;
import com.dkha.scheme.dto.ApplicationSchemeDTO;
import com.dkha.scheme.entity.ApplicationSchemeEntity;
import com.dkha.scheme.redis.ApplicationSchemeRedis;
import com.dkha.scheme.service.ApplicationSchemeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*
* @author li.zhan 719901725@qq.com
* @since v1.0.0 2024-01-11
*/
@Service
public class ApplicationSchemeServiceImpl extends BaseServiceImpl<ApplicationSchemeDao, ApplicationSchemeEntity> implements ApplicationSchemeService {
@Autowired
private ApplicationSchemeRedis ApplicationSchemeRedis;
@Override
public PageData<ApplicationSchemeDTO> page(Map<String, Object> params) {
IPage<ApplicationSchemeEntity> page = baseDao.selectPage(
getPage(params, Constant.CREATE_DATE, false),
getWrapper(params)
);
return getPageData(page, ApplicationSchemeDTO.class);
}
@Override
public List<ApplicationSchemeDTO> list(Map<String, Object> params) {
List<ApplicationSchemeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ApplicationSchemeDTO.class);
}
private QueryWrapper<ApplicationSchemeEntity> getWrapper(Map<String, Object> params){
String schemeName = (String) params.get("schemeName");
QueryWrapper<ApplicationSchemeEntity> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(schemeName), "scheme_name", schemeName);
wrapper.like(params.get("schemeType") != null, "scheme_type", params.get("schemeType"));
wrapper.like(params.get("schemeLevel") != null, "scheme_level", params.get("schemeLevel"));
return wrapper;
}
@Override
public ApplicationSchemeDTO get(String id) {
ApplicationSchemeEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ApplicationSchemeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ApplicationSchemeDTO dto) {
ApplicationSchemeEntity entity = ConvertUtils.sourceToTarget(dto, ApplicationSchemeEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ApplicationSchemeDTO dto) {
ApplicationSchemeEntity entity = ConvertUtils.sourceToTarget(dto, ApplicationSchemeEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
//逻辑删除
//logicDelete(ids, ApplicationSchemeEntity.class);
//物理删除
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

View File

@ -0,0 +1,183 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false"
:close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '150px' : '120px'">
<el-form-item label="项目指南名称" prop="guideName">
<el-input v-model="dataForm.guideName" placeholder="项目指南名称"></el-input>
</el-form-item>
<el-form-item label="类别" prop="guideType">
<el-select v-model="dataForm.guideType" placeholder="请选择">
<el-option
v-for="item in guideType"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="级别" prop="guideLevel">
<el-select v-model="dataForm.guideLevel" placeholder="请选择">
<el-option
v-for="item in guideLevel"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="附件地址" prop="attachmentUrl">
<el-upload
class="upload-demo"
:action="uploadUrl"
:limit=1
:on-change="handleChange"
:http-request="upload"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data() {
return {
uploadUrl: '/system/upload',
guideType: [{
value: 0,
label: '算法类'
}, {
value: 1,
label: '科研类'
}, {
value: 2,
label: '技术开发类'
}],
guideLevel: [{
value: 0,
label: '区级'
}, {
value: 1,
label: '市级'
}, {
value: 2,
label: '省级'
}, {
value: 3,
label: '国家级'
}],
value: '',
visible: false,
dataForm: {
id: '',
guideName: '',
guideType: '',
guideLevel: '',
attachmentUrl: '',
creationDate: ''
}
}
},
computed: {
dataRule() {
return {
fileList: [{
url: window.SITE_CONFIG['uploadURL'] + '/system/upload'
}],
guideName: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
guideType: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
guideLevel: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
attachmentUrl: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
creationDate: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
]
}
}
},
methods: {
handleRemove(file, fileList) {
console.log(file, fileList);
},
handleChange(file, fileList) {
// this.fileList = fileList.slice(-3);
},
upload(file) {
let formData = new FormData();
formData.append("file", file.file);
formData.append("folderName", "");
this.$http
.post(`/system/upload`, formData)
.then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dataForm.attachmentUrl = res.data.src;
})
.catch(() => {
});
},
init() {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo() {
this.$http.get(`/system/guidedeclaration/${this.dataForm.id}`).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {
})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/system/guidedeclaration', this.dataForm).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
})
})
}, 1000, {'leading': true, 'trailing': false})
}
}
</script>

View File

@ -0,0 +1,182 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-unitInfoManagement__guidedeclaration}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.guideName" placeholder="项目指南名称" clearable></el-input>
</el-form-item>
<el-form-item label="类别" prop="guideType">
<el-select v-model="dataForm.guideType" placeholder="请选择">
<el-option
v-for="item in guideType"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="级别" prop="guideLevel">
<el-select v-model="dataForm.guideLevel" placeholder="请选择">
<el-option
v-for="item in guideLevel"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-date-picker
v-model="dataForm.createDate"
align="right"
type="date"
placeholder="选择日期"
:picker-options="createDate"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd">
</el-date-picker>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="guideName" label="项目指南名称" header-align="center" align="center"></el-table-column>
<el-table-column prop="projectType" label="类别" header-align="center" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.guideType===0" effect="dark"></el-tag>
<el-tag v-if="scope.row.guideType===1" effect="dark"></el-tag>
<el-tag v-if="scope.row.guideType===2" effect="dark"></el-tag>
</template>
</el-table-column>
<el-table-column prop="projectType" label="级别" header-align="center" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.guideLevel===0" effect="dark"></el-tag>
<el-tag v-if="scope.row.guideLevel===1" effect="dark"></el-tag>
<el-tag v-if="scope.row.guideLevel===2" effect="dark"></el-tag>
<el-tag v-if="scope.row.guideLevel===3" effect="dark"></el-tag>
</template>
</el-table-column>
<el-table-column prop="createDate" label="日期" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}
</el-button>
<el-button type="text" size="small"
@click="deleteHandle(scope.row.id)">{{ $t('delete') }}
</el-button>
</template>
</el-table-column>
<el-table-column prop="projectType" label="申报指南下载" header-align="center" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-download" ></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './guidedeclaration-add-or-update'
export default {
mixins: [mixinViewModule],
data() {
return {
createDate: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
},
value1: '',
value2: '',
guideType: [{
value: 0,
label: '算法类'
}, {
value: 1,
label: '科研类'
}, {
value: 2,
label: '技术开发类'
}],
guideLevel: [{
value: 0,
label: '区级'
}, {
value: 1,
label: '市级'
}, {
value: 2,
label: '省级'
}, {
value: 3,
label: '国家级'
}],
mixinViewModuleOptions: {
getDataListURL: '/system/guidedeclaration/page',
getDataListIsPage: true,
deleteURL: '/system/guidedeclaration',
deleteIsBatch: true
},
dataForm: {
id: '',
attachmentUrl:''
}
}
},
methods: {
download(url) {
const a = document.createElement('a')
a.style.display = 'none'
a.href = url
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
},
},
components: {
AddOrUpdate
}
}
</script>

View File

@ -0,0 +1,100 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '200px' : '150px'">
<el-form-item label="科研编号" prop="researchId">
<el-input v-model="dataForm.researchId" placeholder="科研编号"></el-input>
</el-form-item>
<el-form-item label="项目编号" prop="projectId">
<el-input v-model="dataForm.projectId" placeholder="项目编号"></el-input>
</el-form-item>
<el-form-item label="预算余额(万元)" prop="budgetBalance">
<el-input v-model="dataForm.budgetBalance" placeholder="预算余额"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
researchId: '',
projectId: '',
budgetBalance: '',
createDate: ''
}
}
},
computed: {
dataRule () {
return {
researchId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
projectId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
budgetBalance: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
createDate: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo () {
this.$http.get(`/system/researchProjectInformation/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/system/researchProjectInformation/', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>

View File

@ -0,0 +1,88 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-researchProjectInformation__researchprojectinformation}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="科研编号" prop="researchId">
<el-input v-model="dataForm.researchId" placeholder="科研编号" clearable></el-input>
</el-form-item>
<el-form-item label="项目编号" prop="projectId">
<el-input v-model="dataForm.projectId" placeholder="项目编号" clearable></el-input>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker
v-model="dataForm.startTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker
v-model="dataForm.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
<el-table-column prop="researchId" label="科研编号" header-align="center" align="center"></el-table-column>
<el-table-column prop="projectId" label="项目编号" header-align="center" align="center"></el-table-column>
<el-table-column prop="budgetBalance" label="预算余额(万元)" header-align="center" align="center"></el-table-column>
<el-table-column prop="createDate" label="创建时间" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="200">
<template slot-scope="scope">
<el-button @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './researchprojectinformation-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/system/researchProjectInformation/page',
getDataListIsPage: true,
deleteURL: '/system/researchProjectInformation',
deleteIsBatch: true
},
dataForm: {
}
}
},
components: {
AddOrUpdate
}
}
</script>

View File

@ -0,0 +1,203 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false"
:close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '150px' : '120px'">
<el-form-item label="计划名称" prop="schemeName">
<el-input v-model="dataForm.schemeName" placeholder="计划名称"></el-input>
</el-form-item>
<el-form-item label="类别" prop="schemeType">
<el-select v-model="dataForm.schemeType" placeholder="请选择">
<el-option
v-for="item in schemeType"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="级别" prop="schemeLevel">
<el-select v-model="dataForm.schemeLevel" placeholder="请选择">
<el-option
v-for="item in schemeLevel"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="计划开始时间" prop="startDate">
<el-date-picker
v-model="dataForm.startDate"
align="right"
type="date"
placeholder="选择日期"
:picker-options="createDate"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束时间" prop="endDate">
<el-date-picker
v-model="dataForm.endDate"
align="right"
type="date"
placeholder="选择日期"
:picker-options="createDate"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data() {
return {
createDate: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
},
schemeType: [{
value: 0,
label: '算法类'
}, {
value: 1,
label: '科研类'
}, {
value: 2,
label: '技术开发类'
}],
schemeLevel: [{
value: 0,
label: '区级'
}, {
value: 1,
label: '市级'
}, {
value: 2,
label: '省级'
}, {
value: 3,
label: '国家级'
}],
visible: false,
dataForm: {
schemeName: '',
schemeType: '',
schemeLevel: '',
startDate: '',
endDate: '',
guideId: ''
}
}
},
computed: {
dataRule() {
return {
schemeName: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
schemeType: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
schemeLevel: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
startDate: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
endDate: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
creator: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
createDate: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
guideId: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
]
}
}
},
methods: {
init() {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo() {
this.$http.get(`/system/scheme/${this.dataForm.id}`).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {
})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/system/scheme', this.dataForm).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {
})
})
}, 1000, {'leading': true, 'trailing': false})
}
}
</script>

View File

@ -0,0 +1,127 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-unitInfoManagement__Applicationscheme}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.schemeName" placeholder="项目计划名称" clearable></el-input>
</el-form-item>
<el-form-item label="类别" prop="guideType">
<el-select v-model="dataForm.schemeType" placeholder="请选择">
<el-option
v-for="item in schemeType"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="级别" prop="guideLevel">
<el-select v-model="dataForm.schemeLevel" placeholder="请选择">
<el-option
v-for="item in schemeLevel"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="schemeName" label="计划名称" header-align="center" align="center"></el-table-column>
<el-table-column prop="projectType" label="类别" header-align="center" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.schemeType===0" effect="dark"></el-tag>
<el-tag v-if="scope.row.schemeType===1" effect="dark"></el-tag>
<el-tag v-if="scope.row.schemeType===2" effect="dark"></el-tag>
</template>
</el-table-column>
<el-table-column prop="projectType" label="级别" header-align="center" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.schemeLevel===0" effect="dark"></el-tag>
<el-tag v-if="scope.row.schemeLevel===1" effect="dark"></el-tag>
<el-tag v-if="scope.row.schemeLevel===2" effect="dark"></el-tag>
<el-tag v-if="scope.row.schemeLevel===3" effect="dark"></el-tag>
</template>
</el-table-column>
<el-table-column prop="startDate" label="计划开始时间" header-align="center" align="center"></el-table-column>
<el-table-column prop="endDate" label="计划结束时间" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './applicationscheme-add-or-update'
export default {
mixins: [mixinViewModule],
data() {
return {
schemeType: [{
value: 0,
label: '算法类'
}, {
value: 1,
label: '科研类'
}, {
value: 2,
label: '技术开发类'
}],
schemeLevel: [{
value: 0,
label: '区级'
}, {
value: 1,
label: '市级'
}, {
value: 2,
label: '省级'
}, {
value: 3,
label: '国家级'
}],
mixinViewModuleOptions: {
getDataListURL: '/system/scheme/page',
getDataListIsPage: true,
deleteURL: '/system/scheme',
deleteIsBatch: true
},
dataForm: {
id: ''
}
}
},
components: {
AddOrUpdate
}
}
</script>