【更新】职位改进批量删除,新增导出功能及组件化按钮

This commit is contained in:
小诺 2021-06-01 00:11:05 +08:00 committed by 15099670051
parent e492942292
commit 8c1ea4101a
9 changed files with 106 additions and 8 deletions

View File

@ -69,3 +69,18 @@ export function sysPosDelete (parameter) {
data: 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'
})
}

View File

@ -33,6 +33,7 @@ import Dialog from '@/components/Dialog'
// xn components // xn components
import XCard from '@/components/xnComponents/XCard' import XCard from '@/components/xnComponents/XCard'
import XDown from '@/components/xnComponents/XDown'
export { export {
AvatarList, AvatarList,
@ -66,5 +67,6 @@ export {
ArticleListContent, ArticleListContent,
AntdEditor, AntdEditor,
Dialog, Dialog,
XCard XCard,
XDown
} }

View 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>

View File

@ -1,7 +1,7 @@
<template> <template>
<a-modal <a-modal
title="新增职位" title="新增职位"
:width="900" :width="500"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
@ok="handleSubmit" @ok="handleSubmit"
@ -61,7 +61,7 @@
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 15 } sm: { span: 18 }
}, },
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,

View File

@ -1,7 +1,7 @@
<template> <template>
<a-modal <a-modal
title="职位编辑" title="职位编辑"
:width="900" :width="500"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
@ok="handleSubmit" @ok="handleSubmit"
@ -73,7 +73,7 @@
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 15 } sm: { span: 18 }
}, },
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,

View File

@ -131,4 +131,17 @@ public class SysPosController {
public ResponseData detail(@Validated(SysPosParam.detail.class) SysPosParam sysPosParam) { public ResponseData detail(@Validated(SysPosParam.detail.class) SysPosParam sysPosParam) {
return new SuccessResponseData(sysPosService.detail(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);
}
} }

View File

@ -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; private Long id;
/** /**

View File

@ -34,7 +34,7 @@ import java.util.List;
/** /**
* 系统职位service接口 * 系统职位service接口
* *
* @author xuyuxiang * @author xuyuxiang yubaoshan
* @date 2020/3/13 16:00 * @date 2020/3/13 16:00
*/ */
public interface SysPosService extends IService<SysPos> { public interface SysPosService extends IService<SysPos> {
@ -95,4 +95,11 @@ public interface SysPosService extends IService<SysPos> {
* @date 2020/3/26 9:50 * @date 2020/3/26 9:50
*/ */
SysPos detail(SysPosParam sysPosParam); SysPos detail(SysPosParam sysPosParam);
/**
* 导出系统职位
* @author yubaoshan
* @date 2021/5/29 16:12
*/
void export(SysPosParam sysPosParam);
} }

View File

@ -32,6 +32,7 @@ import vip.xiaonuo.core.enums.CommonStatusEnum;
import vip.xiaonuo.core.exception.ServiceException; import vip.xiaonuo.core.exception.ServiceException;
import vip.xiaonuo.core.factory.PageFactory; import vip.xiaonuo.core.factory.PageFactory;
import vip.xiaonuo.core.pojo.page.PageResult; 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.SysEmpExtOrgPosService;
import vip.xiaonuo.sys.modular.emp.service.SysEmpPosService; import vip.xiaonuo.sys.modular.emp.service.SysEmpPosService;
import vip.xiaonuo.sys.modular.pos.entity.SysPos; import vip.xiaonuo.sys.modular.pos.entity.SysPos;
@ -48,7 +49,7 @@ import java.util.List;
/** /**
* 系统职位service接口实现类 * 系统职位service接口实现类
* *
* @author xuyuxiang * @author xuyuxiang yubaoshan
* @date 2020/3/13 16:01 * @date 2020/3/13 16:01
*/ */
@Service @Service
@ -190,4 +191,10 @@ public class SysPosServiceImpl extends ServiceImpl<SysPosMapper, SysPos> impleme
} }
return sysPos; return sysPos;
} }
@Override
public void export(SysPosParam sysPosParam) {
List<SysPos> list = this.list();
PoiUtil.exportExcelWithStream("SnowyPos.xls", SysPos.class, list);
}
} }