Commit 902e5714 authored by whlviolin's avatar whlviolin

1、修改页面布局,2、增加通用工具子系统四个算法页面

parent c2a9f8df
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--引入jwt--> <!--引入jwt-->
<dependency> <dependency>
<groupId>com.auth0</groupId> <groupId>com.auth0</groupId>
...@@ -49,7 +53,7 @@ ...@@ -49,7 +53,7 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version> <version>8.0.15</version>
<!-- <scope>runtime</scope>--> <!-- <scope>runtime</scope>-->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
...@@ -144,6 +148,15 @@ ...@@ -144,6 +148,15 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>3.1.6</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -7,10 +7,12 @@ import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; ...@@ -7,10 +7,12 @@ import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@SpringBootApplication @SpringBootApplication
@EnableEurekaClient @EnableEurekaClient
@EnableFeignClients
public class ServerApplication { public class ServerApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package cn.ac.iscas.server.controller;
import cn.ac.iscas.server.pojo.AnalysisResult;
import cn.ac.iscas.server.service.analysis.AnalysisResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/")
public class AnalysisResultController {
@Autowired
AnalysisResultService analysisResultService;
@RequestMapping(value = "/createAnalysisResult", method = RequestMethod.GET)
public Result createAnalysisResult(
@RequestParam("userId") String userId,
@RequestParam("type") String type,
@RequestParam("name") String name,
@RequestParam("result") String result
) {
try {
analysisResultService.createAnalysisResult(userId, name,type,result); // 假设DataDao类有一个getAllYear方法来获取年份数据
return new Result(200, "success", true);
}catch (Exception e){
e.printStackTrace();
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",false);
}
}
@RequestMapping(value = "/getAnalysisResult", method = RequestMethod.GET)
public Result getAnalysisResult() throws Exception{
List<AnalysisResult> data = analysisResultService.getAnalysisResult();
if (data != null) {
return new Result(200, "success", data);
} else {
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null);
}
}
}
...@@ -2,13 +2,15 @@ package cn.ac.iscas.server.controller; ...@@ -2,13 +2,15 @@ package cn.ac.iscas.server.controller;
import cn.ac.iscas.server.pojo.Address; import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry; import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import cn.ac.iscas.server.service.data.DataService; import cn.ac.iscas.server.service.data.DataService;
import cn.ac.iscas.server.service.pojo.CSVTableData;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.*;
import java.util.Map;
@CrossOrigin @CrossOrigin
@RestController @RestController
...@@ -40,7 +42,7 @@ public class DataController { ...@@ -40,7 +42,7 @@ public class DataController {
} }
@RequestMapping(value = "/getyears", method = RequestMethod.GET) @RequestMapping(value = "/getyears", method = RequestMethod.GET)
public Result getAllYear() throws Exception{ public Result getAllYear() throws Exception{
List<Integer> data = dataService.getAllYear(); // 假设DataDao类有一个getAllYear方法来获取年份数据 List<Year> data = dataService.getAllYear(); // 假设DataDao类有一个getAllYear方法来获取年份数据
if (data != null) { if (data != null) {
return new Result(200, "success", data); return new Result(200, "success", data);
...@@ -75,6 +77,15 @@ public class DataController { ...@@ -75,6 +77,15 @@ public class DataController {
public Result getallIndex() throws Exception{ public Result getallIndex() throws Exception{
List<Map<String, Object>> data = dataService.getallIndex(); // 假设DataDao类有一个getAllYear方法来获取年份数据 List<Map<String, Object>> data = dataService.getallIndex(); // 假设DataDao类有一个getAllYear方法来获取年份数据
for(int i=0;i<data.size();i++){
Map<String,Object> datamap = data.get(i);
int id = (int)datamap.get("id");
int level = (int)datamap.get("level");
if(level!=3){
dataService.addChild(id);
}
}
if (data != null) { if (data != null) {
return new Result(200, "success", data); return new Result(200, "success", data);
} else { } else {
...@@ -102,16 +113,47 @@ public class DataController { ...@@ -102,16 +113,47 @@ public class DataController {
} }
} }
@RequestMapping(value = "/run", method = RequestMethod.GET) // @RequestMapping(value = "/getCondition", method = RequestMethod.GET)
// public Result createProject(
// @RequestParam("name") String name
// ) {
// try {
// // 假设DataDao类有一个getAllYear方法来获取年份数据
// return new Result(200, "success", true);
// }catch (Exception e){
// e.printStackTrace();
// return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",false);
// }
// }
@RequestMapping(value = "/getCondition", method = RequestMethod.GET)
public Result run( public Result run(
@RequestParam("dataCondition") String dataCondition, @RequestParam("dataCondition") String dataCondition,
@RequestParam("address") List<String> address, @RequestParam("address") String address,
@RequestParam("years") List<String> years @RequestParam("years") String year
) throws Exception{ ) throws Exception{
List<Map<String, Object>> data = dataService.getConditionData(dataCondition, address, years); // 假设DataDao类有一个getAllYear方法来获取年份数据 List<String> dataConditions = JSON.parseArray(dataCondition,String.class);
List<String> addresses = JSON.parseArray(address,String.class);
if (data != null) { List<String> years = JSON.parseArray(year,String.class);
return new Result(200, "success", data); List<Map<String, Object>> dataList = dataService.getConditionData(dataConditions, years, addresses); // 假设DataDao类有一个getAllYear方法来获取年份数据
List<String> keys = new ArrayList<>();
if(dataList.size()>0){
keys.add("时间");
keys.add("区域");
dataConditions.forEach(dataC->{
String key = dataC + "(" +(dataList.get(0).get("unit")) + ")";
keys.add(key);
dataList.forEach(data->{
data.put(key,data.get(dataC));
});
});
}
Map<String, Object> tbdata = new HashMap<String, Object>();
tbdata.put("header",keys);
tbdata.put("data",dataList);
if (dataList != null) {
return new Result(200, "success", tbdata);
} else { } else {
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null); return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null);
} }
......
...@@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus; ...@@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
@CrossOrigin @CrossOrigin
@RestController @RestController
...@@ -19,19 +20,19 @@ public class ProjectController { ...@@ -19,19 +20,19 @@ public class ProjectController {
public Result createProject( public Result createProject(
@RequestParam("fId") String fId, @RequestParam("fId") String fId,
@RequestParam("name") String name @RequestParam("name") String name
) throws Exception{ ) {
boolean isCreate= projectService.createProject(fId, name); // 假设DataDao类有一个getAllYear方法来获取年份数据 try {
projectService.createProject(fId, name); // 假设DataDao类有一个getAllYear方法来获取年份数据
if(isCreate==true){ return new Result(200, "success", true);
return new Result(200, "success", isCreate); }catch (Exception e){
} else { e.printStackTrace();
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null); return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",false);
} }
} }
@RequestMapping(value = "/getProject", method = RequestMethod.GET) @RequestMapping(value = "/getProject", method = RequestMethod.GET)
public Result getProject() throws Exception{ public Result getProject() throws Exception{
List<Project> data = projectService.getProject(); List<Map<String, Object>> data = projectService.getProject();
if (data != null) { if (data != null) {
return new Result(200, "success", data); return new Result(200, "success", data);
......
package cn.ac.iscas.server.dao;
import cn.ac.iscas.server.pojo.AnalysisResult;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AnalysisResultDao {
List<AnalysisResult> getAnalysisResult();
boolean createAnalysisResult(AnalysisResult analysisResult);
}
...@@ -3,6 +3,7 @@ package cn.ac.iscas.server.dao; ...@@ -3,6 +3,7 @@ package cn.ac.iscas.server.dao;
import cn.ac.iscas.server.pojo.Address; import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry; import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
...@@ -23,18 +24,18 @@ public interface DataDao { ...@@ -23,18 +24,18 @@ public interface DataDao {
List<Industry> getAllIndustry(); List<Industry> getAllIndustry();
List<Integer> getAllYear(); List<Year> getAllYear();
List<Map< String, Object >> getAllDataType(); List<Map< String, Object >> getAllDataType();
List<Map< String, Object >> addChild(); List<Map< String, Object >> addChild(int p_id);
List<Map< String, Object >> getDataIndexWithLevel(); List<Map< String, Object >> getDataIndexWithLevel();
List<Map< String, Object >> getallIndex(); List<Map< String, Object >> getallIndex();
List<Map< String, Object >> getData(String name); List<Map< String, Object >> getData(String name);
List<Map< String, Object >> getConditionData(String titles, List<String>years, List<String> address_id); List<Map< String, Object >> getConditionData(List<String> titles_ret, List<String>years, List<String> address_ids);
......
...@@ -5,12 +5,13 @@ import cn.ac.iscas.server.pojo.Project; ...@@ -5,12 +5,13 @@ import cn.ac.iscas.server.pojo.Project;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface ProjectDao { public interface ProjectDao {
List<Project> getProject(); List<Map<String, Object>> getProject();
boolean createProject(Project project); boolean createProject(Project project);
......
package cn.ac.iscas.server.dao;
import cn.ac.iscas.server.pojo.Task;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
@Mapper
public interface TaskDAO {
void insert(Task task);
void update(Task task);
/**
* 任务查询功能,不返回任务的具体代码
* @param size
* @param userId
* @param startTime
* @param endTime
* @param type
* @param status
* @return
*/
List<Task> gets(@Param("size") int size,
@Param("userId") String userId,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("type") String type,
@Param("status") String status);
void delete(Task task);
Task get(@Param("taskId") String taskId);
List<Task> getUnfinishedTasks(String userId);
}
package cn.ac.iscas.server.pojo;
import java.util.Date;
public class AnalysisResult {
public AnalysisResult(String id, String userId, String type, String name, String result, Date create_time) {
this.id = id;
this.userId = userId;
this.type = type;
this.name = name;
this.result =result;
this.create_time = create_time;
}
private String id;
private String userId;
private String type;
private String name;
private String result;
private Date create_time;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
}
package cn.ac.iscas.server.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class Task {
public static String NORMAL = "normal";
public static String PRO = "pro";
public static String VIP = "vip";
public static String CPU = "cpu";
public static String GPU = "gpu";
private String taskId;
private String name;
private String type;
private String userId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.S", timezone = "Asia/Shanghai")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.S", timezone = "Asia/Shanghai")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.S", timezone = "Asia/Shanghai")
private Date finishTime;
private String status;
private String code;
private String project;
private String version;
private String image;
private String info;
private String kind;
private String userType = NORMAL; //用户类型
private String resType = CPU; //资源类型
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public Task() {}
public Task(String taskId, String name, String type, String userId, Date createTime, Date startTime, Date finishTime, String status) {
this.taskId = taskId;
this.name = name;
this.type = type;
this.userId = userId;
this.createTime = createTime;
this.startTime = startTime;
this.finishTime = finishTime;
this.status = status;
}
public Task(String taskId, String name, String type, String userId, Date createTime, Date startTime, Date finishTime, String status, String code, String project, String version, String image, String info, String kind) {
this.taskId = taskId;
this.name = name;
this.type = type;
this.userId = userId;
this.createTime = createTime;
this.startTime = startTime;
this.finishTime = finishTime;
this.status = status;
this.code = code;
this.project = project;
this.version = version;
this.image = image;
this.info = info;
this.kind = kind;
}
public Task(String taskId, String name, String type, String userId, Date createTime, Date startTime, Date finishTime, String status, String code, String project, String version, String image, String info, String kind, String userType, String resType) {
this.taskId = taskId;
this.name = name;
this.type = type;
this.userId = userId;
this.createTime = createTime;
this.startTime = startTime;
this.finishTime = finishTime;
this.status = status;
this.code = code;
this.project = project;
this.version = version;
this.image = image;
this.info = info;
this.kind = kind;
this.userType = userType;
this.resType = resType;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getFinishTime() {
return finishTime;
}
public void setFinishTime(Date finishTime) {
this.finishTime = finishTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getProject() {
return project;
}
public void setProject(String project) {
this.project = project;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
}
package cn.ac.iscas.server.pojo;
public class Year {
public Year(int id, String year) {
this.id = id;
this.year = year;
}
int id;
String year;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
}
package cn.ac.iscas.server.service.analysis;
import cn.ac.iscas.server.pojo.AnalysisResult;
import java.io.IOException;
import java.util.List;
public interface AnalysisResultService {
public List<AnalysisResult> getAnalysisResult() throws IOException;
public void createAnalysisResult(String userId, String name, String type,String result);
}
package cn.ac.iscas.server.service.analysis.impl;
import cn.ac.iscas.server.dao.AnalysisResultDao;
import cn.ac.iscas.server.pojo.AnalysisResult;
import cn.ac.iscas.server.service.analysis.AnalysisResultService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service
public class AnalysisResultServiceImpl implements AnalysisResultService {
@Resource
private AnalysisResultDao alalysisResultDao;
@Override
public List<AnalysisResult> getAnalysisResult() throws IOException {
List<AnalysisResult> alalysisResult= alalysisResultDao.getAnalysisResult();
return alalysisResult;
}
@Override
public void createAnalysisResult(String userId, String name, String type, String result){
AnalysisResult alalysisResult = new AnalysisResult(UUID.randomUUID().toString(), userId, type, name,result, new Date());
alalysisResultDao.createAnalysisResult(alalysisResult);
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.ac.iscas.server.service.data; ...@@ -2,6 +2,7 @@ package cn.ac.iscas.server.service.data;
import cn.ac.iscas.server.pojo.Address; import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry; import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.io.IOException; import java.io.IOException;
...@@ -19,11 +20,11 @@ public interface DataService { ...@@ -19,11 +20,11 @@ public interface DataService {
public List<Address> getAllAddresses() throws IOException; public List<Address> getAllAddresses() throws IOException;
public List<Industry> getAllIndustry()throws IOException; public List<Industry> getAllIndustry()throws IOException;
public List<Integer> getAllYear()throws IOException; public List<Year> getAllYear()throws IOException;
public List<Map<String, Object>> getAllDataType()throws IOException; public List<Map<String, Object>> getAllDataType()throws IOException;
public List<Map<String, Object>> addChild()throws IOException; public List<Map<String, Object>> addChild(@Param("p_id") int p_id)throws IOException;
public List<Map< String, Object >> getDataIndexWithLevel(@Param("p_id") int p_id)throws IOException; public List<Map< String, Object >> getDataIndexWithLevel(@Param("p_id") int p_id)throws IOException;
public List<Map< String, Object >> getallIndex()throws IOException; public List<Map< String, Object >> getallIndex()throws IOException;
public List<Map< String, Object >> getData(@Param("name") String name)throws IOException; public List<Map< String, Object >> getData(@Param("name") String name)throws IOException;
public List<Map< String, Object >> getConditionData(@Param("titles")String titles, @Param("years")List<String>years, @Param("address_id")List<String> address_id)throws IOException; public List<Map< String, Object >> getConditionData(@Param("titles")List<String> titles, @Param("years")List<String>years, @Param("address_id")List<String> address_id)throws IOException;
} }
...@@ -2,11 +2,14 @@ package cn.ac.iscas.server.service.data.impl; ...@@ -2,11 +2,14 @@ package cn.ac.iscas.server.service.data.impl;
import cn.ac.iscas.server.dao.DataDao; import cn.ac.iscas.server.dao.DataDao;
import cn.ac.iscas.server.pojo.Address; import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry; import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import cn.ac.iscas.server.service.data.DataService; import cn.ac.iscas.server.service.data.DataService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -29,8 +32,8 @@ public class DataServiceImpl implements DataService { ...@@ -29,8 +32,8 @@ public class DataServiceImpl implements DataService {
} }
@Override @Override
public List<Integer> getAllYear() throws IOException { public List<Year> getAllYear() throws IOException {
List<Integer> data= dataDao.getAllYear(); List<Year> data= dataDao.getAllYear();
return data; return data;
} }
...@@ -40,11 +43,6 @@ public class DataServiceImpl implements DataService { ...@@ -40,11 +43,6 @@ public class DataServiceImpl implements DataService {
return data; return data;
} }
@Override
public List<Map<String, Object>> addChild() throws IOException {
List<Map<String, Object>> data= dataDao.addChild();
return data;
}
@Override @Override
public List<Map<String, Object>> getDataIndexWithLevel(int p_id) throws IOException { public List<Map<String, Object>> getDataIndexWithLevel(int p_id) throws IOException {
...@@ -52,9 +50,14 @@ public class DataServiceImpl implements DataService { ...@@ -52,9 +50,14 @@ public class DataServiceImpl implements DataService {
return data; return data;
} }
private List<Map<String, Object>> addChildData()throws IOException{
List<Map<String, Object>> data = this.addChild(-1);
return data;
}
@Override @Override
public List<Map<String, Object>> getallIndex() throws IOException { public List<Map<String, Object>> getallIndex() throws IOException {
List<Map<String, Object>> data= dataDao.getallIndex(); List<Map<String, Object>> data= this.addChildData();
return data; return data;
} }
...@@ -65,8 +68,23 @@ public class DataServiceImpl implements DataService { ...@@ -65,8 +68,23 @@ public class DataServiceImpl implements DataService {
} }
@Override @Override
public List<Map<String, Object>> getConditionData(String titles, List<String> years, List<String> address_ids) throws IOException { public List<Map<String, Object>> getConditionData(List<String> titles, List<String> years, List<String> address_ids) throws IOException {
List<Map<String, Object>> data= dataDao.getConditionData(titles, years, address_ids); List<Map<String, Object>> data= dataDao.getConditionData(titles, years, address_ids);
return data; return data;
} }
@Override
public List<Map<String, Object>> addChild(@Param("p_id") int p_id) throws IOException {
List<Map<String, Object>> data= dataDao.addChild(p_id);
for(int i=0;i<data.size();i++){
Map<String,Object> datamap = data.get(i);
int id = (int)datamap.get("id");
int level = (int)datamap.get("level");
if(level!=3){
List<Map<String, Object>> child= this.addChild(id);
data.get(i).put("children",child);
}
}
return data;
}
} }
\ No newline at end of file
...@@ -4,10 +4,11 @@ import cn.ac.iscas.server.pojo.Project; ...@@ -4,10 +4,11 @@ import cn.ac.iscas.server.pojo.Project;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
public interface ProjectService { public interface ProjectService {
public List<Project> getProject() throws IOException; public List<Map<String, Object>> getProject() throws IOException;
public boolean createProject(String fId, String name)throws IOException; public void createProject(String fId, String name);
} }
...@@ -9,6 +9,7 @@ import javax.annotation.Resource; ...@@ -9,6 +9,7 @@ import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
@Service @Service
...@@ -17,17 +18,15 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -17,17 +18,15 @@ public class ProjectServiceImpl implements ProjectService {
private ProjectDao projectDao; private ProjectDao projectDao;
@Override @Override
public List<Project> getProject() throws IOException { public List<Map<String, Object>> getProject() throws IOException {
List<Project> project= projectDao.getProject(); List<Map<String, Object>> project= projectDao.getProject();
return project; return project;
} }
@Override @Override
public boolean createProject(String fId, String name) throws IOException { public void createProject(String fId, String name){
Project project = new Project(UUID.randomUUID().toString(), fId, name, new Date()); Project project = new Project(UUID.randomUUID().toString(), fId, name, new Date());
projectDao.createProject(project);
boolean isInsert= projectDao.createProject(project);
return isInsert;
} }
} }
\ No newline at end of file
...@@ -4,10 +4,7 @@ import cn.ac.iscas.server.service.pojo.CSVTableData; ...@@ -4,10 +4,7 @@ import cn.ac.iscas.server.service.pojo.CSVTableData;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.BufferedReader; import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -24,7 +21,7 @@ public class ReadFileUtil { ...@@ -24,7 +21,7 @@ public class ReadFileUtil {
}else{ }else{
fileType = "csv"; fileType = "csv";
} }
String fullName = path +"." + fileType; String fullName = path + "." + fileType;
try { try {
// 构建FileInputStream对象 // 构建FileInputStream对象
FileInputStream fip = new FileInputStream(fullName); FileInputStream fip = new FileInputStream(fullName);
......
...@@ -62,3 +62,5 @@ eureka.client.serviceUrl.defaultZone = http://127.0.0.1:9090/eureka ...@@ -62,3 +62,5 @@ eureka.client.serviceUrl.defaultZone = http://127.0.0.1:9090/eureka
eureka.instance.prefer-ip-address = true eureka.instance.prefer-ip-address = true
spring.mvc.pathmatch.matching-strategy=ant_path_matcher spring.mvc.pathmatch.matching-strategy=ant_path_matcher
server.max-http-header-size=102400
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ac.iscas.server.dao.AnalysisResultDao">
<select id="getAnalysisResult" resultType="AnalysisResult">
select * from analysis_result
</select>
<insert id="createAnalysisResult" parameterType="AnalysisResult" >
insert into analysis_result(id, name, type, result, userId,create_time)
values(#{id}, #{name}, #{type}, #{result}, #{userId}, #{create_time} )
</insert>
</mapper>
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
select id, name from industry select id, name from industry
</select> </select>
<select id="getAllYear" resultType="Integer"> <select id="getAllYear" resultType="Year">
select * from year order by year DESC select * from year order by year DESC
</select> </select>
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
</select> </select>
<select id="addChild" parameterType="int" resultType="Map"> <select id="addChild" parameterType="int" resultType="Map">
select id , name, p_id, level from data where p_id = #{p_id} and level!=3 group by name select id , name, p_id, level from data where p_id = #{p_id} group by name
</select> </select>
<select id="getallIndex" resultType="Map"> <select id="getallIndex" resultType="Map">
select id , name, p_id, level from data where p_id = -1 and level!=3 group by name select id , name, p_id, level from data where p_id = -1 group by name
</select> </select>
<select id="getData" parameterType="string" resultType="Map"> <select id="getData" parameterType="string" resultType="Map">
...@@ -41,19 +41,38 @@ ...@@ -41,19 +41,38 @@
where name = #{name} where name = #{name}
</select> </select>
<select id="getConditionData" parameterType="string" resultType="Map"> <select id="getConditionData" resultType="Map">
select year as '时间', address as '区域',
<foreach collection="titles_ret" item="title" index="index" separator=",">
MAX(CASE name WHEN #{title} THEN value END) AS #{title}
</foreach>
,unit
from (
select d.id , d.name, d.value, d.unit, a.address, y.year select d.id , d.name, d.value, d.unit, a.address, y.year
from data d from data d
left join year y on y.id = d.year_id left join year y on y.id = d.year_id
left join address a on a.id = d.address_id left join address a on a.id = d.address_id
where name in (#{titles_ret}) where d.name in
<if test="years!=null and years.length>0"> <foreach collection="titles_ret" item="title" index="index" open="(" close=")" separator=",">
and year_id in (#{years}) #{title}
</foreach>
<if test="years!=null and years.size>0">
and d.year_id in
<foreach collection="years" item="year" index="index" open="(" close=")" separator=",">
#{year}
</foreach>
</if> </if>
<if test="address_ids!=null and address_ids.length>0>0"> <if test="address_ids!=null and address_ids.size>0">
and address_id in (#{address_ids}) and d.address_id in
<foreach collection="address_ids" item="address_id" index="index" open="(" close=")" separator=",">
#{address_id}
</foreach>
</if> </if>
)
as tb
GROUP BY year;
</select> </select>
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
from file_list from file_list
</select> </select>
<select id="insertFileList" parameterType="FileList" > <insert id="insertFileList" parameterType="FileList" >
insert into file_list(id, name, type, path, create_time, update_time, is_dir) insert into file_list(id, name, type, path, create_time, update_time, is_dir)
values(#{id}, #{name}, #{type}, #{path}, #{create_time}, #{update_time}, #{is_dir} ) values(#{id}, #{name}, #{type}, #{path}, #{create_time}, #{update_time}, #{is_dir} )
</select> </insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
<mapper namespace="cn.ac.iscas.server.dao.ProjectDao"> <mapper namespace="cn.ac.iscas.server.dao.ProjectDao">
<select id="getProject" resultType="Project"> <select id="getProject" resultType="Map">
select p.id, p.name, p.fId, DATE_FORMAT(p.update_time,"%Y-%m-%d %H:%i:%s") as updateTime, f.name as fileName, f.type as type from project p select p.id, p.name, p.fId, DATE_FORMAT(p.update_time,"%Y-%m-%d %H:%i:%s") as updateTime, f.name as fileName, f.type as type from project p
inner join file_list f on p.fId = f.id inner join file_list f on p.fId = f.id
</select> </select>
<select id="createProject" parameterType="Project" > <insert id="createProject" parameterType="Project" >
insert into project(id, name, fId, update_time) insert into project(id, name, fId, update_time)
values(#{id}, #{name}, #{fId}, #{update_time} ) values(#{id}, #{name}, #{fId}, #{update_time} )
</select> </insert>
</mapper> </mapper>
\ No newline at end of file
/**
* @author https://vue-admin-beautiful.com (不想保留author可删除)
* @description .eslintrc.js
*/
module.exports = { module.exports = {
root: true, "env": {
env: { "browser": true,
node: true, "es2021": true
}, },
extends: ['plugin:vue/recommended', '@vue/prettier'], "extends": "eslint:recommended",
rules: { "overrides": [
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-v-html': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-useless-template-attributes': 'off',
'vue/no-reserved-component-names': 'off',
},
parserOptions: {
parser: 'babel-eslint',
},
overrides: [
{ {
files: [ "env": {
'**/__tests__/*.{j,t}s?(x)', "node": true
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
}, },
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
], ],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
} }
...@@ -74,10 +74,10 @@ module.exports = [ ...@@ -74,10 +74,10 @@ module.exports = [
data: { data: {
permissions, permissions,
username, username,
'avatar|1': [ // 'avatar|1': [
'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif', // 'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif',
'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif', // 'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
], // ],
}, },
} }
}, },
......
...@@ -13,14 +13,14 @@ export function getIndustry() { ...@@ -13,14 +13,14 @@ export function getIndustry() {
url: 'http://localhost:5000/getindustry', url: 'http://localhost:5000/getindustry',
method: 'get', method: 'get',
}) })
} }
export function getAddress() { export function getAddress() {
return request({ return request({
url: 'http://localhost:5000/getaddrs', url: 'http://localhost:5000/getaddrs',
method: 'get', method: 'get',
}) })
} }
export function detDataTitle() { export function detDataTitle() {
...@@ -30,15 +30,15 @@ export function detDataTitle() { ...@@ -30,15 +30,15 @@ export function detDataTitle() {
}) })
} }
export function run(condition) { export function getCondition(params) {
return request({ return request({
url: 'http://localhost:5000/run', url: "http://localhost:5000/getCondition",
method: 'post', method: 'get',
data: condition params
}) })
} }
export function getTree() { export function getTree() {
return request({ return request({
url: "http://localhost:5000/getallIndex", url: "http://localhost:5000/getallIndex",
...@@ -123,6 +123,23 @@ export function createProject(params) { ...@@ -123,6 +123,23 @@ export function createProject(params) {
}) })
} }
export function getAnalysisResult() {
return request({
url: "http://localhost:5000/getAnalysisResult",
method: 'get'
})
}
export function createAnalysisResult(params) {
return request({
url: "http://localhost:5000/createAnalysisResult",
method: 'get',
params
})
}
export function login(params) { export function login(params) {
return request({ return request({
url: "http://localhost:9091/AuthenticationManager/oauth/token", url: "http://localhost:9091/AuthenticationManager/oauth/token",
...@@ -137,3 +154,37 @@ export function getData(params) { ...@@ -137,3 +154,37 @@ export function getData(params) {
params params
}) })
} }
export function getAHPList(params) {
return request({
url: "http://localhost:8001/getAHPList",
method: 'get',
params
})
}
export function getTOPSISList(params) {
return request({
url: "http://localhost:8001/getTOPSISList",
method: 'get',
params
})
}
export function getRSRList(params) {
return request({
url: "http://localhost:8001/getRSRList",
method: 'get',
params
})
}
export function getDEAList(params) {
return request({
url: "http://localhost:8001/getDEAList",
method: 'get',
params
})
}
<template> <template>
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<span class="avatar-dropdown"> <span class="avatar-dropdown">
<img class="user-avatar" :src="avatar" alt="" /> <!-- <img class="user-avatar" :src="avatar" alt="" />-->
<div class="user-name"> <div class="user-name">
{{ username }} {{ username }}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
......
...@@ -16,8 +16,6 @@ if (process.env.NODE_ENV === 'production') { ...@@ -16,8 +16,6 @@ if (process.env.NODE_ENV === 'production') {
Vue.config.productionTip = false Vue.config.productionTip = false
new Vue({ new Vue({
el: '#vue-admin-beautiful', el: '#vue-admin-beautiful',
router, router,
......
...@@ -8,6 +8,7 @@ import VueRouter from 'vue-router' ...@@ -8,6 +8,7 @@ import VueRouter from 'vue-router'
import Layout from '@/layouts' import Layout from '@/layouts'
import EmptyLayout from '@/layouts/EmptyLayout' import EmptyLayout from '@/layouts/EmptyLayout'
import { publicPath, routerMode } from '@/config' import { publicPath, routerMode } from '@/config'
import {size} from "lodash/collection";
Vue.use(VueRouter) Vue.use(VueRouter)
export const constantRoutes = [ export const constantRoutes = [
...@@ -47,7 +48,8 @@ export const asyncRoutes = [ ...@@ -47,7 +48,8 @@ export const asyncRoutes = [
component: () => import('@/views/index/index'), component: () => import('@/views/index/index'),
meta: { meta: {
title: '首页', title: '首页',
icon: 'home' icon: 'home',
}, },
}, },
], ],
...@@ -57,7 +59,7 @@ export const asyncRoutes = [ ...@@ -57,7 +59,7 @@ export const asyncRoutes = [
component: Layout, component: Layout,
name: 'myData', name: 'myData',
redirect: '/myData', redirect: '/myData',
meta: { title: '通用工具子系统', icon: 'box-open' }, meta: { title: '通用工具子系统', icon: 'box-open',},
children: [ children: [
{ {
path: '/myData', path: '/myData',
...@@ -65,7 +67,9 @@ export const asyncRoutes = [ ...@@ -65,7 +67,9 @@ export const asyncRoutes = [
component: () => import('@/views/myData'), component: () => import('@/views/myData'),
meta: { meta: {
title: '数据查询', title: '数据查询',
icon: 'hockey-puck' icon: 'hockey-puck',
width:'60px',
}, },
}, },
{ {
...@@ -134,16 +138,16 @@ export const asyncRoutes = [ ...@@ -134,16 +138,16 @@ export const asyncRoutes = [
{ {
path: '/data1', path: '/generalTool',
component: Layout, component: Layout,
name: 'data1', name: 'generalTool',
redirect: '/data1', redirect: '/generalTool',
meta: { title: '数据可视化分析', icon: 'box-open' }, meta: { title: '通用工具子系统', icon: 'box-open' },
children: [ children: [
{ {
path: '/data1', path: '/generalTool',
name: 'data1', name: 'generalTool',
component: () => import('@/views/data'), component: () => import('@/views/generalTool'),
meta: { meta: {
title: '通用工具子系统', title: '通用工具子系统',
icon: 'hand-middle-finger', icon: 'hand-middle-finger',
...@@ -153,7 +157,7 @@ export const asyncRoutes = [ ...@@ -153,7 +157,7 @@ export const asyncRoutes = [
path: 'analysis', path: 'analysis',
name: 'analysis', name: 'analysis',
hidden: true, hidden: true,
component: () => import('@/views/data/components/analysis'), component: () => import('@/views/generalTool/components/analysis'),
meta: { meta: {
title: '数据' title: '数据'
}, },
......
...@@ -10,7 +10,7 @@ $base-color-default: #eb8d00; ...@@ -10,7 +10,7 @@ $base-color-default: #eb8d00;
$base-z-index: 999; $base-z-index: 999;
//横向布局纵向布局时菜单背景色 //横向布局纵向布局时菜单背景色
// $base-menu-background: #252525; // $base-menu-background: #252525;
$base-menu-background: #2aa0bb; $base-menu-background: #0078D4;
//菜单文字颜色 //菜单文字颜色
$base-menu-color: hsla(0, 0%, 91%, 0.95); $base-menu-color: hsla(0, 0%, 91%, 0.95);
//菜单选中文字颜色 //菜单选中文字颜色
......
...@@ -82,7 +82,7 @@ export function getOption2(res) { ...@@ -82,7 +82,7 @@ export function getOption2(res) {
let col = [] let col = []
let leg = [] let leg = []
let header = res['header']//["决策单元",'技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)'] let header = res['header']//["决策单元",'技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)']
let data = res['data'] let data = res['value']
for(let i in header){ for(let i in header){
console.log(header[i]) console.log(header[i])
let litem = header[i] let litem = header[i]
...@@ -90,7 +90,7 @@ export function getOption2(res) { ...@@ -90,7 +90,7 @@ export function getOption2(res) {
for (let j in data) { for (let j in data) {
let ditem = data[j] let ditem = data[j]
let value = ditem[litem] let value = ditem[litem]
if(litem == "决策单元") { if(litem == "index") {
col.push(value) col.push(value)
continue; continue;
} }
...@@ -99,12 +99,15 @@ export function getOption2(res) { ...@@ -99,12 +99,15 @@ export function getOption2(res) {
} }
datalist.push(value) datalist.push(value)
} }
if(litem != "决策单元" && litem != "有效性") { if(litem != "决策单元" && litem != "有效性"&& litem != "index") {
leg.push(litem) leg.push(litem)
let obj = { let obj = {
name: litem, name: litem,
type: 'line', type: 'line',
data: datalist data: datalist,
symbol: 'none',
} }
seriesList.push(obj) seriesList.push(obj)
} }
...@@ -114,22 +117,41 @@ export function getOption2(res) { ...@@ -114,22 +117,41 @@ export function getOption2(res) {
console.log(seriesList) console.log(seriesList)
let option = { let option = {
title: { title: {
text: '效益有效性分析' text: ''
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis',
position: function (pt) {
return [pt[0], '20%'];
},
valueFormatter: (value) => parseFloat(value).toFixed(Number(3))
}, },
legend: { legend: {
data:leg data:leg
}, },
dataZoom: [
{
type: 'inside',
start: 0,
end: 100
},
{
start: 0,
end: 100
}
],
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
bottom: '3%', // bottom: '3%',
containLabel: true containLabel: true
}, },
toolbox: { toolbox: {
feature: { feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {} saveAsImage: {}
} }
}, },
...@@ -139,9 +161,51 @@ export function getOption2(res) { ...@@ -139,9 +161,51 @@ export function getOption2(res) {
data: col data: col
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
min:"dataMin",
max:"dataMax",
boundaryGap: [0, '100%']
}, },
series: seriesList series: seriesList
}; };
return option; return option;
} }
export function getOptionByDEA(res) {
let resdata = res['value']
let data =[]
for(let i in resdata){
let value = []
value.push(resdata[i]['投入'])
value.push(resdata[i]['产出'])
value.push(resdata[i]['决策单元'])
data.push(value)
}
let option = {
xAxis: {},
yAxis: {},
tooltip: {
trigger: 'axis'
},
series: [
{
symbolSize: 20,
data: data,
itemStyle: {
normal: {
label: {
position: [25, 9],
show: true,
formatter: function (params) {
return params.value[2]
}
}
}
},
type: 'scatter'
}
]
};
return option;
}
...@@ -78,7 +78,7 @@ instance.interceptors.request.use( ...@@ -78,7 +78,7 @@ instance.interceptors.request.use(
instance.interceptors.response.use( instance.interceptors.response.use(
(response) => { (response) => {
debugger; // debugger;
if (loadingInstance) loadingInstance.close() if (loadingInstance) loadingInstance.close()
const { data, config } = response const { data, config } = response
......
This diff is collapsed.
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getyear, getAddress, detDataTitle, getIndustry, run, getTree } from '@/api/data' import { getyear, getAddress, detDataTitle, getIndustry, getCondition, getTree } from '@/api/data'
import { getOption } from "@/utils/echartsUtil" import { getOption } from "@/utils/echartsUtil"
import VabChart from '@/plugins/echarts' import VabChart from '@/plugins/echarts'
export default { export default {
...@@ -417,7 +417,7 @@ ...@@ -417,7 +417,7 @@
}, },
showDate() { showDate() {
// this.resultData = false; // this.resultData = false;
run(this.params).then(res => { getCondition(this.params).then(res => {
this.resultData = true; this.resultData = true;
console.log(res) console.log(res)
this.tableHeader = res.data.header; this.tableHeader = res.data.header;
......
This diff is collapsed.
<template>
<div style="height:100%;width:100%">
<div style="height: 100%;position:relative;" >
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600;border-bottom:1px solid #e3e3e3">
<span style="margin-left:30px">{{algoName}}</span>
</div>
<div v-if="loading" style="position: absolute; top: 41px; right:0px; left:0px; bottom:0px;overflow: scroll;">
<div style="padding-bottom: 100px;">
<div style="width: 100%; height:100px;margin:10px 50px;">
<span style="font-weight:600;font-size:16px">算法结果描述</span>
</div>
<div class="dynamicComp">
<div v-for="(item,idx) in compDataList">
<!-- <component :is="item.type"></component>-->
<div style="margin:50px;">
<div style="margin:15px">
<span style="font-weight:600;font-size:18px">{{item.name}}</span>
</div>
<el-table
border
height="100%"
:data=item.value
:style="{'width': '100%'}">
<template v-for="item1 in item.header">
<el-table-column
:prop="item1"
align="center"
:label="item1"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { getOption2 } from "@/utils/echartsUtil"
import * as echarts from 'echarts';
import VabChart from '@/plugins/echarts'
import Vue from 'vue'
//引入echarts
export default {
name: 'res3',
props: {
algoName: {
},
algoRes: {
},
algoAllHeader:{
}
},
components: {
VabChart
},
data() {
return {
compDataList:[],
fwl: {},
tableHeader: [],
tableData: [],
tableHeader1: [],
tableData1: [],
loading: false,
}
},
mounted() {
this.initData();
},
methods: {
initData() {
this.tableData = [];
this.tableHeader = []
console.log(this.algoRes)
let data = JSON.parse(this.algoRes)
let newHeader = ['指标', ...this.algoAllHeader]
this.loading = true;
for(let i in data){
let item = data[i]
let header = Object.keys(item.value)
if(item.name == '输出结果1:指标指数'){
item['header'] = newHeader
let data1 = this.arraysToJsonObjectArray(newHeader,item.value)
item['value'] = data1
this.compDataList.push(item)
}else if(item.name == '输出结果2:AHP层次分析结果'){
let value = item.value
let data =this.AHPResultToJsonObject(value)
item['header'] = ['项', ...header]
item['value'] = data
this.compDataList.push(item)
}else if(item.name == '输出结果3:一致性检验结果'){
item['header'] = Object.keys(item.value)
let obj = item.value
let rows = [];
for (let key in obj) {
let value = obj[key];
if(value==true)
value = '通过'
else if(value==false)
value = '不通过'
obj[key]=value
}
rows.push(obj)
item['value'] = rows
this.compDataList.push(item)
}
Vue.filter('formate',(value)=>{
if (value) return '通过'
return value = '不通过'
})
console.log(item)
}
},
resultToJsonObjectArray(keys, values) {
let rows = [];
let item = values[keys[1]]
for (let j = 0; j < Object.keys(item).length; j++) {
let key = Object.keys(item)[j]
let row = {}
for (let i = 0; i < keys.length; i++) {
if(i==0){
row[keys[i]] = key
}else{
let key1 = keys[i];
let value = values[key1][key];
row[key1] =value
}
}
rows.push(row)
}
return rows;
},
arraysToJsonObjectArray(keys, values) {
let rows = [];
for (let i = 0; i < values.length; i++) {
let item = values[i]
let row = {}
for (var j = 0; j <= item.length; j++) {
// 在每次迭代中,将 i 的值累加到 sum 中
if(j==0){
row[keys[j]] = keys[i+1]
}else{
let key = keys[j];
let value = item[j-1];
row[key] =value
}
}
rows.push(row)
}
return rows;
},
AHPResultToJsonObject(data) {
let index = data['项']
let ci =data['CI值']
let max = data['最大特征根']
let weightValue = data['权重值']
let featureVector = data['特征向量']
let rows = [];
for (let i = 0; i < weightValue.length; i++) {
let row = {}
let value = weightValue[i];
row['项'] = this.algoAllHeader[i];
row['权重值'] = value;
row['特征向量'] = featureVector[i];
row['CI值'] = ci
row['最大特征根'] = max
rows.push(row)
}
return rows;
}
}
}
</script>
<style scoped>
</style>
<template>
<div style="height:100%;width:100%">
<div style="height: 100%;position:relative;" >
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600;border-bottom:1px solid #e3e3e3">
<span style="margin-left:30px">{{algoName}}</span>
</div>
<div v-if="loading" style="position: absolute; top: 41px; right:0px; left:0px; bottom:0px;overflow: scroll;">
<div style="padding-bottom: 100px;">
<div style="width: 100%; height:80px;margin:10px 30px;">
<span style="font-weight:600;font-size:14px">算法结果描述</span>
</div>
<div class="dynamicComp">
<div v-for="(item,idx) in compDataList">
<!-- <component :is="item.type"></component>-->
<div style="margin:30px">
<span style="font-weight:600;font-size:14px">{{item.name}}</span>
</div>
<div v-if="item.name=='输出结果2:效益有效性分析'">
<div style="margin:50px; height:600px; display: flex;flex-direction: column; align-content: center;justify-content: center; align-items: center;">
<vab-chart autoresize :options="fwl" :style="{'width': '80%', 'height':'80%'}" />
</div>
</div>
<div v-else-if="item.name=='输出结果4:象限分析'">
<div style="margin:50px; height:600px; display: flex;flex-direction: column; align-content: center;justify-content: center; align-items: center;">
<vab-chart autoresize :options="quadrant" :style="{'width': '80%', 'height':'80%'}" />
</div>
</div>
<div v-else>
<el-table
border
height="100%"
:data=decimalNumberPrecision(item.header,item.value)
:style="{'width': '100%','margin':'30px'}">
<template v-for="item1 in item.header">
<el-table-column
:prop="item1"
align="center"
:label="item1"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
<div style="margin:15px">
<div style="font-weight:600;font-size: 14px;margin:10px 15px;">图表说明:</div>
<div style="white-space: pre-wrap;font-size: 14px;margin:10px 15px;">{{item.text}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import {getOption2, getOptionByDEA} from "@/utils/echartsUtil"
import * as echarts from 'echarts';
import VabChart from '@/plugins/echarts'
import {forEach} from "lodash/fp/_util";
//引入echarts
export default {
name: 'res1',
props: {
algoName: {
},
algoRes: {
}
},
components: {
VabChart
},
data() {
return {
compDataList:[],
fwl: {},
quadrant:{},
loading: false,
}
},
mounted() {
this.initData();
},
methods: {
initData() {
let data=JSON.parse(this.algoRes)
console.log(this.algoRes)
this.loading = true;
let newHeader=[]
for(let i in data) {
let item = data[i]
let header = Object.keys(item.value)
if(item.name.indexOf('输出结果3:规模报酬分析') >= 0)
newHeader = ['项', ...header]
else
newHeader = ['决策单元', ...header]
let data1 =this.resultToJsonObjectArray(newHeader, item.value)
item['header'] = newHeader
item['value'] = data1
this.compDataList.push(item)
if(item.name.indexOf('效益有效性分析') >= 0){
this.fwl =getOption2(item)
}
if(item.name.indexOf('输出结果5:象限分析输出汇总') >= 0){
this.quadrant =getOptionByDEA(item)
}
}
},
decimalNumberPrecision(headers, datas){
datas.forEach(function(data) {
headers.forEach(function (header) {
let value = data[header];
if (typeof value === 'number')
data[header] = value.toFixed(3)
});
});
return datas
},
resultToJsonObjectArray(keys, values) {
let rows = [];
let item = values[keys[1]]
for (let j = 0; j < Object.keys(item).length; j++) {
let key = Object.keys(item)[j]
let row = {}
for (let i = 0; i < keys.length; i++) {
if(i==0){
row[keys[i]] = key
}else{
let key1 = keys[i];
let value = values[key1][key];
row[key1] =value
}
}
rows.push(row)
}
return rows;
},
}
}
</script>
<style scoped>
</style>
<template>
<div style="height:100%;width:100%">
<div style="height: 100%;position:relative;" >
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600;border-bottom:1px solid #e3e3e3">
<span style="margin-left:30px">{{algoName}}</span>
</div>
<div v-if="loading" style="position: absolute; top: 41px; right:0px; left:0px; bottom:0px;overflow: scroll;">
<div style="padding-bottom: 100px;">
<div style="width: 100%; height:100px;margin:10px 50px;">
<span style="font-weight:600;font-size:16px">算法结果描述</span>
</div>
<div class="dynamicComp">
<div v-for="(item,idx) in compDataList">
<!-- <component :is="item.type"></component>-->
<div style="margin:50px;">
<div style="margin:15px">
<span style="font-weight:600;font-size:18px">{{item.name}}</span>
</div>
<el-table
border
height="100%"
:data=item.value
:style="{'width': '100%'}">
<template v-for="item1 in item.header">
<el-table-column
:prop="item1"
align="center"
:label="item1"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { getOption2 } from "@/utils/echartsUtil"
import * as echarts from 'echarts';
import VabChart from '@/plugins/echarts'
import Vue from 'vue'
//引入echarts
export default {
name: 'res4',
props: {
algoName: {
},
algoRes: {
},
algoAllHeader:{
}
},
components: {
VabChart
},
data() {
return {
compDataList:[],
loading: false,
}
},
mounted() {
this.initData();
},
methods: {
initData() {
console.log(this.algoRes)
let data = JSON.parse(this.algoRes)
let newHeader = []
this.loading = true;
for(let i in data){
let item = data[i]
if(item.name.indexOf('评价')>=0){
let header = Object.keys(item.value)
newHeader = ['索引值', ...header]
}else{
let header = Object.keys(item.value)//[Object.keys(item.value)[0]]
newHeader = ['项', ...header]
}
item['header'] = newHeader
let data1 = this.TOPResultToJsonObjectArray(newHeader,item.value)
item['value'] = data1
this.compDataList.push(item)
console.log(item)
}
},
TOPResultToJsonObjectArray(keys, values) {
let rows = [];
let item = values[keys[1]]
for (let j = 0; j < Object.keys(item).length; j++) {
let key = Object.keys(item)[j]
let row = {}
for (let i = 0; i < keys.length; i++) {
if(i==0){
row[keys[i]] = key
}else{
let key1 = keys[i];
let value = values[key1][key];
row[key1] =value
}
}
rows.push(row)
}
return rows;
},
}
}
</script>
<style scoped>
</style>
<template>
<div style="height:100%;width:100%">
<div style="height: 100%;position:relative;" >
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600;border-bottom:1px solid #e3e3e3">
<span style="margin-left:30px">{{algoName}}</span>
</div>
<div v-if="loading" style="position: absolute; top: 41px; right:0px; left:0px; bottom:0px;overflow: scroll;">
<div style="padding-bottom: 100px;">
<div style="width: 100%; height:100px;margin:10px 50px;">
<span style="font-weight:600;font-size:16px">算法结果描述</span>
</div>
<div class="dynamicComp">
<div v-for="(item,idx) in compDataList">
<!-- <component :is="item.type"></component>-->
<div style="margin:50px;">
<div style="margin:15px">
<span style="font-weight:600;font-size:18px">{{item.name}}</span>
</div>
<el-table
border
height="100%"
:data=item.value
:style="{'width': '100%'}">
<template v-for="item1 in item.header">
<el-table-column
:prop="item1"
align="center"
:label="item1"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { getOption2 } from "@/utils/echartsUtil"
import * as echarts from 'echarts';
import VabChart from '@/plugins/echarts'
import Vue from 'vue'
//引入echarts
export default {
name: 'res4',
props: {
algoName: {
},
algoRes: {
},
algoAllHeader:{
}
},
components: {
VabChart
},
data() {
return {
compDataList:[],
loading: false,
}
},
mounted() {
this.initData();
},
methods: {
initData() {
console.log(this.algoRes)
let data = JSON.parse(this.algoRes)
let newHeader = []
this.loading = true;
for(let i in data){
let item = data[i]
if(item.name.indexOf('评价')>=0){
let header = Object.keys(item.value)
newHeader = ['索引值', ...header]
}else{
let header = Object.keys(item.value)//[Object.keys(item.value)[0]]
newHeader = ['项', ...header]
}
item['header'] = newHeader
let data1 = this.TOPResultToJsonObjectArray(newHeader,item.value)
item['value'] = data1
this.compDataList.push(item)
console.log(item)
}
},
TOPResultToJsonObjectArray(keys, values) {
let rows = [];
let item = values[keys[1]]
for (let j = 0; j < Object.keys(item).length; j++) {
let key = Object.keys(item)[j]
let row = {}
for (let i = 0; i < keys.length; i++) {
if(i==0){
row[keys[i]] = key
}else{
let key1 = keys[i];
let value = values[key1][key];
row[key1] =value
}
}
rows.push(row)
}
return rows;
},
}
}
</script>
<style scoped>
</style>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="数据指标" name="1"> <el-collapse-item title="数据指标" name="1">
<div style="height: 380px;overflow: scroll;"> <div style="height: 380px;overflow: scroll;">
<el-tree @check="checkNode" :data="idxData" :props="defaultProps" @node-click="handleNodeClick" show-checkbox> <el-tree @check="checkNode" :data="idxData" :props="defaultProps" @node-click="handleNodeClick" show-checkbox ref="tree" node-key="name">
</el-tree> </el-tree>
</div> </div>
<div style="margin-top:2px;margin-left: 40%;"> <div style="margin-top:2px;margin-left: 40%;">
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</div> </div>
<div style="width: 100%; width: 100%; height: 41px; background: white; line-height: 41px;position: relative;position: relative;display: flex;"> <div style="width: 100%; width: 100%; height: 41px; background: white; line-height: 41px;position: relative;position: relative;display: flex;">
<div class="btn" style="text-align: center;width: 50%;background: #f7c57a;color: white;" @click="clearAll">清空</div> <div class="btn" style="text-align: center;width: 50%;background: #f7c57a;color: white;" @click="clearAll">清空</div>
<div class="btn" style="text-align: center;flex:1;background: #008f70;color: white;" @click="showDate">预览</div> <div class="btn" style="text-align: center;flex:1;background: #0078D4;color: white;" @click="showDate">预览</div>
</div> </div>
</div> </div>
<div style="flex:1;background:white;overflow: scroll;"> <div style="flex:1;background:white;overflow: scroll;">
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</div> </div>
</div> </div>
<div style="position: absolute; bottom: 0px; right: 17px;" v-show="!saveFlag"> <div style="position: absolute; bottom: 0px; right: 17px;" v-show="!saveFlag">
<el-button type="success" @click="toSaveTempFile" style="margin-left:14px;margin-right:4px">保存数据</el-button> <el-button type="success" @click="toSaveTempFile" style="margin-left:14px;margin-right:4px;background-color: #358FD4">保存数据</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getyear, getAddress, detDataTitle, getIndustry, run, getTree, saveTempFile } from '@/api/data' import {getyear, getAddress, detDataTitle, getIndustry, getCondition, getTree, saveTempFile, createProject} from '@/api/data'
import { getOption } from "@/utils/echartsUtil" import { getOption } from "@/utils/echartsUtil"
import VabChart from '@/plugins/echarts' import VabChart from '@/plugins/echarts'
export default { export default {
...@@ -185,8 +185,8 @@ ...@@ -185,8 +185,8 @@
}, },
methods: { methods: {
handleNodeClick() { handleNodeClick(obj) {
this.checkDataTitle(obj)
}, },
init() { init() {
this.getAllYear(); this.getAllYear();
...@@ -206,9 +206,14 @@ ...@@ -206,9 +206,14 @@
checkNode(obj, dList) { checkNode(obj, dList) {
console.log(obj); console.log(obj);
console.log(dList) console.log(dList)
// if(obj.checked) {
// this.condition.dataCondition.push(obj)
// }else{
this.condition.dataCondition = dList.checkedNodes.filter(item => { this.condition.dataCondition = dList.checkedNodes.filter(item => {
return item.level == 3; return item.level == 3;
}) })
// }
this.selectData()
}, },
getAllIndustry() { getAllIndustry() {
this.industry = [] this.industry = []
...@@ -277,40 +282,45 @@ ...@@ -277,40 +282,45 @@
this.condition.dataCondition = this.condition.dataCondition.filter(function (item) { this.condition.dataCondition = this.condition.dataCondition.filter(function (item) {
return item.name != obj.name; return item.name != obj.name;
}); });
console.log(this.condition.dataCondition)
} }
}, },
checkAddress(obj) { checkAddress(obj) {
console.log(obj) console.log(obj)
if(obj.checked) { if(obj.checked) {
this.condition.address.push(obj) this.condition.address.push(obj);
} }
else { else {
this.condition.address = this.condition.address.filter(function (item) { this.condition.address = this.condition.address.filter(function (item) {
return item.name != obj.name; return item.name != obj.name;
}); });
} }
this.selectAddr();
}, },
checkYear(obj) { checkYear(obj) {
console.log(obj) console.log(obj)
if(obj.checked) { if(obj.checked) {
this.condition.years.push(obj) this.condition.years.push(obj);
} }
else { else {
this.condition.years = this.condition.years.filter(function (item) { this.condition.years = this.condition.years.filter(function (item) {
return item.year != obj.year; return item.year != obj.year;
}); });
} }
this.selectYear()
}, },
checkIndustry(obj) { checkIndustry(obj) {
console.log(obj) console.log(obj)
if(obj.checked) { if(obj.checked) {
this.condition.industry.push(obj) this.condition.industry.push(obj);
} }
else { else {
this.condition.industry = this.condition.industry.filter(function (item) { this.condition.industry = this.condition.industry.filter(function (item) {
return item.name != obj.name; return item.name != obj.name;
}); });
} }
this.selectIndustry();
}, },
selectIndustry() { selectIndustry() {
...@@ -328,7 +338,14 @@ ...@@ -328,7 +338,14 @@
address: [], address: [],
years: [], years: [],
industry: [] industry: []
},
this.condition ={
dataCondition: [],
address: [],
years: [],
industry: []
} }
this.$refs.tree.setCheckedKeys([])
}, },
toShowData() { toShowData() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -347,13 +364,29 @@ ...@@ -347,13 +364,29 @@
showDate() { showDate() {
this.saveFileName = ''; this.saveFileName = '';
// this.resultData = false; // this.resultData = false;
run(this.params).then(res => {
let params = {
"dataCondition": this.getArrayStrFromObj(this.params.dataCondition,'name'),
"address": this.getArrayStrFromObj(this.params.address,'id'),
"years": this.getArrayStrFromObj(this.params.years,'id'),
}
// let params = {
// name: 'test'
// }
// getCondition(params).then(res => {
// console.log(res)
// }).catch(err=> {
// console.log(err);
// })
getCondition(params).then(res => {
this.resultData = true; this.resultData = true;
console.log(res) console.log(res)
this.tableHeader = res.data.header; this.tableHeader = res.data.header;
this.tableData = JSON.parse(res.data.data) this.tableData = res.data.data;
// this.algoRes = JSON.parse(res.data.res) // this.algoRes = JSON.parse(res.data.res)
this.saveFileName = res.data.tempFile // this.saveFileName = res.data.tempFile
this.saveFlag = false; this.saveFlag = false;
// this.initResultMap() // this.initResultMap()
}).catch(err => { }).catch(err => {
...@@ -361,6 +394,16 @@ ...@@ -361,6 +394,16 @@
this.resultData = true; this.resultData = true;
}) })
}, },
getArrayStrFromObj(selectItem,type){
let selectValues=[]
selectItem.forEach((item, index) => {
if(type=='name')
selectValues.push(item.name)
else
selectValues.push(item.id)
})
return JSON.stringify(selectValues);
},
runDate() { runDate() {
}, },
...@@ -458,7 +501,7 @@ ...@@ -458,7 +501,7 @@
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
font-weight: 600; font-weight: 600;
background: #00977eb8; background: #358FD4;
border-radius: 2px; border-radius: 2px;
} }
.right .btn:hover { .right .btn:hover {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment