Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
c2f9bad3ad
@ -60,6 +60,12 @@ public enum DbTypeEnum {
|
|||||||
* 人大金仓
|
* 人大金仓
|
||||||
*/
|
*/
|
||||||
KINGBASE_ES(DbType.KINGBASE_ES, "KingbaseES", "POSITION('#{value}' IN #{column}) <> 0"),
|
KINGBASE_ES(DbType.KINGBASE_ES, "KingbaseES", "POSITION('#{value}' IN #{column}) <> 0"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OceanBase
|
||||||
|
*/
|
||||||
|
OCEAN_BASE(DbType.OCEAN_BASE, "OceanBase", "FIND_IN_SET('#{value}', #{column}) <> 0")
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
public static final Map<String, DbTypeEnum> MAP_BY_NAME = Arrays.stream(values())
|
public static final Map<String, DbTypeEnum> MAP_BY_NAME = Arrays.stream(values())
|
||||||
|
|||||||
@ -100,6 +100,10 @@ public class BpmModelMetaInfoVO {
|
|||||||
@Schema(description = "任务后置通知设置", example = "{}")
|
@Schema(description = "任务后置通知设置", example = "{}")
|
||||||
private HttpRequestSetting taskAfterTriggerSetting;
|
private HttpRequestSetting taskAfterTriggerSetting;
|
||||||
|
|
||||||
|
@Schema(description = "自定义打印模板设置", example = "{}")
|
||||||
|
@Valid
|
||||||
|
private PrintTemplateSetting printTemplateSetting;
|
||||||
|
|
||||||
@Schema(description = "流程 ID 规则")
|
@Schema(description = "流程 ID 规则")
|
||||||
@Data
|
@Data
|
||||||
@Valid
|
@Valid
|
||||||
@ -180,4 +184,17 @@ public class BpmModelMetaInfoVO {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(description = "自定义打印模板设置")
|
||||||
|
@Data
|
||||||
|
public static class PrintTemplateSetting {
|
||||||
|
|
||||||
|
@Schema(description = "是否自定义打印模板", example = "false")
|
||||||
|
@NotNull(message = "是否自定义打印模板不能为空")
|
||||||
|
private Boolean enable;
|
||||||
|
|
||||||
|
@Schema(description = "打印模板", example = "<p></p>")
|
||||||
|
private String template;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||||
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
|
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||||
@ -26,6 +27,7 @@ import jakarta.validation.Valid;
|
|||||||
import org.flowable.engine.history.HistoricProcessInstance;
|
import org.flowable.engine.history.HistoricProcessInstance;
|
||||||
import org.flowable.engine.repository.ProcessDefinition;
|
import org.flowable.engine.repository.ProcessDefinition;
|
||||||
import org.flowable.task.api.Task;
|
import org.flowable.task.api.Task;
|
||||||
|
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -34,9 +36,11 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.PROCESS_INSTANCE_NOT_EXISTS;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 流程实例") // 流程实例,通过流程定义创建的一次“申请”
|
@Tag(name = "管理后台 - 流程实例") // 流程实例,通过流程定义创建的一次“申请”
|
||||||
@RestController
|
@RestController
|
||||||
@ -192,8 +196,30 @@ public class BpmProcessInstanceController {
|
|||||||
@GetMapping("/get-bpmn-model-view")
|
@GetMapping("/get-bpmn-model-view")
|
||||||
@Operation(summary = "获取流程实例的 BPMN 模型视图", description = "在【流程详细】界面中,进行调用")
|
@Operation(summary = "获取流程实例的 BPMN 模型视图", description = "在【流程详细】界面中,进行调用")
|
||||||
@Parameter(name = "id", description = "流程实例的编号", required = true)
|
@Parameter(name = "id", description = "流程实例的编号", required = true)
|
||||||
public CommonResult<BpmProcessInstanceBpmnModelViewRespVO> getProcessInstanceBpmnModelView(@RequestParam(value = "id") String id) {
|
public CommonResult<BpmProcessInstanceBpmnModelViewRespVO> getProcessInstanceBpmnModelView(
|
||||||
|
@RequestParam(value = "id") String id) {
|
||||||
return success(processInstanceService.getProcessInstanceBpmnModelView(id));
|
return success(processInstanceService.getProcessInstanceBpmnModelView(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-print-data")
|
||||||
|
@Operation(summary = "获得流程实例的打印数据")
|
||||||
|
@Parameter(name = "id", description = "流程实例的编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
|
||||||
|
public CommonResult<BpmProcessPrintDataRespVO> getProcessInstancePrintData(
|
||||||
|
@RequestParam("processInstanceId") String processInstanceId) {
|
||||||
|
HistoricProcessInstance historicProcessInstance = processInstanceService.getHistoricProcessInstance(processInstanceId);
|
||||||
|
if (historicProcessInstance == null) {
|
||||||
|
throw exception(PROCESS_INSTANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
AdminUserRespDTO startUser = adminUserApi.getUser(Long.valueOf(historicProcessInstance.getStartUserId()));
|
||||||
|
DeptRespDTO dept = deptApi.getDept(startUser.getDeptId());
|
||||||
|
List<HistoricTaskInstance> tasks = taskService.getFinishedTaskListByProcessInstanceIdWithoutCancel(processInstanceId);
|
||||||
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(
|
||||||
|
convertSet(tasks, item -> Long.valueOf(item.getAssignee())));
|
||||||
|
return success(BpmProcessInstanceConvert.INSTANCE.buildProcessInstancePrintData(historicProcessInstance,
|
||||||
|
processDefinitionService.getProcessDefinitionInfo(historicProcessInstance.getProcessDefinitionId()),
|
||||||
|
tasks, userMap,
|
||||||
|
new UserSimpleBaseVO().setNickname(startUser.getNickname()).setDeptName(dept.getName())));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 流程实例的打印数据 Response VO")
|
||||||
|
@Data
|
||||||
|
public class BpmProcessPrintDataRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "流程实例数据")
|
||||||
|
private BpmProcessInstanceRespVO processInstance;
|
||||||
|
|
||||||
|
@Schema(description = "是否开启自定义打印模板", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||||
|
private Boolean printTemplateEnable;
|
||||||
|
|
||||||
|
@Schema(description = "自定义打印模板 HTML")
|
||||||
|
private String printTemplateHtml;
|
||||||
|
|
||||||
|
@Schema(description = "审批任务列表")
|
||||||
|
private List<Task> tasks;
|
||||||
|
|
||||||
|
@Schema(description = "流程任务")
|
||||||
|
@Data
|
||||||
|
public static class Task {
|
||||||
|
|
||||||
|
@Schema(description = "流程任务的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "签名 URL", example = "https://www.iocoder.cn/sign.png")
|
||||||
|
private String signPicUrl;
|
||||||
|
|
||||||
|
@Schema(description = "任务描述", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String description; // 该字段由后端拼接
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,23 +1,29 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.convert.task;
|
package cn.iocoder.yudao.module.bpm.convert.task;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceBpmnModelViewRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceBpmnModelViewRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceRespVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessPrintDataRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||||
import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
|
import cn.iocoder.yudao.module.bpm.convert.definition.BpmProcessDefinitionConvert;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO;
|
||||||
import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent;
|
import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent;
|
||||||
|
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
|
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
|
||||||
@ -35,10 +41,7 @@ import org.mapstruct.Mapping;
|
|||||||
import org.mapstruct.MappingTarget;
|
import org.mapstruct.MappingTarget;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
@ -292,4 +295,47 @@ public interface BpmProcessInstanceConvert {
|
|||||||
.setActivityNodes(activityNodes);
|
.setActivityNodes(activityNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default BpmProcessPrintDataRespVO buildProcessInstancePrintData(HistoricProcessInstance historicProcessInstance,
|
||||||
|
BpmProcessDefinitionInfoDO processDefinitionInfo,
|
||||||
|
List<HistoricTaskInstance> tasks,
|
||||||
|
Map<Long, AdminUserRespDTO> userMap,
|
||||||
|
UserSimpleBaseVO startUser) {
|
||||||
|
BpmModelMetaInfoVO.PrintTemplateSetting printTemplateSetting = processDefinitionInfo.getPrintTemplateSetting();
|
||||||
|
BpmProcessPrintDataRespVO printData = new BpmProcessPrintDataRespVO();
|
||||||
|
// 打印模板是否开启
|
||||||
|
printData.setPrintTemplateEnable(printTemplateSetting != null && Boolean.TRUE.equals(printTemplateSetting.getEnable()));
|
||||||
|
// 流程相关数据
|
||||||
|
BpmProcessInstanceRespVO processInstance = new BpmProcessInstanceRespVO()
|
||||||
|
.setId(historicProcessInstance.getId()).setName(historicProcessInstance.getName())
|
||||||
|
.setBusinessKey(historicProcessInstance.getBusinessKey())
|
||||||
|
.setStartTime(DateUtils.of(historicProcessInstance.getStartTime()))
|
||||||
|
.setEndTime(DateUtils.of(historicProcessInstance.getEndTime()))
|
||||||
|
.setStartUser(startUser).setStatus(FlowableUtils.getProcessInstanceStatus(historicProcessInstance))
|
||||||
|
.setFormVariables(historicProcessInstance.getProcessVariables())
|
||||||
|
.setProcessDefinition(BeanUtils.toBean(processDefinitionInfo, BpmProcessDefinitionRespVO.class));
|
||||||
|
printData.setProcessInstance(processInstance);
|
||||||
|
// 审批历史
|
||||||
|
List<BpmProcessPrintDataRespVO.Task> approveTasks = new ArrayList<>(tasks.size());
|
||||||
|
tasks.forEach(item -> {
|
||||||
|
Map<String, Object> taskLocalVariables = item.getTaskLocalVariables();
|
||||||
|
BpmProcessPrintDataRespVO.Task approveTask = new BpmProcessPrintDataRespVO.Task();
|
||||||
|
approveTask.setName(item.getName());
|
||||||
|
approveTask.setId(item.getId());
|
||||||
|
approveTask.setSignPicUrl((String) taskLocalVariables.get(BpmnVariableConstants.TASK_SIGN_PIC_URL));
|
||||||
|
approveTask.setDescription(StrUtil.format("{} / {} / {} / {} / {}",
|
||||||
|
userMap.get(Long.valueOf(item.getAssignee())).getNickname(),
|
||||||
|
item.getName(),
|
||||||
|
DateUtil.formatDateTime(item.getEndTime()),
|
||||||
|
BpmTaskStatusEnum.valueOf((Integer) taskLocalVariables.get(BpmnVariableConstants.TASK_VARIABLE_STATUS)).getName(),
|
||||||
|
taskLocalVariables.get(BpmnVariableConstants.TASK_VARIABLE_REASON)));
|
||||||
|
approveTasks.add(approveTask);
|
||||||
|
});
|
||||||
|
printData.setTasks(approveTasks);
|
||||||
|
// 自定义模板
|
||||||
|
if (printData.getPrintTemplateEnable() && printTemplateSetting != null) {
|
||||||
|
printData.setPrintTemplateHtml(printTemplateSetting.getTemplate());
|
||||||
|
}
|
||||||
|
return printData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,4 +224,10 @@ public class BpmProcessDefinitionInfoDO extends BaseDO {
|
|||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private BpmModelMetaInfoVO.HttpRequestSetting taskAfterTriggerSetting;
|
private BpmModelMetaInfoVO.HttpRequestSetting taskAfterTriggerSetting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义打印模板设置
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
|
private BpmModelMetaInfoVO.PrintTemplateSetting printTemplateSetting;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.enums.task;
|
package cn.iocoder.yudao.module.bpm.enums.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -47,4 +48,8 @@ public enum BpmProcessInstanceStatusEnum implements ArrayValuable<Integer> {
|
|||||||
APPROVE.getStatus(), REJECT.getStatus(), CANCEL.getStatus());
|
APPROVE.getStatus(), REJECT.getStatus(), CANCEL.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BpmProcessInstanceStatusEnum valueOf(Integer status) {
|
||||||
|
return ArrayUtil.firstMatch(item -> item.getStatus().equals(status), values());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.enums.task;
|
package cn.iocoder.yudao.module.bpm.enums.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -68,4 +69,8 @@ public enum BpmTaskStatusEnum {
|
|||||||
return ObjUtil.equal(status, CANCEL.getStatus());
|
return ObjUtil.equal(status, CANCEL.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BpmTaskStatusEnum valueOf(Integer status) {
|
||||||
|
return ArrayUtil.firstMatch(item -> item.getStatus().equals(status), values());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.task;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
@ -13,6 +14,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.BpmModelMetaInfoVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple.BpmSimpleModelNodeVO;
|
||||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||||
@ -974,7 +976,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.3 如果子流程拒绝, 设置其父流程也为拒绝状态且结束父流程
|
// 1.3 如果子流程拒绝,设置其父流程也为拒绝状态,且结束父流程
|
||||||
|
// 相关问题链接:https://t.zsxq.com/kZhyb
|
||||||
if (Objects.equals(status, BpmProcessInstanceStatusEnum.REJECT.getStatus())
|
if (Objects.equals(status, BpmProcessInstanceStatusEnum.REJECT.getStatus())
|
||||||
&& StrUtil.isNotBlank(instance.getSuperExecutionId())) {
|
&& StrUtil.isNotBlank(instance.getSuperExecutionId())) {
|
||||||
// 1.3.1 获取父流程实例 并标记为不通过
|
// 1.3.1 获取父流程实例 并标记为不通过
|
||||||
@ -984,6 +987,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||||||
|
|
||||||
// 1.3.2 结束父流程。需要在子流程结束事务提交后执行
|
// 1.3.2 结束父流程。需要在子流程结束事务提交后执行
|
||||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCompletion(int transactionStatus) {
|
public void afterCompletion(int transactionStatus) {
|
||||||
// 回滚情况,直接返回
|
// 回滚情况,直接返回
|
||||||
@ -1043,7 +1047,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||||||
runtimeService.setProcessInstanceName(instance.getProcessInstanceId(), name);
|
runtimeService.setProcessInstanceName(instance.getProcessInstanceId(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流程前置通知:需要在流程启动后(事务提交后)。variables 已设置。或者放在 PROCESS_STARTED 事件中处理,先放这里。
|
// 流程前置通知:需要在流程启动后(事务提交后),保证 variables 已设置
|
||||||
|
// 相关问题链接:https://t.zsxq.com/DF7Kq
|
||||||
if (ObjUtil.isNull(processDefinitionInfo.getProcessBeforeTriggerSetting())) {
|
if (ObjUtil.isNull(processDefinitionInfo.getProcessBeforeTriggerSetting())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,6 +176,14 @@ public interface BpmTaskService {
|
|||||||
*/
|
*/
|
||||||
List<HistoricActivityInstance> getHistoricActivityListByExecutionId(String executionId);
|
List<HistoricActivityInstance> getHistoricActivityListByExecutionId(String executionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定流程实例的已完成的流程任务列表,不包含取消状态
|
||||||
|
*
|
||||||
|
* @param processInstanceId 流程实例的编号
|
||||||
|
* @return 流程任务列表
|
||||||
|
*/
|
||||||
|
List<HistoricTaskInstance> getFinishedTaskListByProcessInstanceIdWithoutCancel(String processInstanceId);
|
||||||
|
|
||||||
// ========== Update 写入相关方法 ==========
|
// ========== Update 写入相关方法 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -492,6 +492,17 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
return historyService.createHistoricActivityInstanceQuery().executionId(executionId).list();
|
return historyService.createHistoricActivityInstanceQuery().executionId(executionId).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HistoricTaskInstance> getFinishedTaskListByProcessInstanceIdWithoutCancel(String processInstanceId) {
|
||||||
|
return historyService.createHistoricTaskInstanceQuery()
|
||||||
|
.finished()
|
||||||
|
.includeTaskLocalVariables()
|
||||||
|
.processInstanceId(processInstanceId)
|
||||||
|
.taskVariableValueNotEquals(BpmnVariableConstants.TASK_VARIABLE_STATUS,
|
||||||
|
BpmTaskStatusEnum.CANCEL.getStatus())
|
||||||
|
.orderByHistoricTaskInstanceStartTime().asc().list();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断指定用户,是否是当前任务的审批人
|
* 判断指定用户,是否是当前任务的审批人
|
||||||
*
|
*
|
||||||
|
|||||||
@ -21,9 +21,8 @@ public enum CodegenFrontTypeEnum {
|
|||||||
VUE3_VBEN5_ANTD_SCHEMA(40), // Vue3 VBEN5 + ANTD + schema 模版
|
VUE3_VBEN5_ANTD_SCHEMA(40), // Vue3 VBEN5 + ANTD + schema 模版
|
||||||
VUE3_VBEN5_ANTD_GENERAL(41), // Vue3 VBEN5 + ANTD 标准模版
|
VUE3_VBEN5_ANTD_GENERAL(41), // Vue3 VBEN5 + ANTD 标准模版
|
||||||
|
|
||||||
// TODO @puhui999::50、51 会好点;
|
VUE3_VBEN5_EP_SCHEMA(50), // Vue3 VBEN5 + EP + schema 模版
|
||||||
VUE3_VBEN5_EP_SCHEMA(42), // Vue3 VBEN5 + EP + schema 模版
|
VUE3_VBEN5_EP_GENERAL(51), // Vue3 VBEN5 + EP 标准模版
|
||||||
VUE3_VBEN5_EP_GENERAL(43), // Vue3 VBEN5 + EP 标准模版
|
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -343,7 +343,7 @@ public class CodegenEngine {
|
|||||||
filePath = formatFilePath(filePath, bindingMap);
|
filePath = formatFilePath(filePath, bindingMap);
|
||||||
String content = templateEngine.getTemplate(vmPath).render(bindingMap);
|
String content = templateEngine.getTemplate(vmPath).render(bindingMap);
|
||||||
// 格式化代码
|
// 格式化代码
|
||||||
content = prettyCode(content);
|
content = prettyCode(content, vmPath);
|
||||||
result.put(filePath, content);
|
result.put(filePath, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,11 +383,14 @@ public class CodegenEngine {
|
|||||||
* 如果不处理,Vue 的 Pretty 格式校验可能会报错
|
* 如果不处理,Vue 的 Pretty 格式校验可能会报错
|
||||||
*
|
*
|
||||||
* @param content 格式化前的代码
|
* @param content 格式化前的代码
|
||||||
|
* @param vmPath 模板路径
|
||||||
* @return 格式化后的代码
|
* @return 格式化后的代码
|
||||||
*/
|
*/
|
||||||
private String prettyCode(String content) {
|
private String prettyCode(String content, String vmPath) {
|
||||||
// Vue 界面:去除字段后面多余的 , 逗号,解决前端的 Pretty 代码格式检查的报错
|
// Vue 界面:去除字段后面多余的 , 逗号,解决前端的 Pretty 代码格式检查的报错(需要排除 vben5)
|
||||||
content = content.replaceAll(",\n}", "\n}").replaceAll(",\n }", "\n }");
|
if (!StrUtil.contains(vmPath, "vben5")) {
|
||||||
|
content = content.replaceAll(",\n}", "\n}").replaceAll(",\n }", "\n }");
|
||||||
|
}
|
||||||
// Vue 界面:去除多的 dateFormatter,只有一个的情况下,说明没使用到
|
// Vue 界面:去除多的 dateFormatter,只有一个的情况下,说明没使用到
|
||||||
if (StrUtil.count(content, "dateFormatter") == 1) {
|
if (StrUtil.count(content, "dateFormatter") == 1) {
|
||||||
content = StrUtils.removeLineContains(content, "dateFormatter");
|
content = StrUtils.removeLineContains(content, "dateFormatter");
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) {
|
|||||||
|
|
||||||
/** 导出${table.classComment} */
|
/** 导出${table.classComment} */
|
||||||
export function export${simpleClassName}(params: any) {
|
export function export${simpleClassName}(params: any) {
|
||||||
return requestClient.download('${baseURL}/export-excel', params);
|
return requestClient.download('${baseURL}/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
|
||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
|
import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
|
||||||
#if($table.templateType == 2)## 树表需要导入这些
|
#if($table.templateType == 2)## 树表需要导入这些
|
||||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import { handleTree } from '@vben/utils'
|
import { handleTree } from '@vben/utils'
|
||||||
@ -20,7 +23,6 @@ import { handleTree } from '@vben/utils'
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|
||||||
@ -70,7 +72,7 @@ const getTitle = computed(() => {
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
function resetForm() {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
#if ($column.createOperation || $column.updateOperation)
|
||||||
@ -88,7 +90,7 @@ const resetForm = () => {
|
|||||||
## 特殊:树表专属逻辑
|
## 特殊:树表专属逻辑
|
||||||
#if ( $table.templateType == 2 )
|
#if ( $table.templateType == 2 )
|
||||||
/** 获得${table.classComment}树 */
|
/** 获得${table.classComment}树 */
|
||||||
const get${simpleClassName}Tree = async () => {
|
async function get${simpleClassName}Tree() {
|
||||||
${classNameVar}Tree.value = []
|
${classNameVar}Tree.value = []
|
||||||
const data = await get${simpleClassName}List({});
|
const data = await get${simpleClassName}List({});
|
||||||
data.unshift({
|
data.unshift({
|
||||||
@ -147,7 +149,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
emit('success');
|
emit('success');
|
||||||
message.success({
|
message.success({
|
||||||
content: $t('ui.actionMessage.operationSuccess'),
|
content: $t('ui.actionMessage.operationSuccess'),
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
|
||||||
|
import { ref, h, reactive, onMounted, nextTick } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
import { useTableToolbar, VbenVxeTableToolbar } from '@vben/plugins/vxe-table';
|
||||||
|
import { cloneDeep, downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
|
||||||
import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Input } from 'ant-design-vue';
|
import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Input } from 'ant-design-vue';
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
import ${simpleClassName}Form from './modules/form.vue';
|
import ${simpleClassName}Form from './modules/form.vue';
|
||||||
import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
|
import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
|
||||||
import { ContentWrap } from '#/components/content-wrap';
|
import { ContentWrap } from '#/components/content-wrap';
|
||||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
||||||
import { TableToolbar } from '#/components/table-toolbar';
|
|
||||||
import { useTableToolbar } from '#/hooks';
|
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
||||||
@ -23,7 +23,6 @@ import { useTableToolbar } from '#/hooks';
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { ref, h, reactive,onMounted,nextTick } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
#if (${table.templateType} == 2)## 树表接口
|
#if (${table.templateType} == 2)## 树表接口
|
||||||
import { handleTree,isEmpty } from '@vben/utils'
|
import { handleTree,isEmpty } from '@vben/utils'
|
||||||
@ -77,7 +76,7 @@ const queryFormRef = ref() // 搜索的表单
|
|||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
async function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const params = cloneDeep(queryParams) as any;
|
const params = cloneDeep(queryParams) as any;
|
||||||
@ -104,7 +103,7 @@ const getList = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
function handleQuery() {
|
||||||
#if ( $table.templateType != 2 )
|
#if ( $table.templateType != 2 )
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
#end
|
#end
|
||||||
@ -112,7 +111,7 @@ const handleQuery = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
function resetQuery() {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
@ -144,14 +143,10 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
|||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}(row.id as number);
|
await delete${simpleClassName}(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
await getList();
|
await getList();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@ -164,12 +159,11 @@ async function handleDeleteBatch() {
|
|||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting'),
|
content: $t('ui.actionMessage.deleting'),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}List(checkedIds.value);
|
await delete${simpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
message.success( $t('ui.actionMessage.deleteSuccess') );
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
await getList();
|
await getList();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@ -187,7 +181,7 @@ function handleRowCheckboxChange({
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function handleExport() {
|
||||||
try {
|
try {
|
||||||
exportLoading.value = true;
|
exportLoading.value = true;
|
||||||
const data = await export${simpleClassName}(queryParams);
|
const data = await export${simpleClassName}(queryParams);
|
||||||
@ -200,7 +194,7 @@ try {
|
|||||||
#if (${table.templateType} == 2)
|
#if (${table.templateType} == 2)
|
||||||
/** 切换树形展开/收缩状态 */
|
/** 切换树形展开/收缩状态 */
|
||||||
const isExpanded = ref(true);
|
const isExpanded = ref(true);
|
||||||
function toggleExpand() {
|
function handleExpand() {
|
||||||
isExpanded.value = !isExpanded.value;
|
isExpanded.value = !isExpanded.value;
|
||||||
tableRef.value?.setAllTreeExpand(isExpanded.value);
|
tableRef.value?.setAllTreeExpand(isExpanded.value);
|
||||||
}
|
}
|
||||||
@ -303,12 +297,12 @@ onMounted(() => {
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap title="${table.classComment}">
|
<ContentWrap title="${table.classComment}">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<TableToolbar
|
<VbenVxeTableToolbar
|
||||||
ref="tableToolbarRef"
|
ref="tableToolbarRef"
|
||||||
v-model:hidden-search="hiddenSearchBar"
|
v-model:hidden-search="hiddenSearchBar"
|
||||||
>
|
>
|
||||||
#if (${table.templateType} == 2)
|
#if (${table.templateType} == 2)
|
||||||
<Button @click="toggleExpand" class="mr-2">
|
<Button @click="handleExpand" class="mr-2">
|
||||||
{{ isExpanded ? '收缩' : '展开' }}
|
{{ isExpanded ? '收缩' : '展开' }}
|
||||||
</Button>
|
</Button>
|
||||||
#end
|
#end
|
||||||
@ -326,7 +320,7 @@ onMounted(() => {
|
|||||||
type="primary"
|
type="primary"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
:loading="exportLoading"
|
:loading="exportLoading"
|
||||||
@click="onExport"
|
@click="handleExport"
|
||||||
v-access:code="['${permissionPrefix}:export']"
|
v-access:code="['${permissionPrefix}:export']"
|
||||||
>
|
>
|
||||||
{{ $t('ui.actionTitle.export') }}
|
{{ $t('ui.actionTitle.export') }}
|
||||||
|
|||||||
@ -3,29 +3,97 @@
|
|||||||
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { computed, ref } from 'vue';
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
|
||||||
import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
|
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { $t } from '#/locales';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
import { cloneDeep, formatDateTime } from '@vben/utils';
|
||||||
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
|
import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
|
||||||
|
|
||||||
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
const getTitle = computed(() => {
|
|
||||||
return formData.value?.id
|
|
||||||
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
|
||||||
: $t('ui.actionTitle.create', ['${subTable.classComment}']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const formRef = ref();
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<Partial<${simpleClassName}Api.${subSimpleClassName}>>({
|
const getTitle = computed(() => {
|
||||||
|
return formData.value?.id
|
||||||
|
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
||||||
|
: $t('ui.actionTitle.create', ['${subTable.classComment}']);
|
||||||
|
});
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const formData = ref<Partial<${simpleClassName}Api.${subSimpleClassName}>>({
|
||||||
|
#foreach ($column in $subColumns)
|
||||||
|
#if ($column.createOperation || $column.updateOperation)
|
||||||
|
#if ($column.htmlType == "checkbox")
|
||||||
|
$column.javaField: [],
|
||||||
|
#else
|
||||||
|
$column.javaField: undefined,
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
});
|
||||||
|
const rules: Record<string, Rule[]> = {
|
||||||
|
#foreach ($column in $subColumns)
|
||||||
|
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
$column.javaField: [{ required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == 'select')'change'#else'blur'#end }],
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
};
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
async onConfirm() {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
|
||||||
|
modalApi.lock();
|
||||||
|
// 提交表单
|
||||||
|
const data = formData.value as ${simpleClassName}Api.${subSimpleClassName};
|
||||||
|
try {
|
||||||
|
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
||||||
|
// 关闭并提示
|
||||||
|
await modalApi.close();
|
||||||
|
emit('success');
|
||||||
|
message.success({
|
||||||
|
content: $t('ui.actionMessage.operationSuccess'),
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async onOpenChange(isOpen: boolean) {
|
||||||
|
if (!isOpen) {
|
||||||
|
resetForm()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
|
let data = modalApi.getData<${simpleClassName}Api.${subSimpleClassName}>();
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.id) {
|
||||||
|
modalApi.lock();
|
||||||
|
try {
|
||||||
|
data = await get${subSimpleClassName}(data.id);
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置到 values
|
||||||
|
formData.value = data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
function resetForm(){
|
||||||
|
formData.value = {
|
||||||
#foreach ($column in $subColumns)
|
#foreach ($column in $subColumns)
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
#if ($column.createOperation || $column.updateOperation)
|
||||||
#if ($column.htmlType == "checkbox")
|
#if ($column.htmlType == "checkbox")
|
||||||
@ -35,75 +103,9 @@
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
});
|
|
||||||
const rules: Record<string, Rule[]> = {
|
|
||||||
#foreach ($column in $subColumns)
|
|
||||||
#if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
$column.javaField: [{ required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == 'select')'change'#else'blur'#end }],
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
};
|
};
|
||||||
|
formRef.value?.resetFields();
|
||||||
const [Modal, modalApi] = useVbenModal({
|
}
|
||||||
async onConfirm() {
|
|
||||||
await formRef.value?.validate();
|
|
||||||
|
|
||||||
modalApi.lock();
|
|
||||||
// 提交表单
|
|
||||||
const data = formData.value as ${simpleClassName}Api.${subSimpleClassName};
|
|
||||||
try {
|
|
||||||
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
|
||||||
// 关闭并提示
|
|
||||||
await modalApi.close();
|
|
||||||
emit('success');
|
|
||||||
message.success({
|
|
||||||
content: $t('ui.actionMessage.operationSuccess'),
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onOpenChange(isOpen: boolean) {
|
|
||||||
if (!isOpen) {
|
|
||||||
resetForm()
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载数据
|
|
||||||
let data = modalApi.getData<${simpleClassName}Api.${subSimpleClassName}>();
|
|
||||||
if (!data) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (data.id) {
|
|
||||||
modalApi.lock();
|
|
||||||
try {
|
|
||||||
data = await get${subSimpleClassName}(data.id);
|
|
||||||
} finally {
|
|
||||||
modalApi.unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 设置到 values
|
|
||||||
formData.value = data;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 重置表单 */
|
|
||||||
const resetForm = () => {
|
|
||||||
formData.value = {
|
|
||||||
#foreach ($column in $subColumns)
|
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
|
||||||
#if ($column.htmlType == "checkbox")
|
|
||||||
$column.javaField: [],
|
|
||||||
#else
|
|
||||||
$column.javaField: undefined,
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
};
|
|
||||||
formRef.value?.resetFields();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@ -5,12 +5,15 @@
|
|||||||
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|
||||||
import { message, Tabs, Form, Input, Textarea,Button, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker } from 'ant-design-vue';
|
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
||||||
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
|
import { message, Tabs, Form, Input, Textarea,Button, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker } from 'ant-design-vue';
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
||||||
@ -30,13 +33,14 @@ const props = defineProps<{
|
|||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
||||||
const tableRef = ref<VxeTableInstance>();
|
const tableRef = ref<VxeTableInstance>();
|
||||||
|
|
||||||
/** 添加${subTable.classComment} */
|
/** 添加${subTable.classComment} */
|
||||||
const onAdd = async () => {
|
async function handleAdd() {
|
||||||
await tableRef.value?.insertAt({} as ${simpleClassName}Api.${subSimpleClassName}, -1);
|
await tableRef.value?.insertAt({} as ${simpleClassName}Api.${subSimpleClassName}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
const onDelete = async (row: ${simpleClassName}Api.${subSimpleClassName}) => {
|
async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||||
await tableRef.value?.remove(row);
|
await tableRef.value?.remove(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +50,11 @@ defineExpose({
|
|||||||
const data = list.value as ${simpleClassName}Api.${subSimpleClassName}[];
|
const data = list.value as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
const removeRecords = tableRef.value?.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const removeRecords = tableRef.value?.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
const insertRecords = tableRef.value?.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const insertRecords = tableRef.value?.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
return data
|
return [
|
||||||
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
...data.filter(
|
||||||
?.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
(row) => !removeRecords.some((removed) => removed.id === row.id),
|
||||||
|
),
|
||||||
|
...insertRecords.map((row: any) => ({ ...row, id: undefined })),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -123,25 +129,25 @@ watch(
|
|||||||
#if ( $column.id == $subJoinColumn.id) ## 特殊:忽略主子表的 join 字段,不用填写
|
#if ( $column.id == $subJoinColumn.id) ## 特殊:忽略主子表的 join 字段,不用填写
|
||||||
#elseif ($column.htmlType == "input" && !$column.primaryKey)## 忽略主键,不用在表单里
|
#elseif ($column.htmlType == "input" && !$column.primaryKey)## 忽略主键,不用在表单里
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<Input v-model:value="row.${javaField}" />
|
<Input v-model:value="row.${javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "imageUpload")## 图片上传
|
#elseif($column.htmlType == "imageUpload")## 图片上传
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<ImageUpload v-model:value="row.${javaField}" />
|
<ImageUpload v-model:value="row.${javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "fileUpload")## 文件上传
|
#elseif($column.htmlType == "fileUpload")## 文件上传
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<FileUpload v-model:value="row.${javaField}" />
|
<FileUpload v-model:value="row.${javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "select")## 下拉框
|
#elseif($column.htmlType == "select")## 下拉框
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<Select v-model:value="row.${javaField}" placeholder="请选择${comment}">
|
<Select v-model:value="row.${javaField}" placeholder="请选择${comment}">
|
||||||
#if ("" != $dictType)## 有数据字典
|
#if ("" != $dictType)## 有数据字典
|
||||||
<Select.Option
|
<Select.Option
|
||||||
@ -159,7 +165,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "checkbox")## 多选框
|
#elseif($column.htmlType == "checkbox")## 多选框
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<CheckboxGroup v-model:value="row.${javaField}">
|
<CheckboxGroup v-model:value="row.${javaField}">
|
||||||
#if ("" != $dictType)## 有数据字典
|
#if ("" != $dictType)## 有数据字典
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@ -177,7 +183,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "radio")## 单选框
|
#elseif($column.htmlType == "radio")## 单选框
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<RadioGroup v-model:value="row.${javaField}">
|
<RadioGroup v-model:value="row.${javaField}">
|
||||||
#if ("" != $dictType)## 有数据字典
|
#if ("" != $dictType)## 有数据字典
|
||||||
<Radio
|
<Radio
|
||||||
@ -195,7 +201,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "datetime")## 时间框
|
#elseif($column.htmlType == "datetime")## 时间框
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<DatePicker
|
<DatePicker
|
||||||
v-model:value="row.${javaField}"
|
v-model:value="row.${javaField}"
|
||||||
:showTime="true"
|
:showTime="true"
|
||||||
@ -206,7 +212,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
#elseif($column.htmlType == "textarea" || $column.htmlType == "editor")## 文本框
|
#elseif($column.htmlType == "textarea" || $column.htmlType == "editor")## 文本框
|
||||||
<vxe-column field="${javaField}" title="${comment}" align="center">
|
<vxe-column field="${javaField}" title="${comment}" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<Textarea v-model:value="row.${javaField}" />
|
<Textarea v-model:value="row.${javaField}" />
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
@ -214,12 +220,12 @@ watch(
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
<vxe-column field="operation" title="操作" align="center">
|
<vxe-column field="operation" title="操作" align="center">
|
||||||
<template #default="{row}">
|
<template #default="{ row }">
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
type="link"
|
type="link"
|
||||||
danger
|
danger
|
||||||
@click="onDelete(row as any)"
|
@click="handleDelect(row)"
|
||||||
v-access:code="['${permissionPrefix}:delete']"
|
v-access:code="['${permissionPrefix}:delete']"
|
||||||
>
|
>
|
||||||
{{ $t('ui.actionTitle.delete') }}
|
{{ $t('ui.actionTitle.delete') }}
|
||||||
@ -228,7 +234,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<div class="flex justify-center mt-4">
|
<div class="flex justify-center mt-4">
|
||||||
<Button :icon="h(Plus)" type="primary" ghost @click="onAdd" v-access:code="['${permissionPrefix}:create']">
|
<Button :icon="h(Plus)" type="primary" ghost @click="handleAdd" v-access:code="['${permissionPrefix}:create']">
|
||||||
{{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }}
|
{{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -6,48 +6,50 @@
|
|||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
|
||||||
import { ContentWrap } from '#/components/content-wrap';
|
import { DictTag } from '#/components/dict-tag';
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
||||||
|
import { ContentWrap } from '#/components/content-wrap';
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
import { useTableToolbar, VbenVxeTableToolbar } from '@vben/plugins/vxe-table';
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { message,Button, Tabs,Pagination, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox,RangePicker, DatePicker, TreeSelect } from 'ant-design-vue';
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
import { Plus, Trash2 } from '@vben/icons';
|
import { message,Button, Tabs,Pagination, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox,RangePicker, DatePicker, TreeSelect } from 'ant-design-vue';
|
||||||
import { $t } from '#/locales';
|
import { Plus, Trash2 } from '@vben/icons';
|
||||||
import { TableToolbar } from '#/components/table-toolbar';
|
import { $t } from '#/locales';
|
||||||
import { useTableToolbar } from '#/hooks';
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
import { delete${subSimpleClassName},#if ($deleteBatchEnable) delete${subSimpleClassName}List,#end get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { delete${subSimpleClassName},#if ($deleteBatchEnable) delete${subSimpleClassName}List,#end get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import { isEmpty } from '@vben/utils';
|
import { isEmpty } from '@vben/utils';
|
||||||
#else
|
#else
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
#else
|
#else
|
||||||
import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
${subJoinColumn.javaField}?: number // ${subJoinColumn.columnComment}(主表的关联字段)
|
${subJoinColumn.javaField}?: number // ${subJoinColumn.columnComment}(主表的关联字段)
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: ${subSimpleClassName}Form,
|
connectedComponent: ${subSimpleClassName}Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 创建${subTable.classComment} */
|
/** 创建${subTable.classComment} */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
@ -68,14 +70,10 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
|||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}(row.id as number);
|
await delete${subSimpleClassName}(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
|
||||||
await getList();
|
await getList();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@ -88,12 +86,11 @@ async function handleDeleteBatch() {
|
|||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting'),
|
content: $t('ui.actionMessage.deleting'),
|
||||||
duration: 0,
|
duration: 0,
|
||||||
key: 'action_process_msg',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}List(checkedIds.value);
|
await delete${subSimpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
message.success( $t('ui.actionMessage.deleteSuccess') );
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
await getList();
|
await getList();
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@ -111,87 +108,87 @@ function handleRowCheckboxChange({
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
#end
|
#end
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
#foreach ($column in $subColumns)
|
#foreach ($column in $subColumns)
|
||||||
#if ($column.listOperation)
|
#if ($column.listOperation)
|
||||||
#if ($column.listOperationCondition != 'BETWEEN')
|
#if ($column.listOperationCondition != 'BETWEEN')
|
||||||
$column.javaField: undefined,
|
$column.javaField: undefined,
|
||||||
#end
|
|
||||||
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
|
||||||
$column.javaField: undefined,
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
#end
|
||||||
})
|
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
||||||
|
$column.javaField: undefined,
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
})
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
function handleQuery() {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
function resetQuery() {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
async function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
if (!props.${subJoinColumn.javaField}){
|
if (!props.${subJoinColumn.javaField}){
|
||||||
return []
|
return []
|
||||||
}
|
|
||||||
## 特殊:树表专属逻辑(树不需要分页接口)
|
|
||||||
#if ($table.templateType == 11) ## erp
|
|
||||||
const params = cloneDeep(queryParams) as any;
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if ($column.listOperation)
|
|
||||||
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
|
||||||
if (params.${column.javaField} && Array.isArray(params.${column.javaField})) {
|
|
||||||
params.${column.javaField} = (params.${column.javaField} as string[]).join(',');
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
params.${subJoinColumn.javaField} = props.${subJoinColumn.javaField};
|
|
||||||
const data = await get${subSimpleClassName}Page(params)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
#else
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
|
||||||
list.value = await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!);
|
|
||||||
#else
|
|
||||||
list.value = [await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)];
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
|
## 特殊:树表专属逻辑(树不需要分页接口)
|
||||||
|
#if ($table.templateType == 11) ## erp
|
||||||
|
const params = cloneDeep(queryParams) as any;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if ($column.listOperation)
|
||||||
|
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
||||||
|
if (params.${column.javaField} && Array.isArray(params.${column.javaField})) {
|
||||||
|
params.${column.javaField} = (params.${column.javaField} as string[]).join(',');
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
params.${subJoinColumn.javaField} = props.${subJoinColumn.javaField};
|
||||||
|
const data = await get${subSimpleClassName}Page(params)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
#else
|
||||||
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
|
list.value = await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!);
|
||||||
|
#else
|
||||||
|
list.value = [await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||||
watch(
|
watch(
|
||||||
() => props.${subJoinColumn.javaField},
|
() => props.${subJoinColumn.javaField},
|
||||||
async (val) => {
|
async (val) => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await getList()
|
await getList()
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
@ -292,7 +289,7 @@ onMounted(() => {
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap title="${table.classComment}">
|
<ContentWrap title="${table.classComment}">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<TableToolbar
|
<VbenVxeTableToolbar
|
||||||
ref="tableToolbarRef"
|
ref="tableToolbarRef"
|
||||||
v-model:hidden-search="hiddenSearchBar"
|
v-model:hidden-search="hiddenSearchBar"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,167 +1 @@
|
|||||||
import type { PageParam, PageResult } from '@vben/request';
|
#parse("codegen/vue3_vben5_ele/schema/api/api.ts.vm")
|
||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
|
||||||
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
|
|
||||||
|
|
||||||
export namespace ${simpleClassName}Api {
|
|
||||||
## 特殊:主子表专属逻辑
|
|
||||||
#foreach ($subTable in $subTables)
|
|
||||||
#set ($index = $foreach.count - 1)
|
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
|
||||||
#set ($subColumns = $subColumnsList.get($index))##当前字段数组
|
|
||||||
/** ${subTable.classComment}信息 */
|
|
||||||
export interface ${subSimpleClassName} {
|
|
||||||
#foreach ($column in $subColumns)
|
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
|
||||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
|
|
||||||
#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
|
|
||||||
#else
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
|
|
||||||
#end
|
|
||||||
/** ${table.classComment}信息 */
|
|
||||||
export interface ${simpleClassName} {
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
|
||||||
#if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal")
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment}
|
|
||||||
#elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime")
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment}
|
|
||||||
#else
|
|
||||||
${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#if ( $table.templateType == 2 )
|
|
||||||
children?: ${simpleClassName}[];
|
|
||||||
#end
|
|
||||||
## 特殊:主子表专属逻辑
|
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
|
||||||
#foreach ($subTable in $subTables)
|
|
||||||
#set ($index = $foreach.count - 1)
|
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
|
||||||
#if ( $subTable.subJoinMany )
|
|
||||||
${subSimpleClassName.toLowerCase()}s?: ${subSimpleClassName}[]
|
|
||||||
#else
|
|
||||||
${subSimpleClassName.toLowerCase()}?: ${subSimpleClassName}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ( $table.templateType != 2 )
|
|
||||||
/** 查询${table.classComment}分页 */
|
|
||||||
export function get${simpleClassName}Page(params: PageParam) {
|
|
||||||
return requestClient.get<PageResult<${simpleClassName}Api.${simpleClassName}>>('${baseURL}/page', { params });
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/** 查询${table.classComment}列表 */
|
|
||||||
export function get${simpleClassName}List(params: any) {
|
|
||||||
return requestClient.get<${simpleClassName}Api.${simpleClassName}[]>('${baseURL}/list', { params });
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
/** 查询${table.classComment}详情 */
|
|
||||||
export function get${simpleClassName}(id: number) {
|
|
||||||
return requestClient.get<${simpleClassName}Api.${simpleClassName}>(`${baseURL}/get?id=${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 新增${table.classComment} */
|
|
||||||
export function create${simpleClassName}(data: ${simpleClassName}Api.${simpleClassName}) {
|
|
||||||
return requestClient.post('${baseURL}/create', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 修改${table.classComment} */
|
|
||||||
export function update${simpleClassName}(data: ${simpleClassName}Api.${simpleClassName}) {
|
|
||||||
return requestClient.put('${baseURL}/update', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除${table.classComment} */
|
|
||||||
export function delete${simpleClassName}(id: number) {
|
|
||||||
return requestClient.delete(`${baseURL}/delete?id=${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
|
||||||
/** 批量删除${table.classComment} */
|
|
||||||
export function delete${simpleClassName}List(ids: number[]) {
|
|
||||||
return requestClient.delete(`${baseURL}/delete-list?ids=${ids.join(',')}`)
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
/** 导出${table.classComment} */
|
|
||||||
export function export${simpleClassName}(params: any) {
|
|
||||||
return requestClient.download('${baseURL}/export-excel', params);
|
|
||||||
}
|
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
|
||||||
#foreach ($subTable in $subTables)
|
|
||||||
#set ($index = $foreach.count - 1)
|
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
|
||||||
#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段
|
|
||||||
#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段
|
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
|
||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
|
|
||||||
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($index))
|
|
||||||
|
|
||||||
// ==================== 子表($subTable.classComment) ====================
|
|
||||||
|
|
||||||
## 情况一:MASTER_ERP 时,需要分查询页子表
|
|
||||||
#if ( $table.templateType == 11 )
|
|
||||||
/** 获得${subTable.classComment}分页 */
|
|
||||||
export function get${subSimpleClassName}Page(params: PageParam) {
|
|
||||||
return requestClient.get<PageResult<${simpleClassName}Api.${subSimpleClassName}>>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
|
|
||||||
}
|
|
||||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
|
||||||
#else
|
|
||||||
#if ( $subTable.subJoinMany )
|
|
||||||
/** 获得${subTable.classComment}列表 */
|
|
||||||
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/** 获得${subTable.classComment} */
|
|
||||||
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
|
||||||
#if ( $table.templateType == 11 )
|
|
||||||
/** 新增${subTable.classComment} */
|
|
||||||
export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
|
||||||
return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 修改${subTable.classComment} */
|
|
||||||
export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
|
||||||
return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
|
||||||
export function delete${subSimpleClassName}(id: number) {
|
|
||||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete?id=${id}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ($deleteBatchEnable)
|
|
||||||
/** 批量删除${subTable.classComment} */
|
|
||||||
export function delete${subSimpleClassName}List(ids: number[]) {
|
|
||||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
|
|
||||||
/** 获得${subTable.classComment} */
|
|
||||||
export function get${subSimpleClassName}(id: number) {
|
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import {
|
import { getDictOptions } from '@vben/hooks';
|
||||||
DICT_TYPE,
|
|
||||||
getDictOptions,
|
|
||||||
getRangePickerDefaultProps,
|
|
||||||
} from '#/utils';
|
|
||||||
#if(${table.templateType} == 2)## 树表需要导入这些
|
#if(${table.templateType} == 2)## 树表需要导入这些
|
||||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
|
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
import { handleTree } from '@vben/utils';
|
import { handleTree } from '@vben/utils';
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
@ -186,7 +185,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function useGridColumns(): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] {
|
export function useGridColumns(): VxeTableGridOptions<${apiName}.${simpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
{ type: 'checkbox', width: 40 },
|
{ type: 'checkbox', width: 40 },
|
||||||
@ -389,7 +388,7 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
|
export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${apiName}.${subSimpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
{ type: 'checkbox', width: 40 },
|
{ type: 'checkbox', width: 40 },
|
||||||
@ -426,7 +425,7 @@ export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${sim
|
|||||||
#else
|
#else
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
/** 新增/修改列表的字段 */
|
/** 新增/修改列表的字段 */
|
||||||
export function use${subSimpleClassName}GridEditColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
|
export function use${subSimpleClassName}GridEditColumns(): VxeTableGridOptions<${apiName}.${subSimpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#foreach($column in $subColumns)
|
#foreach($column in $subColumns)
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
#if ($column.createOperation || $column.updateOperation)
|
||||||
@ -602,4 +601,4 @@ export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${sim
|
|||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -1,8 +1,16 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { message, Tabs, Checkbox, Input, Textarea, Select,RadioGroup,CheckboxGroup, DatePicker } from 'ant-design-vue';
|
|
||||||
|
import { message#if ($table.templateType == 11), Tabs#end } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
import { $t } from '#/locales';
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
||||||
@ -12,21 +20,15 @@ import { message, Tabs, Checkbox, Input, Textarea, Select,RadioGroup,CheckboxGro
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<${simpleClassName}Api.${simpleClassName}>();
|
const formData = ref<${apiName}.${simpleClassName}>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['${table.classComment}'])
|
? $t('ui.actionTitle.edit', ['${table.classComment}'])
|
||||||
: $t('ui.actionTitle.create', ['${table.classComment}']);
|
: $t('ui.actionTitle.create', ['${table.classComment}']);
|
||||||
});
|
});
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
@ -51,7 +53,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: useFormSchema(),
|
schema: useFormSchema(),
|
||||||
showDefaultActions: false
|
showDefaultActions: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
@ -60,8 +62,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
// 校验子表单
|
// 校验子表单
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
@ -78,12 +80,12 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as ${simpleClassName}Api.${simpleClassName};
|
const data = (await formApi.getValues()) as ${apiName}.${simpleClassName};
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
// 拼接子表的数据
|
// 拼接子表的数据
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
@ -96,13 +98,13 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
try {
|
try {
|
||||||
await (formData.value?.id ? update${simpleClassName}(data) : create${simpleClassName}(data));
|
await (formData.value?.id ? update${simpleClassName}(data) : create${simpleClassName}(data));
|
||||||
// 关闭并提示
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
message.success( $t('ui.actionMessage.operationSuccess') );
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.unlock();
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
@ -113,21 +115,24 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
let data = modalApi.getData<${simpleClassName}Api.${simpleClassName}>();
|
const data = modalApi.getData<${apiName}.${simpleClassName}>();
|
||||||
if (!data) {
|
if (!data || !data.id) {
|
||||||
|
#if (${table.templateType} == 2)## 树表特有
|
||||||
|
// 设置上级
|
||||||
|
await formApi.setValues(data);
|
||||||
|
#end
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data.id) {
|
modalApi.lock();
|
||||||
modalApi.lock();
|
try {
|
||||||
try {
|
formData.value = await get${simpleClassName}(data.id);
|
||||||
data = await get${simpleClassName}(data.id);
|
// 设置到 values
|
||||||
} finally {
|
if (formData.value) {
|
||||||
modalApi.unlock();
|
await formApi.setValues(formData.value);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
// 设置到 values
|
|
||||||
formData.value = data;
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -135,8 +140,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle">
|
<Modal :title="getTitle">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<Tabs v-model:active-key="subTabsName">
|
<Tabs v-model:active-key="subTabsName">
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
@ -149,6 +154,6 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
#end
|
#end
|
||||||
</Tabs>
|
</Tabs>
|
||||||
#end
|
#end
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -1,56 +1,67 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { ref } from 'vue';
|
||||||
import { message,Tabs } from 'ant-design-vue';
|
|
||||||
|
import {#if ($table.templateType != 2 && $deleteBatchEnable) confirm,#end Page, useVbenModal } from '@vben/common-ui';
|
||||||
|
import { downloadFileFromBlobPart#if ($table.templateType != 2 && $deleteBatchEnable), isEmpty#end } from '@vben/utils';
|
||||||
|
|
||||||
|
import { message#if ($table.templateType == 11), Tabs#end } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
#if (${table.templateType} == 2)## 树表接口
|
||||||
|
import {
|
||||||
|
delete${simpleClassName},
|
||||||
|
export${simpleClassName},
|
||||||
|
get${simpleClassName}List,
|
||||||
|
} from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
#else## 标准表接口
|
||||||
|
import {
|
||||||
|
delete${simpleClassName},#if ($deleteBatchEnable)
|
||||||
|
|
||||||
|
delete${simpleClassName}List,#end
|
||||||
|
export${simpleClassName},
|
||||||
|
get${simpleClassName}Page,
|
||||||
|
} from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
#end
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
||||||
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
|
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
|
||||||
import ${subSimpleClassName}List from './modules/${subSimpleClassName_strikeCase}-list.vue'
|
import ${subSimpleClassName}List from './modules/${subSimpleClassName_strikeCase}-list.vue';
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { ref, computed } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
#if (${table.templateType} == 2)## 树表接口
|
|
||||||
import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
#else## 标准表接口
|
|
||||||
import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}List,#end export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
#end
|
|
||||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
|
|
||||||
#if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况
|
#if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况
|
||||||
/** 子表的列表 */
|
/** 子表的列表 */
|
||||||
const subTabsName = ref('$subClassNameVars.get(0)')
|
const subTabsName = ref('$subClassNameVars.get(0)')
|
||||||
#if ($table.templateType == 11)
|
#if ($table.templateType == 11)
|
||||||
const select${simpleClassName} = ref<${simpleClassName}Api.${simpleClassName}>();
|
const select${simpleClassName} = ref<${apiName}.${simpleClassName}>();
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: Form,
|
connectedComponent: Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
#if (${table.templateType} == 2)## 树表特有:控制表格展开收缩
|
#if (${table.templateType} == 2)## 树表特有:控制表格展开收缩
|
||||||
|
|
||||||
/** 切换树形展开/收缩状态 */
|
/** 切换树形展开/收缩状态 */
|
||||||
const isExpanded = ref(true);
|
const isExpanded = ref(true);
|
||||||
function toggleExpand() {
|
function handleExpand() {
|
||||||
isExpanded.value = !isExpanded.value;
|
isExpanded.value = !isExpanded.value;
|
||||||
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
#if ($table.templateType == 12) ## 内嵌情况
|
#if ($table.templateType == 12) ## 内嵌情况
|
||||||
gridApi.reload();
|
gridApi.reload();
|
||||||
#else
|
#else
|
||||||
@ -60,34 +71,31 @@ function onRefresh() {
|
|||||||
|
|
||||||
/** 创建${table.classComment} */
|
/** 创建${table.classComment} */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData({}).open();
|
formModalApi.setData(null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑${table.classComment} */
|
|
||||||
function handleEdit(row: ${simpleClassName}Api.${simpleClassName}) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (${table.templateType} == 2)## 树表特有:新增下级
|
#if (${table.templateType} == 2)## 树表特有:新增下级
|
||||||
/** 新增下级${table.classComment} */
|
|
||||||
function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) {
|
/** 添加下级${table.classComment} */
|
||||||
|
function handleAppend(row: ${apiName}.${simpleClassName}) {
|
||||||
formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open();
|
formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open();
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
/** 编辑${table.classComment} */
|
||||||
|
function handleEdit(row: ${apiName}.${simpleClassName}) {
|
||||||
|
formModalApi.setData(row).open();
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除${table.classComment} */
|
/** 删除${table.classComment} */
|
||||||
async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
async function handleDelete(row: ${apiName}.${simpleClassName}) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
key: 'action_key_msg',
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}(row.id as number);
|
await delete${simpleClassName}(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
@ -96,30 +104,28 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
|||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
/** 批量删除${table.classComment} */
|
/** 批量删除${table.classComment} */
|
||||||
async function handleDeleteBatch() {
|
async function handleDeleteBatch() {
|
||||||
|
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting'),
|
content: $t('ui.actionMessage.deletingBatch'),
|
||||||
key: 'action_key_msg',
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}List(checkedIds.value);
|
await delete${simpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
content: $t('ui.actionMessage.deleteSuccess'),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([])
|
const checkedIds = ref<number[]>([]);
|
||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
}: {
|
}: {
|
||||||
records: ${simpleClassName}Api.${simpleClassName}[];
|
records: ${apiName}.${simpleClassName}[];
|
||||||
}) {
|
}) {
|
||||||
checkedIds.value = records.map((item) => item.id);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@ -141,20 +147,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
#end
|
#end
|
||||||
#if (${table.templateType} == 2)## 树表设置
|
#if (${table.templateType} == 2)## 树表设置
|
||||||
treeConfig: {
|
|
||||||
parentField: '${treeParentColumn.javaField}',
|
|
||||||
rowField: 'id',
|
|
||||||
transform: true,
|
|
||||||
expandAll: true,
|
|
||||||
reserve: true,
|
|
||||||
},
|
|
||||||
pagerConfig: {
|
|
||||||
enabled: false,
|
|
||||||
},
|
|
||||||
#else## 标准表设置
|
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
#else## 标准表设置
|
||||||
|
keepSource: true,
|
||||||
#end
|
#end
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
@ -184,27 +181,35 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
refresh: true,
|
refresh: true,
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>,
|
#if (${table.templateType} == 2)## 树表设置
|
||||||
#if (${table.templateType} == 11 || $deleteBatchEnable)
|
treeConfig: {
|
||||||
gridEvents:{
|
parentField: '${treeParentColumn.javaField}',
|
||||||
#if(${table.templateType} == 11)
|
rowField: 'id',
|
||||||
cellClick: ({ row }: { row: ${simpleClassName}Api.${simpleClassName}}) => {
|
transform: true,
|
||||||
|
expandAll: true,
|
||||||
|
reserve: true,
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
} as VxeTableGridOptions<${apiName}.${simpleClassName}>,
|
||||||
|
#if (${table.templateType} == 11 || (${table.templateType} != 2 && $deleteBatchEnable))
|
||||||
|
gridEvents: {
|
||||||
|
#if(${table.templateType} == 11)
|
||||||
|
cellClick: ({ row }: { row: ${apiName}.${simpleClassName}}) => {
|
||||||
select${simpleClassName}.value = row;
|
select${simpleClassName}.value = row;
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
#if(${table.templateType} != 2 && $deleteBatchEnable)
|
#if (${table.templateType} != 2 && $deleteBatchEnable)
|
||||||
checkboxAll: handleRowCheckboxChange,
|
checkboxAll: handleRowCheckboxChange,
|
||||||
checkboxChange: handleRowCheckboxChange,
|
checkboxChange: handleRowCheckboxChange,
|
||||||
#end
|
#end
|
||||||
}
|
},
|
||||||
#end
|
#end
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp情况
|
#if ($table.templateType == 11) ## erp情况
|
||||||
<div>
|
<div>
|
||||||
#end
|
#end
|
||||||
@ -228,13 +233,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
#if (${table.templateType} == 2)## 树表特有:展开/收缩按钮
|
|
||||||
{
|
|
||||||
label: isExpanded ? '收缩' : '展开',
|
|
||||||
type: 'primary',
|
|
||||||
onClick: toggleExpand,
|
|
||||||
},
|
|
||||||
#end
|
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.create', ['${table.classComment}']),
|
label: $t('ui.actionTitle.create', ['${table.classComment}']),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -242,6 +240,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
||||||
onClick: handleCreate,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
|
#if (${table.templateType} == 2)## 树表特有:展开/收缩按钮
|
||||||
|
{
|
||||||
|
label: isExpanded ? '收缩' : '展开',
|
||||||
|
type: 'primary',
|
||||||
|
onClick: handleExpand,
|
||||||
|
},
|
||||||
|
#end
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.export'),
|
label: $t('ui.actionTitle.export'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -255,8 +260,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
type: 'primary',
|
type: 'primary',
|
||||||
danger: true,
|
danger: true,
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
||||||
|
disabled: isEmpty(checkedIds),
|
||||||
onClick: handleDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
@ -297,7 +302,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp情况
|
#if ($table.templateType == 11) ## erp情况
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<Tabs v-model:active-key="subTabsName" class="mt-2">
|
<Tabs v-model:active-key="subTabsName" class="mt-2">
|
||||||
@ -314,4 +318,4 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
@ -2,8 +2,9 @@
|
|||||||
#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组
|
#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组
|
||||||
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
@ -16,7 +17,7 @@
|
|||||||
import { use${subSimpleClassName}FormSchema } from '../data';
|
import { use${subSimpleClassName}FormSchema } from '../data';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<${simpleClassName}Api.${subSimpleClassName}>();
|
const formData = ref<${apiName}.${subSimpleClassName}>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
||||||
@ -45,7 +46,7 @@
|
|||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as ${simpleClassName}Api.${subSimpleClassName};
|
const data = (await formApi.getValues()) as ${apiName}.${subSimpleClassName};
|
||||||
data.${subJoinColumn.javaField} = formData.value?.${subJoinColumn.javaField};
|
data.${subJoinColumn.javaField} = formData.value?.${subJoinColumn.javaField};
|
||||||
try {
|
try {
|
||||||
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
||||||
@ -64,7 +65,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
let data = modalApi.getData<${simpleClassName}Api.${subSimpleClassName}>();
|
let data = modalApi.getData<${apiName}.${subSimpleClassName}>();
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,12 @@
|
|||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
||||||
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
@ -33,7 +35,7 @@ const props = defineProps<{
|
|||||||
function onActionClick({
|
function onActionClick({
|
||||||
code,
|
code,
|
||||||
row,
|
row,
|
||||||
}: OnActionClickParams<${simpleClassName}Api.${subSimpleClassName}>) {
|
}: OnActionClickParams<${apiName}.${subSimpleClassName}>) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
onDelete(row);
|
onDelete(row);
|
||||||
@ -63,20 +65,20 @@ gridOptions: {
|
|||||||
|
|
||||||
/** 添加${subTable.classComment} */
|
/** 添加${subTable.classComment} */
|
||||||
const onAdd = async () => {
|
const onAdd = async () => {
|
||||||
await gridApi.grid.insertAt({} as ${simpleClassName}Api.${subSimpleClassName}, -1);
|
await gridApi.grid.insertAt({} as ${apiName}.${subSimpleClassName}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
const onDelete = async (row: ${simpleClassName}Api.${subSimpleClassName}) => {
|
const onDelete = async (row: ${apiName}.${subSimpleClassName}) => {
|
||||||
await gridApi.grid.remove(row);
|
await gridApi.grid.remove(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提供获取表格数据的方法供父组件调用 */
|
/** 提供获取表格数据的方法供父组件调用 */
|
||||||
defineExpose({
|
defineExpose({
|
||||||
getData: (): ${simpleClassName}Api.${subSimpleClassName}[] => {
|
getData: (): ${apiName}.${subSimpleClassName}[] => {
|
||||||
const data = gridApi.grid.getData() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const data = gridApi.grid.getData() as ${apiName}.${subSimpleClassName}[];
|
||||||
const removeRecords = gridApi.grid.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const removeRecords = gridApi.grid.getRemoveRecords() as ${apiName}.${subSimpleClassName}[];
|
||||||
const insertRecords = gridApi.grid.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const insertRecords = gridApi.grid.getInsertRecords() as ${apiName}.${subSimpleClassName}[];
|
||||||
return data
|
return data
|
||||||
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
||||||
.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
||||||
|
|||||||
@ -5,9 +5,10 @@
|
|||||||
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
||||||
@ -51,23 +52,20 @@ function handleCreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑${subTable.classComment} */
|
/** 编辑${subTable.classComment} */
|
||||||
function handleEdit(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
function handleEdit(row: ${apiName}.${subSimpleClassName}) {
|
||||||
formModalApi.setData(row).open();
|
formModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
async function handleDelete(row: ${apiName}.${subSimpleClassName}) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting', [row.id]),
|
content: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
key: 'action_process_msg',
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}(row.id as number);
|
await delete${subSimpleClassName}(row.id!);
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
@ -78,16 +76,13 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
|||||||
async function handleDeleteBatch() {
|
async function handleDeleteBatch() {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: $t('ui.actionMessage.deleting'),
|
content: $t('ui.actionMessage.deleting'),
|
||||||
key: 'action_key_msg',
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}List(checkedIds.value);
|
await delete${subSimpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
message.success({
|
message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
content: $t('ui.actionMessage.deleteSuccess', [row.id]),
|
handleRefresh();
|
||||||
key: 'action_key_msg',
|
|
||||||
});
|
|
||||||
onRefresh();
|
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
@ -97,7 +92,7 @@ const checkedIds = ref<number[]>([])
|
|||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
}: {
|
}: {
|
||||||
records: ${simpleClassName}Api.${subSimpleClassName}[];
|
records: ${apiName}.${subSimpleClassName}[];
|
||||||
}) {
|
}) {
|
||||||
checkedIds.value = records.map((item) => item.id);
|
checkedIds.value = records.map((item) => item.id);
|
||||||
}
|
}
|
||||||
@ -149,7 +144,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
isHover: true,
|
isHover: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>,
|
} as VxeTableGridOptions<${apiName}.${subSimpleClassName}>,
|
||||||
#if (${table.templateType} == 11 && $deleteBatchEnable)
|
#if (${table.templateType} == 11 && $deleteBatchEnable)
|
||||||
gridEvents:{
|
gridEvents:{
|
||||||
checkboxAll: handleRowCheckboxChange,
|
checkboxAll: handleRowCheckboxChange,
|
||||||
@ -159,7 +154,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
async function onRefresh() {
|
async function handleRefresh() {
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
await gridApi.query();
|
await gridApi.query();
|
||||||
#else
|
#else
|
||||||
@ -179,7 +174,7 @@ watch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await onRefresh()
|
await handleRefresh()
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
@ -187,7 +182,7 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid table-title="${subTable.classComment}列表">
|
<Grid table-title="${subTable.classComment}列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export function delete${simpleClassName}List(ids: number[]) {
|
|||||||
|
|
||||||
/** 导出${table.classComment} */
|
/** 导出${table.classComment} */
|
||||||
export function export${simpleClassName}(params: any) {
|
export function export${simpleClassName}(params: any) {
|
||||||
return requestClient.download('${baseURL}/export-excel', params);
|
return requestClient.download('${baseURL}/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
|
|||||||
@ -3,10 +3,11 @@ import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleCl
|
|||||||
import type { FormRules } from 'element-plus';
|
import type { FormRules } from 'element-plus';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker, ElTreeSelect } from 'element-plus';
|
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker, ElTreeSelect } from 'element-plus';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
|
||||||
#if($table.templateType == 2)## 树表需要导入这些
|
#if($table.templateType == 2)## 树表需要导入这些
|
||||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import { handleTree } from '@vben/utils'
|
import { handleTree } from '@vben/utils'
|
||||||
|
|||||||
@ -1,18 +1,18 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
|
||||||
|
import { ref, h, reactive, onMounted, nextTick } from 'vue';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
import { useTableToolbar, VbenVxeTableToolbar } from '@vben/plugins/vxe-table';
|
||||||
|
import { cloneDeep, downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
|
||||||
import { ElButton, ElMessage, ElLoading, ElTabs, ElTabPane, ElPagination, ElForm, ElFormItem, ElDatePicker, ElSelect, ElOption, ElInput } from 'element-plus';
|
import { ElButton, ElMessage, ElLoading, ElTabs, ElTabPane, ElPagination, ElForm, ElFormItem, ElDatePicker, ElSelect, ElOption, ElInput } from 'element-plus';
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
import ${simpleClassName}Form from './modules/form.vue';
|
import ${simpleClassName}Form from './modules/form.vue';
|
||||||
import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
|
import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
|
||||||
import { ContentWrap } from '#/components/content-wrap';
|
import { ContentWrap } from '#/components/content-wrap';
|
||||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
||||||
import { TableToolbar } from '#/components/table-toolbar';
|
|
||||||
import { useTableToolbar } from '#/hooks';
|
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
||||||
@ -23,7 +23,6 @@ import { useTableToolbar } from '#/hooks';
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { ref, h, reactive,onMounted,nextTick } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
#if (${table.templateType} == 2)## 树表接口
|
#if (${table.templateType} == 2)## 树表接口
|
||||||
import { handleTree,isEmpty } from '@vben/utils'
|
import { handleTree,isEmpty } from '@vben/utils'
|
||||||
@ -104,7 +103,7 @@ const getList = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
function handleQuery() {
|
||||||
#if ( $table.templateType != 2 )
|
#if ( $table.templateType != 2 )
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
#end
|
#end
|
||||||
@ -112,7 +111,7 @@ const handleQuery = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
function resetQuery() {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
@ -182,7 +181,7 @@ function handleRowCheckboxChange({
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function handleExport() {
|
||||||
try {
|
try {
|
||||||
exportLoading.value = true;
|
exportLoading.value = true;
|
||||||
const data = await export${simpleClassName}(queryParams);
|
const data = await export${simpleClassName}(queryParams);
|
||||||
@ -195,7 +194,7 @@ try {
|
|||||||
#if (${table.templateType} == 2)
|
#if (${table.templateType} == 2)
|
||||||
/** 切换树形展开/收缩状态 */
|
/** 切换树形展开/收缩状态 */
|
||||||
const isExpanded = ref(true);
|
const isExpanded = ref(true);
|
||||||
function toggleExpand() {
|
function handleExpand() {
|
||||||
isExpanded.value = !isExpanded.value;
|
isExpanded.value = !isExpanded.value;
|
||||||
tableRef.value?.setAllTreeExpand(isExpanded.value);
|
tableRef.value?.setAllTreeExpand(isExpanded.value);
|
||||||
}
|
}
|
||||||
@ -306,7 +305,7 @@ onMounted(() => {
|
|||||||
v-model:hidden-search="hiddenSearchBar"
|
v-model:hidden-search="hiddenSearchBar"
|
||||||
>
|
>
|
||||||
#if (${table.templateType} == 2)
|
#if (${table.templateType} == 2)
|
||||||
<el-button @click="toggleExpand" class="mr-2">
|
<el-button @click="handleExpand" class="mr-2">
|
||||||
{{ isExpanded ? '收缩' : '展开' }}
|
{{ isExpanded ? '收缩' : '展开' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
#end
|
#end
|
||||||
@ -324,7 +323,7 @@ onMounted(() => {
|
|||||||
type="primary"
|
type="primary"
|
||||||
class="ml-2"
|
class="ml-2"
|
||||||
:loading="exportLoading"
|
:loading="exportLoading"
|
||||||
@click="onExport"
|
@click="handleExport"
|
||||||
v-access:code="['${permissionPrefix}:export']"
|
v-access:code="['${permissionPrefix}:export']"
|
||||||
>
|
>
|
||||||
{{ $t('ui.actionTitle.export') }}
|
{{ $t('ui.actionTitle.export') }}
|
||||||
|
|||||||
@ -6,13 +6,15 @@
|
|||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import type { FormRules } from 'element-plus';
|
import type { FormRules } from 'element-plus';
|
||||||
|
|
||||||
|
import { computed, ref, reactive } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker, ElTreeSelect } from 'element-plus';
|
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker, ElTreeSelect } from 'element-plus';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
|
||||||
|
|
||||||
import { computed, ref, reactive } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|||||||
@ -5,12 +5,15 @@
|
|||||||
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
|
|
||||||
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElButton, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker } from 'element-plus';
|
import { computed, ref, reactive, h, onMounted,watch,nextTick } from 'vue';
|
||||||
import { computed, ref, reactive, h, onMounted,watch,nextTick } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
|
import { ElMessage, ElTabs, ElTabPane, ElForm, ElFormItem, ElInput, ElButton, ElSelect, ElOption, ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox, ElDatePicker } from 'element-plus';
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
||||||
@ -31,12 +34,12 @@ const props = defineProps<{
|
|||||||
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
const list = ref<${simpleClassName}Api.${subSimpleClassName}[]>([]) // 列表的数据
|
||||||
const tableRef = ref<VxeTableInstance>();
|
const tableRef = ref<VxeTableInstance>();
|
||||||
/** 添加${subTable.classComment} */
|
/** 添加${subTable.classComment} */
|
||||||
const onAdd = async () => {
|
async function handleAdd() {
|
||||||
await tableRef.value?.insertAt({} as ${simpleClassName}Api.${subSimpleClassName}, -1);
|
await tableRef.value?.insertAt({} as ${simpleClassName}Api.${subSimpleClassName}, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
const onDelete = async (row: ${simpleClassName}Api.${subSimpleClassName}) => {
|
async function onDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
||||||
await tableRef.value?.remove(row);
|
await tableRef.value?.remove(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +49,11 @@ defineExpose({
|
|||||||
const data = list.value as ${simpleClassName}Api.${subSimpleClassName}[];
|
const data = list.value as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
const removeRecords = tableRef.value?.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const removeRecords = tableRef.value?.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
const insertRecords = tableRef.value?.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const insertRecords = tableRef.value?.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
||||||
return data
|
return [
|
||||||
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
...data.filter(
|
||||||
?.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
(row) => !removeRecords.some((removed) => removed.id === row.id),
|
||||||
|
),
|
||||||
|
...insertRecords.map((row: any) => ({ ...row, id: undefined })),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -227,7 +232,7 @@ watch(
|
|||||||
</vxe-column>
|
</vxe-column>
|
||||||
</vxe-table>
|
</vxe-table>
|
||||||
<div class="flex justify-center mt-4">
|
<div class="flex justify-center mt-4">
|
||||||
<el-button :icon="h(Plus)" type="primary" plain @click="onAdd" v-access:code="['${permissionPrefix}:create']">
|
<el-button :icon="h(Plus)" type="primary" plain @click="handleAdd" v-access:code="['${permissionPrefix}:create']">
|
||||||
{{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }}
|
{{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,23 +9,25 @@
|
|||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
|
||||||
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
import type { VxeTableInstance } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
|
||||||
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
|
||||||
import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
|
import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
|
||||||
import { cloneDeep, formatDateTime } from '@vben/utils';
|
|
||||||
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
|
import { getDictOptions } from '@vben/hooks';
|
||||||
|
|
||||||
|
import { DictTag } from '#/components/dict-tag';
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
|
||||||
import { ContentWrap } from '#/components/content-wrap';
|
import { ContentWrap } from '#/components/content-wrap';
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { useTableToolbar, VbenVxeTableToolbar } from '@vben/plugins/vxe-table';
|
||||||
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
||||||
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
import { Tinymce as RichTextarea } from '#/components/tinymce';
|
||||||
import { ImageUpload, FileUpload } from "#/components/upload";
|
import { ImageUpload, FileUpload } from "#/components/upload";
|
||||||
import { ElMessage, ElLoading, ElButton, ElTabs, ElTabPane, ElPagination, ElForm, ElFormItem, ElDatePicker, ElSelect, ElOption, ElInput } from 'element-plus';
|
import { ElMessage, ElLoading, ElButton, ElTabs, ElTabPane, ElPagination, ElForm, ElFormItem, ElDatePicker, ElSelect, ElOption, ElInput } from 'element-plus';
|
||||||
import { Plus, Trash2 } from '@vben/icons';
|
import { Plus, Trash2 } from '@vben/icons';
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { TableToolbar } from '#/components/table-toolbar';
|
|
||||||
import { useTableToolbar } from '#/hooks';
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
@ -129,64 +131,64 @@ function handleRowCheckboxChange({
|
|||||||
})
|
})
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
function handleQuery() {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
function resetQuery() {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
const getList = async () => {
|
async function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
if (!props.${subJoinColumn.javaField}){
|
if (!props.${subJoinColumn.javaField}){
|
||||||
return []
|
return []
|
||||||
}
|
|
||||||
## 特殊:树表专属逻辑(树不需要分页接口)
|
|
||||||
#if ($table.templateType == 11) ## erp
|
|
||||||
const params = cloneDeep(queryParams) as any;
|
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if ($column.listOperation)
|
|
||||||
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
|
||||||
if (params.${column.javaField} && Array.isArray(params.${column.javaField})) {
|
|
||||||
params.${column.javaField} = (params.${column.javaField} as string[]).join(',');
|
|
||||||
}
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
params.${subJoinColumn.javaField} = props.${subJoinColumn.javaField};
|
|
||||||
const data = await get${subSimpleClassName}Page(params)
|
|
||||||
list.value = data.list
|
|
||||||
total.value = data.total
|
|
||||||
#else
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
|
||||||
list.value = await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!);
|
|
||||||
#else
|
|
||||||
list.value = [await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)];
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
|
## 特殊:树表专属逻辑(树不需要分页接口)
|
||||||
|
#if ($table.templateType == 11) ## erp
|
||||||
|
const params = cloneDeep(queryParams) as any;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if ($column.listOperation)
|
||||||
|
#if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN")
|
||||||
|
if (params.${column.javaField} && Array.isArray(params.${column.javaField})) {
|
||||||
|
params.${column.javaField} = (params.${column.javaField} as string[]).join(',');
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
params.${subJoinColumn.javaField} = props.${subJoinColumn.javaField};
|
||||||
|
const data = await get${subSimpleClassName}Page(params)
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
#else
|
||||||
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
|
list.value = await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!);
|
||||||
|
#else
|
||||||
|
list.value = [await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||||
watch(
|
watch(
|
||||||
() => props.${subJoinColumn.javaField},
|
() => props.${subJoinColumn.javaField},
|
||||||
async (val) => {
|
async (val) => {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await getList()
|
await getList()
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
@ -290,7 +292,7 @@ onMounted(() => {
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap title="${table.classComment}">
|
<ContentWrap title="${table.classComment}">
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<TableToolbar
|
<VbenVxeTableToolbar
|
||||||
ref="tableToolbarRef"
|
ref="tableToolbarRef"
|
||||||
v-model:hidden-search="hiddenSearchBar"
|
v-model:hidden-search="hiddenSearchBar"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
|
#if ( $table.templateType != 2 )
|
||||||
import type { PageParam, PageResult } from '@vben/request';
|
import type { PageParam, PageResult } from '@vben/request';
|
||||||
|
#end
|
||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
|
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
|
||||||
|
|
||||||
export namespace ${simpleClassName}Api {
|
export namespace ${apiName} {
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
@ -60,27 +63,35 @@ export namespace ${simpleClassName}Api {
|
|||||||
#if ( $table.templateType != 2 )
|
#if ( $table.templateType != 2 )
|
||||||
/** 查询${table.classComment}分页 */
|
/** 查询${table.classComment}分页 */
|
||||||
export function get${simpleClassName}Page(params: PageParam) {
|
export function get${simpleClassName}Page(params: PageParam) {
|
||||||
return requestClient.get<PageResult<${simpleClassName}Api.${simpleClassName}>>('${baseURL}/page', { params });
|
return requestClient.get<PageResult<${apiName}.${simpleClassName}>>(
|
||||||
|
'${baseURL}/page',
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/** 查询${table.classComment}列表 */
|
/** 查询${table.classComment}列表 */
|
||||||
export function get${simpleClassName}List(params: any) {
|
export function get${simpleClassName}List(params: any) {
|
||||||
return requestClient.get<${simpleClassName}Api.${simpleClassName}[]>('${baseURL}/list', { params });
|
return requestClient.get<${apiName}.${simpleClassName}[]>(
|
||||||
|
'${baseURL}/list',
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/** 查询${table.classComment}详情 */
|
/** 查询${table.classComment}详情 */
|
||||||
export function get${simpleClassName}(id: number) {
|
export function get${simpleClassName}(id: number) {
|
||||||
return requestClient.get<${simpleClassName}Api.${simpleClassName}>(`${baseURL}/get?id=${id}`);
|
return requestClient.get<${apiName}.${simpleClassName}>(
|
||||||
|
`${baseURL}/get?id=${id}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新增${table.classComment} */
|
/** 新增${table.classComment} */
|
||||||
export function create${simpleClassName}(data: ${simpleClassName}Api.${simpleClassName}) {
|
export function create${simpleClassName}(data: ${apiName}.${simpleClassName}) {
|
||||||
return requestClient.post('${baseURL}/create', data);
|
return requestClient.post('${baseURL}/create', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改${table.classComment} */
|
/** 修改${table.classComment} */
|
||||||
export function update${simpleClassName}(data: ${simpleClassName}Api.${simpleClassName}) {
|
export function update${simpleClassName}(data: ${apiName}.${simpleClassName}) {
|
||||||
return requestClient.put('${baseURL}/update', data);
|
return requestClient.put('${baseURL}/update', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,17 +99,19 @@ export function update${simpleClassName}(data: ${simpleClassName}Api.${simpleCla
|
|||||||
export function delete${simpleClassName}(id: number) {
|
export function delete${simpleClassName}(id: number) {
|
||||||
return requestClient.delete(`${baseURL}/delete?id=${id}`);
|
return requestClient.delete(`${baseURL}/delete?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
#if ( $table.templateType != 2 && $deleteBatchEnable)
|
||||||
|
|
||||||
/** 批量删除${table.classComment} */
|
/** 批量删除${table.classComment} */
|
||||||
export function delete${simpleClassName}List(ids: number[]) {
|
export function delete${simpleClassName}List(ids: number[]) {
|
||||||
return requestClient.delete(`${baseURL}/delete-list?ids=${ids.join(',')}`)
|
return requestClient.delete(
|
||||||
|
`${baseURL}/delete-list?ids=${ids.join(',')}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/** 导出${table.classComment} */
|
/** 导出${table.classComment} */
|
||||||
export function export${simpleClassName}(params: any) {
|
export function export${simpleClassName}(params: any) {
|
||||||
return requestClient.download('${baseURL}/export-excel', params);
|
return requestClient.download('${baseURL}/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
@ -118,31 +131,38 @@ export function export${simpleClassName}(params: any) {
|
|||||||
#if ( $table.templateType == 11 )
|
#if ( $table.templateType == 11 )
|
||||||
/** 获得${subTable.classComment}分页 */
|
/** 获得${subTable.classComment}分页 */
|
||||||
export function get${subSimpleClassName}Page(params: PageParam) {
|
export function get${subSimpleClassName}Page(params: PageParam) {
|
||||||
return requestClient.get<PageResult<${simpleClassName}Api.${subSimpleClassName}>>(`${baseURL}/${subSimpleClassName_strikeCase}/page`, { params });
|
return requestClient.get<PageResult<${apiName}.${subSimpleClassName}>>(
|
||||||
|
`${baseURL}/${subSimpleClassName_strikeCase}/page`,
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
## 情况二:非 MASTER_ERP 时,需要列表查询子表
|
||||||
#else
|
#else
|
||||||
#if ( $subTable.subJoinMany )
|
#if ( $subTable.subJoinMany )
|
||||||
/** 获得${subTable.classComment}列表 */
|
/** 获得${subTable.classComment}列表 */
|
||||||
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
export function get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}[]>(`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
return requestClient.get<${apiName}.${subSimpleClassName}[]>(
|
||||||
|
`${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/** 获得${subTable.classComment} */
|
/** 获得${subTable.classComment} */
|
||||||
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
export function get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField}: number) {
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`);
|
return requestClient.get<${apiName}.${subSimpleClassName}>(
|
||||||
|
`${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=${${subJoinColumn.javaField}}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作
|
||||||
#if ( $table.templateType == 11 )
|
#if ( $table.templateType == 11 )
|
||||||
/** 新增${subTable.classComment} */
|
/** 新增${subTable.classComment} */
|
||||||
export function create${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
export function create${subSimpleClassName}(data: ${apiName}.${subSimpleClassName}) {
|
||||||
return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
|
return requestClient.post(`${baseURL}/${subSimpleClassName_strikeCase}/create`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改${subTable.classComment} */
|
/** 修改${subTable.classComment} */
|
||||||
export function update${subSimpleClassName}(data: ${simpleClassName}Api.${subSimpleClassName}) {
|
export function update${subSimpleClassName}(data: ${apiName}.${subSimpleClassName}) {
|
||||||
return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
|
return requestClient.put(`${baseURL}/${subSimpleClassName_strikeCase}/update`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,13 +174,17 @@ export function delete${subSimpleClassName}(id: number) {
|
|||||||
#if ($deleteBatchEnable)
|
#if ($deleteBatchEnable)
|
||||||
/** 批量删除${subTable.classComment} */
|
/** 批量删除${subTable.classComment} */
|
||||||
export function delete${subSimpleClassName}List(ids: number[]) {
|
export function delete${subSimpleClassName}List(ids: number[]) {
|
||||||
return requestClient.delete(`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`)
|
return requestClient.delete(
|
||||||
|
`${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/** 获得${subTable.classComment} */
|
/** 获得${subTable.classComment} */
|
||||||
export function get${subSimpleClassName}(id: number) {
|
export function get${subSimpleClassName}(id: number) {
|
||||||
return requestClient.get<${simpleClassName}Api.${subSimpleClassName}>(`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`);
|
return requestClient.get<${apiName}.${subSimpleClassName}>(
|
||||||
|
`${baseURL}/${subSimpleClassName_strikeCase}/get?id=${id}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { DICT_TYPE } from '@vben/constants';
|
||||||
import {
|
import { getDictOptions } from '@vben/hooks';
|
||||||
DICT_TYPE,
|
|
||||||
getDictOptions,
|
|
||||||
getRangePickerDefaultProps,
|
|
||||||
} from '#/utils';
|
|
||||||
#if(${table.templateType} == 2)## 树表需要导入这些
|
#if(${table.templateType} == 2)## 树表需要导入这些
|
||||||
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
|
import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
import { handleTree } from '@vben/utils';
|
import { handleTree } from '@vben/utils';
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
import { getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
return [
|
return [
|
||||||
@ -30,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
label: '上级${table.classComment}',
|
label: '上级${table.classComment}',
|
||||||
component: 'ApiTreeSelect',
|
component: 'ApiTreeSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
api: async () => {
|
api: async () => {
|
||||||
const data = await get${simpleClassName}List({});
|
const data = await get${simpleClassName}List({});
|
||||||
data.unshift({
|
data.unshift({
|
||||||
@ -158,13 +157,13 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
#if ($column.htmlType == "input" || $column.htmlType == "textarea" || $column.htmlType == "editor")
|
#if ($column.htmlType == "input" || $column.htmlType == "textarea" || $column.htmlType == "editor")
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
placeholder: '请输入${comment}',
|
placeholder: '请输入${comment}',
|
||||||
},
|
},
|
||||||
#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
|
#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
|
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
|
||||||
options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
|
options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
|
||||||
#else## 未设置 dictType 数据字典的情况
|
#else## 未设置 dictType 数据字典的情况
|
||||||
@ -176,7 +175,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...getRangePickerDefaultProps(),
|
...getRangePickerDefaultProps(),
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@ -186,7 +185,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function useGridColumns(): VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>['columns'] {
|
export function useGridColumns(): VxeTableGridOptions<${apiName}.${simpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
{ type: 'checkbox', width: 40 },
|
{ type: 'checkbox', width: 40 },
|
||||||
@ -361,13 +360,13 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] {
|
|||||||
#if ($column.htmlType == "input" || $column.htmlType == "textarea" || $column.htmlType == "editor")
|
#if ($column.htmlType == "input" || $column.htmlType == "textarea" || $column.htmlType == "editor")
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
placeholder: '请输入${comment}',
|
placeholder: '请输入${comment}',
|
||||||
},
|
},
|
||||||
#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
|
#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
|
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
|
||||||
options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
|
options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
|
||||||
#else## 未设置 dictType 数据字典的情况
|
#else## 未设置 dictType 数据字典的情况
|
||||||
@ -379,7 +378,7 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] {
|
|||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...getRangePickerDefaultProps(),
|
...getRangePickerDefaultProps(),
|
||||||
allowClear: true,
|
clearable: true,
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@ -389,7 +388,7 @@ export function use${subSimpleClassName}GridFormSchema(): VbenFormSchema[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 列表的字段 */
|
/** 列表的字段 */
|
||||||
export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
|
export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${apiName}.${subSimpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
{ type: 'checkbox', width: 40 },
|
{ type: 'checkbox', width: 40 },
|
||||||
@ -426,7 +425,7 @@ export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${sim
|
|||||||
#else
|
#else
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
/** 新增/修改列表的字段 */
|
/** 新增/修改列表的字段 */
|
||||||
export function use${subSimpleClassName}GridEditColumns(): VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>['columns'] {
|
export function use${subSimpleClassName}GridEditColumns(): VxeTableGridOptions<${apiName}.${subSimpleClassName}>['columns'] {
|
||||||
return [
|
return [
|
||||||
#foreach($column in $subColumns)
|
#foreach($column in $subColumns)
|
||||||
#if ($column.createOperation || $column.updateOperation)
|
#if ($column.createOperation || $column.updateOperation)
|
||||||
@ -602,4 +601,4 @@ export function use${subSimpleClassName}GridColumns(): VxeTableGridOptions<${sim
|
|||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -1,8 +1,16 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { ElMessage, ElTabs, ElTabPane, ElCheckbox, ElInput, ElSelect, ElRadioGroup, ElCheckboxGroup, ElDatePicker } from 'element-plus';
|
|
||||||
|
import { ElMessage#if ($table.templateType == 11), ElTabs, ElTabPane#end } from 'element-plus';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
import { $t } from '#/locales';
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
||||||
@ -12,21 +20,15 @@ import { ElMessage, ElTabs, ElTabPane, ElCheckbox, ElInput, ElSelect, ElRadioGro
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
|
||||||
import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<${simpleClassName}Api.${simpleClassName}>();
|
const formData = ref<${apiName}.${simpleClassName}>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['${table.classComment}'])
|
? $t('ui.actionTitle.edit', ['${table.classComment}'])
|
||||||
: $t('ui.actionTitle.create', ['${table.classComment}']);
|
: $t('ui.actionTitle.create', ['${table.classComment}']);
|
||||||
});
|
});
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
@ -51,7 +53,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: useFormSchema(),
|
schema: useFormSchema(),
|
||||||
showDefaultActions: false
|
showDefaultActions: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
@ -60,8 +62,8 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
// 校验子表单
|
// 校验子表单
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
@ -78,12 +80,12 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as ${simpleClassName}Api.${simpleClassName};
|
const data = (await formApi.getValues()) as ${apiName}.${simpleClassName};
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
#if ( $subTables && $subTables.size() > 0 )
|
#if ( $subTables && $subTables.size() > 0 )
|
||||||
// 拼接子表的数据
|
// 拼接子表的数据
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
@ -96,7 +98,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
try {
|
try {
|
||||||
await (formData.value?.id ? update${simpleClassName}(data) : create${simpleClassName}(data));
|
await (formData.value?.id ? update${simpleClassName}(data) : create${simpleClassName}(data));
|
||||||
// 关闭并提示
|
// 关闭并提示
|
||||||
@ -113,21 +115,24 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
let data = modalApi.getData<${simpleClassName}Api.${simpleClassName}>();
|
const data = modalApi.getData<${apiName}.${simpleClassName}>();
|
||||||
if (!data) {
|
if (!data || !data.id) {
|
||||||
|
#if (${table.templateType} == 2)## 树表特有
|
||||||
|
// 设置上级
|
||||||
|
await formApi.setValues(data);
|
||||||
|
#end
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data.id) {
|
modalApi.lock();
|
||||||
modalApi.lock();
|
try {
|
||||||
try {
|
formData.value = await get${simpleClassName}(data.id);
|
||||||
data = await get${simpleClassName}(data.id);
|
// 设置到 values
|
||||||
} finally {
|
if (formData.value) {
|
||||||
modalApi.unlock();
|
await formApi.setValues(formData.value);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
modalApi.unlock();
|
||||||
}
|
}
|
||||||
// 设置到 values
|
|
||||||
formData.value = data;
|
|
||||||
await formApi.setValues(formData.value);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -135,20 +140,20 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
<template>
|
<template>
|
||||||
<Modal :title="getTitle">
|
<Modal :title="getTitle">
|
||||||
<Form class="mx-4" />
|
<Form class="mx-4" />
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
#if ( $table.templateType == 10 || $table.templateType == 12 )
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<el-tabs v-model="subTabsName">
|
<ElTabs v-model="subTabsName">
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($index))
|
#set ($subClassNameVar = $subClassNameVars.get($index))
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||||
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
||||||
<el-tab-pane name="$subClassNameVar" label="${subTable.classComment}">
|
<ElTabPane name="$subClassNameVar" label="${subTable.classComment}">
|
||||||
<${subSimpleClassName}Form ref="${subClassNameVar}FormRef" :${subJoinColumn_strikeCase}="formData?.id" />
|
<${subSimpleClassName}Form ref="${subClassNameVar}FormRef" :${subJoinColumn_strikeCase}="formData?.id" />
|
||||||
</el-tab-pane>
|
</ElTabPane>
|
||||||
#end
|
#end
|
||||||
</el-tabs>
|
</ElTabs>
|
||||||
#end
|
#end
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -1,56 +1,67 @@
|
|||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { Page, useVbenModal } from '@vben/common-ui';
|
import { ref } from 'vue';
|
||||||
import { ElMessage, ElTabs, ElTabPane, ElLoading } from 'element-plus';
|
|
||||||
|
import {#if ($table.templateType != 2 && $deleteBatchEnable) confirm,#end Page, useVbenModal } from '@vben/common-ui';
|
||||||
|
import { downloadFileFromBlobPart#if ($table.templateType != 2 && $deleteBatchEnable), isEmpty#end } from '@vben/utils';
|
||||||
|
|
||||||
|
import { ElLoading, ElMessage#if ($table.templateType == 11), ElTabs, ElTabPane#end } from 'element-plus';
|
||||||
|
|
||||||
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
#if (${table.templateType} == 2)## 树表接口
|
||||||
|
import {
|
||||||
|
delete${simpleClassName},
|
||||||
|
export${simpleClassName},
|
||||||
|
get${simpleClassName}List,
|
||||||
|
} from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
#else## 标准表接口
|
||||||
|
import {
|
||||||
|
delete${simpleClassName},#if ($deleteBatchEnable)
|
||||||
|
|
||||||
|
delete${simpleClassName}List,#end
|
||||||
|
export${simpleClassName},
|
||||||
|
get${simpleClassName}Page,
|
||||||
|
} from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
#end
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
import Form from './modules/form.vue';
|
import Form from './modules/form.vue';
|
||||||
|
|
||||||
## 特殊:主子表专属逻辑
|
## 特殊:主子表专属逻辑
|
||||||
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
#if ( $table.templateType == 11 || $table.templateType == 12 )
|
||||||
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
#foreach ($subSimpleClassName in $subSimpleClassNames)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
|
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index))
|
||||||
import ${subSimpleClassName}List from './modules/${subSimpleClassName_strikeCase}-list.vue'
|
import ${subSimpleClassName}List from './modules/${subSimpleClassName_strikeCase}-list.vue';
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
import { ref, computed } from 'vue';
|
|
||||||
import { $t } from '#/locales';
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
||||||
#if (${table.templateType} == 2)## 树表接口
|
|
||||||
import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
#else## 标准表接口
|
|
||||||
import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}List,#end export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
|
||||||
#end
|
|
||||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
|
||||||
|
|
||||||
import { useGridColumns, useGridFormSchema } from './data';
|
|
||||||
|
|
||||||
#if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况
|
#if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况
|
||||||
/** 子表的列表 */
|
/** 子表的列表 */
|
||||||
const subTabsName = ref('$subClassNameVars.get(0)')
|
const subTabsName = ref('$subClassNameVars.get(0)')
|
||||||
#if ($table.templateType == 11)
|
#if ($table.templateType == 11)
|
||||||
const select${simpleClassName} = ref<${simpleClassName}Api.${simpleClassName}>();
|
const select${simpleClassName} = ref<${apiName}.${simpleClassName}>();
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const [FormModal, formModalApi] = useVbenModal({
|
const [FormModal, formModalApi] = useVbenModal({
|
||||||
connectedComponent: Form,
|
connectedComponent: Form,
|
||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
#if (${table.templateType} == 2)## 树表特有:控制表格展开收缩
|
#if (${table.templateType} == 2)## 树表特有:控制表格展开收缩
|
||||||
|
|
||||||
/** 切换树形展开/收缩状态 */
|
/** 切换树形展开/收缩状态 */
|
||||||
const isExpanded = ref(true);
|
const isExpanded = ref(true);
|
||||||
function toggleExpand() {
|
function handleExpand() {
|
||||||
isExpanded.value = !isExpanded.value;
|
isExpanded.value = !isExpanded.value;
|
||||||
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
#if ($table.templateType == 12) ## 内嵌情况
|
#if ($table.templateType == 12) ## 内嵌情况
|
||||||
gridApi.reload();
|
gridApi.reload();
|
||||||
#else
|
#else
|
||||||
@ -60,31 +71,30 @@ function onRefresh() {
|
|||||||
|
|
||||||
/** 创建${table.classComment} */
|
/** 创建${table.classComment} */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData({}).open();
|
formModalApi.setData(null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑${table.classComment} */
|
|
||||||
function handleEdit(row: ${simpleClassName}Api.${simpleClassName}) {
|
|
||||||
formModalApi.setData(row).open();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (${table.templateType} == 2)## 树表特有:新增下级
|
#if (${table.templateType} == 2)## 树表特有:新增下级
|
||||||
/** 新增下级${table.classComment} */
|
|
||||||
function handleAppend(row: ${simpleClassName}Api.${simpleClassName}) {
|
/** 添加下级${table.classComment} */
|
||||||
|
function handleAppend(row: ${apiName}.${simpleClassName}) {
|
||||||
formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open();
|
formModalApi.setData({ ${treeParentColumn.javaField}: row.id }).open();
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
/** 编辑${table.classComment} */
|
||||||
|
function handleEdit(row: ${apiName}.${simpleClassName}) {
|
||||||
|
formModalApi.setData(row).open();
|
||||||
|
}
|
||||||
|
|
||||||
/** 删除${table.classComment} */
|
/** 删除${table.classComment} */
|
||||||
async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
async function handleDelete(row: ${apiName}.${simpleClassName}) {
|
||||||
const loadingInstance = ElLoading.service({
|
const loadingInstance = ElLoading.service({
|
||||||
text: $t('ui.actionMessage.deleting', [row.id]),
|
text: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}(row.id as number);
|
await delete${simpleClassName}(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
@ -93,27 +103,27 @@ async function handleDelete(row: ${simpleClassName}Api.${simpleClassName}) {
|
|||||||
#if ($table.templateType != 2 && $deleteBatchEnable)
|
#if ($table.templateType != 2 && $deleteBatchEnable)
|
||||||
/** 批量删除${table.classComment} */
|
/** 批量删除${table.classComment} */
|
||||||
async function handleDeleteBatch() {
|
async function handleDeleteBatch() {
|
||||||
|
await confirm($t('ui.actionMessage.deleteBatchConfirm'));
|
||||||
const loadingInstance = ElLoading.service({
|
const loadingInstance = ElLoading.service({
|
||||||
text: $t('ui.actionMessage.deleting'),
|
text: $t('ui.actionMessage.deletingBatch'),
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${simpleClassName}List(checkedIds.value);
|
await delete${simpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkedIds = ref<number[]>([])
|
const checkedIds = ref<number[]>([]);
|
||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
}: {
|
}: {
|
||||||
records: ${simpleClassName}Api.${simpleClassName}[];
|
records: ${apiName}.${simpleClassName}[];
|
||||||
}) {
|
}) {
|
||||||
checkedIds.value = records.map((item) => item.id);
|
checkedIds.value = records.map((item) => item.id!);
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@ -135,20 +145,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
#end
|
#end
|
||||||
#if (${table.templateType} == 2)## 树表设置
|
#if (${table.templateType} == 2)## 树表设置
|
||||||
treeConfig: {
|
|
||||||
parentField: '${treeParentColumn.javaField}',
|
|
||||||
rowField: 'id',
|
|
||||||
transform: true,
|
|
||||||
expandAll: true,
|
|
||||||
reserve: true,
|
|
||||||
},
|
|
||||||
pagerConfig: {
|
|
||||||
enabled: false,
|
|
||||||
},
|
|
||||||
#else## 标准表设置
|
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
#else## 标准表设置
|
||||||
|
keepSource: true,
|
||||||
#end
|
#end
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
@ -178,27 +179,35 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
refresh: true,
|
refresh: true,
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<${simpleClassName}Api.${simpleClassName}>,
|
#if (${table.templateType} == 2)## 树表设置
|
||||||
#if (${table.templateType} == 11 || $deleteBatchEnable)
|
treeConfig: {
|
||||||
gridEvents:{
|
parentField: '${treeParentColumn.javaField}',
|
||||||
#if(${table.templateType} == 11)
|
rowField: 'id',
|
||||||
cellClick: ({ row }: { row: ${simpleClassName}Api.${simpleClassName}}) => {
|
transform: true,
|
||||||
|
expandAll: true,
|
||||||
|
reserve: true,
|
||||||
|
},
|
||||||
|
#end
|
||||||
|
} as VxeTableGridOptions<${apiName}.${simpleClassName}>,
|
||||||
|
#if (${table.templateType} == 11 || (${table.templateType} != 2 && $deleteBatchEnable))
|
||||||
|
gridEvents: {
|
||||||
|
#if(${table.templateType} == 11)
|
||||||
|
cellClick: ({ row }: { row: ${apiName}.${simpleClassName}}) => {
|
||||||
select${simpleClassName}.value = row;
|
select${simpleClassName}.value = row;
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
#if(${table.templateType} != 2 && $deleteBatchEnable)
|
#if (${table.templateType} != 2 && $deleteBatchEnable)
|
||||||
checkboxAll: handleRowCheckboxChange,
|
checkboxAll: handleRowCheckboxChange,
|
||||||
checkboxChange: handleRowCheckboxChange,
|
checkboxChange: handleRowCheckboxChange,
|
||||||
#end
|
#end
|
||||||
}
|
},
|
||||||
#end
|
#end
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page auto-content-height>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp情况
|
#if ($table.templateType == 11) ## erp情况
|
||||||
<div>
|
<div>
|
||||||
#end
|
#end
|
||||||
@ -206,29 +215,22 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
#if ($table.templateType == 12) ## 内嵌情况
|
#if ($table.templateType == 12) ## 内嵌情况
|
||||||
<template #expand_content="{ row }">
|
<template #expand_content="{ row }">
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<el-tabs v-model="subTabsName" class="mx-8">
|
<ElTabs v-model="subTabsName" class="mx-8">
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($index))
|
#set ($subClassNameVar = $subClassNameVars.get($index))
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||||
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
||||||
<el-tab-pane name="$subClassNameVar" label="${subTable.classComment}">
|
<ElTabPane name="$subClassNameVar" label="${subTable.classComment}">
|
||||||
<${subSimpleClassName}List :${subJoinColumn_strikeCase}="row?.id" />
|
<${subSimpleClassName}List :${subJoinColumn_strikeCase}="row?.id" />
|
||||||
</el-tab-pane>
|
</ElTabPane>
|
||||||
#end
|
#end
|
||||||
</el-tabs>
|
</ElTabs>
|
||||||
</template>
|
</template>
|
||||||
#end
|
#end
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
#if (${table.templateType} == 2)## 树表特有:展开/收缩按钮
|
|
||||||
{
|
|
||||||
label: isExpanded ? '收缩' : '展开',
|
|
||||||
type: 'primary',
|
|
||||||
onClick: toggleExpand,
|
|
||||||
},
|
|
||||||
#end
|
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.create', ['${table.classComment}']),
|
label: $t('ui.actionTitle.create', ['${table.classComment}']),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -236,6 +238,13 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
||||||
onClick: handleCreate,
|
onClick: handleCreate,
|
||||||
},
|
},
|
||||||
|
#if (${table.templateType} == 2)## 树表特有:展开/收缩按钮
|
||||||
|
{
|
||||||
|
label: isExpanded ? '收缩' : '展开',
|
||||||
|
type: 'primary',
|
||||||
|
onClick: handleExpand,
|
||||||
|
},
|
||||||
|
#end
|
||||||
{
|
{
|
||||||
label: $t('ui.actionTitle.export'),
|
label: $t('ui.actionTitle.export'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
@ -248,8 +257,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
label: $t('ui.actionTitle.deleteBatch'),
|
label: $t('ui.actionTitle.deleteBatch'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
disabled: isEmpty(checkedIds),
|
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
||||||
|
disabled: isEmpty(checkedIds),
|
||||||
onClick: handleDeleteBatch,
|
onClick: handleDeleteBatch,
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
@ -262,7 +271,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
#if (${table.templateType} == 2)## 树表特有:新增下级
|
#if (${table.templateType} == 2)## 树表特有:新增下级
|
||||||
{
|
{
|
||||||
label: '新增下级',
|
label: '新增下级',
|
||||||
type: 'text',
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
icon: ACTION_ICON.ADD,
|
icon: ACTION_ICON.ADD,
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:create'],
|
||||||
onClick: handleAppend.bind(null, row),
|
onClick: handleAppend.bind(null, row),
|
||||||
@ -270,7 +280,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
#end
|
#end
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'text',
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:update'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:update'],
|
||||||
onClick: handleEdit.bind(null, row),
|
onClick: handleEdit.bind(null, row),
|
||||||
@ -278,7 +289,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
text: true,
|
link: true,
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
@ -290,21 +301,20 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp情况
|
#if ($table.templateType == 11) ## erp情况
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<el-tabs v-model="subTabsName" class="mt-2">
|
<ElTabs v-model="subTabsName" class="mt-2">
|
||||||
#foreach ($subTable in $subTables)
|
#foreach ($subTable in $subTables)
|
||||||
#set ($index = $foreach.count - 1)
|
#set ($index = $foreach.count - 1)
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($index))
|
#set ($subClassNameVar = $subClassNameVars.get($index))
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($index))
|
||||||
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index))
|
||||||
<el-tab-pane name="$subClassNameVar" label="${subTable.classComment}">
|
<ElTabPane name="$subClassNameVar" label="${subTable.classComment}">
|
||||||
<${subSimpleClassName}List :${subJoinColumn_strikeCase}="select${simpleClassName}?.id" />
|
<${subSimpleClassName}List :${subJoinColumn_strikeCase}="select${simpleClassName}?.id" />
|
||||||
</el-tab-pane>
|
</ElTabPane>
|
||||||
#end
|
#end
|
||||||
</el-tabs>
|
</ElTabs>
|
||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
@ -2,21 +2,24 @@
|
|||||||
#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组
|
#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组
|
||||||
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
|
||||||
import { ElMessage } from 'element-plus';
|
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { $t } from '#/locales';
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { use${subSimpleClassName}FormSchema } from '../data';
|
import { use${subSimpleClassName}FormSchema } from '../data';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<${simpleClassName}Api.${subSimpleClassName}>();
|
const formData = ref<${apiName}.${subSimpleClassName}>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
? $t('ui.actionTitle.edit', ['${subTable.classComment}'])
|
||||||
@ -45,7 +48,7 @@
|
|||||||
|
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as ${simpleClassName}Api.${subSimpleClassName};
|
const data = (await formApi.getValues()) as ${apiName}.${subSimpleClassName};
|
||||||
data.${subJoinColumn.javaField} = formData.value?.${subJoinColumn.javaField};
|
data.${subJoinColumn.javaField} = formData.value?.${subJoinColumn.javaField};
|
||||||
try {
|
try {
|
||||||
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
await (formData.value?.id ? update${subSimpleClassName}(data) : create${subSimpleClassName}(data));
|
||||||
@ -64,7 +67,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
let data = modalApi.getData<${simpleClassName}Api.${subSimpleClassName}>();
|
let data = modalApi.getData<${apiName}.${subSimpleClassName}>();
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,12 @@
|
|||||||
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
|
||||||
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
#set ($subClassNameVar = $subClassNameVars.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
|
||||||
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
@ -33,7 +35,7 @@ const props = defineProps<{
|
|||||||
function onActionClick({
|
function onActionClick({
|
||||||
code,
|
code,
|
||||||
row,
|
row,
|
||||||
}: OnActionClickParams<${simpleClassName}Api.${subSimpleClassName}>) {
|
}: OnActionClickParams<${apiName}.${subSimpleClassName}>) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
onDelete(row);
|
onDelete(row);
|
||||||
@ -67,16 +69,16 @@ const onAdd = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
const onDelete = async (row: ${simpleClassName}Api.${subSimpleClassName}) => {
|
const onDelete = async (row: ${apiName}.${subSimpleClassName}) => {
|
||||||
await gridApi.grid.remove(row);
|
await gridApi.grid.remove(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提供获取表格数据的方法供父组件调用 */
|
/** 提供获取表格数据的方法供父组件调用 */
|
||||||
defineExpose({
|
defineExpose({
|
||||||
getData: (): ${simpleClassName}Api.${subSimpleClassName}[] => {
|
getData: (): ${apiName}.${subSimpleClassName}[] => {
|
||||||
const data = gridApi.grid.getData() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const data = gridApi.grid.getData() as ${apiName}.${subSimpleClassName}[];
|
||||||
const removeRecords = gridApi.grid.getRemoveRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const removeRecords = gridApi.grid.getRemoveRecords() as ${apiName}.${subSimpleClassName}[];
|
||||||
const insertRecords = gridApi.grid.getInsertRecords() as ${simpleClassName}Api.${subSimpleClassName}[];
|
const insertRecords = gridApi.grid.getInsertRecords() as ${apiName}.${subSimpleClassName}[];
|
||||||
return data
|
return data
|
||||||
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
.filter((row) => !removeRecords.some((removed) => removed.id === row.id))
|
||||||
.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
.concat(insertRecords.map((row: any) => ({ ...row, id: undefined })));
|
||||||
|
|||||||
@ -5,9 +5,10 @@
|
|||||||
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段
|
||||||
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
|
||||||
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
|
||||||
|
#set ($apiName = "${table.moduleName.substring(0,1).toUpperCase()}${table.moduleName.substring(1)}${simpleClassName}Api")
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
|
import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
|
||||||
|
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
|
||||||
@ -41,6 +42,19 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 刷新表格 */
|
||||||
|
async function handleRefresh() {
|
||||||
|
#if ($table.templateType == 11) ## erp
|
||||||
|
await gridApi.query();
|
||||||
|
#else
|
||||||
|
#if ($subTable.subJoinMany) ## 一对多
|
||||||
|
await gridApi.grid.loadData(await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!));
|
||||||
|
#else
|
||||||
|
await gridApi.grid.loadData([await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)]);
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
/** 创建${subTable.classComment} */
|
/** 创建${subTable.classComment} */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
if (!props.${subJoinColumn.javaField}){
|
if (!props.${subJoinColumn.javaField}){
|
||||||
@ -51,20 +65,19 @@ function handleCreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑${subTable.classComment} */
|
/** 编辑${subTable.classComment} */
|
||||||
function handleEdit(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
function handleEdit(row: ${apiName}.${subSimpleClassName}) {
|
||||||
formModalApi.setData(row).open();
|
formModalApi.setData(row).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除${subTable.classComment} */
|
/** 删除${subTable.classComment} */
|
||||||
async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
async function handleDelete(row: ${apiName}.${subSimpleClassName}) {
|
||||||
const loadingInstance = ElLoading.service({
|
const loadingInstance = ElLoading.service({
|
||||||
text: $t('ui.actionMessage.deleting', [row.id]),
|
text: $t('ui.actionMessage.deleting', [row.id]),
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}(row.id as number);
|
await delete${subSimpleClassName}(row.id!);
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
@ -75,13 +88,12 @@ async function handleDelete(row: ${simpleClassName}Api.${subSimpleClassName}) {
|
|||||||
async function handleDeleteBatch() {
|
async function handleDeleteBatch() {
|
||||||
const loadingInstance = ElLoading.service({
|
const loadingInstance = ElLoading.service({
|
||||||
text: $t('ui.actionMessage.deleting'),
|
text: $t('ui.actionMessage.deleting'),
|
||||||
background: 'rgba(0, 0, 0, 0.7)',
|
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await delete${subSimpleClassName}List(checkedIds.value);
|
await delete${subSimpleClassName}List(checkedIds.value);
|
||||||
checkedIds.value = [];
|
checkedIds.value = [];
|
||||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
} finally {
|
} finally {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
}
|
}
|
||||||
@ -91,7 +103,7 @@ const checkedIds = ref<number[]>([])
|
|||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
}: {
|
}: {
|
||||||
records: ${simpleClassName}Api.${subSimpleClassName}[];
|
records: ${apiName}.${subSimpleClassName}[];
|
||||||
}) {
|
}) {
|
||||||
checkedIds.value = records.map((item) => item.id);
|
checkedIds.value = records.map((item) => item.id);
|
||||||
}
|
}
|
||||||
@ -143,7 +155,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
isHover: true,
|
isHover: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<${simpleClassName}Api.${subSimpleClassName}>,
|
} as VxeTableGridOptions<${apiName}.${subSimpleClassName}>,
|
||||||
#if (${table.templateType} == 11 && $deleteBatchEnable)
|
#if (${table.templateType} == 11 && $deleteBatchEnable)
|
||||||
gridEvents:{
|
gridEvents:{
|
||||||
checkboxAll: handleRowCheckboxChange,
|
checkboxAll: handleRowCheckboxChange,
|
||||||
@ -152,19 +164,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
#end
|
#end
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 刷新表格 */
|
|
||||||
async function onRefresh() {
|
|
||||||
#if ($table.templateType == 11) ## erp
|
|
||||||
await gridApi.query();
|
|
||||||
#else
|
|
||||||
#if ($subTable.subJoinMany) ## 一对多
|
|
||||||
await gridApi.grid.loadData(await get${subSimpleClassName}ListBy${SubJoinColumnName}(props.${subJoinColumn.javaField}!));
|
|
||||||
#else
|
|
||||||
await gridApi.grid.loadData([await get${subSimpleClassName}By${SubJoinColumnName}(props.${subJoinColumn.javaField}!)]);
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
/** 监听主表的关联字段的变化,加载对应的子表数据 */
|
||||||
watch(
|
watch(
|
||||||
() => props.${subJoinColumn.javaField},
|
() => props.${subJoinColumn.javaField},
|
||||||
@ -173,7 +172,7 @@ watch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await onRefresh()
|
await handleRefresh()
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
@ -181,7 +180,7 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
#if ($table.templateType == 11) ## erp
|
#if ($table.templateType == 11) ## erp
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid table-title="${subTable.classComment}列表">
|
<Grid table-title="${subTable.classComment}列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
@ -211,7 +210,8 @@ watch(
|
|||||||
:actions="[
|
:actions="[
|
||||||
{
|
{
|
||||||
label: $t('common.edit'),
|
label: $t('common.edit'),
|
||||||
type: 'text',
|
type: 'primary',
|
||||||
|
link: true,
|
||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:update'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:update'],
|
||||||
onClick: handleEdit.bind(null, row),
|
onClick: handleEdit.bind(null, row),
|
||||||
@ -219,7 +219,7 @@ watch(
|
|||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
text: true,
|
link: true,
|
||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
auth: ['${table.moduleName}:${simpleClassName_strikeCase}:delete'],
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user