jeecg-boot 2.0 模块开发版本发布

This commit is contained in:
zhangdaihao
2019-05-19 18:54:09 +08:00
parent 383c521c6d
commit 405ee3f226
770 changed files with 85014 additions and 19508 deletions

View File

@ -0,0 +1,22 @@
/**
*
*/
import { disabledAuthFilter } from "@/utils/authFilter"
export const DisabledAuthFilterMixin = {
props: ['formData'],
data(){
return {
}
},
created() {
},
methods:{
disabledAuth(code){
return disabledAuthFilter(code,this.formData);
},
}
}

View File

@ -2,7 +2,7 @@ import JEditableTable from '@/components/jeecg/JEditableTable'
import { VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
import { httpAction, getAction } from '@/api/manage'
export const JEditableTableOneToManyMixin = {
export const JEditableTableMixin = {
components: {
JEditableTable
},
@ -48,6 +48,7 @@ export const JEditableTableOneToManyMixin = {
/** 当点击新增按钮时调用此方法 */
add() {
if (typeof this.addBefore === 'function') this.addBefore()
// 默认新增空数据
let rowNum = this.addDefaultRowNum
if (typeof rowNum !== 'number') {
@ -57,7 +58,7 @@ export const JEditableTableOneToManyMixin = {
this.eachAllTable((item) => {
item.add(rowNum)
})
if (typeof this.addAfter === 'function') this.addAfter(this.model)
this.edit({})
},
/** 当点击了编辑(修改)按钮时调用此方法 */

View File

@ -4,11 +4,16 @@
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
*/
import { filterObj } from '@/utils/util';
import { deleteAction, getAction } from '@/api/manage'
import { deleteAction, getAction,downFile } from '@/api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
export const JeecgListMixin = {
data(){
return {
/* 查询条件 */
//token header
tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */
queryParam: {},
/* 数据源 */
dataSource:[],
@ -42,7 +47,7 @@ export const JeecgListMixin = {
/* 高级查询条件生效状态 */
superQueryFlag:false,
/* 高级查询条件 */
superQueryParams:"",
superQueryParams:""
}
},
created() {
@ -61,11 +66,13 @@ export const JeecgListMixin = {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
this.ipagination.total = res.result.total;
}
this.loading = false;
})
},
initDictConfig(){
@ -198,23 +205,74 @@ export const JeecgListMixin = {
this.$refs.modalForm.disableSubmit = true;
},
/* 导出 */
handleExportXls(){
handleExportXls2(){
let paramsStr = encodeURI(JSON.stringify(this.getQueryParams()));
let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`;
window.location.href = url;
},
handleExportXls(fileName){
if(!fileName || typeof fileName != "string"){
fileName = "导出文件"
}
let param = {...this.queryParam};
if(this.selectedRowKeys && this.selectedRowKeys.length>0){
param['selections'] = this.selectedRowKeys.join(",")
}
console.log("导出参数",param)
downFile(this.url.exportXlsUrl,param).then((data)=>{
if (!data) {
this.$message.warning("文件下载失败")
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data]), fileName+'.xls')
}else{
let url = window.URL.createObjectURL(new Blob([data]))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName+'.xls')
document.body.appendChild(link)
link.click()
document.body.removeChild(link); //下载完成移除元素
window.URL.revokeObjectURL(url); //释放掉blob对象
}
})
},
/* 导入 */
handleImportExcel(info){
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
this.$message.success(`${info.file.name} 文件上传成功`);
this.loadData();
if(info.file.response.success){
this.$message.success(`${info.file.name} 文件上传成功`);
this.loadData();
} else {
this.$message.error(`${info.file.name} ${info.file.response.message}.`);
}
} else if (info.file.status === 'error') {
this.$message.error(`${info.file.name} 文件上传失败.`);
this.$message.error(`文件上传失败: ${info.file.msg} `);
}
},
/* 图片预览 */
getImgView(text){
if(text && text.indexOf(",")>0){
text = text.substring(0,text.indexOf(","))
}
return window._CONFIG['imgDomainURL']+"/"+text
},
/* 文件下载 */
uploadFile(text){
if(!text){
this.$message.warning("未知的文件")
return;
}
if(text.indexOf(",")>0){
text = text.substring(0,text.indexOf(","))
}
window.open(window._CONFIG['domianURL'] + "/sys/common/download/"+text);
},
}
}