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 013b5bd..9835294 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 @@ -6,6 +6,7 @@ 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; @@ -68,6 +69,7 @@ public class ProjectTypeController extends JeecgController add(@RequestBody ProjectType projectType) { + projectType.setStatus(projectType.getStatus_dictText()); projectTypeService.save(projectType); return Result.OK("添加成功!"); } @@ -83,6 +85,10 @@ public class ProjectTypeController extends JeecgController edit(@RequestBody ProjectType projectType) { + projectType.setStatus(projectType.getStatus_dictText()); + if(projectType.getStatus().equals("0")){ + projectType.setAnnualId(""); + } projectTypeService.updateById(projectType); return Result.OK("编辑成功!"); } 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 6e07489..21d5ef4 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 @@ -1,6 +1,7 @@ package org.jeecg.modules.demo.projectType.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; @@ -87,5 +88,15 @@ public class ProjectType implements Serializable { @Excel(name = "状态", width = 15, dicCode = "projectType_status") @ApiModelProperty(value = "状态") @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; } diff --git a/jeecgboot-vue3/src/views/annual/Annual.data.ts b/jeecgboot-vue3/src/views/annual/Annual.data.ts index 851d95e..2c36f46 100644 --- a/jeecgboot-vue3/src/views/annual/Annual.data.ts +++ b/jeecgboot-vue3/src/views/annual/Annual.data.ts @@ -24,7 +24,7 @@ export const formSchema: FormSchema[] = [ { label: '年度名称', field: 'annualName', - component: 'Input', + component: 'InputNumber', }, // TODO 主键隐藏字段,目前写死为ID { diff --git a/jeecgboot-vue3/src/views/projectType/ProjectType.data.ts b/jeecgboot-vue3/src/views/projectType/ProjectType.data.ts index b9ded74..3ddcec6 100644 --- a/jeecgboot-vue3/src/views/projectType/ProjectType.data.ts +++ b/jeecgboot-vue3/src/views/projectType/ProjectType.data.ts @@ -11,15 +11,20 @@ export const columns: BasicColumn[] = [ dataIndex: 'typeName' }, { - title: '描述', + title: '年度', align:"center", - dataIndex: 'mark' + dataIndex: 'annualId_dictText' }, { title: '状态', align:"center", dataIndex: 'status_dictText' }, + { + title: '描述', + align:"center", + dataIndex: 'mark' + }, ]; //查询数据 export const searchFormSchema: FormSchema[] = [ @@ -29,15 +34,6 @@ export const searchFormSchema: FormSchema[] = [ component: 'Input', //colProps: {span: 6}, }, - // { - // label: "状态", - // field: 'status', - // component: 'JSelectMultiple', - // componentProps:{ - // dictCode:"projectType_status" - // }, - // //colProps: {span: 6}, - // }, { label: '状态', field: 'status', @@ -55,20 +51,47 @@ export const formSchema: FormSchema[] = [ label: '类型名称', field: 'typeName', 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: '描述', field: 'mark', component: 'Input', }, - // { - // label: '状态', - // field: 'status', - // component: 'JDictSelectTag', - // componentProps:{ - // dictCode:"projectType_status" - // }, - // }, // TODO 主键隐藏字段,目前写死为ID { label: '', diff --git a/jeecgboot-vue3/src/views/projectType/ProjectTypeList.vue b/jeecgboot-vue3/src/views/projectType/ProjectTypeList.vue index 602a95f..06635bb 100644 --- a/jeecgboot-vue3/src/views/projectType/ProjectTypeList.vue +++ b/jeecgboot-vue3/src/views/projectType/ProjectTypeList.vue @@ -188,7 +188,7 @@ // auth: 'projecttype:project_type:delete' } ]; - if (record.status == 0) { + /*if (record.status == 0) { actions.unshift({ label: '启动', onClick: handleStart.bind(null,record), @@ -199,7 +199,7 @@ label: '暂停', onClick: handleStop.bind(null,record), }); - } + }*/ return actions; } /**