Showing
33 changed files
with
2876 additions
and
0 deletions
db/Dockerfile
0 → 100644
db/jimureport.mysql5.7.create.sql
0 → 100644
This diff could not be displayed because it is too large.
pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + <parent> | ||
6 | + <groupId>org.springframework.boot</groupId> | ||
7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
8 | + <version>2.5.0</version> | ||
9 | + <relativePath/> | ||
10 | + </parent> | ||
11 | + <groupId>org.jeecg</groupId> | ||
12 | + <artifactId>JimuReport</artifactId> | ||
13 | + <version>1.3</version> | ||
14 | + <name>JimuReport</name> | ||
15 | + | ||
16 | + <url>http://www.jimureport.com</url> | ||
17 | + <description>积木报表</description> | ||
18 | + | ||
19 | + <repositories> | ||
20 | + <repository> | ||
21 | + <id>aliyun</id> | ||
22 | + <name>aliyun Repository</name> | ||
23 | + <url>http://maven.aliyun.com/nexus/content/groups/public</url> | ||
24 | + <snapshots> | ||
25 | + <enabled>false</enabled> | ||
26 | + </snapshots> | ||
27 | + </repository> | ||
28 | + <repository> | ||
29 | + <id>jeecg</id> | ||
30 | + <name>jeecg Repository</name> | ||
31 | + <url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url> | ||
32 | + <snapshots> | ||
33 | + <enabled>false</enabled> | ||
34 | + </snapshots> | ||
35 | + </repository> | ||
36 | + </repositories> | ||
37 | + | ||
38 | + <properties> | ||
39 | + <java.version>1.8</java.version> | ||
40 | + <minio.version>8.0.3</minio.version> | ||
41 | + <!-- DB驱动 --> | ||
42 | + <mysql-connector-java.version>8.0.20</mysql-connector-java.version> | ||
43 | + </properties> | ||
44 | + | ||
45 | + | ||
46 | + <dependencies> | ||
47 | + <!-- JimuReport --> | ||
48 | + <dependency> | ||
49 | + <groupId>org.jeecgframework.jimureport</groupId> | ||
50 | + <artifactId>jimureport-spring-boot-starter</artifactId> | ||
51 | + <version>1.3.795</version> | ||
52 | + </dependency> | ||
53 | + | ||
54 | + | ||
55 | + <!-- SpringBoot--> | ||
56 | + <dependency> | ||
57 | + <groupId>org.springframework.boot</groupId> | ||
58 | + <artifactId>spring-boot-starter-web</artifactId> | ||
59 | + </dependency> | ||
60 | + <dependency> | ||
61 | + <groupId>org.springframework.boot</groupId> | ||
62 | + <artifactId>spring-boot-starter-freemarker</artifactId> | ||
63 | + </dependency> | ||
64 | + | ||
65 | + <!-- minio oss--> | ||
66 | + <dependency> | ||
67 | + <groupId>io.minio</groupId> | ||
68 | + <artifactId>minio</artifactId> | ||
69 | + <version>${minio.version}</version> | ||
70 | + <optional>true</optional> | ||
71 | + </dependency> | ||
72 | + | ||
73 | + <!-- 数据库驱动 --> | ||
74 | + <!--mysql--> | ||
75 | + <dependency> | ||
76 | + <groupId>mysql</groupId> | ||
77 | + <artifactId>mysql-connector-java</artifactId> | ||
78 | + <version>${mysql-connector-java.version}</version> | ||
79 | + <scope>runtime</scope> | ||
80 | + </dependency> | ||
81 | + <!-- sqlserver--> | ||
82 | + <dependency> | ||
83 | + <groupId>com.microsoft.sqlserver</groupId> | ||
84 | + <artifactId>sqljdbc4</artifactId> | ||
85 | + <version>4.0</version> | ||
86 | + <scope>runtime</scope> | ||
87 | + </dependency> | ||
88 | + <!-- oracle驱动--> | ||
89 | + <dependency> | ||
90 | + <groupId>com.oracle</groupId> | ||
91 | + <artifactId>ojdbc6</artifactId> | ||
92 | + <version>11.2.0.3</version> | ||
93 | + <scope>runtime</scope> | ||
94 | + </dependency> | ||
95 | + <!-- postgresql驱动--> | ||
96 | + <dependency> | ||
97 | + <groupId>org.postgresql</groupId> | ||
98 | + <artifactId>postgresql</artifactId> | ||
99 | + <version>42.2.6</version> | ||
100 | + <scope>runtime</scope> | ||
101 | + </dependency> | ||
102 | + <!-- 达梦驱动 | ||
103 | + <dependency> | ||
104 | + <groupId>com.dameng</groupId> | ||
105 | + <artifactId>DmJdbcDriver18</artifactId> | ||
106 | + <version>1.0</version> | ||
107 | + <scope>runtime</scope> | ||
108 | + </dependency> | ||
109 | + <dependency> | ||
110 | + <groupId>com.dameng</groupId> | ||
111 | + <artifactId>DmDialectForHibernate</artifactId> | ||
112 | + <version>5.3</version> | ||
113 | + <scope>runtime</scope> | ||
114 | + </dependency> --> | ||
115 | + <!-- sqlite | ||
116 | + <dependency> | ||
117 | + <groupId>org.xerial</groupId> | ||
118 | + <artifactId>sqlite-jdbc</artifactId> | ||
119 | + <version>3.7.2</version> | ||
120 | + <scope>runtime</scope> | ||
121 | + </dependency> --> | ||
122 | + <!--hsqldb | ||
123 | + <dependency> | ||
124 | + <groupId>org.hsqldb</groupId> | ||
125 | + <artifactId>hsqldb</artifactId> | ||
126 | + <version>2.2.8</version> | ||
127 | + <scope>runtime</scope> | ||
128 | + </dependency>--> | ||
129 | + <!--h2 | ||
130 | + <dependency> | ||
131 | + <groupId>com.h2database</groupId> | ||
132 | + <artifactId>h2</artifactId> | ||
133 | + <version>1.4.197</version> | ||
134 | + <scope>runtime</scope> | ||
135 | + </dependency>--> | ||
136 | + <!--derby | ||
137 | + <dependency> | ||
138 | + <groupId>org.apache.derby</groupId> | ||
139 | + <artifactId>derbyclient</artifactId> | ||
140 | + <version>10.11.1.1</version> | ||
141 | + <scope>runtime</scope> | ||
142 | + </dependency>--> | ||
143 | + <!--db2 | ||
144 | + <dependency> | ||
145 | + <groupId>com.ibm.db2</groupId> | ||
146 | + <artifactId>jcc</artifactId> | ||
147 | + <version>11.5.0.0</version> | ||
148 | + <scope>runtime</scope> | ||
149 | + </dependency>--> | ||
150 | + <!--神通 | ||
151 | + <dependency> | ||
152 | + <groupId>com.csicit.thirdparty</groupId> | ||
153 | + <artifactId>oscar</artifactId> | ||
154 | + <version>1.0.1</version> | ||
155 | + <scope>runtime</scope> | ||
156 | + </dependency>--> | ||
157 | + <!--人大金仓 | ||
158 | + <dependency> | ||
159 | + <groupId>kingbase</groupId> | ||
160 | + <artifactId>kingbase8</artifactId> | ||
161 | + <version>8</version> | ||
162 | + <scope>runtime</scope> | ||
163 | + </dependency>--> | ||
164 | + | ||
165 | + <!-- mybatis --> | ||
166 | + <dependency> | ||
167 | + <groupId>org.mybatis.spring.boot</groupId> | ||
168 | + <artifactId>mybatis-spring-boot-starter</artifactId> | ||
169 | + <version>2.1.2</version> | ||
170 | + </dependency> | ||
171 | + | ||
172 | + <!-- mybatis-plus --> | ||
173 | + <dependency> | ||
174 | + <groupId>com.baomidou</groupId> | ||
175 | + <artifactId>mybatis-plus-boot-starter</artifactId> | ||
176 | + <version>3.3.1</version> | ||
177 | + <exclusions> | ||
178 | + <exclusion> | ||
179 | + <groupId>com.baomidou</groupId> | ||
180 | + <artifactId>mybatis-plus-generator</artifactId> | ||
181 | + </exclusion> | ||
182 | + </exclusions> | ||
183 | + </dependency> | ||
184 | + | ||
185 | + <!-- baomidou --> | ||
186 | + <!--<dependency> | ||
187 | + <groupId>com.baomidou</groupId> | ||
188 | + <artifactId>dynamic-datasource-spring-boot-starter</artifactId> | ||
189 | + <version>3.1.1</version> | ||
190 | + </dependency>--> | ||
191 | + | ||
192 | + <dependency> | ||
193 | + <groupId>org.projectlombok</groupId> | ||
194 | + <artifactId>lombok</artifactId> | ||
195 | + </dependency> | ||
196 | + | ||
197 | + <dependency> | ||
198 | + <groupId>org.influxdb</groupId> | ||
199 | + <artifactId>influxdb-java</artifactId> | ||
200 | + <version>2.7</version> | ||
201 | + </dependency> | ||
202 | + | ||
203 | + </dependencies> | ||
204 | + | ||
205 | + <build> | ||
206 | + <finalName>jimu-report</finalName> | ||
207 | + <plugins> | ||
208 | + <plugin> | ||
209 | + <groupId>org.springframework.boot</groupId> | ||
210 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
211 | + </plugin> | ||
212 | + </plugins> | ||
213 | + <pluginManagement> | ||
214 | + <plugins> | ||
215 | + <plugin> | ||
216 | + <artifactId>maven-resources-plugin</artifactId> | ||
217 | + <configuration> | ||
218 | + <encoding>utf-8</encoding> | ||
219 | + <useDefaultDelimiters>true</useDefaultDelimiters> | ||
220 | + <nonFilteredFileExtensions> | ||
221 | + <nonFilteredFileExtension>woff</nonFilteredFileExtension> | ||
222 | + <nonFilteredFileExtension>woff2</nonFilteredFileExtension> | ||
223 | + <nonFilteredFileExtension>eot</nonFilteredFileExtension> | ||
224 | + <nonFilteredFileExtension>ttf</nonFilteredFileExtension> | ||
225 | + <nonFilteredFileExtension>svg</nonFilteredFileExtension> | ||
226 | + </nonFilteredFileExtensions> | ||
227 | + </configuration> | ||
228 | + </plugin> | ||
229 | + </plugins> | ||
230 | + </pluginManagement> | ||
231 | + | ||
232 | + </build> | ||
233 | + | ||
234 | +</project> |
1 | +//package org.jeecg.modules; | ||
2 | +// | ||
3 | +//import lombok.Builder; | ||
4 | +// | ||
5 | +//import java.io.UnsupportedEncodingException; | ||
6 | +//import java.security.MessageDigest; | ||
7 | +//import java.security.NoSuchAlgorithmException; | ||
8 | +//import java.util.Random; | ||
9 | +// | ||
10 | +//public class DbSchemaKeyGenerator { | ||
11 | +// | ||
12 | +// public static void main(String[] args) { | ||
13 | +// | ||
14 | +// String name = "Your_name"; | ||
15 | +// try { | ||
16 | +// String key = generateKey(name); | ||
17 | +// System.out.println("key: " + key); | ||
18 | +// } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { | ||
19 | +// e.printStackTrace(); | ||
20 | +// } | ||
21 | +// | ||
22 | +// } | ||
23 | +// | ||
24 | +// | ||
25 | +// private static String generateKey(String name) throws NoSuchAlgorithmException, UnsupportedEncodingException { | ||
26 | +// String salt = getSalt(); | ||
27 | +// String encryptSource = "ax5" + name + "b52w" + salt + "vb3"; | ||
28 | +// MessageDigest localMessageDigest = MessageDigest.getInstance("MD5"); | ||
29 | +// String hash = formatToHex(localMessageDigest.digest(encryptSource.getBytes("UTF-8"))); | ||
30 | +// return hash.substring(0, 4) + salt + hash.substring(4); | ||
31 | +// } | ||
32 | +// | ||
33 | +// | ||
34 | +// private static String formatToHex(byte[] paramArrayOfByte) { | ||
35 | +// StringBuilder localStringBuilder = new StringBuilder(); | ||
36 | +// for (int m = 0; m < paramArrayOfByte.length; m++) { | ||
37 | +// if ((m % 32 == 0) && (m != 0)) { | ||
38 | +// localStringBuilder.append("\n"); | ||
39 | +// } | ||
40 | +// String str = Integer.toHexString(paramArrayOfByte[m]); | ||
41 | +// if (str.length() < 2) { | ||
42 | +// str = "0" + str; | ||
43 | +// } | ||
44 | +// if (str.length() > 2) { | ||
45 | +// str = str.substring(str.length() - 2); | ||
46 | +// } | ||
47 | +// localStringBuilder.append(str); | ||
48 | +// } | ||
49 | +// return localStringBuilder.toString(); | ||
50 | +// } | ||
51 | +// | ||
52 | +// private static int random(int min, int max) { | ||
53 | +// return rand() % (max - min + 1) + min; | ||
54 | +// } | ||
55 | +// | ||
56 | +// private static int rand() { | ||
57 | +// return new Random().nextInt(Integer.MAX_VALUE); | ||
58 | +// } | ||
59 | +// | ||
60 | +// private static String getSalt() { | ||
61 | +// int r = random(10000, 30000); | ||
62 | +// return String.valueOf(r); | ||
63 | +// } | ||
64 | +//} | ||
65 | +// |
1 | +package org.jeecg.modules; | ||
2 | + | ||
3 | +import org.jeecg.modules.jmreport.common.util.oConvertUtils; | ||
4 | +import org.mybatis.spring.annotation.MapperScan; | ||
5 | +import org.springframework.boot.SpringApplication; | ||
6 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
7 | +import org.springframework.context.ConfigurableApplicationContext; | ||
8 | +import org.springframework.core.env.Environment; | ||
9 | + | ||
10 | +/** | ||
11 | + * 积木报表独立服务启动类 | ||
12 | + */ | ||
13 | +@SpringBootApplication(scanBasePackages = {"org.jeecg.modules.jmreport"}) | ||
14 | +@MapperScan({"org.jeecg.modules.jmreport.ext.dao","org.jeecgframework.minidao.**"}) | ||
15 | +public class JimuReportApplication { | ||
16 | + | ||
17 | + public static void main(String[] args) { | ||
18 | + ConfigurableApplicationContext application = SpringApplication.run(JimuReportApplication.class, args); | ||
19 | + Environment env = application.getEnvironment(); | ||
20 | + String port = env.getProperty("server.port"); | ||
21 | + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); | ||
22 | + System.out.print("\n----------------------------------------------------------\n\t" + | ||
23 | + "Application JimuReport Demo is running! Access URL:\n\t" + | ||
24 | + "Local: \t\thttp://localhost:" + port + path + "/jmreport/list\n\t" + | ||
25 | + "----------------------------------------------------------"); | ||
26 | + } | ||
27 | + | ||
28 | +} |
1 | +package org.jeecg.modules.jmreport.config; | ||
2 | + | ||
3 | +import org.jeecg.modules.jmreport.api.JmReportTokenServiceI; | ||
4 | +import org.springframework.http.HttpHeaders; | ||
5 | +import org.springframework.stereotype.Component; | ||
6 | + | ||
7 | +import javax.servlet.http.HttpServletRequest; | ||
8 | + | ||
9 | +/** | ||
10 | + * 自定义积木报表鉴权(如果不进行自定义,则所有请求不做权限控制) | ||
11 | + * 1.自定义获取登录token | ||
12 | + * 2.自定义获取登录用户 | ||
13 | + */ | ||
14 | +@Component | ||
15 | +public class JimuReportTokenService implements JmReportTokenServiceI { | ||
16 | + | ||
17 | + /** | ||
18 | + * 通过请求获取Token | ||
19 | + * @param request | ||
20 | + * @return | ||
21 | + */ | ||
22 | + @Override | ||
23 | + public String getToken(HttpServletRequest request) { | ||
24 | + //return TokenUtils.getTokenByRequest(request); | ||
25 | + return "123456"; | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 通过Token获取登录人用户名 | ||
30 | + * @param token | ||
31 | + * @return | ||
32 | + */ | ||
33 | + @Override | ||
34 | + public String getUsername(String token) { | ||
35 | + // return JwtUtil.getUsername(token); | ||
36 | + return "admin"; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * Token校验 | ||
41 | + * @param token | ||
42 | + * @return | ||
43 | + */ | ||
44 | + @Override | ||
45 | + public Boolean verifyToken(String token) { | ||
46 | + //return TokenUtils.verifyToken(token, sysBaseAPI, redisUtil); | ||
47 | + return true; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * 自定义请求头 | ||
52 | + * @return | ||
53 | + */ | ||
54 | + @Override | ||
55 | + public HttpHeaders customApiHeader() { | ||
56 | + HttpHeaders header = new HttpHeaders(); | ||
57 | + header.add("custom-header1", "Please set a custom value 1"); | ||
58 | + header.add("token", "token value 2"); | ||
59 | + return header; | ||
60 | + } | ||
61 | +} |
1 | +package org.jeecg.modules.jmreport.controller; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSON; | ||
4 | +import org.jeecg.modules.jmreport.common.util.ViewFreemarker; | ||
5 | +import org.jeecg.modules.jmreport.common.util.oConvertUtils; | ||
6 | +import org.jeecg.modules.jmreport.config.JmReportBaseConfig; | ||
7 | +import org.jeecg.modules.jmreport.desreport.util.d; | ||
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
11 | +import org.springframework.stereotype.Controller; | ||
12 | +import org.springframework.ui.Model; | ||
13 | +import org.springframework.web.bind.annotation.GetMapping; | ||
14 | +import org.springframework.web.bind.annotation.PathVariable; | ||
15 | + | ||
16 | +import javax.servlet.http.HttpServletRequest; | ||
17 | +import javax.servlet.http.HttpServletResponse; | ||
18 | +import java.util.HashMap; | ||
19 | +import java.util.Map; | ||
20 | + | ||
21 | +/** | ||
22 | + * 积木报表-设置默认首页跳转 | ||
23 | + */ | ||
24 | +@Controller | ||
25 | +public class IndexController { | ||
26 | + private Logger logger = LoggerFactory.getLogger(IndexController.class); | ||
27 | + | ||
28 | + @Autowired | ||
29 | + private JmReportBaseConfig jmBaseConfig; | ||
30 | + | ||
31 | + @GetMapping("/") | ||
32 | + public String index(Model model) { | ||
33 | + model.addAttribute("name", "jimureport"); | ||
34 | + return "jmreport/list"; // 视图重定向 - 跳转 | ||
35 | + } | ||
36 | + | ||
37 | + | ||
38 | + @GetMapping("/page/{pageCode}") | ||
39 | + public void page(Model model,HttpServletRequest request, HttpServletResponse response,@PathVariable("pageCode") String pageCode) throws Exception { | ||
40 | + model.addAttribute("name", "jimureport"); | ||
41 | + String template = "jmreport/desreport/page.ftl"; | ||
42 | + Map<String, Object> paras = new HashMap<>(); | ||
43 | + paras.put("pageCode",pageCode); | ||
44 | + paras.put("base", request.getContextPath()); | ||
45 | + paras.put("baseURL", d.a(request)); | ||
46 | + paras.put("customPrePath", oConvertUtils.getString(request.getAttribute("customPrePath"), "")); | ||
47 | + paras.put("reportConfig", JSON.toJSONString(this.jmBaseConfig)); | ||
48 | + | ||
49 | + ViewFreemarker.view(request, response, template, paras); | ||
50 | + } | ||
51 | +} |
1 | +package org.jeecg.modules.jmreport.controller; | ||
2 | + | ||
3 | +import org.springframework.beans.factory.annotation.Autowired; | ||
4 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
5 | +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | ||
6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
8 | +import org.springframework.web.bind.annotation.RestController; | ||
9 | +import javax.servlet.http.HttpServletRequest; | ||
10 | + | ||
11 | +@RestController | ||
12 | +@RequestMapping("/test") | ||
13 | +public class TestController { | ||
14 | + @Autowired | ||
15 | + private JdbcTemplate jdbcTemplate; | ||
16 | + @Autowired | ||
17 | + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; | ||
18 | + | ||
19 | + | ||
20 | + @RequestMapping(value = "/list", method = RequestMethod.GET) | ||
21 | + public void queryPageList(HttpServletRequest req) { | ||
22 | + System.out.println("getMaxRows="+jdbcTemplate.getMaxRows()); | ||
23 | + System.out.println("getCacheLimit="+namedParameterJdbcTemplate.getCacheLimit()); | ||
24 | + } | ||
25 | + | ||
26 | +} |
1 | +// | ||
2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
3 | +// (powered by Fernflower decompiler) | ||
4 | +// | ||
5 | + | ||
6 | +package org.jeecg.modules.jmreport.desreport.render.a; | ||
7 | + | ||
8 | +import com.alibaba.druid.support.json.JSONUtils; | ||
9 | +import com.alibaba.fastjson.JSONArray; | ||
10 | +import com.alibaba.fastjson.JSONObject; | ||
11 | +import com.alibaba.fastjson.parser.Feature; | ||
12 | +import org.jeecg.modules.jmreport.common.util.oConvertUtils; | ||
13 | +import org.jeecg.modules.jmreport.desreport.model.RenderInfo; | ||
14 | +import org.jeecg.modules.jmreport.desreport.model.ReportDbInfo; | ||
15 | +import org.jeecg.modules.jmreport.desreport.render.handler.RowsRenderHandler; | ||
16 | +import org.jeecg.modules.jmreport.desreport.render.utils.FreeMarkerUtils; | ||
17 | +import org.slf4j.Logger; | ||
18 | +import org.slf4j.LoggerFactory; | ||
19 | +import org.springframework.stereotype.Component; | ||
20 | + | ||
21 | +import java.util.*; | ||
22 | +import java.util.Map.Entry; | ||
23 | + | ||
24 | +@Component("loopBlockRenderStrategy") | ||
25 | +public class a implements RowsRenderHandler { | ||
26 | + private static final Logger a = LoggerFactory.getLogger(a.class); | ||
27 | + | ||
28 | + public a() { | ||
29 | + } | ||
30 | + | ||
31 | + public boolean support(RenderInfo renderInfo, JSONObject rows) { | ||
32 | + return oConvertUtils.isNotEmpty(renderInfo.getLoopBlockList()); | ||
33 | + } | ||
34 | + | ||
35 | + private String a(JSONObject var1, JSONObject var2, Integer var3, Integer var4) { | ||
36 | + Integer var5 = var4 - var3 + 1; | ||
37 | + Integer var6 = var1.getInteger("sci"); | ||
38 | + Integer var7 = var1.getInteger("eci"); | ||
39 | + Integer var8 = oConvertUtils.getInt(var1.getInteger("loopTime"), 1); | ||
40 | + StringBuilder var9 = new StringBuilder(); | ||
41 | + String var10 = var1.getString("db"); | ||
42 | + var9.append("{"); | ||
43 | + var9.append(String.format("<#list list as %s>", var10)); | ||
44 | + | ||
45 | + for (int var11 = var3; var11 <= var4; ++var11) { | ||
46 | + var9.append(String.format("\"${(%s_index*%s)+%s+%s}\":", var10, var5, var3, var11 - var3)); | ||
47 | + JSONObject var12 = (JSONObject) var2.get(var11); | ||
48 | + JSONObject var13 = new JSONObject(true); | ||
49 | + JSONObject var14 = var12.getJSONObject("cells"); | ||
50 | + if (oConvertUtils.isNotEmpty(var14)) { | ||
51 | + JSONObject var15 = new JSONObject(true); | ||
52 | + | ||
53 | + int var16; | ||
54 | + JSONObject var17; | ||
55 | + for (var16 = var6; var16 <= var7; ++var16) { | ||
56 | + if (oConvertUtils.isNotEmpty(var14)) { | ||
57 | + var17 = var14.getJSONObject(var16 + ""); | ||
58 | + var15.put(var16 + "", var17); | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + if (var8 > 1) { | ||
63 | + for (var16 = 1; var16 <= var8 - 1; ++var16) { | ||
64 | + var17 = JSONObject.parseObject(JSONObject.toJSONString(var14), new Feature[]{Feature.OrderedField}); | ||
65 | + | ||
66 | + for (int var18 = var6; var18 <= var7; ++var18) { | ||
67 | + JSONObject var19 = (JSONObject) var17.get(var18); | ||
68 | + String var20 = var19.getString("text"); | ||
69 | + int var21 = (var7 - var6 + 1) * var16 + var18; | ||
70 | + if (oConvertUtils.isNotEmpty(var20) && var20.indexOf("_index") <= -1 && var20.indexOf("${") > -1) { | ||
71 | + var19.put("text", var20.replace("}", var16 + "}")); | ||
72 | + var15.put(var21 + "", var19); | ||
73 | + } else { | ||
74 | + var15.put(var21 + "", var19); | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | + } | ||
79 | + | ||
80 | + var13.put("cells", var15); | ||
81 | + Object var22 = var12.get("height"); | ||
82 | + if (oConvertUtils.isNotEmpty(var22)) { | ||
83 | + var13.put("height", var22); | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + var9.append(JSONUtils.toJSONString(var13)); | ||
88 | + if (var11 < var4) { | ||
89 | + var9.append(","); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + var9.append(String.format("<#if %s_has_next>,</#if>", var10)); | ||
94 | + var9.append("</#list>"); | ||
95 | + var9.append("}"); | ||
96 | + return var9.toString(); | ||
97 | + } | ||
98 | + | ||
99 | + public JSONObject render(RenderInfo renderInfo, JSONObject rows) { | ||
100 | + JSONObject var3 = new JSONObject(true); | ||
101 | + Map var4 = renderInfo.getReport().getDataList(); | ||
102 | + JSONArray var5 = renderInfo.getLoopBlockList(); | ||
103 | + Integer var6 = 0; | ||
104 | + Iterator var7 = var5.iterator(); | ||
105 | + | ||
106 | + JSONObject var9; | ||
107 | + Integer var10; | ||
108 | + Integer var11; | ||
109 | + Integer var12; | ||
110 | + ReportDbInfo var27; | ||
111 | + do { | ||
112 | + if (!var7.hasNext()) { | ||
113 | + return rows; | ||
114 | + } | ||
115 | + | ||
116 | + Object var8 = var7.next(); | ||
117 | + var9 = (JSONObject) var8; | ||
118 | + var10 = var9.getInteger("sri"); | ||
119 | + var11 = var9.getInteger("eri"); | ||
120 | + var12 = oConvertUtils.getInt(var9.getInteger("loopTime"), 1); | ||
121 | + if (var10 > 0) { | ||
122 | + for (int var13 = 0; var13 < var10; ++var13) { | ||
123 | + Object var14 = rows.get(var13); | ||
124 | + if (oConvertUtils.isNotEmpty(var14)) { | ||
125 | + var3.put(var13 + "", var14); | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + String var26 = var9.getString("db"); | ||
131 | + var27 = (ReportDbInfo) var4.get(var26); | ||
132 | + } while (!oConvertUtils.isNotEmpty(var27)); | ||
133 | + | ||
134 | + Object var15 = this.getData(var27); | ||
135 | + HashMap var16 = new HashMap(5); | ||
136 | + if (oConvertUtils.isNotEmpty(var15) && var15 instanceof List) { | ||
137 | + List var17 = (List) var15; | ||
138 | + if (var12 > 1) { | ||
139 | + int var18 = 0; | ||
140 | + ArrayList var19 = new ArrayList(); | ||
141 | + JSONObject var20 = new JSONObject(); | ||
142 | + Iterator var21 = var17.iterator(); | ||
143 | + | ||
144 | + while (true) { | ||
145 | + if (!var21.hasNext()) { | ||
146 | + var15 = var19; | ||
147 | + break; | ||
148 | + } | ||
149 | + | ||
150 | + JSONObject var22 = (JSONObject) var21.next(); | ||
151 | + if (var18 % var12 == 0) { | ||
152 | + var20 = new JSONObject(); | ||
153 | + var20.put("idx", var18 + 1); | ||
154 | + var20.putAll(var22); | ||
155 | + var19.add(var20); | ||
156 | + } else { | ||
157 | + Iterator var23 = var22.entrySet().iterator(); | ||
158 | + | ||
159 | + while (var23.hasNext()) { | ||
160 | + Entry var24 = (Entry) var23.next(); | ||
161 | + String var25 = var24.getKey().toString(); | ||
162 | + var20.put("idx" + var18 % var12, var18 + 1); | ||
163 | + var20.put(var25 + var18 % var12, var24.getValue()); | ||
164 | + } | ||
165 | + } | ||
166 | + | ||
167 | + ++var18; | ||
168 | + } | ||
169 | + } | ||
170 | + | ||
171 | + var16.put("list", var15); | ||
172 | + } | ||
173 | + | ||
174 | + String var28 = this.a(var9, rows, var10, var11); | ||
175 | + String var29 = FreeMarkerUtils.a(var28, var16); | ||
176 | + JSONObject var30 = JSONObject.parseObject(var29, new Feature[]{Feature.OrderedField}); | ||
177 | + Iterator var31 = rows.entrySet().iterator(); | ||
178 | + | ||
179 | + while (var31.hasNext()) { | ||
180 | + Entry var32 = (Entry) var31.next(); | ||
181 | + Object var33 = var32.getValue(); | ||
182 | + if (var33 instanceof JSONObject) { | ||
183 | + Integer var34 = Integer.parseInt(var32.getKey().toString()); | ||
184 | + if (var34 > var11) { | ||
185 | + var6 = var30.size() + var10; | ||
186 | + var30.put(var6.toString(), var33); | ||
187 | + } | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + var3.putAll(var30); | ||
192 | + return var3; | ||
193 | + } | ||
194 | + | ||
195 | + public Object getData(ReportDbInfo reportDbInfo) { | ||
196 | + return reportDbInfo.getList(); | ||
197 | + } | ||
198 | +} | ||
199 | + |
This diff could not be displayed because it is too large.
1 | +package org.jeecg.modules.jmreport.ext.Base; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.baomidou.mybatisplus.extension.api.ApiController; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public class BaseApiController extends ApiController { | ||
9 | + | ||
10 | + /** | ||
11 | + * 请求成功 | ||
12 | + * | ||
13 | + * @param data 数据内容 | ||
14 | + * @return ignore | ||
15 | + */ | ||
16 | + @Override | ||
17 | + protected <T> BaseR<T> success(T data) { | ||
18 | + return BaseR.ok(data); | ||
19 | + } | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + /** | ||
24 | + * 请求成功 | ||
25 | + * | ||
26 | + * @param data 数据内容 | ||
27 | + * @return ignore | ||
28 | + */ | ||
29 | + protected JSONObject api(List<JSONObject> data) { | ||
30 | + | ||
31 | + JSONObject jsonObject = new JSONObject(); | ||
32 | + jsonObject.put("data",data); | ||
33 | + return jsonObject; | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | +} |
1 | +package org.jeecg.modules.jmreport.ext.Base; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.extension.api.IErrorCode; | ||
4 | +import com.baomidou.mybatisplus.extension.api.R; | ||
5 | +import com.baomidou.mybatisplus.extension.enums.ApiErrorCode; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | + | ||
9 | +public class BaseR<T> extends R<T> implements Serializable { | ||
10 | + | ||
11 | + private boolean success; | ||
12 | + | ||
13 | + private T result; | ||
14 | + | ||
15 | + public static <T> BaseR<T> ok(T data) { | ||
16 | + ApiErrorCode aec = ApiErrorCode.SUCCESS; | ||
17 | + | ||
18 | + if (data instanceof Boolean && Boolean.FALSE.equals(data)) { | ||
19 | + aec = ApiErrorCode.FAILED; | ||
20 | + } | ||
21 | + BaseR<T> tBaseR = restResult(null, aec); | ||
22 | + tBaseR.setSuccess(true); | ||
23 | + tBaseR.setCode(200); | ||
24 | + tBaseR.setResult(data); | ||
25 | + return tBaseR; | ||
26 | + } | ||
27 | + | ||
28 | + | ||
29 | + public static <T> BaseR<T> restResult(T data, IErrorCode errorCode) { | ||
30 | + return restResult(data, errorCode.getCode(), errorCode.getMsg()); | ||
31 | + } | ||
32 | + | ||
33 | + | ||
34 | + private static <T> BaseR<T> restResult(T data, long code, String msg) { | ||
35 | + BaseR<T> apiResult = new BaseR<>(); | ||
36 | + apiResult.setCode(code); | ||
37 | + apiResult.setData(data); | ||
38 | + apiResult.setMsg(msg); | ||
39 | + return apiResult; | ||
40 | + } | ||
41 | + | ||
42 | + public boolean isSuccess() { | ||
43 | + return success; | ||
44 | + } | ||
45 | + | ||
46 | + public void setSuccess(boolean success) { | ||
47 | + this.success = success; | ||
48 | + } | ||
49 | + | ||
50 | + public T getResult() { | ||
51 | + return result; | ||
52 | + } | ||
53 | + | ||
54 | + public void setResult(T result) { | ||
55 | + this.result = result; | ||
56 | + } | ||
57 | +} |
1 | +package org.jeecg.modules.jmreport.ext.controller; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import org.apache.commons.lang3.StringUtils; | ||
5 | +import org.influxdb.dto.QueryResult; | ||
6 | +import org.jeecg.modules.jmreport.ext.Base.BaseApiController; | ||
7 | +import org.jeecg.modules.jmreport.ext.service.ApiService; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | +import org.springframework.web.bind.annotation.RestController; | ||
12 | + | ||
13 | +import java.util.Arrays; | ||
14 | +import java.util.List; | ||
15 | +import java.util.Map; | ||
16 | + | ||
17 | +@RestController | ||
18 | +@RequestMapping("/api") | ||
19 | +public class APiController extends BaseApiController { | ||
20 | + | ||
21 | + @Autowired | ||
22 | + private ApiService apiService; | ||
23 | + | ||
24 | + /** | ||
25 | + * 查询树结构 | ||
26 | + * | ||
27 | + * @return | ||
28 | + */ | ||
29 | + @GetMapping("/test") | ||
30 | + public JSONObject getTree(String resid) { | ||
31 | + | ||
32 | + JSONObject jsonObject = new JSONObject(); | ||
33 | + jsonObject.put("data", StringUtils.isBlank(resid) ? "empty"+System.currentTimeMillis():resid); | ||
34 | + | ||
35 | + return api(Arrays.asList(jsonObject)); | ||
36 | + } | ||
37 | + | ||
38 | + /** | ||
39 | + * 查询树结构 | ||
40 | + * | ||
41 | + * @return | ||
42 | + */ | ||
43 | + @GetMapping("/cpu/lyratio") | ||
44 | + public JSONObject getCpu() { | ||
45 | + | ||
46 | + String sql = "SELECT resId, max AS cpuRateMax, mean AS cpuRateAvg, min AS cpuRateMin FROM monitor.rp_1000d.performance_3d WHERE flag = 'cpu' AND kpiId = 'KPI7054BC34' AND time > NOW() - 2160h GROUP BY resId"; | ||
47 | + | ||
48 | + List<Map<String, Object>> maps = apiService.queryInFlux(sql); | ||
49 | + | ||
50 | + JSONObject jsonObject = new JSONObject(); | ||
51 | + jsonObject.put("data", maps); | ||
52 | + | ||
53 | + return api(Arrays.asList(jsonObject)); | ||
54 | + } | ||
55 | + | ||
56 | + | ||
57 | +} |
1 | +package org.jeecg.modules.jmreport.ext.controller; | ||
2 | + | ||
3 | + | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
5 | +import com.baomidou.mybatisplus.extension.api.ApiController; | ||
6 | +import com.baomidou.mybatisplus.extension.api.R; | ||
7 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
8 | +import org.apache.commons.lang3.StringUtils; | ||
9 | +import org.jeecg.modules.jmreport.ext.Base.BaseApiController; | ||
10 | +import org.jeecg.modules.jmreport.ext.entity.ExtPageConfig; | ||
11 | +import org.jeecg.modules.jmreport.ext.service.ExtPageConfigService; | ||
12 | +import org.springframework.web.bind.annotation.*; | ||
13 | + | ||
14 | +import javax.annotation.Resource; | ||
15 | +import java.io.Serializable; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * (ExtPageConfig)表控制层 | ||
20 | + * | ||
21 | + * @author makejava | ||
22 | + * @since 2021-09-14 14:59:33 | ||
23 | + */ | ||
24 | +@RestController | ||
25 | +@RequestMapping("/ext/pageconfig") | ||
26 | +public class ExtPageConfigController extends BaseApiController { | ||
27 | + /** | ||
28 | + * 服务对象 | ||
29 | + */ | ||
30 | + @Resource | ||
31 | + private ExtPageConfigService extPageConfigService; | ||
32 | + | ||
33 | + | ||
34 | + /** | ||
35 | + * 查询树结构 | ||
36 | + * | ||
37 | + * @return | ||
38 | + */ | ||
39 | + @GetMapping("/tree") | ||
40 | + public R getTree() { | ||
41 | + return success(extPageConfigService.getTree()); | ||
42 | + } | ||
43 | + | ||
44 | + | ||
45 | + /** | ||
46 | + * 保存页面的报表 | ||
47 | + * | ||
48 | + * @return | ||
49 | + */ | ||
50 | + @GetMapping("/{id}/{code}") | ||
51 | + public R save(@PathVariable("id") Integer id,@PathVariable("code") String code) { | ||
52 | + if(id != null && StringUtils.isNotBlank(code)){ | ||
53 | + ExtPageConfig config = new ExtPageConfig(); | ||
54 | + config.setId(id); | ||
55 | + config.setReportCode(code); | ||
56 | + return success(extPageConfigService.updateById(config)); | ||
57 | + } | ||
58 | + return failed("保存失败"); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * 保存页面的报表 | ||
63 | + * | ||
64 | + * @return | ||
65 | + */ | ||
66 | + @GetMapping("/detail/{pageCode}") | ||
67 | + public R save(@PathVariable("pageCode") String pageCode) { | ||
68 | + return success(extPageConfigService.getPageDetail(pageCode)); | ||
69 | + } | ||
70 | + | ||
71 | + | ||
72 | + /** | ||
73 | + * 分页查询所有数据 | ||
74 | + * | ||
75 | + * @param page 分页对象 | ||
76 | + * @param extPageConfig 查询实体 | ||
77 | + * @return 所有数据 | ||
78 | + */ | ||
79 | + @GetMapping | ||
80 | + public R selectAll(Page<ExtPageConfig> page, ExtPageConfig extPageConfig) { | ||
81 | + return success(this.extPageConfigService.page(page, new QueryWrapper<>(extPageConfig))); | ||
82 | + } | ||
83 | + | ||
84 | + /** | ||
85 | + * 通过主键查询单条数据 | ||
86 | + * | ||
87 | + * @param id 主键 | ||
88 | + * @return 单条数据 | ||
89 | + */ | ||
90 | + @GetMapping("{id}") | ||
91 | + public R selectOne(@PathVariable Serializable id) { | ||
92 | + return success(this.extPageConfigService.getById(id)); | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * 新增数据 | ||
97 | + * | ||
98 | + * @param extPageConfig 实体对象 | ||
99 | + * @return 新增结果 | ||
100 | + */ | ||
101 | + @PostMapping | ||
102 | + public R insert(@RequestBody ExtPageConfig extPageConfig) { | ||
103 | + return success(this.extPageConfigService.save(extPageConfig)); | ||
104 | + } | ||
105 | + | ||
106 | + /** | ||
107 | + * 修改数据 | ||
108 | + * | ||
109 | + * @param extPageConfig 实体对象 | ||
110 | + * @return 修改结果 | ||
111 | + */ | ||
112 | + @PutMapping | ||
113 | + public R update(@RequestBody ExtPageConfig extPageConfig) { | ||
114 | + return success(this.extPageConfigService.updateById(extPageConfig)); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * 删除数据 | ||
119 | + * | ||
120 | + * @param idList 主键结合 | ||
121 | + * @return 删除结果 | ||
122 | + */ | ||
123 | + @DeleteMapping | ||
124 | + public R delete(@RequestParam("idList") List<Long> idList) { | ||
125 | + return success(this.extPageConfigService.removeByIds(idList)); | ||
126 | + } | ||
127 | +} |
1 | +package org.jeecg.modules.jmreport.ext.dao; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import org.jeecg.modules.jmreport.ext.entity.ExtPageConfig; | ||
5 | +import org.jeecg.modules.jmreport.ext.pojo.PageTreeNode; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * (ExtPageConfig)表数据库访问层 | ||
11 | + * | ||
12 | + * @author makejava | ||
13 | + * @since 2021-09-14 14:59:31 | ||
14 | + */ | ||
15 | +public interface ExtPageConfigDao extends BaseMapper<ExtPageConfig> { | ||
16 | + | ||
17 | +} |
1 | +package org.jeecg.modules.jmreport.ext.entity; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.extension.activerecord.Model; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | +import java.util.Date; | ||
7 | + | ||
8 | +/** | ||
9 | + * (ExtPageConfig)表实体类 | ||
10 | + * | ||
11 | + * @author makejava | ||
12 | + * @since 2021-09-14 14:59:28 | ||
13 | + */ | ||
14 | +@SuppressWarnings("serial") | ||
15 | +public class ExtPageConfig extends Model<ExtPageConfig> { | ||
16 | + | ||
17 | + private Integer id; | ||
18 | + //父级页面 | ||
19 | + private Integer parentId; | ||
20 | + //页面名称 | ||
21 | + private String pageName; | ||
22 | + //页面编码 | ||
23 | + private String pageCode; | ||
24 | + //状态 0启动1停用2删除 | ||
25 | + private Integer status; | ||
26 | + //挂载报表 | ||
27 | + private String reportCode; | ||
28 | + // 排序 | ||
29 | + private Integer sort; | ||
30 | + | ||
31 | + // 排序 | ||
32 | + private Date createTime; | ||
33 | + | ||
34 | + | ||
35 | + public Integer getId() { | ||
36 | + return id; | ||
37 | + } | ||
38 | + | ||
39 | + public void setId(Integer id) { | ||
40 | + this.id = id; | ||
41 | + } | ||
42 | + | ||
43 | + public Integer getParentId() { | ||
44 | + return parentId; | ||
45 | + } | ||
46 | + | ||
47 | + public void setParentId(Integer parentId) { | ||
48 | + this.parentId = parentId; | ||
49 | + } | ||
50 | + | ||
51 | + public String getPageName() { | ||
52 | + return pageName; | ||
53 | + } | ||
54 | + | ||
55 | + public void setPageName(String pageName) { | ||
56 | + this.pageName = pageName; | ||
57 | + } | ||
58 | + | ||
59 | + public String getPageCode() { | ||
60 | + return pageCode; | ||
61 | + } | ||
62 | + | ||
63 | + public void setPageCode(String pageCode) { | ||
64 | + this.pageCode = pageCode; | ||
65 | + } | ||
66 | + | ||
67 | + public Integer getStatus() { | ||
68 | + return status; | ||
69 | + } | ||
70 | + | ||
71 | + public void setStatus(Integer status) { | ||
72 | + this.status = status; | ||
73 | + } | ||
74 | + | ||
75 | + public String getReportCode() { | ||
76 | + return reportCode; | ||
77 | + } | ||
78 | + | ||
79 | + public void setReportCode(String reportCode) { | ||
80 | + this.reportCode = reportCode; | ||
81 | + } | ||
82 | + | ||
83 | + public Integer getSort() { | ||
84 | + return sort; | ||
85 | + } | ||
86 | + | ||
87 | + public void setSort(Integer sort) { | ||
88 | + this.sort = sort; | ||
89 | + } | ||
90 | + | ||
91 | + public Date getCreateTime() { | ||
92 | + return createTime; | ||
93 | + } | ||
94 | + | ||
95 | + public void setCreateTime(Date createTime) { | ||
96 | + this.createTime = createTime; | ||
97 | + } | ||
98 | + | ||
99 | + /** | ||
100 | + * 获取主键值 | ||
101 | + * | ||
102 | + * @return 主键值 | ||
103 | + */ | ||
104 | + @Override | ||
105 | + protected Serializable pkVal() { | ||
106 | + return this.id; | ||
107 | + } | ||
108 | +} |
1 | +package org.jeecg.modules.jmreport.ext.pojo; | ||
2 | + | ||
3 | +import lombok.Builder; | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.ArrayList; | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +@Data | ||
11 | +@Builder | ||
12 | +public class PageDetail implements Serializable { | ||
13 | + | ||
14 | + public PageDetail() { | ||
15 | + } | ||
16 | + | ||
17 | + public PageDetail(String pageName, String pageCode, String reportCode, List<PageDetail> child) { | ||
18 | + this.pageName = pageName; | ||
19 | + this.pageCode = pageCode; | ||
20 | + this.reportCode = reportCode; | ||
21 | + this.child = child; | ||
22 | + } | ||
23 | + | ||
24 | + //页面名称 | ||
25 | + private String pageName; | ||
26 | + //页面编码 | ||
27 | + private String pageCode; | ||
28 | + | ||
29 | + //挂载报表 | ||
30 | + private String reportCode; | ||
31 | + | ||
32 | + private List<PageDetail> child = new ArrayList<>(); | ||
33 | +} |
1 | +package org.jeecg.modules.jmreport.ext.pojo; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | +import java.util.ArrayList; | ||
7 | +import java.util.HashMap; | ||
8 | +import java.util.List; | ||
9 | +import java.util.Map; | ||
10 | + | ||
11 | +@Data | ||
12 | +public class PageTreeNode implements Serializable { | ||
13 | + | ||
14 | + public PageTreeNode() { | ||
15 | + } | ||
16 | + | ||
17 | + public PageTreeNode(Integer id, boolean expand, boolean disabled, String title) { | ||
18 | + this.id = id; | ||
19 | + this.expand = expand; | ||
20 | + this.disabled = disabled; | ||
21 | + this.title = title; | ||
22 | + } | ||
23 | + | ||
24 | + public PageTreeNode(Integer id,String title) { | ||
25 | + this.id = id; | ||
26 | + this.title = title; | ||
27 | + } | ||
28 | + | ||
29 | + private Integer id; | ||
30 | + // 是否打开 | ||
31 | + private boolean expand = true; | ||
32 | + // 是否可点击 | ||
33 | + private boolean disabled = false; | ||
34 | + private String title; | ||
35 | + private List<PageTreeNode> children = new ArrayList<>(); | ||
36 | + | ||
37 | + private Map<String,String> props = new HashMap<>(); | ||
38 | +} |
1 | +package org.jeecg.modules.jmreport.ext.service; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
4 | +import org.jeecg.modules.jmreport.ext.entity.ExtPageConfig; | ||
5 | +import org.jeecg.modules.jmreport.ext.pojo.PageDetail; | ||
6 | +import org.jeecg.modules.jmreport.ext.pojo.PageTreeNode; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * (ExtPageConfig)表服务接口 | ||
12 | + * | ||
13 | + * @author makejava | ||
14 | + * @since 2021-09-14 14:59:32 | ||
15 | + */ | ||
16 | +public interface ExtPageConfigService extends IService<ExtPageConfig> { | ||
17 | + | ||
18 | + | ||
19 | + /** | ||
20 | + * 获取树节点信息 | ||
21 | + * @return | ||
22 | + */ | ||
23 | + PageTreeNode getTree(); | ||
24 | + | ||
25 | + | ||
26 | + /** | ||
27 | + * 获取报表页面详细信息 | ||
28 | + * @return | ||
29 | + */ | ||
30 | + PageDetail getPageDetail(String pageCode); | ||
31 | + | ||
32 | +} |
1 | +package org.jeecg.modules.jmreport.ext.service.impl; | ||
2 | + | ||
3 | +import org.influxdb.dto.QueryResult; | ||
4 | +import org.jeecg.modules.jmreport.ext.service.ApiService; | ||
5 | +import org.jeecg.modules.jmreport.utils.influx.InfluxDbUtils; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +@Service | ||
13 | +public class ApiServiceImpl implements ApiService { | ||
14 | + | ||
15 | + @Autowired | ||
16 | + private InfluxDbUtils influxDbUtils; | ||
17 | + | ||
18 | + public List<Map<String, Object>> queryInFlux(String sql) { | ||
19 | + QueryResult monitor = influxDbUtils.query(sql, "monitor"); | ||
20 | + | ||
21 | + | ||
22 | + List<Map<String, Object>> maps = influxDbUtils.queryResultToMapList(monitor); | ||
23 | + | ||
24 | + return maps; | ||
25 | + } | ||
26 | +} |
1 | +package org.jeecg.modules.jmreport.ext.service.impl; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
5 | +import org.apache.commons.lang3.StringUtils; | ||
6 | +import org.jeecg.modules.jmreport.ext.dao.ExtPageConfigDao; | ||
7 | +import org.jeecg.modules.jmreport.ext.entity.ExtPageConfig; | ||
8 | +import org.jeecg.modules.jmreport.ext.pojo.PageDetail; | ||
9 | +import org.jeecg.modules.jmreport.ext.pojo.PageTreeNode; | ||
10 | +import org.jeecg.modules.jmreport.ext.service.ExtPageConfigService; | ||
11 | +import org.springframework.stereotype.Service; | ||
12 | + | ||
13 | +import java.util.ArrayList; | ||
14 | +import java.util.List; | ||
15 | +import java.util.stream.Collectors; | ||
16 | + | ||
17 | +/** | ||
18 | + * (ExtPageConfig)表服务实现类 | ||
19 | + * | ||
20 | + * @author makejava | ||
21 | + * @since 2021-09-14 14:59:32 | ||
22 | + */ | ||
23 | +@Service | ||
24 | +public class ExtPageConfigServiceImpl extends ServiceImpl<ExtPageConfigDao, ExtPageConfig> implements ExtPageConfigService { | ||
25 | + | ||
26 | + /** | ||
27 | + * 获取树节点信息 | ||
28 | + * | ||
29 | + * @return | ||
30 | + */ | ||
31 | + @Override | ||
32 | + public PageTreeNode getTree() { | ||
33 | + | ||
34 | + PageTreeNode root = new PageTreeNode(-1,"页面配置"); | ||
35 | + | ||
36 | + LambdaQueryWrapper<ExtPageConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
37 | + queryWrapper.orderByAsc(ExtPageConfig::getSort); | ||
38 | + List<ExtPageConfig> list = this.list(queryWrapper); | ||
39 | + | ||
40 | + // 获取所有父节点 | ||
41 | + List<ExtPageConfig> parentList = list.stream().filter(item -> item.getParentId() == null).collect(Collectors.toList()); | ||
42 | + | ||
43 | + parentList.stream().forEach(item ->{ | ||
44 | + | ||
45 | + PageTreeNode node = new PageTreeNode(item.getId(),item.getPageName()); | ||
46 | + node.getProps().put("reportCode",item.getReportCode()); | ||
47 | + getChild(node,list,item); | ||
48 | + root.getChildren().add(node); | ||
49 | + }); | ||
50 | + | ||
51 | + return root; | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 获取报表页面详细信息 | ||
56 | + * | ||
57 | + * @param pageCode | ||
58 | + * @return | ||
59 | + */ | ||
60 | + @Override | ||
61 | + public PageDetail getPageDetail(String pageCode) { | ||
62 | + if(StringUtils.isBlank(pageCode)){ | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + | ||
67 | + LambdaQueryWrapper<ExtPageConfig> queryWrapper = new LambdaQueryWrapper<>(); | ||
68 | + queryWrapper.eq(ExtPageConfig::getPageCode,pageCode); | ||
69 | + | ||
70 | + ExtPageConfig one = this.getOne(queryWrapper); | ||
71 | + if(one == null){ | ||
72 | + return null; | ||
73 | + } | ||
74 | + | ||
75 | + PageDetail root = PageDetail.builder() | ||
76 | + .pageCode(one.getPageCode()) | ||
77 | + .pageName(one.getPageName()) | ||
78 | + .reportCode(one.getReportCode()) | ||
79 | + .child(new ArrayList<>()) | ||
80 | + .build(); | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + LambdaQueryWrapper<ExtPageConfig> queryWrapper1 = new LambdaQueryWrapper<>(); | ||
85 | + queryWrapper1.eq(ExtPageConfig::getParentId,one.getId()); | ||
86 | + queryWrapper1.orderByAsc(ExtPageConfig::getSort); | ||
87 | + List<ExtPageConfig> list = this.list(queryWrapper1); | ||
88 | + | ||
89 | + list.stream().forEach(item ->{ | ||
90 | + PageDetail child = PageDetail.builder() | ||
91 | + .pageCode(item.getPageCode()) | ||
92 | + .pageName(item.getPageName()) | ||
93 | + .reportCode(item.getReportCode()) | ||
94 | + .build(); | ||
95 | + | ||
96 | + root.getChild().add(child); | ||
97 | + }); | ||
98 | + | ||
99 | + return root; | ||
100 | + } | ||
101 | + | ||
102 | + | ||
103 | + private void getChild(PageTreeNode root,List<ExtPageConfig> list,ExtPageConfig pageConfig){ | ||
104 | + | ||
105 | + // 获取子节点 | ||
106 | + List<ExtPageConfig> childList = list.stream().filter(item -> item.getParentId() == root.getId()).collect(Collectors.toList()); | ||
107 | + | ||
108 | + if(!childList.isEmpty()){ | ||
109 | + childList.stream().forEach(item ->{ | ||
110 | + PageTreeNode node = new PageTreeNode(item.getId(),item.getPageName()); | ||
111 | + node.getProps().put("reportCode",item.getReportCode()); | ||
112 | + root.getChildren().add(node); | ||
113 | + }); | ||
114 | + } | ||
115 | + } | ||
116 | +} |
1 | +package org.jeecg.modules.jmreport.ext.service.impl; | ||
2 | + | ||
3 | +import org.jeecg.modules.jmreport.common.vo.Result; | ||
4 | +import org.jeecg.modules.jmreport.desreport.entity.JimuReport; | ||
5 | +import org.jeecg.modules.jmreport.desreport.model.ReportDbInfo; | ||
6 | +import org.jeecg.modules.jmreport.ext.service.SourceExtService; | ||
7 | +import org.springframework.stereotype.Service; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | + | ||
12 | +@Service | ||
13 | +public class SourceExtServiceImpl implements SourceExtService { | ||
14 | + /** | ||
15 | + * 扩展源码中的show接口 | ||
16 | + * | ||
17 | + * @param result | ||
18 | + */ | ||
19 | + @Override | ||
20 | + public void showApiExt(Result result) { | ||
21 | + | ||
22 | + Object obj = result.getResult(); | ||
23 | + if(obj instanceof JimuReport){ | ||
24 | + JimuReport jimuReport = (JimuReport)obj; | ||
25 | + | ||
26 | + Map<String, Object> dataList = jimuReport.getDataList(); | ||
27 | + | ||
28 | + dataList.forEach((k,v) ->{ | ||
29 | + | ||
30 | + // 当前类型 是数据源 | ||
31 | + if(v instanceof ReportDbInfo){ | ||
32 | + ReportDbInfo info = (ReportDbInfo)v; | ||
33 | + | ||
34 | + List<Map<String, Object>> list = info.getList(); | ||
35 | + | ||
36 | + list.stream().forEach(item ->{ | ||
37 | + if(item.containsKey("influxcpumin")){ | ||
38 | + item.put("influxcpumin",System.currentTimeMillis()+""); | ||
39 | + } | ||
40 | + if(item.containsKey("influxcpumax")){ | ||
41 | + item.put("influxcpumax",System.currentTimeMillis() +""); | ||
42 | + } | ||
43 | + | ||
44 | + | ||
45 | + }); | ||
46 | + } | ||
47 | + }); | ||
48 | + | ||
49 | + | ||
50 | + Map<String, Object> data = (Map<String, Object>)dataList.get(""); | ||
51 | + | ||
52 | + | ||
53 | + } | ||
54 | + | ||
55 | + } | ||
56 | +} |
1 | +package org.jeecg.modules.jmreport.utils.influx; | ||
2 | + | ||
3 | +import org.influxdb.InfluxDB; | ||
4 | +import org.influxdb.InfluxDBFactory; | ||
5 | +import org.springframework.beans.factory.annotation.Value; | ||
6 | +import org.springframework.stereotype.Component; | ||
7 | + | ||
8 | +@Component | ||
9 | +public class InfluxDBConfig { | ||
10 | + | ||
11 | + @Value("${spring.influx.url}") | ||
12 | + private String url; | ||
13 | + | ||
14 | + private String database; | ||
15 | + | ||
16 | + private String retentionPolicy; | ||
17 | + | ||
18 | + private InfluxDB influxDB; | ||
19 | + | ||
20 | + public InfluxDBConfig() { | ||
21 | + } | ||
22 | + | ||
23 | + | ||
24 | + public InfluxDBConfig(String userName, String password, String url, String database) { | ||
25 | +// this.userName = userName; | ||
26 | +// this.password = password; | ||
27 | + this.url = url; | ||
28 | + this.database = database; | ||
29 | + build(); | ||
30 | + } | ||
31 | + | ||
32 | + public InfluxDBConfig(String database) { | ||
33 | + this.database = database; | ||
34 | + build(); | ||
35 | + } | ||
36 | + | ||
37 | + private void build() { | ||
38 | + if (influxDB == null) { | ||
39 | + //influxDB = InfluxDBFactory.connect(this.url,this.userName,this.password); | ||
40 | + influxDB = InfluxDBFactory.connect(this.url); | ||
41 | + } | ||
42 | + influxDB.setDatabase(this.database); | ||
43 | + influxDB.setLogLevel(InfluxDB.LogLevel.BASIC); | ||
44 | + } | ||
45 | + | ||
46 | + public InfluxDB getInfluxDB() { | ||
47 | + return influxDB; | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | +} |
1 | +package org.jeecg.modules.jmreport.utils.influx; | ||
2 | + | ||
3 | +import lombok.extern.slf4j.Slf4j; | ||
4 | +import org.influxdb.InfluxDB; | ||
5 | +import org.influxdb.dto.Point; | ||
6 | +import org.influxdb.dto.Query; | ||
7 | +import org.influxdb.dto.QueryResult; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.text.SimpleDateFormat; | ||
12 | +import java.util.HashMap; | ||
13 | +import java.util.LinkedList; | ||
14 | +import java.util.List; | ||
15 | +import java.util.Map; | ||
16 | + | ||
17 | +@Slf4j | ||
18 | +@Service | ||
19 | +public class InfluxDbUtils { | ||
20 | + | ||
21 | + @Autowired | ||
22 | + InfluxDBConfig influxDBConfig; | ||
23 | + | ||
24 | + @Autowired | ||
25 | + private InfluxDB influxDB; | ||
26 | + | ||
27 | + /** | ||
28 | + * 创建数据库 | ||
29 | + * | ||
30 | + * @param dbName | ||
31 | + */ | ||
32 | + public void createDB(String dbName) { | ||
33 | + influxDB.createDatabase(dbName); | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * 删除数据库 | ||
38 | + * | ||
39 | + * @param dbName | ||
40 | + */ | ||
41 | + public void deleteDB(String dbName) { | ||
42 | + influxDB.deleteDatabase(dbName); | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * 创建策略 | ||
47 | + * | ||
48 | + * @param command | ||
49 | + * @param database | ||
50 | + */ | ||
51 | + public void createRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
52 | + command = String.format("CREATE RETENTION POLICY \"%s\" ON \"%s\" DURATION %s REPLICATION %s DEFAULT", defalut, database, policy, fb); | ||
53 | + query(command, database); | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * 删除策略 | ||
58 | + * | ||
59 | + * @param command | ||
60 | + * @param database | ||
61 | + */ | ||
62 | + public void removeRetentionPolicy(String command, String defalut, String database, String policy, int fb) { | ||
63 | + | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * 创建表 | ||
68 | + * | ||
69 | + * @param command 删除语句 | ||
70 | + * @return 返回错误信息 | ||
71 | + */ | ||
72 | + public void createMeasurementData(String command, String database) { | ||
73 | + | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 删除表 | ||
78 | + * | ||
79 | + * @param command 删除语句 | ||
80 | + * @return 返回错误信息 | ||
81 | + */ | ||
82 | + public String deleteMeasurementData(String command, String database) { | ||
83 | + QueryResult result = influxDB.query(new Query(command, database)); | ||
84 | + return result.getError(); | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * 查询 | ||
89 | + * | ||
90 | + * @param command 查询语句 | ||
91 | + * @return | ||
92 | + */ | ||
93 | + public QueryResult query(String command, String database) { | ||
94 | + return influxDB.query(new Query(command, database)); | ||
95 | + } | ||
96 | + | ||
97 | + | ||
98 | +// public void insert(String measurements, Map<String, String> tagsMap, Map<String, Object> fieldsMap) { | ||
99 | +// influxDBConfig.getInfluxDB(); | ||
100 | +// influxDB.insert(measurements, tagsMap, fieldsMap); | ||
101 | +// } | ||
102 | + | ||
103 | + /** | ||
104 | + * 新增 | ||
105 | + * | ||
106 | + * @param dateabse | ||
107 | + * @param measurements | ||
108 | + * @param tagsMap | ||
109 | + * @param fieldsMap | ||
110 | + */ | ||
111 | + public void insert(String dateabse, String measurements, Map<String, String> tagsMap, Map<String, Double> fieldsMap) { | ||
112 | + Point.Builder builder = Point.measurement(measurements); | ||
113 | + //builder.time(System.currentTimeMillis(),TimeUnit.MICROSECONDS); | ||
114 | + builder.addField("kpiValue", fieldsMap.get("kpiValue")); | ||
115 | + //builder.tag("resType", tagsMap.get("resType")); | ||
116 | + builder.tag("resId", tagsMap.get("resId")); | ||
117 | + builder.tag("kpiId", tagsMap.get("kpiId")); | ||
118 | + builder.tag("flag", tagsMap.get("flag")); | ||
119 | + //builder.tag("ipAdde", tagsMap.get("ipAdde")); | ||
120 | + Point point = builder.build(); | ||
121 | + influxDB.setDatabase(dateabse).write(point); | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * 将queryResult 查询结果转换为 map | ||
126 | + * | ||
127 | + * @param queryResult 查询结果 | ||
128 | + * @return List<Map < String , Object>> | ||
129 | + * @author 惠佳旭 | ||
130 | + * @date 2020/12/17 | ||
131 | + */ | ||
132 | + public List<Map<String, Object>> queryResultToMapList(QueryResult queryResult) { | ||
133 | + List<Map<String, Object>> resultList = new LinkedList<>(); | ||
134 | + for (QueryResult.Result result : queryResult.getResults()) { | ||
135 | + if (result == null || result.getSeries() == null) { | ||
136 | + break; | ||
137 | + } | ||
138 | + for (QueryResult.Series series : result.getSeries()) { | ||
139 | + if (series == null || series.getValues() == null) { | ||
140 | + break; | ||
141 | + } | ||
142 | + List<String> columns = series.getColumns(); | ||
143 | + for (List<Object> value : series.getValues()) { | ||
144 | + if (value == null) { | ||
145 | + break; | ||
146 | + } | ||
147 | + Map<String, Object> map = new HashMap<>(columns.size()); | ||
148 | + for (int i = 0; i < value.size(); i++) { | ||
149 | + String columnName = columns.get(i); | ||
150 | + if ("time".equals(columnName)) { | ||
151 | + try { | ||
152 | + String timeStr = value.get(i).toString(); | ||
153 | + map.put(columnName, timeStr.substring(0, 10) + " " + timeStr.substring(11, 19)); | ||
154 | + } catch (Exception e) { | ||
155 | + log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
156 | + map.put(columnName, value.get(i)); | ||
157 | + } | ||
158 | + } else { | ||
159 | + map.put(columnName, value.get(i)); | ||
160 | + } | ||
161 | + } | ||
162 | + resultList.add(map); | ||
163 | + } | ||
164 | + } | ||
165 | + } | ||
166 | + return resultList; | ||
167 | + } | ||
168 | + | ||
169 | + | ||
170 | + public List<Map<String, Object>> queryResultToMap(QueryResult queryResult, String dateFormat) { | ||
171 | + SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); | ||
172 | + List<Map<String, Object>> resultList = new LinkedList<>(); | ||
173 | + for (QueryResult.Result result : queryResult.getResults()) { | ||
174 | + if (result == null || result.getSeries() == null) { | ||
175 | + break; | ||
176 | + } | ||
177 | + for (QueryResult.Series series : result.getSeries()) { | ||
178 | + if (series == null || series.getValues() == null) { | ||
179 | + break; | ||
180 | + } | ||
181 | + List<String> columns = series.getColumns(); | ||
182 | + for (List<Object> value : series.getValues()) { | ||
183 | + if (value == null) { | ||
184 | + break; | ||
185 | + } | ||
186 | + Map<String, Object> map = new HashMap<>(columns.size()); | ||
187 | + for (int i = 0; i < value.size(); i++) { | ||
188 | + String columnName = columns.get(i); | ||
189 | + if ("time".equals(columnName)) { | ||
190 | + try { | ||
191 | + map.put(columnName, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(sdf.parse(value.get(i).toString()))); | ||
192 | + } catch (Exception e) { | ||
193 | + log.error("转换失败:{}转换为日期失败", value.get(i)); | ||
194 | + map.put(columnName, value.get(i)); | ||
195 | + } | ||
196 | + } else { | ||
197 | + map.put(columnName, value.get(i)); | ||
198 | + } | ||
199 | + } | ||
200 | + resultList.add(map); | ||
201 | + } | ||
202 | + } | ||
203 | + } | ||
204 | + return resultList; | ||
205 | + } | ||
206 | + | ||
207 | + | ||
208 | +} |
src/main/resources/application-tjserver.yml
0 → 100644
1 | +server: | ||
2 | + port: 8085 | ||
3 | +spring: | ||
4 | + #配置静态资源 | ||
5 | + mvc: | ||
6 | + static-path-pattern: /** | ||
7 | + resource: | ||
8 | + static-locations: classpath:/static/ | ||
9 | + #配置数据库 | ||
10 | + datasource: | ||
11 | + url: jdbc:mysql://${MYSQL-HOST:192.168.0.249}:${MYSQL-PORT:3306}/${MYSQL-DB:jreport}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | + username: root | ||
13 | + password: 123456 | ||
14 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | +#Minidao配置 | ||
16 | +minidao : | ||
17 | + base-package: org.jeecg.modules.jmreport.* | ||
18 | +#JimuReport[上传配置] | ||
19 | +jeecg : | ||
20 | + # local|minio|alioss | ||
21 | + uploadType: local | ||
22 | + # local | ||
23 | + path : | ||
24 | + #文件路径 | ||
25 | + upload: /opt/upload | ||
26 | + # alioss | ||
27 | + oss: | ||
28 | + endpoint: ?? | ||
29 | + accessKey: ?? | ||
30 | + secretKey: ?? | ||
31 | + bucketName: jimureport | ||
32 | + # minio | ||
33 | + minio: | ||
34 | + minio_url: http://minio.jeecg.com | ||
35 | + minio_name: ?? | ||
36 | + minio_pass: ?? | ||
37 | + bucketName: ?? | ||
38 | +#输出sql日志 | ||
39 | +logging: | ||
40 | + level: | ||
41 | + org.jeecg.modules.jmreport : info |
src/main/resources/application-vm249.yml
0 → 100644
1 | +server: | ||
2 | + port: 8085 | ||
3 | +spring: | ||
4 | + #配置静态资源 | ||
5 | + mvc: | ||
6 | + static-path-pattern: /** | ||
7 | + resource: | ||
8 | + static-locations: classpath:/static/ | ||
9 | + #配置数据库 | ||
10 | + datasource: | ||
11 | + url: jdbc:mysql://69.12.93.116:3306/jreport?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | + username: root | ||
13 | + password: 123456 | ||
14 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | +#Minidao配置 | ||
16 | +minidao : | ||
17 | + base-package: org.jeecg.modules.jmreport.* | ||
18 | +#JimuReport[上传配置] | ||
19 | +jeecg : | ||
20 | + # local|minio|alioss | ||
21 | + uploadType: local | ||
22 | + # local | ||
23 | + path : | ||
24 | + #文件路径 | ||
25 | + upload: /opt/upload | ||
26 | + # alioss | ||
27 | + oss: | ||
28 | + endpoint: ?? | ||
29 | + accessKey: ?? | ||
30 | + secretKey: ?? | ||
31 | + bucketName: jimureport | ||
32 | + # minio | ||
33 | + minio: | ||
34 | + minio_url: http://minio.jeecg.com | ||
35 | + minio_name: ?? | ||
36 | + minio_pass: ?? | ||
37 | + bucketName: ?? | ||
38 | +#输出sql日志 | ||
39 | +logging: | ||
40 | + level: | ||
41 | + org.jeecg.modules.jmreport : info |
src/main/resources/application.yml
0 → 100644
1 | +server: | ||
2 | + port: 8085 | ||
3 | +spring: | ||
4 | + #配置静态资源 | ||
5 | + mvc: | ||
6 | + static-path-pattern: /** | ||
7 | + resource: | ||
8 | + static-locations: classpath:/static/ | ||
9 | + #配置数据库 | ||
10 | + datasource: | ||
11 | + url: jdbc:mysql://${MYSQL-HOST:127.0.0.1}:${MYSQL-PORT:3306}/${MYSQL-DB:jreport}?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true | ||
12 | + username: yx | ||
13 | + password: 123456 | ||
14 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
15 | + profiles: | ||
16 | + active: tjserver | ||
17 | + influx: | ||
18 | + url: http://192.168.0.244:8086 | ||
19 | + database: monitor | ||
20 | + retention_policy: default | ||
21 | + retention_policy_time: 7d | ||
22 | +#mybatis | ||
23 | +mybatis-plus: | ||
24 | + mapper-locations: classpath*:org/jeecg/modules/jmreport/**/dao/*.xml | ||
25 | +#Minidao配置 | ||
26 | +minidao : | ||
27 | + base-package: org.jeecg.modules.jmreport.* | ||
28 | +#JimuReport[上传配置] | ||
29 | +jeecg : | ||
30 | + # local|minio|alioss | ||
31 | + uploadType: local | ||
32 | + # local | ||
33 | + path : | ||
34 | + #文件路径 | ||
35 | + upload: /opt/upload | ||
36 | + # alioss | ||
37 | + oss: | ||
38 | + endpoint: ?? | ||
39 | + accessKey: ?? | ||
40 | + secretKey: ?? | ||
41 | + bucketName: jimureport | ||
42 | + # minio | ||
43 | + minio: | ||
44 | + minio_url: http://minio.jeecg.com | ||
45 | + minio_name: ?? | ||
46 | + minio_pass: ?? | ||
47 | + bucketName: ?? | ||
48 | +#输出sql日志 | ||
49 | +logging: | ||
50 | + level: | ||
51 | + org.jeecg.modules.jmreport : info |

11.5 KB
1 | +<#assign CACHE_VERSION = "v=1.0.38"> | ||
2 | +<!DOCTYPE html> | ||
3 | +<html> | ||
4 | +<head> | ||
5 | + <script> | ||
6 | + let base = "${base}"; | ||
7 | + let baseFull = "${base}" + "${customPrePath}"; | ||
8 | + | ||
9 | + /** | ||
10 | + * 获取url参数 | ||
11 | + */ | ||
12 | + function getRequestUrl() { | ||
13 | + var url = location.search; | ||
14 | + var theRequest = new Object(); | ||
15 | + if (url.indexOf("?") != -1) { | ||
16 | + var str = url.substr(1); | ||
17 | + strs = str.split("&"); | ||
18 | + for (var i = 0; i < strs.length; i++) { | ||
19 | + theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]); | ||
20 | + } | ||
21 | + } | ||
22 | + return theRequest; | ||
23 | + } | ||
24 | + | ||
25 | + let token = getRequestUrl().token; | ||
26 | + if (token == "" || token == null) { | ||
27 | + token = window.localStorage.getItem('JmReport-Access-Token'); | ||
28 | + } | ||
29 | + window.localStorage.setItem('JmReport-Access-Token', token); | ||
30 | + </script> | ||
31 | + <meta charset="utf-8"> | ||
32 | + <meta name="viewport" content="width=device-width"> | ||
33 | + <title>在线设计</title> | ||
34 | + <#include "./common/resource.ftl"> | ||
35 | + <link rel="stylesheet" href="${base}${customPrePath}/jmreport/desreport_/corelib/cust.css?${CACHE_VERSION}"> | ||
36 | + <link rel="shortcut icon" href="${base}${customPrePath}/jmreport/desreport_/corelib/logo.png?${CACHE_VERSION}" | ||
37 | + type="image/x-ico"> | ||
38 | +</head> | ||
39 | +<body style="background: #ffffff"> | ||
40 | +<style> | ||
41 | + | ||
42 | + .ivu-page, | ||
43 | + .ivu-page-prev, | ||
44 | + .ivu-page-next, | ||
45 | + .ivu-select-selection, | ||
46 | + .ivu-select-dropdown, | ||
47 | + .ivu-page.mini .ivu-page-options-elevator input { | ||
48 | + background-color: #ffffff; | ||
49 | + color: #515a6e; | ||
50 | + } | ||
51 | + | ||
52 | + .page { | ||
53 | + display: flex; | ||
54 | + justify-content: center; | ||
55 | + -webkit-box-pack: center; | ||
56 | + } | ||
57 | + | ||
58 | + .ivu-page-item { | ||
59 | + background-color: #ffffff; | ||
60 | + border: 1px solid rgba(131, 125, 125, 0.5); | ||
61 | + } | ||
62 | + | ||
63 | + .ivu-page-item-active { | ||
64 | + background-color: white; | ||
65 | + border: 1px solid #409eff; | ||
66 | + } | ||
67 | + | ||
68 | + .ivu-page-item a { | ||
69 | + margin: 0 6px; | ||
70 | + text-decoration: none; | ||
71 | + color: #515a6e; | ||
72 | + } | ||
73 | + | ||
74 | + .ivu-page-next a, .ivu-page-prev a { | ||
75 | + font-size: 14px; | ||
76 | + color: #515a6e; | ||
77 | + } | ||
78 | + | ||
79 | + .ivu-spin-fix { | ||
80 | + background-color: rgba(131, 125, 125, 0.5); | ||
81 | + } | ||
82 | +</style> | ||
83 | +<style> | ||
84 | + .title { | ||
85 | + font-size: 20px; | ||
86 | + color: #000000; | ||
87 | + text-align: center; | ||
88 | + line-height: 60px; | ||
89 | + font-weight: 500; | ||
90 | + } | ||
91 | + | ||
92 | + .ivu-layout-sider { | ||
93 | + transition: all .2s ease-in-out; | ||
94 | + position: relative; | ||
95 | + background: #ffffff; | ||
96 | + } | ||
97 | + | ||
98 | + .ivu-layout { | ||
99 | + display: flex; | ||
100 | + -webkit-box-orient: vertical; | ||
101 | + -webkit-box-direction: normal; | ||
102 | + flex-direction: column; | ||
103 | + -webkit-box-flex: 1; | ||
104 | + flex: auto; | ||
105 | + background: #ffffff; | ||
106 | + } | ||
107 | + | ||
108 | + .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened .ivu-menu-submenu-title { | ||
109 | + background: #ffffff; | ||
110 | + } | ||
111 | + | ||
112 | + .ivu-menu-dark.ivu-menu-vertical .ivu-menu-opened { | ||
113 | + background: #ffffff; | ||
114 | + } | ||
115 | + | ||
116 | + .ivu-upload-list { | ||
117 | + display: none; | ||
118 | + } | ||
119 | + | ||
120 | + .ivu-table-tip table tbody tr td { | ||
121 | + background-color: ffffff; | ||
122 | + color: #000000; | ||
123 | + } | ||
124 | + | ||
125 | + .ivu-select-dropdown-list .ivu-select-item-focus { | ||
126 | + background: none !important; | ||
127 | + } | ||
128 | +</style> | ||
129 | +<!--引入自定义组件--> | ||
130 | +<#include "./template/list.ftl"> | ||
131 | +<div id="app" style="padding-left: 30px"> | ||
132 | + <div class="layout" style="margin-left: -30px;margin-top: -10px;"> | ||
133 | + <div style="background-color: #1890FF;height: 47px"> | ||
134 | + <span class="aui-logo"></span> | ||
135 | + <span class="jimu-header">报表工作台 </span> | ||
136 | + </div> | ||
137 | + <Layout> | ||
138 | + <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed"> | ||
139 | + <i-menu theme="primary" width="auto" :class="menuitemClasses" active-name="datainfo" | ||
140 | + :open-names="['sub']" @on-select="onMenuSelect"> | ||
141 | + <Submenu name="sub"> | ||
142 | + <template slot="title"> | ||
143 | + <Icon type="ios-apps"/> | ||
144 | + </Icon> | ||
145 | + 报表管理 | ||
146 | + </template> | ||
147 | + <Menu-Item name="datainfo"> | ||
148 | + <Icon type="md-list"/> | ||
149 | + </Icon> | ||
150 | + <span>数据报表</span> | ||
151 | + </Menu-Item> | ||
152 | + <Menu-Item name="chartinfo"> | ||
153 | + <Icon type="md-images"></Icon> | ||
154 | + <span>图形报表</span> | ||
155 | + </Menu-Item> | ||
156 | + <Menu-Item name="printinfo"> | ||
157 | + <Icon type="md-print"></Icon> | ||
158 | + <span>打印设计</span> | ||
159 | + </Menu-Item> | ||
160 | + <Menu-Item name="setting"> | ||
161 | + <Icon type="md-settings"></Icon> | ||
162 | + <span>报表设置</span> | ||
163 | + </Menu-Item> | ||
164 | + </Submenu> | ||
165 | + </i-menu> | ||
166 | + <div slot="trigger"></div> | ||
167 | + </Sider> | ||
168 | + <Tabs value="name1" style="width: 100%" @on-click="tabsClick"> | ||
169 | + <tab-pane icon="md-desktop" label="报表设计" name="name1" class="jimu-tab"> | ||
170 | + <div style="display: flex;justify-content:space-between;margin-left:16px;margin-right: 38px;"> | ||
171 | + <div> | ||
172 | + <i-input size="small" v-model="name" @keyup.enter.native="enterSearchClick" | ||
173 | + placeholder="回车搜索报表名称"></i-input> | ||
174 | + </div> | ||
175 | + <div class="page"> | ||
176 | + <Page :total="page.total" | ||
177 | + show-total | ||
178 | + show-elevator | ||
179 | + :page-size="page.size" | ||
180 | + show-sizer | ||
181 | + @on-change="handleCurrentChange" | ||
182 | + @on-page-size-change="handleSizeChange" | ||
183 | + size="small"> | ||
184 | + </Page> | ||
185 | + </div> | ||
186 | + <div> | ||
187 | + <i-select | ||
188 | + transfer="true" | ||
189 | + v-model="previewModel" | ||
190 | + size="small" | ||
191 | + style="width: 78px;text-align: center;"> | ||
192 | + <i-option value="view" style="font-size: 10px">视图</i-option> | ||
193 | + <i-option value="list" style="font-size: 10px">列表</i-option> | ||
194 | + </i-select> | ||
195 | + </div> | ||
196 | + </div> | ||
197 | + <div style="display: flex;flex-wrap: wrap;" v-if="previewModel =='view'"> | ||
198 | + <div class="excel-view-item excel-list-add"> | ||
199 | + <a @click="createExcel"> | ||
200 | + <i class="ivu-icon ivu-icon-md-add" style="font-size:20px; padding-bottom: 5px;"></i> | ||
201 | + <p style="letter-spacing: 2px;font-size: 14px;">新建报表</p> | ||
202 | + </a> | ||
203 | + </div> | ||
204 | + | ||
205 | + <!-- 循环开始 –>--> | ||
206 | + <div | ||
207 | + v-for="(item,index) in dataSource" | ||
208 | + :key="index" | ||
209 | + class="excel-view-item" | ||
210 | + @mouseover="item.editable=true" | ||
211 | + @mouseout="item.editable=false"> | ||
212 | + | ||
213 | + <!-- 缩略图 –>--> | ||
214 | + <div class="thumb"> | ||
215 | + <img :src="getThumbSrc(item)"/> | ||
216 | + <div class="excel-edit-container" v-show="item.editable"> | ||
217 | + <a :href="getExcelEditUrl(item)" target="_blank"> | ||
218 | + 设计 | ||
219 | + </a> | ||
220 | + </div> | ||
221 | + </div> | ||
222 | + | ||
223 | + <!-- 底部 –>--> | ||
224 | + <div class="item-footer"> | ||
225 | + <span class="item-name">{{ item.name }}</span> | ||
226 | + <div> | ||
227 | + <a class="opt-show" :href="getExcelViewUrl(item)" target="_blank"> | ||
228 | + <Tooltip content="预览模板" placement="top"> | ||
229 | + <i class="ivu-icon ivu-icon-ios-eye-outline" style="font-size: 16px"></i> | ||
230 | + </Tooltip> | ||
231 | + </a> | ||
232 | + <a class="opt-show" v-show="userMessage" @click="setTemplate(item,1)"> | ||
233 | + <Tooltip content="收藏模板" placement="top"> | ||
234 | + <i class="ivu-icon ivu-icon-ios-star-outline" style="font-size: 16px"></i> | ||
235 | + </Tooltip> | ||
236 | + </a> | ||
237 | + <a class="opt-show" @click="handleDelete(item)"> | ||
238 | + <Tooltip content="删除模板" placement="top"> | ||
239 | + <i class="ivu-icon ivu-icon-ios-trash" style="font-size: 16px"></i> | ||
240 | + </Tooltip> | ||
241 | + </a> | ||
242 | + <a class="opt-show" @click="handleCopy(item)"> | ||
243 | + <Tooltip content="复制模板" placement="top"> | ||
244 | + <i class="ivu-icon ivu-icon-ios-browsers" style="font-size: 16px"></i> | ||
245 | + </Tooltip> | ||
246 | + </a> | ||
247 | + <a class="opt-show" @click="handleShare(item.id)"> | ||
248 | + <Tooltip content="分享" placement="top"> | ||
249 | + <i class="ivu-icon ivu-icon-ios-share-alt" style="font-size: 16px"></i> | ||
250 | + </Tooltip> | ||
251 | + </a> | ||
252 | + </div> | ||
253 | + | ||
254 | + </div> | ||
255 | + </div> | ||
256 | + <!-- 循环结束 –>--> | ||
257 | + </div> | ||
258 | + <div v-else style="padding: 10px 10px"> | ||
259 | + <i-button type="primary" @click="createExcel" size="small" | ||
260 | + style="margin-left: 6px;width:78px;font-size: 10px"> | ||
261 | + 新建报表 | ||
262 | + </i-button> | ||
263 | + <i-table size="small" style="margin-top: 10px" border :columns="listColumns" :data="dataSource"> | ||
264 | + <template slot-scope="{ row, index }" slot="action"> | ||
265 | + <a class="opt-list-show" :href="getExcelViewUrl(row)" target="_blank"> | ||
266 | + <Tooltip transfer="true" content="预览模板" placement="top"> | ||
267 | + <i class="ivu-icon ivu-icon-ios-eye-outline" style="font-size: 16px"></i> | ||
268 | + </Tooltip> | ||
269 | + </a> | ||
270 | + <a class="opt-list-show" :href="getExcelEditUrl(row)" target="_blank"> | ||
271 | + <Tooltip transfer="true" content="编辑" placement="top"> | ||
272 | + <i class="ivu-icon ivu-icon-md-create" style="font-size: 16px"></i> | ||
273 | + </Tooltip> | ||
274 | + </a> | ||
275 | + <a class="opt-list-show" v-show="userMessage" @click="setTemplate(row,1)"> | ||
276 | + <Tooltip transfer="true" content="收藏模板" placement="top"> | ||
277 | + <i class="ivu-icon ivu-icon-ios-star-outline" style="font-size: 16px"></i> | ||
278 | + </Tooltip> | ||
279 | + </a> | ||
280 | + <a class="opt-list-show" @click="handleDelete(row)"> | ||
281 | + <Tooltip transfer="true" content="删除模板" placement="top"> | ||
282 | + <i class="ivu-icon ivu-icon-ios-trash" style="font-size: 16px"></i> | ||
283 | + </Tooltip> | ||
284 | + </a> | ||
285 | + <a class="opt-list-show" @click="handleCopy(row)"> | ||
286 | + <Tooltip transfer="true" content="复制模板" placement="top"> | ||
287 | + <i class="ivu-icon ivu-icon-ios-browsers" style="font-size: 16px"></i> | ||
288 | + </Tooltip> | ||
289 | + </a> | ||
290 | + <a class="opt-list-show" @click="handleShare(row.id)"> | ||
291 | + <Tooltip transfer="true" content="分享" placement="top"> | ||
292 | + <i class="ivu-icon ivu-icon-ios-share-alt" style="font-size: 16px"></i> | ||
293 | + </Tooltip> | ||
294 | + </a> | ||
295 | + </template> | ||
296 | + </i-table> | ||
297 | + </div> | ||
298 | + </tab-pane> | ||
299 | + <tab-pane icon="md-options" label="模板案例" name="name2" class="jimu-tab"> | ||
300 | + <div style="display: flex;justify-content:space-between;margin-left:16px;margin-right: 38px"> | ||
301 | + <div> | ||
302 | + <i-input size="small" v-model="name" @keyup.enter.native="loadData" | ||
303 | + placeholder="回车搜索报表名称"></i-input> | ||
304 | + </div> | ||
305 | + <div class="page"> | ||
306 | + <Page :total="page.total" | ||
307 | + show-total | ||
308 | + show-elevator | ||
309 | + :page-size="page.size" | ||
310 | + show-sizer | ||
311 | + @on-change="handleCurrentChange" | ||
312 | + @on-page-size-change="handleSizeChange" | ||
313 | + size="small"> | ||
314 | + </Page> | ||
315 | + </div> | ||
316 | + <div> | ||
317 | + <i-select | ||
318 | + transfer="true" | ||
319 | + v-model="previewModel" | ||
320 | + size="small" | ||
321 | + style="width: 78px;text-align: center;"> | ||
322 | + <i-option value="view" style="font-size: 10px">视图</i-option> | ||
323 | + <i-option value="list" style="font-size: 10px">列表</i-option> | ||
324 | + </i-select> | ||
325 | + </div> | ||
326 | + </div> | ||
327 | + <div style="display: flex;flex-wrap: wrap;" v-if="previewModel =='view'"> | ||
328 | + | ||
329 | + <!-- 循环开始 –>--> | ||
330 | + <div | ||
331 | + v-for="(item,index) in dataSource" | ||
332 | + :key="index" | ||
333 | + class="excel-view-item" | ||
334 | + @mouseover="item.editable=true" | ||
335 | + @mouseout="item.editable=false"> | ||
336 | + | ||
337 | + <!-- 缩略图 –>--> | ||
338 | + <div class="thumb"> | ||
339 | + <img :src="getThumbSrc(item)"/> | ||
340 | + <div class="excel-edit-container" v-show="item.editable"> | ||
341 | + <a v-show="userMessage" :href="getExcelEditUrl(item)" target="_blank"> | ||
342 | + 设计 | ||
343 | + </a> | ||
344 | + </div> | ||
345 | + </div> | ||
346 | + | ||
347 | + <!-- 底部 –>--> | ||
348 | + <div class="item-footer"> | ||
349 | + <span class="item-name">{{ item.name }}</span> | ||
350 | + <div style="margin-left: 14%;"> | ||
351 | + <a class="opt-show" :href="getExcelViewUrl(item)" target="_blank"> | ||
352 | + <Tooltip content="预览模板" placement="top"> | ||
353 | + <i class="ivu-icon ivu-icon-ios-eye-outline" style="font-size: 16px"></i> | ||
354 | + </Tooltip> | ||
355 | + </a> | ||
356 | + <a class="opt-show" v-show="userMessage" @click="setTemplate(item,0)"> | ||
357 | + <Tooltip content="取消收藏" placement="top"> | ||
358 | + <i class="ivu-icon ivu-icon-ios-star" style="font-size: 16px"></i> | ||
359 | + </Tooltip> | ||
360 | + </a> | ||
361 | + <a class="opt-show" @click="handleCopy(item)"> | ||
362 | + <Tooltip content="复制模板" placement="top"> | ||
363 | + <i class="ivu-icon ivu-icon-ios-browsers" style="font-size: 16px"></i> | ||
364 | + </Tooltip> | ||
365 | + </a> | ||
366 | + </div> | ||
367 | + <div v-show="userMessage"> | ||
368 | + <Upload | ||
369 | + :headers="uploadHeader" | ||
370 | + :before-upload="handleUpload" | ||
371 | + :data="{'id':item.id}" | ||
372 | + :action="actionUrl" | ||
373 | + :format="['jpg','jpeg','png']" | ||
374 | + :on-format-error="handleFormatError" | ||
375 | + :on-exceeded-size="handleMaxSize" | ||
376 | + :on-success="handleSuccess"> | ||
377 | + <Tooltip content="上传封面" placement="top-end"> | ||
378 | + <i class="ivu-icon ivu-icon-md-image" style="font-size: 16px"></i> | ||
379 | + </Tooltip> | ||
380 | + </Upload> | ||
381 | + </div> | ||
382 | + </div> | ||
383 | + </div> | ||
384 | + <!-- 循环结束 –>--> | ||
385 | + </div> | ||
386 | + <div v-else style="padding: 10px 10px"> | ||
387 | + <i-button type="primary" @click="createExcel" | ||
388 | + style="margin-left: 6px;width:78px;font-size: 10px" size="small"> | ||
389 | + 新建报表 | ||
390 | + </i-button> | ||
391 | + <i-table size="small" style="margin-top: 10px" border :columns="listColumns" :data="dataSource"> | ||
392 | + <template slot-scope="{ row, index }" slot="action"> | ||
393 | + <a class="opt-list-show" :href="getExcelEditUrl(row)" target="_blank"> | ||
394 | + <Tooltip transfer="true" content="编辑" placement="top"> | ||
395 | + <i class="ivu-icon ivu-icon-md-create" style="font-size: 16px"></i> | ||
396 | + </Tooltip> | ||
397 | + </a> | ||
398 | + <a class="opt-list-show" :href="getExcelViewUrl(row)" target="_blank"> | ||
399 | + <Tooltip transfer="true" content="预览模板" placement="top"> | ||
400 | + <i class="ivu-icon ivu-icon-ios-eye-outline" style="font-size: 16px"></i> | ||
401 | + </Tooltip> | ||
402 | + </a> | ||
403 | + <a class="opt-list-show" v-show="userMessage" @click="setTemplate(row,0)"> | ||
404 | + <Tooltip transfer="true" content="取消收藏" placement="top"> | ||
405 | + <i class="ivu-icon ivu-icon-ios-star" style="font-size: 16px"></i> | ||
406 | + </Tooltip> | ||
407 | + </a> | ||
408 | + <a class="opt-list-show" @click="handleCopy(row)"> | ||
409 | + <Tooltip transfer="true" content="复制模板" placement="top"> | ||
410 | + <i class="ivu-icon ivu-icon-ios-browsers" style="font-size: 16px"></i> | ||
411 | + </Tooltip> | ||
412 | + </a> | ||
413 | + </template> | ||
414 | + </i-table> | ||
415 | + </div> | ||
416 | + </tab-pane> | ||
417 | + </Tabs> | ||
418 | + </Layout> | ||
419 | + </div> | ||
420 | +<#--分享弹窗--> | ||
421 | + <j-jurisdiction ref="jurisdiction"></j-jurisdiction> | ||
422 | + | ||
423 | +<#--报表设置--> | ||
424 | + <Modal v-model="visibleSetting" | ||
425 | + :styles="{top: '20px',width:'80%'}" | ||
426 | + title="报表设置" | ||
427 | + @on-cancel="visibleSetting = false"> | ||
428 | + <div style="display: flex;flex-direction: row"> | ||
429 | + <div style="width: 200px"> | ||
430 | + <Tree ref="tree" :data="treeData" @on-select-change="onTreeChange"></Tree> | ||
431 | + </div> | ||
432 | + <div style="width: calc(100% - 200px)"> | ||
433 | + <div style="text-align: right;padding-right: 12px"> | ||
434 | + <i-button type="primary" @click="savePageConfig" | ||
435 | + style="margin-left: 6px;width:78px;font-size: 10px" size="small"> | ||
436 | + 保存配置 | ||
437 | + </i-button> | ||
438 | + </div> | ||
439 | + <i-table ref="treeTable" size="small" style="margin-top: 10px" border :columns="treeTableColumns" :data="dataSource"> | ||
440 | + <template slot-scope="{ row, index }" slot="action"> | ||
441 | + <a class="opt-list-show" :href="getExcelViewUrl(row)" target="_blank"> | ||
442 | + <Tooltip transfer="true" content="预览模板" placement="top"> | ||
443 | + <i class="ivu-icon ivu-icon-ios-eye-outline" style="font-size: 16px"></i> | ||
444 | + </Tooltip> | ||
445 | + </a> | ||
446 | + <a class="opt-list-show" @click="handleShare(row.id)"> | ||
447 | + <Tooltip transfer="true" content="分享" placement="top"> | ||
448 | + <i class="ivu-icon ivu-icon-ios-share-alt" style="font-size: 16px"></i> | ||
449 | + </Tooltip> | ||
450 | + </a> | ||
451 | + </template> | ||
452 | + </i-table> | ||
453 | + </div> | ||
454 | + </div> | ||
455 | + <div slot="footer"> | ||
456 | + </div> | ||
457 | + </Modal> | ||
458 | +</div> | ||
459 | +<script> | ||
460 | + var BASE_URL = "${base}" + "${customPrePath}"; | ||
461 | + var currentPage = new Vue({ | ||
462 | + el: '#app', | ||
463 | + data: { | ||
464 | + isCollapsed: false, | ||
465 | + token: '',//token | ||
466 | + name: '', | ||
467 | + designerObj: {}, | ||
468 | + loading: true, | ||
469 | + showEdit: false, | ||
470 | + dataSource: [], | ||
471 | + modalTitle: "", | ||
472 | + page: { //分页参数 | ||
473 | + page: 1, | ||
474 | + size: 10, | ||
475 | + total: 0, | ||
476 | + }, | ||
477 | + changecode: "", | ||
478 | + changename: "", | ||
479 | + menuitem: "datainfo", | ||
480 | + tabpan: "name1", | ||
481 | + userMessage: false, | ||
482 | + file: null, | ||
483 | + uploadHeader: {}, | ||
484 | + actionUrl: "", | ||
485 | + previewModel: "view",//浏览方式 | ||
486 | + listColumns: [ | ||
487 | + <#--{--> | ||
488 | + <#-- title: '背景图',--> | ||
489 | + <#-- align: 'center',--> | ||
490 | + <#-- key: 'thumb',--> | ||
491 | + <#-- width: 150,--> | ||
492 | + <#-- className: 'table-background',--> | ||
493 | + <#-- render: (h, params) => {--> | ||
494 | + <#-- let _img = ""--> | ||
495 | + <#-- if(!params.row.thumb){--> | ||
496 | + <#-- _img = "${base}"+"${customPrePath}"+"/jmreport/desreport_/corelib/jiade.jpg"--> | ||
497 | + <#-- }else{--> | ||
498 | + <#-- if(params.row.thumb.indexOf('http')==0){--> | ||
499 | + <#-- _img = params.row.thumb--> | ||
500 | + <#-- }else{--> | ||
501 | + <#-- _img = "${base}"+"${customPrePath}"+"/jmreport/img/"+params.row.thumb--> | ||
502 | + <#-- }--> | ||
503 | + <#-- }--> | ||
504 | + <#-- if(_img){--> | ||
505 | + <#-- return h('img', {--> | ||
506 | + <#-- attrs: {--> | ||
507 | + <#-- src: _img,--> | ||
508 | + <#-- style: 'width: 100px;height: 39px;vertical-align: middle;'--> | ||
509 | + <#-- },--> | ||
510 | + <#-- })--> | ||
511 | + <#-- }else{--> | ||
512 | + <#-- return h("span", '');--> | ||
513 | + <#-- }--> | ||
514 | + <#-- }--> | ||
515 | + <#--},--> | ||
516 | + { | ||
517 | + title: '报表名称', | ||
518 | + key: 'name', | ||
519 | + align: 'left', | ||
520 | + className: 'table-background' | ||
521 | + }, | ||
522 | + { | ||
523 | + title: '操作', | ||
524 | + width: 240, | ||
525 | + align: 'center', | ||
526 | + slot: 'action', | ||
527 | + className: 'table-background', | ||
528 | + fixed: 'right' | ||
529 | + } | ||
530 | + ],//列表的列 | ||
531 | + | ||
532 | + // 显示设置 | ||
533 | + visibleSetting: false, | ||
534 | + treeNode:{}, | ||
535 | + treeData: [], | ||
536 | + treeTableColumns: [ | ||
537 | + { | ||
538 | + type: 'selection', | ||
539 | + width: 60, | ||
540 | + align: 'center' | ||
541 | + }, | ||
542 | + { | ||
543 | + title: '报表名称', | ||
544 | + key: 'name', | ||
545 | + align: 'left', | ||
546 | + className: 'table-background' | ||
547 | + }, | ||
548 | + { | ||
549 | + title: '报表编码', | ||
550 | + key: 'code', | ||
551 | + align: 'left', | ||
552 | + className: 'table-background' | ||
553 | + }, | ||
554 | + { | ||
555 | + title: '创建时间', | ||
556 | + key: 'createTime', | ||
557 | + align: 'left', | ||
558 | + className: 'table-background' | ||
559 | + }, | ||
560 | + { | ||
561 | + title: '操作', | ||
562 | + width: 120, | ||
563 | + align: 'center', | ||
564 | + slot: 'action', | ||
565 | + className: 'table-background', | ||
566 | + fixed: 'right' | ||
567 | + } | ||
568 | + ] | ||
569 | + | ||
570 | + }, | ||
571 | + computed: { | ||
572 | + menuitemClasses: function () { | ||
573 | + return [ | ||
574 | + 'menu-item', | ||
575 | + this.isCollapsed ? 'collapsed-menu' : '' | ||
576 | + ] | ||
577 | + } | ||
578 | + }, | ||
579 | + mounted: function () { | ||
580 | + this.token = token; | ||
581 | + console.log("list_mount--------------", this.token); | ||
582 | + this.uploadHeader = {"X-Access-Token": this.token}; | ||
583 | + this.actionUrl = BASE_URL + "/jmreport/putFile"; | ||
584 | + this.$nextTick(() => { | ||
585 | + this.dataSource = []; | ||
586 | + this.userInfo(); | ||
587 | + }); | ||
588 | + }, | ||
589 | + methods: { | ||
590 | + handleSizeChange(val) { | ||
591 | + this.page.size = val; | ||
592 | + this.loadData(); | ||
593 | + }, | ||
594 | + handleCurrentChange(val) { | ||
595 | + this.page.page = val; | ||
596 | + this.loadData(); | ||
597 | + }, | ||
598 | + show: function () { | ||
599 | + }, | ||
600 | + //查询用户信息并加载数据 | ||
601 | + userInfo: function () { | ||
602 | + var that = this; | ||
603 | + $http.get({ | ||
604 | + url: api.userInfo, | ||
605 | + data: { | ||
606 | + token: that.token | ||
607 | + }, | ||
608 | + success: (result) => { | ||
609 | + if (result.message != null && result.message != "") { | ||
610 | + if (result.message === "admin") { | ||
611 | + that.userMessage = true; | ||
612 | + } | ||
613 | + } | ||
614 | + that.$nextTick(() => { | ||
615 | + that.loadData(); | ||
616 | + }); | ||
617 | + }, | ||
618 | + error: (err) => { | ||
619 | + that.handleSpinHide(); | ||
620 | + } | ||
621 | + }, that) | ||
622 | + }, | ||
623 | + //加载数据 | ||
624 | + loadData: function (name) { | ||
625 | + var that = this; | ||
626 | + if (name != null && name != "") { | ||
627 | + that.tabpan = name; | ||
628 | + that.page = {page: 1, size: 10, total: 0,}; | ||
629 | + } | ||
630 | + var url = ""; | ||
631 | + that.dataSource = []; | ||
632 | + if (that.tabpan == "name1") { | ||
633 | + url = api.excelQuery | ||
634 | + } else { | ||
635 | + url = api.excelQueryByTemplate | ||
636 | + } | ||
637 | + $http.get({ | ||
638 | + url: url, | ||
639 | + data: { | ||
640 | + pageNo: that.page.page, | ||
641 | + pageSize: that.page.size, | ||
642 | + reportType: that.menuitem, | ||
643 | + name: that.name, | ||
644 | + token: that.token | ||
645 | + }, | ||
646 | + success: (result) => { | ||
647 | + var ls = result.records; | ||
648 | + that.page.total = result.total | ||
649 | + if (ls && ls.length > 0) { | ||
650 | + for (var i = 0; i < ls.length; i++) { | ||
651 | + //预览时设置报表打印宽度 | ||
652 | + let jsonStr = ls[i].jsonStr; | ||
653 | + let width; | ||
654 | + if (jsonStr) { | ||
655 | + jsonStr = JSON.parse(jsonStr); | ||
656 | + width = jsonStr.printElWidth || jsonStr.dataRectWidth || 800; | ||
657 | + ls[i].printWidth = width; | ||
658 | + } | ||
659 | + ls[i].editable = false; | ||
660 | + } | ||
661 | + that.$nextTick(() => { | ||
662 | + that.dataSource = JSON.parse(JSON.stringify(ls)); | ||
663 | + }); | ||
664 | + } | ||
665 | + }, | ||
666 | + error: (err) => { | ||
667 | + that.handleSpinHide(); | ||
668 | + } | ||
669 | + }, that) | ||
670 | + }, | ||
671 | + //新建报表 | ||
672 | + createExcel: function () { | ||
673 | + var that = this; | ||
674 | + $http.post({ | ||
675 | + url: api.saveReport, | ||
676 | + data: {}, | ||
677 | + contentType: 'json', | ||
678 | + success: (result) => { | ||
679 | + window.open(api.index + result.id + "?token=" + this.token + "&menuType=" + this.menuitem); | ||
680 | + } | ||
681 | + }, that) | ||
682 | + }, | ||
683 | + //未使用 | ||
684 | + handleEditConfig: function (item) { | ||
685 | + window.location.href = api.index + item.id + "?token=" + this.token; | ||
686 | + }, | ||
687 | + //删除报表 | ||
688 | + handleDelete: function (item) { | ||
689 | + $http.confirm({ | ||
690 | + title: '删除报表', | ||
691 | + content: '是否确认删除?', | ||
692 | + url: api.deleteReport, | ||
693 | + data: { | ||
694 | + id: item.id, | ||
695 | + token: this.token | ||
696 | + }, | ||
697 | + success: (result) => { | ||
698 | + this.loadData(); | ||
699 | + } | ||
700 | + }, this); | ||
701 | + }, | ||
702 | + //复制模版 | ||
703 | + handleCopy: function (item) { | ||
704 | + $http.confirm({ | ||
705 | + title: '复制报表', | ||
706 | + content: '是否确认复制?', | ||
707 | + url: api.reportCopy, | ||
708 | + method: 'get', | ||
709 | + data: { | ||
710 | + id: item.id, | ||
711 | + token: this.token | ||
712 | + }, | ||
713 | + success: (result) => { | ||
714 | + this.loadData(); | ||
715 | + } | ||
716 | + }, this); | ||
717 | + }, | ||
718 | + handlerViewExcel: function (item) { | ||
719 | + console.log(item) | ||
720 | + }, | ||
721 | + getExcelEditUrl: function (item) { | ||
722 | + return api.index + item.id + "?token=" + this.token; | ||
723 | + }, | ||
724 | + getExcelViewUrl: function (item) { | ||
725 | + return api.view + item.id + "?token=" + this.token; | ||
726 | + }, | ||
727 | + getLabelText1: function (createElement) { | ||
728 | + return createElement('div', | ||
729 | + { | ||
730 | + style: {color: '#fff'} | ||
731 | + }, | ||
732 | + [ | ||
733 | + createElement('Icon', {props: {type: 'ios-checkmark'}}), | ||
734 | + '模板库' | ||
735 | + ] | ||
736 | + ) | ||
737 | + }, | ||
738 | + onMenuSelect: function (name) { | ||
739 | + if (name == 'setting') { | ||
740 | + this.loadTree(); | ||
741 | + this.visibleSetting = true; | ||
742 | + return; | ||
743 | + } | ||
744 | + this.menuitem = name; | ||
745 | + this.page = {page: 1, size: 10, total: 0,}; | ||
746 | + this.dataSource = []; | ||
747 | + this.name = "" | ||
748 | + this.loadData(); | ||
749 | + }, | ||
750 | + //报表设计和模板案例点击事件 | ||
751 | + tabsClick(name) { | ||
752 | + this.name = "" | ||
753 | + this.loadData(name) | ||
754 | + }, | ||
755 | + //回车搜索事件 | ||
756 | + enterSearchClick() { | ||
757 | + this.loadData() | ||
758 | + }, | ||
759 | + //设置取消模版 | ||
760 | + setTemplate: function (item, arg) { | ||
761 | + var content = (arg == 1) ? '是否确认设置为模板?' : '是否确认取消模板?'; | ||
762 | + let title = (arg == 1) ? '收藏报表' : '取消收藏报表' | ||
763 | + $http.confirm({ | ||
764 | + title: title, | ||
765 | + content: content, | ||
766 | + url: api.setTemplate, | ||
767 | + method: 'get', | ||
768 | + data: { | ||
769 | + id: item.id, | ||
770 | + template: arg, | ||
771 | + token: this.token | ||
772 | + }, | ||
773 | + success: (result) => { | ||
774 | + this.loadData(); | ||
775 | + } | ||
776 | + }, this); | ||
777 | + }, | ||
778 | + handleUpload(file) { | ||
779 | + this.file = file; | ||
780 | + return true; | ||
781 | + }, | ||
782 | + handleFormatError(file) { | ||
783 | + this.$Notice.warning({ | ||
784 | + title: '文件格式不正确', | ||
785 | + desc: '文件 ' + file.name + ' 格式不正确,请上传 jpg 或 png 格式的图片。' | ||
786 | + }); | ||
787 | + }, | ||
788 | + handleMaxSize(file) { | ||
789 | + this.$Notice.warning({ | ||
790 | + title: '超出文件大小限制', | ||
791 | + desc: '文件 ' + file.name + ' 太大,不能超过 2M。' | ||
792 | + }); | ||
793 | + }, | ||
794 | + handleSuccess(res) { | ||
795 | + if (res != null) { | ||
796 | + this.$Message.success(res.message); | ||
797 | + this.dataSource.forEach((item, index, array) => { | ||
798 | + if (item.id === res.result.id) { | ||
799 | + item.thumb = res.result.thumb; | ||
800 | + } | ||
801 | + }) | ||
802 | + } | ||
803 | + }, | ||
804 | + handleSpinHide() { | ||
805 | + /* setTimeout(() => { | ||
806 | + this.$Spin.hide(); | ||
807 | + }, 3000);*/ | ||
808 | + }, | ||
809 | + //分享按钮点击事件 | ||
810 | + handleShare(id) { | ||
811 | + $http.get({ | ||
812 | + url: api.queryJurisdiction, | ||
813 | + data: {reportId: id}, | ||
814 | + success: (result) => { | ||
815 | + if (result) { | ||
816 | + if (result.status == '0') { | ||
817 | + let protocol = window.location.protocol; | ||
818 | + let host = window.location.host; | ||
819 | + let url = protocol + "//" + host + base; | ||
820 | + result.previewUrl = url + result.previewUrl; | ||
821 | + this.$refs.jurisdiction.jurisdictionData = result; | ||
822 | + this.$refs.jurisdiction.shareUrlModal = true | ||
823 | + } else { | ||
824 | + this.$refs.jurisdiction.jurisdictionData = result; | ||
825 | + this.$refs.jurisdiction.shareModal = true | ||
826 | + } | ||
827 | + } else { | ||
828 | + this.$refs.jurisdiction.jurisdictionData.reportId = id | ||
829 | + this.$refs.jurisdiction.shareModal = true | ||
830 | + } | ||
831 | + } | ||
832 | + }) | ||
833 | + }, | ||
834 | + // 获取缩略图的预览地址 | ||
835 | + getThumbSrc(item) { | ||
836 | + if (!item.thumb) { | ||
837 | + return "${base}" + "${customPrePath}" + "/jmreport/desreport_/corelib/jiade.jpg" | ||
838 | + } else { | ||
839 | + if (item.thumb.indexOf('http') == 0) { | ||
840 | + return item.thumb | ||
841 | + } else { | ||
842 | + return "${base}" + "${customPrePath}" + "/jmreport/img/" + item.thumb | ||
843 | + } | ||
844 | + } | ||
845 | + }, | ||
846 | + | ||
847 | + loadTree() { | ||
848 | + let that = this; | ||
849 | + //console.log("BASE_URL", window.location.origin); | ||
850 | + $http.get({ | ||
851 | + url: window.location.origin + "/ext/pageconfig/tree", | ||
852 | + data: { | ||
853 | + token: that.token | ||
854 | + }, | ||
855 | + success: (result) => { | ||
856 | + | ||
857 | + let arr = []; | ||
858 | + arr.push(result); | ||
859 | + that.treeData = arr; | ||
860 | + }, | ||
861 | + error: (err) => { | ||
862 | + that.handleSpinHide(); | ||
863 | + } | ||
864 | + }, that) | ||
865 | + }, | ||
866 | + | ||
867 | + onTreeChange(arr) { | ||
868 | + let that = this; | ||
869 | + let reportCode = ''; | ||
870 | + if(arr && arr[0] && arr[0].props){ | ||
871 | + reportCode = arr[0].props.reportCode; | ||
872 | + } | ||
873 | + | ||
874 | + that.dataSource.forEach(function (e,i) { | ||
875 | + if(e.id == reportCode){ | ||
876 | + that.$refs.treeTable.toggleSelect(i); | ||
877 | + } else { | ||
878 | + that.$refs.treeTable.$refs.tbody.objData[i]._isChecked = false | ||
879 | + } | ||
880 | + }); | ||
881 | + | ||
882 | + that.treeNode = arr[0]; | ||
883 | + }, | ||
884 | + | ||
885 | + savePageConfig(){ | ||
886 | + var that = this; | ||
887 | + | ||
888 | + let id = this.treeNode.id | ||
889 | + let code = that.$refs.treeTable.getSelection()[0].id; | ||
890 | + | ||
891 | + $http.get({ | ||
892 | + url: window.location.origin + '/ext/pageconfig/' + id + '/' + code, | ||
893 | + data: {}, | ||
894 | + contentType: 'json', | ||
895 | + success: (result) => { | ||
896 | + that.$Message.success('保存成功!'); | ||
897 | + } | ||
898 | + }, that) | ||
899 | + } | ||
900 | + } | ||
901 | + }) | ||
902 | +</script> | ||
903 | + <#include "./common/tj.ftl"> | ||
904 | +</body> | ||
905 | +</html> |
1 | +<#assign CACHE_VERSION = "v=1.0.38"> | ||
2 | +<!DOCTYPE html> | ||
3 | +<html> | ||
4 | +<head> | ||
5 | + <script> | ||
6 | + let base = "${base}"; | ||
7 | + let baseFull = "${base}" + "${customPrePath}"; | ||
8 | + let pageCode = "${pageCode}"; | ||
9 | + | ||
10 | + /** | ||
11 | + * 获取url参数 | ||
12 | + */ | ||
13 | + function getRequestUrl() { | ||
14 | + var url = location.search; | ||
15 | + var theRequest = new Object(); | ||
16 | + if (url.indexOf("?") != -1) { | ||
17 | + var str = url.substr(1); | ||
18 | + strs = str.split("&"); | ||
19 | + for (var i = 0; i < strs.length; i++) { | ||
20 | + theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]); | ||
21 | + } | ||
22 | + } | ||
23 | + return theRequest; | ||
24 | + } | ||
25 | + | ||
26 | + let token = getRequestUrl().token; | ||
27 | + if (token == "" || token == null) { | ||
28 | + token = window.localStorage.getItem('JmReport-Access-Token'); | ||
29 | + } | ||
30 | + window.localStorage.setItem('JmReport-Access-Token', token); | ||
31 | + </script> | ||
32 | + <meta charset="utf-8"> | ||
33 | + <meta name="viewport" content="width=device-width"> | ||
34 | + <title>在线设计</title> | ||
35 | + <#include "./common/resource.ftl"> | ||
36 | + <link rel="stylesheet" href="${base}${customPrePath}/jmreport/desreport_/corelib/cust.css?${CACHE_VERSION}"> | ||
37 | + <link rel="shortcut icon" href="${base}${customPrePath}/jmreport/desreport_/corelib/logo.png?${CACHE_VERSION}" | ||
38 | + type="image/x-ico"> | ||
39 | +</head> | ||
40 | +<body style="background: #ffffff"> | ||
41 | +<style> | ||
42 | + | ||
43 | + | ||
44 | +</style> | ||
45 | +<!--引入自定义组件--> | ||
46 | +<div id="app" style="padding-left: 30px;height: 100%"> | ||
47 | + <div class="layout" style="margin-left: -30px;margin-top: -10px;;height: 100%;display: flex"> | ||
48 | + <div v-if="dataSource.child && dataSource.child.length > 0" style="width: 200px;height: 100%"> | ||
49 | + <Sider breakpoint="md" collapsible :collapsed-width="78" v-model="isCollapsed"> | ||
50 | + <i-menu theme="primary" width="auto" :class="menuitemClasses" active-name="datainfo" | ||
51 | + :open-names="['sub']" @on-select="onMenuSelect"> | ||
52 | + <Submenu name="sub"> | ||
53 | + <template slot="title"> | ||
54 | + <Icon type="ios-apps"/> | ||
55 | + </Icon> | ||
56 | + {{dataSource.pageName}} | ||
57 | + </template> | ||
58 | + <Menu-Item :name="item.pageCode" v-for="(item,index) in dataSource.child"> | ||
59 | + <span>{{item.pageName}}</span> | ||
60 | + </Menu-Item> | ||
61 | + </Submenu> | ||
62 | + </i-menu> | ||
63 | + <div slot="trigger"></div> | ||
64 | + </Sider> | ||
65 | + </div> | ||
66 | + <div v-if="dataSource.child && dataSource.child.length > 0" style="width: calc(100% - 200px);height: 100%"> | ||
67 | + <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" style="border: none;padding-top: 15px;"></iframe> | ||
68 | + </div> | ||
69 | + <div v-else> | ||
70 | + <iframe id="reportFrame" frameborder="0" width="100%" :height="height" :src="src" style="border: none;padding-top: 15px;"></iframe> | ||
71 | + </div> | ||
72 | + </div> | ||
73 | + | ||
74 | +</div> | ||
75 | +<script> | ||
76 | + var BASE_URL = "${base}" + "${customPrePath}"; | ||
77 | + var currentPage = new Vue({ | ||
78 | + el: '#app', | ||
79 | + data: { | ||
80 | + isCollapsed: false, | ||
81 | + token: '',//token | ||
82 | + src:'', | ||
83 | + height:document.documentElement.clientHeight, | ||
84 | + dataSource: {}, | ||
85 | + }, | ||
86 | + computed: { | ||
87 | + menuitemClasses: function () { | ||
88 | + return [ | ||
89 | + 'menu-item', | ||
90 | + this.isCollapsed ? 'collapsed-menu' : '' | ||
91 | + ] | ||
92 | + } | ||
93 | + }, | ||
94 | + mounted: function () { | ||
95 | + this.token = token; | ||
96 | + this.$nextTick(() => { | ||
97 | + this.loadData(); | ||
98 | + }); | ||
99 | + | ||
100 | + const reportFrame = document.getElementById('reportFrame'); | ||
101 | + const deviceHeight = document.documentElement.clientHeight; | ||
102 | + reportFrame.style.height = Number(deviceHeight) + 'px'; //数字是页面布局高度差 | ||
103 | + }, | ||
104 | + methods: { | ||
105 | + | ||
106 | + //加载数据 | ||
107 | + loadData: function () { | ||
108 | + console.log(pageCode); | ||
109 | + let that = this; | ||
110 | + $http.get({ | ||
111 | + url: window.location.origin + "/ext/pageconfig/detail/" + pageCode, | ||
112 | + data: { | ||
113 | + token: that.token | ||
114 | + }, | ||
115 | + success: (result) => { | ||
116 | + that.dataSource = result; | ||
117 | + let flg = false; | ||
118 | + if (result.reportCode) { | ||
119 | + that.setReportSrc(result.reportCode); | ||
120 | + } else { | ||
121 | + if (result.child) { | ||
122 | + result.child.forEach(function (d) { | ||
123 | + if (d.reportCode && !flg) { | ||
124 | + flg = true; | ||
125 | + that.setReportSrc(d.reportCode); | ||
126 | + } | ||
127 | + }) | ||
128 | + } | ||
129 | + } | ||
130 | + }, | ||
131 | + error: (err) => { | ||
132 | + } | ||
133 | + }, that) | ||
134 | + }, | ||
135 | + | ||
136 | + | ||
137 | + setReportSrc(code) { | ||
138 | + //const reportFrame = document.getElementById('reportFrame'); | ||
139 | + //reportFrame.src = "/jmreport/view/" + code ;//+ "?token=" + that.token; | ||
140 | + this.src = window.location.origin + "/jmreport/view/" + code ; | ||
141 | + }, | ||
142 | + | ||
143 | + onMenuSelect: function (key) { | ||
144 | + let that = this; | ||
145 | + let ds = this.dataSource; | ||
146 | + | ||
147 | + if (ds.pageCode == key) { | ||
148 | + let code = ds.reportCode; | ||
149 | + if (code) { | ||
150 | + that.setReportSrc(code); | ||
151 | + } | ||
152 | + } else { | ||
153 | + if (ds.child) { | ||
154 | + let flg = false; | ||
155 | + ds.child.forEach(function (d) { | ||
156 | + if (d.reportCode && d.pageCode == key && !flg) { | ||
157 | + flg = true; | ||
158 | + that.setReportSrc(d.reportCode); | ||
159 | + } | ||
160 | + }) | ||
161 | + } | ||
162 | + } | ||
163 | + console.log(key); | ||
164 | + } | ||
165 | + } | ||
166 | + }) | ||
167 | +</script> | ||
168 | + <#include "./common/tj.ftl"> | ||
169 | +</body> | ||
170 | +</html> |
-
Please register or login to post a comment