【更新】职位改进批量删除,新增导出功能及组件化按钮
This commit is contained in:
parent
e492942292
commit
8c1ea4101a
@ -69,3 +69,18 @@ export function sysPosDelete (parameter) {
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统职位
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2021/5/29 16:19
|
||||
*/
|
||||
export function sysPosExport (parameter) {
|
||||
return axios({
|
||||
url: '/sysPos/export',
|
||||
method: 'get',
|
||||
params: parameter,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import Dialog from '@/components/Dialog'
|
||||
|
||||
// xn components
|
||||
import XCard from '@/components/xnComponents/XCard'
|
||||
import XDown from '@/components/xnComponents/XDown'
|
||||
|
||||
export {
|
||||
AvatarList,
|
||||
@ -66,5 +67,6 @@ export {
|
||||
ArticleListContent,
|
||||
AntdEditor,
|
||||
Dialog,
|
||||
XCard
|
||||
XCard,
|
||||
XDown
|
||||
}
|
||||
|
54
_web/src/components/xnComponents/XDown.vue
Normal file
54
_web/src/components/xnComponents/XDown.vue
Normal file
@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<a-tooltip placement="top">
|
||||
<template slot="title">
|
||||
<span>导出所有数据</span>
|
||||
</template>
|
||||
<!-- 正常来说,这里加个插槽最好了,但是这个就是为导出准备的,一般这两个字不会变 -->
|
||||
<a-button type="dashed" @click="batchExport" :loading="batchExportLoading"><a-icon type="export"/>导出</a-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'XDown',
|
||||
data () {
|
||||
return {
|
||||
batchExportLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 本控件中点击按钮事件
|
||||
*/
|
||||
batchExport () {
|
||||
this.batchExportLoading = true
|
||||
// 将其传达到上个界面
|
||||
this.$emit('batchExport', '')
|
||||
},
|
||||
|
||||
/**
|
||||
* 通过返回的元素通过浏览器下载
|
||||
* 也就是接受使用这个组件的地方吧下载的内容传过来,
|
||||
* 但是这个组件本公子编写的时候只想的适用于导出excel来使用,下载文件呀图片方面的重新整个组件即可
|
||||
*/
|
||||
downloadfile (res) {
|
||||
this.batchExportLoading = false
|
||||
var blob = new Blob([res.data], { type: 'application/octet-stream;charset=UTF-8' })
|
||||
var contentDisposition = res.headers['content-disposition']
|
||||
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||
var result = patt.exec(contentDisposition)
|
||||
var filename = result[1]
|
||||
var downloadElement = document.createElement('a')
|
||||
var href = window.URL.createObjectURL(blob) // 创建下载的链接
|
||||
var reg = /^["](.*)["]$/g
|
||||
downloadElement.style.display = 'none'
|
||||
downloadElement.href = href
|
||||
downloadElement.download = decodeURI(filename.replace(reg, '$1')) // 下载后文件名
|
||||
document.body.appendChild(downloadElement)
|
||||
downloadElement.click() // 点击下载
|
||||
document.body.removeChild(downloadElement) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(href)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-modal
|
||||
title="新增职位"
|
||||
:width="900"
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleSubmit"
|
||||
@ -61,7 +61,7 @@
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 15 }
|
||||
sm: { span: 18 }
|
||||
},
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-modal
|
||||
title="职位编辑"
|
||||
:width="900"
|
||||
:width="500"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
@ok="handleSubmit"
|
||||
@ -73,7 +73,7 @@
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 15 }
|
||||
sm: { span: 18 }
|
||||
},
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
|
@ -131,4 +131,17 @@ public class SysPosController {
|
||||
public ResponseData detail(@Validated(SysPosParam.detail.class) SysPosParam sysPosParam) {
|
||||
return new SuccessResponseData(sysPosService.detail(sysPosParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统用户
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2020/6/30 16:07
|
||||
*/
|
||||
@Permission
|
||||
@GetMapping("/sysPos/export")
|
||||
@BusinessLog(title = "系统职位_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
|
||||
public void export(SysPosParam sysPosParam) {
|
||||
sysPosService.export(sysPosParam);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class SysPosParam extends BaseParam {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "id不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
|
||||
@NotNull(message = "id不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class, export.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||
/**
|
||||
* 系统职位service接口
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @author xuyuxiang yubaoshan
|
||||
* @date 2020/3/13 16:00
|
||||
*/
|
||||
public interface SysPosService extends IService<SysPos> {
|
||||
@ -95,4 +95,11 @@ public interface SysPosService extends IService<SysPos> {
|
||||
* @date 2020/3/26 9:50
|
||||
*/
|
||||
SysPos detail(SysPosParam sysPosParam);
|
||||
|
||||
/**
|
||||
* 导出系统职位
|
||||
* @author yubaoshan
|
||||
* @date 2021/5/29 16:12
|
||||
*/
|
||||
void export(SysPosParam sysPosParam);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import vip.xiaonuo.core.enums.CommonStatusEnum;
|
||||
import vip.xiaonuo.core.exception.ServiceException;
|
||||
import vip.xiaonuo.core.factory.PageFactory;
|
||||
import vip.xiaonuo.core.pojo.page.PageResult;
|
||||
import vip.xiaonuo.core.util.PoiUtil;
|
||||
import vip.xiaonuo.sys.modular.emp.service.SysEmpExtOrgPosService;
|
||||
import vip.xiaonuo.sys.modular.emp.service.SysEmpPosService;
|
||||
import vip.xiaonuo.sys.modular.pos.entity.SysPos;
|
||||
@ -48,7 +49,7 @@ import java.util.List;
|
||||
/**
|
||||
* 系统职位service接口实现类
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @author xuyuxiang yubaoshan
|
||||
* @date 2020/3/13 16:01
|
||||
*/
|
||||
@Service
|
||||
@ -190,4 +191,10 @@ public class SysPosServiceImpl extends ServiceImpl<SysPosMapper, SysPos> impleme
|
||||
}
|
||||
return sysPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(SysPosParam sysPosParam) {
|
||||
List<SysPos> list = this.list();
|
||||
PoiUtil.exportExcelWithStream("SnowyPos.xls", SysPos.class, list);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user