mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
Jeecg Boot 2.2.1 版本发布,低代码平台
This commit is contained in:
15
jeecg-boot/jeecg-boot-module-system/Dockerfile
Normal file
15
jeecg-boot/jeecg-boot-module-system/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||
|
||||
MAINTAINER jeecgos@163.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
RUN mkdir -p /jeecg-boot
|
||||
|
||||
WORKDIR /jeecg-boot
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ADD ./target/jeecg-boot-module-system-2.2.1.jar ./
|
||||
|
||||
CMD sleep 60;java -Djava.security.egd=file:/dev/./urandom -jar jeecg-boot-module-system-2.2.1.jar
|
||||
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.2.1</version>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
|
||||
@ -5,46 +5,52 @@ import org.apache.catalina.Context;
|
||||
import org.apache.tomcat.util.scan.StandardJarScanner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
@Slf4j
|
||||
@EnableSwagger2
|
||||
@SpringBootApplication
|
||||
public class JeecgApplication {
|
||||
public class JeecgApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"Swagger-UI: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
return new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(JeecgApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
//System.setProperty("spring.devtools.restart.enabled", "true");
|
||||
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = env.getProperty("server.servlet.context-path");
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application Jeecg-Boot is running! Access URLs:\n\t" +
|
||||
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
|
||||
"----------------------------------------------------------");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* tomcat-embed-jasper引用后提示jar找不到的问题
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatFactory() {
|
||||
return new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,27 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.parser.ISqlParser;
|
||||
import com.baomidou.mybatisplus.core.parser.ISqlParserFilter;
|
||||
import com.baomidou.mybatisplus.core.parser.SqlParserHelper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
|
||||
import net.sf.jsqlparser.expression.operators.relational.InExpression;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.jeecg.config.mybatis.JeecgTenantParser;
|
||||
import org.jeecg.modules.system.util.TenantContext;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单数据源配置(jeecg.datasource.open = false时生效)
|
||||
@ -16,14 +33,82 @@ import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
* tenant_id 字段名
|
||||
*/
|
||||
public static final String tenant_field = "tenant_id";
|
||||
|
||||
/**
|
||||
* 有哪些表需要做多租户 这些表需要添加一个字段 ,字段名和tenant_field对应的值一样
|
||||
*/
|
||||
private static final List<String> tenantTable = new ArrayList<String>();
|
||||
static {
|
||||
tenantTable.add("jee_bug_danbiao");
|
||||
}
|
||||
|
||||
/**
|
||||
* 多租户属于 SQL 解析部分,依赖 MP 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
// 设置sql的limit为无限制,默认是500
|
||||
return new PaginationInterceptor().setLimit(-1);
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor().setLimit(-1);
|
||||
/*
|
||||
* 【测试多租户】 SQL 解析处理拦截器<br>
|
||||
* 这里固定写成住户 1 实际情况你可以从cookie读取,因此数据看不到 【 麻花藤 】 这条记录( 注意观察 SQL )<br>
|
||||
*/
|
||||
List<ISqlParser> sqlParserList = new ArrayList<>();
|
||||
TenantSqlParser tenantSqlParser = new JeecgTenantParser();
|
||||
tenantSqlParser.setTenantHandler(new TenantHandler() {
|
||||
|
||||
@Override
|
||||
public Expression getTenantId(boolean select) {
|
||||
String tenant_id = TenantContext.getTenant();
|
||||
return new LongValue(tenant_id);
|
||||
}
|
||||
@Override
|
||||
public String getTenantIdColumn() {
|
||||
return tenant_field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doTableFilter(String tableName) {
|
||||
//true则不加租户条件查询 false则加
|
||||
// return excludeTable.contains(tableName);
|
||||
if(tenantTable.contains(tableName)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Expression in(String ids){
|
||||
final InExpression inExpression = new InExpression();
|
||||
inExpression.setLeftExpression(new Column(getTenantIdColumn()));
|
||||
final ExpressionList itemsList = new ExpressionList();
|
||||
final List<Expression> inValues = new ArrayList<>(2);
|
||||
for(String id:ids.split(",")){
|
||||
inValues.add(new LongValue(id));
|
||||
}
|
||||
itemsList.setExpressions(inValues);
|
||||
inExpression.setRightItemsList(itemsList);
|
||||
return inExpression;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
sqlParserList.add(tenantSqlParser);
|
||||
paginationInterceptor.setSqlParserList(sqlParserList);
|
||||
paginationInterceptor.setSqlParserFilter(new ISqlParserFilter() {
|
||||
@Override
|
||||
public boolean doFilter(MetaObject metaObject) {
|
||||
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
|
||||
// 过滤自定义查询此时无租户信息约束【 麻花藤 】出现
|
||||
if ("com.baomidou.springboot.mapper.UserMapper.selectListBySQL".equals(ms.getId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * mybatis-plus SQL执行效率插件【生产环境可以关闭】
|
||||
// */
|
||||
@ -31,6 +116,5 @@ public class MybatisPlusConfig {
|
||||
// public PerformanceInterceptor performanceInterceptor() {
|
||||
// return new PerformanceInterceptor();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,7 +8,9 @@ import org.apache.shiro.spring.LifecycleBeanPostProcessor;
|
||||
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||
import org.crazycake.shiro.IRedisManager;
|
||||
import org.crazycake.shiro.RedisCacheManager;
|
||||
import org.crazycake.shiro.RedisClusterManager;
|
||||
import org.crazycake.shiro.RedisManager;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.shiro.authc.ShiroRealm;
|
||||
@ -18,12 +20,14 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.Filter;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author: Scott
|
||||
@ -37,19 +41,12 @@ public class ShiroConfig {
|
||||
|
||||
@Value("${jeecg.shiro.excludeUrls}")
|
||||
private String excludeUrls;
|
||||
|
||||
@Value("${spring.redis.port}")
|
||||
private String port;
|
||||
|
||||
@Value("${spring.redis.host}")
|
||||
private String host;
|
||||
|
||||
@Value("${spring.redis.password}")
|
||||
private String redisPassword;
|
||||
@Resource
|
||||
LettuceConnectionFactory lettuceConnectionFactory;
|
||||
|
||||
/**
|
||||
* Filter Chain定义说明
|
||||
*
|
||||
* Filter Chain定义说明
|
||||
*
|
||||
* 1、一个URL可以配置多个Filter,使用逗号分隔
|
||||
* 2、当设置多个过滤器时,全部验证通过,才视为通过
|
||||
* 3、部分过滤器可指定参数,如perms,roles
|
||||
@ -78,7 +75,7 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/thirdLogin/**", "anon"); //第三方登录
|
||||
filterChainDefinitionMap.put("/sys/getEncryptedString", "anon"); //获取加密串
|
||||
filterChainDefinitionMap.put("/sys/sms", "anon");//短信验证码
|
||||
filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录
|
||||
filterChainDefinitionMap.put("/sys/phoneLogin", "anon");//手机登录
|
||||
filterChainDefinitionMap.put("/sys/user/checkOnlyUser", "anon");//校验用户是否存在
|
||||
filterChainDefinitionMap.put("/sys/user/register", "anon");//用户注册
|
||||
filterChainDefinitionMap.put("/sys/user/querySysUser", "anon");//根据手机号获取用户信息
|
||||
@ -110,21 +107,24 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/swagger**/**", "anon");
|
||||
filterChainDefinitionMap.put("/webjars/**", "anon");
|
||||
filterChainDefinitionMap.put("/v2/**", "anon");
|
||||
|
||||
|
||||
//性能监控
|
||||
filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
|
||||
filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
|
||||
filterChainDefinitionMap.put("/actuator/redis/**", "anon");
|
||||
|
||||
//大屏设计器排除
|
||||
filterChainDefinitionMap.put("/big/screen/**", "anon");
|
||||
|
||||
//测试示例
|
||||
filterChainDefinitionMap.put("/test/jeecgDemo/html", "anon"); //模板页面
|
||||
filterChainDefinitionMap.put("/test/jeecgDemo/redis/**", "anon"); //redis测试
|
||||
|
||||
|
||||
//排除Online请求
|
||||
filterChainDefinitionMap.put("/auto/cgform/**", "anon");
|
||||
|
||||
//websocket排除
|
||||
filterChainDefinitionMap.put("/websocket/**", "anon");
|
||||
filterChainDefinitionMap.put("/newsWebsocket/**", "anon");
|
||||
|
||||
// 添加自己的过滤器并且取名为jwt
|
||||
Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
|
||||
@ -214,16 +214,29 @@ public class ShiroConfig {
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public RedisManager redisManager() {
|
||||
log.info("===============(2)创建RedisManager,连接Redis..URL= " + host + ":" + port);
|
||||
RedisManager redisManager = new RedisManager();
|
||||
redisManager.setHost(host);
|
||||
redisManager.setPort(oConvertUtils.getInt(port));
|
||||
redisManager.setTimeout(0);
|
||||
if (!StringUtils.isEmpty(redisPassword)) {
|
||||
redisManager.setPassword(redisPassword);
|
||||
}
|
||||
return redisManager;
|
||||
public IRedisManager redisManager() {
|
||||
log.info("===============(2)创建RedisManager,连接Redis..");
|
||||
IRedisManager manager;
|
||||
// redis 单机支持,在集群为空,或者集群无机器时候使用 add by jzyadmin@163.com
|
||||
if (lettuceConnectionFactory.getClusterConfiguration() == null || lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().isEmpty()) {
|
||||
RedisManager redisManager = new RedisManager();
|
||||
redisManager.setHost(lettuceConnectionFactory.getHostName());
|
||||
redisManager.setPort(lettuceConnectionFactory.getPort());
|
||||
redisManager.setTimeout(0);
|
||||
if (!StringUtils.isEmpty(lettuceConnectionFactory.getPassword())) {
|
||||
redisManager.setPassword(lettuceConnectionFactory.getPassword());
|
||||
}
|
||||
manager = redisManager;
|
||||
}else{
|
||||
// redis 集群支持,优先使用集群配置 add by jzyadmin@163.com
|
||||
RedisClusterManager redisManager = new RedisClusterManager();
|
||||
Set<HostAndPort> portSet = new HashSet<>();
|
||||
lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost() , node.getPort())));
|
||||
JedisCluster jedisCluster = new JedisCluster(portSet);
|
||||
redisManager.setJedisCluster(jedisCluster);
|
||||
manager = redisManager;
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
package org.jeecg.config.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
import net.sf.jsqlparser.expression.BinaryExpression;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.Parenthesis;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||
import net.sf.jsqlparser.expression.operators.relational.*;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.schema.Table;
|
||||
import net.sf.jsqlparser.statement.select.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 复写租户条件
|
||||
*/
|
||||
public class JeecgTenantParser extends TenantSqlParser {
|
||||
|
||||
/**
|
||||
* @param expression
|
||||
* @param table
|
||||
* @return
|
||||
*/
|
||||
protected Expression processTableAlias(Expression expression, Table table) {
|
||||
String tableAliasName;
|
||||
if (table.getAlias() == null) {
|
||||
tableAliasName = table.getName();
|
||||
} else {
|
||||
tableAliasName = table.getAlias().getName();
|
||||
}
|
||||
|
||||
// in
|
||||
if (expression instanceof InExpression) {
|
||||
InExpression in = (InExpression) expression;
|
||||
if (in.getLeftExpression() instanceof Column) {
|
||||
setTableAliasNameForColumn((Column) in.getLeftExpression(), tableAliasName);
|
||||
}
|
||||
|
||||
// 比较操作
|
||||
} else if (expression instanceof BinaryExpression) {
|
||||
BinaryExpression compare = (BinaryExpression) expression;
|
||||
if (compare.getLeftExpression() instanceof Column) {
|
||||
setTableAliasNameForColumn((Column) compare.getLeftExpression(), tableAliasName);
|
||||
} else if (compare.getRightExpression() instanceof Column) {
|
||||
setTableAliasNameForColumn((Column) compare.getRightExpression(), tableAliasName);
|
||||
}
|
||||
|
||||
// between
|
||||
} else if (expression instanceof Between) {
|
||||
Between between = (Between) expression;
|
||||
if (between.getLeftExpression() instanceof Column) {
|
||||
setTableAliasNameForColumn((Column) between.getLeftExpression(), tableAliasName);
|
||||
}
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
|
||||
private void setTableAliasNameForColumn(Column column, String tableAliasName) {
|
||||
column.setColumnName(tableAliasName + "." + column.getColumnName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认是按 tenant_id=1 按等于条件追加
|
||||
*
|
||||
* @param currentExpression 现有的条件:比如你原来的sql查询条件
|
||||
* @param table
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Expression builderExpression(Expression currentExpression, Table table) {
|
||||
final Expression tenantExpression = this.getTenantHandler().getTenantId(true);
|
||||
Expression appendExpression;
|
||||
if (!(tenantExpression instanceof SupportsOldOracleJoinSyntax)) {
|
||||
appendExpression = new EqualsTo();
|
||||
((EqualsTo) appendExpression).setLeftExpression(this.getAliasColumn(table));
|
||||
((EqualsTo) appendExpression).setRightExpression(tenantExpression);
|
||||
} else {
|
||||
appendExpression = processTableAlias(tenantExpression, table);
|
||||
}
|
||||
if (currentExpression == null) {
|
||||
return appendExpression;
|
||||
}
|
||||
if (currentExpression instanceof BinaryExpression) {
|
||||
BinaryExpression binaryExpression = (BinaryExpression) currentExpression;
|
||||
if (binaryExpression.getLeftExpression() instanceof FromItem) {
|
||||
processFromItem((FromItem) binaryExpression.getLeftExpression());
|
||||
}
|
||||
if (binaryExpression.getRightExpression() instanceof FromItem) {
|
||||
processFromItem((FromItem) binaryExpression.getRightExpression());
|
||||
}
|
||||
} else if (currentExpression instanceof InExpression) {
|
||||
InExpression inExp = (InExpression) currentExpression;
|
||||
ItemsList rightItems = inExp.getRightItemsList();
|
||||
if (rightItems instanceof SubSelect) {
|
||||
processSelectBody(((SubSelect) rightItems).getSelectBody());
|
||||
}
|
||||
}
|
||||
if (currentExpression instanceof OrExpression) {
|
||||
return new AndExpression(new Parenthesis(currentExpression), appendExpression);
|
||||
} else {
|
||||
return new AndExpression(currentExpression, appendExpression);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
|
||||
FromItem fromItem = plainSelect.getFromItem();
|
||||
if (fromItem instanceof Table) {
|
||||
Table fromTable = (Table) fromItem;
|
||||
if (!this.getTenantHandler().doTableFilter(fromTable.getName())) {
|
||||
plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
|
||||
if (addColumn) {
|
||||
plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(this.getTenantHandler().getTenantIdColumn())));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
processFromItem(fromItem);
|
||||
}
|
||||
List<Join> joins = plainSelect.getJoins();
|
||||
if (joins != null && joins.size() > 0) {
|
||||
joins.forEach(j -> {
|
||||
processJoin(j);
|
||||
processFromItem(j.getRightItem());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
package org.jeecg.modules.demo.test.controller;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
* @Date 2020/1/12 17:19
|
||||
* @Description: Minio文件服务测试
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/minio")
|
||||
public class MinioController {
|
||||
|
||||
//minio服务的IP端口
|
||||
private static String url = "http://111.225.222.176:9000";
|
||||
private static String accessKey = "admin";
|
||||
private static String secretKey = "jeecg1357";
|
||||
private static String bucketName = "jeecgtest";
|
||||
|
||||
/**
|
||||
* 上传文件到minio服务
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("upload")
|
||||
public String upload(@RequestParam("file") MultipartFile file) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream is = file.getInputStream(); //得到文件流
|
||||
String fileName = "/upload/img/" + file.getOriginalFilename(); //文件名
|
||||
String contentType = file.getContentType(); //类型
|
||||
minioClient.putObject(bucketName, fileName, is, contentType); //把文件放置Minio桶(文件夹)
|
||||
return "上传成功";
|
||||
} catch (Exception e) {
|
||||
return "上传失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载minio服务的文件
|
||||
*
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("download")
|
||||
public String download(HttpServletResponse response) {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
InputStream fileInputStream = minioClient.getObject(bucketName, "11.jpg");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + "11.jpg");
|
||||
response.setContentType("application/force-download");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
IOUtils.copy(fileInputStream, response.getOutputStream());
|
||||
return "下载完成";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "下载失败";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取minio文件的下载地址
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("url")
|
||||
public String getUrl() {
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(url, accessKey, secretKey);
|
||||
String url = minioClient.presignedGetObject(bucketName, "11.jpg");
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "获取失败";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class OSSFileController {
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/upload")
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
public Result upload(@RequestParam("file") MultipartFile multipartFile) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
|
||||
@ -86,7 +86,7 @@ public class QuartzJobController {
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<?> add(@RequestBody QuartzJob quartzJob) {
|
||||
List<QuartzJob> list = quartzJobService.findByJobClassName(quartzJob.getJobClassName());
|
||||
@ -103,7 +103,7 @@ public class QuartzJobController {
|
||||
* @param quartzJob
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<?> eidt(@RequestBody QuartzJob quartzJob) {
|
||||
try {
|
||||
@ -121,7 +121,7 @@ public class QuartzJobController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
@ -139,7 +139,7 @@ public class QuartzJobController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
@ -158,22 +158,16 @@ public class QuartzJobController {
|
||||
* @param jobClassName
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@GetMapping(value = "/pause")
|
||||
@ApiOperation(value = "暂停定时任务")
|
||||
public Result<Object> pauseJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
|
||||
QuartzJob job = null;
|
||||
try {
|
||||
job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
}
|
||||
scheduler.pauseJob(JobKey.jobKey(jobClassName.trim()));
|
||||
} catch (SchedulerException e) {
|
||||
throw new JeecgBootException("暂停定时任务失败");
|
||||
job = quartzJobService.getOne(new LambdaQueryWrapper<QuartzJob>().eq(QuartzJob::getJobClassName, jobClassName));
|
||||
if (job == null) {
|
||||
return Result.error("定时任务不存在!");
|
||||
}
|
||||
job.setStatus(CommonConstant.STATUS_DISABLE);
|
||||
quartzJobService.updateById(job);
|
||||
quartzJobService.pause(job);
|
||||
return Result.ok("暂停定时任务成功");
|
||||
}
|
||||
|
||||
@ -183,7 +177,7 @@ public class QuartzJobController {
|
||||
* @param jobClassName
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
@GetMapping(value = "/resume")
|
||||
@ApiOperation(value = "恢复定时任务")
|
||||
public Result<Object> resumeJob(@RequestParam(name = "jobClassName", required = true) String jobClassName) {
|
||||
@ -267,4 +261,26 @@ public class QuartzJobController {
|
||||
}
|
||||
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 立即执行
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequiresRoles("admin")
|
||||
@GetMapping("/execute")
|
||||
public Result<?> execute(@RequestParam(name = "id", required = true) String id) {
|
||||
QuartzJob quartzJob = quartzJobService.getById(id);
|
||||
if (quartzJob == null) {
|
||||
return Result.error("未找到对应实体");
|
||||
}
|
||||
try {
|
||||
quartzJobService.execute(quartzJob);
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
log.info("定时任务 立即执行失败>>"+e.getMessage());
|
||||
return Result.error("执行失败!");
|
||||
}
|
||||
return Result.ok("执行成功!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.*;
|
||||
|
||||
/**
|
||||
* @Description: 同步定时任务测试
|
||||
*
|
||||
* 此处的同步是指 当定时任务的执行时间大于任务的时间间隔时
|
||||
* 会等待第一个任务执行完成才会走第二个任务
|
||||
*
|
||||
*
|
||||
* @author: taoyan
|
||||
* @date: 2020年06月19日
|
||||
*/
|
||||
@PersistJobDataAfterExecution
|
||||
@DisallowConcurrentExecution
|
||||
@Slf4j
|
||||
public class AsyncJob implements Job {
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info(" --- 同步任务调度开始 --- ");
|
||||
try {
|
||||
//此处模拟任务执行时间 5秒 任务表达式配置为每秒执行一次:0/1 * * * * ? *
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//测试发现 每5秒执行一次
|
||||
log.info(" --- 执行完毕,时间:"+DateUtils.now()+"---");
|
||||
}
|
||||
|
||||
}
|
||||
@ -24,4 +24,17 @@ public interface IQuartzJobService extends IService<QuartzJob> {
|
||||
boolean deleteAndStopJob(QuartzJob quartzJob);
|
||||
|
||||
boolean resumeJob(QuartzJob quartzJob);
|
||||
|
||||
/**
|
||||
* 执行定时任务
|
||||
* @param quartzJob
|
||||
*/
|
||||
void execute(QuartzJob quartzJob) throws Exception;
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
* @param quartzJob
|
||||
* @throws SchedulerException
|
||||
*/
|
||||
void pause(QuartzJob quartzJob);
|
||||
}
|
||||
|
||||
@ -1,22 +1,15 @@
|
||||
package org.jeecg.modules.quartz.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.modules.quartz.entity.QuartzJob;
|
||||
import org.jeecg.modules.quartz.mapper.QuartzJobMapper;
|
||||
import org.jeecg.modules.quartz.service.IQuartzJobService;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -38,6 +31,11 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
/**
|
||||
* 立即执行的任务分组
|
||||
*/
|
||||
private static final String JOB_TEST_GROUP = "test_group";
|
||||
|
||||
@Override
|
||||
public List<QuartzJob> findByJobClassName(String jobClassName) {
|
||||
return quartzJobMapper.findByJobClassName(jobClassName);
|
||||
@ -93,6 +91,34 @@ public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob
|
||||
return ok;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(QuartzJob quartzJob) throws Exception {
|
||||
String jobName = quartzJob.getJobClassName().trim();
|
||||
Date startDate = new Date();
|
||||
String ymd = DateUtils.date2Str(startDate,DateUtils.yyyymmddhhmmss.get());
|
||||
String identity = jobName + ymd;
|
||||
//3秒后执行 只执行一次
|
||||
startDate.setTime(startDate.getTime()+3000L);
|
||||
// 定义一个Trigger
|
||||
SimpleTrigger trigger = (SimpleTrigger)TriggerBuilder.newTrigger()
|
||||
.withIdentity(identity, JOB_TEST_GROUP)
|
||||
.startAt(startDate)
|
||||
.build();
|
||||
// 构建job信息
|
||||
JobDetail jobDetail = JobBuilder.newJob(getClass(jobName).getClass()).withIdentity(identity).usingJobData("parameter", quartzJob.getParameter()).build();
|
||||
// 将trigger和 jobDetail 加入这个调度
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
// 启动scheduler
|
||||
scheduler.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause(QuartzJob quartzJob){
|
||||
schedulerDelete(quartzJob.getJobClassName().trim());
|
||||
quartzJob.setStatus(CommonConstant.STATUS_DISABLE);
|
||||
this.updateById(quartzJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加定时任务
|
||||
*
|
||||
|
||||
@ -8,6 +8,7 @@ import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
import org.jeecg.modules.shiro.authc.JwtToken;
|
||||
import org.jeecg.modules.shiro.vo.DefContants;
|
||||
import org.jeecg.modules.system.util.TenantContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -68,6 +69,10 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
|
||||
httpServletResponse.setStatus(HttpStatus.OK.value());
|
||||
return false;
|
||||
}
|
||||
//update-begin-author:taoyan date:20200708 for:多租户用到
|
||||
String tenant_id = httpServletRequest.getHeader(DefContants.TENANT_ID);
|
||||
TenantContext.setTenant(tenant_id);
|
||||
//update-end-author:taoyan date:20200708 for:多租户用到
|
||||
return super.preHandle(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,4 +4,9 @@ public class DefContants {
|
||||
|
||||
public final static String X_ACCESS_TOKEN = "X-Access-Token";
|
||||
|
||||
/**
|
||||
* 多租户 请求头
|
||||
*/
|
||||
public final static String TENANT_ID = "tenant_id";
|
||||
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class TestWebController {
|
||||
}
|
||||
|
||||
@GetMapping("/require_role")
|
||||
@RequiresRoles({"admin"})
|
||||
@RequiresRoles("admin")
|
||||
public ResponseBean requireRole() {
|
||||
return new ResponseBean(200, "You are visiting require_role", null);
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package org.jeecg.modules.system.aspect;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@ -24,11 +26,12 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志,切面处理类
|
||||
*
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2018年1月14日
|
||||
@ -38,10 +41,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||
public class AutoLogAspect {
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
|
||||
@Pointcut("@annotation(org.jeecg.common.aspect.annotation.AutoLog)")
|
||||
public void logPointCut() {
|
||||
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("logPointCut()")
|
||||
@ -68,15 +71,15 @@ public class AutoLogAspect {
|
||||
//注解上的描述,操作日志内容
|
||||
sysLog.setLogContent(syslog.value());
|
||||
sysLog.setLogType(syslog.logType());
|
||||
|
||||
|
||||
}
|
||||
|
||||
//请求的方法名
|
||||
String className = joinPoint.getTarget().getClass().getName();
|
||||
String methodName = signature.getName();
|
||||
sysLog.setMethod(className + "." + methodName + "()");
|
||||
|
||||
|
||||
|
||||
|
||||
//设置操作类型
|
||||
if (sysLog.getLogType() == CommonConstant.LOG_TYPE_2) {
|
||||
sysLog.setOperateType(getOperateType(methodName, syslog.operateType()));
|
||||
@ -144,7 +147,19 @@ public class AutoLogAspect {
|
||||
String params = "";
|
||||
if ("POST".equals(httpMethod) || "PUT".equals(httpMethod) || "PATCH".equals(httpMethod)) {
|
||||
Object[] paramsArray = joinPoint.getArgs();
|
||||
params = JSONObject.toJSONString(paramsArray);
|
||||
// java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)
|
||||
// https://my.oschina.net/mengzhang6/blog/2395893
|
||||
Object[] arguments = new Object[paramsArray.length];
|
||||
for (int i = 0; i < paramsArray.length; i++) {
|
||||
if (paramsArray[i] instanceof ServletRequest || paramsArray[i] instanceof ServletResponse || paramsArray[i] instanceof MultipartFile) {
|
||||
//ServletRequest不能序列化,从入参里排除,否则报异常:java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)
|
||||
//ServletResponse不能序列化 从入参里排除,否则报异常:java.lang.IllegalStateException: getOutputStream() has already been called for this response
|
||||
continue;
|
||||
}
|
||||
arguments[i] = paramsArray[i];
|
||||
}
|
||||
|
||||
params = JSONObject.toJSONString(arguments);
|
||||
} else {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
|
||||
@ -3,6 +3,7 @@ package org.jeecg.modules.system.controller;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -83,7 +84,11 @@ public class LoginController {
|
||||
//update-end-author:taoyan date:20190828 for:校验验证码
|
||||
|
||||
//1. 校验用户是否有效
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
//update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUser::getUsername,username);
|
||||
SysUser sysUser = sysUserService.getOne(queryWrapper);
|
||||
//update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false
|
||||
result = sysUserService.checkUserIsEffective(sysUser);
|
||||
if(!result.isSuccess()) {
|
||||
return result;
|
||||
@ -256,6 +261,10 @@ public class LoginController {
|
||||
SysUser sysUser = sysUserService.getUserByPhone(mobile);
|
||||
result = sysUserService.checkUserIsEffective(sysUser);
|
||||
if(!result.isSuccess()) {
|
||||
String message = result.getMessage();
|
||||
if("该用户不存在,请注册".equals(message)){
|
||||
result.error500("该用户不存在或未绑定手机号");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,12 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
@ -32,11 +27,11 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 分类字典
|
||||
@ -74,7 +69,7 @@ public class SysCategoryController {
|
||||
QueryWrapper<SysCategory> queryWrapper = new QueryWrapper<SysCategory>();
|
||||
queryWrapper.eq("pid", sysCategory.getPid());
|
||||
//--author:os_chengtgen---date:20190804 -----for: 分类字典页面显示错误,issues:377--------end
|
||||
|
||||
|
||||
Page<SysCategory> page = new Page<SysCategory>(pageNo, pageSize);
|
||||
IPage<SysCategory> pageList = sysCategoryService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
@ -233,7 +228,22 @@ public class SysCategoryController {
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<SysCategory> listSysCategorys = ExcelImportUtil.importExcel(file.getInputStream(), SysCategory.class, params);
|
||||
//按照编码长度排序
|
||||
Collections.sort(listSysCategorys);
|
||||
log.info("排序后的list====>",listSysCategorys);
|
||||
for (SysCategory sysCategoryExcel : listSysCategorys) {
|
||||
String code = sysCategoryExcel.getCode();
|
||||
if(code.length()>3){
|
||||
String pCode = sysCategoryExcel.getCode().substring(0,code.length()-3);
|
||||
log.info("pCode====>",pCode);
|
||||
String pId=sysCategoryService.queryIdByCode(pCode);
|
||||
log.info("pId====>",pId);
|
||||
if(StringUtils.isNotBlank(pId)){
|
||||
sysCategoryExcel.setPid(pId);
|
||||
}
|
||||
}else{
|
||||
sysCategoryExcel.setPid("0");
|
||||
}
|
||||
sysCategoryService.save(sysCategoryExcel);
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listSysCategorys.size());
|
||||
@ -399,29 +409,31 @@ public class SysCategoryController {
|
||||
|
||||
/**
|
||||
* 分类字典控件数据回显[表单页面]
|
||||
* @param key
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/loadDictItem", method = RequestMethod.GET)
|
||||
public Result<List<String>> loadDictItem(@RequestParam(name="ids") String ids) {
|
||||
public Result<List<String>> loadDictItem(@RequestParam(name = "ids") String ids) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>().in(SysCategory::getId,ids);
|
||||
List<SysCategory> list = this.sysCategoryService.list(query);
|
||||
List<String> textList = new ArrayList<String>();
|
||||
for (String id : ids.split(",")) {
|
||||
for (SysCategory c : list) {
|
||||
if(id.equals(c.getId())){
|
||||
textList.add(c.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 非空判断
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
result.setSuccess(false);
|
||||
result.setMessage("ids 不能为空");
|
||||
return result;
|
||||
}
|
||||
String[] idArray = ids.split(",");
|
||||
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<>();
|
||||
query.in(SysCategory::getId, Arrays.asList(idArray));
|
||||
// 查询数据
|
||||
List<SysCategory> list = this.sysCategoryService.list(query);
|
||||
// 取出name并返回
|
||||
List<String> textList = list.stream().map(SysCategory::getName).collect(Collectors.toList());
|
||||
result.setSuccess(true);
|
||||
result.setResult(textList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [列表页面]加载分类字典数据 用于值的替换
|
||||
* @param code
|
||||
|
||||
@ -18,10 +18,12 @@ import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.ImportExcelUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDepart;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysDepartTreeModel;
|
||||
import org.jeecg.modules.system.service.ISysDepartService;
|
||||
import org.jeecg.modules.system.service.ISysPositionService;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
@ -58,6 +60,8 @@ public class SysDepartController {
|
||||
private ISysDepartService sysDepartService;
|
||||
@Autowired
|
||||
public RedisTemplate<String, Object> redisTemplate;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
/**
|
||||
* 查询数据 查出我的部门,并以树结构数据格式响应给前端
|
||||
*
|
||||
@ -112,7 +116,6 @@ public class SysDepartController {
|
||||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
@ -138,7 +141,6 @@ public class SysDepartController {
|
||||
* @param sysDepart
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
|
||||
@ -166,7 +168,6 @@ public class SysDepartController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) {
|
||||
@ -194,7 +195,6 @@ public class SysDepartController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<SysDepart> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
@ -309,7 +309,6 @@ public class SysDepartController {
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
@ -398,4 +397,46 @@ public class SysDepartController {
|
||||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 查询数据 查出所有部门,并以树结构数据格式响应给前端
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET)
|
||||
public Result<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) {
|
||||
Result<Map<String,Object>> result = new Result<>();
|
||||
try {
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord);
|
||||
//根据keyWord获取用户信息
|
||||
LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>();
|
||||
queryUser.eq(SysUser::getDelFlag,0);
|
||||
queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord));
|
||||
List<SysUser> sysUsers = this.sysUserService.list(queryUser);
|
||||
map.put("userList",sysUsers);
|
||||
map.put("departList",list);
|
||||
result.setResult(map);
|
||||
result.setSuccess(true);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编码获取部门信息
|
||||
*
|
||||
* @param orgCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDepartName")
|
||||
public Result<SysDepart> getDepartName(@RequestParam(name = "orgCode") String orgCode) {
|
||||
Result<SysDepart> result = new Result<>();
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysDepart::getOrgCode, orgCode);
|
||||
SysDepart sysDepart = sysDepartService.getOne(query);
|
||||
result.setSuccess(true);
|
||||
result.setResult(sysDepart);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -97,7 +98,6 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-添加", notes="部门角色-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysDepartRole sysDepartRole) {
|
||||
@ -111,7 +111,6 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
* @param sysDepartRole
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@ApiOperation(value="部门角色-编辑", notes="部门角色-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody SysDepartRole sysDepartRole) {
|
||||
@ -125,7 +124,6 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-通过id删除")
|
||||
@ApiOperation(value="部门角色-通过id删除", notes="部门角色-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
@ -140,7 +138,6 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@AutoLog(value = "部门角色-批量删除")
|
||||
@ApiOperation(value="部门角色-批量删除", notes="部门角色-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
@ -170,9 +167,8 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
@RequestMapping(value = "/getDeptRoleList", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartRole>> getDeptRoleList(@RequestParam(value = "departId") String departId,@RequestParam(value = "userId") String userId){
|
||||
Result<List<SysDepartRole>> result = new Result<>();
|
||||
//查询管理部门下,用户所在部门的所有角色
|
||||
SysDepart depart = sysDepartService.getById(departId);
|
||||
List<SysDepartRole> deptRoleList = sysDepartRoleService.queryDeptRoleByDeptAndUser(depart.getOrgCode(),userId);
|
||||
//查询选中部门的角色
|
||||
List<SysDepartRole> deptRoleList = sysDepartRoleService.list(new LambdaQueryWrapper<SysDepartRole>().eq(SysDepartRole::getDepartId,departId));
|
||||
result.setSuccess(true);
|
||||
result.setResult(deptRoleList);
|
||||
return result;
|
||||
@ -198,9 +194,13 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getDeptRoleByUserId", method = RequestMethod.GET)
|
||||
public Result<List<SysDepartRoleUser>> getDeptRoleByUserId(@RequestParam(value = "userId") String userId){
|
||||
public Result<List<SysDepartRoleUser>> getDeptRoleByUserId(@RequestParam(value = "userId") String userId,@RequestParam(value = "departId") String departId){
|
||||
Result<List<SysDepartRoleUser>> result = new Result<>();
|
||||
List<SysDepartRoleUser> roleUserList = departRoleUserService.list(new QueryWrapper<SysDepartRoleUser>().eq("user_id",userId));
|
||||
//查询部门下角色
|
||||
List<SysDepartRole> roleList = sysDepartRoleService.list(new QueryWrapper<SysDepartRole>().eq("depart_id",departId));
|
||||
List<String> roleIds = roleList.stream().map(SysDepartRole::getId).collect(Collectors.toList());
|
||||
//根据角色id,用户id查询已授权角色
|
||||
List<SysDepartRoleUser> roleUserList = departRoleUserService.list(new QueryWrapper<SysDepartRoleUser>().eq("user_id",userId).in("drole_id",roleIds));
|
||||
result.setSuccess(true);
|
||||
result.setResult(roleUserList);
|
||||
return result;
|
||||
|
||||
@ -242,7 +242,7 @@ public class SysDictController {
|
||||
* 根据字典code加载字典text 返回
|
||||
*/
|
||||
@RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET)
|
||||
public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String key, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
|
||||
public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
|
||||
Result<List<String>> result = new Result<>();
|
||||
try {
|
||||
if(dictCode.indexOf(",")!=-1) {
|
||||
@ -251,7 +251,7 @@ public class SysDictController {
|
||||
result.error500("字典Code格式不正确!");
|
||||
return result;
|
||||
}
|
||||
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], key.split(","));
|
||||
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys);
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(texts);
|
||||
@ -319,7 +319,6 @@ public class SysDictController {
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysDict> add(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
@ -340,7 +339,6 @@ public class SysDictController {
|
||||
* @param sysDict
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysDict> edit(@RequestBody SysDict sysDict) {
|
||||
Result<SysDict> result = new Result<SysDict>();
|
||||
@ -362,7 +360,6 @@ public class SysDictController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true)
|
||||
public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) {
|
||||
@ -381,7 +378,6 @@ public class SysDictController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
@CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true)
|
||||
public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
|
||||
@ -246,7 +246,7 @@ public class SysPermissionController {
|
||||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysPermission> add(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<SysPermission>();
|
||||
@ -266,7 +266,7 @@ public class SysPermissionController {
|
||||
* @param permission
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<SysPermission> edit(@RequestBody SysPermission permission) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
@ -286,7 +286,7 @@ public class SysPermissionController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<SysPermission> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
@ -305,7 +305,7 @@ public class SysPermissionController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysPermission> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
Result<SysPermission> result = new Result<>();
|
||||
@ -403,7 +403,7 @@ public class SysPermissionController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveRolePermission", method = RequestMethod.POST)
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
public Result<String> saveRolePermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<String> result = new Result<>();
|
||||
@ -683,6 +683,7 @@ public class SysPermissionController {
|
||||
* @param sysPermissionDataRule
|
||||
* @return
|
||||
*/
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/addPermissionRule", method = RequestMethod.POST)
|
||||
public Result<SysPermissionDataRule> addPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
@ -697,6 +698,7 @@ public class SysPermissionController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/editPermissionRule", method = { RequestMethod.PUT, RequestMethod.POST })
|
||||
public Result<SysPermissionDataRule> editPermissionRule(@RequestBody SysPermissionDataRule sysPermissionDataRule) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
@ -713,9 +715,10 @@ public class SysPermissionController {
|
||||
/**
|
||||
* 删除菜单权限数据
|
||||
*
|
||||
* @param sysPermissionDataRule
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequiresRoles({ "admin" })
|
||||
@RequestMapping(value = "/deletePermissionRule", method = RequestMethod.DELETE)
|
||||
public Result<SysPermissionDataRule> deletePermissionRule(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<SysPermissionDataRule> result = new Result<SysPermissionDataRule>();
|
||||
@ -773,7 +776,7 @@ public class SysPermissionController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/saveDepartPermission", method = RequestMethod.POST)
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequiresRoles({ "admin" })
|
||||
public Result<String> saveDepartPermission(@RequestBody JSONObject json) {
|
||||
long start = System.currentTimeMillis();
|
||||
Result<String> result = new Result<>();
|
||||
|
||||
@ -109,7 +109,6 @@ public class SysRoleController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
//@RequiresRoles({"admin"})
|
||||
public Result<SysRole> add(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
try {
|
||||
@ -128,7 +127,6 @@ public class SysRoleController {
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysRole> edit(@RequestBody SysRole role) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
@ -152,7 +150,6 @@ public class SysRoleController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysRoleService.deleteRole(id);
|
||||
@ -164,7 +161,6 @@ public class SysRoleController {
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysRole> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<SysRole> result = new Result<SysRole>();
|
||||
|
||||
@ -0,0 +1,163 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.modules.system.service.ISysTenantService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租户配置信息
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sys/tenant")
|
||||
public class SysTenantController {
|
||||
|
||||
@Autowired
|
||||
private ISysTenantService sysTenantService;
|
||||
|
||||
/**
|
||||
* 获取列表数据
|
||||
* @param sysTenant
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PermissionData(pageComponent = "system/TenantList")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<IPage<SysTenant>> queryPageList(SysTenant sysTenant,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
|
||||
Result<IPage<SysTenant>> result = new Result<IPage<SysTenant>>();
|
||||
QueryWrapper<SysTenant> queryWrapper = QueryGenerator.initQueryWrapper(sysTenant, req.getParameterMap());
|
||||
Page<SysTenant> page = new Page<SysTenant>(pageNo, pageSize);
|
||||
IPage<SysTenant> pageList = sysTenantService.page(page, queryWrapper);
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public Result<SysTenant> add(@RequestBody SysTenant sysTenant) {
|
||||
Result<SysTenant> result = new Result<SysTenant>();
|
||||
if(sysTenantService.getById(sysTenant.getId())!=null){
|
||||
return result.error500("该编号已存在!");
|
||||
}
|
||||
try {
|
||||
sysTenantService.save(sysTenant);
|
||||
result.success("添加成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
public Result<SysTenant> edit(@RequestBody SysTenant tenant) {
|
||||
Result<SysTenant> result = new Result<SysTenant>();
|
||||
SysTenant sysTenant = sysTenantService.getById(tenant.getId());
|
||||
if(sysTenant==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
boolean ok = sysTenantService.updateById(tenant);
|
||||
if(ok) {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysTenantService.removeById(id);
|
||||
return Result.ok("删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<?> result = new Result<>();
|
||||
if(oConvertUtils.isEmpty(ids)) {
|
||||
result.error500("未选中租户!");
|
||||
}else {
|
||||
List<String> ls = Arrays.asList(ids.split(","));
|
||||
sysTenantService.removeByIds(ls);
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryById", method = RequestMethod.GET)
|
||||
public Result<SysTenant> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Result<SysTenant> result = new Result<SysTenant>();
|
||||
SysTenant sysTenant = sysTenantService.getById(id);
|
||||
if(sysTenant==null) {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
result.setResult(sysTenant);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询有效的 租户数据
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/queryList", method = RequestMethod.GET)
|
||||
public Result<List<SysTenant>> queryList(@RequestParam(name="ids",required=false) String ids) {
|
||||
Result<List<SysTenant>> result = new Result<List<SysTenant>>();
|
||||
LambdaQueryWrapper<SysTenant> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysTenant::getStatus, 1);
|
||||
if(oConvertUtils.isNotEmpty(ids)){
|
||||
query.in(SysTenant::getId, ids.split(","));
|
||||
}
|
||||
Date now = new Date();
|
||||
query.ge(SysTenant::getEndDate, now);
|
||||
query.le(SysTenant::getBeginDate, now);
|
||||
List<SysTenant> ls = sysTenantService.list(query);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -22,10 +22,7 @@ import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.PasswordUtil;
|
||||
import org.jeecg.common.util.PmsUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.util.*;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
import org.jeecg.modules.system.model.SysUserSysDepartModel;
|
||||
@ -119,8 +116,7 @@ public class SysUserController {
|
||||
if(userIds!=null && userIds.size()>0){
|
||||
Map<String,String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
pageList.getRecords().forEach(item->{
|
||||
//TODO 临时借用这个字段用于页面展示
|
||||
item.setOrgCode(useDepNames.get(item.getId()));
|
||||
item.setOrgCodeTxt(useDepNames.get(item.getId()));
|
||||
});
|
||||
}
|
||||
result.setSuccess(true);
|
||||
@ -130,7 +126,6 @@ public class SysUserController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
//@RequiresPermissions("user:add")
|
||||
public Result<SysUser> add(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
String selectedRoles = jsonObject.getString("selectedroles");
|
||||
@ -155,8 +150,6 @@ public class SysUserController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.PUT)
|
||||
//@RequiresRoles({"admin"})
|
||||
//@RequiresPermissions("user:edit")
|
||||
public Result<SysUser> edit(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
@ -186,7 +179,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.DELETE)
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sysBaseAPI.addLog("删除用户,id: " +id ,CommonConstant.LOG_TYPE_2, 3);
|
||||
@ -197,7 +189,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 批量删除用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
sysBaseAPI.addLog("批量删除用户, ids: " +ids ,CommonConstant.LOG_TYPE_2, 3);
|
||||
@ -210,7 +201,6 @@ public class SysUserController {
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
|
||||
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
@ -297,7 +287,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/changePassword", method = RequestMethod.PUT)
|
||||
public Result<?> changePassword(@RequestBody SysUser sysUser) {
|
||||
SysUser u = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, sysUser.getUsername()));
|
||||
@ -392,7 +381,7 @@ public class SysUserController {
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param sysUser
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
|
||||
@ -426,9 +415,8 @@ public class SysUserController {
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("user:import")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response)throws IOException {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
// 错误信息
|
||||
@ -498,27 +486,7 @@ public class SysUserController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (errorLines == 0) {
|
||||
return Result.ok("共" + successLines + "行数据全部导入成功!");
|
||||
} else {
|
||||
JSONObject result = new JSONObject(5);
|
||||
int totalCount = successLines + errorLines;
|
||||
result.put("totalCount", totalCount);
|
||||
result.put("errorCount", errorLines);
|
||||
result.put("successCount", successLines);
|
||||
result.put("msg", "总上传行数:" + totalCount + ",已导入行数:" + successLines + ",错误行数:" + errorLines);
|
||||
String fileUrl = PmsUtil.saveErrorTxtByList(errorMessage, "userImportExcelErrorLog");
|
||||
int lastIndex = fileUrl.lastIndexOf(File.separator);
|
||||
String fileName = fileUrl.substring(lastIndex + 1);
|
||||
result.put("fileUrl", "/sys/common/static/" + fileUrl);
|
||||
result.put("fileName", fileName);
|
||||
Result res = Result.ok(result);
|
||||
|
||||
res.setCode(201);
|
||||
res.setMessage("文件导入成功,但有错误。");
|
||||
|
||||
return res;
|
||||
}
|
||||
return ImportExcelUtil.imporReturnRes(errorLines,successLines,errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -540,7 +508,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 首页用户重置密码
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/updatePassword", method = RequestMethod.PUT)
|
||||
public Result<?> changPassword(@RequestBody JSONObject json) {
|
||||
String username = json.getString("username");
|
||||
@ -573,7 +540,6 @@ public class SysUserController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/addSysUserRole", method = RequestMethod.POST)
|
||||
public Result<String> addSysUserRole(@RequestBody SysUserRoleVO sysUserRoleVO) {
|
||||
Result<String> result = new Result<String>();
|
||||
@ -604,7 +570,6 @@ public class SysUserController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteUserRole", method = RequestMethod.DELETE)
|
||||
public Result<SysUserRole> deleteUserRole(@RequestParam(name="roleId") String roleId,
|
||||
@RequestParam(name="userId",required=true) String userId
|
||||
@ -628,7 +593,6 @@ public class SysUserController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteUserRoleBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysUserRole> deleteUserRoleBatch(
|
||||
@RequestParam(name="roleId") String roleId,
|
||||
@ -755,7 +719,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 给指定部门添加对应的用户
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/editSysDepartWithUser", method = RequestMethod.POST)
|
||||
public Result<String> editSysDepartWithUser(@RequestBody SysDepartUsersVO sysDepartUsersVO) {
|
||||
Result<String> result = new Result<String>();
|
||||
@ -784,7 +747,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 删除指定机构的用户关系
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteUserInDepart", method = RequestMethod.DELETE)
|
||||
public Result<SysUserDepart> deleteUserInDepart(@RequestParam(name="depId") String depId,
|
||||
@RequestParam(name="userId",required=true) String userId
|
||||
@ -816,7 +778,6 @@ public class SysUserController {
|
||||
/**
|
||||
* 批量删除指定机构的用户关系
|
||||
*/
|
||||
//@RequiresRoles({"admin"})
|
||||
@RequestMapping(value = "/deleteUserInDepartBatch", method = RequestMethod.DELETE)
|
||||
public Result<SysUserDepart> deleteUserInDepartBatch(
|
||||
@RequestParam(name="depId") String depId,
|
||||
@ -975,8 +936,8 @@ public class SysUserController {
|
||||
* 用户手机号验证
|
||||
*/
|
||||
@PostMapping("/phoneVerification")
|
||||
public Result<String> phoneVerification(@RequestBody JSONObject jsonObject) {
|
||||
Result<String> result = new Result<String>();
|
||||
public Result<Map<String,String>> phoneVerification(@RequestBody JSONObject jsonObject) {
|
||||
Result<Map<String,String>> result = new Result<Map<String,String>>();
|
||||
String phone = jsonObject.getString("phone");
|
||||
String smscode = jsonObject.getString("smscode");
|
||||
Object code = redisUtil.get(phone);
|
||||
@ -985,8 +946,16 @@ public class SysUserController {
|
||||
result.setSuccess(false);
|
||||
return result;
|
||||
}
|
||||
redisUtil.set(phone, smscode);
|
||||
result.setResult(smscode);
|
||||
//设置有效时间
|
||||
redisUtil.set(phone, smscode,600);
|
||||
//新增查询用户名
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysUser::getPhone,phone);
|
||||
SysUser user = sysUserService.getOne(query);
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("smscode",smscode);
|
||||
map.put("username",user.getUsername());
|
||||
result.setResult(map);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
@ -1082,14 +1051,21 @@ public class SysUserController {
|
||||
public Result<?> appUserList(@RequestParam(name = "keyword", required = false) String keyword,
|
||||
@RequestParam(name = "username", required = false) String username,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name = "syncFlow", required = false) String syncFlow) {
|
||||
try {
|
||||
//TODO 从查询效率上将不要用mp的封装的page分页查询 建议自己写分页语句
|
||||
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<SysUser>();
|
||||
query.eq(SysUser::getActivitiSync, "1");
|
||||
if(oConvertUtils.isNotEmpty(syncFlow)){
|
||||
query.eq(SysUser::getActivitiSync, "1");
|
||||
}
|
||||
query.eq(SysUser::getDelFlag,"0");
|
||||
if(oConvertUtils.isNotEmpty(username)){
|
||||
query.eq(SysUser::getUsername,username);
|
||||
if(username.contains(",")){
|
||||
query.in(SysUser::getUsername,username.split(","));
|
||||
}else{
|
||||
query.eq(SysUser::getUsername,username);
|
||||
}
|
||||
}else{
|
||||
query.and(i -> i.like(SysUser::getUsername, keyword).or().like(SysUser::getRealname, keyword));
|
||||
}
|
||||
@ -1161,18 +1137,30 @@ public class SysUserController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/appEdit", method = RequestMethod.PUT)
|
||||
public Result<SysUser> appEdit(@RequestBody JSONObject jsonObject) {
|
||||
public Result<SysUser> appEdit(HttpServletRequest request,@RequestBody JSONObject jsonObject) {
|
||||
Result<SysUser> result = new Result<SysUser>();
|
||||
try {
|
||||
SysUser sysUser = sysUserService.getById(jsonObject.getString("id"));
|
||||
String username = JwtUtil.getUserNameByToken(request);
|
||||
SysUser sysUser = sysUserService.getUserByName(username);
|
||||
sysBaseAPI.addLog("移动端编辑用户,id: " +jsonObject.getString("id") ,CommonConstant.LOG_TYPE_2, 2);
|
||||
if(sysUser==null) {
|
||||
result.error500("未找到对应用户!");
|
||||
}else {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
user.setUpdateTime(new Date());
|
||||
user.setPassword(sysUser.getPassword());
|
||||
sysUserService.updateById(user);
|
||||
String realname=jsonObject.getString("realname");
|
||||
String avatar=jsonObject.getString("avatar");
|
||||
String sex=jsonObject.getString("sex");
|
||||
String phone=jsonObject.getString("phone");
|
||||
String email=jsonObject.getString("email");
|
||||
Date birthday=jsonObject.getDate("birthday");
|
||||
|
||||
sysUser.setRealname(realname);
|
||||
sysUser.setAvatar(avatar);
|
||||
sysUser.setSex(Integer.parseInt(sex));
|
||||
sysUser.setBirthday(birthday);
|
||||
sysUser.setPhone(phone);
|
||||
sysUser.setEmail(email);
|
||||
sysUser.setUpdateTime(new Date());
|
||||
sysUserService.updateById(sysUser);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
@ -1180,5 +1168,70 @@ public class SysUserController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userid获取用户信息和部门员工信息
|
||||
*
|
||||
* @return Result
|
||||
*/
|
||||
@GetMapping("/queryChildrenByUsername")
|
||||
public Result queryChildrenByUsername(@RequestParam("userId") String userId) {
|
||||
//获取用户信息
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
SysUser sysUser = sysUserService.getById(userId);
|
||||
String username = sysUser.getUsername();
|
||||
Integer identity = sysUser.getUserIdentity();
|
||||
map.put("sysUser",sysUser);
|
||||
if(identity!=null && identity==2){
|
||||
//获取部门用户信息
|
||||
String departIds = sysUser.getDepartIds();
|
||||
if(StringUtils.isNotBlank(departIds)){
|
||||
List<String> departIdList = Arrays.asList(departIds.split(","));
|
||||
List<SysUser> childrenUser = sysUserService.queryByDepIds(departIdList,username);
|
||||
map.put("children",childrenUser);
|
||||
}
|
||||
}
|
||||
return Result.ok(map);
|
||||
}
|
||||
/**
|
||||
* 移动端查询部门用户信息
|
||||
* @param departId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/appQueryByDepartId")
|
||||
public Result<List<SysUser>> appQueryByDepartId(@RequestParam(name="departId", required = false) String departId) {
|
||||
Result<List<SysUser>> result = new Result<List<SysUser>>();
|
||||
List<String> list=new ArrayList<String> ();
|
||||
list.add(departId);
|
||||
List<SysUser> childrenUser = sysUserService.queryByDepIds(list,null);
|
||||
result.setResult(childrenUser);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 移动端查询用户信息(通过用户名模糊查询)
|
||||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/appQueryUser")
|
||||
public Result<List<SysUser>> appQueryUser(@RequestParam(name = "keyword", required = false) String keyword) {
|
||||
Result<List<SysUser>> result = new Result<List<SysUser>>();
|
||||
LambdaQueryWrapper<SysUser> queryWrapper =new LambdaQueryWrapper<SysUser>();
|
||||
//TODO 外部模拟登陆临时账号,列表不显示
|
||||
queryWrapper.ne(SysUser::getUsername,"_reserve_user_external");
|
||||
if(StringUtils.isNotBlank(keyword)){
|
||||
queryWrapper.and(i -> i.like(SysUser::getUsername, keyword).or().like(SysUser::getRealname, keyword));
|
||||
}
|
||||
List<SysUser> list = sysUserService.list(queryWrapper);
|
||||
//批量查询用户的所属部门
|
||||
//step.1 先拿到全部的 useids
|
||||
//step.2 通过 useids,一次性查询用户的所属部门名字
|
||||
List<String> userIds = list.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
if(userIds!=null && userIds.size()>0){
|
||||
Map<String,String> useDepNames = sysUserService.getDepNamesByUserIds(userIds);
|
||||
list.forEach(item->{
|
||||
item.setOrgCodeTxt(useDepNames.get(item.getId()));
|
||||
});
|
||||
}
|
||||
result.setResult(list);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@ -20,14 +21,13 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_category")
|
||||
public class SysCategory implements Serializable {
|
||||
public class SysCategory implements Serializable,Comparable<SysCategory>{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ID_WORKER_STR)
|
||||
private java.lang.String id;
|
||||
/**父级节点*/
|
||||
@Excel(name = "父级节点", width = 15)
|
||||
private java.lang.String pid;
|
||||
/**类型名称*/
|
||||
@Excel(name = "类型名称", width = 15)
|
||||
@ -36,25 +36,34 @@ public class SysCategory implements Serializable {
|
||||
@Excel(name = "类型编码", width = 15)
|
||||
private java.lang.String code;
|
||||
/**创建人*/
|
||||
@Excel(name = "创建人", width = 15)
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Excel(name = "更新人", width = 15)
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@Excel(name = "所属部门", width = 15)
|
||||
private java.lang.String sysOrgCode;
|
||||
/**是否有子节点*/
|
||||
@Excel(name = "是否有子节点", width = 15)
|
||||
@Excel(name = "是否有子节点(1:有)", width = 15)
|
||||
private java.lang.String hasChild;
|
||||
|
||||
@Override
|
||||
public int compareTo(SysCategory o) {
|
||||
//比较条件我们定的是按照code的长度升序
|
||||
// <0:当前对象比传入对象小。
|
||||
// =0:当前对象等于传入对象。
|
||||
// >0:当前对象比传入对象大。
|
||||
int s = this.code.length() - o.code.length();
|
||||
return s;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysCategory [code=" + code + ", name=" + name + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,14 @@ public class SysDepartRolePermission {
|
||||
@Excel(name = "dataRuleIds", width = 15)
|
||||
@ApiModelProperty(value = "dataRuleIds")
|
||||
private java.lang.String dataRuleIds;
|
||||
/** 操作时间 */
|
||||
@Excel(name = "操作时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "操作时间")
|
||||
private java.util.Date operateDate;
|
||||
/** 操作ip */
|
||||
private java.lang.String operateIp;
|
||||
|
||||
public SysDepartRolePermission() {
|
||||
}
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -45,6 +48,18 @@ public class SysRolePermission implements Serializable {
|
||||
*/
|
||||
private String dataRuleIds;
|
||||
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date operateDate;
|
||||
|
||||
/**
|
||||
* 操作ip
|
||||
*/
|
||||
private String operateIp;
|
||||
|
||||
public SysRolePermission() {
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 租户信息
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_tenant")
|
||||
public class SysTenant implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginDate;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 状态 1正常 0冻结
|
||||
*/
|
||||
@Dict(dicCode = "tenant_status")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -102,6 +102,9 @@ public class SysUser implements Serializable {
|
||||
*/
|
||||
private String orgCode;
|
||||
|
||||
/**部门名称*/
|
||||
private transient String orgCodeTxt;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:冻结 )
|
||||
*/
|
||||
@ -175,6 +178,7 @@ public class SysUser implements Serializable {
|
||||
/**
|
||||
* 第三方登录的唯一标识
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String thirdId;
|
||||
|
||||
/**
|
||||
@ -182,4 +186,9 @@ public class SysUser implements Serializable {
|
||||
* (github/github,wechat_enterprise/企业微信,dingtalk/钉钉)
|
||||
*/
|
||||
private String thirdType;
|
||||
|
||||
/**
|
||||
* 多租户id配置,编辑用户的时候设置
|
||||
*/
|
||||
private String relTenantIds;
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
|
||||
public interface SysTenantMapper extends BaseMapper<SysTenant> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.system.mapper.SysTenantMapper">
|
||||
|
||||
</mapper>
|
||||
@ -85,6 +85,7 @@
|
||||
SELECT
|
||||
sys_user.id AS id,
|
||||
sys_user.realname AS realname,
|
||||
sys_user.avatar AS avatar,
|
||||
sys_user.work_no AS workNo,
|
||||
sys_user.post AS post,
|
||||
sys_user.telephone AS telephone,
|
||||
|
||||
@ -21,5 +21,6 @@ public class SysUserSysDepartModel {
|
||||
private String phone;
|
||||
private String departId;
|
||||
private String departName;
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package org.jeecg.modules.system.rule;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
||||
import org.jeecg.common.handler.IFillRuleHandler;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 填值规则Demo:生成订单号
|
||||
* 【测试示例】
|
||||
*/
|
||||
public class OrderNumberRule implements IFillRuleHandler {
|
||||
|
||||
@Override
|
||||
public Object execute(JSONObject params, JSONObject formData) {
|
||||
String prefix = "CN";
|
||||
//订单前缀默认为CN 如果规则参数不为空,则取自定义前缀
|
||||
if (params != null) {
|
||||
Object obj = params.get("prefix");
|
||||
if (obj != null) prefix = obj.toString();
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
int random = RandomUtils.nextInt(90) + 10;
|
||||
String value = prefix + format.format(new Date()) + random;
|
||||
// 根据formData的值的不同,生成不同的订单号
|
||||
String name = formData.getString("name");
|
||||
if (!StringUtils.isEmpty(name)) {
|
||||
value += name;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -102,5 +102,9 @@ public interface ISysDepartService extends IService<SysDepart>{
|
||||
* @return
|
||||
*/
|
||||
List<String> getMySubDepIdsByDepId(String departIds);
|
||||
|
||||
/**
|
||||
* 根据关键字获取部门信息(通讯录)
|
||||
* @return
|
||||
*/
|
||||
List<SysDepartTreeModel> queryTreeByKeyWord(String keyWord);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public interface ISysDictService extends IService<SysDict> {
|
||||
String queryTableDictTextByKey(String table, String text, String code, String key);
|
||||
|
||||
@Deprecated
|
||||
List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray);
|
||||
List<String> queryTableDictByKeys(String table, String text, String code, String keys);
|
||||
|
||||
/**
|
||||
* 根据字典类型删除关联表中其对应的数据
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
|
||||
public interface ISysTenantService extends IService<SysTenant> {
|
||||
|
||||
}
|
||||
@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Joiner;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
@ -500,7 +501,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
|
||||
@Override
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) {
|
||||
return sysDictService.queryTableDictByKeys(table,text,code,keyArray);
|
||||
return sysDictService.queryTableDictByKeys(table,text,code,Joiner.on(",").join(keyArray));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.jeecg.common.util.IPUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDepartRolePermission;
|
||||
import org.jeecg.modules.system.mapper.SysDepartRolePermissionMapper;
|
||||
@ -9,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -22,12 +25,23 @@ public class SysDepartRolePermissionServiceImpl extends ServiceImpl<SysDepartRol
|
||||
|
||||
@Override
|
||||
public void saveDeptRolePermission(String roleId, String permissionIds, String lastPermissionIds) {
|
||||
String ip = "";
|
||||
try {
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//获取IP地址
|
||||
ip = IPUtils.getIpAddr(request);
|
||||
} catch (Exception e) {
|
||||
ip = "127.0.0.1";
|
||||
}
|
||||
List<String> add = getDiff(lastPermissionIds,permissionIds);
|
||||
if(add!=null && add.size()>0) {
|
||||
List<SysDepartRolePermission> list = new ArrayList<SysDepartRolePermission>();
|
||||
for (String p : add) {
|
||||
if(oConvertUtils.isNotEmpty(p)) {
|
||||
SysDepartRolePermission rolepms = new SysDepartRolePermission(roleId, p);
|
||||
rolepms.setOperateDate(new Date());
|
||||
rolepms.setOperateIp(ip);
|
||||
list.add(rolepms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,13 @@ package org.jeecg.modules.system.service.impl;
|
||||
import java.util.*;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.FillRuleConstant;
|
||||
import org.jeecg.common.util.FillRuleUtil;
|
||||
import org.jeecg.common.util.YouBianCodeUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.mapper.*;
|
||||
import org.jeecg.modules.system.model.DepartIdModel;
|
||||
@ -45,6 +47,8 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
private SysDepartRolePermissionMapper departRolePermissionMapper;
|
||||
@Autowired
|
||||
private SysDepartRoleUserMapper departRoleUserMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public List<SysDepartTreeModel> queryMyDeptTreeList(String departIds) {
|
||||
@ -429,4 +433,40 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
|
||||
}
|
||||
return orgCode;
|
||||
}
|
||||
/**
|
||||
* 获取部门树信息根据关键字
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysDepartTreeModel> queryTreeByKeyWord(String keyWord) {
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
|
||||
query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
|
||||
query.orderByAsc(SysDepart::getDepartOrder);
|
||||
List<SysDepart> list = this.list(query);
|
||||
// 调用wrapTreeDataToTreeList方法生成树状数据
|
||||
List<SysDepartTreeModel> listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list);
|
||||
List<SysDepartTreeModel> treelist =new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(keyWord)){
|
||||
this.getTreeByKeyWord(keyWord,listResult,treelist);
|
||||
}else{
|
||||
return listResult;
|
||||
}
|
||||
return treelist;
|
||||
}
|
||||
/**
|
||||
* 根据关键字筛选部门信息
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
public void getTreeByKeyWord(String keyWord,List<SysDepartTreeModel> allResult,List<SysDepartTreeModel> newResult){
|
||||
for (SysDepartTreeModel model:allResult) {
|
||||
if (model.getDepartName().contains(keyWord)){
|
||||
newResult.add(model);
|
||||
continue;
|
||||
}else if(model.getChildren()!=null){
|
||||
getTreeByKeyWord(keyWord,model.getChildren(),newResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.vo.DictModel;
|
||||
import org.jeecg.common.system.vo.DictQuery;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysDict;
|
||||
import org.jeecg.modules.system.entity.SysDictItem;
|
||||
import org.jeecg.modules.system.mapper.SysDictItemMapper;
|
||||
@ -72,7 +73,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
}).collect(Collectors.toList());
|
||||
res.put(d.getDictCode(), dictModelList);
|
||||
}
|
||||
log.debug("-------登录加载系统字典-----" + res.toString());
|
||||
log.info("-------登录加载系统字典-----" + res.toString());
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -133,12 +134,16 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keyArray
|
||||
* @param keys (逗号分隔)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE)
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) {
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys) {
|
||||
if(oConvertUtils.isEmpty(keys)){
|
||||
return null;
|
||||
}
|
||||
String[] keyArray = keys.split(",");
|
||||
List<DictModel> dicts = sysDictMapper.queryTableDictByKeys(table, text, code, keyArray);
|
||||
List<String> texts = new ArrayList<>(dicts.size());
|
||||
// 查询出来的顺序可能是乱的,需要排个序
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.util.IPUtils;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysRolePermission;
|
||||
import org.jeecg.modules.system.mapper.SysRolePermissionMapper;
|
||||
@ -19,6 +17,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色权限表 服务实现类
|
||||
@ -32,6 +32,15 @@ public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionM
|
||||
|
||||
@Override
|
||||
public void saveRolePermission(String roleId, String permissionIds) {
|
||||
String ip = "";
|
||||
try {
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//获取IP地址
|
||||
ip = IPUtils.getIpAddr(request);
|
||||
} catch (Exception e) {
|
||||
ip = "127.0.0.1";
|
||||
}
|
||||
LambdaQueryWrapper<SysRolePermission> query = new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId);
|
||||
this.remove(query);
|
||||
List<SysRolePermission> list = new ArrayList<SysRolePermission>();
|
||||
@ -39,6 +48,8 @@ public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionM
|
||||
for (String p : arr) {
|
||||
if(oConvertUtils.isNotEmpty(p)) {
|
||||
SysRolePermission rolepms = new SysRolePermission(roleId, p);
|
||||
rolepms.setOperateDate(new Date());
|
||||
rolepms.setOperateIp(ip);
|
||||
list.add(rolepms);
|
||||
}
|
||||
}
|
||||
@ -47,12 +58,23 @@ public class SysRolePermissionServiceImpl extends ServiceImpl<SysRolePermissionM
|
||||
|
||||
@Override
|
||||
public void saveRolePermission(String roleId, String permissionIds, String lastPermissionIds) {
|
||||
String ip = "";
|
||||
try {
|
||||
//获取request
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
//获取IP地址
|
||||
ip = IPUtils.getIpAddr(request);
|
||||
} catch (Exception e) {
|
||||
ip = "127.0.0.1";
|
||||
}
|
||||
List<String> add = getDiff(lastPermissionIds,permissionIds);
|
||||
if(add!=null && add.size()>0) {
|
||||
List<SysRolePermission> list = new ArrayList<SysRolePermission>();
|
||||
for (String p : add) {
|
||||
if(oConvertUtils.isNotEmpty(p)) {
|
||||
SysRolePermission rolepms = new SysRolePermission(roleId, p);
|
||||
rolepms.setOperateDate(new Date());
|
||||
rolepms.setOperateIp(ip);
|
||||
list.add(rolepms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.system.entity.SysTenant;
|
||||
import org.jeecg.modules.system.mapper.SysTenantMapper;
|
||||
import org.jeecg.modules.system.service.ISysTenantService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant> implements ISysTenantService {
|
||||
|
||||
|
||||
}
|
||||
@ -360,7 +360,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return result;
|
||||
}
|
||||
//情况2:根据用户信息查询,该用户已注销
|
||||
if (CommonConstant.DEL_FLAG_1.toString().equals(sysUser.getDelFlag())) {
|
||||
//update-begin---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
if (CommonConstant.DEL_FLAG_1==sysUser.getDelFlag()) {
|
||||
//update-end---author:王帅 Date:20200601 for:if条件永远为falsebug------------
|
||||
sysBaseAPI.addLog("用户登录失败,用户名:" + sysUser.getUsername() + "已注销!", CommonConstant.LOG_TYPE_1, null);
|
||||
result.error500("该用户已注销");
|
||||
return result;
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.system.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 多租户 tenant_id存储器
|
||||
*/
|
||||
@Slf4j
|
||||
public class TenantContext {
|
||||
|
||||
private static ThreadLocal<String> currentTenant = new ThreadLocal<>();
|
||||
|
||||
public static void setTenant(String tenant) {
|
||||
log.debug(" setting tenant to " + tenant);
|
||||
currentTenant.set(tenant);
|
||||
}
|
||||
|
||||
public static String getTenant() {
|
||||
return currentTenant.get();
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
currentTenant.remove();
|
||||
}
|
||||
}
|
||||
@ -127,16 +127,16 @@ spring:
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/ jeecg-boot-os-re?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
|
||||
#username: root
|
||||
#password: root
|
||||
#driver-class-name: com.mysql.jdbc.Driver
|
||||
#driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
@ -177,17 +177,17 @@ jeecg :
|
||||
webapp: D://opt//webapp
|
||||
#短信秘钥
|
||||
sms:
|
||||
accessKeyId: ??
|
||||
accessKeySecret: ??
|
||||
accessKeyId: ??
|
||||
accessKeySecret: ??
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
bucketName: jeecgos
|
||||
staticDomain: https://static.jeecg.com
|
||||
staticDomain: ??
|
||||
# ElasticSearch 6设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
@ -197,14 +197,27 @@ jeecg :
|
||||
desform:
|
||||
# 主题颜色(仅支持 16进制颜色代码)
|
||||
theme-color: "#1890ff"
|
||||
# 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置)
|
||||
upload-type: system
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://fileview.jeecg.com
|
||||
file-view-domain: 127.0.0.1:8012
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#Wps在线文档
|
||||
wps:
|
||||
domain: https://wwo.wps.cn/office/
|
||||
appid: ??
|
||||
appsecret: ??
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
@ -215,3 +228,4 @@ cas:
|
||||
#enable swagger
|
||||
swagger:
|
||||
enable: true
|
||||
|
||||
|
||||
@ -127,10 +127,10 @@ spring:
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
|
||||
@ -180,7 +180,7 @@ jeecg :
|
||||
accessKeyId: LTAIpW4gUG7xYDNI
|
||||
accessKeySecret: ??
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
@ -197,6 +197,8 @@ jeecg :
|
||||
desform:
|
||||
# 主题颜色(仅支持 16进制颜色代码)
|
||||
theme-color: "#1890ff"
|
||||
# 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置)
|
||||
upload-type: system
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://fileview.jeecg.com
|
||||
# minio文件上传
|
||||
@ -205,6 +207,17 @@ jeecg :
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
#是否需要校验token
|
||||
is_verify_token: true
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#Wps在线文档
|
||||
wps:
|
||||
domain: https://wwo.wps.cn/office/
|
||||
appid: ??
|
||||
appsecret: ??
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
@ -213,4 +226,4 @@ logging:
|
||||
org.jeecg.modules.system.mapper : debug
|
||||
#enable swagger
|
||||
swagger:
|
||||
enable: false
|
||||
enable: false
|
||||
|
||||
@ -8,16 +8,16 @@ server:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,httptrace
|
||||
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
@ -25,10 +25,10 @@ spring:
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
@ -88,7 +88,7 @@ spring:
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
resource:
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
@ -101,7 +101,7 @@ spring:
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
dynamic:
|
||||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
@ -125,14 +125,14 @@ spring:
|
||||
filters: stat,wall,slf4j
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
|
||||
#username: root
|
||||
#password: root
|
||||
@ -180,7 +180,7 @@ jeecg :
|
||||
accessKeyId: LTAIpW4gUG7xYDNI
|
||||
accessKeySecret: ??
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储配置
|
||||
oss:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
@ -197,6 +197,8 @@ jeecg :
|
||||
desform:
|
||||
# 主题颜色(仅支持 16进制颜色代码)
|
||||
theme-color: "#1890ff"
|
||||
# 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置)
|
||||
upload-type: system
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://127.0.0.1:8012
|
||||
# minio文件上传
|
||||
@ -205,9 +207,20 @@ jeecg :
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
#是否需要校验token
|
||||
is_verify_token: false
|
||||
#必须校验方法
|
||||
verify_methods: remove,delete,save,add,update
|
||||
#Wps在线文档
|
||||
wps:
|
||||
domain: https://wwo.wps.cn/office/
|
||||
appid: ??
|
||||
appsecret: ??
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#enable swagger
|
||||
swagger:
|
||||
enable: true
|
||||
enable: true
|
||||
|
||||
@ -13,16 +13,16 @@ justauth:
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: 0277e675495f14a4a183
|
||||
client-secret: ??
|
||||
client-secret: 4681b5153f7158bcdb9b781d8374841d5f51af04
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: wwc2a8c8b19c201bcc
|
||||
client-secret: ??
|
||||
client-secret: Z6VtKLr3dSzuq8zxTaWacGexQW6qxVK8AHrI2ARDv9c
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: 1000002
|
||||
DINGTALK:
|
||||
client-id: dingoa33vjqxrbyidnmgwo
|
||||
client-secret: ??
|
||||
client-secret: RK1020ctw9mRRElz7oMjfHY12BuYVvjP99iraxu76cq9CIB0gyqeb5FJw_OEBnXA
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/dingtalk/callback
|
||||
cache:
|
||||
type: default
|
||||
|
||||
@ -9,6 +9,6 @@ ${AnsiColor.BRIGHT_BLUE}
|
||||
|
||||
|
||||
${AnsiColor.BRIGHT_GREEN}
|
||||
Jeecg Boot Version: 2.2.0
|
||||
Jeecg Boot Version: 2.2.1
|
||||
Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||
${AnsiColor.BLACK}
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
<#-- 非空校验 -->
|
||||
<#if po.nullable == 'N' || fieldValidType == '*'>
|
||||
{ required: true, message: '请输入${po.filedComment}!'},
|
||||
<#else>
|
||||
{ required: false},
|
||||
</#if>
|
||||
<#-- 唯一校验 -->
|
||||
<#if fieldValidType == 'only'>
|
||||
|
||||
@ -35,6 +35,12 @@ import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
@ -82,6 +88,9 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-添加", notes="${tableVo.ftlDescription}-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody ${entityName} ${entityName?uncap_first}) {
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.save(${entityName?uncap_first});
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
@ -19,8 +19,15 @@
|
||||
<#assign query_sel_multi=false>
|
||||
<#assign query_sel_cat=false>
|
||||
<#assign query_sel_search=false>
|
||||
<#assign query_switch=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
@ -41,6 +48,9 @@
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#assign query_sel_user=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#assign query_switch=true>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#assign query_sel_dep=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
@ -108,6 +118,9 @@
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
@ -156,6 +169,9 @@
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
:scroll="{x:true}"
|
||||
</#if>
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
@ -186,7 +202,7 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)">
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
@ -198,6 +214,14 @@
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
@ -210,7 +234,7 @@
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
|
||||
<${tableName?replace("_","-")}-modal ref="modalForm" @ok="modalFormOk"></${tableName?replace("_","-")}-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@ -220,6 +244,10 @@
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
|
||||
<#if query_field_select>
|
||||
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
|
||||
</#if>
|
||||
@ -256,6 +284,9 @@
|
||||
<#if query_sel_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
@ -288,6 +319,9 @@
|
||||
<#if query_sel_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
JSwitch,
|
||||
</#if>
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
@ -331,6 +365,9 @@
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
<#elseif po.classType=='switch'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : ''),
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
|
||||
dataIndex: '${po.fieldName}_dictText'
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
@ -352,7 +389,7 @@
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
<#if tableVo.extendParams.scroll=='1'>
|
||||
// fixed:"right",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
</#if>
|
||||
scopedSlots: { customRender: 'action' }
|
||||
@ -364,18 +401,42 @@
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
//代码生成后需手动设置流程编码
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
<#if list_need_pca>
|
||||
pcaData:''
|
||||
</#if>
|
||||
}
|
||||
},
|
||||
<#if list_need_pca>
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
},
|
||||
</#if>
|
||||
<#if list_need_switch>
|
||||
<#list columns as po>
|
||||
<#if po.classType=='switch'>
|
||||
<#if po.dictField?default("")?trim?length gt 1>
|
||||
<#assign switch_extend_arr=po.dictField?eval>
|
||||
<#else>
|
||||
<#assign switch_extend_arr=['Y','N']>
|
||||
</#if>
|
||||
<#list switch_extend_arr as a>
|
||||
<#if a_index == 0>
|
||||
<#assign switch_extend_arr1=a>
|
||||
<#else>
|
||||
<#assign switch_extend_arr2=a>
|
||||
</#if>
|
||||
</#list>
|
||||
this.$set(this.dictOptions, '${po.fieldName}', [{text:'是',value:'${switch_extend_arr1}'},{text:'否',value:'${switch_extend_arr2}'}])
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
@ -387,6 +448,33 @@
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
|
||||
@ -0,0 +1,346 @@
|
||||
<#--<#include "../../../../../../../common/utils.ftl">-->
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<a-form :form="form" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
<a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
|
||||
<a-button @click="submitForm">提 交</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</j-form-container>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
import JFormContainer from '@/components/jeecg/JFormContainer'
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}Form",
|
||||
components: {
|
||||
JFormContainer,
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
props: {
|
||||
//流程表单data
|
||||
formData: {
|
||||
type: Object,
|
||||
default: ()=>{},
|
||||
required: false
|
||||
},
|
||||
//表单模式:false流程表单 true普通表单
|
||||
normal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
},
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById"
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
if(this.normal===false){
|
||||
if(this.formData.disabled===false){
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}
|
||||
return this.disabled
|
||||
},
|
||||
showFlowSubmitButton(){
|
||||
if(this.normal===false){
|
||||
if(this.formData.disabled===false){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//如果是流程中表单,则需要加载流程表单data
|
||||
this.showFlowData();
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({});
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
})
|
||||
},
|
||||
//渲染流程表单数据
|
||||
showFlowData(){
|
||||
if(this.normal === false){
|
||||
let params = {id:this.formData.dataId};
|
||||
getAction(this.url.queryById,params).then((res)=>{
|
||||
if(res.success){
|
||||
this.edit (res.result);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
submitForm () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
console.log("表单提交数据",formData)
|
||||
httpAction(httpurl,formData,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
popupCallback(row){
|
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.form.setFieldsValue(backObj)
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -1,226 +1,54 @@
|
||||
<#--<#include "../../../../../../../common/utils.ftl">-->
|
||||
<#include "/common/utils.ftl">
|
||||
<#assign modal_width = 800>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign modal_width = 896>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign modal_width = 1024>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign modal_width = 1280>
|
||||
</#if>
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disablesubmit} }"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${tableName?replace("_","-")}-form>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
|
||||
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
export default {
|
||||
name: "${entityName}Modal",
|
||||
components: {
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
components: {
|
||||
${entityName}Form
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
title:"操作",
|
||||
width:800,
|
||||
title:'',
|
||||
width:${modal_width},
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
}
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({});
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
},
|
||||
close () {
|
||||
@ -228,50 +56,15 @@
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
console.log("表单提交数据",formData)
|
||||
httpAction(httpurl,formData,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
popupCallback(row){
|
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.form.setFieldsValue(backObj)
|
||||
}
|
||||
</#if>
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -1,4 +1,12 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<#assign modal_width = 800>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign modal_width = 896>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign modal_width = 1024>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign modal_width = 1280>
|
||||
</#if>
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
@ -7,210 +15,58 @@
|
||||
:closable="false"
|
||||
@close="close"
|
||||
:visible="visible">
|
||||
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField?default("")}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
</a-form>
|
||||
</a-spin>
|
||||
<a-button type="primary" @click="handleOk">确定</a-button>
|
||||
<a-button type="primary" @click="handleCancel">取消</a-button>
|
||||
<${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></${tableName?replace("_","-")}-form>
|
||||
<div class="drawer-footer">
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction } from '@/api/manage'
|
||||
import pick from 'lodash.pick'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
|
||||
export default {
|
||||
name: "${entityName}Modal",
|
||||
components: {
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
components: {
|
||||
${entityName}Form
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
form: this.$form.createForm(this),
|
||||
title:"操作",
|
||||
width:800,
|
||||
width:${modal_width},
|
||||
visible: false,
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
}
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({});
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model<#list columns as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>))
|
||||
})
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
let formData = Object.assign(this.model, values);
|
||||
console.log("表单提交数据",formData)
|
||||
httpAction(httpurl,formData,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
popupCallback(row){
|
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'>,'${po.fieldName}'</#if></#list>))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -222,4 +78,15 @@
|
||||
margin-bottom: 30px;
|
||||
float: right;
|
||||
}
|
||||
.drawer-footer{
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 16px;
|
||||
text-align: right;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
</style>
|
||||
@ -45,6 +45,12 @@ import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
<#assign bpm_flag=false>
|
||||
<#list originalColumns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* @Description: ${tableVo.ftlDescription}
|
||||
@ -98,6 +104,9 @@ public class ${entityName}Controller {
|
||||
public Result<?> add(@RequestBody ${entityName}Page ${entityName?uncap_first}Page) {
|
||||
${entityName} ${entityName?uncap_first} = new ${entityName}();
|
||||
BeanUtils.copyProperties(${entityName?uncap_first}Page, ${entityName?uncap_first});
|
||||
<#if bpm_flag>
|
||||
${entityName?uncap_first}.setBpmStatus("1");
|
||||
</#if>
|
||||
${entityName?uncap_first}Service.saveMain(${entityName?uncap_first}, <#list subTables as sub>${entityName?uncap_first}Page.get${sub.entityName}List()<#if sub_has_next>,</#if></#list>);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ -27,6 +28,19 @@ public class ${entityName}Page {
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
<#else>
|
||||
@ -46,18 +60,21 @@ public class ${entityName}Page {
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15)
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
private <#if po.fieldType=='java.sql.Blob'>byte[]<#else>${po.fieldType}</#if> ${po.fieldName};
|
||||
</#list>
|
||||
|
||||
|
||||
<#list subTables as sub>
|
||||
@ExcelCollection(name="${sub.ftlDescription}")
|
||||
@ApiModelProperty(value = "${sub.ftlDescription}")
|
||||
private List<${sub.entityName}> ${sub.entityName?uncap_first}List;
|
||||
</#list>
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -19,8 +19,13 @@
|
||||
<#assign query_sel_multi=false>
|
||||
<#assign query_sel_cat=false>
|
||||
<#assign query_sel_search=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
@ -159,6 +164,7 @@
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
@ -181,10 +187,15 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)">
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
@ -193,6 +204,14 @@
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<#if bpm_flag>
|
||||
<a-menu-item v-if="record.bpmStatus === '1'">
|
||||
<a @click="startProcess(record)">发起流程</a>
|
||||
</a-menu-item>
|
||||
</#if>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
@ -205,7 +224,7 @@
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
|
||||
<${tableName?replace("_","-")}-modal ref="modalForm" @ok="modalFormOk"/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@ -250,6 +269,9 @@
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
import '@/assets/less/TableExpand.less'
|
||||
<#if bpm_flag>
|
||||
import { postAction } from '@/api/manage'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
@ -319,6 +341,9 @@
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='image'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'imgSlot'}
|
||||
@ -342,6 +367,7 @@
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
@ -351,16 +377,30 @@
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
|
||||
<#if bpm_flag>startProcess: '/process/extActProcess/startMutilProcess'</#if>
|
||||
},
|
||||
<#if bpm_flag>
|
||||
flowCode: 'dev_${tableName}_001',
|
||||
</#if>
|
||||
dictOptions:{},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
@ -373,7 +413,34 @@
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
<#if bpm_flag>
|
||||
startProcess(record){
|
||||
this.$confirm({
|
||||
title:'提示',
|
||||
content:'确认提交流程吗?',
|
||||
onOk:()=>{
|
||||
let params = {
|
||||
flowCode: this.flowCode,
|
||||
id: record.id,
|
||||
formUrl: '${entityPackage}/modules/${entityName}Form',
|
||||
formUrlMobile: ''
|
||||
}
|
||||
postAction(this.url.startProcess, params).then(res=>{
|
||||
if(res.success){
|
||||
this.$message.success(res.message);
|
||||
this.loadData();
|
||||
this.onClearSelected();
|
||||
}else{
|
||||
this.$message.warning(res.message);
|
||||
}
|
||||
}).catch((e)=>{
|
||||
this.$message.warning('不识别的请求!');
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
</#if>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,534 @@
|
||||
<#include "/common/utils.ftl">
|
||||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<!-- 主表单区域 -->
|
||||
<a-form :form="form" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum==2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.classType =='textarea'>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<#else>
|
||||
<a-col :span="${form_span}" >
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
</#if>
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</j-form-container>
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model="activeKey" @change="handleChangeTabs">
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<${Format.humpToShortbar(sub.entityName)}-form ref="${sub.entityName?uncap_first}Form" @validateError="validateError" :disabled="formDisabled"></${Format.humpToShortbar(sub.entityName)}-form>
|
||||
</a-tab-pane>
|
||||
|
||||
<#else>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<j-editable-table
|
||||
:ref="refKeys[${sub_index}]"
|
||||
:loading="${sub.entityName?uncap_first}Table.loading"
|
||||
:columns="${sub.entityName?uncap_first}Table.columns"
|
||||
:dataSource="${sub.entityName?uncap_first}Table.dataSource"
|
||||
:maxHeight="300"
|
||||
:disabled="formDisabled"
|
||||
:rowNumber="true"
|
||||
:rowSelection="true"
|
||||
:actionButton="true"/>
|
||||
</a-tab-pane>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-tabs>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import pick from 'lodash.pick'
|
||||
import { getAction } from '@/api/manage'
|
||||
import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
|
||||
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
import JFormContainer from '@/components/jeecg/JFormContainer'
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
import ${sub.entityName}Form from './${sub.entityName}Form.vue'
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}Form',
|
||||
mixins: [JEditableTableMixin],
|
||||
components: {
|
||||
JFormContainer,
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
${sub.entityName}Form,
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
labelCol2: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 },
|
||||
},
|
||||
wrapperCol2: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 },
|
||||
},
|
||||
// 新增时子表默认添加几行空数据
|
||||
addDefaultRowNum: 1,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
refKeys: [<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>],
|
||||
<#assign hasOne2Many = false>
|
||||
tableKeys:[<#list subTables as sub><#if sub.foreignRelationType =='0'>'${sub.entityName?uncap_first}', <#assign hasOne2Many = true></#if></#list>],
|
||||
activeKey: '${subTables[0].entityName?uncap_first}',
|
||||
<#list subTables as sub><#rt/>
|
||||
// ${sub.ftlDescription}
|
||||
${sub.entityName?uncap_first}Table: {
|
||||
loading: false,
|
||||
dataSource: [],
|
||||
columns: [
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
<#assign popupBackFields = "">
|
||||
|
||||
<#-- 循环子表的列 开始 -->
|
||||
<#list sub.colums as col><#rt/>
|
||||
<#if col.isShow =='Y'>
|
||||
<#if col.filedComment !='外键' >
|
||||
{
|
||||
title: '${col.filedComment}',
|
||||
key: '${col.fieldName}',
|
||||
<#if col.classType =='date'>
|
||||
type: FormTypes.date,
|
||||
<#elseif col.classType =='datetime'>
|
||||
type: FormTypes.datetime,
|
||||
<#elseif "int,decimal,double,"?contains(col.classType)>
|
||||
type: FormTypes.inputNumber,
|
||||
<#elseif col.classType =='list' || col.classType =='radio'>
|
||||
type: FormTypes.select,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
type: FormTypes.list_multi,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='sel_search'>
|
||||
type: FormTypes.sel_search,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='image'>
|
||||
type: FormTypes.image,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#elseif col.classType =='file'>
|
||||
type: FormTypes.file,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#elseif col.classType =='popup'>
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">
|
||||
<#else>
|
||||
<#assign popupBackFields = "${col.dictText}">
|
||||
</#if>
|
||||
type: FormTypes.popup,
|
||||
popupCode:"${col.dictTable}",
|
||||
destFields:"${Format.underlineToHump(col.dictText)}",
|
||||
orgFields:"${col.dictField}",
|
||||
<#elseif col.fieldDbType=='int' || col.fieldDbType=='double' || col.fieldDbType=='BigDecimal'>
|
||||
type: FormTypes.inputNumber,
|
||||
<#else>
|
||||
type: FormTypes.input,
|
||||
</#if>
|
||||
<#if col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
width:"250px",
|
||||
<#else>
|
||||
width:"200px",
|
||||
</#if>
|
||||
<#if col.classType =='file'>
|
||||
placeholder: '请选择文件',
|
||||
<#else>
|
||||
placeholder: '请输入${'$'}{title}',
|
||||
</#if>
|
||||
defaultValue: '',
|
||||
<#-- 子表的校验 -->
|
||||
<#assign subFieldValidType = col.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if col.nullable == 'N' || subFieldValidType == '*'>
|
||||
validateRules: [{ required: true, message: '${'$'}{title}不能为空' }],
|
||||
<#-- 其他情况下,只要有值就被认为是正则校验 -->
|
||||
<#elseif subFieldValidType?length gt 0>
|
||||
<#assign subMessage = '格式不正确'>
|
||||
<#if subFieldValidType == 'only' >
|
||||
<#assign subMessage = '不能重复'>
|
||||
</#if>
|
||||
validateRules: [{ pattern: "${subFieldValidType}", message: "${'$'}{title}${subMessage}" }],
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 循环子表的列 结束 -->
|
||||
|
||||
<#-- 处理popup的隐藏列 -->
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#list popupBackFields?split(",") as item>
|
||||
<#if item?length gt 0>
|
||||
<#assign tempItemFlag = true>
|
||||
|
||||
<#list sub.colums as col>
|
||||
<#if col.isShow =='Y' && col.fieldName == item>
|
||||
<#assign tempItemFlag = false>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if tempItemFlag>
|
||||
{
|
||||
title: '${item}',
|
||||
key: '${item}',
|
||||
type:"hidden"
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</#if>
|
||||
]
|
||||
},
|
||||
</#list>
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
queryById: "/${entityPackage}/${entityName?uncap_first}/queryById",
|
||||
<#list subTables as sub><#rt/>
|
||||
${sub.entityName?uncap_first}: {
|
||||
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
|
||||
},
|
||||
</#list>
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
//流程表单data
|
||||
formData: {
|
||||
type: Object,
|
||||
default: ()=>{},
|
||||
required: false
|
||||
},
|
||||
//表单模式:false流程表单 true普通表单
|
||||
normal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
},
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
if(this.normal===false){
|
||||
if(this.formData.disabled===false){
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}
|
||||
return this.disabled
|
||||
},
|
||||
showFlowSubmitButton(){
|
||||
if(this.normal===false){
|
||||
if(this.formData.disabled===false){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
//如果是流程中表单,则需要加载流程表单data
|
||||
this.showFlowData();
|
||||
},
|
||||
methods: {
|
||||
getAllTable() {
|
||||
<#if hasOne2Many==true>
|
||||
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
||||
return Promise.all(values)
|
||||
<#else>
|
||||
return new Promise(resolve => {
|
||||
resolve([]);
|
||||
})
|
||||
</#if>
|
||||
},
|
||||
/** 调用完edit()方法之后会自动调用此方法 */
|
||||
editAfter() {
|
||||
let fieldval = pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(fieldval)
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
this.$refs.${sub.entityName?uncap_first}Form.initFormData(this.url.${sub.entityName?uncap_first}.list,this.model.id)
|
||||
</#if>
|
||||
</#list>
|
||||
})
|
||||
// 加载子表数据
|
||||
if (this.model.id) {
|
||||
let params = { id: this.model.id }
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
this.requestSubTableData(this.url.${sub.entityName?uncap_first}.list, params, this.${sub.entityName?uncap_first}Table)
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
/** 整理成formData */
|
||||
classifyIntoFormData(allValues) {
|
||||
let main = Object.assign(this.model, allValues.formValue)
|
||||
return {
|
||||
...main, // 展开
|
||||
<#assign subManyIndex = 0>
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
${sub.entityName?uncap_first}List: allValues.tablesValue[${subManyIndex}].values,
|
||||
<#assign subManyIndex = subManyIndex+1>
|
||||
<#else>
|
||||
${sub.entityName?uncap_first}List: this.$refs.${sub.entityName?uncap_first}Form.getFormData(),
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
//渲染流程表单数据
|
||||
showFlowData(){
|
||||
if(this.normal === false){
|
||||
let params = {id:this.formData.dataId};
|
||||
getAction(this.url.queryById,params).then((res)=>{
|
||||
if(res.success){
|
||||
this.edit (res.result);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
validateError(msg){
|
||||
this.$message.error(msg)
|
||||
},
|
||||
popupCallback(row){
|
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.form.setFieldsValue(backObj)
|
||||
}
|
||||
</#if>
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@ -5,435 +5,58 @@
|
||||
:width="1200"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:confirmLoading="confirmLoading"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||
@cancel="handleCancel">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<!-- 主表单区域 -->
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.classType =='textarea'>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<#else>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
</#if>
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
||||
<!-- 子表单区域 -->
|
||||
<a-tabs v-model="activeKey" @change="handleChangeTabs">
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<${Format.humpToShortbar(sub.entityName)}-form ref="${sub.entityName?uncap_first}Form" @validateError="validateError"></${Format.humpToShortbar(sub.entityName)}-form>
|
||||
</a-tab-pane>
|
||||
|
||||
<#else>
|
||||
<a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
|
||||
<j-editable-table
|
||||
:ref="refKeys[${sub_index}]"
|
||||
:loading="${sub.entityName?uncap_first}Table.loading"
|
||||
:columns="${sub.entityName?uncap_first}Table.columns"
|
||||
:dataSource="${sub.entityName?uncap_first}Table.dataSource"
|
||||
:maxHeight="300"
|
||||
:rowNumber="true"
|
||||
:rowSelection="true"
|
||||
:actionButton="true"/>
|
||||
</a-tab-pane>
|
||||
|
||||
</#if>
|
||||
</#list>
|
||||
</a-tabs>
|
||||
|
||||
</a-spin>
|
||||
<${tableName?replace("_","-")}-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal/>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import pick from 'lodash.pick'
|
||||
import { FormTypes,getRefPromise } from '@/utils/JEditableTableUtil'
|
||||
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
import ${sub.entityName}Form from './${sub.entityName}Form.vue'
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
<#if form_file>
|
||||
import JUpload from '@/components/jeecg/JUpload'
|
||||
</#if>
|
||||
<#if form_image>
|
||||
import JImageUpload from '@/components/jeecg/JImageUpload'
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if form_select>
|
||||
import JDictSelectTag from "@/components/dict/JDictSelectTag"
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
import ${entityName}Form from './${entityName}Form'
|
||||
|
||||
export default {
|
||||
name: '${entityName}Modal',
|
||||
mixins: [JEditableTableMixin],
|
||||
components: {
|
||||
<#list subTables as sub>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
${sub.entityName}Form,
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if form_file>
|
||||
JUpload,
|
||||
</#if>
|
||||
<#if form_image>
|
||||
JImageUpload,
|
||||
</#if>
|
||||
<#if form_sel_depart>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if form_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if form_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect
|
||||
</#if>
|
||||
${entityName}Form
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
labelCol2: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 3 },
|
||||
},
|
||||
wrapperCol2: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 20 },
|
||||
},
|
||||
// 新增时子表默认添加几行空数据
|
||||
addDefaultRowNum: 1,
|
||||
<#include "/common/validatorRulesTemplate/main.ftl">
|
||||
refKeys: [<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>],
|
||||
<#assign hasOne2Many = false>
|
||||
tableKeys:[<#list subTables as sub><#if sub.foreignRelationType =='0'>'${sub.entityName?uncap_first}', <#assign hasOne2Many = true></#if></#list>],
|
||||
activeKey: '${subTables[0].entityName?uncap_first}',
|
||||
<#list subTables as sub><#rt/>
|
||||
// ${sub.ftlDescription}
|
||||
${sub.entityName?uncap_first}Table: {
|
||||
loading: false,
|
||||
dataSource: [],
|
||||
columns: [
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
<#assign popupBackFields = "">
|
||||
|
||||
<#-- 循环子表的列 开始 -->
|
||||
<#list sub.colums as col><#rt/>
|
||||
<#if col.isShow =='Y'>
|
||||
<#if col.filedComment !='外键' >
|
||||
{
|
||||
title: '${col.filedComment}',
|
||||
key: '${col.fieldName}',
|
||||
<#if col.classType =='date'>
|
||||
type: FormTypes.date,
|
||||
<#elseif col.classType =='datetime'>
|
||||
type: FormTypes.datetime,
|
||||
<#elseif "int,decimal,double,"?contains(col.classType)>
|
||||
type: FormTypes.inputNumber,
|
||||
<#elseif col.classType =='list' || col.classType =='radio'>
|
||||
type: FormTypes.select,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
type: FormTypes.list_multi,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='sel_search'>
|
||||
type: FormTypes.sel_search,
|
||||
<#if col.dictTable?default("")?trim?length gt 1>
|
||||
dictCode:"${col.dictTable},${col.dictText},${col.dictField}",
|
||||
<#else>
|
||||
dictCode:"${col.dictField}",
|
||||
</#if>
|
||||
<#elseif col.classType =='image'>
|
||||
type: FormTypes.image,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#elseif col.classType =='file'>
|
||||
type: FormTypes.file,
|
||||
token:true,
|
||||
responseName:"message",
|
||||
<#elseif col.classType =='popup'>
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#assign popupBackFields = "${popupBackFields}"+","+"${col.dictText}">
|
||||
<#else>
|
||||
<#assign popupBackFields = "${col.dictText}">
|
||||
</#if>
|
||||
type: FormTypes.popup,
|
||||
popupCode:"${col.dictTable}",
|
||||
destFields:"${Format.underlineToHump(col.dictText)}",
|
||||
orgFields:"${col.dictField}",
|
||||
<#else>
|
||||
type: FormTypes.input,
|
||||
</#if>
|
||||
<#if col.classType =='list_multi' || col.classType =='checkbox'>
|
||||
width:"250px",
|
||||
<#else>
|
||||
width:"200px",
|
||||
</#if>
|
||||
<#if col.classType =='file'>
|
||||
placeholder: '请选择文件',
|
||||
<#else>
|
||||
placeholder: '请输入${'$'}{title}',
|
||||
</#if>
|
||||
defaultValue: '',
|
||||
<#-- 子表的校验 -->
|
||||
<#assign subFieldValidType = col.fieldValidType!''>
|
||||
<#-- 非空校验 -->
|
||||
<#if col.nullable == 'N' || subFieldValidType == '*'>
|
||||
validateRules: [{ required: true, message: '${'$'}{title}不能为空' }],
|
||||
<#-- 其他情况下,只要有值就被认为是正则校验 -->
|
||||
<#elseif subFieldValidType?length gt 0>
|
||||
<#assign subMessage = '格式不正确'>
|
||||
<#if subFieldValidType == 'only' >
|
||||
<#assign subMessage = '不能重复'>
|
||||
</#if>
|
||||
validateRules: [{ pattern: "${subFieldValidType}", message: "${'$'}{title}${subMessage}" }],
|
||||
</#if>
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 循环子表的列 结束 -->
|
||||
|
||||
<#-- 处理popup的隐藏列 -->
|
||||
<#if popupBackFields?length gt 0>
|
||||
<#list popupBackFields?split(",") as item>
|
||||
<#if item?length gt 0>
|
||||
<#assign tempItemFlag = true>
|
||||
|
||||
<#list sub.colums as col>
|
||||
<#if col.isShow =='Y' && col.fieldName == item>
|
||||
<#assign tempItemFlag = false>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if tempItemFlag>
|
||||
{
|
||||
title: '${item}',
|
||||
key: '${item}',
|
||||
type:"hidden"
|
||||
},
|
||||
</#if>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
</#if>
|
||||
]
|
||||
},
|
||||
</#list>
|
||||
url: {
|
||||
add: "/${entityPackage}/${entityName?uncap_first}/add",
|
||||
edit: "/${entityPackage}/${entityName?uncap_first}/edit",
|
||||
<#list subTables as sub><#rt/>
|
||||
${sub.entityName?uncap_first}: {
|
||||
list: '/${entityPackage}/${entityName?uncap_first}/query${sub.entityName}ByMainId'
|
||||
},
|
||||
</#list>
|
||||
}
|
||||
title:'',
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getAllTable() {
|
||||
<#if hasOne2Many==true>
|
||||
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
||||
return Promise.all(values)
|
||||
<#else>
|
||||
return new Promise(resolve => {
|
||||
resolve([]);
|
||||
methods:{
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
</#if>
|
||||
},
|
||||
/** 调用完edit()方法之后会自动调用此方法 */
|
||||
editAfter() {
|
||||
let fieldval = pick(this.model<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(fieldval)
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='1'>
|
||||
this.$refs.${sub.entityName?uncap_first}Form.initFormData(this.url.${sub.entityName?uncap_first}.list,this.model.id)
|
||||
</#if>
|
||||
</#list>
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
// 加载子表数据
|
||||
if (this.model.id) {
|
||||
let params = { id: this.model.id }
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
this.requestSubTableData(this.url.${sub.entityName?uncap_first}.list, params, this.${sub.entityName?uncap_first}Table)
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
},
|
||||
/** 整理成formData */
|
||||
classifyIntoFormData(allValues) {
|
||||
let main = Object.assign(this.model, allValues.formValue)
|
||||
return {
|
||||
...main, // 展开
|
||||
<#assign subManyIndex = 0>
|
||||
<#list subTables as sub><#rt/>
|
||||
<#if sub.foreignRelationType =='0'>
|
||||
${sub.entityName?uncap_first}List: allValues.tablesValue[${subManyIndex}].values,
|
||||
<#assign subManyIndex = subManyIndex+1>
|
||||
<#else>
|
||||
${sub.entityName?uncap_first}List: this.$refs.${sub.entityName?uncap_first}Form.getFormData(),
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
validateError(msg){
|
||||
this.$message.error(msg)
|
||||
handleOk () {
|
||||
this.$refs.realForm.handleOk();
|
||||
},
|
||||
popupCallback(row){
|
||||
this.form.setFieldsValue(pick(row<#list columns as po><#if po.fieldName !='id'><#if po.fieldDbType=='Blob'>,'${po.fieldName}String'<#else>,'${po.fieldName}'</#if></#if></#list>))
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.form.setFieldsValue(backObj)
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
</#if>
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -3,20 +3,34 @@
|
||||
<#if sub.foreignRelationType=='1'>
|
||||
#segment#${sub.entityName}Form.vue
|
||||
<template>
|
||||
<div>
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<j-form-container :disabled="disabled">
|
||||
<a-form :form="form" slot="detail">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
<#assign form_select_search = false>
|
||||
<#assign form_popup = false>
|
||||
<#assign form_sel_depart = false>
|
||||
<#assign form_sel_user = false>
|
||||
<#assign form_file = false>
|
||||
<#assign form_image = false>
|
||||
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#if tableVo.fieldRowNum == 2>
|
||||
<#assign form_span = 12>
|
||||
<#elseif tableVo.fieldRowNum==3>
|
||||
<#assign form_span = 8>
|
||||
<#elseif tableVo.fieldRowNum==4>
|
||||
<#assign form_span = 6>
|
||||
</#if>
|
||||
<#list sub.colums as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
@ -24,64 +38,95 @@
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.classType =='textarea'>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
|
||||
<#else>
|
||||
<a-col :xs="24" :sm="12">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
</#if>
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-form-item>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
</#list>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</j-form-container>
|
||||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import { getAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
import JFormContainer from '@/components/jeecg/JFormContainer'
|
||||
<#if form_date>
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
</#if>
|
||||
@ -103,10 +148,29 @@
|
||||
<#if form_select_multi>
|
||||
import JMultiSelectTag from "@/components/dict/JMultiSelectTag"
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
import JEditor from '@/components/jeecg/JEditor'
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${sub.entityName}Form',
|
||||
components: {
|
||||
components: {
|
||||
JFormContainer,
|
||||
<#if form_date>
|
||||
JDate,
|
||||
</#if>
|
||||
@ -128,6 +192,31 @@
|
||||
<#if form_select_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if form_select_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
props:{
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
@ -204,8 +293,12 @@
|
||||
clearFormData(){
|
||||
this.form.resetFields()
|
||||
this.model={}
|
||||
},
|
||||
<#if form_cat_tree>
|
||||
handleCategoryChange(value,backObj){
|
||||
this.form.setFieldsValue(backObj);
|
||||
}
|
||||
|
||||
</#if>
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -97,9 +97,35 @@ public class ${entityName}Controller extends JeecgController<${entityName}, I${e
|
||||
public Result<?> queryPageList(${entityName} ${entityName?uncap_first},HttpServletRequest req) {
|
||||
QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap());
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
return Result.ok(list);
|
||||
IPage<LvTestTree> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.ok(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量查询子节点
|
||||
* @param parentIds 父ID(多个采用半角逗号分割)
|
||||
* @return 返回 IPage
|
||||
* @param parentIds
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "${tableVo.ftlDescription}-批量获取子数据")
|
||||
@ApiOperation(value="${tableVo.ftlDescription}-批量获取子数据", notes="${tableVo.ftlDescription}-批量获取子数据")
|
||||
@GetMapping("/getChildListBatch")
|
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) {
|
||||
try {
|
||||
QueryWrapper<${entityName}> queryWrapper = new QueryWrapper<>();
|
||||
List<String> parentIdList = Arrays.asList(parentIds.split(","));
|
||||
queryWrapper.in("${Format.humpToUnderline(pidFieldName)}", parentIdList);
|
||||
List<${entityName}> list = ${entityName?uncap_first}Service.list(queryWrapper);
|
||||
IPage<${entityName}> pageList = new Page<>(1, 10, list.size());
|
||||
pageList.setRecords(list);
|
||||
return Result.ok(pageList);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("批量查询子节点失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
|
||||
@ -10,7 +10,150 @@
|
||||
</#list>
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<#assign query_field_no=0>
|
||||
<#assign query_field_select=false>
|
||||
<#assign query_field_date=false>
|
||||
<#assign list_need_dict=false>
|
||||
<#assign list_need_category=false>
|
||||
<#assign query_field_pca=false>
|
||||
<#assign list_need_pca=false>
|
||||
<#assign query_flag=false>
|
||||
<#assign query_inp=false>
|
||||
<#assign query_popup=false>
|
||||
<#assign query_sel_user=false>
|
||||
<#assign query_sel_dep=false>
|
||||
<#assign query_sel_multi=false>
|
||||
<#assign query_sel_cat=false>
|
||||
<#assign query_sel_search=false>
|
||||
<#assign query_switch=false>
|
||||
<#assign list_need_switch=false>
|
||||
<#assign bpm_flag=false>
|
||||
|
||||
<#-- 开始循环 -->
|
||||
<#list columns as po>
|
||||
<#if po.fieldDbName=='bpm_status'>
|
||||
<#assign bpm_flag=true>
|
||||
</#if>
|
||||
<#if po.isQuery=='Y'>
|
||||
<#assign query_flag=true>
|
||||
<#if query_field_no==2>
|
||||
<template v-if="toggleSearchStatus">
|
||||
</#if>
|
||||
<#assign query_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign query_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<#if po.queryMode=='single'>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='sel_search'>
|
||||
<#assign query_sel_search=true>
|
||||
<#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.classType=='sel_user'>
|
||||
<#assign query_sel_user=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='switch'>
|
||||
<#assign query_switch=true>
|
||||
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if> query></j-switch>
|
||||
<#elseif po.classType=='sel_depart'>
|
||||
<#assign query_sel_dep=true>
|
||||
<#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='list_multi'>
|
||||
<#assign query_sel_multi=true>
|
||||
<#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign query_sel_cat=true>
|
||||
<#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
|
||||
<#elseif po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
|
||||
<#elseif po.classType=='pca'>
|
||||
<#assign query_field_pca=true>
|
||||
<#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
|
||||
<#elseif po.classType=='popup'>
|
||||
<#if query_field_no gt 1> </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#assign query_field_select=true>
|
||||
<#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
|
||||
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
|
||||
<#if po.classType=='date'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#elseif po.classType=='datetime'>
|
||||
<#assign query_field_date=true>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
|
||||
<#else>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
|
||||
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
|
||||
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
|
||||
</#if>
|
||||
<#if query_field_no gt 1> </#if></a-form-item>
|
||||
<#if query_field_no gt 1> </#if></a-col>
|
||||
</#if>
|
||||
<#assign query_field_no=query_field_no+1>
|
||||
</#if>
|
||||
<#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_need_dict=true>
|
||||
</#if>
|
||||
<#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
|
||||
<#assign list_need_category=true>
|
||||
</#if>
|
||||
<#if po.classType=='pca'>
|
||||
<#assign list_need_pca=true>
|
||||
</#if>
|
||||
<#if po.classType=='switch'>
|
||||
<#assign list_need_switch=true>
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- 结束循环 -->
|
||||
<#t>
|
||||
<#if query_field_no gt 2>
|
||||
</template>
|
||||
</#if>
|
||||
<#if query_flag>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
</span>
|
||||
</a-col>
|
||||
</#if>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
@ -45,7 +188,7 @@
|
||||
@change="handleTableChange"
|
||||
@expand="handleExpand"
|
||||
v-bind="tableProps">
|
||||
|
||||
|
||||
<template slot="imgSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
@ -58,7 +201,7 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)">
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
@ -95,11 +238,78 @@
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import ${entityName}Modal from './modules/${entityName}Modal'
|
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
||||
|
||||
import { filterObj } from '@/utils/util';
|
||||
<#if query_field_select>
|
||||
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
import JDate from '@/components/jeecg/JDate.vue'
|
||||
</#if>
|
||||
<#if list_need_category>
|
||||
import { loadCategoryData } from '@/api/api'
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if list_need_pca>
|
||||
import Area from '@/components/_util/Area'
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
import JInput from '@comp/jeecg/JInput'
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
import JCategorySelect from '@comp/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}List",
|
||||
mixins:[JeecgListMixin],
|
||||
components: {
|
||||
<#if query_field_select>
|
||||
JDictSelectTag,
|
||||
</#if>
|
||||
<#if query_field_date>
|
||||
JDate,
|
||||
</#if>
|
||||
<#if query_field_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if query_inp>
|
||||
JInput,
|
||||
</#if>
|
||||
<#if query_sel_user>
|
||||
JSelectUserByDep,
|
||||
</#if>
|
||||
<#if query_sel_dep>
|
||||
JSelectDepart,
|
||||
</#if>
|
||||
<#if query_sel_multi>
|
||||
JMultiSelectTag,
|
||||
</#if>
|
||||
<#if query_sel_cat>
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if query_sel_search>
|
||||
JSearchSelectTag,
|
||||
</#if>
|
||||
<#if query_switch>
|
||||
JSwitch,
|
||||
</#if>
|
||||
${entityName}Modal
|
||||
},
|
||||
data () {
|
||||
@ -152,6 +362,7 @@
|
||||
url: {
|
||||
list: "/${entityPackage}/${entityName?uncap_first}/rootList",
|
||||
childList: "/${entityPackage}/${entityName?uncap_first}/childList",
|
||||
getChildListBatch: "/${entityPackage}/${entityName?uncap_first}/getChildListBatch",
|
||||
delete: "/${entityPackage}/${entityName?uncap_first}/delete",
|
||||
deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
|
||||
exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
|
||||
@ -185,36 +396,95 @@
|
||||
this.ipagination.current=1
|
||||
}
|
||||
this.loading = true
|
||||
this.expandedRowKeys = []
|
||||
let params = this.getQueryParams()
|
||||
return new Promise((resolve) => {
|
||||
getAction(this.url.list,params).then(res=>{
|
||||
if(res.success){
|
||||
let result = res.result
|
||||
if(Number(result.total)>0){
|
||||
this.ipagination.total = Number(result.total)
|
||||
this.dataSource = this.getDataByResult(res.result.records)
|
||||
resolve()
|
||||
}else{
|
||||
this.ipagination.total=0
|
||||
this.dataSource=[]
|
||||
}
|
||||
getAction(this.url.list,params).then(res=>{
|
||||
if(res.success){
|
||||
let result = res.result
|
||||
if(Number(result.total)>0){
|
||||
this.ipagination.total = Number(result.total)
|
||||
this.dataSource = this.getDataByResult(res.result.records)
|
||||
return this.loadDataByExpandedRows(this.dataSource)
|
||||
}else{
|
||||
this.$message.warning(res.message)
|
||||
this.ipagination.total=0
|
||||
this.dataSource=[]
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}else{
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(()=>{
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
|
||||
loadDataByExpandedRows(dataList) {
|
||||
if (this.expandedRowKeys.length > 0) {
|
||||
return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{
|
||||
if (res.success && res.result.records.length>0) {
|
||||
//已展开的数据批量子节点
|
||||
let records = res.result.records
|
||||
const listMap = new Map();
|
||||
for (let item of records) {
|
||||
let pid = item.pid;
|
||||
if (this.expandedRowKeys.join(',').includes(pid)) {
|
||||
let mapList = listMap.get(pid);
|
||||
if (mapList == null) {
|
||||
mapList = [];
|
||||
}
|
||||
mapList.push(item);
|
||||
listMap.set(pid, mapList);
|
||||
}
|
||||
}
|
||||
let childrenMap = listMap;
|
||||
let fn = (list) => {
|
||||
list.forEach(data => {
|
||||
if (this.expandedRowKeys.includes(data.id)) {
|
||||
data.children = this.getDataByResult(childrenMap.get(data.id))
|
||||
fn(data.children)
|
||||
}
|
||||
})
|
||||
}
|
||||
fn(dataList)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
},
|
||||
getQueryParams(arg) {
|
||||
//获取查询条件
|
||||
let sqp = {}
|
||||
let param = {}
|
||||
if(this.superQueryParams){
|
||||
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
||||
sqp['superQueryMatchType'] = this.superQueryMatchType
|
||||
}
|
||||
if(arg){
|
||||
param = Object.assign(sqp, this.isorter ,this.filters);
|
||||
}else{
|
||||
param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
|
||||
}
|
||||
param.field = this.getQueryField();
|
||||
param.pageNo = this.ipagination.current;
|
||||
param.pageSize = this.ipagination.pageSize;
|
||||
return filterObj(param);
|
||||
},
|
||||
searchReset() {
|
||||
//重置
|
||||
this.expandedRowKeys = []
|
||||
this.queryParam = {}
|
||||
this.loadData(1);
|
||||
},
|
||||
getDataByResult(result){
|
||||
return result.map(item=>{
|
||||
//判断是否标记了带有子节点
|
||||
if(item[this.hasChildrenField]=='1'){
|
||||
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
|
||||
item.children = [loadChild]
|
||||
}
|
||||
return item
|
||||
})
|
||||
if(result){
|
||||
return result.map(item=>{
|
||||
//判断是否标记了带有子节点
|
||||
if(item[this.hasChildrenField]=='1'){
|
||||
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
|
||||
item.children = [loadChild]
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
},
|
||||
handleExpand(expanded, record){
|
||||
// 判断是否是展开状态
|
||||
@ -225,8 +495,8 @@
|
||||
params[this.pidField] = record.id
|
||||
getAction(this.url.childList,params).then((res)=>{
|
||||
if(res.success){
|
||||
if(res.result && res.result.length>0){
|
||||
record.children = this.getDataByResult(res.result)
|
||||
if(res.result.records){
|
||||
record.children = this.getDataByResult(res.result.records)
|
||||
this.dataSource = [...this.dataSource]
|
||||
}else{
|
||||
record.children=''
|
||||
@ -244,84 +514,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
</#if>
|
||||
</#list>
|
||||
},
|
||||
modalFormOk(formData,arr){
|
||||
if(!formData.id){
|
||||
this.addOk(formData,arr)
|
||||
}else{
|
||||
if(!arr){
|
||||
this.loadData()
|
||||
}else{
|
||||
this.editOk(formData,this.dataSource)
|
||||
this.dataSource=[...this.dataSource]
|
||||
}
|
||||
}
|
||||
},
|
||||
editOk(formData,arr){
|
||||
if(arr && arr.length>0){
|
||||
for(let i=0;i<arr.length;i++){
|
||||
if(arr[i].id==formData.id){
|
||||
arr[i]=formData
|
||||
break
|
||||
}else{
|
||||
this.editOk(formData,arr[i].children)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async addOk(formData,arr){
|
||||
if(!formData[this.pidField]){
|
||||
this.loadData()
|
||||
}else{
|
||||
if(this.loadParent===true){
|
||||
this.expandTreeNode(formData[this.pidField])
|
||||
this.loadParent = false
|
||||
}else{
|
||||
this.expandedRowKeys=[]
|
||||
for(let i of arr){
|
||||
await this.expandTreeNode(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
expandTreeNode(nodeId){
|
||||
return new Promise((resolve,reject)=>{
|
||||
this.getFormDataById(nodeId,this.dataSource)
|
||||
let row = this.parentFormData
|
||||
this.expandedRowKeys.push(nodeId)
|
||||
let params = this.getQueryParams();//查询条件
|
||||
params[this.pidField] = nodeId
|
||||
getAction(this.url.childList,params).then((res)=>{
|
||||
if(res.success){
|
||||
if(res.result && res.result.length>0){
|
||||
row.children = this.getDataByResult(res.result)
|
||||
}else{
|
||||
row.children=''
|
||||
}
|
||||
this.dataSource = [...this.dataSource]
|
||||
resolve()
|
||||
}else{
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getFormDataById(id,arr){
|
||||
if(arr && arr.length>0){
|
||||
for(let i=0;i<arr.length;i++){
|
||||
if(arr[i].id==id){
|
||||
this.parentFormData = arr[i]
|
||||
}else{
|
||||
this.getFormDataById(id,arr[i].children)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleAddChild(record){
|
||||
this.loadParent = true
|
||||
let obj = {}
|
||||
@ -336,12 +528,7 @@
|
||||
var that = this;
|
||||
deleteAction(that.url.delete, {id: record.id}).then((res) => {
|
||||
if (res.success) {
|
||||
if(!record[this.pidField] || record[this.pidField] =='0' || record[this.pidField].length==0){
|
||||
that.loadData(1)
|
||||
}else{
|
||||
that.$message.success(res.message);
|
||||
that.expandTreeNode(record[this.pidField]);
|
||||
}
|
||||
that.loadData(1)
|
||||
} else {
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@
|
||||
httpAction(httpurl,formData,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.submitSuccess(formData,old_pid==new_pid)
|
||||
this.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ -26,6 +27,19 @@ public class ${entityName} implements Serializable {
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
@TableId(type = IdType.ID_WORKER_STR)
|
||||
@ -46,9 +60,12 @@ public class ${entityName} implements Serializable {
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15)
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
<#if po.fieldDbType=='Blob'>
|
||||
private transient java.lang.String ${po.fieldName}String;
|
||||
|
||||
@ -153,6 +153,7 @@
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
@ -176,10 +177,15 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)">
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
<#if list_need_pca>
|
||||
<template slot="pcaSlot" slot-scope="text">
|
||||
<div>{{ getPcaText(text) }}</div>
|
||||
</template>
|
||||
</#if>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
@ -318,6 +324,9 @@
|
||||
<#elseif po.classType=='umeditor'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'htmlSlot'}
|
||||
<#elseif po.classType=='pca'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'pcaSlot'}
|
||||
<#elseif po.classType=='file'>
|
||||
dataIndex: '${po.fieldName}',
|
||||
scopedSlots: {customRender: 'fileSlot'}
|
||||
@ -356,6 +365,8 @@
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
@ -391,12 +402,22 @@
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
<#if list_need_pca>
|
||||
this.pcaData = new Area()
|
||||
</#if>
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
<#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
<#if list_need_pca>
|
||||
getPcaText(code){
|
||||
return this.pcaData.getText(code);
|
||||
},
|
||||
</#if>
|
||||
initDictConfig(){
|
||||
<#list columns as po>
|
||||
<#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
size="middle"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:scroll="{x:true}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
@ -57,7 +58,7 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)">
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
@ -161,6 +162,8 @@
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
}
|
||||
],
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
@ -23,79 +24,95 @@
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
@ -136,6 +153,15 @@
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${entityName}Modal",
|
||||
@ -167,8 +193,17 @@
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
data () {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
cancelText="关闭">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-row>
|
||||
<#assign form_date = false>
|
||||
<#assign form_select = false>
|
||||
<#assign form_select_multi = false>
|
||||
@ -25,79 +26,95 @@
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#list sub.originalColumns as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictField}">
|
||||
</#if>
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-col :span="${form_span}">
|
||||
<a-form-item label="${po.filedComment}" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<#if po.classType =='date'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" style="width: 100%"/>
|
||||
<#elseif po.classType =='datetime'>
|
||||
<#assign form_date=true>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<j-date placeholder="请选择${po.filedComment}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
|
||||
<#elseif po.classType =='popup'>
|
||||
<#assign form_popup=true>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<j-popup
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
<#assign form_select = true>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-dict-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='list_multi' || po.classType=='checkbox'>
|
||||
<#assign form_select_multi = true>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<j-multi-select-tag type="${po.classType}" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true" dictCode="${form_field_dictCode}" placeholder="请选择${po.filedComment}"/>
|
||||
<#elseif po.classType=='sel_search'>
|
||||
<#assign form_select_search = true>
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<j-search-select-tag v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" dict="${form_field_dictCode}" />
|
||||
<#elseif po.classType=='cat_tree'>
|
||||
<#assign form_cat_tree = true>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>pcode="${po.dictField}"<#else>pcode="0"</#if> placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<j-category-select v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" pcode="${po.dictField?default("")}" placeholder="请选择${po.filedComment}" <#if po.dictText?default("")?trim?length gt 1>back="${po.dictText}" @change="handleCategoryChange"</#if>/>
|
||||
<#if po.dictText?default("")?trim?length gt 1>
|
||||
<#assign form_cat_back = "${po.dictText}">
|
||||
</#if>
|
||||
<#elseif po.fieldDbType=='int' || po.fieldDbType=='double' || po.fieldDbType=='BigDecimal'>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<a-input-number v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}" style="width: 100%"/>
|
||||
<#elseif po.classType=='file'>
|
||||
<#assign form_file = true>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<j-upload v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"></j-upload>
|
||||
<#elseif po.classType=='image'>
|
||||
<#assign form_image = true>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<j-image-upload isMultiple v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"></j-image-upload>
|
||||
<#elseif po.classType=='umeditor'>
|
||||
<#assign form_editor = true>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<j-editor v-decorator="['${po.fieldName}',{trigger:'input'}]"/>
|
||||
<#elseif po.fieldDbType=='Blob'>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<a-input v-decorator="['${po.fieldName}String'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<#else>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
<a-input v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"></a-input>
|
||||
</#if>
|
||||
</a-form-item>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if form_cat_tree && form_cat_back?length gt 1>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item v-show="false">
|
||||
<a-input v-decorator="['${form_cat_back}']"></a-input>
|
||||
</a-form-item>
|
||||
</#if>
|
||||
|
||||
</a-row>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</j-modal>
|
||||
@ -138,6 +155,15 @@
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: "${sub.entityName}Modal",
|
||||
@ -169,8 +195,17 @@
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
props:{
|
||||
|
||||
@ -12,6 +12,7 @@ import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ -27,6 +28,19 @@ public class ${entityName}Page {
|
||||
|
||||
<#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
|
||||
<#list originalColumns as po>
|
||||
<#-- 生成字典Code -->
|
||||
<#assign list_field_dictCode="">
|
||||
<#if po.classType='sel_user'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
|
||||
<#elseif po.classType='sel_depart'>
|
||||
<#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
|
||||
<#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
|
||||
<#elseif po.dictField?default("")?trim?length gt 1>
|
||||
<#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
|
||||
</#if>
|
||||
</#if>
|
||||
/**${po.filedComment}*/
|
||||
<#if po.fieldName == primaryKeyField>
|
||||
<#else>
|
||||
@ -46,8 +60,11 @@ public class ${entityName}Page {
|
||||
</#if>
|
||||
<#else>
|
||||
<#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
|
||||
@Excel(name = "${po.filedComment}", width = 15)
|
||||
@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
|
||||
</#if>
|
||||
<#if list_field_dictCode?length gt 1>
|
||||
@Dict(${list_field_dictCode?substring(2)})
|
||||
</#if>
|
||||
</#if>
|
||||
</#if>
|
||||
@ApiModelProperty(value = "${po.filedComment}")
|
||||
|
||||
@ -157,6 +157,7 @@
|
||||
bordered
|
||||
rowKey="id"
|
||||
class="j-table-force-nowrap"
|
||||
:scroll="{x:true}"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
@ -199,7 +200,7 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)"
|
||||
@click="downloadFile(text)"
|
||||
>
|
||||
<span>下载</span>
|
||||
</a-button>
|
||||
@ -323,12 +324,14 @@
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align: 'center',
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' },
|
||||
},
|
||||
],
|
||||
// 字典选项
|
||||
dictOptions: {},
|
||||
// 展开的行
|
||||
// 展开的行test
|
||||
expandedRowKeys: [],
|
||||
<#assign urlPrefix="/${entityPackage}/${entityName?uncap_first}">
|
||||
url: {
|
||||
|
||||
@ -25,9 +25,12 @@
|
||||
<#assign form_editor = false>
|
||||
<#assign form_cat_tree = false>
|
||||
<#assign form_cat_back = "">
|
||||
|
||||
<#assign form_pca = false>
|
||||
<#assign form_md = false>
|
||||
<#assign form_switch=false>
|
||||
<#assign form_span = 24>
|
||||
<#list columns as po>
|
||||
<#if po.isShow =='Y'>
|
||||
<#if po.isShow =='Y' && po.fieldName != 'id'>
|
||||
<#assign form_field_dictCode="">
|
||||
<#if po.dictTable?default("")?trim?length gt 1>
|
||||
<#assign form_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
|
||||
@ -53,15 +56,26 @@
|
||||
v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"
|
||||
:trigger-change="true"
|
||||
org-fields="${po.dictField}"
|
||||
dest-fields="${po.dictText}"
|
||||
dest-fields="${Format.underlineToHump(po.dictText)}"
|
||||
code="${po.dictTable}"
|
||||
@callback="popupCallback"/>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#elseif po.classType =='sel_depart'>
|
||||
<#assign form_sel_depart=true>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-depart v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" multi/>
|
||||
<#elseif po.classType =='switch'>
|
||||
<#assign form_switch=true>
|
||||
<j-switch v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" <#if po.dictField?default("")?trim?length gt 1>:options="${po.dictField}"</#if>></j-switch>
|
||||
<#elseif po.classType =='pca'>
|
||||
<#assign form_pca=true>
|
||||
<j-area-linkage type="cascader" v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入省市区"/>
|
||||
<#elseif po.classType =='markdown'>
|
||||
<#assign form_md=true>
|
||||
<j-markdown-editor v-decorator="['${po.fieldName}']" id="${po.fieldName}"></j-markdown-editor>
|
||||
<#elseif po.classType =='password'>
|
||||
<a-input-password v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType =='sel_user'>
|
||||
<#assign form_sel_user = true>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" :trigger-change="true"/>
|
||||
<j-select-user-by-dep v-decorator="['${po.fieldName}'${autoWriteRules(po)}]"/>
|
||||
<#elseif po.classType =='textarea'>
|
||||
<a-textarea v-decorator="['${po.fieldName}'${autoWriteRules(po)}]" rows="4" placeholder="请输入${po.filedComment}"/>
|
||||
<#elseif po.classType=='list' || po.classType=='radio'>
|
||||
@ -178,6 +192,15 @@
|
||||
<#if form_cat_tree>
|
||||
import JCategorySelect from '@/components/jeecg/JCategorySelect'
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
|
||||
</#if>
|
||||
<#if form_md>
|
||||
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
import JSwitch from '@/components/jeecg/JSwitch'
|
||||
</#if>
|
||||
|
||||
export default {
|
||||
name: '${entityName}Modal',
|
||||
@ -215,8 +238,17 @@
|
||||
<#if form_editor>
|
||||
JEditor,
|
||||
</#if>
|
||||
<#if form_pca>
|
||||
JAreaLinkage,
|
||||
</#if>
|
||||
<#if form_cat_tree>
|
||||
JCategorySelect
|
||||
JCategorySelect,
|
||||
</#if>
|
||||
<#if form_md>
|
||||
JMarkdownEditor,
|
||||
</#if>
|
||||
<#if form_switch==true >
|
||||
JSwitch,
|
||||
</#if>
|
||||
},
|
||||
data() {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="uploadFile(text)"
|
||||
@click="downloadFile(text)"
|
||||
>
|
||||
<span>下载</span>
|
||||
</a-button>
|
||||
|
||||
Reference in New Issue
Block a user