人员证书新增、档案、修改、导出、删除

This commit is contained in:
qinjie 2021-12-17 16:54:30 +08:00
parent 0d242f5f8a
commit 3b2cf41a99
5 changed files with 530 additions and 316 deletions

View File

@ -6,7 +6,13 @@ const api = {
get: '/sys/dictionary/item/get', get: '/sys/dictionary/item/get',
add: '/sys/dictionary/item/add', add: '/sys/dictionary/item/add',
del: '/sys/dictionary/item/del', del: '/sys/dictionary/item/del',
edit: '/sys/dictionary/item/edit' edit: '/sys/dictionary/item/edit',
certificateList: '/archives/certificate/listPage',
addCertificate: '/person/certificate/add',
certificateDetail: '/person/certificate/detail',
delCertificate: '/person/certificate/del',
certificateExport: 'person/certificate/export'
} }
// 证书类型 列表 // 证书类型 列表
@ -62,3 +68,48 @@ export function editCertificateType(params) {
data: params data: params
}) })
} }
// 证书列表
export function getArchivesCertificatelist(params) {
return request({
url: api.certificateList,
method: 'get',
params: params
})
}
// 新增人员证书
export function addPersonCertificate(params) {
return request({
url: api.addCertificate,
method: 'post',
data: params
})
}
// 获取证书详情
export function findPersonCertificateDetail(params) {
return request({
url: api.certificateDetail,
method: 'get',
params: params
})
}
// 删除人员证书
export function delCertificate(params) {
return request({
url: api.delCertificate,
method: 'post',
params: params
})
}
// 导出证书详情
export function exportCertificate(params) {
return request({
url: api.certificateExport,
method: 'get',
params: params
})
}

8
src/api/common/common.js Normal file
View File

@ -0,0 +1,8 @@
const api = {
download: '/dawa/common/download',
}
// 附件下载
export function downloadExportFile(fileName) {
window.location.href = api.download + '?fileName=' + fileName;
}

View File

@ -0,0 +1,136 @@
<template>
<a-card :bordered="false" :title="pageName">
<template slot="extra">
<a-button size="small" @click="save" type="primary">保存</a-button>
<a-button size="small" @click="close">返回</a-button>
</template>
<a-form-model :model="form">
<a-form-model-item label="证书名称" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-input v-model="form.name" placeholder="证书名称" />
</a-form-model-item>
<a-form-model-item label="证书注册日期" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-date-picker v-model="form.registerDate" :format="'YYYY-MM-DD'" valueFormat="YYYY-MM-DD" placeholder="证书注册日期" />
</a-form-model-item>
<a-form-model-item label="证书有效期" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-date-picker v-model="form.validityStartDate" :format="'YYYY-MM-DD'" valueFormat="YYYY-MM-DD" placeholder="证书有效期开始日期" />
-
<a-date-picker v-model="form.validityEndDate" :format="'YYYY-MM-DD'" valueFormat="YYYY-MM-DD" placeholder="证书有效期结束日期" />
</a-form-model-item>
<a-form-model-item label="证书类型" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-select v-model="form.type" placeholder="请选择证书类型" :allowClear="true">
<a-select-option v-for="(item, index) in certificateType" :key="index" :value="item.value">{{ item.name }}</a-select-option>
</a-select>
</a-form-model-item>
<!-- <a-form-model-item label="证书状态" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<a-select v-model="form.state" placeholder="请选择证书状态" :allowClear="true">
<a-select-option v-for="(item, index) in certificateState" :key="index" :value="item.value">{{ item.name }}</a-select-option>
</a-select>
</a-form-model-item> -->
<a-form-model-item label="证书照片" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
<db-upload v-model="fileList"></db-upload>
</a-form-model-item>
</a-form-model>
</a-card>
</template>
<script>
import DbUpload from '@/components/DbUpload/DbUpload.vue'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { addPersonCertificate, findPersonCertificateDetail } from '@/api/archives/certificate'
export default {
// import使
components: { DbUpload },
props: {},
data() {
//
return {
pageName: this.$route.query.certificateId ? '证书编辑' : '证书新增',
fileList: [],
form: {},
certificateType: [], //
certificateState: [], //
};
},
// data
computed: {},
// data
watch: {},
//
methods: {
//
close() {
if (this.$route.query.certificateId) this.$router.push({ path: '/archives/certificate/Index', query: {} });
else this.$router.push({ path: '/personList', query: {} });
},
//
loadCertificateInfo() {
if (!this.$route.query.certificateId) return;
findPersonCertificateDetail({ id: this.$route.query.certificateId }).then(res => {
this.form = res.data;
this.fileList = JSON.parse(res.data.file);
})
},
//
dictionaryDropDown() {
//
dictionaryDropDown({ dictionaryCode: '0001' }).then((res) => {
this.certificateType = res.data;
})
//
dictionaryDropDown({ dictionaryCode: '0010' }).then((res) => {
this.certificateState = res.data;
})
},
//
save() {
let personCertificate = this.form;
console.log(this.fileList)
if (!personCertificate.id) personCertificate.personId = parseInt(this.$route.query.personId);
personCertificate.file = JSON.stringify(this.fileList);
console.log('save---', this.form)
addPersonCertificate(personCertificate).then(res => {
this.$message.success(this.pageName + "成功!");
this.close();
});
},
},
// - 访this
created() {
//
this.dictionaryDropDown();
//
this.loadCertificateInfo();
},
// - 访DOM
mounted() { },
// -
beforeCreate() { },
// -
beforeMount() { },
// -
beforeUpdate() { },
// -
updated() { },
// -
beforeDestroy() { },
// -
destroyed() { },
// keep-alive
activated() { }
};
</script>
<style scoped>
</style>

View File

@ -30,14 +30,16 @@
<a-icon type="down" /> <a-icon type="down" />
</a> </a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item> <a-menu-item v-if="hasPerm('person:certificate:edit')">
<a href="javascript:;" @click="editPersonCertificate(record)">修改</a> <a href="javascript:;" @click="editPersonCertificate(record)">修改</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item v-if="hasPerm('person:certificate:export')">
<a href="javascript:;">导出</a> <a href="javascript:;" @click="exportPersonCertificate(record)">导出</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item v-if="hasPerm('person:certificate:del')">
<a href="javascript:;" @click="delPersonCertificate(record)">删除</a> <a-popconfirm placement="topRight" title="确认删除?" @confirm="() => delPersonCertificate(record)">
<a href="javascript:;">删除</a>
</a-popconfirm>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
@ -51,10 +53,11 @@
<script> <script>
import { Empty } from 'ant-design-vue' import { Empty } from 'ant-design-vue'
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { getCertificateTypeList, getArchivesCertificatelist } from '@/api/archives/certificate' import { getArchivesCertificatelist, delCertificate, exportCertificate } from '@/api/archives/certificate'
import { downloadExportFile } from '@/api/common/common'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { orgList } from '@/api/org/org' import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util' import { listToTree } from '@/utils/util'
const rootParentId = 0
export default { export default {
// import使 // import使
@ -64,7 +67,10 @@ export default {
// //
return { return {
queryParam: { orgId: '', orgType: 1, type: '' }, queryParam: { orgId: '', orgType: 1, type: '' },
type: [], queryOptions: [
{ type: 'select-dic', placeholder: '证书类型', key: 'type', options: [] }
],
state: [], //
// //
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE, simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
@ -84,23 +90,29 @@ export default {
{ title: '单位信息', width: 'auto', align: 'center', dataIndex: 'dwOrgName', key: 'dwOrgName' }, { title: '单位信息', width: 'auto', align: 'center', dataIndex: 'dwOrgName', key: 'dwOrgName' },
{ title: '部门信息', width: 'auto', align: 'center', dataIndex: 'bmOrgName', key: 'bmOrgName' }, { title: '部门信息', width: 'auto', align: 'center', dataIndex: 'bmOrgName', key: 'bmOrgName' },
{ title: '证书名称', width: 'auto', align: 'center', dataIndex: 'name', key: 'name' }, { title: '证书名称', width: 'auto', align: 'center', dataIndex: 'name', key: 'name' },
{ title: '证书类型', width: 'auto', align: 'center', dataIndex: 'type', key: 'type' }, {
title: '证书类型', width: 'auto', align: 'center', dataIndex: 'type', key: 'type', customRender: (text, record, index) => {
let textStr = '';
this.queryOptions[0].options.forEach(element => { if (element.value.toString() === text) textStr = element.name; });
return textStr;
}
},
{ title: '注册日期', width: 'auto', align: 'center', dataIndex: 'registerDate', key: 'registerDate' }, { title: '注册日期', width: 'auto', align: 'center', dataIndex: 'registerDate', key: 'registerDate' },
{ title: '失效日期', width: 'auto', align: 'center', dataIndex: 'validityStartDate', key: 'validityStartDate' }, { title: '失效日期', width: 'auto', align: 'center', dataIndex: 'validityEndDate', key: 'validityEndDate' },
{ title: '证书状态', width: '80px', align: 'center', dataIndex: 'state', key: 'state' }, {
title: '证书状态', width: '80px', align: 'center', dataIndex: 'state', key: 'state', customRender: (text, record, index) => {
let textStr = '';
this.state.forEach(element => { if (element.value.toString() === text) textStr = element.name; });
return textStr;
}
},
{ title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } } { title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
], ],
loadData: null, loadData: null,
}; };
}, },
// data // data
computed: { computed: {},
queryOptions: function () {
return [
{ type: 'select', placeholder: '培训种类', key: 'type', options: [{ id: '', name: '全部' }, ...this.type] },
]
},
},
// data // data
watch: {}, watch: {},
// //
@ -113,7 +125,7 @@ export default {
return return
} }
this.defaultExpandedKeys = [] this.defaultExpandedKeys = []
this.orgTree = listToTree(res.data, [], rootParentId) this.orgTree = listToTree(res.data, [], 0)
this.queryParam.orgId = this.orgTree[0].id this.queryParam.orgId = this.orgTree[0].id
for (var item of this.orgTree) { for (var item of this.orgTree) {
if (item.pid === 0) { if (item.pid === 0) {
@ -127,25 +139,22 @@ export default {
}); });
}, },
// //
getCertificateType() { dictionaryDropDown() {
getCertificateTypeList({ dictionaryCode: '0001' }).then(res => { //
for (let index in res.data) { dictionaryDropDown({ dictionaryCode: '0001' }).then((res) => {
let item = {}; this.queryOptions[0].options = res.data;
item.id = res.data[index].value.toString(); })
item.name = res.data[index].name;
this.type.push(item) //
} dictionaryDropDown({ dictionaryCode: '0010' }).then((res) => {
}); this.state = res.data;
})
}, },
// //
editCertificateType() { editCertificateType() {
this.$router.push({ this.$router.push({ path: '/archives/certificate/CertificateType', query: {} });
path: '/archives/certificate/CertificateType', query: {
}
});
}, },
// //
@ -175,9 +184,19 @@ export default {
}); });
}, },
//
exportPersonCertificate(record) {
exportCertificate({ id: record.id }).then(res => {
downloadExportFile(res.data);
});
},
// //
delPersonCertificate(record) { delPersonCertificate(record) {
delCertificate({ id: record.id }).then(res => {
this.$message.success("删除证书成功!");
this.$refs.table.refresh(true)
});
} }
}, },
// - 访this // - 访this
@ -186,7 +205,7 @@ export default {
this.getOrgTree(); this.getOrgTree();
// //
this.getCertificateType(); this.dictionaryDropDown();
}, },
// - 访DOM // - 访DOM
mounted() { }, mounted() { },

View File

@ -3,15 +3,7 @@
<a-col :md="5" :sm="24"> <a-col :md="5" :sm="24">
<a-card :bordered="false" :loading="treeLoading"> <a-card :bordered="false" :loading="treeLoading">
<div v-if="this.orgTree != ''"> <div v-if="this.orgTree != ''">
<a-tree <a-tree :treeData="orgTree" :onLoadData="orgTree" v-if="orgTree.length" @select="handleClick" :defaultExpandAll="true" :defaultExpandedKeys="defaultExpandedKeys" :defaultSelectedKeys="defaultSelectedKeys" :replaceFields="replaceFields" />
:treeData="orgTree"
:onLoadData="orgTree"
v-if="orgTree.length"
@select="handleClick"
:defaultExpandAll="true"
:defaultExpandedKeys="defaultExpandedKeys"
:defaultSelectedKeys="defaultSelectedKeys"
:replaceFields="replaceFields" />
</div> </div>
<div v-else> <div v-else>
<a-empty :image="simpleImage" /> <a-empty :image="simpleImage" />
@ -28,13 +20,13 @@
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="48"> <a-row :gutter="48">
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="姓名" > <a-form-item label="姓名">
<a-input v-model="queryParam.name" allow-clear placeholder="请输入姓名"/> <a-input v-model="queryParam.name" allow-clear placeholder="请输入姓名" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
<a-form-item label="用户名" > <a-form-item label="用户名">
<a-input v-model="queryParam.userName" allow-clear placeholder="请输入用户名"/> <a-input v-model="queryParam.userName" allow-clear placeholder="请输入用户名" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="24"> <a-col :md="8" :sm="24">
@ -66,13 +58,7 @@
</div> </div>
</div> </div>
<s-table <s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
>
<template slot="registerDate" slot-scope="text, record"> <template slot="registerDate" slot-scope="text, record">
{{ record.registerDate | moment('YYYY-MM-DD') }} {{ record.registerDate | moment('YYYY-MM-DD') }}
</template> </template>
@ -82,7 +68,8 @@
<a-divider type="vertical" v-if="hasPerm('person:detail')" /> <a-divider type="vertical" v-if="hasPerm('person:detail')" />
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')"> <a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
<a class="ant-dropdown-link"> <a class="ant-dropdown-link">
更多 <a-icon type="down" /> 更多
<a-icon type="down" />
</a> </a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item v-if="hasPerm('person:edit')"> <a-menu-item v-if="hasPerm('person:edit')">
@ -93,6 +80,9 @@
<a>重置密码</a> <a>重置密码</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item v-if="hasPerm('person:certificate:edit')">
<a @click="addPersonCertificate(record)">添加证书</a>
</a-menu-item>
<a-menu-item v-if="hasPerm('person:del')"> <a-menu-item v-if="hasPerm('person:del')">
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)"> <a-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)">
<a>删除</a> <a>删除</a>
@ -105,280 +95,290 @@
<person-form ref="personForm" @ok="handleOk" /> <person-form ref="personForm" @ok="handleOk" />
<person-detail ref="personDetail" @ok="handleOk" /> <person-detail ref="personDetail" @ok="handleOk" />
<org-tree @selectOrg="selectOrg($event)" ref="orgModal"/> <org-tree @selectOrg="selectOrg($event)" ref="orgModal" />
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
</template> </template>
<script> <script>
import { STable } from '@/components' import { STable } from '@/components'
import { Empty } from 'ant-design-vue' import { Empty } from 'ant-design-vue'
import { orgList } from '@/api/org/org' import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util' import { listToTree } from '@/utils/util'
import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd } from '@/api/person/person' import { personPage, personDel, personQuit, personTransferOrg, personSetAdmin, personResetPwd } from '@/api/person/person'
import PersonRegister from './PersonRegister' import PersonRegister from './PersonRegister'
import PersonForm from './PersonForm' import PersonForm from './PersonForm'
import PersonDetail from './PersonDetail' import PersonDetail from './PersonDetail'
import OrgTree from '../org/OrgTree' import OrgTree from '../org/OrgTree'
const rootParentId = 0 const rootParentId = 0
export default { export default {
components: { components: {
STable, STable,
PersonRegister, PersonRegister,
PersonForm, PersonForm,
PersonDetail, PersonDetail,
OrgTree OrgTree
}, },
data () { data() {
return { return {
// //
queryParam: { isAdmin: 2 }, queryParam: { isAdmin: 2 },
// //
columns: [ columns: [
{ {
title: '姓名', title: '姓名',
dataIndex: 'name' dataIndex: 'name'
},
{
title: '用户名',
dataIndex: 'userName'
},
{
title: '单位信息',
dataIndex: 'unit'
},
{
title: '部门信息',
dataIndex: 'dept'
},
{
title: '年度学时要求',
dataIndex: 'classHours'
},
{
title: '注册时间',
dataIndex: 'registerDate',
scopedSlots: { customRender: 'registerDate' }
}
],
// Promise
loadData: parameter => {
return personPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
}, },
orgTree: [], {
selectedRowKeys: [], title: '用户名',
selectedRows: [], dataIndex: 'userName'
defaultExpandedKeys: [],
defaultSelectedKeys: [],
treeLoading: true,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
}, },
orgId: '', {
orgType: 1 title: '单位信息',
} dataIndex: 'unit'
}, },
created () { {
this.getOrgTree() title: '部门信息',
dataIndex: 'dept'
},
{
title: '年度学时要求',
dataIndex: 'classHours'
},
{
title: '注册时间',
dataIndex: 'registerDate',
scopedSlots: { customRender: 'registerDate' }
}
],
// Promise
loadData: parameter => {
return personPage(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
orgTree: [],
selectedRowKeys: [],
selectedRows: [],
defaultExpandedKeys: [],
defaultSelectedKeys: [],
treeLoading: true,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
},
orgId: '',
orgType: 1
}
},
created() {
this.getOrgTree()
if (this.hasPerm('person:edit') || this.hasPerm('person:resetPwd') || this.hasPerm('person:del')) { if (this.hasPerm('person:edit') || this.hasPerm('person:resetPwd') || this.hasPerm('person:del')) {
this.columns.push({ this.columns.push({
title: '操作', title: '操作',
width: '150px', width: '150px',
dataIndex: 'action', dataIndex: 'action',
scopedSlots: { customRender: 'action' } scopedSlots: { customRender: 'action' }
}) })
} }
},
methods: {
/**
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开
*/
async getOrgTree() {
await orgList({ orgType: this.orgType }).then(res => {
this.treeLoading = false
if (!res.code === 200 || !res.data.length) {
return
}
this.defaultExpandedKeys = []
this.defaultSelectedKeys = []
this.orgTree = listToTree(res.data, [], rootParentId)
this.orgId = this.orgTree[0].id
this.defaultSelectedKeys.push(this.orgId)
for (var item of this.orgTree) {
if (item.pid === 0) {
this.defaultExpandedKeys.push(item.id)
}
}
console.log(this.defaultExpandedKeys)
})
}, },
methods: { async changeOrgType() {
/** this.orgType = this.orgType === 1 ? 2 : 1
* 获取到机构树展开顶级下树节点考虑到后期数据量变大不建议全部展开 await this.getOrgTree()
*/ // 使asyncawait orgTree
async getOrgTree () { this.handleClick(this.orgId)
await orgList({ orgType: this.orgType }).then(res => { },
this.treeLoading = false /**
if (!res.code === 200 || !res.data.length) { * 重置密码
return */
} resetPwd(record) {
this.defaultExpandedKeys = [] personResetPwd({ id: record.id }).then(res => {
this.defaultSelectedKeys = [] if (res.code === 200) {
this.orgTree = listToTree(res.data, [], rootParentId) this.$message.success('重置成功')
this.orgId = this.orgTree[0].id // this.$refs.table.refresh()
this.defaultSelectedKeys.push(this.orgId)
for (var item of this.orgTree) {
if (item.pid === 0) {
this.defaultExpandedKeys.push(item.id)
}
}
console.log(this.defaultExpandedKeys)
})
},
async changeOrgType () {
this.orgType = this.orgType === 1 ? 2 : 1
await this.getOrgTree()
// 使asyncawait orgTree
this.handleClick(this.orgId)
},
/**
* 重置密码
*/
resetPwd (record) {
personResetPwd({ id: record.id }).then(res => {
if (res.code === 200) {
this.$message.success('重置成功')
// this.$refs.table.refresh()
} else {
this.$message.error('重置失败:' + res.msg)
}
})
},
/**
* 删除用户
*/
personDelete (record) {
personDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh()
} else {
this.$message.error('删除失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('删除错误:' + err.msg)
})
},
quit () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$confirm({
title: '提示',
content: '确认离职吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personQuit(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel () {
}
})
},
transfer () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$refs.orgModal.loadOrg()
},
selectOrg (orgData) {
this.$confirm({
title: '提示',
content: '确认转移部门至' + orgData.name + '吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { ids: paramIds, targetOrgId: orgData.id }
personTransferOrg(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel () {
}
})
},
setAdmin () {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$confirm({
title: '提示',
content: '确认设置为管理员吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personSetAdmin(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel () {
}
})
},
personRegister () {
if (this.orgType === 1) {
this.$router.push({
path: '/person/personRegister',
query: { orgId: this.orgId }
})
} else { } else {
this.$router.push({ this.$message.error('重置失败:' + res.msg)
path: '/person/personOrg',
query: { orgId: this.orgId }
})
} }
}, })
/** },
* 点击左侧机构树查询列表 /**
*/ * 删除用户
handleClick (e) { */
this.queryParam.orgId = e.toString() personDelete(record) {
this.orgId = e.toString() personDel({ id: record.id, deleteReason: '' }).then((res) => {
this.$refs.table.refresh(true) if (res.code === 200) {
}, this.$message.success('删除成功')
handleOk () { this.$refs.table.refresh()
this.$refs.table.refresh() } else {
}, this.$message.error('删除失败:' + res.msg)
onRadioChange (e) { }
this.queryParam.isAdmin = e.target.value }).catch((err) => {
this.$refs.table.refresh(true) this.$message.error('删除错误:' + err.msg)
}, })
onSelectChange (selectedRowKeys, selectedRows) { },
this.selectedRowKeys = selectedRowKeys /**
this.selectedRows = selectedRows * 添加证书
*/
addPersonCertificate(record) {
this.$router.push({
path: '/archives/certificate/EditCertificate', query: {
personId: record.id
}
});
},
quit() {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
} }
this.$confirm({
title: '提示',
content: '确认离职吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personQuit(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel() {
}
})
},
transfer() {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$refs.orgModal.loadOrg()
},
selectOrg(orgData) {
this.$confirm({
title: '提示',
content: '确认转移部门至' + orgData.name + '吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { ids: paramIds, targetOrgId: orgData.id }
personTransferOrg(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel() {
}
})
},
setAdmin() {
if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员')
return
}
this.$confirm({
title: '提示',
content: '确认设置为管理员吗',
onOk: () => {
const paramIds = this.selectedRowKeys.join(',')
const param = { 'ids': paramIds }
personSetAdmin(param).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.$refs.table.refresh()
} else {
this.$message.error('操作失败:' + res.msg)
}
}).catch((err) => {
this.$message.error('操作错误:' + err.msg)
})
},
onCancel() {
}
})
},
personRegister() {
if (this.orgType === 1) {
this.$router.push({
path: '/person/personRegister',
query: { orgId: this.orgId }
})
} else {
this.$router.push({
path: '/person/personOrg',
query: { orgId: this.orgId }
})
}
},
/**
* 点击左侧机构树查询列表
*/
handleClick(e) {
this.queryParam.orgId = e.toString()
this.orgId = e.toString()
this.$refs.table.refresh(true)
},
handleOk() {
this.$refs.table.refresh()
},
onRadioChange(e) {
this.queryParam.isAdmin = e.target.value
this.$refs.table.refresh(true)
},
onSelectChange(selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectedRows = selectedRows
} }
} }
}
</script> </script>
<style lang="less"> <style lang="less">
.table-operator { .table-operator {
margin-bottom: 18px; margin-bottom: 18px;
} }
button { button {
margin-right: 8px; margin-right: 8px;
} }
.person-type span{ .person-type span {
font-size: 24px; font-size: 24px;
} }
</style> </style>