【升级】代码生成模块增加批量删除及导出功能
This commit is contained in:
parent
c488abdd21
commit
f69b058ed0
@ -88,7 +88,7 @@ public class XnVelocityContext {
|
|||||||
|
|
||||||
// sql中id的创建
|
// sql中id的创建
|
||||||
List<Long> idList = new ArrayList<>();
|
List<Long> idList = new ArrayList<>();
|
||||||
for (int a = 0; a <= 6; a++) {
|
for (int a = 0; a <= 7; a++) {
|
||||||
idList.add(Math.abs(UUID.randomUUID().getLeastSignificantBits()));
|
idList.add(Math.abs(UUID.randomUUID().getLeastSignificantBits()));
|
||||||
}
|
}
|
||||||
velocityContext.put("sqlMenuId", idList);
|
velocityContext.put("sqlMenuId", idList);
|
||||||
|
@ -22,21 +22,25 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|||||||
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
||||||
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||||
*/
|
*/
|
||||||
package ${packageName}.${modularName}.${busName}.controller;
|
package ${packageName}import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import vip.xiaonuo.core.annotion.BusinessLog;
|
import vip.xiaonuo.core.annotion.BusinessLog;
|
||||||
import vip.xiaonuo.core.annotion.Permission;
|
import vip.xiaonuo.core.annotion.Permission;
|
||||||
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
|
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
|
||||||
import vip.xiaonuo.core.pojo.response.ResponseData;
|
import vip.xiaonuo.core.pojo.response.ResponseData;
|
||||||
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
|
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
|
||||||
import ${packageName}.${modularName}.${busName}.param.${ClassName}Param;
|
|
||||||
import ${packageName}.${modularName}.${busName}.service.${ClassName}Service;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
.${modularName}.${busName}.controller;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.param.${ClassName}Param;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.service.${ClassName}Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}控制器
|
* ${functionName}控制器
|
||||||
@ -78,7 +82,7 @@ public class ${ClassName}Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除${functionName}
|
* 删除${functionName},可批量删除
|
||||||
*
|
*
|
||||||
* @author ${authorName}
|
* @author ${authorName}
|
||||||
* @date ${createDateString}
|
* @date ${createDateString}
|
||||||
@ -86,8 +90,8 @@ public class ${ClassName}Controller {
|
|||||||
@Permission
|
@Permission
|
||||||
@PostMapping("/${className}/delete")
|
@PostMapping("/${className}/delete")
|
||||||
@BusinessLog(title = "${functionName}_删除", opType = LogAnnotionOpTypeEnum.DELETE)
|
@BusinessLog(title = "${functionName}_删除", opType = LogAnnotionOpTypeEnum.DELETE)
|
||||||
public ResponseData delete(@RequestBody @Validated(${ClassName}Param.delete.class) ${ClassName}Param ${className}Param) {
|
public ResponseData delete(@RequestBody @Validated(${ClassName}Param.delete.class) List<${ClassName}Param> ${className}ParamList) {
|
||||||
${className}Service.delete(${className}Param);
|
${className}Service.delete(${className}ParamList);
|
||||||
return new SuccessResponseData();
|
return new SuccessResponseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,4 +135,17 @@ public class ${ClassName}Controller {
|
|||||||
return new SuccessResponseData(${className}Service.list(${className}Param));
|
return new SuccessResponseData(${className}Service.list(${className}Param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出系统用户
|
||||||
|
*
|
||||||
|
* @author ${authorName}
|
||||||
|
* @date ${createDateString}
|
||||||
|
*/
|
||||||
|
@Permission
|
||||||
|
@GetMapping("/${className}/export")
|
||||||
|
@BusinessLog(title = "${functionName}_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
|
||||||
|
public void export(${ClassName}Param ${className}Param) {
|
||||||
|
${className}Service.export(${className}Param);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,20 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|||||||
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
||||||
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||||
*/
|
*/
|
||||||
package ${packageName}.${modularName}.${busName}.enums;
|
package ${packageName}import vip.xiaonuo.core.annotion.ExpEnumType;
|
||||||
|
|
||||||
import vip.xiaonuo.core.annotion.ExpEnumType;
|
|
||||||
import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum;
|
import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum;
|
||||||
import vip.xiaonuo.core.factory.ExpEnumCodeFactory;
|
import vip.xiaonuo.core.factory.ExpEnumCodeFactory;
|
||||||
import vip.xiaonuo.sys.core.consts.SysExpEnumConstant;
|
import vip.xiaonuo.sys.core.consts.SysExpEnumConstant;
|
||||||
|
|
||||||
|
.${modularName}.${busName}.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}
|
* ${functionName}
|
||||||
*
|
*
|
||||||
* @author ${authorName}
|
* @author ${authorName}
|
||||||
* @date ${createDateString}
|
* @date ${createDateString}
|
||||||
*/
|
*/
|
||||||
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE, kind = SysExpEnumConstant.SYS_POS_EXCEPTION_ENUM)
|
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
|
||||||
public enum ${ClassName}ExceptionEnum implements AbstractBaseExceptionEnum {
|
public enum ${ClassName}ExceptionEnum implements AbstractBaseExceptionEnum {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,3 +69,18 @@ export function ${className}Delete (parameter) {
|
|||||||
data: parameter
|
data: parameter
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出${functionName}
|
||||||
|
*
|
||||||
|
* @author ${authorName}
|
||||||
|
* @date ${createDateString}
|
||||||
|
*/
|
||||||
|
export function ${className}Export (parameter) {
|
||||||
|
return axios({
|
||||||
|
url: '/${className}/export',
|
||||||
|
method: 'get',
|
||||||
|
params: parameter,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -22,14 +22,17 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|||||||
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
||||||
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||||
*/
|
*/
|
||||||
package ${packageName}.${modularName}.${busName}.service;
|
package ${packageName}import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import vip.xiaonuo.core.pojo.page.PageResult;
|
import vip.xiaonuo.core.pojo.page.PageResult;
|
||||||
import ${packageName}.${modularName}.${busName}.entity.${ClassName};
|
|
||||||
import ${packageName}.${modularName}.${busName}.param.${ClassName}Param;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
.${modularName}.${busName}.service;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.entity.${ClassName};
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.param.${ClassName}Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}service接口
|
* ${functionName}service接口
|
||||||
*
|
*
|
||||||
@ -68,7 +71,7 @@ public interface ${ClassName}Service extends IService<${ClassName}> {
|
|||||||
* @author ${authorName}
|
* @author ${authorName}
|
||||||
* @date ${createDateString}
|
* @date ${createDateString}
|
||||||
*/
|
*/
|
||||||
void delete(${ClassName}Param ${className}Param);
|
void delete(List<${ClassName}Param> ${className}ParamList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑${functionName}
|
* 编辑${functionName}
|
||||||
@ -85,4 +88,13 @@ public interface ${ClassName}Service extends IService<${ClassName}> {
|
|||||||
* @date ${createDateString}
|
* @date ${createDateString}
|
||||||
*/
|
*/
|
||||||
${ClassName} detail(${ClassName}Param ${className}Param);
|
${ClassName} detail(${ClassName}Param ${className}Param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出${functionName}
|
||||||
|
*
|
||||||
|
* @author ${authorName}
|
||||||
|
* @date ${createDateString}
|
||||||
|
*/
|
||||||
|
void export(${ClassName}Param ${className}Param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,29 +22,30 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|||||||
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
||||||
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||||
*/
|
*/
|
||||||
package ${packageName}.${modularName}.${busName}.service.impl;
|
package ${packageName}import cn.hutool.core.bean.BeanUtil;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.springframework.stereotype.Service;
|
||||||
import vip.xiaonuo.core.consts.CommonConstant;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import vip.xiaonuo.core.enums.CommonStatusEnum;
|
|
||||||
import vip.xiaonuo.core.exception.ServiceException;
|
import vip.xiaonuo.core.exception.ServiceException;
|
||||||
import vip.xiaonuo.core.factory.PageFactory;
|
import vip.xiaonuo.core.factory.PageFactory;
|
||||||
import vip.xiaonuo.core.pojo.page.PageResult;
|
import vip.xiaonuo.core.pojo.page.PageResult;
|
||||||
import ${packageName}.${modularName}.${busName}.entity.${ClassName};
|
import vip.xiaonuo.core.util.PoiUtil;
|
||||||
import ${packageName}.${modularName}.${busName}.enums.${ClassName}ExceptionEnum;
|
|
||||||
import ${packageName}.${modularName}.${busName}.mapper.${ClassName}Mapper;
|
|
||||||
import ${packageName}.${modularName}.${busName}.param.${ClassName}Param;
|
|
||||||
import ${packageName}.${modularName}.${busName}.service.${ClassName}Service;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
.${modularName}.${busName}.service.impl;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.entity.${ClassName};
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.enums.${ClassName}ExceptionEnum;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.mapper.${ClassName}Mapper;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.param.${ClassName}Param;
|
||||||
|
${packageName}
|
||||||
|
.${modularName}.${busName}.service.${ClassName}Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}service接口实现类
|
* ${functionName}service接口实现类
|
||||||
*
|
*
|
||||||
@ -85,12 +86,14 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void delete(${ClassName}Param ${className}Param) {
|
public void delete(List<${ClassName}Param> ${className}ParamList) {
|
||||||
|
${className}ParamList.forEach(${className}Param -> {
|
||||||
#foreach ($column in $tableField)
|
#foreach ($column in $tableField)
|
||||||
#if (${column.columnKey} == "PRI")
|
#if (${column.columnKey} == "PRI")
|
||||||
this.removeById(${className}Param.get${column.columnKeyName}());
|
this.removeById(${className}Param.get${column.columnKeyName}());
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -123,4 +126,11 @@ public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${C
|
|||||||
}
|
}
|
||||||
return ${className};
|
return ${className};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void export(${ClassName}Param ${className}Param) {
|
||||||
|
List<${ClassName}> list = this.list(${className}Param);
|
||||||
|
PoiUtil.exportExcelWithStream("Snowy${ClassName}.xls", ${ClassName}.class, list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,9 @@ INSERT INTO `sys_menu` VALUES
|
|||||||
#elseif($foreach.count == 7)
|
#elseif($foreach.count == 7)
|
||||||
INSERT INTO `sys_menu` VALUES
|
INSERT INTO `sys_menu` VALUES
|
||||||
('$id', '$pid', '[0],[$pid],', '${functionName}列表', '${busName}_index_list', '2', null, null, null, '${className}:list', 'system_tool', '0', 'Y', null, null, '1', '100', null, '0', null, null, null, null);
|
('$id', '$pid', '[0],[$pid],', '${functionName}列表', '${busName}_index_list', '2', null, null, null, '${className}:list', 'system_tool', '0', 'Y', null, null, '1', '100', null, '0', null, null, null, null);
|
||||||
|
|
||||||
|
#elseif($foreach.count == 8)
|
||||||
|
INSERT INTO `sys_menu` VALUES
|
||||||
|
('$id', '$pid', '[0],[$pid],', '${functionName}导出', '${busName}_index_export', '2', null, null, null, '${className}:export', 'system_tool', '0', 'Y', null, null, '1', '100', null, '0', null, null, null, null);
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
@ -30,5 +30,9 @@ INSERT INTO `sys_menu` VALUES
|
|||||||
#elseif($foreach.count == 7)
|
#elseif($foreach.count == 7)
|
||||||
INSERT INTO "sys_menu" VALUES
|
INSERT INTO "sys_menu" VALUES
|
||||||
("$id", "$pid", "[0],[$pid],", "${functionName}列表", "${busName}_index_list", "2", null, null, null, "${className}:list", "system_tool", "0", "Y", null, null, "1", "100", null, "0", null, null, null, null);
|
("$id", "$pid", "[0],[$pid],", "${functionName}列表", "${busName}_index_list", "2", null, null, null, "${className}:list", "system_tool", "0", "Y", null, null, "1", "100", null, "0", null, null, null, null);
|
||||||
|
|
||||||
|
#elseif($foreach.count == 7)
|
||||||
|
INSERT INTO "sys_menu" VALUES
|
||||||
|
("$id", "$pid", "[0],[$pid],", "${functionName}导出", "${busName}_index_export", "2", null, null, null, "${className}:export", "system_tool", "0", "Y", null, null, "1", "100", null, "0", null, null, null, null);
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
@ -22,19 +22,16 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|||||||
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
|
||||||
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
|
||||||
*/
|
*/
|
||||||
package ${packageName}.${modularName}.${busName}.entity;
|
package ${packageName}import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import vip.xiaonuo.core.pojo.base.entity.BaseEntity;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.util.*;
|
|
||||||
#foreach ($column in $tableField)
|
.${modularName}.${busName}.entity;
|
||||||
#if (${column.javaType} == 'BigDecimal')
|
#foreach($column in $tableField)
|
||||||
import java.math.BigDecimal;
|
#if(${column.javaType}=='BigDecimal')
|
||||||
#end
|
|
||||||
#if(${column.javaType} == "Date")
|
|
||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
@ -64,6 +61,7 @@ public class ${ClassName} extends BaseEntity {
|
|||||||
#if(${column.javaType} == "Date")
|
#if(${column.javaType} == "Date")
|
||||||
@Excel(name = "${column.columnComment}", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
|
@Excel(name = "${column.columnComment}", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
|
||||||
#end
|
#end
|
||||||
|
@Excel(name = "${column.columnComment}")
|
||||||
private ${column.javaType} ${column.javaName};
|
private ${column.javaType} ${column.javaName};
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
@ -104,16 +104,22 @@
|
|||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
:alert="true"
|
:alert="options.alert"
|
||||||
#foreach ($column in $tableField)
|
#foreach ($column in $tableField)
|
||||||
#if (${column.columnKey} == "PRI")
|
#if (${column.columnKey} == "PRI")
|
||||||
:rowKey="(record) => record.${column.javaName}"
|
:rowKey="(record) => record.${column.javaName}"
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
:rowSelection="options.rowSelection"
|
||||||
>
|
>
|
||||||
<template class="table-operator" slot="operator" v-if="hasPerm('${className}:add')" >
|
<template class="table-operator" slot="operator" v-if="hasPerm('${className}:add')" >
|
||||||
<a-button type="primary" v-if="hasPerm('${className}:add')" icon="plus" @click="$refs.addForm.add()">新增${functionName}</a-button>
|
<a-button type="primary" v-if="hasPerm('${className}:add')" icon="plus" @click="$refs.addForm.add()">新增${functionName}</a-button>
|
||||||
|
<a-button type="danger" :disabled="selectedRowKeys.length < 1" v-if="hasPerm('${className}:delete')" @click="batchDelete"><a-icon type="delete"/>批量删除</a-button>
|
||||||
|
<x-down
|
||||||
|
v-if="hasPerm('${className}:export')"
|
||||||
|
ref="batchExport"
|
||||||
|
@batchExport="batchExport"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
#foreach ($column in $tableField)
|
#foreach ($column in $tableField)
|
||||||
#if(${column.whetherTable} == "Y")
|
#if(${column.whetherTable} == "Y")
|
||||||
@ -139,7 +145,7 @@
|
|||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<a v-if="hasPerm('${className}:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
<a v-if="hasPerm('${className}:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
||||||
<a-divider type="vertical" v-if="hasPerm('${className}:edit') & hasPerm('${className}:delete')"/>
|
<a-divider type="vertical" v-if="hasPerm('${className}:edit') & hasPerm('${className}:delete')"/>
|
||||||
<a-popconfirm v-if="hasPerm('${className}:delete')" placement="topRight" title="确认删除?" @confirm="() => ${className}Delete(record)">
|
<a-popconfirm v-if="hasPerm('${className}:delete')" placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)">
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</span>
|
</span>
|
||||||
@ -164,25 +170,25 @@
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if($Ellipsis == "Y")
|
#if($Ellipsis == "Y")
|
||||||
import { STable, Ellipsis } from '@/components'
|
import {Ellipsis, STable, XDown} from '@/components'
|
||||||
#else
|
import moment from 'moment'
|
||||||
import { STable } from '@/components'
|
import {${className}Delete, ${className}Export, ${className}Page} from '@/api/modular/main/'
|
||||||
|
import addForm from './addForm.vue'
|
||||||
|
import editForm from './editForm.vue'
|
||||||
|
#else
|
||||||
#end
|
#end
|
||||||
#if($DateQuery == "Y")
|
#if($DateQuery == "Y")
|
||||||
import moment from 'moment'
|
|
||||||
#end
|
#end
|
||||||
import { ${className}Page, ${className}Delete } from '@/api/modular/main/${busName}/${className}Manage'
|
export default {
|
||||||
import addForm from './addForm.vue'
|
|
||||||
import editForm from './editForm.vue'
|
|
||||||
export default {
|
|
||||||
components: {
|
components: {
|
||||||
#if($Ellipsis == "Y")
|
#if($Ellipsis == "Y")
|
||||||
Ellipsis,
|
Ellipsis,
|
||||||
#end
|
#end
|
||||||
STable,
|
STable,
|
||||||
addForm,
|
addForm,
|
||||||
editForm
|
editForm,
|
||||||
|
XDown
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@ -235,7 +241,14 @@
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
selectedRows: []
|
selectedRows: [],
|
||||||
|
options: {
|
||||||
|
alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
|
||||||
|
rowSelection: {
|
||||||
|
selectedRowKeys: this.selectedRowKeys,
|
||||||
|
onChange: this.onSelectChange
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@ -282,11 +295,35 @@
|
|||||||
return obj
|
return obj
|
||||||
},
|
},
|
||||||
#end
|
#end
|
||||||
|
/**
|
||||||
|
* 单个删除
|
||||||
|
*/
|
||||||
|
singleDelete (record) {
|
||||||
|
#foreach ($column in $tableField)
|
||||||
|
#if (${column.columnKey} == "PRI")
|
||||||
|
const param = [{ '${column.javaName}': record.${column.javaName} }]
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
this.${className}Delete(param)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*/
|
||||||
|
batchDelete () {
|
||||||
|
const paramIds = this.selectedRowKeys.map((d) => {
|
||||||
|
#foreach ($column in $tableField)
|
||||||
|
#if (${column.columnKey} == "PRI")
|
||||||
|
return { '${column.javaName}': d }
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
})
|
||||||
|
this.${className}Delete(paramIds)
|
||||||
|
},
|
||||||
${className}Delete (record) {
|
${className}Delete (record) {
|
||||||
${className}Delete(record).then((res) => {
|
${className}Delete(record).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('删除成功')
|
||||||
this.$refs.table.refresh()
|
this.$refs.table.clearRefreshSelected()
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('删除失败') // + res.message
|
this.$message.error('删除失败') // + res.message
|
||||||
}
|
}
|
||||||
@ -306,6 +343,21 @@
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
/**
|
||||||
|
* 批量导出
|
||||||
|
*/
|
||||||
|
batchExport () {
|
||||||
|
const paramIds = this.selectedRowKeys.map((d) => {
|
||||||
|
#foreach ($column in $tableField)
|
||||||
|
#if (${column.columnKey} == "PRI")
|
||||||
|
return { '${column.javaName}': d }
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
})
|
||||||
|
${className}Export(paramIds).then((res) => {
|
||||||
|
this.$refs.batchExport.downloadfile(res)
|
||||||
|
})
|
||||||
|
},
|
||||||
handleOk () {
|
handleOk () {
|
||||||
this.$refs.table.refresh()
|
this.$refs.table.refresh()
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user