diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java index f5fd6b8..9a7653e 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java @@ -21,6 +21,8 @@ import org.jeecg.modules.demo.project.dto.DepartExtDto; import org.jeecg.modules.demo.project.dto.ProjectShenBaoDto; import org.jeecg.modules.demo.project.entity.Project; import org.jeecg.modules.demo.project.service.IProjectService; +import org.jeecg.modules.demo.projectType.entity.ProjectType; +import org.jeecg.modules.demo.projectType.service.IProjectTypeService; import org.jeecg.modules.demo.userext.entity.UserExt; import org.jeecg.modules.demo.userext.service.IUserExtService; import org.jeecg.modules.system.entity.SysDepart; @@ -64,6 +66,9 @@ public class ProjectController extends JeecgController @Autowired private ISysDepartService iSysDepartService; + @Autowired + private IProjectTypeService iProjectTypeService; + /** * 分页列表查询 * @@ -94,8 +99,14 @@ public class ProjectController extends JeecgController @ApiOperation(value = "项目表-根据id查询", notes = "项目表-根据id查询") @GetMapping(value = "/getById") - public Result getById(Project project,HttpServletRequest req) { - return Result.OK(projectService.getById(project.getId())); + public Result getById(Project param,HttpServletRequest req) { + Project project = projectService.getById(param.getId()); + ProjectType projectType = iProjectTypeService.getById(project.getProjectTypeid()); + project.setAnnualName(projectType.getAnnualName()); + project.setProjectTypeName(projectType.getTypeName()); + project.setAnnualName(projectType.getAnnualName()); + project.setProjectTypeName(projectType.getTypeName()); + return Result.OK(project); } @ApiOperation(value = "获取项目负责人信息", notes = "获取项目负责人信息") diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/entity/Project.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/entity/Project.java index b5235ed..3d97009 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/entity/Project.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/entity/Project.java @@ -1,6 +1,7 @@ package org.jeecg.modules.demo.project.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -234,6 +235,13 @@ public class Project implements Serializable { @ApiModelProperty(value = "项目类别表id") @Dict(dictTable = "project_type",dicCode = "id",dicText = "type_name") private String projectTypeid; + + @TableField(exist = false) + private String projectTypeName; + + @TableField(exist = false) + private String annualName; + /** * 批次 */ diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java index 698f594..9be171d 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/service/impl/ProjectServiceImpl.java @@ -1,6 +1,7 @@ package org.jeecg.modules.demo.project.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; @@ -72,6 +73,10 @@ public class ProjectServiceImpl extends ServiceImpl impl project.setProjectStatus("5"); // 预算书不存在 project.setBudgetStatus("10"); + +// ProjectType projectType = iProjectTypeService.getById(project.getProjectTypeid()); +// project.setAnnualName(projectType.getAnnualName()); +// project.setProjectTypeName(projectType.getTypeName()); this.save(project); userExt.setUserId(loginUser.getId()); userExt.setProjectId(project.getId()); @@ -80,7 +85,6 @@ public class ProjectServiceImpl extends ServiceImpl impl departExt.setProjectId(project.getId()); this.iDepartExtService.save(departExt); - sysDepart.setId(loginUser.getOrgId()); updateDepart4ShenBao(sysDepart); } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/controller/ProjectTypeController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/controller/ProjectTypeController.java index 9835294..e1ffb2c 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/controller/ProjectTypeController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/controller/ProjectTypeController.java @@ -1,17 +1,21 @@ package org.jeecg.modules.demo.projectType.controller; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.demo.annual.entity.Annual; +import org.jeecg.modules.demo.annual.service.IAnnualService; import org.jeecg.modules.demo.projectType.entity.ProjectType; import org.jeecg.modules.demo.projectType.service.IProjectTypeService; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +25,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; +import java.util.List; /** * @Description: 项目类型 @@ -36,6 +41,9 @@ public class ProjectTypeController extends JeecgController add(@RequestBody ProjectType projectType) { projectType.setStatus(projectType.getStatus_dictText()); + if (StrUtil.isNotBlank(projectType.getAnnualId())) { + Annual annual = iAnnualService.getById(projectType.getAnnualId()); + projectType.setAnnualName(annual.getAnnualName()); + } projectTypeService.save(projectType); return Result.OK("添加成功!"); } @@ -86,9 +98,13 @@ public class ProjectTypeController extends JeecgController edit(@RequestBody ProjectType projectType) { projectType.setStatus(projectType.getStatus_dictText()); - if(projectType.getStatus().equals("0")){ + if (projectType.getStatus().equals("0")) { projectType.setAnnualId(""); } + if (StrUtil.isNotBlank(projectType.getAnnualId())) { + Annual annual = iAnnualService.getById(projectType.getAnnualId()); + projectType.setAnnualName(annual.getAnnualName()); + } projectTypeService.updateById(projectType); return Result.OK("编辑成功!"); } @@ -148,6 +164,12 @@ public class ProjectTypeController extends JeecgController> getProjectTypeList() { + List list = projectTypeService.list(new LambdaQueryWrapper().eq(ProjectType::getStatus, "1")); + return Result.OK(list); + } + /** * 导出excel * diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/entity/ProjectType.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/entity/ProjectType.java index 21d5ef4..89a0337 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/entity/ProjectType.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/entity/ProjectType.java @@ -97,6 +97,8 @@ public class ProjectType implements Serializable { @ApiModelProperty(value = "年度id") private String annualId; + private String annualName; + @TableField(exist = false) private String status_dictText; } diff --git a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/data.ts b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/data.ts index e81f5f1..2604c23 100644 --- a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/data.ts +++ b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/data.ts @@ -6,7 +6,12 @@ export const projectBaseInfoSchemas: FormSchema[] = [ { label: '项目类别', field: 'projectTypeid', - component: 'Input', + // component: 'Input', + component: 'JDictSelectTag', + componentProps: { + dictCode: 'project_type,type_name,id', + // stringToNumber: true, + }, dynamicDisabled: true, // defaultValue: '科技攻关', defaultValue: '1846744340708184065', @@ -158,9 +163,9 @@ export const departSchemas: FormSchema[] = [ field: 'orgName', component: 'Input', label: '单位名称', - required: true, + // required: true, defaultValue: useUserStore().getUserInfo?.orgCode, - dynamicDisabled: true, + // dynamicDisabled: true, }, { field: 'category', @@ -198,16 +203,6 @@ export const departSchemas: FormSchema[] = [ // }, // width: 200, }, - // { - // field: 'date', - // label: '注册时间2', - // component: 'DatePicker', - // editComponentProps: { - // valueFormat: 'YYYY-MM-DD', - // format: 'YYYY-MM-DD', - // }, - // width: 200, - // }, { field: 'departNameAbbr', component: 'Input', diff --git a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.ts b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.ts index 41bc084..28a81a5 100644 --- a/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.ts +++ b/jeecgboot-vue3/src/views/projectApplication/kejigongguan/xiangmushu/JiBenXinXi.ts @@ -5,10 +5,10 @@ import { useUserStore } from '/@/store/modules/user'; export const projectBaseInfoSchemas: FormSchema[] = [ { label: '项目类别', - field: 'projectTypeid', + field: 'projectTypeName', component: 'Input', dynamicDisabled: true, - defaultValue: '科技攻关', + // defaultValue: '科技攻关', // defaultValue: '1846744340708184065', }, /*{ @@ -16,12 +16,19 @@ export const projectBaseInfoSchemas: FormSchema[] = [ field: 'projectTypeid', component: 'Input', },*/ - { + /*{ field: 'annualId', component: 'Input', label: '计划年度', dynamicDisabled: true, defaultValue: '2025', + },*/ + { + field: 'annualName', + component: 'Input', + label: '年度', + dynamicDisabled: true, + // defaultValue: '2025', }, { field: 'batchNo', @@ -258,17 +265,35 @@ export const projectBaseInfoSchemas: FormSchema[] = [ { label: '申请专利数', field: 'applyPatentNumber', - component: 'Input', + component: 'InputNumber', + dynamicRules: ({model,schema}) => { + return [ + { required: false}, + { pattern: /^(([1-9][0-9]*))$/, message: '请输入正确的人数!'}, + ]; + }, }, { label: '发明专利数', field: 'invevtionPatentNumber', - component: 'Input', + component: 'InputNumber', + dynamicRules: ({model,schema}) => { + return [ + { required: false}, + { pattern: /^(([1-9][0-9]*))$/, message: '请输入正确的人数!'}, + ]; + }, }, { label: '授权专利数', field: 'creditPatentNumber', - component: 'Input', + component: 'InputNumber', + dynamicRules: ({model,schema}) => { + return [ + { required: false}, + { pattern: /^(([1-9][0-9]*))$/, message: '请输入正确的人数!'}, + ]; + }, }, ]; @@ -379,9 +404,9 @@ export const departSchemas: FormSchema[] = [ field: 'orgName', component: 'Input', label: '单位名称', - required: true, + // required: true, defaultValue: useUserStore().getUserInfo?.orgCode, - dynamicDisabled: true, + // dynamicDisabled: true, }, { field: 'category', diff --git a/jeecgboot-vue3/src/views/projectApplication/project/Project.api.ts b/jeecgboot-vue3/src/views/projectApplication/project/Project.api.ts index 09be436..89f01fe 100644 --- a/jeecgboot-vue3/src/views/projectApplication/project/Project.api.ts +++ b/jeecgboot-vue3/src/views/projectApplication/project/Project.api.ts @@ -5,6 +5,7 @@ const {createConfirm} = useMessage(); enum Api { list = '/project/project/list', + projectType = '/projectType/getProjectTypeList', save = '/project/project/add', edit = '/project/project/edit', deleteOne = '/project/project/delete', @@ -29,6 +30,10 @@ export const getImportUrl = Api.importExcel; export const list = (params) => defHttp.get({url: Api.list, params}); + +export const getProjectTypeList = (params) => + defHttp.get({url: Api.projectType, params}); + /** * 删除单个 */ diff --git a/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue b/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue index 125428a..6964d17 100644 --- a/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue +++ b/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue @@ -15,6 +15,9 @@ 科技攻关 +