代码优化 UTF-8

This commit is contained in:
thinkgem
2021-05-29 00:01:07 +08:00
parent 86ffdf24b8
commit 9403efc790
23 changed files with 81 additions and 69 deletions

View File

@@ -27,7 +27,6 @@ public class AesUtils {
private static final int DEFAULT_IVSIZE = 16; // 生成随机向量, 默认大小为cipher.getBlockSize(), 16字节
private static final SecureRandom RANDOM = new SecureRandom(); // 用于 生成 generateIV随机数对象
private static final String DEFAULT_URL_ENCODING = "UTF-8";
private static final byte[] DEFAULT_KEY = new byte[]{-97,88,-94,9,70,-76,126,25,0,3,-20,113,108,28,69,125};
/**
@@ -44,7 +43,7 @@ public class AesUtils {
*/
public static String encode(String input) {
try {
return EncodeUtils.encodeHex(encode(input.getBytes(DEFAULT_URL_ENCODING), DEFAULT_KEY));
return EncodeUtils.encodeHex(encode(input.getBytes(EncodeUtils.UTF_8), DEFAULT_KEY));
} catch (UnsupportedEncodingException e) {
return "";
}
@@ -58,7 +57,7 @@ public class AesUtils {
*/
public static String encode(String input, String key) {
try {
return EncodeUtils.encodeHex(encode(input.getBytes(DEFAULT_URL_ENCODING), EncodeUtils.decodeHex(key)));
return EncodeUtils.encodeHex(encode(input.getBytes(EncodeUtils.UTF_8), EncodeUtils.decodeHex(key)));
} catch (UnsupportedEncodingException e) {
return "";
}
@@ -71,7 +70,7 @@ public class AesUtils {
*/
public static String decode(String input) {
try {
return new String(decode(EncodeUtils.decodeHex(input), DEFAULT_KEY), DEFAULT_URL_ENCODING);
return new String(decode(EncodeUtils.decodeHex(input), DEFAULT_KEY), EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
return "";
}
@@ -85,7 +84,7 @@ public class AesUtils {
*/
public static String decode(String input, String key) {
try {
return new String(decode(EncodeUtils.decodeHex(input), EncodeUtils.decodeHex(key)), DEFAULT_URL_ENCODING);
return new String(decode(EncodeUtils.decodeHex(input), EncodeUtils.decodeHex(key)), EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
return "";
}

View File

@@ -36,8 +36,9 @@ import com.jeesite.common.lang.StringUtils;
*/
public class EncodeUtils {
public static final String UTF_8 = "UTF-8";
private static final Logger logger = LoggerFactory.getLogger(EncodeUtils.class);
private static final String DEFAULT_URL_ENCODING = "UTF-8";
private static final char[] BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray();
/**
@@ -73,7 +74,7 @@ public class EncodeUtils {
return StringUtils.EMPTY;
}
try {
return new String(Base64.encodeBase64(input.getBytes(DEFAULT_URL_ENCODING)));
return new String(Base64.encodeBase64(input.getBytes(EncodeUtils.UTF_8)));
} catch (UnsupportedEncodingException e) {
return "";
}
@@ -90,7 +91,11 @@ public class EncodeUtils {
* Base64解码.
*/
public static byte[] decodeBase64(String input) {
return Base64.decodeBase64(input.getBytes());
try {
return Base64.decodeBase64(input.getBytes(EncodeUtils.UTF_8));
} catch (UnsupportedEncodingException e) {
throw ExceptionUtils.unchecked(e);
}
}
/**
@@ -101,7 +106,7 @@ public class EncodeUtils {
return StringUtils.EMPTY;
}
try {
return new String(Base64.decodeBase64(input.getBytes()), DEFAULT_URL_ENCODING);
return new String(Base64.decodeBase64(input.getBytes(EncodeUtils.UTF_8)), EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
return StringUtils.EMPTY;
}
@@ -150,7 +155,7 @@ public class EncodeUtils {
* URL 编码, Encode默认为UTF-8.
*/
public static String encodeUrl(String part) {
return encodeUrl(part, DEFAULT_URL_ENCODING);
return encodeUrl(part, EncodeUtils.UTF_8);
}
/**
@@ -171,7 +176,7 @@ public class EncodeUtils {
* URL 解码, Encode默认为UTF-8.
*/
public static String decodeUrl(String part) {
return decodeUrl(part, DEFAULT_URL_ENCODING);
return decodeUrl(part, EncodeUtils.UTF_8);
}
/**

View File

@@ -20,7 +20,6 @@ import com.jeesite.common.io.IOUtils;
public class Md5Utils {
private static final String MD5 = "MD5";
private static final String DEFAULT_ENCODING = "UTF-8";
/**
* 对输入字符串进行md5散列.
@@ -37,7 +36,7 @@ public class Md5Utils {
*/
public static String md5(String input, int iterations) {
try {
return EncodeUtils.encodeHex(DigestUtils.digest(input.getBytes(DEFAULT_ENCODING), MD5, null, iterations));
return EncodeUtils.encodeHex(DigestUtils.digest(input.getBytes(EncodeUtils.UTF_8), MD5, null, iterations));
} catch (UnsupportedEncodingException e) {
return StringUtils.EMPTY;
}

View File

@@ -22,7 +22,6 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -244,7 +243,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
*/
public static String readFileToString(String classResourcePath){
try (InputStream in = new ClassPathResource(classResourcePath).getInputStream()){
return IOUtils.toString(in, Charsets.toCharset("UTF-8"));
return IOUtils.toString(in, EncodeUtils.UTF_8);
} catch (IOException e) {
logger.warn("Error file convert: {}", e.getMessage());
}
@@ -422,7 +421,7 @@ public class FileUtils extends org.apache.commons.io.FileUtils {
*/
public static void writeToFile(String fileName, String content, boolean append) {
try {
FileUtils.write(new File(fileName), content, "utf-8", append);
FileUtils.write(new File(fileName), content, EncodeUtils.UTF_8, append);
logger.debug("文件 " + fileName + " 写入成功!");
} catch (IOException e) {
logger.debug("文件 " + fileName + " 写入失败! " + e.getMessage());

View File

@@ -18,6 +18,7 @@ import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.collect.SetUtils;
import com.jeesite.common.lang.ObjectUtils;
import com.jeesite.common.lang.StringUtils;
@@ -111,7 +112,7 @@ public class PropertiesUtils {
Resource resource = ResourceUtils.getResource(location);
if (resource.exists()){
if (location.endsWith(".properties")){
try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), "UTF-8")){
try (InputStreamReader is = new InputStreamReader(resource.getInputStream(), EncodeUtils.UTF_8)){
properties.load(is);
configSet.add(location);
} catch (IOException e) {

View File

@@ -12,6 +12,7 @@ import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.lang.ExceptionUtils;
/**
@@ -68,7 +69,7 @@ public class ResourceUtils extends org.springframework.util.ResourceUtils {
*/
public static String getResourceFileContent(String location){
try(InputStream is = ResourceUtils.getResourceFileStream(location)){
return IOUtils.toString(is, "UTF-8");
return IOUtils.toString(is, EncodeUtils.UTF_8);
}catch (IOException e) {
throw ExceptionUtils.unchecked(e);
}

View File

@@ -20,7 +20,6 @@ import com.jeesite.common.collect.ListUtils;
public class StringUtils extends org.apache.commons.lang3.StringUtils {
private static final char SEPARATOR = '_';
private static final String CHARSET_NAME = "UTF-8";
/**
* 转换为字节数组
@@ -30,7 +29,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
public static byte[] getBytes(String str){
if (str != null){
try {
return str.getBytes(CHARSET_NAME);
return str.getBytes(EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
return null;
}
@@ -46,7 +45,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
*/
public static String toString(byte[] bytes){
try {
return new String(bytes, CHARSET_NAME);
return new String(bytes, EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
return EMPTY;
}

View File

@@ -7,6 +7,7 @@ import org.apache.commons.mail.HtmlEmail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.io.PropertiesUtils;
/**
@@ -66,7 +67,7 @@ public class EmailUtils {
htmlEmail.setMsg(content);
// 其他信息
htmlEmail.setCharset("utf-8");
htmlEmail.setCharset(EncodeUtils.UTF_8);
// 发送
htmlEmail.send();

View File

@@ -34,7 +34,7 @@ public class SmsUtils {
// dataMap.put("mobile", mobile);
// // 短信内容
// dataMap.put("content", prefix + content + suffix);
// HttpClientUtils.post(url, dataMap, "UTF-8");
// HttpClientUtils.post(url, dataMap, EncodeUtils.UTF_8);
logger.debug("短信内容:" + content + " 手机号码:" + mobile);
logger.warn("短信模拟发送成功!实际并未发送到手机,请实现 " + SmsUtils.class + " 的 send 方法。");
return "{result:0,message:\"短信模拟发送成功!\"}";

View File

@@ -29,6 +29,8 @@ import java.util.jar.JarInputStream;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.jeesite.common.codec.EncodeUtils;
/**
* Class工具类借鉴ibatis的io包的ResolverUtil类。
* @author ThinkGem
@@ -620,7 +622,7 @@ class DefaultVFS extends VFS {
// File name might be URL-encoded
if (!file.exists()) {
try {
file = new File(URLEncoder.encode(jarUrl.toString(), "UTF-8"));
file = new File(URLEncoder.encode(jarUrl.toString(), EncodeUtils.UTF_8));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unsupported encoding? UTF-8? That's unpossible.");
}

View File

@@ -19,8 +19,8 @@
package com.jeesite.common.text;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -32,6 +32,8 @@ import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.jeesite.common.codec.EncodeUtils;
/*
* Functions for diff, match and patch.
* Computes the difference between two texts to create a patch.
@@ -1433,7 +1435,7 @@ public class DiffMatchPatch {
switch (aDiff.operation) {
case INSERT:
try {
text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8")
text.append("+").append(URLEncoder.encode(aDiff.text, EncodeUtils.UTF_8)
.replace('+', ' ')).append("\t");
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.
@@ -1483,7 +1485,7 @@ public class DiffMatchPatch {
// decode would change all "+" to " "
param = param.replace("+", "%2B");
try {
param = URLDecoder.decode(param, "UTF-8");
param = URLDecoder.decode(param, EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.
throw new Error("This system does not support UTF-8.", e);
@@ -2255,7 +2257,7 @@ public class DiffMatchPatch {
line = text.getFirst().substring(1);
line = line.replace("+", "%2B"); // decode would change all "+" to " "
try {
line = URLDecoder.decode(line, "UTF-8");
line = URLDecoder.decode(line, EncodeUtils.UTF_8);
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.
throw new Error("This system does not support UTF-8.", e);
@@ -2424,7 +2426,7 @@ public class DiffMatchPatch {
break;
}
try {
text.append(URLEncoder.encode(aDiff.text, "UTF-8").replace('+', ' '))
text.append(URLEncoder.encode(aDiff.text, EncodeUtils.UTF_8).replace('+', ' '))
.append("\n");
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.

View File

@@ -18,6 +18,7 @@ import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.image.ImageUtils;
import com.jeesite.common.io.FileUtils;
import com.jeesite.common.media.VideoUtils;
@@ -43,7 +44,7 @@ public class BinaryUploader {
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
if ( isAjaxUpload ) {
upload.setHeaderEncoding( "UTF-8" );
upload.setHeaderEncoding( EncodeUtils.UTF_8 );
}
try {

View File

@@ -32,6 +32,8 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
import com.jeesite.common.codec.EncodeUtils;
/**
* HTTP客户端工具类支持HTTPS
* @author ThinkGem
@@ -44,7 +46,7 @@ public class HttpClientUtils {
* @param url
*/
public static String get(String url) {
return get(url, "UTF-8");
return get(url, EncodeUtils.UTF_8);
}
/**
@@ -61,7 +63,7 @@ public class HttpClientUtils {
* @param url
*/
public static String ajaxGet(String url) {
return ajaxGet(url, "UTF-8");
return ajaxGet(url, EncodeUtils.UTF_8);
}
/**
@@ -78,7 +80,7 @@ public class HttpClientUtils {
* http的post请求传递map格式参数
*/
public static String post(String url, Map<String, String> dataMap) {
return post(url, dataMap, "UTF-8");
return post(url, dataMap, EncodeUtils.UTF_8);
}
/**
@@ -106,7 +108,7 @@ public class HttpClientUtils {
* http的post请求增加异步请求头参数传递map格式参数
*/
public static String ajaxPost(String url, Map<String, String> dataMap) {
return ajaxPost(url, dataMap, "UTF-8");
return ajaxPost(url, dataMap, EncodeUtils.UTF_8);
}
/**
@@ -135,7 +137,7 @@ public class HttpClientUtils {
* http的post请求增加异步请求头参数传递json格式参数
*/
public static String ajaxPostJson(String url, String jsonString) {
return ajaxPostJson(url, jsonString, "UTF-8");
return ajaxPostJson(url, jsonString, EncodeUtils.UTF_8);
}
/**
@@ -159,7 +161,7 @@ public class HttpClientUtils {
* 执行一个http请求传递HttpGet或HttpPost参数
*/
public static String executeRequest(HttpUriRequest httpRequest) {
return executeRequest(httpRequest, "UTF-8");
return executeRequest(httpRequest, EncodeUtils.UTF_8);
}
/**

View File

@@ -10,6 +10,7 @@ import java.util.Objects;
import org.springframework.core.io.Resource;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.io.FileUtils;
import com.jeesite.common.io.IOUtils;
import com.jeesite.common.lang.ExceptionUtils;
@@ -111,7 +112,7 @@ public class FileTemplete implements Comparable<FileTemplete>, Serializable {
return null;
}
try(InputStream is = resource.getInputStream()){
return IOUtils.toString(is, "UTF-8");
return IOUtils.toString(is, EncodeUtils.UTF_8);
}catch (IOException e) {
throw ExceptionUtils.unchecked(e);
}

View File

@@ -85,7 +85,7 @@ $('#dataGrid').dataGrid({
{header:'${text("展现方式")}', name:'showModes', index:'a.show_modes', width:150, fixed:true, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('cms_show_modes')}, val, '未知', true);
}},
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
{header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('cms:category:edit')){ %>
actions.push('<a href="${ctx}/cms/category/form?categoryCode='+row.categoryCode+'" class="btnList" title="${text("编辑栏目表")}"><i class="fa fa-pencil"></i></a>&nbsp;');

View File

@@ -55,29 +55,29 @@
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text('站点名称')}', name:'siteName', index:'a.site_name', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" data-title="${text('编辑站点')}">'+(val||row.id)+'</a>';
{header:'${text("站点名称")}', name:'siteName', index:'a.site_name', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" data-title="${text("编辑站点")}">'+(val||row.id)+'</a>';
}},
{header:'${text('站点标题')}', name:'title', index:'a.title', width:150, align:"left"},
// {header:'${text('站点Logo')}', name:'logo', index:'a.logo', width:150, align:"left"},
{header:'${text('站点域名')}', name:'domain', index:'a.domain', width:150, align:"center"},
{header:'${text('描述')}', name:'description', index:'a.description', width:150, align:"left"},
{header:'${text('主题')}', name:'theme', index:'a.theme', width:150, align:"center"},
{header:'${text('状态')}', name:'status', index:'a.status', width:90, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text('未知')}', true);
{header:'${text("站点标题")}', name:'title', index:'a.title', width:150, align:"left"},
// {header:'${text("站点Logo")}', name:'logo', index:'a.logo', width:150, align:"left"},
{header:'${text("站点域名")}', name:'domain', index:'a.domain', width:150, align:"center"},
{header:'${text("描述")}', name:'description', index:'a.description', width:150, align:"left"},
{header:'${text("主题")}', name:'theme', index:'a.theme', width:150, align:"center"},
{header:'${text("状态")}', name:'status', index:'a.status', width:90, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
}},
{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text('操作')}', name:'actions', width:120, formatter: function(val, obj, row, act){
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
{header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('cms:site:edit')){ %>
actions.push('<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" title="${text('编辑站点')}"><i class="fa fa-pencil"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/form?siteCode='+row.siteCode+'" class="btnList" title="${text("编辑站点")}"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/cms/site/disable?siteCode='+row.siteCode+'" class="btnList" title="${text('停用站点')}" data-confirm="${text('确认要停用该站点吗')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/disable?siteCode='+row.siteCode+'" class="btnList" title="${text("停用站点")}" data-confirm="${text("确认要停用该站点吗")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/cms/site/enable?siteCode='+row.siteCode+'" class="btnList" title="${text('启用站点')}" data-confirm="${text('确认要启用该站点吗')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/enable?siteCode='+row.siteCode+'" class="btnList" title="${text("启用站点")}" data-confirm="${text("确认要启用该站点吗")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/cms/site/delete?siteCode='+row.siteCode+'" class="btnList" title="${text('删除站点')}" data-confirm="${text('确认要删除该站点吗')}"><i class="fa fa-trash-o"></i></a>&nbsp;');
actions.push('<a href="${ctx}/cms/site/delete?siteCode='+row.siteCode+'" class="btnList" title="${text("删除站点")}" data-confirm="${text("确认要删除该站点吗")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}

View File

@@ -77,7 +77,7 @@ public class CasAuthorizingRealm extends BaseAuthorizingRealm {
String ticket = (String) casToken.getCredentials();
if (ticketValidator == null) {
ticketValidator = new Cas20ServiceTicketValidator(casServerUrl);
((Cas20ServiceTicketValidator)ticketValidator).setEncoding("UTF-8");
((Cas20ServiceTicketValidator)ticketValidator).setEncoding(EncodeUtils.UTF_8);
}
// 进行登录身份验证

View File

@@ -6,6 +6,7 @@ package com.jeesite.modules.msg.send;
import org.apache.commons.mail.HtmlEmail;
import org.springframework.stereotype.Service;
import com.jeesite.common.codec.EncodeUtils;
import com.jeesite.common.config.Global;
import com.jeesite.common.lang.ExceptionUtils;
import com.jeesite.common.lang.StringUtils;
@@ -33,7 +34,7 @@ public class EmailSendService extends BaseService implements MsgSendService{
String sslSmtpPort = Global.getProperty("msg.email.sslSmtpPort", "465");
HtmlEmail htmlEmail = new HtmlEmail();
htmlEmail.setCharset("utf-8");
htmlEmail.setCharset(EncodeUtils.UTF_8);
htmlEmail.setFrom(fromAddress);
htmlEmail.setAuthentication(fromAddress, fromPassword);
htmlEmail.setHostName(fromHostName);

View File

@@ -15,7 +15,6 @@ import com.jeesite.common.msg.SmsUtils;
import com.jeesite.common.service.BaseService;
import com.jeesite.modules.msg.entity.MsgPush;
import com.jeesite.modules.msg.entity.content.SmsMsgContent;
import com.jeesite.modules.msg.send.MsgSendService;
/**
* 短信发送服务实现
@@ -33,7 +32,7 @@ public class SmsSendService extends BaseService implements MsgSendService{
// String prefix = Global.getProperty("msg.sms.prefix", "");
// String suffix = Global.getProperty("msg.sms.suffix", "");
// Connection conn = Jsoup.connect(url);
// conn.postDataCharset("UTF-8");
// conn.postDataCharset(EncodeUtils.UTF_8);
// conn.method(Method.POST);
// for (String param : StringUtils.split(data, "&")){
// String[] ss = StringUtils.split(param, "=");

View File

@@ -6,7 +6,7 @@
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="fa fa-cog"></i></span>
<div class="info-box-content">
<span class="info-box-text">CPU 使用率</span>
<span class="info-box-text">使用率</span>
<span class="info-box-number">90<small>%</small></span>
</div>
</div>

View File

@@ -123,18 +123,18 @@
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'${text("登录账号")}', name:'loginCode', index:'a.login_code', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
{header:'${text("登录账号")}', name:'loginCode', index:'a.login_code', width:120, align:"center", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/sys/empUser/form?userCode='+row.userCode+'&op=edit" class="btnList" data-title="${text("编辑用户")}">'+(val||row.id)+'</a>';
}},
{header:'${text("用户昵称")}', name:'userName', index:'a.user_name', width:135, align:"center"},
{header:'${text("员工姓名")}', name:'refName', index:'a.ref_name', width:135, align:"center"},
{header:'${text("用户昵称")}', name:'userName', index:'a.user_name', width:120, align:"center"},
{header:'${text("员工姓名")}', name:'refName', index:'a.ref_name', width:120, align:"center"},
{header:'${text("归属机构")}', name:'employee.office.officeName', index:'o.office_name', width:135, align:"center"},
{header:'${text("归属公司")}', name:'employee.company.companyName', index:'c.company_name', width:135, align:"center"},
{header:'${text("电子邮箱")}', name:'email', index:'a.email', width:135, align:"center"},
{header:'${text("手机号码")}', name:'mobile', index:'a.mobile', width:135, align:"center"},
{header:'${text("办公电话")}', name:'phone', index:'a.phone', width:135, align:"center"},
{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:135, align:"center"},
{header:'${text("状态")}', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){
{header:'${text("电子邮箱")}', name:'email', index:'a.email', width:120, align:"center"},
{header:'${text("手机号码")}', name:'mobile', index:'a.mobile', width:120, align:"center"},
{header:'${text("办公电话")}', name:'phone', index:'a.phone', width:120, align:"center"},
{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:120, align:"center", frozen:true},
{header:'${text("状态")}', name:'status', index:'a.status', width:80, align:"center", frozen:true, formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_status')}, val, '未知', true);
}},
{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){

View File

@@ -124,11 +124,11 @@
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'单行文本', name:'testInput', index:'a.test_input', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
{header:'单行文本', name:'testInput', index:'a.test_input', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){
if(obj.rowId == ''){ return '小计:'; }
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="编辑数据">'+(val||row.id)+'</a>';
}, summaryTpl: "<em>{0}</em> ", summaryType: "count"},
{header:'多行文本', name:'testTextarea', index:'a.test_textarea', width:150, align:"center", frozen:true, formatter: function(val, obj, row, act){
{header:'多行文本', name:'testTextarea', index:'a.test_textarea', width:200, align:"center", formatter: function(val, obj, row, act){
if(obj.rowId == ''){ return '<em>' + val + '</em>个' }
return val||'';
}, summaryTpl: "<em>{0}</em>", summaryType: "count"},

View File

@@ -151,7 +151,7 @@ $('#dataGrid').dataGrid({
}},
{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', firstsortorder:'desc', width:150, align:"center"},
{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'${text("操作")}', name:'actions', width:200, formatter: function(val, obj, row, act){
{header:'${text("操作")}', name:'actions', width:100, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testData:edit')){ %>
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="${text("编辑数据")}"><i class="fa fa-pencil"></i></a>&nbsp;');