|
|
@ -3,27 +3,27 @@ |
|
|
|
* 高级查询按钮调用 superQuery方法 高级查询组件ref定义为superQueryModal |
|
|
|
* 高级查询按钮调用 superQuery方法 高级查询组件ref定义为superQueryModal |
|
|
|
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除 |
|
|
|
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
import { filterObj } from '@/utils/util'; |
|
|
|
import {filterObj} from '@/utils/util'; |
|
|
|
import { deleteAction, getAction,downFile,getFileAccessHttpUrl } from '@/api/manage' |
|
|
|
import {deleteAction, getAction, downFile, getFileAccessHttpUrl} from '@/api/manage' |
|
|
|
import Vue from 'vue' |
|
|
|
import Vue from 'vue' |
|
|
|
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types" |
|
|
|
import {ACCESS_TOKEN, TENANT_ID} from "@/store/mutation-types" |
|
|
|
import store from '@/store' |
|
|
|
import store from '@/store' |
|
|
|
import {Modal} from 'ant-design-vue' |
|
|
|
import {Modal} from 'ant-design-vue' |
|
|
|
|
|
|
|
|
|
|
|
export const JeecgListMixin = { |
|
|
|
export const JeecgListMixin = { |
|
|
|
data(){ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
pagedOld:{ |
|
|
|
pagedOld: { |
|
|
|
record:{}, |
|
|
|
record: {}, |
|
|
|
title:"", |
|
|
|
title: "", |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */ |
|
|
|
/* 查询条件-请不要在queryParam中声明非字符串值的属性 */ |
|
|
|
queryParam: {}, |
|
|
|
queryParam: {}, |
|
|
|
/* 数据源 */ |
|
|
|
/* 数据源 */ |
|
|
|
dataSource:[], |
|
|
|
dataSource: [], |
|
|
|
/* 分页参数 */ |
|
|
|
/* 分页参数 */ |
|
|
|
ipagination:{ |
|
|
|
ipagination: { |
|
|
|
current: 1, |
|
|
|
current: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
|
pageSizeOptions: ['10', '20', '30'], |
|
|
|
pageSizeOptions: ['10', '20', '30'], |
|
|
@ -35,22 +35,22 @@ export const JeecgListMixin = { |
|
|
|
total: 0 |
|
|
|
total: 0 |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 排序参数 */ |
|
|
|
/* 排序参数 */ |
|
|
|
isorter:{ |
|
|
|
isorter: { |
|
|
|
column: 'createTime', |
|
|
|
column: 'createTime', |
|
|
|
order: 'desc', |
|
|
|
order: 'desc', |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 筛选参数 */ |
|
|
|
/* 筛选参数 */ |
|
|
|
filters: {}, |
|
|
|
filters: {}, |
|
|
|
/* table加载状态 */ |
|
|
|
/* table加载状态 */ |
|
|
|
loading:false, |
|
|
|
loading: false, |
|
|
|
/* table选中keys*/ |
|
|
|
/* table选中keys*/ |
|
|
|
selectedRowKeys: [], |
|
|
|
selectedRowKeys: [], |
|
|
|
/* table选中records*/ |
|
|
|
/* table选中records*/ |
|
|
|
selectionRows: [], |
|
|
|
selectionRows: [], |
|
|
|
/* 查询折叠 */ |
|
|
|
/* 查询折叠 */ |
|
|
|
toggleSearchStatus:false, |
|
|
|
toggleSearchStatus: false, |
|
|
|
/* 高级查询条件生效状态 */ |
|
|
|
/* 高级查询条件生效状态 */ |
|
|
|
superQueryFlag:false, |
|
|
|
superQueryFlag: false, |
|
|
|
/* 高级查询条件 */ |
|
|
|
/* 高级查询条件 */ |
|
|
|
superQueryParams: '', |
|
|
|
superQueryParams: '', |
|
|
|
/** 高级查询拼接方式 */ |
|
|
|
/** 高级查询拼接方式 */ |
|
|
@ -58,30 +58,30 @@ export const JeecgListMixin = { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
if(!this.disableMixinCreated){ |
|
|
|
if (!this.disableMixinCreated) { |
|
|
|
console.log(' -- mixin created -- ') |
|
|
|
console.log(' -- mixin created -- ') |
|
|
|
this.loadData(); |
|
|
|
this.loadData(); |
|
|
|
//初始化字典配置 在自己页面定义
|
|
|
|
//初始化字典配置 在自己页面定义
|
|
|
|
this.initDictConfig(); |
|
|
|
this.initDictConfig(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.$bus.$on('getInfo', (oldFunction) => { |
|
|
|
this.$bus.$on('getInfo', (oldFunction) => { |
|
|
|
oldFunction(this.pagedOld) |
|
|
|
oldFunction(this.pagedOld) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
|
//token header
|
|
|
|
//token header
|
|
|
|
tokenHeader(){ |
|
|
|
tokenHeader() { |
|
|
|
let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)} |
|
|
|
let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)} |
|
|
|
let tenantid = Vue.ls.get(TENANT_ID) |
|
|
|
let tenantid = Vue.ls.get(TENANT_ID) |
|
|
|
if(tenantid){ |
|
|
|
if (tenantid) { |
|
|
|
head['tenant-id'] = tenantid |
|
|
|
head['tenant-id'] = tenantid |
|
|
|
} |
|
|
|
} |
|
|
|
return head; |
|
|
|
return head; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
methods: { |
|
|
|
loadData(arg) { |
|
|
|
loadData(arg) { |
|
|
|
if(!this.url.list){ |
|
|
|
if (!this.url.list) { |
|
|
|
this.$message.error("请设置url.list属性!") |
|
|
|
this.$message.error("请设置url.list属性!") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -94,32 +94,31 @@ export const JeecgListMixin = { |
|
|
|
getAction(this.url.list, params).then((res) => { |
|
|
|
getAction(this.url.list, params).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
if (res.success) { |
|
|
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
|
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
|
this.dataSource = res.result.records||res.result; |
|
|
|
this.dataSource = res.result.records || res.result; |
|
|
|
if(res.result.total) |
|
|
|
if (res.result.total) { |
|
|
|
{ |
|
|
|
|
|
|
|
this.ipagination.total = res.result.total; |
|
|
|
this.ipagination.total = res.result.total; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
this.ipagination.total = 0; |
|
|
|
this.ipagination.total = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
|
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
|
|
|
|
} |
|
|
|
} |
|
|
|
if(res.code===510){ |
|
|
|
if (res.code === 510) { |
|
|
|
this.$message.warning(res.message) |
|
|
|
this.$message.warning(res.message) |
|
|
|
} |
|
|
|
} |
|
|
|
this.loading = false; |
|
|
|
this.loading = false; |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
initDictConfig(){ |
|
|
|
initDictConfig() { |
|
|
|
console.log("--这是一个假的方法!") |
|
|
|
console.log("--这是一个假的方法!") |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleSuperQuery(params, matchType) { |
|
|
|
handleSuperQuery(params, matchType) { |
|
|
|
//高级查询方法
|
|
|
|
//高级查询方法
|
|
|
|
if(!params){ |
|
|
|
if (!params) { |
|
|
|
this.superQueryParams='' |
|
|
|
this.superQueryParams = '' |
|
|
|
this.superQueryFlag = false |
|
|
|
this.superQueryFlag = false |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
this.superQueryFlag = true |
|
|
|
this.superQueryFlag = true |
|
|
|
this.superQueryParams=JSON.stringify(params) |
|
|
|
this.superQueryParams = JSON.stringify(params) |
|
|
|
this.superQueryMatchType = matchType |
|
|
|
this.superQueryMatchType = matchType |
|
|
|
} |
|
|
|
} |
|
|
|
this.loadData(1) |
|
|
|
this.loadData(1) |
|
|
@ -127,11 +126,11 @@ export const JeecgListMixin = { |
|
|
|
getQueryParams() { |
|
|
|
getQueryParams() { |
|
|
|
//获取查询条件
|
|
|
|
//获取查询条件
|
|
|
|
let sqp = {} |
|
|
|
let sqp = {} |
|
|
|
if(this.superQueryParams){ |
|
|
|
if (this.superQueryParams) { |
|
|
|
sqp['superQueryParams']=encodeURI(this.superQueryParams) |
|
|
|
sqp['superQueryParams'] = encodeURI(this.superQueryParams) |
|
|
|
sqp['superQueryMatchType'] = this.superQueryMatchType |
|
|
|
sqp['superQueryMatchType'] = this.superQueryMatchType |
|
|
|
} |
|
|
|
} |
|
|
|
var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); |
|
|
|
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters); |
|
|
|
param.field = this.getQueryField(); |
|
|
|
param.field = this.getQueryField(); |
|
|
|
param.pageNo = this.ipagination.current; |
|
|
|
param.pageNo = this.ipagination.current; |
|
|
|
param.pageSize = this.ipagination.pageSize; |
|
|
|
param.pageSize = this.ipagination.pageSize; |
|
|
@ -165,7 +164,7 @@ export const JeecgListMixin = { |
|
|
|
this.loadData(1); |
|
|
|
this.loadData(1); |
|
|
|
}, |
|
|
|
}, |
|
|
|
batchDel: function () { |
|
|
|
batchDel: function () { |
|
|
|
if(!this.url.deleteBatch){ |
|
|
|
if (!this.url.deleteBatch) { |
|
|
|
this.$message.error("请设置url.deleteBatch属性!") |
|
|
|
this.$message.error("请设置url.deleteBatch属性!") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -225,7 +224,7 @@ export const JeecgListMixin = { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDelete: function (id) { |
|
|
|
handleDelete: function (id) { |
|
|
|
if(!this.url.delete){ |
|
|
|
if (!this.url.delete) { |
|
|
|
this.$message.error("请设置url.delete属性!") |
|
|
|
this.$message.error("请设置url.delete属性!") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -242,7 +241,7 @@ export const JeecgListMixin = { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
startorstop: function (id) { |
|
|
|
startorstop: function (id) { |
|
|
|
if(!this.url.update){ |
|
|
|
if (!this.url.update) { |
|
|
|
this.$message.error("请设置url.update属性!") |
|
|
|
this.$message.error("请设置url.update属性!") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -258,40 +257,45 @@ export const JeecgListMixin = { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
reCalculatePage(count){ |
|
|
|
reCalculatePage(count) { |
|
|
|
//总数量-count
|
|
|
|
//总数量-count
|
|
|
|
let total=this.ipagination.total-count; |
|
|
|
let total = this.ipagination.total - count; |
|
|
|
//获取删除后的分页数
|
|
|
|
//获取删除后的分页数
|
|
|
|
let currentIndex=Math.ceil(total/this.ipagination.pageSize); |
|
|
|
let currentIndex = Math.ceil(total / this.ipagination.pageSize); |
|
|
|
//删除后的分页数<所在当前页
|
|
|
|
//删除后的分页数<所在当前页
|
|
|
|
if(currentIndex<this.ipagination.current){ |
|
|
|
if (currentIndex < this.ipagination.current) { |
|
|
|
this.ipagination.current=currentIndex; |
|
|
|
this.ipagination.current = currentIndex; |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('currentIndex',currentIndex) |
|
|
|
console.log('currentIndex', currentIndex) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleEdit: function (record) { |
|
|
|
handleEdit: function (record) { |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.title = "编辑"; |
|
|
|
this.$refs.modalForm.title = "编辑"; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
fuzhi: function(record){ |
|
|
|
fuzhi: function (record) { |
|
|
|
record.id='' |
|
|
|
record.id = '' |
|
|
|
record.functionName1=record.functionName+1 |
|
|
|
record.functionName1 = record.functionName + 1 |
|
|
|
record.functionEnName1=record.functionEnName+1 |
|
|
|
record.functionEnName1 = record.functionEnName + 1 |
|
|
|
record.functionCode1=record.functionCode+1 |
|
|
|
record.functionCode1 = record.functionCode + 1 |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.title = "复制"; |
|
|
|
this.$refs.modalForm.title = "复制"; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
fuzhi1: function(record){ |
|
|
|
fuzhi1: function (record) { |
|
|
|
record.id='' |
|
|
|
record.id = '' |
|
|
|
record.rule_no='' |
|
|
|
record.rule_no = '' |
|
|
|
record.rule_code='' |
|
|
|
record.rule_code = '' |
|
|
|
|
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
|
|
|
|
this.$refs.modalForm.title = "复制"; |
|
|
|
|
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
fuzhiProject: function (record) { |
|
|
|
|
|
|
|
record.fuzhi = true; |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.title = "复制"; |
|
|
|
this.$refs.modalForm.title = "复制"; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
this.$refs.modalForm.disableSubmit = false; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
handleAdd: function () { |
|
|
|
handleAdd: function () { |
|
|
|
this.$refs.modalForm.add(); |
|
|
|
this.$refs.modalForm.add(); |
|
|
|
this.$refs.modalForm.title = "新增"; |
|
|
|
this.$refs.modalForm.title = "新增"; |
|
|
@ -308,11 +312,11 @@ export const JeecgListMixin = { |
|
|
|
this.ipagination = pagination; |
|
|
|
this.ipagination = pagination; |
|
|
|
this.loadData(); |
|
|
|
this.loadData(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleToggleSearch(){ |
|
|
|
handleToggleSearch() { |
|
|
|
this.toggleSearchStatus = !this.toggleSearchStatus; |
|
|
|
this.toggleSearchStatus = !this.toggleSearchStatus; |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 给popup查询使用(查询区域不支持回填多个字段,限制只返回一个字段)
|
|
|
|
// 给popup查询使用(查询区域不支持回填多个字段,限制只返回一个字段)
|
|
|
|
getPopupField(fields){ |
|
|
|
getPopupField(fields) { |
|
|
|
return fields.split(',')[0] |
|
|
|
return fields.split(',')[0] |
|
|
|
}, |
|
|
|
}, |
|
|
|
modalFormOk() { |
|
|
|
modalFormOk() { |
|
|
@ -321,39 +325,39 @@ export const JeecgListMixin = { |
|
|
|
//清空列表选中
|
|
|
|
//清空列表选中
|
|
|
|
this.onClearSelected() |
|
|
|
this.onClearSelected() |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDetail:function(record){ |
|
|
|
handleDetail: function (record) { |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.edit(record); |
|
|
|
this.$refs.modalForm.title="详情"; |
|
|
|
this.$refs.modalForm.title = "详情"; |
|
|
|
this.$refs.modalForm.disableSubmit = true; |
|
|
|
this.$refs.modalForm.disableSubmit = true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 导出 */ |
|
|
|
/* 导出 */ |
|
|
|
handleExportXls2(){ |
|
|
|
handleExportXls2() { |
|
|
|
let paramsStr = encodeURI(JSON.stringify(this.getQueryParams())); |
|
|
|
let paramsStr = encodeURI(JSON.stringify(this.getQueryParams())); |
|
|
|
let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`; |
|
|
|
let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`; |
|
|
|
window.location.href = url; |
|
|
|
window.location.href = url; |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleExportXls(fileName){ |
|
|
|
handleExportXls(fileName) { |
|
|
|
if(!fileName || typeof fileName != "string"){ |
|
|
|
if (!fileName || typeof fileName != "string") { |
|
|
|
fileName = "导出文件" |
|
|
|
fileName = "导出文件" |
|
|
|
} |
|
|
|
} |
|
|
|
let param = this.getQueryParams(); |
|
|
|
let param = this.getQueryParams(); |
|
|
|
if(this.selectedRowKeys && this.selectedRowKeys.length>0){ |
|
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { |
|
|
|
param['selections'] = this.selectedRowKeys.join(",") |
|
|
|
param['selections'] = this.selectedRowKeys.join(",") |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("导出参数",param) |
|
|
|
console.log("导出参数", param) |
|
|
|
downFile(this.url.exportXlsUrl,param).then((data)=>{ |
|
|
|
downFile(this.url.exportXlsUrl, param).then((data) => { |
|
|
|
if (!data) { |
|
|
|
if (!data) { |
|
|
|
this.$message.warning("文件下载失败") |
|
|
|
this.$message.warning("文件下载失败") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') { |
|
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') { |
|
|
|
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') |
|
|
|
window.navigator.msSaveBlob(new Blob([data], {type: 'application/vnd.ms-excel'}), fileName + '.xls') |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) |
|
|
|
let url = window.URL.createObjectURL(new Blob([data], {type: 'application/vnd.ms-excel'})) |
|
|
|
let link = document.createElement('a') |
|
|
|
let link = document.createElement('a') |
|
|
|
link.style.display = 'none' |
|
|
|
link.style.display = 'none' |
|
|
|
link.href = url |
|
|
|
link.href = url |
|
|
|
link.setAttribute('download', fileName+'.xls') |
|
|
|
link.setAttribute('download', fileName + '.xls') |
|
|
|
document.body.appendChild(link) |
|
|
|
document.body.appendChild(link) |
|
|
|
link.click() |
|
|
|
link.click() |
|
|
|
document.body.removeChild(link); //下载完成移除元素
|
|
|
|
document.body.removeChild(link); //下载完成移除元素
|
|
|
@ -361,28 +365,28 @@ export const JeecgListMixin = { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
daochu(fileName){ |
|
|
|
daochu(fileName) { |
|
|
|
if(!fileName || typeof fileName != "string"){ |
|
|
|
if (!fileName || typeof fileName != "string") { |
|
|
|
fileName = "导出文件" |
|
|
|
fileName = "导出文件" |
|
|
|
} |
|
|
|
} |
|
|
|
let param = this.getQueryParams(); |
|
|
|
let param = this.getQueryParams(); |
|
|
|
if(this.selectedRowKeys && this.selectedRowKeys.length>0){ |
|
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { |
|
|
|
param['selections'] = this.selectedRowKeys.join(",") |
|
|
|
param['selections'] = this.selectedRowKeys.join(",") |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("导出参数",param) |
|
|
|
console.log("导出参数", param) |
|
|
|
downFile(this.url.standards,param).then((data)=>{ |
|
|
|
downFile(this.url.standards, param).then((data) => { |
|
|
|
if (!data) { |
|
|
|
if (!data) { |
|
|
|
this.$message.warning("文件下载失败") |
|
|
|
this.$message.warning("文件下载失败") |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') { |
|
|
|
if (typeof window.navigator.msSaveBlob !== 'undefined') { |
|
|
|
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') |
|
|
|
window.navigator.msSaveBlob(new Blob([data], {type: 'application/vnd.ms-excel'}), fileName + '.xls') |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) |
|
|
|
let url = window.URL.createObjectURL(new Blob([data], {type: 'application/vnd.ms-excel'})) |
|
|
|
let link = document.createElement('a') |
|
|
|
let link = document.createElement('a') |
|
|
|
link.style.display = 'none' |
|
|
|
link.style.display = 'none' |
|
|
|
link.href = url |
|
|
|
link.href = url |
|
|
|
link.setAttribute('download', fileName+'.xls') |
|
|
|
link.setAttribute('download', fileName + '.xls') |
|
|
|
document.body.appendChild(link) |
|
|
|
document.body.appendChild(link) |
|
|
|
link.click() |
|
|
|
link.click() |
|
|
|
document.body.removeChild(link); //下载完成移除元素
|
|
|
|
document.body.removeChild(link); //下载完成移除元素
|
|
|
@ -391,7 +395,7 @@ export const JeecgListMixin = { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 导入 */ |
|
|
|
/* 导入 */ |
|
|
|
handleImportExcel(info){ |
|
|
|
handleImportExcel(info) { |
|
|
|
if (info.file.status !== 'uploading') { |
|
|
|
if (info.file.status !== 'uploading') { |
|
|
|
console.log(info.file, info.fileList); |
|
|
|
console.log(info.file, info.fileList); |
|
|
|
} |
|
|
|
} |
|
|
@ -399,7 +403,7 @@ export const JeecgListMixin = { |
|
|
|
if (info.file.response.success) { |
|
|
|
if (info.file.response.success) { |
|
|
|
// this.$message.success(`${info.file.name} 文件上传成功`);
|
|
|
|
// this.$message.success(`${info.file.name} 文件上传成功`);
|
|
|
|
if (info.file.response.code === 201) { |
|
|
|
if (info.file.response.code === 201) { |
|
|
|
let { message, result: { msg, fileUrl, fileName } } = info.file.response |
|
|
|
let {message, result: {msg, fileUrl, fileName}} = info.file.response |
|
|
|
let href = window._CONFIG['domianURL'] + fileUrl |
|
|
|
let href = window._CONFIG['domianURL'] + fileUrl |
|
|
|
this.$warning({ |
|
|
|
this.$warning({ |
|
|
|
title: message, |
|
|
|
title: message, |
|
|
@ -440,21 +444,21 @@ export const JeecgListMixin = { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 图片预览 */ |
|
|
|
/* 图片预览 */ |
|
|
|
getImgView(text){ |
|
|
|
getImgView(text) { |
|
|
|
if(text && text.indexOf(",")>0){ |
|
|
|
if (text && text.indexOf(",") > 0) { |
|
|
|
text = text.substring(0,text.indexOf(",")) |
|
|
|
text = text.substring(0, text.indexOf(",")) |
|
|
|
} |
|
|
|
} |
|
|
|
return getFileAccessHttpUrl(text) |
|
|
|
return getFileAccessHttpUrl(text) |
|
|
|
}, |
|
|
|
}, |
|
|
|
/* 文件下载 */ |
|
|
|
/* 文件下载 */ |
|
|
|
// update--autor:lvdandan-----date:20200630------for:修改下载文件方法名uploadFile改为downloadFile------
|
|
|
|
// update--autor:lvdandan-----date:20200630------for:修改下载文件方法名uploadFile改为downloadFile------
|
|
|
|
downloadFile(text){ |
|
|
|
downloadFile(text) { |
|
|
|
if(!text){ |
|
|
|
if (!text) { |
|
|
|
this.$message.warning("未知的文件") |
|
|
|
this.$message.warning("未知的文件") |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(text.indexOf(",")>0){ |
|
|
|
if (text.indexOf(",") > 0) { |
|
|
|
text = text.substring(0,text.indexOf(",")) |
|
|
|
text = text.substring(0, text.indexOf(",")) |
|
|
|
} |
|
|
|
} |
|
|
|
let url = getFileAccessHttpUrl(text) |
|
|
|
let url = getFileAccessHttpUrl(text) |
|
|
|
window.open(url); |
|
|
|
window.open(url); |
|
|
|