【新增】机构管理增加导出与批量删除
This commit is contained in:
parent
07048c5fe4
commit
b7783fe2cb
@ -83,3 +83,18 @@ export function sysOrgDelete (parameter) {
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统机构
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2021/5/30 12:58
|
||||
*/
|
||||
export function sysOrgExport (parameter) {
|
||||
return axios({
|
||||
url: '/sysOrg/export',
|
||||
method: 'get',
|
||||
params: parameter,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
@ -31,8 +31,6 @@
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
|
||||
</a-col>
|
||||
<a-col :md="8" :sm="24">
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
@ -46,13 +44,19 @@
|
||||
:rowKey="(record) => record.id"
|
||||
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||
>
|
||||
<template slot="operator" v-if="hasPerm('sysOrg:add')">
|
||||
<template slot="operator">
|
||||
<a-button @click="$refs.addForm.add()" icon="plus" type="primary" v-if="hasPerm('sysOrg:add')">新增机构</a-button>
|
||||
<a-button type="danger" :disabled="selectedRowKeys.length < 1" v-if="hasPerm('sysPos:delete')" @click="batchDelete"><a-icon type="delete"/>批量删除</a-button>
|
||||
<x-down
|
||||
v-if="hasPerm('sysOrg:export')"
|
||||
ref="batchExport"
|
||||
@batchExport="batchExport"
|
||||
/>
|
||||
</template>
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a v-if="hasPerm('sysOrg:edit')" @click="$refs.editForm.edit(record)">编辑</a>
|
||||
<a-divider type="vertical" v-if="hasPerm('sysOrg:edit') & hasPerm('sysOrg:delete')"/>
|
||||
<a-popconfirm v-if="hasPerm('sysOrg:delete')" placement="topRight" title="确认删除?" @confirm="() => sysOrgDelete(record)">
|
||||
<a-popconfirm v-if="hasPerm('sysOrg:delete')" placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
@ -64,13 +68,14 @@
|
||||
</a-row>
|
||||
</template>
|
||||
<script>
|
||||
import { STable, XCard } from '@/components'
|
||||
import { STable, XCard, XDown } from '@/components'
|
||||
import { Empty } from 'ant-design-vue'
|
||||
import { getOrgPage, sysOrgDelete, getOrgTree } from '@/api/modular/system/orgManage'
|
||||
import { getOrgPage, sysOrgDelete, getOrgTree, sysOrgExport } from '@/api/modular/system/orgManage'
|
||||
import addForm from './addForm'
|
||||
import editForm from './editForm'
|
||||
export default {
|
||||
components: {
|
||||
XDown,
|
||||
XCard,
|
||||
STable,
|
||||
addForm,
|
||||
@ -78,8 +83,6 @@
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
// 高级搜索 展开/关闭
|
||||
advanced: false,
|
||||
// 查询参数
|
||||
queryParam: {},
|
||||
// 表头
|
||||
@ -155,16 +158,39 @@
|
||||
this.$refs.table.refresh()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 单个删除
|
||||
*/
|
||||
singleDelete (record) {
|
||||
const param = [{ 'id': record.id }]
|
||||
this.sysOrgDelete(param)
|
||||
},
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
batchDelete () {
|
||||
const paramIds = this.selectedRowKeys.map((d) => {
|
||||
return { 'id': d }
|
||||
})
|
||||
this.sysOrgDelete(paramIds)
|
||||
},
|
||||
/**
|
||||
* 批量导出
|
||||
*/
|
||||
batchExport () {
|
||||
sysOrgExport().then((res) => {
|
||||
this.$refs.batchExport.downloadfile(res)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 删除
|
||||
* @param record
|
||||
*/
|
||||
sysOrgDelete (record) {
|
||||
sysOrgDelete(record).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success('删除成功')
|
||||
this.getOrgTree()
|
||||
this.$refs.table.refresh()
|
||||
this.$refs.table.clearRefreshSelected()
|
||||
} else {
|
||||
this.$message.error('删除失败:' + res.message)
|
||||
}
|
||||
@ -178,9 +204,6 @@
|
||||
}
|
||||
this.$refs.table.refresh(true)
|
||||
},
|
||||
toggleAdvanced () {
|
||||
this.advanced = !this.advanced
|
||||
},
|
||||
handleOk () {
|
||||
this.getOrgTree()
|
||||
this.$refs.table.refresh()
|
||||
|
@ -24,6 +24,7 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
||||
*/
|
||||
package vip.xiaonuo.core.pojo.base.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
@ -46,6 +47,7 @@ public class BaseEntity implements Serializable {
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Excel(name = "创建时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
@ -58,6 +60,7 @@ public class BaseEntity implements Serializable {
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@Excel(name = "更新时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vip.xiaonuo.sys.modular.user.param.SysUserParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -152,4 +153,17 @@ public class SysOrgController {
|
||||
public ResponseData tree(SysOrgParam sysOrgParam) {
|
||||
return new SuccessResponseData(sysOrgService.tree(sysOrgParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统组织机构
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2021/5/30 12:48
|
||||
*/
|
||||
@Permission
|
||||
@GetMapping("/sysOrg/export")
|
||||
@BusinessLog(title = "系统组织机构_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
|
||||
public void export(SysOrgParam sysOrgParam) {
|
||||
sysOrgService.export(sysOrgParam);
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
||||
*/
|
||||
package vip.xiaonuo.sys.modular.org.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import vip.xiaonuo.core.pojo.base.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
@ -59,26 +60,31 @@ public class SysOrg extends BaseEntity {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Excel(name = "名称", width = 20)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Excel(name = "编码", width = 20)
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Excel(name = "排序", width = 20)
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 20)
|
||||
@TableField(insertStrategy = FieldStrategy.IGNORED)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态(字典 0正常 1停用 2删除)
|
||||
*/
|
||||
@Excel(name = "状态", replace = {"正常_0", "停用_1", "删除_2"}, width = 20)
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -117,4 +117,12 @@ public interface SysOrgService extends IService<SysOrg> {
|
||||
* @date 2020/4/5 18:29
|
||||
*/
|
||||
List<Long> getDataScopeListByDataScopeType(Integer dataScopeType, Long orgId);
|
||||
|
||||
/**
|
||||
* 导出机构数据
|
||||
*
|
||||
* @author yubaoshan
|
||||
* @date 2021/5/30 12:48
|
||||
*/
|
||||
void export(SysOrgParam sysOrgParam);
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import vip.xiaonuo.core.factory.PageFactory;
|
||||
import vip.xiaonuo.core.factory.TreeBuildFactory;
|
||||
import vip.xiaonuo.core.pojo.node.AntdBaseTreeNode;
|
||||
import vip.xiaonuo.core.pojo.page.PageResult;
|
||||
import vip.xiaonuo.core.util.PoiUtil;
|
||||
import vip.xiaonuo.sys.core.enums.DataScopeTypeEnum;
|
||||
import vip.xiaonuo.sys.modular.emp.service.SysEmpExtOrgPosService;
|
||||
import vip.xiaonuo.sys.modular.emp.service.SysEmpService;
|
||||
|
Loading…
x
Reference in New Issue
Block a user