首页图表开发

master
wangbing 4 years ago
parent 711621a6e9
commit c1d31e9dc0

@ -648,7 +648,7 @@ public class SpringBootCallable implements Callable {
File css = Tool.createPath(static_, "css");
File img = Tool.createPath(static_, "img");
File dist = Tool.createPath(static_, "dist");
File echarts = Tool.createPath(static_, "echarts");
File echarts = Tool.createPath(dist, "echarts");
Tool.outputResource("SpringBoot/resources/static/favicon.ico", Tool.createFile(static_, "favicon.ico"));
//css文件
@ -666,7 +666,7 @@ public class SpringBootCallable implements Callable {
//element-ui
Tool.outputResource("SpringBoot/resources/static/dist/echarts/echarts.js", Tool.createFile(echarts, "echarts.js"));
Tool.outputResource("SpringBoot/resources/static/dist/echarts/echarts.min.js", Tool.createFile(echarts, "echarts.min.css"));
Tool.outputResource("SpringBoot/resources/static/dist/echarts/echarts.min.js", Tool.createFile(echarts, "echarts.min.js"));
File fonts = Tool.createPath(dist, "fonts");
// Tool.outputResource("SpringBoot/resources/static/dist/fonts/w-e-icon.woff", Tool.createFile(fonts, "w-e-icon.woff"));

@ -0,0 +1,35 @@
package ${domain}.action.ajax.wsys;
import org.springframework.beans.factory.annotation.Autowired;
import ${domain}.frame.auth.LocalData;
import ${domain}.module.wsys.mgr.DataManager;
import ${domain}.module.wsys.req.DataErrorRequest;
import ${domain}.module.wsys.req.DataLoginRequest;
import ${domain}.module.wsys.req.DataTaskRequest;
import ${domain}.module.wsys.req.DataTotalRequest;
import ${domain}.module.wsys.rsp.DataErrorResponse;
import ${domain}.module.wsys.rsp.DataLoginResponse;
import ${domain}.module.wsys.rsp.DataTaskResponse;
import ${domain}.module.wsys.rsp.DataTotalResponse;
public class DataAjax {
@Autowired
private DataManager dataManager;
public DataTotalResponse total(DataTotalRequest request) {
return dataManager.total(request, LocalData.getToken());
}
public DataLoginResponse login(DataLoginRequest request) {
return dataManager.login(request, LocalData.getToken());
}
public DataErrorResponse error(DataErrorRequest request) {
return dataManager.error(request, LocalData.getToken());
}
public DataTaskResponse task(DataTaskRequest request) {
return dataManager.task(request, LocalData.getToken());
}
}

@ -0,0 +1,25 @@
package ${domain}.frame.validation;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = NumberValidator.class)
@Inherited
public @interface Number {
String message() default "字段长度不符合";
int min() default 0;
int max() default 2147483647;
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}

@ -0,0 +1,48 @@
package ${domain}.frame.validation;
import org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorContextImpl;
import ${domain}.frame.utils.StringUtil;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.Locale;
public class NumberValidator implements ConstraintValidator<Number, Integer> {
private int min;
private int max;
private String defaultMessage;
@Override
public void initialize(Number constraint) {
min = constraint.min();
max = constraint.max();
}
@Override
public boolean isValid(Integer o, ConstraintValidatorContext constraintValidatorContext) {
String fieldName = "";
if (constraintValidatorContext instanceof ConstraintValidatorContextImpl) {
ConstraintValidatorContextImpl validatorContext = (ConstraintValidatorContextImpl) constraintValidatorContext;
if (validatorContext.getConstraintViolationCreationContexts() != null
&& validatorContext.getConstraintViolationCreationContexts().size() > 0
&& validatorContext.getConstraintViolationCreationContexts().get(0).getPath() != null) {
fieldName = validatorContext.getConstraintViolationCreationContexts().get(0).getPath().asString();
}
}
if (o < min) {
constraintValidatorContext.disableDefaultConstraintViolation();
String message = StringUtil.isNotEmpty(defaultMessage) ? defaultMessage : String.format(Locale.CHINESE, "[ %s ] 最小值为%d", fieldName, min);
constraintValidatorContext.buildConstraintViolationWithTemplate(message).addConstraintViolation();
return false;
} else if (o > max) {
constraintValidatorContext.disableDefaultConstraintViolation();
String message = StringUtil.isNotEmpty(defaultMessage) ? defaultMessage : String.format(Locale.CHINESE, "[ %s ] 最大值为%d", fieldName, max);
constraintValidatorContext.buildConstraintViolationWithTemplate(message).addConstraintViolation();
return false;
} else {
return true;
}
}
}

@ -0,0 +1,29 @@
package ${domain}.module.wsys.ent;
/**
* DataCount -
*
* @author wangbing
* @version 0.0.1
* @since 2020-11-15
*/
public class DataCount {
private String date;
private int count;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}

@ -0,0 +1,61 @@
package ${domain}.module.wsys.ent;
/**
* DataTotal -
*
* @author wangbing
* @version 0.0.1
* @since 2020-11-15
*/
public class DataTotal {
// 用户总数
private int userAll;
// 用户在线数
private int userLine;
// 机构总数
private int deptAll;
// 故障未处理数
private int errorUn;
// 故障总数
private int errorAll;
public int getUserAll() {
return userAll;
}
public void setUserAll(int userAll) {
this.userAll = userAll;
}
public int getUserLine() {
return userLine;
}
public void setUserLine(int userLine) {
this.userLine = userLine;
}
public int getDeptAll() {
return deptAll;
}
public void setDeptAll(int deptAll) {
this.deptAll = deptAll;
}
public int getErrorUn() {
return errorUn;
}
public void setErrorUn(int errorUn) {
this.errorUn = errorUn;
}
public int getErrorAll() {
return errorAll;
}
public void setErrorAll(int errorAll) {
this.errorAll = errorAll;
}
}

@ -0,0 +1,29 @@
package ${domain}.module.wsys.mgr;
import ${domain}.frame.auth.Token;
import ${domain}.module.wsys.req.DataErrorRequest;
import ${domain}.module.wsys.req.DataLoginRequest;
import ${domain}.module.wsys.req.DataTaskRequest;
import ${domain}.module.wsys.req.DataTotalRequest;
import ${domain}.module.wsys.rsp.DataErrorResponse;
import ${domain}.module.wsys.rsp.DataLoginResponse;
import ${domain}.module.wsys.rsp.DataTaskResponse;
import ${domain}.module.wsys.rsp.DataTotalResponse;
/**
*
*
* @author author
* @version 0.0.1
* @since 2017-01-01
*/
public interface DataManager {
DataTotalResponse total(DataTotalRequest request, Token token);
DataLoginResponse login(DataLoginRequest request, Token token);
DataErrorResponse error(DataErrorRequest request, Token token);
DataTaskResponse task(DataTaskRequest request, Token token);
}

@ -0,0 +1,176 @@
package ${domain}.module.wsys.mgr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ${domain}.frame.auth.Token;
import ${domain}.frame.base.ErrorType;
import ${domain}.frame.base.SortType;
import ${domain}.frame.utils.ValidationUtil;
import ${domain}.module.wsys.ent.DataCount;
import ${domain}.module.wsys.ent.DataTotal;
import ${domain}.module.wsys.ent.Logtask;
import ${domain}.module.wsys.mpr.DataMapper;
import ${domain}.module.wsys.req.DataErrorRequest;
import ${domain}.module.wsys.req.DataLoginRequest;
import ${domain}.module.wsys.req.DataTaskRequest;
import ${domain}.module.wsys.req.DataTotalRequest;
import ${domain}.module.wsys.req.LogtaskFindRequest;
import ${domain}.module.wsys.rsp.DataErrorResponse;
import ${domain}.module.wsys.rsp.DataLoginResponse;
import ${domain}.module.wsys.rsp.DataTaskResponse;
import ${domain}.module.wsys.rsp.DataTotalResponse;
import ${domain}.module.wsys.rsp.LogtaskFindResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* TOKENS -
*
* @author author
* @version 0.0.1
* @since 2017-01-01
*/
@Transactional
@Service
public class DataManagerImpl implements DataManager {
@Autowired
private DataMapper dataMapper;
@Autowired
private LogtaskManager logtaskManager;
@Override
public DataTotalResponse total(DataTotalRequest request, Token token) {
DataTotalResponse response = new DataTotalResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
DataTotal dataTotal = dataMapper.total(request, token);
response.setDataTotal(dataTotal);
return response;
}
@Override
public DataLoginResponse login(DataLoginRequest request, Token token) {
DataLoginResponse response = new DataLoginResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
SimpleDateFormat simpleDateFormat1 = null;
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
try {
simpleDateFormat1 = new SimpleDateFormat(request.getFormat());
} catch (Exception e) {
response.addError(ErrorType.BUSINESS_ERROR, "日期格式化表达式错误");
return response;
}
List<Map<String, String>> list = new ArrayList<>();
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
if (request.isToday()) {
Map<String, String> datas = new HashMap<>();
datas.put("date1", simpleDateFormat1.format(instance.getTime()));
datas.put("date2", simpleDateFormat2.format(instance.getTime()));
list.add(datas);
}
while (list.size() < request.getDays()) {
instance.add(Calendar.DAY_OF_MONTH, -1);
Map<String, String> datas = new HashMap<>();
datas.put("date1", simpleDateFormat1.format(instance.getTime()));
datas.put("date2", simpleDateFormat2.format(instance.getTime()));
list.add(datas);
}
List<DataCount> result = dataMapper.login(list, token);
response.setResult(result);
return response;
}
@Override
public DataErrorResponse error(DataErrorRequest request, Token token) {
DataErrorResponse response = new DataErrorResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
SimpleDateFormat simpleDateFormat1 = null;
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd");
try {
simpleDateFormat1 = new SimpleDateFormat(request.getFormat());
} catch (Exception e) {
response.addError(ErrorType.BUSINESS_ERROR, "日期格式化表达式错误");
return response;
}
List<Map<String, String>> list = new ArrayList<>();
Calendar instance = Calendar.getInstance();
instance.setTime(new Date());
if (request.isToday()) {
Map<String, String> datas = new HashMap<>();
datas.put("date1", simpleDateFormat1.format(instance.getTime()));
datas.put("date2", simpleDateFormat2.format(instance.getTime()));
list.add(datas);
}
while (list.size() < request.getDays()) {
instance.add(Calendar.DAY_OF_MONTH, -1);
Map<String, String> datas = new HashMap<>();
datas.put("date1", simpleDateFormat1.format(instance.getTime()));
datas.put("date2", simpleDateFormat2.format(instance.getTime()));
list.add(datas);
}
List<DataCount> result = dataMapper.error(list, token);
response.setResult(result);
return response;
}
@Override
public DataTaskResponse task(DataTaskRequest request, Token token) {
DataTaskResponse response = new DataTaskResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
LogtaskFindRequest logtaskFindRequest = new LogtaskFindRequest();
logtaskFindRequest.setSortType(SortType.ASC);
logtaskFindRequest.setSortKey("CREATE_TIME");
logtaskFindRequest.setPageSize(100);
LogtaskFindResponse logtaskFindResponse = logtaskManager.find(logtaskFindRequest, token);
if (logtaskFindResponse.hasError()) {
response.addErrors(logtaskFindResponse.getErrors());
return response;
}
List<DataCount> result = new ArrayList<>();
response.setResult(result);
int countSuccess = 0;
for (Logtask logtask : logtaskFindResponse.getResult()) {
DataCount dataCount = new DataCount();
dataCount.setDate("");
dataCount.setCount(logtask.getExecTime());
if ("1".equals(logtask.getExecState())) {
countSuccess++;
}
result.add(dataCount);
}
response.setCountSuceess(countSuccess);
response.setCountFailed(logtaskFindResponse.getResult().size() - countSuccess);
return response;
}
}

@ -0,0 +1,49 @@
package ${domain}.module.wsys.mpr;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import ${domain}.frame.auth.Token;
import ${domain}.module.wsys.ent.DataCount;
import ${domain}.module.wsys.ent.DataTotal;
import ${domain}.module.wsys.req.DataTaskRequest;
import ${domain}.module.wsys.req.DataTotalRequest;
import java.util.List;
import java.util.Map;
/**
*
*
* @author wangbing
* @since 2020-06-27
*/
@Mapper
public interface DataMapper {
/**
*
*
* @param request
* @param token
* @return
*/
DataTotal total(@Param("request") DataTotalRequest request, @Param("token") Token token);
/**
*
*
* @param list
* @param token
* @return
*/
List<DataCount> login(@Param("list") List<Map<String, String>> list, @Param("token") Token token);
/**
*
*
* @param list
* @param token
* @return
*/
List<DataCount> error(@Param("list") List<Map<String, String>> list, @Param("token") Token token);
}

@ -0,0 +1,31 @@
<?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="${domain}.module.wsys.mpr.DataMapper">
<select id="total" resultType="${domain}.module.wsys.ent.DataTotal">
SELECT
( SELECT COUNT( 1 ) + 1 FROM SYS_USER WHERE IS_DELETED = 0 AND USER_STATUS = '0' ) USER_ALL,
( SELECT COUNT( 1 ) FROM SYS_TOKENS WHERE IS_DELETED = 0 AND VALID = '1' ) USER_LINE,
( SELECT COUNT( 1 ) FROM SYS_DEPT WHERE IS_DELETED = 0 ) DEPT_ALL,
( SELECT COUNT( 1 ) FROM SYS_LOGERR WHERE IS_DELETED = 0 AND LOG_STATE = '0' ) ERROR_UN,
( SELECT COUNT( 1 ) FROM SYS_LOGERR WHERE IS_DELETED = 0 ) ERROR_ALL
</select>
<select id="login" resultType="${domain}.module.wsys.ent.DataCount">
SELECT * FROM
<foreach collection="list" item="item" index="index" open="(" close=")" separator="UNION ALL">
SELECT ${r'#'}{item.date1} "DATE",COUNT(1) "COUNT" FROM SYS_TOKENS WHERE date(LOGIN_TIME/1000,'unixepoch') = ${r'#'}{item.date2}
</foreach>
ORDER BY DATE
</select>
<select id="error" resultType="${domain}.module.wsys.ent.DataCount">
SELECT * FROM
<foreach collection="list" item="item" index="index" open="(" close=")" separator="UNION ALL">
SELECT ${r'#'}{item.date1} "DATE",COUNT( 1 ) "COUNT" FROM SYS_LOGERR WHERE date(CREATE_TIME) = ${r'#'}{item.date2}
</foreach>
ORDER BY DATE
</select>
</mapper>

@ -0,0 +1,46 @@
package ${domain}.module.wsys.req;
import ${domain}.frame.base.BaseFindRequest;
import ${domain}.frame.validation.Number;
/**
* TokensLogoutRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class DataErrorRequest extends BaseFindRequest {
// 日期格式化;默认yyyy-MM-dd
private String format = "yyyy-MM-dd";
// 统计天数
@Number(min = 1, max = 366, message = "统计天数最少为1天,最大为366天")
private int days;
// 是否包含今天
private boolean today;
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
public boolean isToday() {
return today;
}
public void setToday(boolean today) {
this.today = today;
}
}

@ -0,0 +1,46 @@
package ${domain}.module.wsys.req;
import ${domain}.frame.base.BaseFindRequest;
import ${domain}.frame.validation.Number;
/**
* TokensLogoutRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class DataLoginRequest extends BaseFindRequest {
// 日期格式化;默认yyyy-MM-dd
private String format = "yyyy-MM-dd";
// 统计天数
@Number(min = 1, max = 366, message = "统计天数最少为1天,最大为366天")
private int days;
// 是否包含今天
private boolean today;
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
public boolean isToday() {
return today;
}
public void setToday(boolean today) {
this.today = today;
}
}

@ -0,0 +1,14 @@
package ${domain}.module.wsys.req;
import ${domain}.frame.base.BaseFindRequest;
/**
* DataTaskRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class DataTaskRequest extends BaseFindRequest {
}

@ -0,0 +1,14 @@
package ${domain}.module.wsys.req;
import ${domain}.frame.base.BaseRequest;
/**
* DataTotalRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class DataTotalRequest extends BaseRequest {
}

@ -0,0 +1,7 @@
package ${domain}.module.wsys.rsp;
import ${domain}.frame.base.BaseFindResponse;
import ${domain}.module.wsys.ent.DataCount;
public class DataErrorResponse extends BaseFindResponse<DataCount> {
}

@ -0,0 +1,7 @@
package ${domain}.module.wsys.rsp;
import ${domain}.frame.base.BaseFindResponse;
import ${domain}.module.wsys.ent.DataCount;
public class DataLoginResponse extends BaseFindResponse<DataCount> {
}

@ -0,0 +1,25 @@
package ${domain}.module.wsys.rsp;
import ${domain}.frame.base.BaseFindResponse;
import ${domain}.module.wsys.ent.DataCount;
public class DataTaskResponse extends BaseFindResponse<DataCount> {
private int countSuceess;
private int countFailed;
public int getCountSuceess() {
return countSuceess;
}
public void setCountSuceess(int countSuceess) {
this.countSuceess = countSuceess;
}
public int getCountFailed() {
return countFailed;
}
public void setCountFailed(int countFailed) {
this.countFailed = countFailed;
}
}

@ -0,0 +1,17 @@
package ${domain}.module.wsys.rsp;
import ${domain}.frame.base.BaseResponse;
import ${domain}.module.wsys.ent.DataTotal;
public class DataTotalResponse extends BaseResponse {
private DataTotal dataTotal;
public DataTotal getDataTotal() {
return dataTotal;
}
public void setDataTotal(DataTotal dataTotal) {
this.dataTotal = dataTotal;
}
}

@ -4,6 +4,8 @@
<title>${title?default("首页")}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="${context}/static/dist/lib.min.js" type="text/javascript"></script>
<script src="${context}/static/dist/index.min.js" type="text/javascript"></script>
<link href="${context}/static/dist/index.min.css" rel="stylesheet"/>
<script src="${context}/static/dist/echarts/echarts.min.js" type="text/javascript"></script>
<link href="${context}/static/css/base.css" rel="stylesheet"/>
</head>

@ -10,27 +10,34 @@
d="M515.776 537.472c-216.64 0-216.64-322.56-216.64-322.56S299.136 0 515.776 0s216.64 214.912 216.64 214.912S732.352 537.472 515.776 537.472L515.776 537.472z"
p-id="2846" fill="#ffffff"></path></svg>
</span>
<span class="count">3300</span>
<span class="count">{{dataTotal.userAll}}</span>
<span class="info">用户人数</span>
</div>
<div class="total">
<span class="icon" style="background-color: #e46bbd">
<svg t="1605239338109" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="2844" width="48" height="48">
xmlns="http://www.w3.org/2000/svg"
p-id="2844" width="48" height="48">
<path d="M945.344 1022.912 78.72 1022.912c0 0-108.288-439.04 433.28-439.04C1053.632 583.872 945.344 1022.912 945.344 1022.912L945.344 1022.912z"
p-id="2845" fill="#ffffff"></path>
<path d="M515.776 537.472c-216.64 0-216.64-322.56-216.64-322.56S299.136 0 515.776 0s216.64 214.912 216.64 214.912S732.352 537.472 515.776 537.472L515.776 537.472z"
p-id="2846" fill="#ffffff"></path></svg>
</span>
<span class="count">3300</span>
<span class="count">{{dataTotal.userLine}}</span>
<span class="info">在线人数</span>
</div>
<div class="total">
<span class="icon" style="background-color: #1cbd6b">
<svg t="1605509613034" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4787" width="48" height="48"><path d="M274.4 404.7v-4.8c0-19.3 15.5-35.1 34.4-35.1h27.5c18.9 0 34.4 15.8 34.4 35.1v5.1c0 19.4 4.8 21.2 23.7 21.2h239.4c17.5 0 19.2-2.4 19.2-18.6v-7.8c0-19.3 15.5-35.1 34.4-35.1H714c18.9 0 34.4 15.8 34.4 35.1v6.1c0 17.3 5.8 20.2 22.6 20.2h132.1c17.9 0 23-4.9 23-22.4v-39.2c0-38.6-30.9-70.2-68.7-70.2H166.7c-37.8 0-68.7 31.6-68.7 70.2v36.8c0 19.8 5.7 24.8 26.9 24.8h124.8c20 0.1 24.7-2.1 24.7-21.4z m0 0" fill="#ffffff" p-id="4788"></path><path d="M348.5 475.6c0 18.9-11.5 34.4-25.7 34.4s-25.7-15.5-25.7-34.4v-42.2c0-18.9 11.5-34.4 25.7-34.4s25.7 15.5 25.7 34.4v42.2z m0 0M724 477.5c0 18.9-11.5 34.4-25.7 34.4s-25.7-15.5-25.7-34.4v-42.2c0-18.9 11.5-34.4 25.7-34.4 14.1 0 25.7 15.5 25.7 34.4v42.2z m0 0M367.7 257.7c22-59.7 78.5-102.1 144.6-102.1s122.6 42.5 144.6 102.1c0 0 4.7 19.7 31.9 19.7 27.3 0 27.2-19.7 27.2-19.7C692.1 165.7 610 98 512.4 98s-179.7 67.7-203.8 159.7c0 0-1.5 17.2 26.7 17.2s32.4-17.2 32.4-17.2z m0 0" fill="#ffffff" p-id="4789"></path><path d="M904.9 478.8h-133c-18.5 0-23.5 3.2-23.5 18.9v7.5c0 19.3-15.5 35.1-34.4 35.1h-26.2c-18.9 0-34.4-15.8-34.4-35.1v-4.5c0-4.9-0.4-8.7-1.4-11.7-1.9-7.7-7.1-10.1-18.7-10.1H390.7c-11.6 0-16.8 2.4-18.7 10.1-1 3-1.4 6.8-1.4 11.7v4.5c0 19.3-15.5 35.1-34.4 35.1H310c-18.9 0-34.4-15.8-34.4-35.1v-7.5c0-15.7-5-18.9-23.5-18.9h-133c-14.5 0-21.2 5.3-21.2 21v356c0 38.6 30.9 70.2 68.7 70.2h690.5c37.8 0 68.7-31.6 68.7-70.2v-356c0.2-15.7-6.4-21-20.9-21z" fill="#ffffff" p-id="4790"></path></svg>
<svg t="1605509613034" class="icon" viewBox="0 0 1024 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="4787" width="48" height="48"><path
d="M274.4 404.7v-4.8c0-19.3 15.5-35.1 34.4-35.1h27.5c18.9 0 34.4 15.8 34.4 35.1v5.1c0 19.4 4.8 21.2 23.7 21.2h239.4c17.5 0 19.2-2.4 19.2-18.6v-7.8c0-19.3 15.5-35.1 34.4-35.1H714c18.9 0 34.4 15.8 34.4 35.1v6.1c0 17.3 5.8 20.2 22.6 20.2h132.1c17.9 0 23-4.9 23-22.4v-39.2c0-38.6-30.9-70.2-68.7-70.2H166.7c-37.8 0-68.7 31.6-68.7 70.2v36.8c0 19.8 5.7 24.8 26.9 24.8h124.8c20 0.1 24.7-2.1 24.7-21.4z m0 0"
fill="#ffffff" p-id="4788"></path><path
d="M348.5 475.6c0 18.9-11.5 34.4-25.7 34.4s-25.7-15.5-25.7-34.4v-42.2c0-18.9 11.5-34.4 25.7-34.4s25.7 15.5 25.7 34.4v42.2z m0 0M724 477.5c0 18.9-11.5 34.4-25.7 34.4s-25.7-15.5-25.7-34.4v-42.2c0-18.9 11.5-34.4 25.7-34.4 14.1 0 25.7 15.5 25.7 34.4v42.2z m0 0M367.7 257.7c22-59.7 78.5-102.1 144.6-102.1s122.6 42.5 144.6 102.1c0 0 4.7 19.7 31.9 19.7 27.3 0 27.2-19.7 27.2-19.7C692.1 165.7 610 98 512.4 98s-179.7 67.7-203.8 159.7c0 0-1.5 17.2 26.7 17.2s32.4-17.2 32.4-17.2z m0 0"
fill="#ffffff" p-id="4789"></path><path
d="M904.9 478.8h-133c-18.5 0-23.5 3.2-23.5 18.9v7.5c0 19.3-15.5 35.1-34.4 35.1h-26.2c-18.9 0-34.4-15.8-34.4-35.1v-4.5c0-4.9-0.4-8.7-1.4-11.7-1.9-7.7-7.1-10.1-18.7-10.1H390.7c-11.6 0-16.8 2.4-18.7 10.1-1 3-1.4 6.8-1.4 11.7v4.5c0 19.3-15.5 35.1-34.4 35.1H310c-18.9 0-34.4-15.8-34.4-35.1v-7.5c0-15.7-5-18.9-23.5-18.9h-133c-14.5 0-21.2 5.3-21.2 21v356c0 38.6 30.9 70.2 68.7 70.2h690.5c37.8 0 68.7-31.6 68.7-70.2v-356c0.2-15.7-6.4-21-20.9-21z"
fill="#ffffff" p-id="4790"></path></svg>
</span>
<span class="count">3300</span>
<span class="count">{{dataTotal.deptAll}}</span>
<span class="info">部门总数</span>
</div>
<div class="total">
@ -40,7 +47,7 @@
d="M230.065 736.146L169.78 748.77 61.495 911.958l20.386 20.275 20.386 20.306 164.414-107.588 12.774-59.85 135.22-134.324-49.265-49.017-135.345 134.386z m589.641-614.423c5.666-5.683 14.983-5.683 20.706 0 5.792 5.687 5.792 14.931 0 20.586l-237.217 235.6 36.999 36.767L877.35 179.078c5.788-5.716 15.04-5.716 20.758 0a14.361 14.361 0 0 1 0 20.585L660.895 435.227l33.22 32.961c0.568-0.529 1.136-0.84 1.703-1.439l25.103-24.9v0.035l201.1-199.676c40.15-39.824 40.15-104.364 0-144.163-40.08-39.824-105.137-39.856-145.227 0L576.957 296.376l-26.364 26.213c-0.505 0.592-0.886 1.215-1.387 1.744l33.165 33.02 237.335-235.63zM478.105 312.652c3.396-18.587 4.275-37.545 2.577-56.293-4.216-46.419-24.162-91.716-59.904-127.226C359.3 68.151 269.07 53.375 193.566 84.673L315.574 205.69c18.307 18.278 18.374 47.896-0.066 66.198l-50.904 50.48c-18.31 18.209-48.193 18.272-66.444 0L78.856 203.911c-27.117 73.163-11.262 158.38 47.889 217.11 32.4 32.11 72.74 51.19 114.704 57.725a211.463 211.463 0 0 0 60.032 0.627C428.396 605.483 741.82 916.672 741.82 916.672c47.56 47.14 124.834 47.14 172.341 0 22.964-22.831 35.679-53.162 35.679-85.43 0-32.366-12.715-62.795-35.741-85.626L478.105 312.652z m398.55 566.723c-24.852 24.652-64.936 24.652-89.85 0.064-24.666-24.554-24.666-64.54 0.063-89.094 24.851-24.486 64.935-24.553 89.727 0 24.855 24.554 24.791 64.54 0.06 89.03z"
p-id="4248" fill="#ffffff"></path></svg>
</span>
<span class="count">3300</span>
<span class="count">{{dataTotal.errorUn}}</span>
<span class="info">故障未处理</span>
</div>
<div class="total">
@ -50,7 +57,7 @@
d="M230.065 736.146L169.78 748.77 61.495 911.958l20.386 20.275 20.386 20.306 164.414-107.588 12.774-59.85 135.22-134.324-49.265-49.017-135.345 134.386z m589.641-614.423c5.666-5.683 14.983-5.683 20.706 0 5.792 5.687 5.792 14.931 0 20.586l-237.217 235.6 36.999 36.767L877.35 179.078c5.788-5.716 15.04-5.716 20.758 0a14.361 14.361 0 0 1 0 20.585L660.895 435.227l33.22 32.961c0.568-0.529 1.136-0.84 1.703-1.439l25.103-24.9v0.035l201.1-199.676c40.15-39.824 40.15-104.364 0-144.163-40.08-39.824-105.137-39.856-145.227 0L576.957 296.376l-26.364 26.213c-0.505 0.592-0.886 1.215-1.387 1.744l33.165 33.02 237.335-235.63zM478.105 312.652c3.396-18.587 4.275-37.545 2.577-56.293-4.216-46.419-24.162-91.716-59.904-127.226C359.3 68.151 269.07 53.375 193.566 84.673L315.574 205.69c18.307 18.278 18.374 47.896-0.066 66.198l-50.904 50.48c-18.31 18.209-48.193 18.272-66.444 0L78.856 203.911c-27.117 73.163-11.262 158.38 47.889 217.11 32.4 32.11 72.74 51.19 114.704 57.725a211.463 211.463 0 0 0 60.032 0.627C428.396 605.483 741.82 916.672 741.82 916.672c47.56 47.14 124.834 47.14 172.341 0 22.964-22.831 35.679-53.162 35.679-85.43 0-32.366-12.715-62.795-35.741-85.626L478.105 312.652z m398.55 566.723c-24.852 24.652-64.936 24.652-89.85 0.064-24.666-24.554-24.666-64.54 0.063-89.094 24.851-24.486 64.935-24.553 89.727 0 24.855 24.554 24.791 64.54 0.06 89.03z"
p-id="4248" fill="#ffffff"></path></svg>
</span>
<span class="count">3300</span>
<span class="count">{{dataTotal.errorAll}}</span>
<span class="info">故障总数</span>
</div>
</div>
@ -130,213 +137,278 @@
var app = new Vue({
mixins: [mixin],
el: "#app",
data: {},
data: {
dataTotal: {}
},
methods: {
initTotalCount: function () {
new Ajax("wsys", "data", "total").post({}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
this.dataTotal = response.dataTotal;
}
}.bind(this))
},
initLoginChart: function () {
var loginChart = echarts.init(document.getElementById('LoginChart'));
var option = {
title: {
text: '周登录情况',
subtext: '折线图',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
new Ajax("wsys", "data", "login").post({
"days": 7,
"today": false,
"format": "MM月dd日"
}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
var date = [];
var data = [];
for (var i = 0; i < response.result.length; i++) {
var obj = response.result[i];
date.push(obj.date)
data.push(obj.count)
}
},
xAxis: {
type: 'category',
name: '日期',
axisTick: false,
axisLabel: {
interval: 0,
fontSize: 11
},
boundaryGap: false,
data: ['11月07日', '11月08日', '11月09日', '11月10日', '11月11日', '11月12日', '11月13日']
},
yAxis: {
type: 'value',
name: '登录/次',
axisTick: false,
axisLabel: {
interval: 0
},
},
series: [{
data: [10, 21, 23, 14, 31, 33, 27],
type: 'line',
itemStyle: {
color: '#515151'
},
lineStyle: {
color: "#515151",
type: 'dashed',
width: 1
},
label: {
show: true,
color: '#2c8aff',
position: 'top'
}
}]
};
loginChart.setOption(option);
var option = {
title: {
text: '周登录情况',
subtext: '折线图',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
xAxis: {
type: 'category',
name: '日期',
axisTick: false,
axisLabel: {
interval: 0,
fontSize: 11
},
boundaryGap: false,
data: date
},
yAxis: {
type: 'value',
name: '登录/次',
axisTick: false,
axisLabel: {
interval: 0
},
},
series: [{
data: data,
type: 'line',
itemStyle: {
color: '#515151'
},
lineStyle: {
color: "#515151",
type: 'dashed',
width: 1
},
label: {
show: true,
color: '#2c8aff',
position: 'top'
}
}]
};
loginChart.setOption(option);
}
}.bind(this));
},
initErrorChart: function () {
var loginChart = echarts.init(document.getElementById('ErrorChart'));
var option = {
title: {
text: '周故障情况',
subtext: '折线图',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
new Ajax("wsys", "data", "error").post({
"days": 7,
"today": false,
"format": "MM月dd日"
}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
var date = [];
var data = [];
for (var i = 0; i < response.result.length; i++) {
var obj = response.result[i];
date.push(obj.date)
data.push(obj.count)
}
},
xAxis: {
type: 'category',
name: '日期',
axisTick: false,
axisLabel: {
interval: 0,
fontSize: 11
},
boundaryGap: false,
data: ['11月07日', '11月08日', '11月09日', '11月10日', '11月11日', '11月12日', '11月13日']
},
yAxis: {
type: 'value',
name: '故障/次',
axisTick: false,
axisLabel: {
interval: 0
},
},
series: [{
data: [1, 2, 2, 0, 0, 1, 0],
type: 'line',
itemStyle: {
color: '#ff0000'
},
lineStyle: {
color: "#ff0000",
type: 'solid',
width: 1
},
label: {
show: true,
color: '#ff0000',
position: 'top'
}
}]
};
loginChart.setOption(option);
var option = {
title: {
text: '周故障情况',
subtext: '折线图',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
xAxis: {
type: 'category',
name: '日期',
axisTick: false,
axisLabel: {
interval: 0,
fontSize: 11
},
boundaryGap: false,
data: date
},
yAxis: {
type: 'value',
name: '故障/次',
axisTick: false,
axisLabel: {
interval: 0
},
},
series: [{
data: data,
type: 'line',
itemStyle: {
color: '#ff0000'
},
lineStyle: {
color: "#ff0000",
type: 'solid',
width: 1
},
label: {
show: true,
color: '#ff0000',
position: 'top'
}
}]
};
loginChart.setOption(option);
}
}.bind(this));
},
initTokenTaskChart: function () {
initTaskChart: function () {
var chart = echarts.init(document.getElementById('TokenTaskChart'));
var option = {
title: {
text: '任务执行情况',
subtext: '最近100次执行情况间',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
grid: {
left: '50px',
right: '50px',
top: '30%',
bottom: '5%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
axisLabel: {
show: false
new Ajax("wsys", "data", "task").post({}, function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
var date = [];
var data = [];
for (var i = 0; i < response.result.length; i++) {
var obj = response.result[i];
date.push(obj.date)
data.push(obj.count)
}
},
yAxis: {
name: '时间(ms)',
type: 'value',
axisTick: false
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
series: [{
name: '执行时间(ms)',
type: 'line',
smooth: true,
itemStyle: {
color: '#2c8df2',
},
data: [30, 52, 17, 20, 10, 11, 10, 13, 10, 10],
}, {
name: '任务',
type: 'pie',
z: 100,
radius: '40%',
center: ['85%', '40%'],
itemStyle: {
opacity: 0.7
},
label: {
formatter: '{b}:{d}%'
},
tooltip: {
trigger: 'item',
formatter: '{b}:{d}%'
},
data: [{
value: 95,
name: '成功率',
itemStyle: {
color: '#2c8df2'
},
label: {
}
}, {
value: 5,
name: '失败率',
itemStyle: {
color: '#ff0000'
var option = {
title: {
text: '登录凭证任务执行情况',
subtext: '最近100次执行情况',
textStyle: {
color: '#515151',
fontSize: 14
},
top: '10px',
left: 'center'
},
}]
}]
};
chart.setOption(option);
},
grid: {
left: '50px',
right: '50px',
top: '30%',
bottom: '5%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
axisLabel: {
show: false
}
},
yAxis: {
name: '时间(ms)',
type: 'value',
axisTick: false
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
series: [{
name: '执行时间(ms)',
type: 'line',
smooth: true,
itemStyle: {
color: '#2c8df2',
},
tooltip: {
trigger: 'item',
axisPointer: {
type: 'cross'
}
},
data: data
}, {
name: '任务',
type: 'pie',
z: 100,
radius: '40%',
center: ['85%', '40%'],
itemStyle: {
opacity: 0.7
},
label: {
formatter: '{b}:{d}%'
},
tooltip: {
trigger: 'item',
formatter: '{b}:{d}%'
},
data: [{
value: response.countSuceess,
name: '成功率',
itemStyle: {
color: '#2c8df2'
},
label: {}
}, {
value: response.countFailed,
name: '失败率',
itemStyle: {
color: '#ff0000'
},
}]
}]
};
chart.setOption(option);
}
}.bind(this))
}
},
created: function () {
},
mounted: function () {
this.initTotalCount();
this.initLoginChart();
this.initErrorChart();
this.initTokenTaskChart();
this.initTaskChart();
},
watch: {}
})

Loading…
Cancel
Save

Powered by TurnKey Linux.