Commit 902e5714 authored by whlviolin's avatar whlviolin

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

parent c2a9f8df
......@@ -33,6 +33,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--引入jwt-->
<dependency>
<groupId>com.auth0</groupId>
......@@ -49,7 +53,7 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
<!-- <scope>runtime</scope>-->
<!-- <scope>runtime</scope>-->
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
......@@ -144,6 +148,15 @@
<version>1.0.0</version>
<scope>compile</scope>
</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>
......
......@@ -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.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class ServerApplication {
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;
import cn.ac.iscas.server.pojo.Address;
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.pojo.CSVTableData;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.*;
@CrossOrigin
@RestController
......@@ -40,7 +42,7 @@ public class DataController {
}
@RequestMapping(value = "/getyears", method = RequestMethod.GET)
public Result getAllYear() throws Exception{
List<Integer> data = dataService.getAllYear(); // 假设DataDao类有一个getAllYear方法来获取年份数据
List<Year> data = dataService.getAllYear(); // 假设DataDao类有一个getAllYear方法来获取年份数据
if (data != null) {
return new Result(200, "success", data);
......@@ -75,6 +77,15 @@ public class DataController {
public Result getallIndex() throws Exception{
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) {
return new Result(200, "success", data);
} else {
......@@ -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(
@RequestParam("dataCondition") String dataCondition,
@RequestParam("address") List<String> address,
@RequestParam("years") List<String> years
@RequestParam("dataCondition") String dataCondition,
@RequestParam("address") String address,
@RequestParam("years") String year
) 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);
List<String> years = JSON.parseArray(year,String.class);
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));
});
});
}
if (data != null) {
return new Result(200, "success", data);
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 {
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null);
}
......
......@@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@CrossOrigin
@RestController
......@@ -19,19 +20,19 @@ public class ProjectController {
public Result createProject(
@RequestParam("fId") String fId,
@RequestParam("name") String name
) throws Exception{
boolean isCreate= projectService.createProject(fId, name); // 假设DataDao类有一个getAllYear方法来获取年份数据
if(isCreate==true){
return new Result(200, "success", isCreate);
} else {
return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), "failed",null);
) {
try {
projectService.createProject(fId, name); // 假设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 = "/getProject", method = RequestMethod.GET)
public Result getProject() throws Exception{
List<Project> data = projectService.getProject();
List<Map<String, Object>> data = projectService.getProject();
if (data != null) {
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;
import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
......@@ -23,18 +24,18 @@ public interface DataDao {
List<Industry> getAllIndustry();
List<Integer> getAllYear();
List<Year> getAllYear();
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 >> getallIndex();
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;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProjectDao {
List<Project> getProject();
List<Map<String, Object>> getProject();
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;
import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import org.apache.ibatis.annotations.Param;
import java.io.IOException;
......@@ -19,11 +20,11 @@ public interface DataService {
public List<Address> getAllAddresses() 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>> 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 >> getallIndex()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;
import cn.ac.iscas.server.dao.DataDao;
import cn.ac.iscas.server.pojo.Address;
import cn.ac.iscas.server.pojo.Industry;
import cn.ac.iscas.server.pojo.Year;
import cn.ac.iscas.server.service.data.DataService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -29,8 +32,8 @@ public class DataServiceImpl implements DataService {
}
@Override
public List<Integer> getAllYear() throws IOException {
List<Integer> data= dataDao.getAllYear();
public List<Year> getAllYear() throws IOException {
List<Year> data= dataDao.getAllYear();
return data;
}
......@@ -40,11 +43,6 @@ public class DataServiceImpl implements DataService {
return data;
}
@Override
public List<Map<String, Object>> addChild() throws IOException {
List<Map<String, Object>> data= dataDao.addChild();
return data;
}
@Override
public List<Map<String, Object>> getDataIndexWithLevel(int p_id) throws IOException {
......@@ -52,9 +50,14 @@ public class DataServiceImpl implements DataService {
return data;
}
private List<Map<String, Object>> addChildData()throws IOException{
List<Map<String, Object>> data = this.addChild(-1);
return data;
}
@Override
public List<Map<String, Object>> getallIndex() throws IOException {
List<Map<String, Object>> data= dataDao.getallIndex();
List<Map<String, Object>> data= this.addChildData();
return data;
}
......@@ -65,8 +68,23 @@ public class DataServiceImpl implements DataService {
}
@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);
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;
import java.io.IOException;
import java.util.List;
import java.util.Map;
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;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
......@@ -17,17 +18,15 @@ public class ProjectServiceImpl implements ProjectService {
private ProjectDao projectDao;
@Override
public List<Project> getProject() throws IOException {
List<Project> project= projectDao.getProject();
public List<Map<String, Object>> getProject() throws IOException {
List<Map<String, Object>> project= projectDao.getProject();
return project;
}
@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());
boolean isInsert= projectDao.createProject(project);
return isInsert;
projectDao.createProject(project);
}
}
\ No newline at end of file
......@@ -4,10 +4,7 @@ import cn.ac.iscas.server.service.pojo.CSVTableData;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
......@@ -24,7 +21,7 @@ public class ReadFileUtil {
}else{
fileType = "csv";
}
String fullName = path +"." + fileType;
String fullName = path + "." + fileType;
try {
// 构建FileInputStream对象
FileInputStream fip = new FileInputStream(fullName);
......
......@@ -61,4 +61,6 @@ eureka.instance.hostname = spring-cloud-discovery
eureka.client.serviceUrl.defaultZone = http://127.0.0.1:9090/eureka
eureka.instance.prefer-ip-address = true
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
\ No newline at end of file
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 @@
select id, name from industry
</select>
<select id="getAllYear" resultType="Integer">
<select id="getAllYear" resultType="Year">
select * from year order by year DESC
</select>
......@@ -27,10 +27,10 @@
</select>
<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 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 id="getData" parameterType="string" resultType="Map">
......@@ -41,19 +41,38 @@
where name = #{name}
</select>
<select id="getConditionData" parameterType="string" resultType="Map">
select d.id , d.name, d.value, d.unit, a.address, y.year
from data d
left join year y on y.id = d.year_id
left join address a on a.id = d.address_id
where name in (#{titles_ret})
<if test="years!=null and years.length>0">
and year_id in (#{years})
</if>
<if test="address_ids!=null and address_ids.length>0>0">
and address_id in (#{address_ids})
</if>
<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
from data d
left join year y on y.id = d.year_id
left join address a on a.id = d.address_id
where d.name in
<foreach collection="titles_ret" item="title" index="index" open="(" close=")" separator=",">
#{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 test="address_ids!=null and address_ids.size>0">
and d.address_id in
<foreach collection="address_ids" item="address_id" index="index" open="(" close=")" separator=",">
#{address_id}
</foreach>
</if>
)
as tb
GROUP BY year;
</select>
......
......@@ -8,9 +8,9 @@
from file_list
</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)
values(#{id}, #{name}, #{type}, #{path}, #{create_time}, #{update_time}, #{is_dir} )
</select>
</insert>
</mapper>
\ No newline at end of file
......@@ -3,15 +3,15 @@
<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
inner join file_list f on p.fId = f.id
</select>
<select id="createProject" parameterType="Project" >
<insert id="createProject" parameterType="Project" >
insert into project(id, name, fId, update_time)
values(#{id}, #{name}, #{fId}, #{update_time} )
</select>
</insert>
</mapper>
\ No newline at end of file
/**
* @author https://vue-admin-beautiful.com (不想保留author可删除)
* @description .eslintrc.js
*/
module.exports = {
root: true,
env: {
node: true,
},
extends: ['plugin:vue/recommended', '@vue/prettier'],
rules: {
'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: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
"env": {
"browser": true,
"es2021": true
},
],
"extends": "eslint:recommended",
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
......@@ -74,10 +74,10 @@ module.exports = [
data: {
permissions,
username,
'avatar|1': [
'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif',
'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
],
// 'avatar|1': [
// 'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif',
// 'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
// ],
},
}
},
......
......@@ -9,50 +9,50 @@ export function getyear() {
}
export function getIndustry() {
return request({
url: 'http://localhost:5000/getindustry',
method: 'get',
})
}
return request({
url: 'http://localhost:5000/getindustry',
method: 'get',
})
}
export function getAddress() {
return request({
url: 'http://localhost:5000/getaddrs',
method: 'get',
})
}
return request({
url: 'http://localhost:5000/getaddrs',
method: 'get',
})
}
export function detDataTitle() {
return request({
url: 'http://localhost:5000/getdatatitles',
method: 'get',
})
return request({
url: 'http://localhost:5000/getdatatitles',
method: 'get',
})
}
export function run(condition) {
return request({
url: 'http://localhost:5000/run',
method: 'post',
data: condition
})
}
export function getCondition(params) {
return request({
url: "http://localhost:5000/getCondition",
method: 'get',
params
})
}
export function getTree() {
return request({
url: "http://localhost:5000/getallIndex",
method: 'get',
return request({
url: "http://localhost:5000/getallIndex",
method: 'get',
})
})
}
export function readFile(params) {
return request({
url: "http://localhost:5000/readfile",
method: 'get',
params
url: "http://localhost:5000/readfile",
method: 'get',
params
})
}
......@@ -60,9 +60,9 @@ export function readFile(params) {
export function saveTempFile(params) {
return request({
url: "http://localhost:5000/saveTempFile",
method: 'get',
params
url: "http://localhost:5000/saveTempFile",
method: 'get',
params
})
}
......@@ -70,9 +70,9 @@ export function saveTempFile(params) {
export function runAlgo(params) {
return request({
url: "http://localhost:5000/algo/run",
method: 'get',
params
url: "http://localhost:5000/algo/run",
method: 'get',
params
})
}
......@@ -80,9 +80,9 @@ export function runAlgo(params) {
export function runDEAAlgo(params) {
return request({
url: "http://localhost:5000/algo/runDEA",
method: 'get',
params
url: "http://localhost:5000/algo/runDEA",
method: 'get',
params
})
}
......@@ -90,25 +90,25 @@ export function runDEAAlgo(params) {
export function getDataHeader(params) {
return request({
url: "http://localhost:5000/getDataHeader",
method: 'get',
params
url: "http://localhost:5000/getDataHeader",
method: 'get',
params
})
}
export function getProject() {
return request({
url: "http://localhost:5000/getProject",
method: 'get'
url: "http://localhost:5000/getProject",
method: 'get'
})
}
export function getFileList() {
return request({
url: "http://localhost:5000/getFileList",
method: 'get'
url: "http://localhost:5000/getFileList",
method: 'get'
})
}
......@@ -116,9 +116,26 @@ export function getFileList() {
export function createProject(params) {
return request({
url: "http://localhost:5000/createProject",
method: 'get',
params
url: "http://localhost:5000/createProject",
method: 'get',
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
})
}
......@@ -137,3 +154,37 @@ export function getData(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>
<el-dropdown @command="handleCommand">
<span class="avatar-dropdown">
<img class="user-avatar" :src="avatar" alt="" />
<!-- <img class="user-avatar" :src="avatar" alt="" />-->
<div class="user-name">
{{ username }}
<i class="el-icon-arrow-down el-icon--right"></i>
......
......@@ -5,7 +5,7 @@
{{ $route.query.name }}
</template>
<template v-else>
{{ item.meta.title }}
{{ item.meta.title }}
</template>
</el-breadcrumb-item>
</el-breadcrumb>
......
......@@ -16,8 +16,6 @@ if (process.env.NODE_ENV === 'production') {
Vue.config.productionTip = false
new Vue({
el: '#vue-admin-beautiful',
router,
......
......@@ -8,6 +8,7 @@ import VueRouter from 'vue-router'
import Layout from '@/layouts'
import EmptyLayout from '@/layouts/EmptyLayout'
import { publicPath, routerMode } from '@/config'
import {size} from "lodash/collection";
Vue.use(VueRouter)
export const constantRoutes = [
......@@ -47,7 +48,8 @@ export const asyncRoutes = [
component: () => import('@/views/index/index'),
meta: {
title: '首页',
icon: 'home'
icon: 'home',
},
},
],
......@@ -57,7 +59,7 @@ export const asyncRoutes = [
component: Layout,
name: 'myData',
redirect: '/myData',
meta: { title: '通用工具子系统', icon: 'box-open' },
meta: { title: '通用工具子系统', icon: 'box-open',},
children: [
{
path: '/myData',
......@@ -65,7 +67,9 @@ export const asyncRoutes = [
component: () => import('@/views/myData'),
meta: {
title: '数据查询',
icon: 'hockey-puck'
icon: 'hockey-puck',
width:'60px',
},
},
{
......@@ -134,16 +138,16 @@ export const asyncRoutes = [
{
path: '/data1',
path: '/generalTool',
component: Layout,
name: 'data1',
redirect: '/data1',
meta: { title: '数据可视化分析', icon: 'box-open' },
name: 'generalTool',
redirect: '/generalTool',
meta: { title: '通用工具子系统', icon: 'box-open' },
children: [
{
path: '/data1',
name: 'data1',
component: () => import('@/views/data'),
path: '/generalTool',
name: 'generalTool',
component: () => import('@/views/generalTool'),
meta: {
title: '通用工具子系统',
icon: 'hand-middle-finger',
......@@ -153,7 +157,7 @@ export const asyncRoutes = [
path: 'analysis',
name: 'analysis',
hidden: true,
component: () => import('@/views/data/components/analysis'),
component: () => import('@/views/generalTool/components/analysis'),
meta: {
title: '数据'
},
......
......@@ -10,7 +10,7 @@ $base-color-default: #eb8d00;
$base-z-index: 999;
//横向布局纵向布局时菜单背景色
// $base-menu-background: #252525;
$base-menu-background: #2aa0bb;
$base-menu-background: #0078D4;
//菜单文字颜色
$base-menu-color: hsla(0, 0%, 91%, 0.95);
//菜单选中文字颜色
......
......@@ -2,74 +2,74 @@
export function getOption(data1) {
console.log(data1)
// if(data1["data"].length == 0) {
// return
// }
// prettier-ignore
const hours = data1["columns"];
// prettier-ignore
const days = data1["index"];
// prettier-ignore
let data = []
for(let item in data1.data) {
for (let col in data1.data[item]) {
data.push([parseInt(item), parseInt(col), data1.data[item][col]])
}
console.log(data1)
// if(data1["data"].length == 0) {
// return
// }
// prettier-ignore
const hours = data1["columns"];
// prettier-ignore
const days = data1["index"];
// prettier-ignore
let data = []
for(let item in data1.data) {
for (let col in data1.data[item]) {
data.push([parseInt(item), parseInt(col), data1.data[item][col]])
}
// const data = [[0, 0, 5]]
// .map(function (item) {
// return [item[1], item[0], item[2] || '-'];
// });
console.log(data)
let option = {
tooltip: {
position: 'top'
},
grid: {
height: '50%',
top: '10%'
},
xAxis: {
type: 'category',
data: hours,
splitArea: {
show: true
}
}
// const data = [[0, 0, 5]]
// .map(function (item) {
// return [item[1], item[0], item[2] || '-'];
// });
console.log(data)
let option = {
tooltip: {
position: 'top'
},
grid: {
height: '50%',
top: '10%'
},
xAxis: {
type: 'category',
data: hours,
splitArea: {
show: true
}
},
yAxis: {
type: 'category',
data: days,
splitArea: {
show: true
}
},
visualMap: {
min: 0,
max: 1,
calculable: true,
orient: 'horizontal',
left: 'center',
bottom: '15%'
},
series: [
{
name: 'Punch Card',
type: 'heatmap',
data: data,
label: {
show: true
},
yAxis: {
type: 'category',
data: days,
splitArea: {
show: true
}
},
visualMap: {
min: 0,
max: 1,
calculable: true,
orient: 'horizontal',
left: 'center',
bottom: '15%'
},
series: [
{
name: 'Punch Card',
type: 'heatmap',
data: data,
label: {
show: true
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
return option;
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
return option;
}
......@@ -77,71 +77,135 @@ export function getOption(data1) {
export function getOption2(res) {
let seriesList = []
let seriesList = []
let col = []
let leg = []
let header = res['header']//["决策单元",'技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)']
let data = res['value']
for(let i in header){
console.log(header[i])
let litem = header[i]
let datalist = []
for (let j in data) {
let ditem = data[j]
let value = ditem[litem]
if(litem == "index") {
col.push(value)
continue;
}
if(litem == "有效性") {
continue;
}
datalist.push(value)
}
if(litem != "决策单元" && litem != "有效性"&& litem != "index") {
leg.push(litem)
let obj = {
name: litem,
type: 'line',
data: datalist,
symbol: 'none',
let col = []
let leg = []
let header = res['header']//["决策单元",'技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)']
let data = res['data']
for(let i in header){
console.log(header[i])
let litem = header[i]
let datalist = []
for (let j in data) {
let ditem = data[j]
let value = ditem[litem]
if(litem == "决策单元") {
col.push(value)
continue;
}
if(litem == "有效性") {
continue;
}
datalist.push(value)
}
if(litem != "决策单元" && litem != "有效性") {
leg.push(litem)
let obj = {
name: litem,
type: 'line',
data: datalist
}
seriesList.push(obj)
}
}
seriesList.push(obj)
}
console.log(col)
console.log(seriesList)
let option = {
title: {
text: '效益有效性分析'
},
tooltip: {
trigger: 'axis'
},
legend: {
data:leg
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
}
console.log(col)
console.log(seriesList)
let option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis',
position: function (pt) {
return [pt[0], '20%'];
},
valueFormatter: (value) => parseFloat(value).toFixed(Number(3))
},
legend: {
data:leg
},
dataZoom: [
{
type: 'inside',
start: 0,
end: 100
},
{
start: 0,
end: 100
}
],
grid: {
left: '3%',
right: '4%',
// bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
dataZoom: {
yAxisIndex: 'none'
},
toolbox: {
feature: {
saveAsImage: {}
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: col
},
yAxis: {
type: 'value',
min:"dataMin",
max:"dataMax",
boundaryGap: [0, '100%']
},
series: seriesList
};
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]
}
}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: col
},
yAxis: {
type: 'value'
},
series: seriesList
};
return option;
type: 'scatter'
}
]
};
return option;
}
......@@ -78,7 +78,7 @@ instance.interceptors.request.use(
instance.interceptors.response.use(
(response) => {
debugger;
// debugger;
if (loadingInstance) loadingInstance.close()
const { data, config } = response
......
<template>
<div class="index-container">
<div style="background:#e8f1f2">
<vab-breadcrumb class="hidden-xs-only" :style="{'height':'30px', 'line-height':'30px', 'margin-left':'20px'}" />
</div>
<div style="width: 100%; height:100%;width: 100%;height: 100%;display: flex;flex-direction: row;">
<div class="result_list" style="width: 200px;border-right: 3px solid #d7d7d754;" v-if="false">
<div class="title" style=" ">
<span style="margin-left: 14px;"><span style="font-size:20px"><i :class="project.type =='xlsx'?'iconfont icon-web-icon-':'iconfont icon-web-icon-'"></i></span>{{project.fileName}}</span>
</div>
<div style="height:30px;line-height:30px">
<span style="margin-left:20px">分析结果列表</span>
</div>
</div>
<div class="sel-algo" style="width: 285px;border-right: 3px solid #d7d7d754;">
<div class="title">
<span style="margin-left: 14px;">选择算法 - {{project.fileName}}</span>
</div>
<div class="body">
<div v-for="item in algos">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;"
@click="item.expand=!item.expand">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
<div style="margin-right:5px;"><i :class="item.expand?'el-icon-caret-bottom':'el-icon-caret-right'"></i>
</div>
</div>
<div v-show="item.expand" style="width: 100%; line-height:16px;min-height:50px">
<template v-for="ch in item.child">
<div class="algo-item" style="font-size:13px;height:26px; line-height:26px;" @click="useAlgo(ch)"
:class="ch.id == selectAlgo.id?'active-item':''">
<span style="margin-left:38px">{{ch.name}}</span>
</div>
</template>
</div>
</div>
</div>
</div>
<div style="flex: 1; display: flex; flex-direction: row; overflow: auto;" v-if="selectAlgo.id && !hasResult">
<div class="sel-args" style="width: 240px;border-right: 3px solid #d7d7d754;">
<div class="title">
<span style="margin-left: 14px;">选择变量</span>
</div>
<div class="body" >
<!-- 调用组件 -->
<draggable v-model="args" v-bind="{sort: false}" :group="{ name:'person', pull: true, put:false }"
:clone="cloneItem">
<div v-for="item in args">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
</div>
</div>
</draggable>
<div style="position: absolute; bottom: 10px; right: 35px;">
<el-button type="success" style="margin-left:14px;margin-right:4px" @click="run">开始分析</el-button>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-if="selectAlgo.key == 'DEA'"> <!-- 这是包络分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:40px;line-height:40px;margin-left: 20px;">放入投入指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%; height: 33%; overflow: scroll;border:1px dashed #cdcdcd;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入产出指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%;height: 30%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入索引项 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else> <!-- 这是相关性分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="height: 30px; line-height: 30px;">
<span style="margin-left:25px">放入变量</span>
</div>
<div style="width: 100%; height:100%; display: flex;flex-direction: row;justify-content: center;">
<div style="width: 95%; height:77%;border:1px dashed #cdcdcd;margin-left: 20px;overflow-y: auto;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
</div>
</div>
</div>
</div>
<div style="flex: 1;" v-if="hasResult">
<component :is="selectAlgo.component" :algoName="selectAlgo.name" :algoRes="algoRes" />
</div>
</div>
</div>
</template>
<script>
import {
runAlgo, getDataHeader, runDEAAlgo
} from '@/api/data'
import VabChart from '@/plugins/echarts'
import draggable from 'vuedraggable'
import res1 from "./res/res1.vue"
import res2 from "./res/res2.vue"
export default {
name: 'Index',
components: {
VabChart,
draggable,
res1,
res2
},
data() {
return {
hasResult: false,
algoRes: {},
selectAlgo: {},
project: {},
choose_args: [],
choose_args1: [],
choose_args2: [],
choose_args3: [],
args: [{
"id": "1",
"name": "时间",
"key": "time",
"type": ""
},
{
"id": "2",
"name": "区域",
"key": "address",
"type": ""
},
{
"id": "3",
"name": "总人口(万人)",
"key": "total",
"type": ""
},
{
"id": "4",
"name": "男性人口(万人)",
"key": "man_total",
"type": ""
},
{
"id": "5",
"name": "女性人口(万人)",
"key": "woman_total",
"type": ""
}
],
algos: [
{
"id": "2",
"name": "综合评价",
"key": "dea",
"icon": "iconfont icon-database-set",
"expand": false,
"child": [{
"id": '21',
"name": "数据包络分析(DEA)",
"key": "DEA",
"component": "res2"
}]
},
{
"id": "3",
"name": "相关性分析",
"key": "deal",
"icon": "iconfont icon-jiegou",
"expand": false,
"child": [{
"id": '31',
"name": "Pearson相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '32',
"name": "Spearman相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '33',
"name": "Kendall一致性检验",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "1",
"name": "数据处理",
"key": "deal",
"icon": "iconfont icon-people-network-full",
"expand": false,
"child": [{
"id": '11',
"name": "数据标签",
"key": "deal1"
},
{
"id": '12',
"name": "数据编码",
"key": "deal1"
},
{
"id": '13',
"name": "异常值处理",
"key": "deal1"
},
{
"id": '14',
"name": "缺失值处理",
"key": "deal1"
}, {
"id": '15',
"name": "数据变换",
"key": "deal1"
}
]
},
{
"id": "4",
"name": "数据预处理",
"key": "deal2",
"icon": "iconfont icon--_shujuyuchuli",
"expand": false,
"child": [{
"id": '41',
"name": "特征提取",
"desc": "特征提取",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '42',
"name": "归一化",
"desc": "归一化",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '43',
"name": "描述统计",
"desc": "描述统计",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "5",
"name": "回归模型",
"key": "deal2",
"icon": "iconfont icon-xianxinghuigui",
"expand": false,
"child": [{
"id": '51',
"name": "预测与对象关联的连续值属性",
"desc": "预测与对象关联的连续值属性",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "6",
"name": "分类模型",
"key": "deal2",
"icon": "iconfont icon-fenlei3",
"expand": false,
"child": [{
"id": '61',
"name": "标识对象所属的类别",
"desc": "标识对象所属的类别",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "7",
"name": "聚类算法",
"key": "deal2",
"icon": "iconfont icon-julei",
"expand": false,
"child": [{
"id": '71',
"name": "自动将相似对象归为一组",
"desc": "自动将相似对象归为一组",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "8",
"name": "降维方法",
"key": "deal2",
"icon": "iconfont icon--_shujujiangwei",
"expand": false,
"child": [{
"id": '81',
"name": "减少要考虑的随机变量的数量",
"desc": "减少要考虑的随机变量的数量",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "9",
"name": "统计检验",
"key": "deal2",
"icon": "iconfont icon-tongji2",
"expand": false,
"child": [{
"id": '91',
"name": "t检验",
"desc": "t检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '92',
"name": "正态检验",
"desc": "正态检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "10",
"name": "关联分析",
"key": "deal2",
"icon": "iconfont icon-guanlianguize",
"expand": false,
"child": [{
"id": '101',
"name": "用于从数据中挖掘出潜在的关联关系",
"desc": "用于从数据中挖掘出潜在的关联关系",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "11",
"name": "时间序列分析",
"key": "deal2",
"icon": "iconfont icon-guanlian1",
"expand": false,
"child": [{
"id": '111',
"name": "针对时序序列数据的分析预测",
"desc": "针对时序序列数据的分析预测",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "12",
"name": "综合评价",
"key": "deal2",
"icon": "iconfont icon-tongji",
"expand": false,
"child": [{
"id": '121',
"name": "运用多个指标对多个参评单位进行评价的方法",
"desc": "运用多个指标对多个参评单位进行评价的方法",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "13",
"name": "图表分析",
"key": "deal2",
"icon": "iconfont icon-24gf-chartPie",
"expand": false,
"child": [{
"id": '131',
"name": "对数据和结果的可视化分析",
"desc": "对数据和结果的可视化分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "14",
"name": "领域分析",
"key": "deal2",
"icon": "iconfont icon-icon_xinyong_xianxing_jijin-222",
"expand": false,
"child": [{
"id": '141',
"name": "领域算法分析",
"desc": "领域算法分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
}
]
}
},
mounted() {
this.initdata();
},
methods: {
initdata() {
this.project = this.$route.query;
console.log(this.project)
this.getDataInfo()
},
getDataInfo() {
this.args = []
let params = {
"fId": this.project.fId,
"name": this.project.name
}
getDataHeader(params).then(res => {
let temp = res.data.header;
for (let entry in temp) {
let obj = {
"name": temp[entry]
}
this.args.push(obj)
}
}).catch(err => {
console.log(err)
})
},
useAlgo(algo) {
console.log("选择算法")
console.log(algo)
this.selectAlgo = algo;
this.hasResult = false;
},
runCommon() {
let params = {
"name": this.project.fileName,
"fId": this.project.fId,
"algo": this.selectAlgo.algo,
"ar": JSON.stringify(this.choose_args)
}
runAlgo(params).then(res => {
console.log("算法执行结果")
console.log(res)
this.hasResult = true
this.algoRes = JSON.parse(res.data.res);
}).catch(err => {
console.log(err)
})
},
runDEA() {
//this.choose_args1 = {aa:'aaa'}
let params = {
"name": this.project.name,
"fId": this.project.fId,
"args_x": JSON.stringify(this.choose_args1),
"args_y": JSON.stringify(this.choose_args2),
"args_z": JSON.stringify(this.choose_args3),
}
this.hasResult = true
this.algoRes = //res.data;
{title: "数据包络分析(DEA)_编号_身高cm_负荷时间",
res11: {header:["决策单元",'技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)','有效性'],data:[{"决策单元":0,'技术效益(BCC)':0.907106846851185,'规模效益(CCR/BCC)':0.988628931300419,'综合技术效益(CCR)':0.89679207257778,'有效性':'非 DEA 有效'},{"决策单元":1,'技术效益(BCC)':0.3,'规模效益(CCR/BCC)':0.1,'综合技术效益(CCR)':0.2,'有效性':'DEA 强有效'}],
},
res22: {header:['技术效益(BCC)','规模效益(CCR/BCC)','综合技术效益(CCR)'],data:[{'技术效益(BCC)':0.907106846851185,'规模效益(CCR/BCC)':0.988628931300419,'综合技术效益(CCR)':0.89679207257778},{'技术效益(BCC)':0.3,'规模效益(CCR/BCC)':0.1,'综合技术效益(CCR)':0.2}]},
}
// runDEAAlgo(params).then(res => {
// console.log("算法执行结果")
// console.log(res)
// this.hasResult = true
// this.algoRes = //res.data;
// {title: "数据包络分析(DEA)_编号_身高cm_负荷时间"}
// }).catch(err => {
// console.log(err)
// })
},
run() {
if(this.selectAlgo.key == "DEA") {
this.runDEA();
} else {
this.runCommon();
}
},
cloneItem: function (val) {
// 深复制一个节点
return JSON.parse(JSON.stringify(val))
},
dragItem: function (widget) {
console.log(widget);
},
addItem: function (widget) {
console.log(widget);
},
delEntry1(item) {
this.choose_args1 = this.choose_args1.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry2(item) {
this.choose_args2 = this.choose_args2.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry3(item) {
this.choose_args3 = this.choose_args3.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry(item) {
this.choose_args = this.choose_args.filter(i => {
return i.name != item.name
})
this.args.push(item)
}
}
}
</script>
<style scoped>
.index-container {
height: 100%;
}
.result_list .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-algo .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-args .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
}
.body .entry:hover {
cursor: pointer;
background: rgb(240, 255, 254);
}
.algo-item:hover {
cursor: pointer;
background: rgb(246, 255, 254);
}
.active-item {
background: rgb(228, 228, 228);
}
.mdc_right {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
}
.mdc_right>div {
height: 28px;
line-height: 28px;
margin-top: 6px;
/* border: 1px solid #CCCCCC; */
cursor: move;
margin: 5px 20px;
}
.mdc_right>div:hover {
background: #e6e6e6;
/* box-shadow: 1px 2px 4px #CCCCCC; */
}
.mdc_right>div>span {
display: inline-block;
vertical-align: top;
}
.mdc_right>div>span>img {
height: 30px;
}
.del-entry:hover {
color: red;
cursor: pointer;
}
</style>
......@@ -137,11 +137,11 @@
</div>
</div>
</div>
</div>
</template>
<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 VabChart from '@/plugins/echarts'
export default {
......@@ -158,7 +158,7 @@
},
activeNames: "1",
idxData: [],
defaultProps: {
children: 'children',
label: 'name'
......@@ -417,7 +417,7 @@
},
showDate() {
// this.resultData = false;
run(this.params).then(res => {
getCondition(this.params).then(res => {
this.resultData = true;
console.log(res)
this.tableHeader = res.data.header;
......@@ -509,4 +509,4 @@
color: #303133;
line-height: 1.7692307692;
}
</style>
\ No newline at end of file
</style>
<template>
<div class="index-container">
<div style="background:#e8f1f2">
<vab-breadcrumb class="hidden-xs-only" :style="{'height':'30px', 'line-height':'30px', 'margin-left':'20px'}" />
</div>
<div style="width: 100%; height:100%;width: 100%;height: 100%;display: flex;flex-direction: row;">
<div class="result_list" style="width: 240px;border-right: 3px solid #d7d7d754;" v-if="true">
<div class="title" style=" ">
<span style="margin-left: 14px;"><span style="font-size:20px"><i :class="project.type =='xlsx'?'iconfont icon-web-icon-':'iconfont icon-web-icon-'"></i></span>{{project.fileName}}</span>
</div>
<div style="height:30px;line-height:30px">
<span style="margin-left:20px">分析结果列表</span>
</div>
<div v-for="item in analysisResult">
<!-- <template v-for="ch in item.child">-->
<div class="algo-item" style="font-size:13px;height:26px; line-height:26px;" @click="getAnalysisResultDetail(item)"
:class="item.id == selectAlgo.id?'active-item':''">
<div style="margin-left:38px;white-space: nowrap;text-overflow:ellipsis; overflow:hidden;" :title="item.name">{{item.name}}</div>
</div>
<!-- </template>-->
</div>
</div>
<div class="sel-algo" style="width: 240px;border-right: 3px solid #d7d7d754;">
<div class="title">
<span style="margin-left: 14px;">选择算法 - {{project.fileName}}</span>
</div>
<div class="body">
<div v-for="item in algos">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;"
@click="item.expand=!item.expand">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
<div style="margin-right:5px;"><i :class="item.expand?'el-icon-caret-bottom':'el-icon-caret-right'"></i>
</div>
</div>
<div v-show="item.expand" style="width: 100%; line-height:16px;min-height:50px">
<template v-for="ch in item.child">
<div class="algo-item" style="font-size:13px;height:26px; line-height:26px;" @click="useAlgo(ch)"
:class="ch.id == selectAlgo.id?'active-item':''">
<span style="margin-left:38px">{{ch.name}}</span>
</div>
</template>
</div>
</div>
</div>
</div>
<div style="flex: 1; display: flex; flex-direction: row; overflow: auto;" v-if="selectAlgo.id && !hasResult">
<div v-if="selectAlgo.key != 'AHPSimple'" class="sel-args" style="width: 30%;border-right: 3px solid #d7d7d754;">
<div class="title" >
<span style="margin-left: 14px;">选择变量</span>
</div>
<div class="body" >
<!-- 调用组件 -->
<draggable v-model="args" v-bind="{sort: false}" :group="{ name:'person', pull: true, put:false }"
:clone="cloneItem">
<div v-for="item in args">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
</div>
</div>
</draggable>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;overflow: auto;" v-if="selectAlgo.key == 'AHPSimple'">
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="margin:50px;">
<el-table
border
height="100%"
:data=AHPSimpletableData
:style="{'width': '100%'}">
<template v-for="item in AHPSimpleHeader">
<el-table-column
:prop="item"
align="center"
:label="item"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;overflow:auto;overflow-scrolling: inherit" v-else-if="selectAlgo.key == 'DEA'"> <!-- 这是包络分析定制的参数 -->
<div style="height:3%;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:7%;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 87%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:5%;line-height:40px;margin-left: 20px;">放入投入指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%; height: 27%; overflow: scroll;border:1px dashed #cdcdcd;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:5%;line-height:40px;margin-left: 20px;">放入产出指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%;height: 27%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:5%;line-height:40px;margin-left: 20px;">放入索引项 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height: 5%; margin-top: 8px;">
<span style="margin-left: 25px;">DEA类型</span>
<span style="margin-left: 15px;"><el-select v-model="chooseDEA" clearable placeholder="请选择">
<el-option
v-for="item in DEAList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else-if="selectAlgo.key == 'TOPSIS'"> <!-- 这是包络分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:40px;line-height:40px;margin-left: 20px;">放入正向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%; height: 33%; overflow: scroll;border:1px dashed #cdcdcd;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入负向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%;height: 30%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:30px;line-height:40px;margin-left: 20px;">放入 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div >
<span style="margin-left: 25px;">变量权重</span>
<span style="margin-left: 15px;"><el-select v-model="chooseVariableWeight" clearable placeholder="请选择">
<el-option
v-for="item in variableWeightList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else-if="selectAlgo.key == 'RSR'"> <!-- 这是包络分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:40px;line-height:40px;margin-left: 20px;">放入正向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 100%; height:100%; ">
<div style="width: 95%; height: 33%; overflow: scroll;border:1px dashed #cdcdcd;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入负向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%;height: 30%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:30px;line-height:40px;margin-left: 20px;">放入索引 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="margin-left: 20px;height:35px;">
<span>编秩方法</span>
<span style="margin-left: 15px;"><el-select v-model="chooseRankingMethod" clearable placeholder="请选择">
<el-option
v-for="item in rsrRankingMethodList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
<span style="margin-left: 25px;">分档数量</span>
<span style="margin-left: 15px;"><el-select v-model="chooseQuantitiesCategory" clearable placeholder="请选择">
<el-option
v-for="item in rsrQuantitiesCategories"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
<span style="margin-left: 25px;">变量权重</span>
<span style="margin-left: 15px;"><el-select v-model="chooseRSRVariableWeight" clearable placeholder="请选择">
<el-option
v-for="item in RSRVariableWeightList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else> <!-- 这是相关性分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="height: 30px; line-height: 30px;">
<span style="margin-left:25px">放入变量</span>
</div>
<div style="width: 100%; height:100%; display: flex;flex-direction: row;justify-content: center;">
<div style="width: 95%; height:77%;border:1px dashed #cdcdcd;margin-left: 20px;overflow-y: auto;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
</div>
</div>
</div>
<div style="position: absolute; bottom: 10px; right: 35px;height: 3%">
<el-button type="success" style="margin-left:14px;margin-right:4px" @click="run">开始分析</el-button>
</div>
</div>
<div style="flex: 1;" v-if="hasResult">
<component :is="selectAlgo.component" :algoName="selectAlgo.name" :algoRes="algoRes" :algoAllHeader="algoAllHeader"/>
</div>
</div>
</div>
</template>
<script>
import {
runAlgo, getDataHeader, runDEAAlgo, readFile, getTOPSISList, getRSRList, getDEAList, getAHPList, createAnalysisResult, getAnalysisResult
} from '@/api/data'
import VabChart from '@/plugins/echarts'
import draggable from 'vuedraggable'
import res1 from "./res/res1.vue"
import dea from "./res/dea.vue"
import ahpsimple from "./res/ahpsimple.vue"
import topsis from "./res/topsis.vue"
import rsr from "./res/rsr.vue"
import uploadForm from "mockjs";
export default {
name: 'Index',
components: {
VabChart,
draggable,
res1,
dea,
ahpsimple,
topsis,
rsr,
},
data() {
return {
hasResult: false,
algoRes: {},
selectAlgo: {},
algoAllHeader:[],
project: {},
AHPSimpleHeader:[],
AHPSimpletableData:[],
chooseRankingMethod: '非整秩方法',
chooseVariableWeight: '熵权法',
chooseQuantitiesCategory: '3',
rankingMethodList:[{id:'no_integer_rank',name:'非整秩方法'}],//编秩方法
quantitiesCategories:[{id:'3',name:'3挡'}],//分档数量
variableWeightList:[{id:'entropy_method',name:'熵权法'}],//变量权重
chooseRSRVariableWeight:'熵权法',
RSRVariableWeightList:[{id:'entropy_method',name:'熵权法'},{id:'no_weight',name:'不设置权重'},{id:'custom_weight',name:'自定义权重'}],//变量权重
rsrRankingMethodList:[{id:'integer_rank',name:'整秩方法'},{id:'no_integer_rank',name:'非整秩方法'}],//编秩方法
rsrQuantitiesCategories:[{id:'3',name:'3档'},{id:'4',name:'4档'},{id:'5',name:'5档'}],//分档数量
chooseDEA:'BBC',
DEAList:[{id:'bbc',name:'BBC'},{id:'ccr',name:'CCR'}],
choose_args: [],
choose_args1: [],
choose_args2: [],
choose_args3: [],
args: [{
"id": "1",
"name": "时间",
"key": "time",
"type": ""
},
{
"id": "2",
"name": "区域",
"key": "address",
"type": ""
},
{
"id": "3",
"name": "总人口(万人)",
"key": "total",
"type": ""
},
{
"id": "4",
"name": "男性人口(万人)",
"key": "man_total",
"type": ""
},
{
"id": "5",
"name": "女性人口(万人)",
"key": "woman_total",
"type": ""
}
],
algos: [
{
"id": "2",
"name": "综合评价",
"key": "dea",
"icon": "iconfont icon-database-set",
"expand": false,
"child": [{
"id": '21',
"name": "数据包络分析(DEA)",
"key": "DEA",
"component": "dea"
},
{
"id": '22',
"name": "层次分析法(AHP简化版)",
"key": "AHPSimple",
"component": "ahpsimple"
},
{
"id": '23',
"name": "优劣解距离法(TOPSIS)",
"key": "TOPSIS",
"component": "topsis"
},
{
"id": '24',
"name": "秩和比综合评价法(RSR)",
"key": "RSR",
"component": "rsr"
},
]
},
{
"id": "3",
"name": "相关性分析",
"key": "deal",
"icon": "iconfont icon-jiegou",
"expand": false,
"child": [{
"id": '31',
"name": "Pearson相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '32',
"name": "Spearman相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '33',
"name": "Kendall一致性检验",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "1",
"name": "数据处理",
"key": "deal",
"icon": "iconfont icon-people-network-full",
"expand": false,
"child": [{
"id": '11',
"name": "数据标签",
"key": "deal1"
},
{
"id": '12',
"name": "数据编码",
"key": "deal1"
},
{
"id": '13',
"name": "异常值处理",
"key": "deal1"
},
{
"id": '14',
"name": "缺失值处理",
"key": "deal1"
}, {
"id": '15',
"name": "数据变换",
"key": "deal1"
}
]
},
{
"id": "4",
"name": "数据预处理",
"key": "deal2",
"icon": "iconfont icon--_shujuyuchuli",
"expand": false,
"child": [{
"id": '41',
"name": "特征提取",
"desc": "特征提取",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '42',
"name": "归一化",
"desc": "归一化",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '43',
"name": "描述统计",
"desc": "描述统计",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "5",
"name": "回归模型",
"key": "deal2",
"icon": "iconfont icon-xianxinghuigui",
"expand": false,
"child": [{
"id": '51',
"name": "预测与对象关联的连续值属性",
"desc": "预测与对象关联的连续值属性",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "6",
"name": "分类模型",
"key": "deal2",
"icon": "iconfont icon-fenlei3",
"expand": false,
"child": [{
"id": '61',
"name": "标识对象所属的类别",
"desc": "标识对象所属的类别",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "7",
"name": "聚类算法",
"key": "deal2",
"icon": "iconfont icon-julei",
"expand": false,
"child": [{
"id": '71',
"name": "自动将相似对象归为一组",
"desc": "自动将相似对象归为一组",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "8",
"name": "降维方法",
"key": "deal2",
"icon": "iconfont icon--_shujujiangwei",
"expand": false,
"child": [{
"id": '81',
"name": "减少要考虑的随机变量的数量",
"desc": "减少要考虑的随机变量的数量",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "9",
"name": "统计检验",
"key": "deal2",
"icon": "iconfont icon-tongji2",
"expand": false,
"child": [{
"id": '91',
"name": "t检验",
"desc": "t检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '92',
"name": "正态检验",
"desc": "正态检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "10",
"name": "关联分析",
"key": "deal2",
"icon": "iconfont icon-guanlianguize",
"expand": false,
"child": [{
"id": '101',
"name": "用于从数据中挖掘出潜在的关联关系",
"desc": "用于从数据中挖掘出潜在的关联关系",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "11",
"name": "时间序列分析",
"key": "deal2",
"icon": "iconfont icon-guanlian1",
"expand": false,
"child": [{
"id": '111',
"name": "针对时序序列数据的分析预测",
"desc": "针对时序序列数据的分析预测",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "12",
"name": "综合评价",
"key": "deal2",
"icon": "iconfont icon-tongji",
"expand": false,
"child": [{
"id": '121',
"name": "运用多个指标对多个参评单位进行评价的方法",
"desc": "运用多个指标对多个参评单位进行评价的方法",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "13",
"name": "图表分析",
"key": "deal2",
"icon": "iconfont icon-24gf-chartPie",
"expand": false,
"child": [{
"id": '131',
"name": "对数据和结果的可视化分析",
"desc": "对数据和结果的可视化分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "14",
"name": "领域分析",
"key": "deal2",
"icon": "iconfont icon-icon_xinyong_xianxing_jijin-222",
"expand": false,
"child": [{
"id": '141',
"name": "领域算法分析",
"desc": "领域算法分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
}
],
analysisResult:[],
}
},
mounted() {
this.initdata();
this.getAnalysisResult();
},
methods: {
uploadForm,
initdata() {
this.project = this.$route.query;
console.log(this.project)
this.getDataInfo()
},
getDataInfo() {
this.args = []
let params = {
"fId": this.project.fId,
"name": this.project.name
}
readFile(params).then(res => {
console.log(res)
this.AHPSimpleHeader = res.data.header;
this.AHPSimpletableData = res.data.data;
}).catch(err => {
console.log(err)
})
getDataHeader(params).then(res => {
let temp = res.data.header;
this.algoAllHeader = temp
for (let entry in temp) {
let obj = {
"name": temp[entry]
}
this.args.push(obj)
}
}).catch(err => {
console.log(err)
})
},
createAnalysisResult(selectAlgo,algoRes){
let args = this.choose_args1.concat(this.choose_args2).concat(this.choose_args3)
let names = selectAlgo.name
args.forEach(function(item) {
let name = item.name;
names = names +"_" + name;
});
let params = {
"name": names,
"userId": '',
"type": selectAlgo.component,
"result": algoRes
}
createAnalysisResult(params).then(res => {
this.getAnalysisResult()
}).catch(err => {
console.log(err)
})
},
getAnalysisResult(){
getAnalysisResult().then(res => {
this.hasAnalysisResult = true
this.analysisResult = res.data;
}).catch(err => {
console.log(err)
})
},
useAlgo(algo) {
console.log("选择算法")
console.log(algo)
this.selectAlgo = algo;
this.hasResult = false;
},
getAnalysisResultDetail(item){
this.hasResult = true;
this.selectAlgo={
"name": item.name,
"component": item.type
}
this.algoRes = item.result;
},
runCommon() {
let params = {
"name": this.project.fileName,
"fId": this.project.fId,
"algo": this.selectAlgo.algo,
"ar": JSON.stringify(this.choose_args)
}
runAlgo(params).then(res => {
console.log("算法执行结果")
console.log(res)
this.hasResult = true
this.algoRes = JSON.parse(res.data.res);
}).catch(err => {
console.log(err)
})
return this.algoRes
},
runDEA() {
//this.choose_args1 = {aa:'aaa'}
// let params = {
// "name": this.project.name,
// "fId": this.project.fId,
// "args_x": JSON.stringify(this.choose_args1),
// "args_y": JSON.stringify(this.choose_args2),
// "args_z": JSON.stringify(this.choose_args3),
// }
let params = {
'type':this.chooseDEA
}
getDEAList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
}).catch(err => {
console.log(err)
})
},
runAHPSimple(){
this.args = []
let params = {
"fileName": this.project.fileName
}
getAHPList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
})
},
runTOPSIS(){
let index = this.choose_args3
if(index.length>0)
index = index[0]['name'].replace("\ufeff", "");
else
index = ""
let params = {
"fileName": this.project.fileName,
"positive": this.getArrayObjectStrValue(this.choose_args1),
"negative": this.getArrayObjectStrValue(this.choose_args2),
"index":index
}
getTOPSISList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
})
},
runRSR(){
let index = this.choose_args3
if(index.length>0)
index = index[0]['name'].replace("\ufeff", "");
else
index = ""
let params = {
"fileName": this.project.fileName,
"positive": this.getArrayObjectStrValue(this.choose_args1),
"negative": this.getArrayObjectStrValue(this.choose_args2),
"index":index,
'weight_type':this.chooseRSRVariableWeight,
'rank_make_method':this.chooseRankingMethod,
'number_bins':this.chooseQuantitiesCategory
}
getRSRList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes,this.choose_args1,this.choose_args2,this.choose_args3)
})
},
run() {
if(this.selectAlgo.key == "DEA") {
this.runDEA();
} else if(this.selectAlgo.key == "AHPSimple"){
this.runAHPSimple();
} else if(this.selectAlgo.key == "TOPSIS"){
this.runTOPSIS();
}else if(this.selectAlgo.key == "RSR"){
this.runRSR();
}
else {
this.runCommon();
}
},
cloneItem: function (val) {
// 深复制一个节点
return JSON.parse(JSON.stringify(val))
},
dragItem: function (widget) {
console.log(widget);
},
addItem: function (widget) {
console.log(widget);
},
delEntry1(item) {
this.choose_args1 = this.choose_args1.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry2(item) {
this.choose_args2 = this.choose_args2.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry3(item) {
this.choose_args3 = this.choose_args3.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry(item) {
this.choose_args = this.choose_args.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
getArrayObjectStrValue(myArray){
// 或使用forEach方法
let values = []
myArray.forEach(function(item) {
let name = item.name.replace("\ufeff", "");
values.push(name)
});
return JSON.stringify(values);
}
}
}
</script>
<style scoped>
.index-container {
height: 100%;
}
.result_list .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-algo .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-args .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
}
.body .entry:hover {
cursor: pointer;
background: rgb(240, 255, 254);
}
.algo-item:hover {
cursor: pointer;
background: rgb(246, 255, 254);
}
.active-item {
background: rgb(228, 228, 228);
}
.mdc_right {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
}
.mdc_right>div {
height: 28px;
line-height: 28px;
margin-top: 6px;
/* border: 1px solid #CCCCCC; */
cursor: move;
margin: 5px 20px;
}
.mdc_right>div:hover {
background: #e6e6e6;
/* box-shadow: 1px 2px 4px #CCCCCC; */
}
.mdc_right>div>span {
display: inline-block;
vertical-align: top;
}
.mdc_right>div>span>img {
height: 30px;
}
.del-entry:hover {
color: red;
cursor: pointer;
}
</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: '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 @@
</el-collapse-item>
<el-collapse-item title="数据指标" name="1">
<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>
</div>
<div style="margin-top:2px;margin-left: 40%;">
......@@ -46,7 +46,7 @@
</el-collapse>
</div>
<div class="right">
<div class="entry" style="height:35%;">
<div class="header" style="">指标</div>
<div class="body">
......@@ -83,7 +83,7 @@
</div>
<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;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 style="flex:1;background:white;overflow: scroll;">
......@@ -110,17 +110,17 @@
</div>
</div>
<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>
</template>
<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 VabChart from '@/plugins/echarts'
export default {
......@@ -137,7 +137,7 @@
},
activeNames: "1",
idxData: [],
defaultProps: {
children: 'children',
label: 'name'
......@@ -185,8 +185,8 @@
},
methods: {
handleNodeClick() {
handleNodeClick(obj) {
this.checkDataTitle(obj)
},
init() {
this.getAllYear();
......@@ -206,9 +206,14 @@
checkNode(obj, dList) {
console.log(obj);
console.log(dList)
this.condition.dataCondition = dList.checkedNodes.filter(item => {
return item.level == 3;
})
// if(obj.checked) {
// this.condition.dataCondition.push(obj)
// }else{
this.condition.dataCondition = dList.checkedNodes.filter(item => {
return item.level == 3;
})
// }
this.selectData()
},
getAllIndustry() {
this.industry = []
......@@ -277,40 +282,45 @@
this.condition.dataCondition = this.condition.dataCondition.filter(function (item) {
return item.name != obj.name;
});
console.log(this.condition.dataCondition)
}
},
checkAddress(obj) {
console.log(obj)
if(obj.checked) {
this.condition.address.push(obj)
this.condition.address.push(obj);
}
else {
this.condition.address = this.condition.address.filter(function (item) {
return item.name != obj.name;
return item.name != obj.name;
});
}
this.selectAddr();
},
checkYear(obj) {
console.log(obj)
if(obj.checked) {
this.condition.years.push(obj)
this.condition.years.push(obj);
}
else {
this.condition.years = this.condition.years.filter(function (item) {
return item.year != obj.year;
});
}
this.selectYear()
},
checkIndustry(obj) {
console.log(obj)
if(obj.checked) {
this.condition.industry.push(obj)
this.condition.industry.push(obj);
}
else {
this.condition.industry = this.condition.industry.filter(function (item) {
return item.name != obj.name;
});
}
this.selectIndustry();
},
selectIndustry() {
......@@ -328,7 +338,14 @@
address: [],
years: [],
industry: []
},
this.condition ={
dataCondition: [],
address: [],
years: [],
industry: []
}
this.$refs.tree.setCheckedKeys([])
},
toShowData() {
this.$nextTick(() => {
......@@ -347,13 +364,29 @@
showDate() {
this.saveFileName = '';
// 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;
console.log(res)
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.saveFileName = res.data.tempFile
// this.saveFileName = res.data.tempFile
this.saveFlag = false;
// this.initResultMap()
}).catch(err => {
......@@ -361,6 +394,16 @@
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() {
},
......@@ -372,7 +415,7 @@
}).then(({ value }) => {
this.saveDate(value)
}).catch(() => {
});
}
},
......@@ -386,7 +429,7 @@
this.$message({
type: 'info',
message: '保存成功'
});
});
this.saveFileName = '';
this.saveFlag = true;
}).catch(err => {
......@@ -458,7 +501,7 @@
height: 40px;
line-height: 40px;
font-weight: 600;
background: #00977eb8;
background: #358FD4;
border-radius: 2px;
}
.right .btn:hover {
......@@ -478,4 +521,4 @@
height: 41px;
line-height: 41px;
}
</style>
\ No newline at end of file
</style>
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