Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
Yuanjianghong 2021-11-22 20:33:01 +08:00
commit 55aefae2e6
2 changed files with 153 additions and 17 deletions

View File

@ -27,9 +27,9 @@
</a-col>
<!-- orgTree -->
<a-col :span="24" :style="{marginTop: '-8px', marginBottom: '8px'}">
<org-tree v-show="orgTree.ifshow" :startOrganizationId="orgTree.startOrganizationId" @getSelectTreeKey="key => form[orgTree.formKey] = key"></org-tree>
</a-col>
<!-- <a-col :span="24" :style="{marginTop: '-8px', marginBottom: '8px'}" v-show="orgTree.ifshow">
<org-tree :startOrganizationId="orgTree.startOrganizationId" @getSelectTreeKey="key => form[orgTree.formKey] = key"></org-tree>
</a-col> -->
</a-row>
</a-form>

View File

@ -1,17 +1,60 @@
<template>
<a-card :bordered="false" title="证书档案">
<a-card :bordered="false" title="证书档案" :loading="treeLoading">
<div class="table-page-search-wrapper">
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom>
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam.type = '', handleRefresh()}"></SearchCom>
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
<a-button type="primary" @click="editCertificateType()">编辑证书类型</a-button>
</div>
</div>
<a-row :gutter="24">
<a-col :md="5" :sm="24" class="borderTop ">
<div>
<div v-if="this.orgTree != ''">
<a-tree :treeData="orgTree" v-if="orgTree.length" @select="handleClick" :defaultExpandAll="true" :defaultExpandedKeys="defaultExpandedKeys" :replaceFields="replaceFields" />
</div>
<div v-else>
<a-empty :image="simpleImage" />
</div>
<a-button type="primary" @click="changeOrgType" style="display: block; margin: 10px auto;">
{{ queryParam.orgType === 1 ? '切换到项目组' : '切换到单位' }}
</a-button>
</div>
</a-col>
<a-col :md="19" :sm="24" style="padding-left: 0px">
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData">
<template slot="action" slot-scope="text, record">
<a-dropdown>
<a class="ant-dropdown-link">操作
<a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:;" @click="editPersonCertificate(record)">修改</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;">导出</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="delPersonCertificate(record)">删除</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</s-table>
</a-col>
</a-row>
</a-card>
</template>
<script>
import { Empty } from 'ant-design-vue'
import { STable, SearchCom } from '@/components'
import { getCertificateTypeList } from '@/api/archives/certificate'
import { getCertificateTypeList, getArchivesCertificatelist } from '@/api/archives/certificate'
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default {
// import使
@ -20,15 +63,40 @@ export default {
data() {
//
return {
queryParam: { orgId: '', name: '', type: '' },
type: []
queryParam: { orgId: '', orgType: 1, type: '' },
type: [],
//
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
orgTree: [],
defaultExpandedKeys: [],
treeLoading: true,
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
},
//
columns: [
{ title: '姓名', width: '80px', align: 'center', dataIndex: 'personName', key: 'personName' },
{ 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: 'registerDate', key: 'registerDate' },
{ title: '失效日期', width: 'auto', align: 'center', dataIndex: 'validityStartDate', key: 'validityStartDate' },
{ title: '证书状态', width: '80px', align: 'center', dataIndex: 'state', key: 'state' },
{ title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
],
loadData: null,
};
},
// data
computed: {
queryOptions: function () {
return [
{ type: 'input', placeholder: '证书名称', key: 'name' },
{ type: 'select', placeholder: '培训种类', key: 'type', options: [{ id: '', name: '全部' }, ...this.type] },
]
},
@ -37,6 +105,40 @@ export default {
watch: {},
//
methods: {
//
getOrgTree() {
orgList({ orgType: this.queryParam.orgType }).then(res => {
this.treeLoading = false
if (!res.code === 200 || !res.data.length) {
return
}
this.defaultExpandedKeys = []
this.orgTree = listToTree(res.data, [], rootParentId)
this.queryParam.orgId = this.orgTree[0].id
for (var item of this.orgTree) {
if (item.pid === 0) {
this.defaultExpandedKeys.push(item.id)
}
}
if (!this.loadData) this.loadData = parameter => { return getArchivesCertificatelist(Object.assign(parameter, this.queryParam)).then(res => { return res }) };
else this.handleRefresh();
});
},
//
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)
}
});
},
//
editCertificateType() {
this.$router.push({
@ -44,19 +146,47 @@ export default {
}
});
},
//
handleRefresh() {
this.$refs.table.refresh(true)
},
//
changeOrgType() {
this.queryParam.orgType = this.queryParam.orgType === 1 ? 2 : 1;
this.getOrgTree();
// this.handleClick();
},
//
handleClick(e) {
this.queryParam.orgId = e.toString()
this.$refs.table.refresh(true)
},
//
editPersonCertificate(record) {
this.$router.push({
path: '/archives/certificate/EditCertificate', query: {
certificateId: record.id
}
});
},
//
delPersonCertificate(record) {
}
},
// - 访this
created() {
//
this.getOrgTree();
//
getCertificateTypeList({ dictionaryCode: '0001' }).then(res => {
for (let index in res.data) {
let item = {};
item.id = res.data[index].value;
item.name = res.data[index].name;
this.type.push(item)
}
});
this.getCertificateType();
},
// - 访DOM
mounted() { },
@ -78,4 +208,10 @@ export default {
</script>
<style scoped>
.borderTop {
border-top: 1px solid #e8e8e8;
}
.borderRight {
border-right: 1px solid #e8e8e8;
}
</style>