Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a3967de5d7
16
pom.xml
16
pom.xml
|
|
@ -6,34 +6,34 @@
|
||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>ruoyi</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依微服务系统</description>
|
<description>若依微服务系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi.version>3.1.0</ruoyi.version>
|
<ruoyi.version>3.2.0</ruoyi.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<spring-boot.version>2.5.3</spring-boot.version>
|
<spring-boot.version>2.5.5</spring-boot.version>
|
||||||
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
<spring-cloud.version>2020.0.4</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
|
||||||
<alibaba.nacos.version>2.0.3</alibaba.nacos.version>
|
<alibaba.nacos.version>2.0.3</alibaba.nacos.version>
|
||||||
<spring-boot-admin.version>2.4.3</spring-boot-admin.version>
|
<spring-boot-admin.version>2.5.2</spring-boot-admin.version>
|
||||||
<spring-boot.mybatis>2.2.0</spring-boot.mybatis>
|
<spring-boot.mybatis>2.2.0</spring-boot.mybatis>
|
||||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||||
<swagger.core.version>1.6.2</swagger.core.version>
|
<swagger.core.version>1.6.2</swagger.core.version>
|
||||||
<tobato.version>1.27.2</tobato.version>
|
<tobato.version>1.27.2</tobato.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
<pagehelper.boot.version>1.4.0</pagehelper.boot.version>
|
||||||
<druid.version>1.2.6</druid.version>
|
<druid.version>1.2.8</druid.version>
|
||||||
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
<dynamic-ds.version>3.4.1</dynamic-ds.version>
|
||||||
<commons.io.version>2.11.0</commons.io.version>
|
<commons.io.version>2.11.0</commons.io.version>
|
||||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||||
<velocity.version>1.7</velocity.version>
|
<velocity.version>1.7</velocity.version>
|
||||||
<fastjson.version>1.2.76</fastjson.version>
|
<fastjson.version>1.2.78</fastjson.version>
|
||||||
<minio.version>8.2.2</minio.version>
|
<minio.version>8.2.2</minio.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<common-pool.version>2.10.0</common-pool.version>
|
<common-pool.version>2.10.0</common-pool.version>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-api</artifactId>
|
<artifactId>ruoyi-api</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义导出Excel数据注解
|
* 自定义导出Excel数据注解
|
||||||
|
|
@ -103,7 +104,17 @@ public @interface Excel
|
||||||
/**
|
/**
|
||||||
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
|
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
|
||||||
*/
|
*/
|
||||||
Align align() default Align.AUTO;
|
public Align align() default Align.AUTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器
|
||||||
|
*/
|
||||||
|
public Class<?> handler() default ExcelHandlerAdapter.class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义数据处理器参数
|
||||||
|
*/
|
||||||
|
public String[] args() default {};
|
||||||
|
|
||||||
public enum Align
|
public enum Align
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,22 @@ public class ServletUtils
|
||||||
return Convert.toInt(getRequest().getParameter(name), defaultValue);
|
return Convert.toInt(getRequest().getParameter(name), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Boolean参数
|
||||||
|
*/
|
||||||
|
public static Boolean getParameterToBool(String name)
|
||||||
|
{
|
||||||
|
return Convert.toBool(getRequest().getParameter(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取Boolean参数
|
||||||
|
*/
|
||||||
|
public static Boolean getParameterToBool(String name, Boolean defaultValue)
|
||||||
|
{
|
||||||
|
return Convert.toBool(getRequest().getParameter(name), defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取request
|
* 获取request
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,7 @@ public class FileUtils
|
||||||
.append(percentEncodedFileName);
|
.append(percentEncodedFileName);
|
||||||
|
|
||||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||||
|
response.setHeader("download-filename", percentEncodedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ public final class HTMLFilter
|
||||||
{
|
{
|
||||||
paramValue = processParamProtocol(paramValue);
|
paramValue = processParamProtocol(paramValue);
|
||||||
}
|
}
|
||||||
params.append(' ').append(paramName).append("=\"").append(paramValue).append("\"");
|
params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ruoyi.common.core.utils.poi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel数据格式处理适配器
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface ExcelHandlerAdapter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 格式化
|
||||||
|
*
|
||||||
|
* @param value 单元格数据值
|
||||||
|
* @param args excel注解args参数组
|
||||||
|
*
|
||||||
|
* @return 处理后的值
|
||||||
|
*/
|
||||||
|
Object format(Object value, String[] args);
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -35,6 +36,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
|
@ -102,6 +104,16 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
private List<Object[]> fields;
|
private List<Object[]> fields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前行号
|
||||||
|
*/
|
||||||
|
private int rownum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大高度
|
* 最大高度
|
||||||
*/
|
*/
|
||||||
|
|
@ -127,7 +139,7 @@ public class ExcelUtil<T>
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(List<T> list, String sheetName, Type type)
|
public void init(List<T> list, String sheetName, String title, Type type)
|
||||||
{
|
{
|
||||||
if (list == null)
|
if (list == null)
|
||||||
{
|
{
|
||||||
|
|
@ -136,8 +148,27 @@ public class ExcelUtil<T>
|
||||||
this.list = list;
|
this.list = list;
|
||||||
this.sheetName = sheetName;
|
this.sheetName = sheetName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.title = title;
|
||||||
createExcelField();
|
createExcelField();
|
||||||
createWorkbook();
|
createWorkbook();
|
||||||
|
createTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建excel第一行标题
|
||||||
|
*/
|
||||||
|
public void createTitle()
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(title))
|
||||||
|
{
|
||||||
|
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
||||||
|
titleRow.setHeightInPoints(30);
|
||||||
|
Cell titleCell = titleRow.createCell(0);
|
||||||
|
titleCell.setCellStyle(styles.get("title"));
|
||||||
|
titleCell.setCellValue(title);
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(),
|
||||||
|
this.fields.size() - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -148,33 +179,36 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
public List<T> importExcel(InputStream is) throws Exception
|
public List<T> importExcel(InputStream is) throws Exception
|
||||||
{
|
{
|
||||||
return importExcel(StringUtils.EMPTY, is);
|
return importExcel(is, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对excel表单默认第一个索引名转换成list
|
||||||
|
*
|
||||||
|
* @param is 输入流
|
||||||
|
* @param titleNum 标题占用行数
|
||||||
|
* @return 转换后集合
|
||||||
|
*/
|
||||||
|
public List<T> importExcel(InputStream is, int titleNum) throws Exception
|
||||||
|
{
|
||||||
|
return importExcel(StringUtils.EMPTY, is, titleNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对excel表单指定表格索引名转换成list
|
* 对excel表单指定表格索引名转换成list
|
||||||
*
|
*
|
||||||
* @param sheetName 表格索引名
|
* @param sheetName 表格索引名
|
||||||
|
* @param titleNum 标题占用行数
|
||||||
* @param is 输入流
|
* @param is 输入流
|
||||||
* @return 转换后集合
|
* @return 转换后集合
|
||||||
*/
|
*/
|
||||||
public List<T> importExcel(String sheetName, InputStream is) throws Exception
|
public List<T> importExcel(String sheetName, InputStream is, int titleNum) throws Exception
|
||||||
{
|
{
|
||||||
this.type = Type.IMPORT;
|
this.type = Type.IMPORT;
|
||||||
this.wb = WorkbookFactory.create(is);
|
this.wb = WorkbookFactory.create(is);
|
||||||
List<T> list = new ArrayList<T>();
|
List<T> list = new ArrayList<T>();
|
||||||
Sheet sheet = null;
|
// 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet
|
||||||
if (StringUtils.isNotEmpty(sheetName))
|
Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0);
|
||||||
{
|
|
||||||
// 如果指定sheet名,则取指定sheet中的内容.
|
|
||||||
sheet = wb.getSheet(sheetName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 如果传入的sheet名不存在则默认指向第1个sheet.
|
|
||||||
sheet = wb.getSheetAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sheet == null)
|
if (sheet == null)
|
||||||
{
|
{
|
||||||
throw new IOException("文件sheet不存在");
|
throw new IOException("文件sheet不存在");
|
||||||
|
|
@ -188,7 +222,7 @@ public class ExcelUtil<T>
|
||||||
// 定义一个map用于存放excel列的序号和field.
|
// 定义一个map用于存放excel列的序号和field.
|
||||||
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
||||||
// 获取表头
|
// 获取表头
|
||||||
Row heard = sheet.getRow(0);
|
Row heard = sheet.getRow(titleNum);
|
||||||
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
|
||||||
{
|
{
|
||||||
Cell cell = heard.getCell(i);
|
Cell cell = heard.getCell(i);
|
||||||
|
|
@ -203,25 +237,18 @@ public class ExcelUtil<T>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 有数据时才处理 得到类的所有field.
|
// 有数据时才处理 得到类的所有field.
|
||||||
Field[] allFields = clazz.getDeclaredFields();
|
List<Object[]> fields = this.getFields();
|
||||||
// 定义一个map用于存放列的序号和field.
|
Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>();
|
||||||
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
|
for (Object[] objects : fields)
|
||||||
for (int col = 0; col < allFields.length; col++)
|
|
||||||
{
|
{
|
||||||
Field field = allFields[col];
|
Excel attr = (Excel) objects[1];
|
||||||
Excel attr = field.getAnnotation(Excel.class);
|
Integer column = cellMap.get(attr.name());
|
||||||
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
if (column != null)
|
||||||
{
|
{
|
||||||
// 设置类的私有字段属性可访问.
|
fieldsMap.put(column, objects);
|
||||||
field.setAccessible(true);
|
|
||||||
Integer column = cellMap.get(attr.name());
|
|
||||||
if (column != null)
|
|
||||||
{
|
|
||||||
fieldsMap.put(column, field);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 1; i <= rows; i++)
|
for (int i = titleNum + 1; i <= rows; i++)
|
||||||
{
|
{
|
||||||
// 从第2行开始取数据,默认第一行是表头.
|
// 从第2行开始取数据,默认第一行是表头.
|
||||||
Row row = sheet.getRow(i);
|
Row row = sheet.getRow(i);
|
||||||
|
|
@ -231,14 +258,15 @@ public class ExcelUtil<T>
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
T entity = null;
|
T entity = null;
|
||||||
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
|
for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet())
|
||||||
{
|
{
|
||||||
Object val = this.getCellValue(row, entry.getKey());
|
Object val = this.getCellValue(row, entry.getKey());
|
||||||
|
|
||||||
// 如果不存在实例则新建.
|
// 如果不存在实例则新建.
|
||||||
entity = (entity == null ? clazz.newInstance() : entity);
|
entity = (entity == null ? clazz.newInstance() : entity);
|
||||||
// 从map中得到对应列的field.
|
// 从map中得到对应列的field.
|
||||||
Field field = fieldsMap.get(entry.getKey());
|
Field field = (Field) entry.getValue()[0];
|
||||||
|
Excel attr = (Excel) entry.getValue()[1];
|
||||||
// 取得类型,并根据对象类型设置值.
|
// 取得类型,并根据对象类型设置值.
|
||||||
Class<?> fieldType = field.getType();
|
Class<?> fieldType = field.getType();
|
||||||
if (String.class == fieldType)
|
if (String.class == fieldType)
|
||||||
|
|
@ -298,7 +326,6 @@ public class ExcelUtil<T>
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotNull(fieldType))
|
if (StringUtils.isNotNull(fieldType))
|
||||||
{
|
{
|
||||||
Excel attr = field.getAnnotation(Excel.class);
|
|
||||||
String propertyName = field.getName();
|
String propertyName = field.getName();
|
||||||
if (StringUtils.isNotEmpty(attr.targetAttr()))
|
if (StringUtils.isNotEmpty(attr.targetAttr()))
|
||||||
{
|
{
|
||||||
|
|
@ -308,6 +335,10 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
|
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
|
||||||
}
|
}
|
||||||
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
|
{
|
||||||
|
val = dataFormatHandlerAdapter(val, attr);
|
||||||
|
}
|
||||||
ReflectUtils.invokeSetter(entity, propertyName, val);
|
ReflectUtils.invokeSetter(entity, propertyName, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -326,14 +357,35 @@ public class ExcelUtil<T>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) throws IOException
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)throws IOException
|
||||||
|
{
|
||||||
|
exportExcel(response, list, sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param response 返回数据
|
||||||
|
* @param list 导出数据集合
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) throws IOException
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(list, sheetName, Type.EXPORT);
|
this.init(list, sheetName, title, Type.EXPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* 对list数据源将其里面的数据导入到excel表单
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
*
|
*
|
||||||
|
|
@ -341,10 +393,22 @@ public class ExcelUtil<T>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
||||||
|
{
|
||||||
|
importTemplateExcel(response, sheetName, StringUtils.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
|
*
|
||||||
|
* @param sheetName 工作表的名称
|
||||||
|
* @param title 标题
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) throws IOException
|
||||||
{
|
{
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
this.init(null, sheetName, Type.IMPORT);
|
this.init(null, sheetName, title, Type.IMPORT);
|
||||||
exportExcel(response.getOutputStream());
|
exportExcel(response.getOutputStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,13 +441,13 @@ public class ExcelUtil<T>
|
||||||
public void writeSheet()
|
public void writeSheet()
|
||||||
{
|
{
|
||||||
// 取出一共有多少个sheet.
|
// 取出一共有多少个sheet.
|
||||||
double sheetNo = Math.ceil(list.size() / sheetSize);
|
int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize));
|
||||||
for (int index = 0; index <= sheetNo; index++)
|
for (int index = 0; index < sheetNo; index++)
|
||||||
{
|
{
|
||||||
createSheet(sheetNo, index);
|
createSheet(sheetNo, index);
|
||||||
|
|
||||||
// 产生一行
|
// 产生一行
|
||||||
Row row = sheet.createRow(0);
|
Row row = sheet.createRow(rownum);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
// 写入各个字段的列头名称
|
// 写入各个字段的列头名称
|
||||||
for (Object[] os : fields)
|
for (Object[] os : fields)
|
||||||
|
|
@ -411,7 +475,7 @@ public class ExcelUtil<T>
|
||||||
int endNo = Math.min(startNo + sheetSize, list.size());
|
int endNo = Math.min(startNo + sheetSize, list.size());
|
||||||
for (int i = startNo; i < endNo; i++)
|
for (int i = startNo; i < endNo; i++)
|
||||||
{
|
{
|
||||||
row = sheet.createRow(i + 1 - startNo);
|
row = sheet.createRow(i + 1 + rownum - startNo);
|
||||||
// 得到导出对象.
|
// 得到导出对象.
|
||||||
T vo = (T) list.get(i);
|
T vo = (T) list.get(i);
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
|
@ -419,8 +483,6 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
Field field = (Field) os[0];
|
Field field = (Field) os[0];
|
||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
// 设置实体类私有属性可访问
|
|
||||||
field.setAccessible(true);
|
|
||||||
this.addCell(excel, row, vo, field, column++);
|
this.addCell(excel, row, vo, field, column++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,6 +501,16 @@ public class ExcelUtil<T>
|
||||||
CellStyle style = wb.createCellStyle();
|
CellStyle style = wb.createCellStyle();
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
Font titleFont = wb.createFont();
|
||||||
|
titleFont.setFontName("Arial");
|
||||||
|
titleFont.setFontHeightInPoints((short) 16);
|
||||||
|
titleFont.setBold(true);
|
||||||
|
style.setFont(titleFont);
|
||||||
|
styles.put("title", style);
|
||||||
|
|
||||||
|
style = wb.createCellStyle();
|
||||||
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
style.setBorderRight(BorderStyle.THIN);
|
style.setBorderRight(BorderStyle.THIN);
|
||||||
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
|
||||||
style.setBorderLeft(BorderStyle.THIN);
|
style.setBorderLeft(BorderStyle.THIN);
|
||||||
|
|
@ -633,6 +705,10 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
|
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
|
||||||
}
|
}
|
||||||
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
|
{
|
||||||
|
cell.setCellValue(dataFormatHandlerAdapter(value, attr));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 设置列类型
|
// 设置列类型
|
||||||
|
|
@ -779,6 +855,28 @@ public class ExcelUtil<T>
|
||||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理器
|
||||||
|
*
|
||||||
|
* @param value 数据值
|
||||||
|
* @param excel 数据注解
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String dataFormatHandlerAdapter(Object value, Excel excel)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object instance = excel.handler().newInstance();
|
||||||
|
Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class });
|
||||||
|
value = formatMethod.invoke(instance, value, excel.args());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
|
||||||
|
}
|
||||||
|
return Convert.toStr(value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合计统计信息
|
* 合计统计信息
|
||||||
*/
|
*/
|
||||||
|
|
@ -809,10 +907,9 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
if (statistics.size() > 0)
|
if (statistics.size() > 0)
|
||||||
{
|
{
|
||||||
Cell cell = null;
|
|
||||||
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
|
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
|
||||||
Set<Integer> keys = statistics.keySet();
|
Set<Integer> keys = statistics.keySet();
|
||||||
cell = row.createCell(0);
|
Cell cell = row.createCell(0);
|
||||||
cell.setCellStyle(styles.get("total"));
|
cell.setCellStyle(styles.get("total"));
|
||||||
cell.setCellValue("合计");
|
cell.setCellValue("合计");
|
||||||
|
|
||||||
|
|
@ -882,7 +979,17 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
private void createExcelField()
|
private void createExcelField()
|
||||||
{
|
{
|
||||||
this.fields = new ArrayList<Object[]>();
|
this.fields = getFields();
|
||||||
|
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
||||||
|
this.maxHeight = getRowHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段注解信息
|
||||||
|
*/
|
||||||
|
public List<Object[]> getFields()
|
||||||
|
{
|
||||||
|
List<Object[]> fields = new ArrayList<Object[]>();
|
||||||
List<Field> tempFields = new ArrayList<>();
|
List<Field> tempFields = new ArrayList<>();
|
||||||
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
|
||||||
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
|
||||||
|
|
@ -891,7 +998,12 @@ public class ExcelUtil<T>
|
||||||
// 单注解
|
// 单注解
|
||||||
if (field.isAnnotationPresent(Excel.class))
|
if (field.isAnnotationPresent(Excel.class))
|
||||||
{
|
{
|
||||||
putToField(field, field.getAnnotation(Excel.class));
|
Excel attr = field.getAnnotation(Excel.class);
|
||||||
|
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
||||||
|
{
|
||||||
|
field.setAccessible(true);
|
||||||
|
fields.add(new Object[] { field, attr });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多注解
|
// 多注解
|
||||||
|
|
@ -899,14 +1011,17 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
Excels attrs = field.getAnnotation(Excels.class);
|
Excels attrs = field.getAnnotation(Excels.class);
|
||||||
Excel[] excels = attrs.value();
|
Excel[] excels = attrs.value();
|
||||||
for (Excel excel : excels)
|
for (Excel attr : excels)
|
||||||
{
|
{
|
||||||
putToField(field, excel);
|
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
||||||
|
{
|
||||||
|
field.setAccessible(true);
|
||||||
|
fields.add(new Object[] { field, attr });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
return fields;
|
||||||
this.maxHeight = getRowHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -923,23 +1038,15 @@ public class ExcelUtil<T>
|
||||||
return (short) (maxHeight * 20);
|
return (short) (maxHeight * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 放到字段集合中
|
|
||||||
*/
|
|
||||||
private void putToField(Field field, Excel attr)
|
|
||||||
{
|
|
||||||
if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
|
|
||||||
{
|
|
||||||
this.fields.add(new Object[] { field, attr });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个工作簿
|
* 创建一个工作簿
|
||||||
*/
|
*/
|
||||||
public void createWorkbook()
|
public void createWorkbook()
|
||||||
{
|
{
|
||||||
this.wb = new SXSSFWorkbook(500);
|
this.wb = new SXSSFWorkbook(500);
|
||||||
|
this.sheet = wb.createSheet();
|
||||||
|
wb.setSheetName(0, sheetName);
|
||||||
|
this.styles = createStyles(wb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -948,17 +1055,13 @@ public class ExcelUtil<T>
|
||||||
* @param sheetNo sheet数量
|
* @param sheetNo sheet数量
|
||||||
* @param index 序号
|
* @param index 序号
|
||||||
*/
|
*/
|
||||||
public void createSheet(double sheetNo, int index)
|
public void createSheet(int sheetNo, int index)
|
||||||
{
|
{
|
||||||
this.sheet = wb.createSheet();
|
|
||||||
this.styles = createStyles(wb);
|
|
||||||
// 设置工作表的名称.
|
// 设置工作表的名称.
|
||||||
if (sheetNo == 0)
|
if (sheetNo > 1 && index > 0)
|
||||||
{
|
|
||||||
wb.setSheetName(index, sheetName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
this.sheet = wb.createSheet();
|
||||||
|
this.createTitle();
|
||||||
wb.setSheetName(index, sheetName + index);
|
wb.setSheetName(index, sheetName + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ public class BaseController
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
||||||
{
|
{
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy);
|
Boolean reasonable = pageDomain.getReasonable();
|
||||||
|
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ public class PageDomain
|
||||||
/** 排序的方向desc或者asc */
|
/** 排序的方向desc或者asc */
|
||||||
private String isAsc = "asc";
|
private String isAsc = "asc";
|
||||||
|
|
||||||
|
/** 分页参数合理化 */
|
||||||
|
private Boolean reasonable = true;
|
||||||
|
|
||||||
public String getOrderBy()
|
public String getOrderBy()
|
||||||
{
|
{
|
||||||
if (StringUtils.isEmpty(orderByColumn))
|
if (StringUtils.isEmpty(orderByColumn))
|
||||||
|
|
@ -81,4 +84,18 @@ public class PageDomain
|
||||||
this.isAsc = isAsc;
|
this.isAsc = isAsc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getReasonable()
|
||||||
|
{
|
||||||
|
if (StringUtils.isNull(reasonable))
|
||||||
|
{
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
return reasonable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReasonable(Boolean reasonable)
|
||||||
|
{
|
||||||
|
this.reasonable = reasonable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ public class TableSupport
|
||||||
*/
|
*/
|
||||||
public static final String IS_ASC = "isAsc";
|
public static final String IS_ASC = "isAsc";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页参数合理化
|
||||||
|
*/
|
||||||
|
public static final String REASONABLE = "reasonable";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 封装分页对象
|
* 封装分页对象
|
||||||
*/
|
*/
|
||||||
|
|
@ -39,6 +44,7 @@ public class TableSupport
|
||||||
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
|
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
|
||||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||||
|
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||||
return pageDomain;
|
return pageDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
package com.ruoyi.common.datascope.aspect;
|
package com.ruoyi.common.datascope.aspect;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.Signature;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
|
@ -59,27 +55,15 @@ public class DataScopeAspect
|
||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
// 配置织入点
|
@Before("@annotation(controllerDataScope)")
|
||||||
@Pointcut("@annotation(com.ruoyi.common.datascope.annotation.DataScope)")
|
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
||||||
public void dataScopePointCut()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before("dataScopePointCut()")
|
|
||||||
public void doBefore(JoinPoint point) throws Throwable
|
|
||||||
{
|
{
|
||||||
clearDataScope(point);
|
clearDataScope(point);
|
||||||
handleDataScope(point);
|
handleDataScope(point, controllerDataScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleDataScope(final JoinPoint joinPoint)
|
protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope)
|
||||||
{
|
{
|
||||||
// 获得注解
|
|
||||||
DataScope controllerDataScope = getAnnotationLog(joinPoint);
|
|
||||||
if (controllerDataScope == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 获取当前的用户
|
// 获取当前的用户
|
||||||
LoginUser loginUser = tokenService.getLoginUser();
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
if (StringUtils.isNotNull(loginUser))
|
if (StringUtils.isNotNull(loginUser))
|
||||||
|
|
@ -155,22 +139,6 @@ public class DataScopeAspect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在注解,如果存在就获取
|
|
||||||
*/
|
|
||||||
private DataScope getAnnotationLog(JoinPoint joinPoint)
|
|
||||||
{
|
|
||||||
Signature signature = joinPoint.getSignature();
|
|
||||||
MethodSignature methodSignature = (MethodSignature) signature;
|
|
||||||
Method method = methodSignature.getMethod();
|
|
||||||
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.getAnnotation(DataScope.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接权限sql前先清空params.dataScope参数防止注入
|
* 拼接权限sql前先清空params.dataScope参数防止注入
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,9 @@ public @interface Log
|
||||||
* 是否保存请求的参数
|
* 是否保存请求的参数
|
||||||
*/
|
*/
|
||||||
public boolean isSaveRequestData() default true;
|
public boolean isSaveRequestData() default true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否保存响应的参数
|
||||||
|
*/
|
||||||
|
public boolean isSaveResponseData() default true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,13 @@
|
||||||
package com.ruoyi.common.log.aspect;
|
package com.ruoyi.common.log.aspect;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.Signature;
|
|
||||||
import org.aspectj.lang.annotation.AfterReturning;
|
import org.aspectj.lang.annotation.AfterReturning;
|
||||||
import org.aspectj.lang.annotation.AfterThrowing;
|
import org.aspectj.lang.annotation.AfterThrowing;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Pointcut;
|
|
||||||
import org.aspectj.lang.reflect.MethodSignature;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -44,21 +39,15 @@ public class LogAspect
|
||||||
@Autowired
|
@Autowired
|
||||||
private AsyncLogService asyncLogService;
|
private AsyncLogService asyncLogService;
|
||||||
|
|
||||||
// 配置织入点
|
|
||||||
@Pointcut("@annotation(com.ruoyi.common.log.annotation.Log)")
|
|
||||||
public void logPointCut()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理完请求后执行
|
* 处理完请求后执行
|
||||||
*
|
*
|
||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
*/
|
*/
|
||||||
@AfterReturning(pointcut = "logPointCut()", returning = "jsonResult")
|
@AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
|
||||||
public void doAfterReturning(JoinPoint joinPoint, Object jsonResult)
|
public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult)
|
||||||
{
|
{
|
||||||
handleLog(joinPoint, null, jsonResult);
|
handleLog(joinPoint, controllerLog, null, jsonResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,32 +56,22 @@ public class LogAspect
|
||||||
* @param joinPoint 切点
|
* @param joinPoint 切点
|
||||||
* @param e 异常
|
* @param e 异常
|
||||||
*/
|
*/
|
||||||
@AfterThrowing(value = "logPointCut()", throwing = "e")
|
@AfterThrowing(value = "@annotation(controllerLog)", throwing = "e")
|
||||||
public void doAfterThrowing(JoinPoint joinPoint, Exception e)
|
public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e)
|
||||||
{
|
{
|
||||||
handleLog(joinPoint, e, null);
|
handleLog(joinPoint, controllerLog, e, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult)
|
protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 获得注解
|
|
||||||
Log controllerLog = getAnnotationLog(joinPoint);
|
|
||||||
if (controllerLog == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *========数据库日志=========*//
|
// *========数据库日志=========*//
|
||||||
SysOperLog operLog = new SysOperLog();
|
SysOperLog operLog = new SysOperLog();
|
||||||
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
|
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
|
||||||
// 请求的地址
|
// 请求的地址
|
||||||
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
|
||||||
operLog.setOperIp(ip);
|
operLog.setOperIp(ip);
|
||||||
// 返回参数
|
|
||||||
operLog.setJsonResult(JSON.toJSONString(jsonResult));
|
|
||||||
|
|
||||||
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
if (StringUtils.isNotBlank(username))
|
if (StringUtils.isNotBlank(username))
|
||||||
|
|
@ -112,7 +91,7 @@ public class LogAspect
|
||||||
// 设置请求方式
|
// 设置请求方式
|
||||||
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
|
||||||
// 处理设置注解上的参数
|
// 处理设置注解上的参数
|
||||||
getControllerMethodDescription(joinPoint, controllerLog, operLog);
|
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
|
||||||
// 保存数据库
|
// 保存数据库
|
||||||
asyncLogService.saveSysLog(operLog);
|
asyncLogService.saveSysLog(operLog);
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +111,7 @@ public class LogAspect
|
||||||
* @param operLog 操作日志
|
* @param operLog 操作日志
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception
|
public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception
|
||||||
{
|
{
|
||||||
// 设置action动作
|
// 设置action动作
|
||||||
operLog.setBusinessType(log.businessType().ordinal());
|
operLog.setBusinessType(log.businessType().ordinal());
|
||||||
|
|
@ -146,6 +125,11 @@ public class LogAspect
|
||||||
// 获取参数的信息,传入到数据库中。
|
// 获取参数的信息,传入到数据库中。
|
||||||
setRequestValue(joinPoint, operLog);
|
setRequestValue(joinPoint, operLog);
|
||||||
}
|
}
|
||||||
|
// 是否需要保存response,参数和值
|
||||||
|
if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
|
||||||
|
{
|
||||||
|
operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -164,22 +148,6 @@ public class LogAspect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否存在注解,如果存在就获取
|
|
||||||
*/
|
|
||||||
private Log getAnnotationLog(JoinPoint joinPoint) throws Exception
|
|
||||||
{
|
|
||||||
Signature signature = joinPoint.getSignature();
|
|
||||||
MethodSignature methodSignature = (MethodSignature) signature;
|
|
||||||
Method method = methodSignature.getMethod();
|
|
||||||
|
|
||||||
if (method != null)
|
|
||||||
{
|
|
||||||
return method.getAnnotation(Log.class);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数拼装
|
* 参数拼装
|
||||||
*/
|
*/
|
||||||
|
|
@ -188,13 +156,13 @@ public class LogAspect
|
||||||
String params = "";
|
String params = "";
|
||||||
if (paramsArray != null && paramsArray.length > 0)
|
if (paramsArray != null && paramsArray.length > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < paramsArray.length; i++)
|
for (Object o : paramsArray)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i]))
|
if (StringUtils.isNotNull(o) && !isFilterObject(o))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object jsonObj = JSON.toJSON(paramsArray[i]);
|
Object jsonObj = JSON.toJSON(o);
|
||||||
params += jsonObj.toString() + " ";
|
params += jsonObj.toString() + " ";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
@ -223,17 +191,17 @@ public class LogAspect
|
||||||
else if (Collection.class.isAssignableFrom(clazz))
|
else if (Collection.class.isAssignableFrom(clazz))
|
||||||
{
|
{
|
||||||
Collection collection = (Collection) o;
|
Collection collection = (Collection) o;
|
||||||
for (Iterator iter = collection.iterator(); iter.hasNext();)
|
for (Object value : collection)
|
||||||
{
|
{
|
||||||
return iter.next() instanceof MultipartFile;
|
return value instanceof MultipartFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Map.class.isAssignableFrom(clazz))
|
else if (Map.class.isAssignableFrom(clazz))
|
||||||
{
|
{
|
||||||
Map map = (Map) o;
|
Map map = (Map) o;
|
||||||
for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
|
for (Object value : map.entrySet())
|
||||||
{
|
{
|
||||||
Map.Entry entry = (Map.Entry) iter.next();
|
Map.Entry entry = (Map.Entry) value;
|
||||||
return entry.getValue() instanceof MultipartFile;
|
return entry.getValue() instanceof MultipartFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public class VelocityUtils
|
||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
velocityContext.put("columns", genTable.getColumns());
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
|
velocityContext.put("dicts", getDicts(genTable));
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory))
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
||||||
{
|
{
|
||||||
|
|
@ -260,6 +261,27 @@ public class VelocityUtils
|
||||||
return importList;
|
return importList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据列类型获取字典组
|
||||||
|
*
|
||||||
|
* @param genTable 业务表对象
|
||||||
|
* @return 返回字典组
|
||||||
|
*/
|
||||||
|
public static String getDicts(GenTable genTable)
|
||||||
|
{
|
||||||
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
|
List<String> dicts = new ArrayList<String>();
|
||||||
|
for (GenTableColumn column : columns)
|
||||||
|
{
|
||||||
|
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
|
||||||
|
column.getHtmlType(), new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO }))
|
||||||
|
{
|
||||||
|
dicts.add("'" + column.getDictType() + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.join(dicts, ", ");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取权限前缀
|
* 获取权限前缀
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public interface ${ClassName}Mapper
|
||||||
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int delete${subClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增${subTable.functionName}
|
* 批量新增${subTable.functionName}
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${column.javaField}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -106,7 +106,11 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $column.dictType)
|
#elseif($column.list && "" != $column.dictType)
|
||||||
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $javaField)
|
#elseif($column.list && "" != $javaField)
|
||||||
#if(${foreach.index} == 1)
|
#if(${foreach.index} == 1)
|
||||||
<el-table-column label="${comment}" prop="${javaField}" />
|
<el-table-column label="${comment}" prop="${javaField}" />
|
||||||
|
|
@ -180,10 +184,10 @@
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
@ -198,10 +202,10 @@
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-checkbox-group v-model="form.${field}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue">
|
:label="dict.value">
|
||||||
{{dict.dictLabel}}
|
{{dict.label}}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -215,11 +219,11 @@
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-radio-group v-model="form.${field}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
|
@ -261,6 +265,9 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
#if(${dicts} != '')
|
||||||
|
dicts: [${dicts}],
|
||||||
|
#end
|
||||||
components: {
|
components: {
|
||||||
Treeselect
|
Treeselect
|
||||||
},
|
},
|
||||||
|
|
@ -279,16 +286,7 @@ export default {
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
// $comment字典
|
|
||||||
${column.javaField}Options: [],
|
|
||||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
// $comment时间范围
|
// $comment时间范围
|
||||||
daterange${AttrName}: [],
|
daterange${AttrName}: [],
|
||||||
|
|
@ -326,13 +324,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
this.getDicts("${column.dictType}").then(response => {
|
|
||||||
this.${column.javaField}Options = response.data;
|
|
||||||
});
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
|
|
@ -378,20 +369,6 @@ export default {
|
||||||
this.${businessName}Options.push(data);
|
this.${businessName}Options.push(data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
// $comment字典翻译
|
|
||||||
${column.javaField}Format(row, column) {
|
|
||||||
return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
|
|
||||||
},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -471,13 +448,13 @@ export default {
|
||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(this.form).then(response => {
|
add${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -487,16 +464,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", {
|
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return del${BusinessName}(row.${pkColumn.javaField});
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
return del${BusinessName}(row.${pkColumn.javaField});
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${column.javaField}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -134,7 +134,11 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $column.dictType)
|
#elseif($column.list && "" != $column.dictType)
|
||||||
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
#elseif($column.list && "" != $javaField)
|
#elseif($column.list && "" != $javaField)
|
||||||
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||||
#end
|
#end
|
||||||
|
|
@ -201,10 +205,10 @@
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
@ -219,10 +223,10 @@
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-checkbox-group v-model="form.${field}">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue">
|
:label="dict.value">
|
||||||
{{dict.dictLabel}}
|
{{dict.label}}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -236,11 +240,11 @@
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-radio-group v-model="form.${field}">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in ${field}Options"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
|
@ -312,6 +316,9 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${Busin
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
#if(${dicts} != '')
|
||||||
|
dicts: [${dicts}],
|
||||||
|
#end
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -341,16 +348,7 @@ export default {
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
// $comment字典
|
|
||||||
${column.javaField}Options: [],
|
|
||||||
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
|
||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
// $comment时间范围
|
// $comment时间范围
|
||||||
daterange${AttrName}: [],
|
daterange${AttrName}: [],
|
||||||
|
|
@ -390,13 +388,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
this.getDicts("${column.dictType}").then(response => {
|
|
||||||
this.${column.javaField}Options = response.data;
|
|
||||||
});
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
|
|
@ -423,20 +414,6 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
#foreach ($column in $columns)
|
|
||||||
#if(${column.dictType} != '')
|
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
// $comment字典翻译
|
|
||||||
${column.javaField}Format(row, column) {
|
|
||||||
return this.selectDictLabel#if($column.htmlType == "checkbox")s#end(this.${column.javaField}Options, row.${column.javaField});
|
|
||||||
},
|
|
||||||
#end
|
|
||||||
#end
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -523,13 +500,13 @@ export default {
|
||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(this.form).then(response => {
|
add${BusinessName}(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -540,16 +517,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids;
|
||||||
this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", {
|
this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return del${BusinessName}(${pkColumn.javaField}s);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
return del${BusinessName}(${pkColumn.javaField}s);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
/** ${subTable.functionName}序号 */
|
/** ${subTable.functionName}序号 */
|
||||||
|
|
@ -570,7 +543,7 @@ export default {
|
||||||
/** ${subTable.functionName}删除按钮操作 */
|
/** ${subTable.functionName}删除按钮操作 */
|
||||||
handleDelete${subClassName}() {
|
handleDelete${subClassName}() {
|
||||||
if (this.checked${subClassName}.length == 0) {
|
if (this.checked${subClassName}.length == 0) {
|
||||||
this.msgError("请先选择要删除的${subTable.functionName}数据");
|
this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
||||||
} else {
|
} else {
|
||||||
const ${subclassName}List = this.${subclassName}List;
|
const ${subclassName}List = this.${subclassName}List;
|
||||||
const checked${subClassName} = this.checked${subClassName};
|
const checked${subClassName} = this.checked${subClassName};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,6 +38,9 @@ public class SysMenu extends BaseEntity
|
||||||
/** 组件路径 */
|
/** 组件路径 */
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
|
/** 路由参数 */
|
||||||
|
private String query;
|
||||||
|
|
||||||
/** 是否为外链(0是 1否) */
|
/** 是否为外链(0是 1否) */
|
||||||
private String isFrame;
|
private String isFrame;
|
||||||
|
|
||||||
|
|
@ -138,6 +140,16 @@ public class SysMenu extends BaseEntity
|
||||||
this.component = component;
|
this.component = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQuery()
|
||||||
|
{
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuery(String query)
|
||||||
|
{
|
||||||
|
this.query = query;
|
||||||
|
}
|
||||||
|
|
||||||
public String getIsFrame()
|
public String getIsFrame()
|
||||||
{
|
{
|
||||||
return isFrame;
|
return isFrame;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ public class RouterVo
|
||||||
*/
|
*/
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由参数:如 {"id": 1, "name": "ry"}
|
||||||
|
*/
|
||||||
|
private String query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,6 +106,16 @@ public class RouterVo
|
||||||
this.component = component;
|
this.component = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQuery()
|
||||||
|
{
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuery(String query)
|
||||||
|
{
|
||||||
|
this.query = query;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getAlwaysShow()
|
public Boolean getAlwaysShow()
|
||||||
{
|
{
|
||||||
return alwaysShow;
|
return alwaysShow;
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
router.setName(getRouteName(menu));
|
router.setName(getRouteName(menu));
|
||||||
router.setPath(getRouterPath(menu));
|
router.setPath(getRouterPath(menu));
|
||||||
router.setComponent(getComponent(menu));
|
router.setComponent(getComponent(menu));
|
||||||
|
router.setQuery(menu.getQuery());
|
||||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||||
List<SysMenu> cMenus = menu.getChildren();
|
List<SysMenu> cMenus = menu.getChildren();
|
||||||
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
||||||
|
|
@ -168,6 +169,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
children.setComponent(menu.getComponent());
|
children.setComponent(menu.getComponent());
|
||||||
children.setName(StringUtils.capitalize(menu.getPath()));
|
children.setName(StringUtils.capitalize(menu.getPath()));
|
||||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||||
|
children.setQuery(menu.getQuery());
|
||||||
childrenList.add(children);
|
childrenList.add(children);
|
||||||
router.setChildren(childrenList);
|
router.setChildren(childrenList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<result property="orderNum" column="order_num" />
|
<result property="orderNum" column="order_num" />
|
||||||
<result property="path" column="path" />
|
<result property="path" column="path" />
|
||||||
<result property="component" column="component" />
|
<result property="component" column="component" />
|
||||||
|
<result property="query" column="query" />
|
||||||
<result property="isFrame" column="is_frame" />
|
<result property="isFrame" column="is_frame" />
|
||||||
<result property="isCache" column="is_cache" />
|
<result property="isCache" column="is_cache" />
|
||||||
<result property="menuType" column="menu_type" />
|
<result property="menuType" column="menu_type" />
|
||||||
|
|
@ -27,7 +28,7 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectMenuVo">
|
<sql id="selectMenuVo">
|
||||||
select menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
|
select menu_id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
|
||||||
from sys_menu
|
from sys_menu
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -48,32 +49,32 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
|
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
|
||||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||||
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
|
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
|
||||||
order by m.parent_id, m.order_num
|
order by m.parent_id, m.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
|
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
|
||||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
left join sys_user_role ur on rm.role_id = ur.role_id
|
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||||
left join sys_role ro on ur.role_id = ro.role_id
|
left join sys_role ro on ur.role_id = ro.role_id
|
||||||
where ur.user_id = #{params.userId}
|
where ur.user_id = #{params.userId}
|
||||||
<if test="menuName != null and menuName != ''">
|
<if test="menuName != null and menuName != ''">
|
||||||
AND menu_name like concat('%', #{menuName}, '%')
|
AND m.menu_name like concat('%', #{menuName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="visible != null and visible != ''">
|
<if test="visible != null and visible != ''">
|
||||||
AND visible = #{visible}
|
AND m.visible = #{visible}
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
AND status = #{status}
|
AND m.status = #{status}
|
||||||
</if>
|
</if>
|
||||||
order by m.parent_id, m.order_num
|
order by m.parent_id, m.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
|
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
|
||||||
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.query, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
left join sys_user_role ur on rm.role_id = ur.role_id
|
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||||
|
|
@ -132,6 +133,7 @@
|
||||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||||
<if test="path != null and path != ''">path = #{path},</if>
|
<if test="path != null and path != ''">path = #{path},</if>
|
||||||
<if test="component != null">component = #{component},</if>
|
<if test="component != null">component = #{component},</if>
|
||||||
|
<if test="query != null">query = #{query},</if>
|
||||||
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
||||||
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
||||||
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
||||||
|
|
@ -154,6 +156,7 @@
|
||||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||||
<if test="path != null and path != ''">path,</if>
|
<if test="path != null and path != ''">path,</if>
|
||||||
<if test="component != null and component != ''">component,</if>
|
<if test="component != null and component != ''">component,</if>
|
||||||
|
<if test="query != null and query != ''">query,</if>
|
||||||
<if test="isFrame != null and isFrame != ''">is_frame,</if>
|
<if test="isFrame != null and isFrame != ''">is_frame,</if>
|
||||||
<if test="isCache != null and isCache != ''">is_cache,</if>
|
<if test="isCache != null and isCache != ''">is_cache,</if>
|
||||||
<if test="menuType != null and menuType != ''">menu_type,</if>
|
<if test="menuType != null and menuType != ''">menu_type,</if>
|
||||||
|
|
@ -171,6 +174,7 @@
|
||||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||||
<if test="path != null and path != ''">#{path},</if>
|
<if test="path != null and path != ''">#{path},</if>
|
||||||
<if test="component != null and component != ''">#{component},</if>
|
<if test="component != null and component != ''">#{component},</if>
|
||||||
|
<if test="query != null and query != ''">#{query},</if>
|
||||||
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
|
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
|
||||||
<if test="isCache != null and isCache != ''">#{isCache},</if>
|
<if test="isCache != null and isCache != ''">#{isCache},</if>
|
||||||
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"description": "若依管理系统",
|
"description": "若依管理系统",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -41,8 +41,8 @@
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"core-js": "3.8.1",
|
"core-js": "3.8.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.15.5",
|
"element-ui": "2.15.6",
|
||||||
"file-saver": "2.0.4",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "6.4.3",
|
"fuse.js": "6.4.3",
|
||||||
"highlight.js": "9.18.5",
|
"highlight.js": "9.18.5",
|
||||||
"js-beautify": "1.13.0",
|
"js-beautify": "1.13.0",
|
||||||
|
|
@ -71,8 +71,8 @@
|
||||||
"eslint-plugin-vue": "7.2.0",
|
"eslint-plugin-vue": "7.2.0",
|
||||||
"lint-staged": "10.5.3",
|
"lint-staged": "10.5.3",
|
||||||
"runjs": "4.4.2",
|
"runjs": "4.4.2",
|
||||||
"sass": "1.32.0",
|
"sass": "1.32.13",
|
||||||
"sass-loader": "10.1.0",
|
"sass-loader": "10.1.1",
|
||||||
"script-ext-html-webpack-plugin": "2.1.5",
|
"script-ext-html-webpack-plugin": "2.1.5",
|
||||||
"svg-sprite-loader": "5.1.1",
|
"svg-sprite-loader": "5.1.1",
|
||||||
"vue-template-compiler": "2.6.12"
|
"vue-template-compiler": "2.6.12"
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,17 @@
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-dialog:not(.is-fullscreen){
|
.el-dialog:not(.is-fullscreen) {
|
||||||
margin-top: 6vh !important;
|
margin-top: 6vh !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body {
|
||||||
|
overflow: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
max-height: 70vh;
|
||||||
|
padding: 10px 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.el-table {
|
.el-table {
|
||||||
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
|
.el-table__header-wrapper, .el-table__fixed-header-wrapper {
|
||||||
th {
|
th {
|
||||||
|
|
@ -130,7 +137,7 @@
|
||||||
/** 表格更多操作下拉样式 */
|
/** 表格更多操作下拉样式 */
|
||||||
.el-table .el-dropdown-link {
|
.el-table .el-dropdown-link {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #1890ff;
|
color: #409EFF;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@
|
||||||
.main-container {
|
.main-container {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
transition: margin-left .28s;
|
transition: margin-left .28s;
|
||||||
margin-left: $sideBarWidth;
|
margin-left: $base-sidebar-width;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
-webkit-transition: width .28s;
|
-webkit-transition: width .28s;
|
||||||
transition: width 0.28s;
|
transition: width 0.28s;
|
||||||
width: $sideBarWidth !important;
|
width: $base-sidebar-width !important;
|
||||||
background-color: $menuBg;
|
background-color: $base-menu-background;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
font-size: 0px;
|
font-size: 0px;
|
||||||
|
|
@ -81,12 +81,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
& .theme-dark .is-active > .el-submenu__title {
|
& .theme-dark .is-active > .el-submenu__title {
|
||||||
color: $subMenuActiveText !important;
|
color: $base-menu-color-active !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .nest-menu .el-submenu>.el-submenu__title,
|
& .nest-menu .el-submenu>.el-submenu__title,
|
||||||
& .el-submenu .el-menu-item {
|
& .el-submenu .el-menu-item {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $base-sidebar-width !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(0, 0, 0, 0.06) !important;
|
background-color: rgba(0, 0, 0, 0.06) !important;
|
||||||
|
|
@ -95,10 +95,10 @@
|
||||||
|
|
||||||
& .theme-dark .nest-menu .el-submenu>.el-submenu__title,
|
& .theme-dark .nest-menu .el-submenu>.el-submenu__title,
|
||||||
& .theme-dark .el-submenu .el-menu-item {
|
& .theme-dark .el-submenu .el-menu-item {
|
||||||
background-color: $subMenuBg !important;
|
background-color: $base-sub-menu-background !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: $subMenuHover !important;
|
background-color: $base-sub-menu-hover !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu--collapse .el-menu .el-submenu {
|
.el-menu--collapse .el-menu .el-submenu {
|
||||||
min-width: $sideBarWidth !important;
|
min-width: $base-sidebar-width !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mobile responsive
|
// mobile responsive
|
||||||
|
|
@ -165,14 +165,14 @@
|
||||||
|
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
transition: transform .28s;
|
transition: transform .28s;
|
||||||
width: $sideBarWidth !important;
|
width: $base-sidebar-width !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hideSidebar {
|
&.hideSidebar {
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transition-duration: 0.3s;
|
transition-duration: 0.3s;
|
||||||
transform: translate3d(-$sideBarWidth, 0, 0);
|
transform: translate3d(-$base-sidebar-width, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,37 +8,47 @@ $tiffany: #4AB7BD;
|
||||||
$yellow:#FEC171;
|
$yellow:#FEC171;
|
||||||
$panGreen: #30B08F;
|
$panGreen: #30B08F;
|
||||||
|
|
||||||
// sidebar
|
// 默认菜单主题风格
|
||||||
$menuText:#bfcbd9;
|
$base-menu-color:#bfcbd9;
|
||||||
$menuActiveText:#409EFF;
|
$base-menu-color-active:#f4f4f5;
|
||||||
$subMenuActiveText:#f4f4f5; // https://github.com/ElemeFE/element/issues/12951
|
$base-menu-background:#304156;
|
||||||
|
$base-logo-title-color: #ffffff;
|
||||||
|
|
||||||
$menuBg:#304156;
|
$base-menu-light-color:rgba(0,0,0,.70);
|
||||||
$menuHover:#263445;
|
$base-menu-light-background:#ffffff;
|
||||||
$sidebarTitle: #ffffff;
|
$base-logo-light-title-color: #001529;
|
||||||
|
|
||||||
$menuLightBg:#ffffff;
|
$base-sub-menu-background:#1f2d3d;
|
||||||
$menuLightHover:#f0f1f5;
|
$base-sub-menu-hover:#001528;
|
||||||
$sidebarLightTitle: #001529;
|
|
||||||
|
|
||||||
$subMenuBg:#1f2d3d;
|
// 自定义暗色菜单风格
|
||||||
$subMenuHover:#001528;
|
/**
|
||||||
|
$base-menu-color:hsla(0,0%,100%,.65);
|
||||||
|
$base-menu-color-active:#fff;
|
||||||
|
$base-menu-background:#001529;
|
||||||
|
$base-logo-title-color: #ffffff;
|
||||||
|
|
||||||
$sideBarWidth: 200px;
|
$base-menu-light-color:rgba(0,0,0,.70);
|
||||||
|
$base-menu-light-background:#ffffff;
|
||||||
|
$base-logo-light-title-color: #001529;
|
||||||
|
|
||||||
|
$base-sub-menu-background:#000c17;
|
||||||
|
$base-sub-menu-hover:#001528;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$base-sidebar-width: 200px;
|
||||||
|
|
||||||
// the :export directive is the magic sauce for webpack
|
// the :export directive is the magic sauce for webpack
|
||||||
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
|
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
|
||||||
:export {
|
:export {
|
||||||
menuText: $menuText;
|
menuColor: $base-menu-color;
|
||||||
menuActiveText: $menuActiveText;
|
menuLightColor: $base-menu-light-color;
|
||||||
subMenuActiveText: $subMenuActiveText;
|
menuColorActive: $base-menu-color-active;
|
||||||
menuBg: $menuBg;
|
menuBackground: $base-menu-background;
|
||||||
menuHover: $menuHover;
|
menuLightBackground: $base-menu-light-background;
|
||||||
menuLightBg: $menuLightBg;
|
subMenuBackground: $base-sub-menu-background;
|
||||||
menuLightHover: $menuLightHover;
|
subMenuHover: $base-sub-menu-hover;
|
||||||
subMenuBg: $subMenuBg;
|
sideBarWidth: $base-sidebar-width;
|
||||||
subMenuHover: $subMenuHover;
|
logoTitleColor: $base-logo-title-color;
|
||||||
sideBarWidth: $sideBarWidth;
|
logoLightTitleColor: $base-logo-light-title-color
|
||||||
sidebarTitle: $sidebarTitle;
|
|
||||||
sidebarLightTitle: $sidebarLightTitle
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,179 @@
|
||||||
|
<template>
|
||||||
|
<el-form size="small">
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
日,允许的通配符[, - * / L M]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
不指定
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min="0" :max="31" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="0" :max="31" /> 日
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min="0" :max="31" /> 号开始,每
|
||||||
|
<el-input-number v-model='average02' :min="0" :max="31" /> 日执行一次
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="5">
|
||||||
|
每月
|
||||||
|
<el-input-number v-model='workday' :min="0" :max="31" /> 号最近的那个工作日
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="6">
|
||||||
|
本月最后一天
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="7">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="item in 31" :key="item" :value="item">{{item}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 1,
|
||||||
|
workday: 1,
|
||||||
|
cycle01: 1,
|
||||||
|
cycle02: 2,
|
||||||
|
average01: 1,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-day',
|
||||||
|
props: ['check', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
('day rachange');
|
||||||
|
if (this.radioValue === 1) {
|
||||||
|
this.$emit('update', 'day', '*', 'day');
|
||||||
|
this.$emit('update', 'week', '?', 'day');
|
||||||
|
this.$emit('update', 'month', '*', 'day');
|
||||||
|
} else {
|
||||||
|
if (this.cron.hour === '*') {
|
||||||
|
this.$emit('update', 'hour', '0', 'day');
|
||||||
|
}
|
||||||
|
if (this.cron.min === '*') {
|
||||||
|
this.$emit('update', 'min', '0', 'day');
|
||||||
|
}
|
||||||
|
if (this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'day');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'day', '?');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'day', this.average01 + '/' + this.average02);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this.$emit('update', 'day', this.workday + 'W');
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
this.$emit('update', 'day', 'L');
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
this.$emit('update', 'day', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
('day rachange end');
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'day', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'day', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 最近工作日值变化时
|
||||||
|
workdayChange() {
|
||||||
|
if (this.radioValue == '5') {
|
||||||
|
this.$emit('update', 'day', this.workday + 'W');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '7') {
|
||||||
|
this.$emit('update', 'day', this.checkboxString);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 父组件传递的week发生变化触发
|
||||||
|
weekChange() {
|
||||||
|
//判断week值与day不能同时为“?”
|
||||||
|
if (this.cron.week == '?' && this.radioValue == '2') {
|
||||||
|
this.radioValue = '1';
|
||||||
|
} else if (this.cron.week !== '?' && this.radioValue != '2') {
|
||||||
|
this.radioValue = '2';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'workdayCheck': 'workdayChange',
|
||||||
|
'checkboxString': 'checkboxChange',
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 1, 31)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 1, 31)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 1, 31)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 31)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算工作日格式
|
||||||
|
workdayCheck: function () {
|
||||||
|
this.workday = this.checkNum(this.workday, 1, 31)
|
||||||
|
return this.workday;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
<template>
|
||||||
|
<el-form size="small">
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
小时,允许的通配符[, - * /]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="0" :max="60" /> 小时
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min="0" :max="60" /> 小时开始,每
|
||||||
|
<el-input-number v-model='average02' :min="0" :max="60" /> 小时执行一次
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 1,
|
||||||
|
cycle01: 0,
|
||||||
|
cycle02: 1,
|
||||||
|
average01: 0,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-hour',
|
||||||
|
props: ['check', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
if (this.radioValue === 1) {
|
||||||
|
this.$emit('update', 'hour', '*', 'hour');
|
||||||
|
this.$emit('update', 'day', '*', 'hour');
|
||||||
|
} else {
|
||||||
|
if (this.cron.min === '*') {
|
||||||
|
this.$emit('update', 'min', '0', 'hour');
|
||||||
|
}
|
||||||
|
if (this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'hour');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'hour', this.average01 + '/' + this.average02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '2') {
|
||||||
|
this.$emit('update', 'hour', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'hour', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'checkboxString': 'checkboxChange'
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 0, 23)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 0, 23)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 0, 23)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 23)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,425 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="秒" v-if="shouldHide('second')">
|
||||||
|
<CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" />
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="分钟" v-if="shouldHide('min')">
|
||||||
|
<CrontabMin
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronmin"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="小时" v-if="shouldHide('hour')">
|
||||||
|
<CrontabHour
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronhour"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="日" v-if="shouldHide('day')">
|
||||||
|
<CrontabDay
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronday"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="月" v-if="shouldHide('month')">
|
||||||
|
<CrontabMonth
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronmonth"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="周" v-if="shouldHide('week')">
|
||||||
|
<CrontabWeek
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronweek"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="年" v-if="shouldHide('year')">
|
||||||
|
<CrontabYear
|
||||||
|
@update="updateCrontabValue"
|
||||||
|
:check="checkNumber"
|
||||||
|
:cron="crontabValueObj"
|
||||||
|
ref="cronyear"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<div class="popup-main">
|
||||||
|
<div class="popup-result">
|
||||||
|
<p class="title">时间表达式</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<th v-for="item of tabTitles" width="40" :key="item">{{item}}</th>
|
||||||
|
<th>Cron 表达式</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.second}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.min}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.hour}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.day}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.month}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.week}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueObj.year}}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>{{crontabValueString}}</span>
|
||||||
|
</td>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<CrontabResult :ex="crontabValueString"></CrontabResult>
|
||||||
|
|
||||||
|
<div class="pop_btn">
|
||||||
|
<el-button size="small" type="primary" @click="submitFill">确定</el-button>
|
||||||
|
<el-button size="small" type="warning" @click="clearCron">重置</el-button>
|
||||||
|
<el-button size="small" @click="hidePopup">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CrontabSecond from "./second.vue";
|
||||||
|
import CrontabMin from "./min.vue";
|
||||||
|
import CrontabHour from "./hour.vue";
|
||||||
|
import CrontabDay from "./day.vue";
|
||||||
|
import CrontabMonth from "./month.vue";
|
||||||
|
import CrontabWeek from "./week.vue";
|
||||||
|
import CrontabYear from "./year.vue";
|
||||||
|
import CrontabResult from "./result.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tabTitles: ["秒", "分钟", "小时", "日", "月", "周", "年"],
|
||||||
|
tabActive: 0,
|
||||||
|
myindex: 0,
|
||||||
|
crontabValueObj: {
|
||||||
|
second: "*",
|
||||||
|
min: "*",
|
||||||
|
hour: "*",
|
||||||
|
day: "*",
|
||||||
|
month: "*",
|
||||||
|
week: "?",
|
||||||
|
year: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
name: "vcrontab",
|
||||||
|
props: ["expression", "hideComponent"],
|
||||||
|
methods: {
|
||||||
|
shouldHide(key) {
|
||||||
|
if (this.hideComponent && this.hideComponent.includes(key)) return false;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
resolveExp() {
|
||||||
|
// 反解析 表达式
|
||||||
|
if (this.expression) {
|
||||||
|
let arr = this.expression.split(" ");
|
||||||
|
if (arr.length >= 6) {
|
||||||
|
//6 位以上是合法表达式
|
||||||
|
let obj = {
|
||||||
|
second: arr[0],
|
||||||
|
min: arr[1],
|
||||||
|
hour: arr[2],
|
||||||
|
day: arr[3],
|
||||||
|
month: arr[4],
|
||||||
|
week: arr[5],
|
||||||
|
year: arr[6] ? arr[6] : "",
|
||||||
|
};
|
||||||
|
this.crontabValueObj = {
|
||||||
|
...obj,
|
||||||
|
};
|
||||||
|
for (let i in obj) {
|
||||||
|
if (obj[i]) this.changeRadio(i, obj[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 没有传入的表达式 则还原
|
||||||
|
this.clearCron();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// tab切换值
|
||||||
|
tabCheck(index) {
|
||||||
|
this.tabActive = index;
|
||||||
|
},
|
||||||
|
// 由子组件触发,更改表达式组成的字段值
|
||||||
|
updateCrontabValue(name, value, from) {
|
||||||
|
"updateCrontabValue", name, value, from;
|
||||||
|
this.crontabValueObj[name] = value;
|
||||||
|
if (from && from !== name) {
|
||||||
|
console.log(`来自组件 ${from} 改变了 ${name} ${value}`);
|
||||||
|
this.changeRadio(name, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 赋值到组件
|
||||||
|
changeRadio(name, value) {
|
||||||
|
let arr = ["second", "min", "hour", "month"],
|
||||||
|
refName = "cron" + name,
|
||||||
|
insValue;
|
||||||
|
|
||||||
|
if (!this.$refs[refName]) return;
|
||||||
|
|
||||||
|
if (arr.includes(name)) {
|
||||||
|
if (value === "*") {
|
||||||
|
insValue = 1;
|
||||||
|
} else if (value.indexOf("-") > -1) {
|
||||||
|
let indexArr = value.split("-");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].cycle01 = 0)
|
||||||
|
: (this.$refs[refName].cycle01 = indexArr[0]);
|
||||||
|
this.$refs[refName].cycle02 = indexArr[1];
|
||||||
|
insValue = 2;
|
||||||
|
} else if (value.indexOf("/") > -1) {
|
||||||
|
let indexArr = value.split("/");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].average01 = 0)
|
||||||
|
: (this.$refs[refName].average01 = indexArr[0]);
|
||||||
|
this.$refs[refName].average02 = indexArr[1];
|
||||||
|
insValue = 3;
|
||||||
|
} else {
|
||||||
|
insValue = 4;
|
||||||
|
this.$refs[refName].checkboxList = value.split(",");
|
||||||
|
}
|
||||||
|
} else if (name == "day") {
|
||||||
|
if (value === "*") {
|
||||||
|
insValue = 1;
|
||||||
|
} else if (value == "?") {
|
||||||
|
insValue = 2;
|
||||||
|
} else if (value.indexOf("-") > -1) {
|
||||||
|
let indexArr = value.split("-");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].cycle01 = 0)
|
||||||
|
: (this.$refs[refName].cycle01 = indexArr[0]);
|
||||||
|
this.$refs[refName].cycle02 = indexArr[1];
|
||||||
|
insValue = 3;
|
||||||
|
} else if (value.indexOf("/") > -1) {
|
||||||
|
let indexArr = value.split("/");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].average01 = 0)
|
||||||
|
: (this.$refs[refName].average01 = indexArr[0]);
|
||||||
|
this.$refs[refName].average02 = indexArr[1];
|
||||||
|
insValue = 4;
|
||||||
|
} else if (value.indexOf("W") > -1) {
|
||||||
|
let indexArr = value.split("W");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].workday = 0)
|
||||||
|
: (this.$refs[refName].workday = indexArr[0]);
|
||||||
|
insValue = 5;
|
||||||
|
} else if (value === "L") {
|
||||||
|
insValue = 6;
|
||||||
|
} else {
|
||||||
|
this.$refs[refName].checkboxList = value.split(",");
|
||||||
|
insValue = 7;
|
||||||
|
}
|
||||||
|
} else if (name == "week") {
|
||||||
|
if (value === "*") {
|
||||||
|
insValue = 1;
|
||||||
|
} else if (value == "?") {
|
||||||
|
insValue = 2;
|
||||||
|
} else if (value.indexOf("-") > -1) {
|
||||||
|
let indexArr = value.split("-");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].cycle01 = 0)
|
||||||
|
: (this.$refs[refName].cycle01 = indexArr[0]);
|
||||||
|
this.$refs[refName].cycle02 = indexArr[1];
|
||||||
|
insValue = 3;
|
||||||
|
} else if (value.indexOf("#") > -1) {
|
||||||
|
let indexArr = value.split("#");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].average01 = 1)
|
||||||
|
: (this.$refs[refName].average01 = indexArr[0]);
|
||||||
|
this.$refs[refName].average02 = indexArr[1];
|
||||||
|
insValue = 4;
|
||||||
|
} else if (value.indexOf("L") > -1) {
|
||||||
|
let indexArr = value.split("L");
|
||||||
|
isNaN(indexArr[0])
|
||||||
|
? (this.$refs[refName].weekday = 1)
|
||||||
|
: (this.$refs[refName].weekday = indexArr[0]);
|
||||||
|
insValue = 5;
|
||||||
|
} else {
|
||||||
|
this.$refs[refName].checkboxList = value.split(",");
|
||||||
|
insValue = 7;
|
||||||
|
}
|
||||||
|
} else if (name == "year") {
|
||||||
|
if (value == "") {
|
||||||
|
insValue = 1;
|
||||||
|
} else if (value == "*") {
|
||||||
|
insValue = 2;
|
||||||
|
} else if (value.indexOf("-") > -1) {
|
||||||
|
insValue = 3;
|
||||||
|
} else if (value.indexOf("/") > -1) {
|
||||||
|
insValue = 4;
|
||||||
|
} else {
|
||||||
|
this.$refs[refName].checkboxList = value.split(",");
|
||||||
|
insValue = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$refs[refName].radioValue = insValue;
|
||||||
|
},
|
||||||
|
// 表单选项的子组件校验数字格式(通过-props传递)
|
||||||
|
checkNumber(value, minLimit, maxLimit) {
|
||||||
|
// 检查必须为整数
|
||||||
|
value = Math.floor(value);
|
||||||
|
if (value < minLimit) {
|
||||||
|
value = minLimit;
|
||||||
|
} else if (value > maxLimit) {
|
||||||
|
value = maxLimit;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
// 隐藏弹窗
|
||||||
|
hidePopup() {
|
||||||
|
this.$emit("hide");
|
||||||
|
},
|
||||||
|
// 填充表达式
|
||||||
|
submitFill() {
|
||||||
|
this.$emit("fill", this.crontabValueString);
|
||||||
|
this.hidePopup();
|
||||||
|
},
|
||||||
|
clearCron() {
|
||||||
|
// 还原选择项
|
||||||
|
("准备还原");
|
||||||
|
this.crontabValueObj = {
|
||||||
|
second: "*",
|
||||||
|
min: "*",
|
||||||
|
hour: "*",
|
||||||
|
day: "*",
|
||||||
|
month: "*",
|
||||||
|
week: "?",
|
||||||
|
year: "",
|
||||||
|
};
|
||||||
|
for (let j in this.crontabValueObj) {
|
||||||
|
this.changeRadio(j, this.crontabValueObj[j]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
crontabValueString: function() {
|
||||||
|
let obj = this.crontabValueObj;
|
||||||
|
let str =
|
||||||
|
obj.second +
|
||||||
|
" " +
|
||||||
|
obj.min +
|
||||||
|
" " +
|
||||||
|
obj.hour +
|
||||||
|
" " +
|
||||||
|
obj.day +
|
||||||
|
" " +
|
||||||
|
obj.month +
|
||||||
|
" " +
|
||||||
|
obj.week +
|
||||||
|
(obj.year == "" ? "" : " " + obj.year);
|
||||||
|
return str;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
CrontabSecond,
|
||||||
|
CrontabMin,
|
||||||
|
CrontabHour,
|
||||||
|
CrontabDay,
|
||||||
|
CrontabMonth,
|
||||||
|
CrontabWeek,
|
||||||
|
CrontabYear,
|
||||||
|
CrontabResult,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
expression: "resolveExp",
|
||||||
|
hideComponent(value) {
|
||||||
|
// 隐藏部分组件
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted: function() {
|
||||||
|
this.resolveExp();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.pop_btn {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.popup-main {
|
||||||
|
position: relative;
|
||||||
|
margin: 10px auto;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.popup-title {
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 34px;
|
||||||
|
padding-top: 6px;
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
.popup-result {
|
||||||
|
box-sizing: border-box;
|
||||||
|
line-height: 24px;
|
||||||
|
margin: 25px auto;
|
||||||
|
padding: 15px 10px 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.popup-result .title {
|
||||||
|
position: absolute;
|
||||||
|
top: -28px;
|
||||||
|
left: 50%;
|
||||||
|
width: 140px;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-left: -70px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 30px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.popup-result table {
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.popup-result table span {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
font-family: arial;
|
||||||
|
line-height: 30px;
|
||||||
|
height: 30px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #e8e8e8;
|
||||||
|
}
|
||||||
|
.popup-result-scroll {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 24px;
|
||||||
|
height: 10em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<template>
|
||||||
|
<el-form size="small">
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
分钟,允许的通配符[, - * /]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="0" :max="60" /> 分钟
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min="0" :max="60" /> 分钟开始,每
|
||||||
|
<el-input-number v-model='average02' :min="0" :max="60" /> 分钟执行一次
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 1,
|
||||||
|
cycle01: 1,
|
||||||
|
cycle02: 2,
|
||||||
|
average01: 0,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-min',
|
||||||
|
props: ['check', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
if (this.radioValue !== 1 && this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'min');
|
||||||
|
}
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'min', '*', 'min');
|
||||||
|
this.$emit('update', 'hour', '*', 'min');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'min', this.checkboxString, 'min');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '2') {
|
||||||
|
this.$emit('update', 'min', this.cycleTotal, 'min');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'min', this.averageTotal, 'min');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'min', this.checkboxString, 'min');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'checkboxString': 'checkboxChange',
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 0, 59)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 59)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
<template>
|
||||||
|
<el-form size='small'>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
月,允许的通配符[, - * /]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min="1" :max="12" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="1" :max="12" /> 月
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min="1" :max="12" /> 月开始,每
|
||||||
|
<el-input-number v-model='average02' :min="1" :max="12" /> 月月执行一次
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="item in 12" :key="item" :value="item">{{item}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 1,
|
||||||
|
cycle01: 1,
|
||||||
|
cycle02: 2,
|
||||||
|
average01: 1,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-month',
|
||||||
|
props: ['check', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
if (this.radioValue === 1) {
|
||||||
|
this.$emit('update', 'month', '*');
|
||||||
|
this.$emit('update', 'year', '*');
|
||||||
|
} else {
|
||||||
|
if (this.cron.day === '*') {
|
||||||
|
this.$emit('update', 'day', '0', 'month');
|
||||||
|
}
|
||||||
|
if (this.cron.hour === '*') {
|
||||||
|
this.$emit('update', 'hour', '0', 'month');
|
||||||
|
}
|
||||||
|
if (this.cron.min === '*') {
|
||||||
|
this.$emit('update', 'min', '0', 'month');
|
||||||
|
}
|
||||||
|
if (this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'month');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'month', this.average01 + '/' + this.average02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'month', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '2') {
|
||||||
|
this.$emit('update', 'month', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'month', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'month', this.checkboxString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'checkboxString': 'checkboxChange'
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 1, 12)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 1, 12)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 1, 12)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 12)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,566 @@
|
||||||
|
<template>
|
||||||
|
<div class="popup-result">
|
||||||
|
<p class="title">最近5次运行时间</p>
|
||||||
|
<ul class="popup-result-scroll">
|
||||||
|
<template v-if='isShow'>
|
||||||
|
<li v-for='item in resultList' :key="item">{{item}}</li>
|
||||||
|
</template>
|
||||||
|
<li v-else>计算结果中...</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dayRule: '',
|
||||||
|
dayRuleSup: '',
|
||||||
|
dateArr: [],
|
||||||
|
resultList: [],
|
||||||
|
isShow: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-result',
|
||||||
|
methods: {
|
||||||
|
// 表达式值变化时,开始去计算结果
|
||||||
|
expressionChange() {
|
||||||
|
|
||||||
|
// 计算开始-隐藏结果
|
||||||
|
this.isShow = false;
|
||||||
|
// 获取规则数组[0秒、1分、2时、3日、4月、5星期、6年]
|
||||||
|
let ruleArr = this.$options.propsData.ex.split(' ');
|
||||||
|
// 用于记录进入循环的次数
|
||||||
|
let nums = 0;
|
||||||
|
// 用于暂时存符号时间规则结果的数组
|
||||||
|
let resultArr = [];
|
||||||
|
// 获取当前时间精确至[年、月、日、时、分、秒]
|
||||||
|
let nTime = new Date();
|
||||||
|
let nYear = nTime.getFullYear();
|
||||||
|
let nMonth = nTime.getMonth() + 1;
|
||||||
|
let nDay = nTime.getDate();
|
||||||
|
let nHour = nTime.getHours();
|
||||||
|
let nMin = nTime.getMinutes();
|
||||||
|
let nSecond = nTime.getSeconds();
|
||||||
|
// 根据规则获取到近100年可能年数组、月数组等等
|
||||||
|
this.getSecondArr(ruleArr[0]);
|
||||||
|
this.getMinArr(ruleArr[1]);
|
||||||
|
this.getHourArr(ruleArr[2]);
|
||||||
|
this.getDayArr(ruleArr[3]);
|
||||||
|
this.getMonthArr(ruleArr[4]);
|
||||||
|
this.getWeekArr(ruleArr[5]);
|
||||||
|
this.getYearArr(ruleArr[6], nYear);
|
||||||
|
// 将获取到的数组赋值-方便使用
|
||||||
|
let sDate = this.dateArr[0];
|
||||||
|
let mDate = this.dateArr[1];
|
||||||
|
let hDate = this.dateArr[2];
|
||||||
|
let DDate = this.dateArr[3];
|
||||||
|
let MDate = this.dateArr[4];
|
||||||
|
let YDate = this.dateArr[5];
|
||||||
|
// 获取当前时间在数组中的索引
|
||||||
|
let sIdx = this.getIndex(sDate, nSecond);
|
||||||
|
let mIdx = this.getIndex(mDate, nMin);
|
||||||
|
let hIdx = this.getIndex(hDate, nHour);
|
||||||
|
let DIdx = this.getIndex(DDate, nDay);
|
||||||
|
let MIdx = this.getIndex(MDate, nMonth);
|
||||||
|
let YIdx = this.getIndex(YDate, nYear);
|
||||||
|
// 重置月日时分秒的函数(后面用的比较多)
|
||||||
|
const resetSecond = function () {
|
||||||
|
sIdx = 0;
|
||||||
|
nSecond = sDate[sIdx]
|
||||||
|
}
|
||||||
|
const resetMin = function () {
|
||||||
|
mIdx = 0;
|
||||||
|
nMin = mDate[mIdx]
|
||||||
|
resetSecond();
|
||||||
|
}
|
||||||
|
const resetHour = function () {
|
||||||
|
hIdx = 0;
|
||||||
|
nHour = hDate[hIdx]
|
||||||
|
resetMin();
|
||||||
|
}
|
||||||
|
const resetDay = function () {
|
||||||
|
DIdx = 0;
|
||||||
|
nDay = DDate[DIdx]
|
||||||
|
resetHour();
|
||||||
|
}
|
||||||
|
const resetMonth = function () {
|
||||||
|
MIdx = 0;
|
||||||
|
nMonth = MDate[MIdx]
|
||||||
|
resetDay();
|
||||||
|
}
|
||||||
|
// 如果当前年份不为数组中当前值
|
||||||
|
if (nYear !== YDate[YIdx]) {
|
||||||
|
resetMonth();
|
||||||
|
}
|
||||||
|
// 如果当前月份不为数组中当前值
|
||||||
|
if (nMonth !== MDate[MIdx]) {
|
||||||
|
resetDay();
|
||||||
|
}
|
||||||
|
// 如果当前“日”不为数组中当前值
|
||||||
|
if (nDay !== DDate[DIdx]) {
|
||||||
|
resetHour();
|
||||||
|
}
|
||||||
|
// 如果当前“时”不为数组中当前值
|
||||||
|
if (nHour !== hDate[hIdx]) {
|
||||||
|
resetMin();
|
||||||
|
}
|
||||||
|
// 如果当前“分”不为数组中当前值
|
||||||
|
if (nMin !== mDate[mIdx]) {
|
||||||
|
resetSecond();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 循环年份数组
|
||||||
|
goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) {
|
||||||
|
let YY = YDate[Yi];
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (nMonth > MDate[MDate.length - 1]) {
|
||||||
|
resetMonth();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 循环月份数组
|
||||||
|
goMonth: for (let Mi = MIdx; Mi < MDate.length; Mi++) {
|
||||||
|
// 赋值、方便后面运算
|
||||||
|
let MM = MDate[Mi];
|
||||||
|
MM = MM < 10 ? '0' + MM : MM;
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (nDay > DDate[DDate.length - 1]) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 循环日期数组
|
||||||
|
goDay: for (let Di = DIdx; Di < DDate.length; Di++) {
|
||||||
|
// 赋值、方便后面运算
|
||||||
|
let DD = DDate[Di];
|
||||||
|
let thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
|
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (nHour > hDate[hDate.length - 1]) {
|
||||||
|
resetHour();
|
||||||
|
if (Di == DDate.length - 1) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断日期的合法性,不合法的话也是跳出当前循环
|
||||||
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') {
|
||||||
|
resetDay();
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
// 如果日期规则中有值时
|
||||||
|
if (this.dayRule == 'lastDay') {
|
||||||
|
// 如果不是合法日期则需要将前将日期调到合法日期即月末最后一天
|
||||||
|
|
||||||
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
DD--;
|
||||||
|
|
||||||
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this.dayRule == 'workDay') {
|
||||||
|
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
|
||||||
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
DD--;
|
||||||
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取达到条件的日期是星期X
|
||||||
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
||||||
|
// 当星期日时
|
||||||
|
if (thisWeek == 0) {
|
||||||
|
// 先找下一个日,并判断是否为月底
|
||||||
|
DD++;
|
||||||
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
|
// 判断下一日已经不是合法日期
|
||||||
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
DD -= 3;
|
||||||
|
}
|
||||||
|
} else if (thisWeek == 6) {
|
||||||
|
// 当星期6时只需判断不是1号就可进行操作
|
||||||
|
if (this.dayRuleSup !== 1) {
|
||||||
|
DD--;
|
||||||
|
} else {
|
||||||
|
DD += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (this.dayRule == 'weekDay') {
|
||||||
|
// 如果指定了是星期几
|
||||||
|
// 获取当前日期是属于星期几
|
||||||
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
||||||
|
// 校验当前星期是否在星期池(dayRuleSup)中
|
||||||
|
if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) {
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (Di == DDate.length - 1) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (this.dayRule == 'assWeek') {
|
||||||
|
// 如果指定了是第几周的星期几
|
||||||
|
// 获取每月1号是属于星期几
|
||||||
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
|
||||||
|
if (this.dayRuleSup[1] >= thisWeek) {
|
||||||
|
DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1;
|
||||||
|
} else {
|
||||||
|
DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1;
|
||||||
|
}
|
||||||
|
} else if (this.dayRule == 'lastWeek') {
|
||||||
|
// 如果指定了每月最后一个星期几
|
||||||
|
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
|
||||||
|
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
|
||||||
|
DD--;
|
||||||
|
thisDD = DD < 10 ? '0' + DD : DD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取月末最后一天是星期几
|
||||||
|
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
|
||||||
|
// 找到要求中最近的那个星期几
|
||||||
|
if (this.dayRuleSup < thisWeek) {
|
||||||
|
DD -= thisWeek - this.dayRuleSup;
|
||||||
|
} else if (this.dayRuleSup > thisWeek) {
|
||||||
|
DD -= 7 - (this.dayRuleSup - thisWeek)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 判断时间值是否小于10置换成“05”这种格式
|
||||||
|
DD = DD < 10 ? '0' + DD : DD;
|
||||||
|
|
||||||
|
// 循环“时”数组
|
||||||
|
goHour: for (let hi = hIdx; hi < hDate.length; hi++) {
|
||||||
|
let hh = hDate[hi] < 10 ? '0' + hDate[hi] : hDate[hi]
|
||||||
|
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (nMin > mDate[mDate.length - 1]) {
|
||||||
|
resetMin();
|
||||||
|
if (hi == hDate.length - 1) {
|
||||||
|
resetHour();
|
||||||
|
if (Di == DDate.length - 1) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
continue goDay;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 循环"分"数组
|
||||||
|
goMin: for (let mi = mIdx; mi < mDate.length; mi++) {
|
||||||
|
let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi];
|
||||||
|
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (nSecond > sDate[sDate.length - 1]) {
|
||||||
|
resetSecond();
|
||||||
|
if (mi == mDate.length - 1) {
|
||||||
|
resetMin();
|
||||||
|
if (hi == hDate.length - 1) {
|
||||||
|
resetHour();
|
||||||
|
if (Di == DDate.length - 1) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
continue goDay;
|
||||||
|
}
|
||||||
|
continue goHour;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 循环"秒"数组
|
||||||
|
goSecond: for (let si = sIdx; si <= sDate.length - 1; si++) {
|
||||||
|
let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si];
|
||||||
|
// 添加当前时间(时间合法性在日期循环时已经判断)
|
||||||
|
if (MM !== '00' && DD !== '00') {
|
||||||
|
resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss)
|
||||||
|
nums++;
|
||||||
|
}
|
||||||
|
// 如果条数满了就退出循环
|
||||||
|
if (nums == 5) break goYear;
|
||||||
|
// 如果到达最大值时
|
||||||
|
if (si == sDate.length - 1) {
|
||||||
|
resetSecond();
|
||||||
|
if (mi == mDate.length - 1) {
|
||||||
|
resetMin();
|
||||||
|
if (hi == hDate.length - 1) {
|
||||||
|
resetHour();
|
||||||
|
if (Di == DDate.length - 1) {
|
||||||
|
resetDay();
|
||||||
|
if (Mi == MDate.length - 1) {
|
||||||
|
resetMonth();
|
||||||
|
continue goYear;
|
||||||
|
}
|
||||||
|
continue goMonth;
|
||||||
|
}
|
||||||
|
continue goDay;
|
||||||
|
}
|
||||||
|
continue goHour;
|
||||||
|
}
|
||||||
|
continue goMin;
|
||||||
|
}
|
||||||
|
} //goSecond
|
||||||
|
} //goMin
|
||||||
|
}//goHour
|
||||||
|
}//goDay
|
||||||
|
}//goMonth
|
||||||
|
}
|
||||||
|
// 判断100年内的结果条数
|
||||||
|
if (resultArr.length == 0) {
|
||||||
|
this.resultList = ['没有达到条件的结果!'];
|
||||||
|
} else {
|
||||||
|
this.resultList = resultArr;
|
||||||
|
if (resultArr.length !== 5) {
|
||||||
|
this.resultList.push('最近100年内只有上面' + resultArr.length + '条结果!')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算完成-显示结果
|
||||||
|
this.isShow = true;
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 用于计算某位数字在数组中的索引
|
||||||
|
getIndex(arr, value) {
|
||||||
|
if (value <= arr[0] || value > arr[arr.length - 1]) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < arr.length - 1; i++) {
|
||||||
|
if (value > arr[i] && value <= arr[i + 1]) {
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"年"数组
|
||||||
|
getYearArr(rule, year) {
|
||||||
|
this.dateArr[5] = this.getOrderArr(year, year + 100);
|
||||||
|
if (rule !== undefined) {
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[5] = this.getCycleArr(rule, year + 100, false)
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[5] = this.getAverageArr(rule, year + 100)
|
||||||
|
} else if (rule !== '*') {
|
||||||
|
this.dateArr[5] = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"月"数组
|
||||||
|
getMonthArr(rule) {
|
||||||
|
this.dateArr[4] = this.getOrderArr(1, 12);
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[4] = this.getCycleArr(rule, 12, false)
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[4] = this.getAverageArr(rule, 12)
|
||||||
|
} else if (rule !== '*') {
|
||||||
|
this.dateArr[4] = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"日"数组-主要为日期规则
|
||||||
|
getWeekArr(rule) {
|
||||||
|
// 只有当日期规则的两个值均为“”时则表达日期是有选项的
|
||||||
|
if (this.dayRule == '' && this.dayRuleSup == '') {
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dayRule = 'weekDay';
|
||||||
|
this.dayRuleSup = this.getCycleArr(rule, 7, false)
|
||||||
|
} else if (rule.indexOf('#') >= 0) {
|
||||||
|
this.dayRule = 'assWeek';
|
||||||
|
let matchRule = rule.match(/[0-9]{1}/g);
|
||||||
|
this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])];
|
||||||
|
this.dateArr[3] = [1];
|
||||||
|
if (this.dayRuleSup[1] == 7) {
|
||||||
|
this.dayRuleSup[1] = 0;
|
||||||
|
}
|
||||||
|
} else if (rule.indexOf('L') >= 0) {
|
||||||
|
this.dayRule = 'lastWeek';
|
||||||
|
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]);
|
||||||
|
this.dateArr[3] = [31];
|
||||||
|
if (this.dayRuleSup == 7) {
|
||||||
|
this.dayRuleSup = 0;
|
||||||
|
}
|
||||||
|
} else if (rule !== '*' && rule !== '?') {
|
||||||
|
this.dayRule = 'weekDay';
|
||||||
|
this.dayRuleSup = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
// 如果weekDay时将7调整为0【week值0即是星期日】
|
||||||
|
if (this.dayRule == 'weekDay') {
|
||||||
|
for (let i = 0; i < this.dayRuleSup.length; i++) {
|
||||||
|
if (this.dayRuleSup[i] == 7) {
|
||||||
|
this.dayRuleSup[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"日"数组-少量为日期规则
|
||||||
|
getDayArr(rule) {
|
||||||
|
this.dateArr[3] = this.getOrderArr(1, 31);
|
||||||
|
this.dayRule = '';
|
||||||
|
this.dayRuleSup = '';
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[3] = this.getCycleArr(rule, 31, false)
|
||||||
|
this.dayRuleSup = 'null';
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[3] = this.getAverageArr(rule, 31)
|
||||||
|
this.dayRuleSup = 'null';
|
||||||
|
} else if (rule.indexOf('W') >= 0) {
|
||||||
|
this.dayRule = 'workDay';
|
||||||
|
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]);
|
||||||
|
this.dateArr[3] = [this.dayRuleSup];
|
||||||
|
} else if (rule.indexOf('L') >= 0) {
|
||||||
|
this.dayRule = 'lastDay';
|
||||||
|
this.dayRuleSup = 'null';
|
||||||
|
this.dateArr[3] = [31];
|
||||||
|
} else if (rule !== '*' && rule !== '?') {
|
||||||
|
this.dateArr[3] = this.getAssignArr(rule)
|
||||||
|
this.dayRuleSup = 'null';
|
||||||
|
} else if (rule == '*') {
|
||||||
|
this.dayRuleSup = 'null';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"时"数组
|
||||||
|
getHourArr(rule) {
|
||||||
|
this.dateArr[2] = this.getOrderArr(0, 23);
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[2] = this.getCycleArr(rule, 24, true)
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[2] = this.getAverageArr(rule, 23)
|
||||||
|
} else if (rule !== '*') {
|
||||||
|
this.dateArr[2] = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"分"数组
|
||||||
|
getMinArr(rule) {
|
||||||
|
this.dateArr[1] = this.getOrderArr(0, 59);
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[1] = this.getCycleArr(rule, 60, true)
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[1] = this.getAverageArr(rule, 59)
|
||||||
|
} else if (rule !== '*') {
|
||||||
|
this.dateArr[1] = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取"秒"数组
|
||||||
|
getSecondArr(rule) {
|
||||||
|
this.dateArr[0] = this.getOrderArr(0, 59);
|
||||||
|
if (rule.indexOf('-') >= 0) {
|
||||||
|
this.dateArr[0] = this.getCycleArr(rule, 60, true)
|
||||||
|
} else if (rule.indexOf('/') >= 0) {
|
||||||
|
this.dateArr[0] = this.getAverageArr(rule, 59)
|
||||||
|
} else if (rule !== '*') {
|
||||||
|
this.dateArr[0] = this.getAssignArr(rule)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 根据传进来的min-max返回一个顺序的数组
|
||||||
|
getOrderArr(min, max) {
|
||||||
|
let arr = [];
|
||||||
|
for (let i = min; i <= max; i++) {
|
||||||
|
arr.push(i);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
// 根据规则中指定的零散值返回一个数组
|
||||||
|
getAssignArr(rule) {
|
||||||
|
let arr = [];
|
||||||
|
let assiginArr = rule.split(',');
|
||||||
|
for (let i = 0; i < assiginArr.length; i++) {
|
||||||
|
arr[i] = Number(assiginArr[i])
|
||||||
|
}
|
||||||
|
arr.sort(this.compare)
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
// 根据一定算术规则计算返回一个数组
|
||||||
|
getAverageArr(rule, limit) {
|
||||||
|
let arr = [];
|
||||||
|
let agArr = rule.split('/');
|
||||||
|
let min = Number(agArr[0]);
|
||||||
|
let step = Number(agArr[1]);
|
||||||
|
while (min <= limit) {
|
||||||
|
arr.push(min);
|
||||||
|
min += step;
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
// 根据规则返回一个具有周期性的数组
|
||||||
|
getCycleArr(rule, limit, status) {
|
||||||
|
// status--表示是否从0开始(则从1开始)
|
||||||
|
let arr = [];
|
||||||
|
let cycleArr = rule.split('-');
|
||||||
|
let min = Number(cycleArr[0]);
|
||||||
|
let max = Number(cycleArr[1]);
|
||||||
|
if (min > max) {
|
||||||
|
max += limit;
|
||||||
|
}
|
||||||
|
for (let i = min; i <= max; i++) {
|
||||||
|
let add = 0;
|
||||||
|
if (status == false && i % limit == 0) {
|
||||||
|
add = limit;
|
||||||
|
}
|
||||||
|
arr.push(Math.round(i % limit + add))
|
||||||
|
}
|
||||||
|
arr.sort(this.compare)
|
||||||
|
return arr;
|
||||||
|
},
|
||||||
|
// 比较数字大小(用于Array.sort)
|
||||||
|
compare(value1, value2) {
|
||||||
|
if (value2 - value1 > 0) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 格式化日期格式如:2017-9-19 18:04:33
|
||||||
|
formatDate(value, type) {
|
||||||
|
// 计算日期相关值
|
||||||
|
let time = typeof value == 'number' ? new Date(value) : value;
|
||||||
|
let Y = time.getFullYear();
|
||||||
|
let M = time.getMonth() + 1;
|
||||||
|
let D = time.getDate();
|
||||||
|
let h = time.getHours();
|
||||||
|
let m = time.getMinutes();
|
||||||
|
let s = time.getSeconds();
|
||||||
|
let week = time.getDay();
|
||||||
|
// 如果传递了type的话
|
||||||
|
if (type == undefined) {
|
||||||
|
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
|
||||||
|
} else if (type == 'week') {
|
||||||
|
return week;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 检查日期是否存在
|
||||||
|
checkDate(value) {
|
||||||
|
let time = new Date(value);
|
||||||
|
let format = this.formatDate(time)
|
||||||
|
return value == format ? true : false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'ex': 'expressionChange'
|
||||||
|
},
|
||||||
|
props: ['ex'],
|
||||||
|
mounted: function () {
|
||||||
|
// 初始化 获取一次结果
|
||||||
|
this.expressionChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
<template>
|
||||||
|
<el-form size="small">
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
秒,允许的通配符[, - * /]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min="0" :max="60" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="0" :max="60" /> 秒
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min="0" :max="60" /> 秒开始,每
|
||||||
|
<el-input-number v-model='average02' :min="0" :max="60" /> 秒执行一次
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 1,
|
||||||
|
cycle01: 1,
|
||||||
|
cycle02: 2,
|
||||||
|
average01: 0,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-second',
|
||||||
|
props: ['check', 'radioParent'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'second', '*', 'second');
|
||||||
|
this.$emit('update', 'min', '*', 'second');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'second', this.average01 + '/' + this.average02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '2') {
|
||||||
|
this.$emit('update', 'second', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'second', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'second', this.checkboxString);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
othChange() {
|
||||||
|
// 反解析
|
||||||
|
let ins = this.cron.second
|
||||||
|
('反解析 second', ins);
|
||||||
|
if (ins === '*') {
|
||||||
|
this.radioValue = 1;
|
||||||
|
} else if (ins.indexOf('-') > -1) {
|
||||||
|
this.radioValue = 2
|
||||||
|
} else if (ins.indexOf('/') > -1) {
|
||||||
|
this.radioValue = 3
|
||||||
|
} else {
|
||||||
|
this.radioValue = 4
|
||||||
|
this.checkboxList = ins.split(',')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'checkboxString': 'checkboxChange',
|
||||||
|
radioParent() {
|
||||||
|
this.radioValue = this.radioParent
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 0, 59)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 0, 59)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 0, 59)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 59)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,167 @@
|
||||||
|
<template>
|
||||||
|
<el-form size='small'>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="1">
|
||||||
|
周,允许的通配符[, - * / L #]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="2">
|
||||||
|
不指定
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="3">
|
||||||
|
周期从星期
|
||||||
|
<el-input-number v-model='cycle01' :min="1" :max="7" /> -
|
||||||
|
<el-input-number v-model='cycle02' :min="1" :max="7" />
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="4">
|
||||||
|
第
|
||||||
|
<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
|
||||||
|
<el-input-number v-model='average02' :min="1" :max="7" />
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="5">
|
||||||
|
本月最后一个星期
|
||||||
|
<el-input-number v-model='weekday' :min="1" :max="7" />
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio v-model='radioValue' :label="6">
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
|
<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
radioValue: 2,
|
||||||
|
weekday: 1,
|
||||||
|
cycle01: 1,
|
||||||
|
cycle02: 2,
|
||||||
|
average01: 1,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-week',
|
||||||
|
props: ['check', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
if (this.radioValue === 1) {
|
||||||
|
this.$emit('update', 'week', '*');
|
||||||
|
this.$emit('update', 'year', '*');
|
||||||
|
} else {
|
||||||
|
if (this.cron.month === '*') {
|
||||||
|
this.$emit('update', 'month', '0', 'week');
|
||||||
|
}
|
||||||
|
if (this.cron.day === '*') {
|
||||||
|
this.$emit('update', 'day', '0', 'week');
|
||||||
|
}
|
||||||
|
if (this.cron.hour === '*') {
|
||||||
|
this.$emit('update', 'hour', '0', 'week');
|
||||||
|
}
|
||||||
|
if (this.cron.min === '*') {
|
||||||
|
this.$emit('update', 'min', '0', 'week');
|
||||||
|
}
|
||||||
|
if (this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'week');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'week', '?');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'week', this.average01 + '#' + this.average02);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this.$emit('update', 'week', this.weekday + 'L');
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
this.$emit('update', 'week', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 根据互斥事件,更改radio的值
|
||||||
|
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'week', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'week', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 最近工作日值变化时
|
||||||
|
weekdayChange() {
|
||||||
|
if (this.radioValue == '5') {
|
||||||
|
this.$emit('update', 'week', this.weekday + 'L');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '6') {
|
||||||
|
this.$emit('update', 'week', this.checkboxString);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'weekdayCheck': 'weekdayChange',
|
||||||
|
'checkboxString': 'checkboxChange',
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, 1, 7)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, 1, 7)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, 1, 4)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 7)
|
||||||
|
return this.average01 + '#' + this.average02;
|
||||||
|
},
|
||||||
|
// 最近的工作日(格式)
|
||||||
|
weekdayCheck: function () {
|
||||||
|
this.weekday = this.checkNum(this.weekday, 1, 7)
|
||||||
|
return this.weekday;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str == '' ? '*' : str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
<template>
|
||||||
|
<el-form size="small">
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio :label="1" v-model='radioValue'>
|
||||||
|
不填,允许的通配符[, - * /]
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio :label="2" v-model='radioValue'>
|
||||||
|
每年
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio :label="3" v-model='radioValue'>
|
||||||
|
周期从
|
||||||
|
<el-input-number v-model='cycle01' :min='fullYear' /> -
|
||||||
|
<el-input-number v-model='cycle02' :min='fullYear' />
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio :label="4" v-model='radioValue'>
|
||||||
|
从
|
||||||
|
<el-input-number v-model='average01' :min='fullYear' /> 年开始,每
|
||||||
|
<el-input-number v-model='average02' :min='fullYear' /> 年执行一次
|
||||||
|
</el-radio>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio :label="5" v-model='radioValue'>
|
||||||
|
指定
|
||||||
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple>
|
||||||
|
<el-option v-for="item in 9" :key="item" :value="item - 1 + fullYear" :label="item -1 + fullYear" />
|
||||||
|
</el-select>
|
||||||
|
</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fullYear: 0,
|
||||||
|
radioValue: 1,
|
||||||
|
cycle01: 0,
|
||||||
|
cycle02: 0,
|
||||||
|
average01: 0,
|
||||||
|
average02: 1,
|
||||||
|
checkboxList: [],
|
||||||
|
checkNum: this.$options.propsData.check
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: 'crontab-year',
|
||||||
|
props: ['check', 'month', 'cron'],
|
||||||
|
methods: {
|
||||||
|
// 单选按钮值变化时
|
||||||
|
radioChange() {
|
||||||
|
if (this.cron.month === '*') {
|
||||||
|
this.$emit('update', 'month', '0', 'year');
|
||||||
|
}
|
||||||
|
if (this.cron.day === '*') {
|
||||||
|
this.$emit('update', 'day', '0', 'year');
|
||||||
|
}
|
||||||
|
if (this.cron.hour === '*') {
|
||||||
|
this.$emit('update', 'hour', '0', 'year');
|
||||||
|
}
|
||||||
|
if (this.cron.min === '*') {
|
||||||
|
this.$emit('update', 'min', '0', 'year');
|
||||||
|
}
|
||||||
|
if (this.cron.second === '*') {
|
||||||
|
this.$emit('update', 'second', '0', 'year');
|
||||||
|
}
|
||||||
|
switch (this.radioValue) {
|
||||||
|
case 1:
|
||||||
|
this.$emit('update', 'year', '');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.$emit('update', 'year', '*');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this.$emit('update', 'year', this.average01 + '/' + this.average02);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this.$emit('update', 'year', this.checkboxString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 周期两个值变化时
|
||||||
|
cycleChange() {
|
||||||
|
if (this.radioValue == '3') {
|
||||||
|
this.$emit('update', 'year', this.cycleTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 平均两个值变化时
|
||||||
|
averageChange() {
|
||||||
|
if (this.radioValue == '4') {
|
||||||
|
this.$emit('update', 'year', this.averageTotal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// checkbox值变化时
|
||||||
|
checkboxChange() {
|
||||||
|
if (this.radioValue == '5') {
|
||||||
|
this.$emit('update', 'year', this.checkboxString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"radioValue": "radioChange",
|
||||||
|
'cycleTotal': 'cycleChange',
|
||||||
|
'averageTotal': 'averageChange',
|
||||||
|
'checkboxString': 'checkboxChange'
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算两个周期值
|
||||||
|
cycleTotal: function () {
|
||||||
|
this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
|
||||||
|
this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
|
||||||
|
return this.cycle01 + '-' + this.cycle02;
|
||||||
|
},
|
||||||
|
// 计算平均用到的值
|
||||||
|
averageTotal: function () {
|
||||||
|
this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
|
||||||
|
this.average02 = this.checkNum(this.average02, 1, 10)
|
||||||
|
return this.average01 + '/' + this.average02;
|
||||||
|
},
|
||||||
|
// 计算勾选的checkbox值合集
|
||||||
|
checkboxString: function () {
|
||||||
|
let str = this.checkboxList.join();
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
// 仅获取当前年份
|
||||||
|
this.fullYear = Number(new Date().getFullYear());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import DataDict from '@/utils/dict'
|
||||||
|
import { getDicts as getDicts } from '@/api/system/dict/data'
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
Vue.use(DataDict, {
|
||||||
|
metas: {
|
||||||
|
'*': {
|
||||||
|
labelField: 'dictLabel',
|
||||||
|
valueField: 'dictValue',
|
||||||
|
request(dictMeta) {
|
||||||
|
return getDicts(dictMeta.type).then(res => res.data)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install,
|
||||||
|
}
|
||||||
|
|
@ -1,22 +1,23 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<template v-for="(item, index) in options">
|
<template v-for="(item, index) in options">
|
||||||
<template v-if="values.includes(item.dictValue)">
|
<template v-if="values.includes(item.value)">
|
||||||
<span
|
<span
|
||||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
v-if="item.raw.listClass == 'default' || item.raw.listClass == ''"
|
||||||
:key="item.dictValue"
|
:key="item.value"
|
||||||
:index="index"
|
:index="index"
|
||||||
:class="item.cssClass"
|
:class="item.raw.cssClass"
|
||||||
>{{ item.dictLabel }}</span
|
>{{ item.label }}</span
|
||||||
>
|
>
|
||||||
<el-tag
|
<el-tag
|
||||||
v-else
|
v-else
|
||||||
:key="item.dictValue"
|
:disable-transitions="true"
|
||||||
|
:key="item.value"
|
||||||
:index="index"
|
:index="index"
|
||||||
:type="item.listClass == 'primary' ? '' : item.listClass"
|
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
|
||||||
:class="item.cssClass"
|
:class="item.raw.cssClass"
|
||||||
>
|
>
|
||||||
{{ item.dictLabel }}
|
{{ item.label }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,10 @@ export default {
|
||||||
// 删除图片
|
// 删除图片
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
||||||
this.fileList.splice(findex, 1);
|
if(findex > -1) {
|
||||||
this.$emit("input", this.listToString(this.fileList));
|
this.fileList.splice(findex, 1);
|
||||||
|
this.$emit("input", this.listToString(this.fileList));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res) {
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,22 @@ export default {
|
||||||
immediate: true
|
immediate: true
|
||||||
},
|
},
|
||||||
async theme(val) {
|
async theme(val) {
|
||||||
|
await this.setTheme(val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if(this.defaultTheme !== ORIGINAL_THEME) {
|
||||||
|
this.setTheme(this.defaultTheme)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
async setTheme(val) {
|
||||||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
||||||
if (typeof val !== 'string') return
|
if (typeof val !== 'string') return
|
||||||
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
||||||
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
||||||
|
|
||||||
const $message = this.$message({
|
|
||||||
message: ' Compiling the theme',
|
|
||||||
customClass: 'theme-message',
|
|
||||||
type: 'success',
|
|
||||||
duration: 0,
|
|
||||||
iconClass: 'el-icon-loading'
|
|
||||||
})
|
|
||||||
|
|
||||||
const getHandler = (variable, id) => {
|
const getHandler = (variable, id) => {
|
||||||
return () => {
|
return () => {
|
||||||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
||||||
|
|
@ -80,12 +83,8 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$emit('change', val)
|
this.$emit('change', val)
|
||||||
|
},
|
||||||
|
|
||||||
$message.close()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
updateStyle(style, oldCluster, newCluster) {
|
updateStyle(style, oldCluster, newCluster) {
|
||||||
let newStyle = style
|
let newStyle = style
|
||||||
oldCluster.forEach((color, index) => {
|
oldCluster.forEach((color, index) => {
|
||||||
|
|
|
||||||
|
|
@ -162,14 +162,8 @@ export default {
|
||||||
this.sideTheme = val;
|
this.sideTheme = val;
|
||||||
},
|
},
|
||||||
saveSetting() {
|
saveSetting() {
|
||||||
const loading = this.$loading({
|
this.$modal.loading("正在保存到本地,请稍后...");
|
||||||
lock: true,
|
this.$cache.local.set(
|
||||||
fullscreen: false,
|
|
||||||
text: "正在保存到本地,请稍后...",
|
|
||||||
spinner: "el-icon-loading",
|
|
||||||
background: "rgba(0, 0, 0, 0.7)"
|
|
||||||
});
|
|
||||||
localStorage.setItem(
|
|
||||||
"layout-setting",
|
"layout-setting",
|
||||||
`{
|
`{
|
||||||
"topNav":${this.topNav},
|
"topNav":${this.topNav},
|
||||||
|
|
@ -181,17 +175,11 @@ export default {
|
||||||
"theme":"${this.theme}"
|
"theme":"${this.theme}"
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
setTimeout(loading.close(), 1000)
|
setTimeout(this.$modal.closeLoading(), 1000)
|
||||||
},
|
},
|
||||||
resetSetting() {
|
resetSetting() {
|
||||||
this.$loading({
|
this.$modal.loading("正在清除设置缓存并刷新,请稍后...");
|
||||||
lock: true,
|
this.$cache.local.remove("layout-setting")
|
||||||
fullscreen: false,
|
|
||||||
text: "正在清除设置缓存并刷新,请稍后...",
|
|
||||||
spinner: "el-icon-loading",
|
|
||||||
background: "rgba(0, 0, 0, 0.7)"
|
|
||||||
});
|
|
||||||
localStorage.removeItem("layout-setting")
|
|
||||||
setTimeout("window.location.reload()", 1000)
|
setTimeout("window.location.reload()", 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { isExternal } from '@/utils/validate'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
to: {
|
to: {
|
||||||
type: String,
|
type: [String, Object],
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }">
|
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1>
|
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||||
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.sidebarTitle : variables.sidebarLightTitle }">{{ title }} </h1>
|
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="!item.hidden">
|
<div v-if="!item.hidden">
|
||||||
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
||||||
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
|
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
|
||||||
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
||||||
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
|
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
@ -56,6 +56,9 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hasOneShowingChild(children = [], parent) {
|
hasOneShowingChild(children = [], parent) {
|
||||||
|
if (!children) {
|
||||||
|
children = [];
|
||||||
|
}
|
||||||
const showingChildren = children.filter(item => {
|
const showingChildren = children.filter(item => {
|
||||||
if (item.hidden) {
|
if (item.hidden) {
|
||||||
return false
|
return false
|
||||||
|
|
@ -79,13 +82,17 @@ export default {
|
||||||
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
resolvePath(routePath) {
|
resolvePath(routePath, routeQuery) {
|
||||||
if (isExternal(routePath)) {
|
if (isExternal(routePath)) {
|
||||||
return routePath
|
return routePath
|
||||||
}
|
}
|
||||||
if (isExternal(this.basePath)) {
|
if (isExternal(this.basePath)) {
|
||||||
return this.basePath
|
return this.basePath
|
||||||
}
|
}
|
||||||
|
if (routeQuery) {
|
||||||
|
let query = JSON.parse(routeQuery);
|
||||||
|
return { path: path.resolve(this.basePath, routePath), query: query }
|
||||||
|
}
|
||||||
return path.resolve(this.basePath, routePath)
|
return path.resolve(this.basePath, routePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }">
|
<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
|
||||||
<logo v-if="showLogo" :collapse="isCollapse" />
|
<logo v-if="showLogo" :collapse="isCollapse" />
|
||||||
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
|
<el-scrollbar :class="settings.sideTheme" wrap-class="scrollbar-wrapper">
|
||||||
<el-menu
|
<el-menu
|
||||||
:default-active="activeMenu"
|
:default-active="activeMenu"
|
||||||
:collapse="isCollapse"
|
:collapse="isCollapse"
|
||||||
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg"
|
:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
|
||||||
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuText : 'rgba(0,0,0,.65)'"
|
:text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
|
||||||
:unique-opened="true"
|
:unique-opened="true"
|
||||||
:active-text-color="settings.theme"
|
:active-text-color="settings.theme"
|
||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,12 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</scroll-pane>
|
</scroll-pane>
|
||||||
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
|
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
|
||||||
<li @click="refreshSelectedTag(selectedTag)">刷新页面</li>
|
<li @click="refreshSelectedTag(selectedTag)"><i class="el-icon-refresh-right"></i> 刷新页面</li>
|
||||||
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
|
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前</li>
|
||||||
<li @click="closeOthersTags">关闭其他</li>
|
<li @click="closeOthersTags"><i class="el-icon-circle-close"></i> 关闭其他</li>
|
||||||
<li v-if="!isLastView()" @click="closeRightTags">关闭右侧</li>
|
<li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back"></i> 关闭左侧</li>
|
||||||
<li @click="closeAllTags(selectedTag)">关闭所有</li>
|
<li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
|
||||||
|
<li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close"></i> 全部关闭</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -84,6 +85,13 @@ export default {
|
||||||
isAffix(tag) {
|
isAffix(tag) {
|
||||||
return tag.meta && tag.meta.affix
|
return tag.meta && tag.meta.affix
|
||||||
},
|
},
|
||||||
|
isFirstView() {
|
||||||
|
try {
|
||||||
|
return this.selectedTag.fullPath === this.visitedViews[1].fullPath || this.selectedTag.fullPath === '/index'
|
||||||
|
} catch (err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
isLastView() {
|
isLastView() {
|
||||||
try {
|
try {
|
||||||
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
|
||||||
|
|
@ -167,6 +175,13 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closeLeftTags() {
|
||||||
|
this.$store.dispatch('tagsView/delLeftTags', this.selectedTag).then(visitedViews => {
|
||||||
|
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
|
||||||
|
this.toLastView(visitedViews)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
closeOthersTags() {
|
closeOthersTags() {
|
||||||
this.$router.push(this.selectedTag).catch(()=>{});
|
this.$router.push(this.selectedTag).catch(()=>{});
|
||||||
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}">
|
<div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}">
|
||||||
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
|
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
|
||||||
<sidebar class="sidebar-container" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }" />
|
<sidebar class="sidebar-container"/>
|
||||||
<div :class="{hasTagsView:needTagsView}" class="main-container">
|
<div :class="{hasTagsView:needTagsView}" class="main-container">
|
||||||
<div :class="{'fixed-header':fixedHeader}">
|
<div :class="{'fixed-header':fixedHeader}">
|
||||||
<navbar />
|
<navbar />
|
||||||
|
|
@ -93,7 +93,7 @@ export default {
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
width: calc(100% - #{$sideBarWidth});
|
width: calc(100% - #{$base-sidebar-width});
|
||||||
transition: width 0.28s;
|
transition: width 0.28s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import App from './App'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import directive from './directive' //directive
|
import directive from './directive' //directive
|
||||||
|
import plugins from './plugins' // plugins
|
||||||
import { download } from '@/utils/request'
|
import { download } from '@/utils/request'
|
||||||
|
|
||||||
import './assets/icons' // icon
|
import './assets/icons' // icon
|
||||||
|
|
@ -18,6 +19,7 @@ import './permission' // permission control
|
||||||
import { getDicts } from "@/api/system/dict/data";
|
import { getDicts } from "@/api/system/dict/data";
|
||||||
import { getConfigKey } from "@/api/system/config";
|
import { getConfigKey } from "@/api/system/config";
|
||||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||||
|
// 分页组件
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
// 自定义表格工具组件
|
// 自定义表格工具组件
|
||||||
import RightToolbar from "@/components/RightToolbar"
|
import RightToolbar from "@/components/RightToolbar"
|
||||||
|
|
@ -31,6 +33,8 @@ import ImageUpload from "@/components/ImageUpload"
|
||||||
import DictTag from '@/components/DictTag'
|
import DictTag from '@/components/DictTag'
|
||||||
// 头部标签组件
|
// 头部标签组件
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
|
// 字典数据组件
|
||||||
|
import DictData from '@/components/DictData'
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
|
|
@ -43,18 +47,6 @@ Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
|
|
||||||
Vue.prototype.msgSuccess = function (msg) {
|
|
||||||
this.$message({ showClose: true, message: msg, type: "success" });
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.prototype.msgError = function (msg) {
|
|
||||||
this.$message({ showClose: true, message: msg, type: "error" });
|
|
||||||
}
|
|
||||||
|
|
||||||
Vue.prototype.msgInfo = function (msg) {
|
|
||||||
this.$message.info(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 全局组件挂载
|
// 全局组件挂载
|
||||||
Vue.component('DictTag', DictTag)
|
Vue.component('DictTag', DictTag)
|
||||||
Vue.component('Pagination', Pagination)
|
Vue.component('Pagination', Pagination)
|
||||||
|
|
@ -64,7 +56,9 @@ Vue.component('FileUpload', FileUpload)
|
||||||
Vue.component('ImageUpload', ImageUpload)
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
|
|
||||||
Vue.use(directive)
|
Vue.use(directive)
|
||||||
|
Vue.use(plugins)
|
||||||
Vue.use(VueMeta)
|
Vue.use(VueMeta)
|
||||||
|
DictData.install()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you don't want to use mock-server
|
* If you don't want to use mock-server
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
const sessionCache = {
|
||||||
|
set (key, value) {
|
||||||
|
if (!sessionStorage) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (key != null && value != null) {
|
||||||
|
sessionStorage.setItem(key, value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get (key) {
|
||||||
|
if (!sessionStorage) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (key == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return sessionStorage.getItem(key)
|
||||||
|
},
|
||||||
|
setJSON (key, jsonValue) {
|
||||||
|
if (jsonValue != null) {
|
||||||
|
this.set(key, JSON.stringify(jsonValue))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getJSON (key) {
|
||||||
|
const value = this.get(key)
|
||||||
|
if (value != null) {
|
||||||
|
return JSON.parse(value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remove (key) {
|
||||||
|
sessionStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const localCache = {
|
||||||
|
set (key, value) {
|
||||||
|
if (!localStorage) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (key != null && value != null) {
|
||||||
|
localStorage.setItem(key, value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get (key) {
|
||||||
|
if (!localStorage) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (key == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return localStorage.getItem(key)
|
||||||
|
},
|
||||||
|
setJSON (key, jsonValue) {
|
||||||
|
if (jsonValue != null) {
|
||||||
|
this.set(key, JSON.stringify(jsonValue))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getJSON (key) {
|
||||||
|
const value = this.get(key)
|
||||||
|
if (value != null) {
|
||||||
|
return JSON.parse(value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remove (key) {
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
/**
|
||||||
|
* 会话级缓存
|
||||||
|
*/
|
||||||
|
session: sessionCache,
|
||||||
|
/**
|
||||||
|
* 本地缓存
|
||||||
|
*/
|
||||||
|
local: localCache
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
import axios from 'axios'
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
|
const baseURL = process.env.VUE_APP_BASE_API
|
||||||
|
|
||||||
|
export default {
|
||||||
|
zip(url, name) {
|
||||||
|
var url = baseURL + url
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||||
|
}).then(res => {
|
||||||
|
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||||
|
this.saveAs(blob, name)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
saveAs(text, name, opts) {
|
||||||
|
saveAs(text, name, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import cache from './cache'
|
||||||
|
import modal from './modal'
|
||||||
|
import download from './download'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install(Vue) {
|
||||||
|
// 缓存对象
|
||||||
|
Vue.prototype.$cache = cache
|
||||||
|
// 模态框对象
|
||||||
|
Vue.prototype.$modal = modal
|
||||||
|
// 下载文件
|
||||||
|
Vue.prototype.$download = download
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
import { Message, MessageBox, Notification, Loading } from 'element-ui'
|
||||||
|
|
||||||
|
let loadingInstance;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// 消息提示
|
||||||
|
msg(content) {
|
||||||
|
Message.info(content)
|
||||||
|
},
|
||||||
|
// 错误消息
|
||||||
|
msgError(content) {
|
||||||
|
Message.error(content)
|
||||||
|
},
|
||||||
|
// 成功消息
|
||||||
|
msgSuccess(content) {
|
||||||
|
Message.success(content)
|
||||||
|
},
|
||||||
|
// 警告消息
|
||||||
|
msgWarning(content) {
|
||||||
|
Message.warning(content)
|
||||||
|
},
|
||||||
|
// 弹出提示
|
||||||
|
alert(content) {
|
||||||
|
MessageBox.alert(content, "系统提示")
|
||||||
|
},
|
||||||
|
// 错误提示
|
||||||
|
alertError(content) {
|
||||||
|
MessageBox.alert(content, "系统提示", { type: 'error' })
|
||||||
|
},
|
||||||
|
// 成功提示
|
||||||
|
alertSuccess(content) {
|
||||||
|
MessageBox.alert(content, "系统提示", { type: 'success' })
|
||||||
|
},
|
||||||
|
// 警告提示
|
||||||
|
alertWarning(content) {
|
||||||
|
MessageBox.alert(content, "系统提示", { type: 'warning' })
|
||||||
|
},
|
||||||
|
// 通知提示
|
||||||
|
notify(content) {
|
||||||
|
Notification.info(content)
|
||||||
|
},
|
||||||
|
// 错误通知
|
||||||
|
notifyError(content) {
|
||||||
|
Notification.error(content);
|
||||||
|
},
|
||||||
|
// 成功通知
|
||||||
|
notifySuccess(content) {
|
||||||
|
Notification.success(content)
|
||||||
|
},
|
||||||
|
// 警告通知
|
||||||
|
notifyWarning(content) {
|
||||||
|
Notification.warning(content)
|
||||||
|
},
|
||||||
|
// 确认窗体
|
||||||
|
confirm(content) {
|
||||||
|
return MessageBox.confirm(content, "系统提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 打开遮罩层
|
||||||
|
loading(content) {
|
||||||
|
loadingInstance = Loading.service({
|
||||||
|
lock: true,
|
||||||
|
text: content,
|
||||||
|
spinner: "el-icon-loading",
|
||||||
|
background: "rgba(0, 0, 0, 0.7)",
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 关闭遮罩层
|
||||||
|
closeLoading() {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,19 +9,20 @@ import Layout from '@/layout'
|
||||||
/**
|
/**
|
||||||
* Note: 路由配置项
|
* Note: 路由配置项
|
||||||
*
|
*
|
||||||
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
|
* hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1
|
||||||
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
* alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
|
||||||
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
|
* // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面
|
||||||
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
|
* // 若你想不管路由下面的 children 声明的个数都显示你的根路由
|
||||||
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
|
* // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由
|
||||||
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
||||||
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
||||||
|
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
|
||||||
* meta : {
|
* meta : {
|
||||||
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
||||||
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
||||||
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg
|
||||||
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示
|
||||||
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -143,7 +144,7 @@ export const constantRoutes = [
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:tableId(\\d+)',
|
path: 'index',
|
||||||
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
|
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
|
||||||
name: 'GenEdit',
|
name: 'GenEdit',
|
||||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import variables from '@/assets/styles/element-variables.scss'
|
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
|
|
||||||
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
|
||||||
|
|
@ -6,7 +5,7 @@ const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dyn
|
||||||
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
||||||
const state = {
|
const state = {
|
||||||
title: '',
|
title: '',
|
||||||
theme: storageSetting.theme || variables.theme,
|
theme: storageSetting.theme || '#409EFF',
|
||||||
sideTheme: storageSetting.sideTheme || sideTheme,
|
sideTheme: storageSetting.sideTheme || sideTheme,
|
||||||
showSettings: showSettings,
|
showSettings: showSettings,
|
||||||
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,23 @@ const mutations = {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
DEL_LEFT_VIEWS: (state, view) => {
|
||||||
|
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
||||||
|
if (index === -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
state.visitedViews = state.visitedViews.filter((item, idx) => {
|
||||||
|
if (idx >= index || (item.meta && item.meta.affix)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
const i = state.cachedViews.indexOf(item.name)
|
||||||
|
if (i > -1) {
|
||||||
|
state.cachedViews.splice(i, 1)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +189,14 @@ const actions = {
|
||||||
commit('DEL_RIGHT_VIEWS', view)
|
commit('DEL_RIGHT_VIEWS', view)
|
||||||
resolve([...state.visitedViews])
|
resolve([...state.visitedViews])
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
delLeftTags({ commit }, view) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
commit('DEL_LEFT_VIEWS', view)
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import { mergeRecursive } from "@/utils/ruoyi";
|
||||||
|
import DictMeta from './DictMeta'
|
||||||
|
import DictData from './DictData'
|
||||||
|
|
||||||
|
const DEFAULT_DICT_OPTIONS = {
|
||||||
|
types: [],
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc 字典
|
||||||
|
* @property {Object} label 标签对象,内部属性名为字典类型名称
|
||||||
|
* @property {Object} dict 字段数组,内部属性名为字典类型名称
|
||||||
|
* @property {Array.<DictMeta>} _dictMetas 字典元数据数组
|
||||||
|
*/
|
||||||
|
export default class Dict {
|
||||||
|
constructor() {
|
||||||
|
this.owner = null
|
||||||
|
this.label = {}
|
||||||
|
this.type = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
init(options) {
|
||||||
|
if (options instanceof Array) {
|
||||||
|
options = { types: options }
|
||||||
|
}
|
||||||
|
const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options)
|
||||||
|
if (opts.types === undefined) {
|
||||||
|
throw new Error('need dict types')
|
||||||
|
}
|
||||||
|
const ps = []
|
||||||
|
this._dictMetas = opts.types.map(t => DictMeta.parse(t))
|
||||||
|
this._dictMetas.forEach(dictMeta => {
|
||||||
|
const type = dictMeta.type
|
||||||
|
Vue.set(this.label, type, {})
|
||||||
|
Vue.set(this.type, type, [])
|
||||||
|
if (dictMeta.lazy) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ps.push(loadDict(this, dictMeta))
|
||||||
|
})
|
||||||
|
return Promise.all(ps)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新加载字典
|
||||||
|
* @param {String} type 字典类型
|
||||||
|
*/
|
||||||
|
reloadDict(type) {
|
||||||
|
const dictMeta = this._dictMetas.find(e => e.type === type)
|
||||||
|
if (dictMeta === undefined) {
|
||||||
|
return Promise.reject(`the dict meta of ${type} was not found`)
|
||||||
|
}
|
||||||
|
return loadDict(this, dictMeta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载字典
|
||||||
|
* @param {Dict} dict 字典
|
||||||
|
* @param {DictMeta} dictMeta 字典元数据
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
function loadDict(dict, dictMeta) {
|
||||||
|
return dictMeta.request(dictMeta)
|
||||||
|
.then(response => {
|
||||||
|
const type = dictMeta.type
|
||||||
|
let dicts = dictMeta.responseConverter(response, dictMeta)
|
||||||
|
if (!(dicts instanceof Array)) {
|
||||||
|
console.error('the return of responseConverter must be Array.<DictData>')
|
||||||
|
dicts = []
|
||||||
|
} else if (dicts.filter(d => d instanceof DictData).length !== dicts.length) {
|
||||||
|
console.error('the type of elements in dicts must be DictData')
|
||||||
|
dicts = []
|
||||||
|
}
|
||||||
|
dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts)
|
||||||
|
dicts.forEach(d => {
|
||||||
|
Vue.set(dict.label[type], d.value, d.label)
|
||||||
|
})
|
||||||
|
return dicts
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
import DictOptions from './DictOptions'
|
||||||
|
import DictData from './DictData'
|
||||||
|
|
||||||
|
export default function(dict, dictMeta) {
|
||||||
|
const label = determineDictField(dict, dictMeta.labelField, ...DictOptions.DEFAULT_LABEL_FIELDS)
|
||||||
|
const value = determineDictField(dict, dictMeta.valueField, ...DictOptions.DEFAULT_VALUE_FIELDS)
|
||||||
|
return new DictData(dict[label], dict[value], dict)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定字典字段
|
||||||
|
* @param {DictData} dict
|
||||||
|
* @param {...String} fields
|
||||||
|
*/
|
||||||
|
function determineDictField(dict, ...fields) {
|
||||||
|
return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f))
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
/**
|
||||||
|
* @classdesc 字典数据
|
||||||
|
* @property {String} label 标签
|
||||||
|
* @property {*} value 标签
|
||||||
|
* @property {Object} raw 原始数据
|
||||||
|
*/
|
||||||
|
export default class DictData {
|
||||||
|
constructor(label, value, raw) {
|
||||||
|
this.label = label
|
||||||
|
this.value = value
|
||||||
|
this.raw = raw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { mergeRecursive } from "@/utils/ruoyi";
|
||||||
|
import DictOptions from './DictOptions'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc 字典元数据
|
||||||
|
* @property {String} type 类型
|
||||||
|
* @property {Function} request 请求
|
||||||
|
* @property {String} label 标签字段
|
||||||
|
* @property {String} value 值字段
|
||||||
|
*/
|
||||||
|
export default class DictMeta {
|
||||||
|
constructor(options) {
|
||||||
|
this.type = options.type
|
||||||
|
this.request = options.request,
|
||||||
|
this.responseConverter = options.responseConverter
|
||||||
|
this.labelField = options.labelField
|
||||||
|
this.valueField = options.valueField
|
||||||
|
this.lazy = options.lazy === true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析字典元数据
|
||||||
|
* @param {Object} options
|
||||||
|
* @returns {DictMeta}
|
||||||
|
*/
|
||||||
|
DictMeta.parse= function(options) {
|
||||||
|
let opts = null
|
||||||
|
if (typeof options === 'string') {
|
||||||
|
opts = DictOptions.metas[options] || {}
|
||||||
|
opts.type = options
|
||||||
|
} else if (typeof options === 'object') {
|
||||||
|
opts = options
|
||||||
|
}
|
||||||
|
opts = mergeRecursive(DictOptions.metas['*'], opts)
|
||||||
|
return new DictMeta(opts)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { mergeRecursive } from "@/utils/ruoyi";
|
||||||
|
import dictConverter from './DictConverter'
|
||||||
|
|
||||||
|
export const options = {
|
||||||
|
metas: {
|
||||||
|
'*': {
|
||||||
|
/**
|
||||||
|
* 字典请求,方法签名为function(dictMeta: DictMeta): Promise
|
||||||
|
*/
|
||||||
|
request: (dictMeta) => {
|
||||||
|
console.log(`load dict ${dictMeta.type}`)
|
||||||
|
return Promise.resolve([])
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData
|
||||||
|
*/
|
||||||
|
responseConverter,
|
||||||
|
labelField: 'label',
|
||||||
|
valueField: 'value',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 默认标签字段
|
||||||
|
*/
|
||||||
|
DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
|
||||||
|
/**
|
||||||
|
* 默认值字段
|
||||||
|
*/
|
||||||
|
DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射字典
|
||||||
|
* @param {Object} response 字典数据
|
||||||
|
* @param {DictMeta} dictMeta 字典元数据
|
||||||
|
* @returns {DictData}
|
||||||
|
*/
|
||||||
|
function responseConverter(response, dictMeta) {
|
||||||
|
const dicts = response.content instanceof Array ? response.content : response
|
||||||
|
if (dicts === undefined) {
|
||||||
|
console.warn(`no dict data of "${dictMeta.type}" found in the response`)
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return dicts.map(d => dictConverter(d, dictMeta))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mergeOptions(src) {
|
||||||
|
mergeRecursive(options, src)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default options
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import Dict from './Dict'
|
||||||
|
import { mergeOptions } from './DictOptions'
|
||||||
|
|
||||||
|
export default function(Vue, options) {
|
||||||
|
mergeOptions(options)
|
||||||
|
Vue.mixin({
|
||||||
|
data() {
|
||||||
|
if (this.$options.dicts === undefined || this.$options.dicts === null) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
const dict = new Dict()
|
||||||
|
dict.owner = this
|
||||||
|
return {
|
||||||
|
dict
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (!(this.dict instanceof Dict)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
options.onCreated && options.onCreated(this.dict)
|
||||||
|
this.dict.init(this.$options.dicts).then(() => {
|
||||||
|
options.onReady && options.onReady(this.dict)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$emit('dictReady', this.dict)
|
||||||
|
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
||||||
|
this.$options.methods.onDictReady.call(this, this.dict)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { Notification, MessageBox, Message } from 'element-ui'
|
import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import errorCode from '@/utils/errorCode'
|
import errorCode from '@/utils/errorCode'
|
||||||
import { tansParams } from "@/utils/ruoyi";
|
import { tansParams } from "@/utils/ruoyi";
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
let downloadLoadingInstance;
|
||||||
|
|
||||||
|
axios.defaults.headers['Conntent-Type'] = 'application/json;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
|
|
@ -51,7 +54,7 @@ service.interceptors.response.use(res => {
|
||||||
location.href = '/index';
|
location.href = '/index';
|
||||||
})
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
return Promise.reject('令牌验证失败')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
Message({
|
Message({
|
||||||
message: msg,
|
message: msg,
|
||||||
|
|
@ -90,31 +93,20 @@ service.interceptors.response.use(res => {
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function download(url, params, filename) {
|
export function download(url, params, filename) {
|
||||||
|
downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍后", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
|
||||||
return service.post(url, params, {
|
return service.post(url, params, {
|
||||||
transformRequest: [(params) => {
|
transformRequest: [(params) => { return tansParams(params) }],
|
||||||
return tansParams(params)
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
}],
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
},
|
|
||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
const content = data
|
const content = data
|
||||||
const blob = new Blob([content])
|
const blob = new Blob([content])
|
||||||
if ('download' in document.createElement('a')) {
|
saveAs(blob, filename)
|
||||||
const elink = document.createElement('a')
|
downloadLoadingInstance.close();
|
||||||
elink.download = filename
|
|
||||||
elink.style.display = 'none'
|
|
||||||
elink.href = URL.createObjectURL(blob)
|
|
||||||
document.body.appendChild(elink)
|
|
||||||
elink.click()
|
|
||||||
URL.revokeObjectURL(elink.href)
|
|
||||||
document.body.removeChild(elink)
|
|
||||||
} else {
|
|
||||||
navigator.msSaveBlob(blob, filename)
|
|
||||||
}
|
|
||||||
}).catch((r) => {
|
}).catch((r) => {
|
||||||
console.error(r)
|
console.error(r)
|
||||||
|
Message.error('下载文件出现错误,请联系管理员!')
|
||||||
|
downloadLoadingInstance.close();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ export function addDateRange(params, dateRange, propName) {
|
||||||
export function selectDictLabel(datas, value) {
|
export function selectDictLabel(datas, value) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
Object.keys(datas).some((key) => {
|
Object.keys(datas).some((key) => {
|
||||||
if (datas[key].dictValue == ('' + value)) {
|
if (datas[key].value == ('' + value)) {
|
||||||
actions.push(datas[key].dictLabel);
|
actions.push(datas[key].label);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -122,6 +122,22 @@ export function praseStrEmpty(str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 数据合并
|
||||||
|
export function mergeRecursive(source, target) {
|
||||||
|
for (var p in target) {
|
||||||
|
try {
|
||||||
|
if (target[p].constructor == Object) {
|
||||||
|
source[p] = mergeRecursive(source[p], target[p]);
|
||||||
|
} else {
|
||||||
|
source[p] = target[p];
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
source[p] = target[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return source;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造树型结构数据
|
* 构造树型结构数据
|
||||||
* @param {*} data 数据源
|
* @param {*} data 数据源
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
import axios from 'axios'
|
|
||||||
import { getToken } from '@/utils/auth'
|
|
||||||
|
|
||||||
const mimeMap = {
|
|
||||||
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
||||||
zip: 'application/zip'
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseUrl = process.env.VUE_APP_BASE_API
|
|
||||||
export function downLoadZip(str, filename) {
|
|
||||||
var url = baseUrl + str
|
|
||||||
axios({
|
|
||||||
method: 'get',
|
|
||||||
url: url,
|
|
||||||
responseType: 'blob',
|
|
||||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
|
||||||
}).then(res => {
|
|
||||||
resolveBlob(res, mimeMap.zip)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 解析blob响应内容并下载
|
|
||||||
* @param {*} res blob响应内容
|
|
||||||
* @param {String} mimeType MIME类型
|
|
||||||
*/
|
|
||||||
export function resolveBlob(res, mimeType) {
|
|
||||||
const aLink = document.createElement('a')
|
|
||||||
var blob = new Blob([res.data], { type: mimeType })
|
|
||||||
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
|
|
||||||
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
|
||||||
var contentDisposition = decodeURI(res.headers['content-disposition'])
|
|
||||||
var result = patt.exec(contentDisposition)
|
|
||||||
var fileName = result[1]
|
|
||||||
fileName = fileName.replace(/\"/g, '')
|
|
||||||
aLink.style.display = 'none'
|
|
||||||
aLink.href = URL.createObjectURL(blob)
|
|
||||||
aLink.setAttribute('download', fileName) // 设置下载文件名称
|
|
||||||
document.body.appendChild(aLink)
|
|
||||||
aLink.click()
|
|
||||||
URL.revokeObjectURL(aLink.href);//清除引用
|
|
||||||
document.body.removeChild(aLink);
|
|
||||||
}
|
|
||||||
|
|
@ -146,6 +146,55 @@
|
||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v3.2.0 - 2021-10-12">
|
||||||
|
<ol>
|
||||||
|
<li>菜单管理支持配置路由参数</li>
|
||||||
|
<li>定时任务支持在线生成cron表达式</li>
|
||||||
|
<li>自定义弹层溢出滚动样式</li>
|
||||||
|
<li>自定义可拖动弹窗宽度指令</li>
|
||||||
|
<li>自定义可拖动弹窗高度指令</li>
|
||||||
|
<li>修改时检查用户数据权限范围</li>
|
||||||
|
<li>修复保存配置主题颜色失效问题</li>
|
||||||
|
<li>新增暗色菜单风格主题</li>
|
||||||
|
<li>菜单&部门新增展开/折叠功能</li>
|
||||||
|
<li>页签新增关闭左侧&添加图标</li>
|
||||||
|
<li>代码生成主子表多选行数据</li>
|
||||||
|
<li>日期范围支持添加多组</li>
|
||||||
|
<li>Excel导入支持@Excels注解</li>
|
||||||
|
<li>Excel注解支持导入导出标题信息</li>
|
||||||
|
<li>Excel注解支持自定义数据处理器</li>
|
||||||
|
<li>日志注解新增是否保存响应参数</li>
|
||||||
|
<li>定时任务对检查异常进行事务回滚</li>
|
||||||
|
<li>补充定时任务表字段注释</li>
|
||||||
|
<li>定时任务屏蔽ldap远程调用</li>
|
||||||
|
<li>新增通用方法简化下载使用</li>
|
||||||
|
<li>新增通用方法简化模态/缓存使用</li>
|
||||||
|
<li>新增data-dict组件简化数据字典使用</li>
|
||||||
|
<li>禁用dict-tag组件的渐变动画</li>
|
||||||
|
<li>默认首页使用keep-alive缓存</li>
|
||||||
|
<li>升级springcloud到最新版2020.0.4</li>
|
||||||
|
<li>升级spring-boot到最新版本2.5.5</li>
|
||||||
|
<li>升级spring-boot-admin到最新版2.5.2</li>
|
||||||
|
<li>升级pagehelper到最新版1.4.0</li>
|
||||||
|
<li>升级fastjson到最新版1.2.78</li>
|
||||||
|
<li>升级druid到最新版1.2.8</li>
|
||||||
|
<li>升级element-ui到最新版本2.15.6</li>
|
||||||
|
<li>升级sass-loader到最新版本10.1.1</li>
|
||||||
|
<li>升级dart-sass到版本1.32.13</li>
|
||||||
|
<li>升级file-saver到最新版本2.0.5</li>
|
||||||
|
<li>优化异常处理信息</li>
|
||||||
|
<li>验证码默认20s超时</li>
|
||||||
|
<li>优化代码生成导入表按创建时间排序</li>
|
||||||
|
<li>优化代码生成点击预览重置激活tab</li>
|
||||||
|
<li>修复主子表代码模板方法名错误问题</li>
|
||||||
|
<li>修复xss过滤后格式出现的异常</li>
|
||||||
|
<li>修复多图组件验证失败被删除问题</li>
|
||||||
|
<li>请求参数新增reasonable分页合理化属性</li>
|
||||||
|
<li>修复代码生成页面数据编辑保存之后总是跳转第一页的问题</li>
|
||||||
|
<li>修复带safari浏览器无法格式化utc日期格式yyyy-MM-dd'T'HH:mm:ss.SSS问题</li>
|
||||||
|
<li>其他细节优化</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v3.1.0 - 2021-08-02">
|
<el-collapse-item title="v3.1.0 - 2021-08-02">
|
||||||
<ol>
|
<ol>
|
||||||
<li>支持配置XSS跨站脚本过滤</li>
|
<li>支持配置XSS跨站脚本过滤</li>
|
||||||
|
|
@ -560,7 +609,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 版本号
|
// 版本号
|
||||||
version: "3.1.0",
|
version: "3.2.0",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,20 @@
|
||||||
<el-form-item label="任务组名" prop="jobGroup">
|
<el-form-item label="任务组名" prop="jobGroup">
|
||||||
<el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small">
|
<el-select v-model="queryParams.jobGroup" placeholder="请选择任务组名" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in jobGroupOptions"
|
v-for="dict in dict.type.sys_job_group"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="任务状态" prop="status">
|
<el-form-item label="任务状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="请选择任务状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_job_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -94,9 +94,13 @@
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="任务编号" align="center" prop="jobId" />
|
<el-table-column label="任务编号" width="100" align="center" prop="jobId" />
|
||||||
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" />
|
<el-table-column label="任务组名" align="center" prop="jobGroup">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
|
<el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="状态" align="center">
|
<el-table-column label="状态" align="center">
|
||||||
|
|
@ -151,7 +155,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改定时任务对话框 -->
|
<!-- 添加或修改定时任务对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -163,10 +167,10 @@
|
||||||
<el-form-item label="任务分组" prop="jobGroup">
|
<el-form-item label="任务分组" prop="jobGroup">
|
||||||
<el-select v-model="form.jobGroup" placeholder="请选择">
|
<el-select v-model="form.jobGroup" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in jobGroupOptions"
|
v-for="dict in dict.type.sys_job_group"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -187,17 +191,16 @@
|
||||||
<el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" />
|
<el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="24">
|
||||||
<el-form-item label="cron表达式" prop="cronExpression">
|
<el-form-item label="cron表达式" prop="cronExpression">
|
||||||
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" />
|
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式">
|
||||||
</el-form-item>
|
<template slot="append">
|
||||||
</el-col>
|
<el-button type="primary" @click="handleShowCron">
|
||||||
<el-col :span="12">
|
生成表达式
|
||||||
<el-form-item label="是否并发" prop="concurrent">
|
<i class="el-icon-time el-icon--right"></i>
|
||||||
<el-radio-group v-model="form.concurrent" size="small">
|
</el-button>
|
||||||
<el-radio-button label="0">允许</el-radio-button>
|
</template>
|
||||||
<el-radio-button label="1">禁止</el-radio-button>
|
</el-input>
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
|
|
@ -209,14 +212,22 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否并发" prop="concurrent">
|
||||||
|
<el-radio-group v-model="form.concurrent" size="small">
|
||||||
|
<el-radio-button label="0">允许</el-radio-button>
|
||||||
|
<el-radio-button label="1">禁止</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_job_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -228,6 +239,10 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="Cron表达式生成器" :visible.sync="openCron" append-to-body destroy-on-close class="scrollbar">
|
||||||
|
<crontab @hide="openCron=false" @fill="crontabFill" :expression="expression"></crontab>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 任务日志详细 -->
|
<!-- 任务日志详细 -->
|
||||||
<el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body>
|
<el-dialog title="任务详细" :visible.sync="openView" width="700px" append-to-body>
|
||||||
<el-form ref="form" :model="form" label-width="120px" size="mini">
|
<el-form ref="form" :model="form" label-width="120px" size="mini">
|
||||||
|
|
@ -280,9 +295,12 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
|
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
|
||||||
|
import Crontab from '@/components/Crontab'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { Crontab },
|
||||||
name: "Job",
|
name: "Job",
|
||||||
|
dicts: ['sys_job_group', 'sys_job_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -305,10 +323,10 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
// 是否显示详细弹出层
|
// 是否显示详细弹出层
|
||||||
openView: false,
|
openView: false,
|
||||||
// 任务组名字典
|
// 是否显示Cron表达式弹出层
|
||||||
jobGroupOptions: [],
|
openCron: false,
|
||||||
// 状态字典
|
// 传入的表达式
|
||||||
statusOptions: [],
|
expression: "",
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -335,12 +353,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_job_group").then(response => {
|
|
||||||
this.jobGroupOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_job_status").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询定时任务列表 */
|
/** 查询定时任务列表 */
|
||||||
|
|
@ -354,11 +366,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 任务组名字典翻译
|
// 任务组名字典翻译
|
||||||
jobGroupFormat(row, column) {
|
jobGroupFormat(row, column) {
|
||||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
return this.selectDictLabel(this.dict.type.sys_job_group, row.jobGroup);
|
||||||
},
|
|
||||||
// 状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
@ -414,29 +422,21 @@ export default {
|
||||||
// 任务状态修改
|
// 任务状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", {
|
this.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return changeJobStatus(row.jobId, row.status);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.$modal.msgSuccess(text + "成功");
|
||||||
}).then(function() {
|
}).catch(function() {
|
||||||
return changeJobStatus(row.jobId, row.status);
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
}).then(() => {
|
});
|
||||||
this.msgSuccess(text + "成功");
|
|
||||||
}).catch(function() {
|
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/* 立即执行一次 */
|
/* 立即执行一次 */
|
||||||
handleRun(row) {
|
handleRun(row) {
|
||||||
this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", {
|
this.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return runJob(row.jobId, row.jobGroup);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.$modal.msgSuccess("执行成功");
|
||||||
}).then(function() {
|
}).catch(() => {});
|
||||||
return runJob(row.jobId, row.jobGroup);
|
|
||||||
}).then(() => {
|
|
||||||
this.msgSuccess("执行成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 任务详细信息 */
|
/** 任务详细信息 */
|
||||||
handleView(row) {
|
handleView(row) {
|
||||||
|
|
@ -445,6 +445,15 @@ export default {
|
||||||
this.openView = true;
|
this.openView = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** cron表达式按钮操作 */
|
||||||
|
handleShowCron() {
|
||||||
|
this.expression = this.form.cronExpression;
|
||||||
|
this.openCron = true;
|
||||||
|
},
|
||||||
|
/** 确定后回传值 */
|
||||||
|
crontabFill(value) {
|
||||||
|
this.form.cronExpression = value;
|
||||||
|
},
|
||||||
/** 任务日志列表查询 */
|
/** 任务日志列表查询 */
|
||||||
handleJobLog(row) {
|
handleJobLog(row) {
|
||||||
const jobId = row.jobId || 0;
|
const jobId = row.jobId || 0;
|
||||||
|
|
@ -472,13 +481,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.jobId != undefined) {
|
if (this.form.jobId != undefined) {
|
||||||
updateJob(this.form).then(response => {
|
updateJob(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addJob(this.form).then(response => {
|
addJob(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -489,16 +498,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const jobIds = row.jobId || this.ids;
|
const jobIds = row.jobId || this.ids;
|
||||||
this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delJob(jobIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delJob(jobIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in jobGroupOptions"
|
v-for="dict in dict.type.sys_job_group"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -36,10 +36,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_common_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -109,10 +109,18 @@
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
|
<el-table-column label="日志编号" width="80" align="center" prop="jobLogId" />
|
||||||
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
<el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" :show-overflow-tooltip="true" />
|
<el-table-column label="任务组名" align="center" prop="jobGroup" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_job_group" :value="scope.row.jobGroup"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
<el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
|
<el-table-column label="日志信息" align="center" prop="jobMessage" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="执行状态" align="center" prop="status" :formatter="statusFormat" />
|
<el-table-column label="执行状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="执行时间" align="center" prop="createTime" width="180">
|
<el-table-column label="执行时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
|
@ -181,6 +189,7 @@ import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "JobLog",
|
name: "JobLog",
|
||||||
|
dicts: ['sys_common_status', 'sys_job_group'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -201,10 +210,6 @@ export default {
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 执行状态字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 任务组名字典
|
|
||||||
jobGroupOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -226,12 +231,6 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
this.getDicts("sys_common_status").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_job_group").then(response => {
|
|
||||||
this.jobGroupOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询调度日志列表 */
|
/** 查询调度日志列表 */
|
||||||
|
|
@ -244,14 +243,6 @@ export default {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// 执行状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 任务组名字典翻译
|
|
||||||
jobGroupFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
|
||||||
},
|
|
||||||
// 返回按钮
|
// 返回按钮
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.$store.dispatch("tagsView/delView", this.$route);
|
this.$store.dispatch("tagsView/delView", this.$route);
|
||||||
|
|
@ -281,29 +272,21 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const jobLogIds = this.ids;
|
const jobLogIds = this.ids;
|
||||||
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delJobLog(jobLogIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delJobLog(jobLogIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/** 清空按钮操作 */
|
/** 清空按钮操作 */
|
||||||
handleClean() {
|
handleClean() {
|
||||||
this.$confirm("是否确认清空所有调度日志数据项?", "警告", {
|
this.$modal.confirm('是否确认清空所有调度日志数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return cleanJobLog();
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("清空成功");
|
||||||
return cleanJobLog();
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("清空成功");
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -107,16 +107,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 强退按钮操作 */
|
/** 强退按钮操作 */
|
||||||
handleForceLogout(row) {
|
handleForceLogout(row) {
|
||||||
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认强退名称为"' + row.userName + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return forceLogout(row.tokenId);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("强退成功");
|
||||||
return forceLogout(row.tokenId);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("强退成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
<el-form-item label="系统内置" prop="configType">
|
<el-form-item label="系统内置" prop="configType">
|
||||||
<el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small">
|
<el-select v-model="queryParams.configType" placeholder="系统内置" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in dict.type.sys_yes_no"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -111,7 +111,11 @@
|
||||||
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键值" align="center" prop="configValue" />
|
<el-table-column label="参数键值" align="center" prop="configValue" />
|
||||||
<el-table-column label="系统内置" align="center" prop="configType" :formatter="typeFormat" />
|
<el-table-column label="系统内置" align="center" prop="configType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
@ -161,10 +165,10 @@
|
||||||
<el-form-item label="系统内置" prop="configType">
|
<el-form-item label="系统内置" prop="configType">
|
||||||
<el-radio-group v-model="form.configType">
|
<el-radio-group v-model="form.configType">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in dict.type.sys_yes_no"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
|
|
@ -184,6 +188,7 @@ import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Config",
|
name: "Config",
|
||||||
|
dicts: ['sys_yes_no'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -204,8 +209,6 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 类型数据字典
|
|
||||||
typeOptions: [],
|
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|
@ -234,9 +237,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_yes_no").then(response => {
|
|
||||||
this.typeOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询参数列表 */
|
/** 查询参数列表 */
|
||||||
|
|
@ -249,10 +249,6 @@ export default {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// 参数系统内置字典翻译
|
|
||||||
typeFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.typeOptions, row.configType);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -309,13 +305,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.configId != undefined) {
|
if (this.form.configId != undefined) {
|
||||||
updateConfig(this.form).then(response => {
|
updateConfig(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addConfig(this.form).then(response => {
|
addConfig(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -326,15 +322,11 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const configIds = row.configId || this.ids;
|
const configIds = row.configId || this.ids;
|
||||||
this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(function() {
|
|
||||||
return delConfig(configIds);
|
return delConfig(configIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
|
|
@ -346,7 +338,7 @@ export default {
|
||||||
/** 刷新缓存按钮操作 */
|
/** 刷新缓存按钮操作 */
|
||||||
handleRefreshCache() {
|
handleRefreshCache() {
|
||||||
refreshCache().then(() => {
|
refreshCache().then(() => {
|
||||||
this.msgSuccess("刷新成功");
|
this.$modal.msgSuccess("刷新成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="部门状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -37,19 +37,33 @@
|
||||||
v-hasPermi="['system:dept:add']"
|
v-hasPermi="['system:dept:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
plain
|
||||||
|
icon="el-icon-sort"
|
||||||
|
size="mini"
|
||||||
|
@click="toggleExpandAll"
|
||||||
|
>展开/折叠</el-button>
|
||||||
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-if="refreshTable"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="deptList"
|
:data="deptList"
|
||||||
row-key="deptId"
|
row-key="deptId"
|
||||||
default-expand-all
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
|
||||||
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="100"></el-table-column>
|
<el-table-column prop="status" label="状态" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
|
@ -121,10 +135,10 @@
|
||||||
<el-form-item label="部门状态">
|
<el-form-item label="部门状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -145,6 +159,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Dept",
|
name: "Dept",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -160,8 +175,12 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 状态数据字典
|
// 是否展开,默认全部展开
|
||||||
statusOptions: [],
|
isExpandAll: true,
|
||||||
|
// 重新渲染表格状态
|
||||||
|
refreshTable: true,
|
||||||
|
// 是否展开
|
||||||
|
expand: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
deptName: undefined,
|
deptName: undefined,
|
||||||
|
|
@ -199,9 +218,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询部门列表 */
|
/** 查询部门列表 */
|
||||||
|
|
@ -223,10 +239,6 @@ export default {
|
||||||
children: node.children
|
children: node.children
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 字典状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -267,6 +279,14 @@ export default {
|
||||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
toggleExpandAll() {
|
||||||
|
this.refreshTable = false;
|
||||||
|
this.isExpandAll = !this.isExpandAll;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.refreshTable = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
@ -285,13 +305,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.deptId != undefined) {
|
if (this.form.deptId != undefined) {
|
||||||
updateDept(this.form).then(response => {
|
updateDept(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addDept(this.form).then(response => {
|
addDept(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -301,16 +321,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delDept(row.deptId);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delDept(row.deptId);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
|
@ -163,10 +163,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
|
|
@ -187,6 +187,7 @@ import { listType, getType } from "@/api/system/dict/type";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Data",
|
name: "Data",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -236,8 +237,6 @@ export default {
|
||||||
label: "危险"
|
label: "危险"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 类型数据字典
|
// 类型数据字典
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|
@ -268,9 +267,6 @@ export default {
|
||||||
const dictId = this.$route.params && this.$route.params.dictId;
|
const dictId = this.$route.params && this.$route.params.dictId;
|
||||||
this.getType(dictId);
|
this.getType(dictId);
|
||||||
this.getTypeList();
|
this.getTypeList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典类型详细 */
|
/** 查询字典类型详细 */
|
||||||
|
|
@ -355,13 +351,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictCode != undefined) {
|
if (this.form.dictCode != undefined) {
|
||||||
updateData(this.form).then(response => {
|
updateData(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addData(this.form).then(response => {
|
addData(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -372,16 +368,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictCodes = row.dictCode || this.ids;
|
const dictCodes = row.dictCode || this.ids;
|
||||||
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delData(dictCodes);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delData(dictCodes);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
|
@ -173,10 +173,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
|
|
@ -196,6 +196,7 @@ import { listType, getType, delType, addType, updateType, refreshCache } from "@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Dict",
|
name: "Dict",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -216,8 +217,6 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|
@ -243,9 +242,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典类型列表 */
|
/** 查询字典类型列表 */
|
||||||
|
|
@ -313,13 +309,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictId != undefined) {
|
if (this.form.dictId != undefined) {
|
||||||
updateType(this.form).then(response => {
|
updateType(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addType(this.form).then(response => {
|
addType(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -330,16 +326,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictIds = row.dictId || this.ids;
|
const dictIds = row.dictId || this.ids;
|
||||||
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delType(dictIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delType(dictIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
@ -350,7 +342,7 @@ export default {
|
||||||
/** 刷新缓存按钮操作 */
|
/** 刷新缓存按钮操作 */
|
||||||
handleRefreshCache() {
|
handleRefreshCache() {
|
||||||
refreshCache().then(() => {
|
refreshCache().then(() => {
|
||||||
this.msgSuccess("刷新成功");
|
this.$modal.msgSuccess("刷新成功");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_common_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -95,7 +95,11 @@
|
||||||
<el-table-column label="访问编号" align="center" prop="infoId" />
|
<el-table-column label="访问编号" align="center" prop="infoId" />
|
||||||
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
|
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" />
|
||||||
<el-table-column label="地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
|
<el-table-column label="地址" align="center" prop="ipaddr" width="130" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
<el-table-column label="登录状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="描述" align="center" prop="msg" />
|
<el-table-column label="描述" align="center" prop="msg" />
|
||||||
<el-table-column label="访问时间" align="center" prop="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
|
<el-table-column label="访问时间" align="center" prop="accessTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
@ -119,6 +123,7 @@ import { list, delLogininfor, cleanLogininfor } from "@/api/system/logininfor";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Logininfor",
|
name: "Logininfor",
|
||||||
|
dicts: ['sys_common_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -133,8 +138,6 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
// 表格数据
|
// 表格数据
|
||||||
list: [],
|
list: [],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 默认排序
|
// 默认排序
|
||||||
|
|
@ -151,9 +154,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_common_status").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询登录日志列表 */
|
/** 查询登录日志列表 */
|
||||||
|
|
@ -166,10 +166,6 @@ export default {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// 登录状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
|
|
@ -196,29 +192,21 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const infoIds = row.infoId || this.ids;
|
const infoIds = row.infoId || this.ids;
|
||||||
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delLogininfor(infoIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delLogininfor(infoIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 清空按钮操作 */
|
/** 清空按钮操作 */
|
||||||
handleClean() {
|
handleClean() {
|
||||||
this.$confirm('是否确认清空所有登录日志数据项?', "警告", {
|
this.$modal.confirm('是否确认清空所有登录日志数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return cleanLogininfor();
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("清空成功");
|
||||||
return cleanLogininfor();
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("清空成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -37,13 +37,24 @@
|
||||||
v-hasPermi="['system:menu:add']"
|
v-hasPermi="['system:menu:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
plain
|
||||||
|
icon="el-icon-sort"
|
||||||
|
size="mini"
|
||||||
|
@click="toggleExpandAll"
|
||||||
|
>展开/折叠</el-button>
|
||||||
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
|
v-if="refreshTable"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="menuList"
|
:data="menuList"
|
||||||
row-key="menuId"
|
row-key="menuId"
|
||||||
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
||||||
|
|
@ -55,7 +66,11 @@
|
||||||
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
|
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
|
||||||
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" :formatter="statusFormat" width="80"></el-table-column>
|
<el-table-column prop="status" label="状态" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
|
@ -191,37 +206,14 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.menuType != 'F'">
|
<el-form-item v-if="form.menuType == 'C'">
|
||||||
|
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
<el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
显示状态
|
路由参数
|
||||||
</span>
|
</span>
|
||||||
<el-radio-group v-model="form.visible">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in visibleOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictValue"
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item v-if="form.menuType != 'F'">
|
|
||||||
<span slot="label">
|
|
||||||
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
|
||||||
<i class="el-icon-question"></i>
|
|
||||||
</el-tooltip>
|
|
||||||
菜单状态
|
|
||||||
</span>
|
|
||||||
<el-radio-group v-model="form.status">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in statusOptions"
|
|
||||||
:key="dict.dictValue"
|
|
||||||
:label="dict.dictValue"
|
|
||||||
>{{dict.dictLabel}}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -238,6 +230,40 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item v-if="form.menuType != 'F'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
显示状态
|
||||||
|
</span>
|
||||||
|
<el-radio-group v-model="form.visible">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_show_hide"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item v-if="form.menuType != 'F'">
|
||||||
|
<span slot="label">
|
||||||
|
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
菜单状态
|
||||||
|
</span>
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
@ -256,6 +282,7 @@ import IconSelect from "@/components/IconSelect";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Menu",
|
name: "Menu",
|
||||||
|
dicts: ['sys_show_hide', 'sys_normal_disable'],
|
||||||
components: { Treeselect, IconSelect },
|
components: { Treeselect, IconSelect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -271,10 +298,10 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 显示状态数据字典
|
// 是否展开,默认全部折叠
|
||||||
visibleOptions: [],
|
isExpandAll: false,
|
||||||
// 菜单状态数据字典
|
// 重新渲染表格状态
|
||||||
statusOptions: [],
|
refreshTable: true,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
menuName: undefined,
|
menuName: undefined,
|
||||||
|
|
@ -298,12 +325,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_show_hide").then(response => {
|
|
||||||
this.visibleOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 选择图标
|
// 选择图标
|
||||||
|
|
@ -338,20 +359,6 @@ export default {
|
||||||
this.menuOptions.push(menu);
|
this.menuOptions.push(menu);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 显示状态字典翻译
|
|
||||||
visibleFormat(row, column) {
|
|
||||||
if (row.menuType == "F") {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return this.selectDictLabel(this.visibleOptions, row.visible);
|
|
||||||
},
|
|
||||||
// 菜单状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
if (row.menuType == "F") {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -394,6 +401,14 @@ export default {
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加菜单";
|
this.title = "添加菜单";
|
||||||
},
|
},
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
toggleExpandAll() {
|
||||||
|
this.refreshTable = false;
|
||||||
|
this.isExpandAll = !this.isExpandAll;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.refreshTable = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
@ -410,13 +425,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.menuId != undefined) {
|
if (this.form.menuId != undefined) {
|
||||||
updateMenu(this.form).then(response => {
|
updateMenu(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addMenu(this.form).then(response => {
|
addMenu(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -426,16 +441,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delMenu(row.menuId);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delMenu(row.menuId);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
<el-form-item label="类型" prop="noticeType">
|
<el-form-item label="类型" prop="noticeType">
|
||||||
<el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">
|
<el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in dict.type.sys_notice_type"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -80,20 +80,16 @@
|
||||||
prop="noticeTitle"
|
prop="noticeTitle"
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
/>
|
/>
|
||||||
<el-table-column
|
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
||||||
label="公告类型"
|
<template slot-scope="scope">
|
||||||
align="center"
|
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
||||||
prop="noticeType"
|
</template>
|
||||||
:formatter="typeFormat"
|
</el-table-column>
|
||||||
width="100"
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
/>
|
<template slot-scope="scope">
|
||||||
<el-table-column
|
<dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
|
||||||
label="状态"
|
</template>
|
||||||
align="center"
|
</el-table-column>
|
||||||
prop="status"
|
|
||||||
:formatter="statusFormat"
|
|
||||||
width="100"
|
|
||||||
/>
|
|
||||||
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
|
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
@ -141,10 +137,10 @@
|
||||||
<el-form-item label="公告类型" prop="noticeType">
|
<el-form-item label="公告类型" prop="noticeType">
|
||||||
<el-select v-model="form.noticeType" placeholder="请选择">
|
<el-select v-model="form.noticeType" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in dict.type.sys_notice_type"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -153,10 +149,10 @@
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_notice_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -180,6 +176,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Notice",
|
name: "Notice",
|
||||||
|
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -200,10 +197,6 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 类型数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 状态数据字典
|
|
||||||
typeOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -227,12 +220,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_notice_status").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_notice_type").then(response => {
|
|
||||||
this.typeOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询公告列表 */
|
/** 查询公告列表 */
|
||||||
|
|
@ -244,14 +231,6 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 公告状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 公告状态字典翻译
|
|
||||||
typeFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.typeOptions, row.noticeType);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -306,13 +285,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.noticeId != undefined) {
|
if (this.form.noticeId != undefined) {
|
||||||
updateNotice(this.form).then(response => {
|
updateNotice(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addNotice(this.form).then(response => {
|
addNotice(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -323,16 +302,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const noticeIds = row.noticeId || this.ids
|
const noticeIds = row.noticeId || this.ids
|
||||||
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delNotice(noticeIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delNotice(noticeIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in dict.type.sys_oper_type"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -46,10 +46,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_common_status"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -110,11 +110,19 @@
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="日志编号" align="center" prop="operId" />
|
<el-table-column label="日志编号" align="center" prop="operId" />
|
||||||
<el-table-column label="系统模块" align="center" prop="title" />
|
<el-table-column label="系统模块" align="center" prop="title" />
|
||||||
<el-table-column label="操作类型" align="center" prop="businessType" :formatter="typeFormat" />
|
<el-table-column label="操作类型" align="center" prop="businessType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_oper_type" :value="scope.row.businessType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="请求方式" align="center" prop="requestMethod" />
|
<el-table-column label="请求方式" align="center" prop="requestMethod" />
|
||||||
<el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/>
|
<el-table-column label="操作人员" align="center" prop="operName" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']" width="100"/>
|
||||||
<el-table-column label="主机" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" />
|
<el-table-column label="主机" align="center" prop="operIp" width="130" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="操作状态" align="center" prop="status" :formatter="statusFormat" />
|
<el-table-column label="操作状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_common_status" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
|
<el-table-column label="操作日期" align="center" prop="operTime" sortable="custom" :sort-orders="['descending', 'ascending']" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.operTime) }}</span>
|
<span>{{ parseTime(scope.row.operTime) }}</span>
|
||||||
|
|
@ -190,6 +198,7 @@ import { list, delOperlog, cleanOperlog } from "@/api/system/operlog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Operlog",
|
name: "Operlog",
|
||||||
|
dicts: ['sys_oper_type', 'sys_common_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -206,10 +215,6 @@ export default {
|
||||||
list: [],
|
list: [],
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 类型数据字典
|
|
||||||
typeOptions: [],
|
|
||||||
// 类型数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 默认排序
|
// 默认排序
|
||||||
|
|
@ -229,12 +234,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_oper_type").then(response => {
|
|
||||||
this.typeOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_common_status").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询登录日志 */
|
/** 查询登录日志 */
|
||||||
|
|
@ -247,13 +246,9 @@ export default {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// 操作日志状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 操作日志类型字典翻译
|
// 操作日志类型字典翻译
|
||||||
typeFormat(row, column) {
|
typeFormat(row, column) {
|
||||||
return this.selectDictLabel(this.typeOptions, row.businessType);
|
return this.selectDictLabel(this.dict.type.sys_oper_type, row.businessType);
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
|
@ -286,29 +281,21 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const operIds = row.operId || this.ids;
|
const operIds = row.operId || this.ids;
|
||||||
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delOperlog(operIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delOperlog(operIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 清空按钮操作 */
|
/** 清空按钮操作 */
|
||||||
handleClean() {
|
handleClean() {
|
||||||
this.$confirm('是否确认清空所有操作日志数据项?', "警告", {
|
this.$modal.confirm('是否确认清空所有操作日志数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return cleanOperlog();
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("清空成功");
|
||||||
return cleanOperlog();
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("清空成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="岗位状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -87,7 +87,11 @@
|
||||||
<el-table-column label="岗位编码" align="center" prop="postCode" />
|
<el-table-column label="岗位编码" align="center" prop="postCode" />
|
||||||
<el-table-column label="岗位名称" align="center" prop="postName" />
|
<el-table-column label="岗位名称" align="center" prop="postName" />
|
||||||
<el-table-column label="岗位排序" align="center" prop="postSort" />
|
<el-table-column label="岗位排序" align="center" prop="postSort" />
|
||||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
|
@ -136,10 +140,10 @@
|
||||||
<el-form-item label="岗位状态" prop="status">
|
<el-form-item label="岗位状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
|
|
@ -159,6 +163,7 @@ import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/po
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Post",
|
name: "Post",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -179,8 +184,6 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -207,9 +210,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询岗位列表 */
|
/** 查询岗位列表 */
|
||||||
|
|
@ -221,10 +221,6 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 岗位状态字典翻译
|
|
||||||
statusFormat(row, column) {
|
|
||||||
return this.selectDictLabel(this.statusOptions, row.status);
|
|
||||||
},
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -280,13 +276,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.postId != undefined) {
|
if (this.form.postId != undefined) {
|
||||||
updatePost(this.form).then(response => {
|
updatePost(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addPost(this.form).then(response => {
|
addPost(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -297,16 +293,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const postIds = row.postId || this.ids;
|
const postIds = row.postId || this.ids;
|
||||||
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delPost(postIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delPost(postIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
|
@ -107,6 +107,7 @@ import selectUser from "./selectUser";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AuthUser",
|
name: "AuthUser",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
components: { selectUser },
|
components: { selectUser },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -122,8 +123,6 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
// 用户表格数据
|
// 用户表格数据
|
||||||
userList: [],
|
userList: [],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -139,9 +138,6 @@ export default {
|
||||||
if (roleId) {
|
if (roleId) {
|
||||||
this.queryParams.roleId = roleId;
|
this.queryParams.roleId = roleId;
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -182,30 +178,22 @@ export default {
|
||||||
/** 取消授权按钮操作 */
|
/** 取消授权按钮操作 */
|
||||||
cancelAuthUser(row) {
|
cancelAuthUser(row) {
|
||||||
const roleId = this.queryParams.roleId;
|
const roleId = this.queryParams.roleId;
|
||||||
this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', "警告", {
|
this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() {
|
||||||
confirmButtonText: "确定",
|
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(function() {
|
|
||||||
return authUserCancel({ userId: row.userId, roleId: roleId });
|
return authUserCancel({ userId: row.userId, roleId: roleId });
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("取消授权成功");
|
this.$modal.msgSuccess("取消授权成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
/** 批量取消授权按钮操作 */
|
/** 批量取消授权按钮操作 */
|
||||||
cancelAuthUserAll(row) {
|
cancelAuthUserAll(row) {
|
||||||
const roleId = this.queryParams.roleId;
|
const roleId = this.queryParams.roleId;
|
||||||
const userIds = this.userIds.join(",");
|
const userIds = this.userIds.join(",");
|
||||||
this.$confirm('是否取消选中用户授权数据项?', "警告", {
|
this.$modal.confirm('是否取消选中用户授权数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return authUserCancelAll({ roleId: roleId, userIds: userIds });
|
||||||
cancelButtonText: "取消",
|
|
||||||
type: "warning"
|
|
||||||
}).then(() => {
|
|
||||||
return authUserCancelAll({ roleId: roleId, userIds: userIds });
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("取消授权成功");
|
this.$modal.msgSuccess("取消授权成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -182,10 +182,10 @@
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="菜单权限">
|
<el-form-item label="菜单权限">
|
||||||
|
|
@ -264,6 +264,7 @@ import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/d
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Role",
|
name: "Role",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -292,8 +293,6 @@ export default {
|
||||||
deptNodeAll: false,
|
deptNodeAll: false,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 数据范围选项
|
// 数据范围选项
|
||||||
dataScopeOptions: [
|
dataScopeOptions: [
|
||||||
{
|
{
|
||||||
|
|
@ -351,9 +350,6 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询角色列表 */
|
/** 查询角色列表 */
|
||||||
|
|
@ -414,17 +410,13 @@ export default {
|
||||||
// 角色状态修改
|
// 角色状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', "警告", {
|
this.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return changeRoleStatus(row.roleId, row.status);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.$modal.msgSuccess(text + "成功");
|
||||||
}).then(function() {
|
}).catch(function() {
|
||||||
return changeRoleStatus(row.roleId, row.status);
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
}).then(() => {
|
});
|
||||||
this.msgSuccess(text + "成功");
|
|
||||||
}).catch(function() {
|
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
@ -580,14 +572,14 @@ export default {
|
||||||
if (this.form.roleId != undefined) {
|
if (this.form.roleId != undefined) {
|
||||||
this.form.menuIds = this.getMenuAllCheckedKeys();
|
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||||
updateRole(this.form).then(response => {
|
updateRole(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.form.menuIds = this.getMenuAllCheckedKeys();
|
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||||
addRole(this.form).then(response => {
|
addRole(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -600,7 +592,7 @@ export default {
|
||||||
if (this.form.roleId != undefined) {
|
if (this.form.roleId != undefined) {
|
||||||
this.form.deptIds = this.getDeptAllCheckedKeys();
|
this.form.deptIds = this.getDeptAllCheckedKeys();
|
||||||
dataScope(this.form).then(response => {
|
dataScope(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.openDataScope = false;
|
this.openDataScope = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -609,16 +601,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const roleIds = row.roleId || this.ids;
|
const roleIds = row.roleId || this.ids;
|
||||||
this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delRole(roleIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delRole(roleIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="statusOptions" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
|
@ -61,6 +61,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
|
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
|
||||||
export default {
|
export default {
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
props: {
|
props: {
|
||||||
// 角色编号
|
// 角色编号
|
||||||
roleId: {
|
roleId: {
|
||||||
|
|
@ -77,8 +78,6 @@ export default {
|
||||||
total: 0,
|
total: 0,
|
||||||
// 未授权用户数据
|
// 未授权用户数据
|
||||||
userList: [],
|
userList: [],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -89,11 +88,6 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 显示弹框
|
// 显示弹框
|
||||||
show() {
|
show() {
|
||||||
|
|
@ -130,7 +124,7 @@ export default {
|
||||||
const roleId = this.queryParams.roleId;
|
const roleId = this.queryParams.roleId;
|
||||||
const userIds = this.userIds.join(",");
|
const userIds = this.userIds.join(",");
|
||||||
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
|
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
|
||||||
this.msgSuccess(res.msg);
|
this.$modal.msgSuccess(res.msg);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit("ok");
|
this.$emit("ok");
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export default {
|
||||||
const userId = this.form.userId;
|
const userId = this.form.userId;
|
||||||
const roleIds = this.roleIds.join(",");
|
const roleIds = this.roleIds.join(",");
|
||||||
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
|
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
|
||||||
this.msgSuccess("授权成功");
|
this.$modal.msgSuccess("授权成功");
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,10 @@
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -250,10 +250,10 @@
|
||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select v-model="form.sex" placeholder="请选择">
|
<el-select v-model="form.sex" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sexOptions"
|
v-for="dict in dict.type.sys_user_sex"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictLabel"
|
:label="dict.label"
|
||||||
:value="dict.dictValue"
|
:value="dict.value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -262,10 +262,10 @@
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in statusOptions"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.dictValue"
|
:key="dict.value"
|
||||||
:label="dict.dictValue"
|
:label="dict.value"
|
||||||
>{{dict.dictLabel}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -353,6 +353,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
|
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||||
components: { Treeselect },
|
components: { Treeselect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -382,10 +383,6 @@ export default {
|
||||||
initPassword: undefined,
|
initPassword: undefined,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 状态数据字典
|
|
||||||
statusOptions: [],
|
|
||||||
// 性别状态字典
|
|
||||||
sexOptions: [],
|
|
||||||
// 岗位选项
|
// 岗位选项
|
||||||
postOptions: [],
|
postOptions: [],
|
||||||
// 角色选项
|
// 角色选项
|
||||||
|
|
@ -433,7 +430,8 @@ export default {
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
userName: [
|
userName: [
|
||||||
{ required: true, message: "用户名称不能为空", trigger: "blur" }
|
{ required: true, message: "用户名称不能为空", trigger: "blur" },
|
||||||
|
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
nickName: [
|
nickName: [
|
||||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
||||||
|
|
@ -468,12 +466,6 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
this.getDicts("sys_normal_disable").then(response => {
|
|
||||||
this.statusOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getDicts("sys_user_sex").then(response => {
|
|
||||||
this.sexOptions = response.data;
|
|
||||||
});
|
|
||||||
this.getConfigKey("sys.user.initPassword").then(response => {
|
this.getConfigKey("sys.user.initPassword").then(response => {
|
||||||
this.initPassword = response.msg;
|
this.initPassword = response.msg;
|
||||||
});
|
});
|
||||||
|
|
@ -508,17 +500,13 @@ export default {
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
|
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return changeUserStatus(row.userId, row.status);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.$modal.msgSuccess(text + "成功");
|
||||||
}).then(function() {
|
}).catch(function() {
|
||||||
return changeUserStatus(row.userId, row.status);
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
}).then(() => {
|
});
|
||||||
this.msgSuccess(text + "成功");
|
|
||||||
}).catch(function() {
|
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
|
|
@ -611,7 +599,7 @@ export default {
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
resetUserPwd(row.userId, value).then(response => {
|
||||||
this.msgSuccess("修改成功,新密码是:" + value);
|
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
@ -626,13 +614,13 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.userId != undefined) {
|
if (this.form.userId != undefined) {
|
||||||
updateUser(this.form).then(response => {
|
updateUser(this.form).then(response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addUser(this.form).then(response => {
|
addUser(this.form).then(response => {
|
||||||
this.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
|
@ -643,16 +631,12 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const userIds = row.userId || this.ids;
|
const userIds = row.userId || this.ids;
|
||||||
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
|
||||||
confirmButtonText: "确定",
|
return delUser(userIds);
|
||||||
cancelButtonText: "取消",
|
}).then(() => {
|
||||||
type: "warning"
|
this.getList();
|
||||||
}).then(function() {
|
this.$modal.msgSuccess("删除成功");
|
||||||
return delUser(userIds);
|
}).catch(() => {});
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
|
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
|
||||||
response => {
|
response => {
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export default {
|
||||||
// 上传预处理
|
// 上传预处理
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
if (file.type.indexOf("image/") == -1) {
|
if (file.type.indexOf("image/") == -1) {
|
||||||
this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
|
this.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
|
||||||
} else {
|
} else {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
|
|
@ -128,7 +128,7 @@ export default {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.options.img = response.imgUrl;
|
this.options.img = response.imgUrl;
|
||||||
store.commit('SET_AVATAR', this.options.img);
|
store.commit('SET_AVATAR', this.options.img);
|
||||||
this.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue