项目类型管理添加 10.14

master
zhc077 1 month ago
parent 25666a0778
commit a9d6fbbeda
  1. 6
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/controller/ProjectTypeController.java
  2. 13
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/projectType/entity/ProjectType.java
  3. 2
      jeecgboot-vue3/src/views/annual/Annual.data.ts
  4. 61
      jeecgboot-vue3/src/views/projectType/ProjectType.data.ts
  5. 4
      jeecgboot-vue3/src/views/projectType/ProjectTypeList.vue

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
@ -68,6 +69,7 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject
// @RequiresPermissions("projecttype:project_type:add") // @RequiresPermissions("projecttype:project_type:add")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody ProjectType projectType) { public Result<String> add(@RequestBody ProjectType projectType) {
projectType.setStatus(projectType.getStatus_dictText());
projectTypeService.save(projectType); projectTypeService.save(projectType);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -83,6 +85,10 @@ public class ProjectTypeController extends JeecgController<ProjectType, IProject
// @RequiresPermissions("projecttype:project_type:edit") // @RequiresPermissions("projecttype:project_type:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ProjectType projectType) { public Result<String> edit(@RequestBody ProjectType projectType) {
projectType.setStatus(projectType.getStatus_dictText());
if(projectType.getStatus().equals("0")){
projectType.setAnnualId("");
}
projectTypeService.updateById(projectType); projectTypeService.updateById(projectType);
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
} }

@ -1,6 +1,7 @@
package org.jeecg.modules.demo.projectType.entity; package org.jeecg.modules.demo.projectType.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@ -87,5 +88,15 @@ public class ProjectType implements Serializable {
@Excel(name = "状态", width = 15, dicCode = "projectType_status") @Excel(name = "状态", width = 15, dicCode = "projectType_status")
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
@Dict(dicCode = "projectType_status") @Dict(dicCode = "projectType_status")
private Integer status; private String status;
/**年度id*/
@Excel(name = "年度id", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id")
@Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id")
@ApiModelProperty(value = "年度id")
private String annualId;
@TableField(exist = false)
private String status_dictText;
} }

@ -24,7 +24,7 @@ export const formSchema: FormSchema[] = [
{ {
label: '年度名称', label: '年度名称',
field: 'annualName', field: 'annualName',
component: 'Input', component: 'InputNumber',
}, },
// TODO ID // TODO ID
{ {

@ -11,15 +11,20 @@ export const columns: BasicColumn[] = [
dataIndex: 'typeName' dataIndex: 'typeName'
}, },
{ {
title: '描述', title: '年度',
align:"center", align:"center",
dataIndex: 'mark' dataIndex: 'annualId_dictText'
}, },
{ {
title: '状态', title: '状态',
align:"center", align:"center",
dataIndex: 'status_dictText' dataIndex: 'status_dictText'
}, },
{
title: '描述',
align:"center",
dataIndex: 'mark'
},
]; ];
// //
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
@ -29,15 +34,6 @@ export const searchFormSchema: FormSchema[] = [
component: 'Input', component: 'Input',
//colProps: {span: 6}, //colProps: {span: 6},
}, },
// {
// label: "",
// field: 'status',
// component: 'JSelectMultiple',
// componentProps:{
// dictCode:"projectType_status"
// },
// //colProps: {span: 6},
// },
{ {
label: '状态', label: '状态',
field: 'status', field: 'status',
@ -55,20 +51,47 @@ export const formSchema: FormSchema[] = [
label: '类型名称', label: '类型名称',
field: 'typeName', field: 'typeName',
component: 'Input', component: 'Input',
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请输入类型名称!'},
];
},
},
{
label: '状态',
field: 'status_dictText',
component: 'JDictSelectTag',
// defaultValue: '',
componentProps: {
dictCode: 'projectType_status',
},
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请选择项目状态!'},
];
},
},
{
label: '年度',
field: 'annualId',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'annual,annual_name,id',
},
ifShow: ({ values }) => {
return values.status_dictText == 1;
},
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请选择年度!'},
];
},
}, },
{ {
label: '描述', label: '描述',
field: 'mark', field: 'mark',
component: 'Input', component: 'Input',
}, },
// {
// label: '',
// field: 'status',
// component: 'JDictSelectTag',
// componentProps:{
// dictCode:"projectType_status"
// },
// },
// TODO ID // TODO ID
{ {
label: '', label: '',

@ -188,7 +188,7 @@
// auth: 'projecttype:project_type:delete' // auth: 'projecttype:project_type:delete'
} }
]; ];
if (record.status == 0) { /*if (record.status == 0) {
actions.unshift({ actions.unshift({
label: '启动', label: '启动',
onClick: handleStart.bind(null,record), onClick: handleStart.bind(null,record),
@ -199,7 +199,7 @@
label: '暂停', label: '暂停',
onClick: handleStop.bind(null,record), onClick: handleStop.bind(null,record),
}); });
} }*/
return actions; return actions;
} }
/** /**

Loading…
Cancel
Save