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

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" />
@ -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>
@ -255,6 +245,16 @@
this.$message.error('删除错误:' + err.msg) this.$message.error('删除错误:' + err.msg)
}) })
}, },
/**
* 添加证书
*/
addPersonCertificate(record) {
this.$router.push({
path: '/archives/certificate/EditCertificate', query: {
personId: record.id
}
});
},
quit() { quit() {
if (!this.selectedRowKeys.length) { if (!this.selectedRowKeys.length) {
this.$message.warning('请选择人员') this.$message.warning('请选择人员')