人员证书新增、档案、修改、导出、删除
This commit is contained in:
parent
0d242f5f8a
commit
3b2cf41a99
|
@ -6,7 +6,13 @@ const api = {
|
|||
get: '/sys/dictionary/item/get',
|
||||
add: '/sys/dictionary/item/add',
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
// 证书列表
|
||||
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
|
||||
})
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
const api = {
|
||||
download: '/dawa/common/download',
|
||||
}
|
||||
|
||||
// 附件下载
|
||||
export function downloadExportFile(fileName) {
|
||||
window.location.href = api.download + '?fileName=' + fileName;
|
||||
}
|
|
@ -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>
|
|
@ -30,14 +30,16 @@
|
|||
<a-icon type="down" />
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a-menu-item v-if="hasPerm('person:certificate:edit')">
|
||||
<a href="javascript:;" @click="editPersonCertificate(record)">修改</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;">导出</a>
|
||||
<a-menu-item v-if="hasPerm('person:certificate:export')">
|
||||
<a href="javascript:;" @click="exportPersonCertificate(record)">导出</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="delPersonCertificate(record)">删除</a>
|
||||
<a-menu-item v-if="hasPerm('person:certificate:del')">
|
||||
<a-popconfirm placement="topRight" title="确认删除?" @confirm="() => delPersonCertificate(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
|
@ -51,10 +53,11 @@
|
|||
<script>
|
||||
import { Empty } from 'ant-design-vue'
|
||||
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 { listToTree } from '@/utils/util'
|
||||
const rootParentId = 0
|
||||
|
||||
export default {
|
||||
// import引入的组件需要注入到对象中才能使用
|
||||
|
@ -64,7 +67,10 @@ export default {
|
|||
// 这里存放数据
|
||||
return {
|
||||
queryParam: { orgId: '', orgType: 1, type: '' },
|
||||
type: [],
|
||||
queryOptions: [
|
||||
{ type: 'select-dic', placeholder: '证书类型', key: 'type', options: [] }
|
||||
],
|
||||
state: [], // 证书状态字典
|
||||
|
||||
// 组织机构数需要用到的参数
|
||||
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: 'bmOrgName', key: 'bmOrgName' },
|
||||
{ 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: 'validityStartDate', key: 'validityStartDate' },
|
||||
{ title: '证书状态', width: '80px', align: 'center', dataIndex: 'state', key: 'state' },
|
||||
{ title: '失效日期', width: 'auto', align: 'center', dataIndex: 'validityEndDate', key: 'validityEndDate' },
|
||||
{
|
||||
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' } }
|
||||
],
|
||||
loadData: null,
|
||||
};
|
||||
},
|
||||
// 计算属性 类似于data概念
|
||||
computed: {
|
||||
queryOptions: function () {
|
||||
return [
|
||||
{ type: 'select', placeholder: '培训种类', key: 'type', options: [{ id: '', name: '全部' }, ...this.type] },
|
||||
]
|
||||
},
|
||||
},
|
||||
computed: {},
|
||||
// 监控data中的数据变化
|
||||
watch: {},
|
||||
// 方法集合
|
||||
|
@ -113,7 +125,7 @@ export default {
|
|||
return
|
||||
}
|
||||
this.defaultExpandedKeys = []
|
||||
this.orgTree = listToTree(res.data, [], rootParentId)
|
||||
this.orgTree = listToTree(res.data, [], 0)
|
||||
this.queryParam.orgId = this.orgTree[0].id
|
||||
for (var item of this.orgTree) {
|
||||
if (item.pid === 0) {
|
||||
|
@ -127,25 +139,22 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 获取所有证书类型
|
||||
getCertificateType() {
|
||||
getCertificateTypeList({ dictionaryCode: '0001' }).then(res => {
|
||||
for (let index in res.data) {
|
||||
let item = {};
|
||||
item.id = res.data[index].value.toString();
|
||||
item.name = res.data[index].name;
|
||||
this.type.push(item)
|
||||
}
|
||||
});
|
||||
// 获取词典项
|
||||
dictionaryDropDown() {
|
||||
// 获取证书类型
|
||||
dictionaryDropDown({ dictionaryCode: '0001' }).then((res) => {
|
||||
this.queryOptions[0].options = res.data;
|
||||
})
|
||||
|
||||
// 获取证书状态
|
||||
dictionaryDropDown({ dictionaryCode: '0010' }).then((res) => {
|
||||
this.state = res.data;
|
||||
})
|
||||
},
|
||||
|
||||
// 编辑证书类型
|
||||
editCertificateType() {
|
||||
this.$router.push({
|
||||
path: '/archives/certificate/CertificateType', query: {
|
||||
|
||||
}
|
||||
});
|
||||
this.$router.push({ path: '/archives/certificate/CertificateType', query: {} });
|
||||
},
|
||||
|
||||
// 搜索区查询按钮
|
||||
|
@ -175,9 +184,19 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 导出人员证书
|
||||
exportPersonCertificate(record) {
|
||||
exportCertificate({ id: record.id }).then(res => {
|
||||
downloadExportFile(res.data);
|
||||
});
|
||||
},
|
||||
|
||||
// 删除人员证书
|
||||
delPersonCertificate(record) {
|
||||
|
||||
delCertificate({ id: record.id }).then(res => {
|
||||
this.$message.success("删除证书成功!");
|
||||
this.$refs.table.refresh(true)
|
||||
});
|
||||
}
|
||||
},
|
||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||
|
@ -186,7 +205,7 @@ export default {
|
|||
this.getOrgTree();
|
||||
|
||||
// 获取所有证书类型
|
||||
this.getCertificateType();
|
||||
this.dictionaryDropDown();
|
||||
},
|
||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||
mounted() { },
|
||||
|
|
|
@ -3,15 +3,7 @@
|
|||
<a-col :md="5" :sm="24">
|
||||
<a-card :bordered="false" :loading="treeLoading">
|
||||
<div v-if="this.orgTree != ''">
|
||||
<a-tree
|
||||
:treeData="orgTree"
|
||||
:onLoadData="orgTree"
|
||||
v-if="orgTree.length"
|
||||
@select="handleClick"
|
||||
:defaultExpandAll="true"
|
||||
:defaultExpandedKeys="defaultExpandedKeys"
|
||||
:defaultSelectedKeys="defaultSelectedKeys"
|
||||
:replaceFields="replaceFields" />
|
||||
<a-tree :treeData="orgTree" :onLoadData="orgTree" v-if="orgTree.length" @select="handleClick" :defaultExpandAll="true" :defaultExpandedKeys="defaultExpandedKeys" :defaultSelectedKeys="defaultSelectedKeys" :replaceFields="replaceFields" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<a-empty :image="simpleImage" />
|
||||
|
@ -66,13 +58,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<s-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:data="loadData"
|
||||
:rowKey="(record) => record.id"
|
||||
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||
>
|
||||
<s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
|
||||
<template slot="registerDate" slot-scope="text, record">
|
||||
{{ record.registerDate | moment('YYYY-MM-DD') }}
|
||||
</template>
|
||||
|
@ -82,7 +68,8 @@
|
|||
<a-divider type="vertical" v-if="hasPerm('person:detail')" />
|
||||
<a-dropdown v-if="hasPerm('person:edit') || hasPerm('person:resetPwd') || hasPerm('person:del')">
|
||||
<a class="ant-dropdown-link">
|
||||
更多 <a-icon type="down" />
|
||||
更多
|
||||
<a-icon type="down" />
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-if="hasPerm('person:edit')">
|
||||
|
@ -93,6 +80,9 @@
|
|||
<a>重置密码</a>
|
||||
</a-popconfirm>
|
||||
</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-popconfirm placement="topRight" title="确认删除?" @confirm="() => personDelete(record)">
|
||||
<a>删除</a>
|
||||
|
@ -255,6 +245,16 @@
|
|||
this.$message.error('删除错误:' + err.msg)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 添加证书
|
||||
*/
|
||||
addPersonCertificate(record) {
|
||||
this.$router.push({
|
||||
path: '/archives/certificate/EditCertificate', query: {
|
||||
personId: record.id
|
||||
}
|
||||
});
|
||||
},
|
||||
quit() {
|
||||
if (!this.selectedRowKeys.length) {
|
||||
this.$message.warning('请选择人员')
|
||||
|
|
Loading…
Reference in New Issue