master
wangbing 5 years ago
parent 989ce9462d
commit e0f06eb14f

@ -643,6 +643,7 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "MapperUtil.java"), option + "/java/frame/utils/MapperUtil.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "MD5Util.java"), option + "/java/frame/utils/MD5Util.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ProcessUtil.java"), option + "/java/frame/utils/ProcessUtil.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ResponseUtil.java"), option + "/java/frame/utils/ResponseUtil.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "RSAUtil.java"), option + "/java/frame/utils/RSAUtil.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "StringUtil.java"), option + "/java/frame/utils/StringUtil.java", ctx);
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "ValidationUtil.java"), option + "/java/frame/utils/ValidationUtil.java", ctx);

@ -2,10 +2,21 @@ package ${basePackage}.action.ajax.${module};
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.module.${module}.mgr.${table.getCName()}Manager;
import ${basePackage}.module.${module}.ent.${table.getCName()};
import ${basePackage}.module.${module}.req.*;
import ${basePackage}.module.${module}.rsp.*;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
public class ${table.getCName()}Ajax{
@ -13,93 +24,83 @@ public class ${table.getCName()}Ajax{
private ${table.getCName()}Manager ${table.getFName()}Manager;
<#if table.getCreate()>
public ${table.getCName()}CreateResponse create(String jsonParam) {
public ${table.getCName()}CreateResponse create(TreeNode jsonParam) {
${table.getCName()}CreateRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}CreateRequest.class);
return ${table.getFName()}Manager.create(request, LocalData.getToken());
}
</#if>
<#if table.getDelete()>
public ${table.getCName()}DeleteResponse delete(String jsonParam) {
public ${table.getCName()}DeleteResponse delete(TreeNode jsonParam) {
${table.getCName()}DeleteRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}DeleteRequest.class);
return ${table.getFName()}Manager.delete(request, LocalData.getToken());
}
</#if>
<#if table.getUpdate()>
public ${table.getCName()}UpdateResponse update(String jsonParam) {
public ${table.getCName()}UpdateResponse update(TreeNode jsonParam) {
${table.getCName()}UpdateRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}UpdateRequest.class);
return ${table.getFName()}Manager.update(request, LocalData.getToken());
}
</#if>
<#if table.getFind()>
public ${table.getCName()}FindResponse find(String jsonParam) {
public ${table.getCName()}FindResponse find(TreeNode jsonParam) {
${table.getCName()}FindRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}FindRequest.class);
return ${table.getFName()}Manager.find(request, LocalData.getToken());
}
</#if>
<#if table.getGet()>
public ${table.getCName()}GetResponse get(String jsonParam) {
public ${table.getCName()}GetResponse get(TreeNode jsonParam) {
${table.getCName()}GetRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}GetRequest.class);
return ${table.getFName()}Manager.get(request, LocalData.getToken());
}
</#if>
<#if table.getSearch()>
public ${table.getCName()}SearchResponse search(String jsonParam) {
public ${table.getCName()}SearchResponse search(TreeNode jsonParam) {
${table.getCName()}SearchRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}SearchRequest.class);
return ${table.getFName()}Manager.search(request, LocalData.getToken());
}
</#if>
<#if table.getGetAll()>
public ${table.getCName()}GetAllResponse getAll(String jsonParam) {
public ${table.getCName()}GetAllResponse getAll(TreeNode jsonParam) {
${table.getCName()}GetAllRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}GetAllRequest.class);
return ${table.getFName()}Manager.getAll(request, LocalData.getToken());
}
</#if>
<#if table.getHtml()>
public Object template(){
try {
WSheet<DictItemCreateRequest> sheet = new WSheet<>(DictItemCreateRequest.class);
byte[] bytes = sheet.getBytes();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(sheet.getName() + ".xlsx","utf-8"));
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
} catch (IOException e) {
BaseResponse baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "");
return baseResponse;
return ResponseUtil.apply(new WSheet<>(${table.getCName()}.class));
}
public Object exports(TreeNode jsonParam) {
${table.getCName()}FindRequest request = MapperUtil.toJava(jsonParam, ${table.getCName()}FindRequest.class);
${table.getCName()}FindResponse response = ${table.getFName()}Manager.find(request, LocalData.getToken());
if (response.hasError()) {
return response;
}
return ResponseUtil.apply(new WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
byte[] bytes = file.getBytes();
WSheet<DictCreateRequest> sheet = new WSheet<>(bytes, DictCreateRequest.class);
WSheet<${table.getCName()}> sheet = new WSheet<>(file.getBytes(), ${table.getCName()}.class);
if (sheet.hasError()) {
byte[] sheetBytes = sheet.getBytes(true);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(sheet.getName() + "-err.xlsx","utf-8"));
return new ResponseEntity<>(sheetBytes, headers, HttpStatus.OK);
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-err.xlsx");
} else {
return baseResponse;
}
} catch (IOException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
} catch (TemplateNotMatchException | ReadErrorException e) {
} catch (TemplateNotMatchException | ReadErrorException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
}
return baseResponse;
}
</#if>

@ -1,25 +1,22 @@
package ${basePackage}.action.ajax.system;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.excel.WSheet;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.module.system.ent.Dict;
import ${basePackage}.module.system.mgr.DictManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.TreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import java.io.IOException;
import java.net.URLEncoder;
public class DictAjax {
@ -57,33 +54,25 @@ public class DictAjax {
}
public Object template(){
try {
WSheet<DictCreateRequest> sheet = new WSheet<>(DictCreateRequest.class);
byte[] bytes = sheet.getBytes();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(sheet.getName() + ".xlsx","utf-8"));
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
} catch (IOException e) {
BaseResponse baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "");
return baseResponse;
return ResponseUtil.apply(new WSheet<>(Dict.class));
}
public Object exports(TreeNode jsonParam) {
DictFindRequest request = MapperUtil.toJava(jsonParam, DictFindRequest.class);
DictFindResponse response = dictManager.find(request, LocalData.getToken());
if (response.hasError()) {
return response;
}
return ResponseUtil.apply(new WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
byte[] bytes = file.getBytes();
WSheet<DictCreateRequest> sheet = new WSheet<>(bytes, DictCreateRequest.class);
WSheet<Dict> sheet = new WSheet<>(file.getBytes(), Dict.class);
if (sheet.hasError()) {
byte[] sheetBytes = sheet.getBytes(true);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(sheet.getName() + "-err.xlsx","utf-8"));
return new ResponseEntity<>(sheetBytes, headers, HttpStatus.OK);
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-err.xlsx");
} else {
return baseResponse;
}
@ -92,7 +81,6 @@ public class DictAjax {
} catch (TemplateNotMatchException | ReadErrorException e) {
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
}
return baseResponse;
}
}

@ -43,7 +43,6 @@ public class WColumn implements Serializable {
public WColumn() {
this.name = "";
this.cellWidth = 1;
this.isHidden = false;
this.isRequired = false;
this.description = "";
}
@ -51,7 +50,6 @@ public class WColumn implements Serializable {
public WColumn(String name) {
this.name = name;
this.cellWidth = 1;
this.isHidden = false;
this.isRequired = false;
this.description = "";
}
@ -83,14 +81,6 @@ public class WColumn implements Serializable {
this.cellWidth = cellWidth;
}
public boolean isHidden() {
return isHidden;
}
public void setHidden(boolean isHidden) {
this.isHidden = isHidden;
}
public boolean isRequired() {
return isRequired;
}

@ -5,6 +5,7 @@ import ${basePackage}.frame.excel.style.ErrorCellStyle;
import ${basePackage}.frame.excel.style.HeadCellStyle;
import ${basePackage}.frame.excel.style.RedFont;
import ${basePackage}.frame.utils.ClassUtil;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.utils.StringUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.annotation.*;
@ -79,12 +80,13 @@ public class WSheet<T> implements Serializable, Cloneable {
boolean parentFirst = clazz.isAnnotationPresent(ParentFirst.class) && clazz.getAnnotation(ParentFirst.class).value();
Field[] fields = ClassUtil.getFields(clazz, parentFirst);
for (Field field : fields) {
WColumn WColumn = new WColumn();
WColumn.setField(field);
if (field.isAnnotationPresent(Ignore.class) && field.getAnnotation(Ignore.class).value()) {
WColumn.setHidden(true);
continue;
}
WColumn WColumn = new WColumn();
WColumn.setField(field);
//获取列名称
if (!field.isAnnotationPresent(ColumnName.class)) {
WColumn.setName(field.getName());
@ -164,7 +166,7 @@ public class WSheet<T> implements Serializable, Cloneable {
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
public WSheet(List<T> list) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
public WSheet(List<T> list) {
if (list == null || list.size() == 0) {
throw new RuntimeException("不允许传入空的列表");
}
@ -185,14 +187,24 @@ public class WSheet<T> implements Serializable, Cloneable {
method = t.getClass().getMethod("get" + att);
} catch (NoSuchMethodException e) {
// 尝试获取is方法工具生成布尔值可能是is而不是get
method = t.getClass().getMethod("is" + att);
try {
method = t.getClass().getMethod("is" + att);
} catch (NoSuchMethodException e1) {
LogUtil.w(field.getName()+"can not find get method");
}
}
Object value = method.invoke(t);
if (null == value) {
row.put(column.getName(), new WCell());
} else {
String string = column.getConverter().string(value);
row.put(column.getName(), new WCell(string));
try {
Object value = method.invoke(t);
if (null == value) {
row.put(column.getName(), new WCell());
} else {
String string = column.getConverter().string(value);
row.put(column.getName(), new WCell(string));
}
} catch (IllegalAccessException e) {
LogUtil.w( "can not invoke get method!");
} catch (InvocationTargetException e) {
LogUtil.w(method.getName() + " unexpected exception!");
}
}
this.rowList.add(row);
@ -210,6 +222,10 @@ public class WSheet<T> implements Serializable, Cloneable {
* 2:<br/>
*/
public WSheet(byte[] bytes, Class<T> clazz) throws TemplateNotMatchException, ReadErrorException {
this(bytes, clazz, null);
}
public WSheet(byte[] bytes, Class<T> clazz, Validator validator) throws TemplateNotMatchException, ReadErrorException {
Workbook workbook = null;
InputStream is = null;
boolean flag;
@ -301,6 +317,7 @@ public class WSheet<T> implements Serializable, Cloneable {
try {
T t = transferOneObject(clazz, i);
List<String> validate = ValidationUtil.validate(t);
validate.addAll(validator != null ? validator.validate(t) : null);
if (validate.size() > 0) {
for (String s : validate) {
row.addError(s);
@ -335,11 +352,6 @@ public class WSheet<T> implements Serializable, Cloneable {
}
for (int j = 0; j < this.columnList.size(); j++) {
WColumn wColumn = this.columnList.get(0);
if (wColumn.isHidden()) {
continue;
}
String key = this.columnList.get(j).getName();
for (WColumn column : columnList) {
@ -458,21 +470,19 @@ public class WSheet<T> implements Serializable, Cloneable {
* @return
* @throws IOException
*/
public byte[] getBytes() throws IOException {
XSSFWorkbook workbook = getExcel(false);
if (workbook != null) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
workbook.write(outputStream);
return outputStream.toByteArray();
}
return null;
public byte[] getBytes() {
return getBytes(false);
}
public byte[] getBytes(boolean checkResult) throws IOException {
public byte[] getBytes(boolean checkResult) {
XSSFWorkbook workbook = getExcel(checkResult);
if (workbook != null) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
workbook.write(outputStream);
try {
workbook.write(outputStream);
} catch (IOException e) {
return null;
}
return outputStream.toByteArray();
}
return null;
@ -601,4 +611,8 @@ public class WSheet<T> implements Serializable, Cloneable {
return cell.getStringCellValue();
}
}
public interface Validator<T> {
List<String> validate(T t);
}
}

@ -5,10 +5,11 @@ import java.lang.reflect.Method;
import java.util.*;
/**
* Created on 2015/5/28.
* ClassUtil
*
* @author
* @version 2.1.0
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class ClassUtil {
@ -20,31 +21,13 @@ public class ClassUtil {
* @return
*/
public static Field[] getFields(Class clazz, boolean parentFirst) {
List<Field> returnList = new ArrayList<>();
Set<String> nameSet = new HashSet<>();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
returnList.add(field);
nameSet.add(field.getName());
}
List<Field> parentList = getParentFields(clazz.getSuperclass(), nameSet, parentFirst);
if (parentFirst) {
parentList.addAll(returnList);
returnList = parentList;
} else {
returnList.addAll(parentList);
}
fields = new Field[returnList.size()];
int index = 0;
for (Field field : returnList) {
fields[index++] = field;
Field[] parentFields = getParentFields(clazz.getSuperclass());
return concat(fields, parentFields);
}
return fields;
}
/**
@ -115,12 +98,6 @@ public class ClassUtil {
return pojoClass.getMethod(getMethodName.toString(), type);
}
/**
* java
*
* @param field
* @return
*/
public static boolean isJavaClass(Field field) {
Class<?> fieldType = field.getType();
boolean isBaseClass = false;
@ -136,37 +113,23 @@ public class ClassUtil {
return isBaseClass;
}
/**
*
*
* @param clazz
* @return
*/
public static Field[] getFields(Class clazz) {
return getFields(clazz, false);
}
private static List<Field> getParentFields(Class parentClazz, Set<String> nameSet, boolean parentFirst) {
List<Field> fieldList = new ArrayList<>();
private static Field[] getParentFields(Class parentClazz) {
if (parentClazz != null) {
Field[] parentList = parentClazz.getDeclaredFields();
int index = 0;
for (Field field : parentList) {
int beginSize = nameSet.size();
nameSet.add(field.getName());
int endSize = nameSet.size();
if (endSize > beginSize) {
if (parentFirst) {
fieldList.add(index++, field);
} else {
fieldList.add(field);
}
}
}
fieldList.addAll(getParentFields(parentClazz.getSuperclass(), nameSet, parentFirst));
Field[] fields = parentClazz.getDeclaredFields();
Field[] parentFields = getParentFields(parentClazz.getSuperclass());
return concat(fields, parentFields);
}
return fieldList;
return new Field[0];
}
private static Field[] concat(Field[] f1, Field[] f2) {
Field[] fields = new Field[f1.length + f2.length];
System.arraycopy(f1, 0, fields, 0, f1.length);
System.arraycopy(f2, 0, fields, f1.length, f2.length);
return fields;
}
}

@ -1,6 +1,5 @@
package ${basePackage}.frame.utils;
/**
* Message -
*

@ -0,0 +1,42 @@
package ${basePackage}.frame.utils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import ${basePackage}.frame.excel.WSheet;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* Base64Util
*
* @author wangbing
* @version 0.0.1
* @since 2017-01-01
*/
public class ResponseUtil {
/**
* ResponseEntity
*
* @param bytes
* @param fileName
* @return
*/
public static ResponseEntity<byte[]> apply(byte[] bytes, String fileName) {
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(fileName, "utf-8"));
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
} catch (UnsupportedEncodingException e) {
return null;
}
}
public static ResponseEntity<byte[]> apply(WSheet sheet) {
return apply(sheet.getBytes(), sheet.getName() + ".xlsx");
}
}

@ -404,21 +404,18 @@
onSelectionChange: function (select) {
this.select = select;
},
excelTemplate: function () {
this.$ajax.template(this.module, this.target, {});
},
excelSelect: function () {
selectExcel: function () {
this.$refs['excel'].dispatchEvent(new MouseEvent('click'))
},
excelImport: function (item) {
onTemplate: function () {
this.$ajax.template(this.module, this.target, {});
},
onImport: function (item) {
const file = item.target.files[0];
this.$ajax.imports(this.module, this.target, file).then(function (response) {
if (response.errors.length > 0) {
this.e(response.errors[0].message);
} else {
this.i("文件上传成功!");
}
}.bind(this))
this.$ajax.imports(this.module, this.target, file);
},
onExport: function () {
this.$ajax.exports(this.module, this.target, this.vm);
},
onSave: function () {
this.$refs['form'].validate(function (valid) {

@ -18,9 +18,9 @@
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增
</el-button>
<el-button type="warning" size="small" icon="el-icon-download">导出</el-button>
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-width="90px">
@ -42,13 +42,13 @@
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="excelTemplate"></el-button>
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" @click="excelSelect">
<el-button size="small" @click="selectExcel">
<i class="el-icon-upload2">
<input type="file" style="display: none" @change="excelImport($event)" ref="excel">
<input type="file" style="display: none" @change="onImport($event)" ref="excel">
</i>
</el-button>
</el-tooltip>

@ -24,10 +24,9 @@
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增
</el-button>
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download">导出</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-width="90px">
@ -60,13 +59,13 @@
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="excelTemplate"></el-button>
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" @click="excelSelect">
<el-button size="small" @click="selectExcel">
<i class="el-icon-upload2">
<input type="file" style="display: none" @change="excelImport($event)" ref="excel">
<input type="file" style="display: none" @change="onImport($event)" ref="excel">
</i>
</el-button>
</el-tooltip>

@ -27,10 +27,9 @@
<el-card class="box-card">
<el-row>
<el-col :span="12">
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate(['create',''])">新增
</el-button>
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
<el-button type="warning" size="small" icon="el-icon-download">导出</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-width="90px">
@ -58,13 +57,13 @@
<el-col :span="12">
<el-button-group style="float: right;">
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
<el-button size="small" icon="el-icon-date" @click="excelTemplate"></el-button>
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
</el-tooltip>
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
<el-button size="small" @click="excelSelect">
<el-button size="small" @click="selectExcel">
<i class="el-icon-upload2">
<input type="file" style="display: none" @change="excelImport($event)" ref="excel">
<input type="file" style="display: none" @change="onImport($event)" ref="excel">
</i>
</el-button>
</el-tooltip>

Loading…
Cancel
Save

Powered by TurnKey Linux.