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

This commit is contained in:
Yjhon 2022-03-14 16:56:29 +08:00
commit 5bffd0f746
2 changed files with 134 additions and 59 deletions

View File

@ -1,51 +1,78 @@
<template> <template>
<a-card :bordered="false" title="人员档案"> <a-row :gutter="24" >
<div class="table-page-search-wrapper"> <a-col :md="5" :sm="24">
<SearchCom :form="queryParam" :list="queryOptions" :orgTree="orgTreeOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom> <a-card :bordered="false" :loading="treeLoading">
<div style="width: 100%; height: 32px; margin-bottom: 8px;"> <div v-if="this.orgTree != ''">
<a-button type="primary" :style="{float: 'right'}">导出</a-button> <a-tree
</div> :treeData="orgTree"
</div> :onLoadData="orgTree"
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.archivesUserPageNum) || 1"> v-if="orgTree.length"
<template slot="action" slot-scope="text, record"> @select="handleClick"
<a-dropdown v-if="hasPerm('archives:user:autotrain:list') || hasPerm('archives:user:terminaltrain:list') || hasPerm('archives:user:selfStudy:list') || hasPerm('archives:user:violation:list')"> :defaultExpandAll="false"
<a class="ant-dropdown-link">操作 :defaultExpandedKeys="expandedKeys"
<a-icon type="down" /> :defaultSelectedKeys="selectedKeys"
</a> :replaceFields="replaceFields" />
<a-menu slot="overlay"> </div>
<a-menu-item v-if="hasPerm('archives:user:autotrain:list') || hasPerm('archives:user:terminaltrain:list')"> <div v-else>
<a href="javascript:;" @click="archivesProject(record)">项目档案</a> <a-empty :image="simpleImage" />
</a-menu-item> </div>
<a-menu-item v-if="hasPerm('archives:user:selfStudy:list')">
<a href="javascript:;" @click="archivesSelfStudy(record)">自学档案</a> </a-card>
</a-menu-item> </a-col>
<a-menu-item v-if="hasPerm('archives:user:violation:list')"> <a-col :md="19" :sm="24">
<a href="javascript:;" @click="archivesViolation(record)">违章档案</a> <a-card :bordered="false" title="人员档案">
</a-menu-item> <div class="table-page-search-wrapper">
<a-menu-item> <SearchCom :form="queryParam" :list="queryOptions" :orgTree="orgTreeOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom>
<a-popconfirm title="确认导出?" cancelText="取消" okText="确认" @confirm="() => handleDelete(record)"> <div style="width: 100%; height: 32px; margin-bottom: 8px;">
<a href="javascript:;"> 导出 </a> <!-- <a-button type="primary" :style="{float: 'right'}">导出</a-button> -->
</a-popconfirm> </div>
</a-menu-item> </div>
</a-menu> <s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.archivesUserPageNum) || 1">
</a-dropdown> <template slot="action" slot-scope="text, record">
</template> <a-dropdown v-if="hasPerm('archives:user:autotrain:list') || hasPerm('archives:user:terminaltrain:list') || hasPerm('archives:user:selfStudy:list') || hasPerm('archives:user:violation:list')">
</s-table> <a class="ant-dropdown-link">操作
</a-card> <a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item v-if="hasPerm('archives:user:autotrain:list') || hasPerm('archives:user:terminaltrain:list')">
<a href="javascript:;" @click="archivesProject(record)">项目档案</a>
</a-menu-item>
<!-- <a-menu-item v-if="hasPerm('archives:user:selfStudy:list')">
<a href="javascript:;" @click="archivesSelfStudy(record)">自学档案</a>
</a-menu-item> -->
<a-menu-item v-if="hasPerm('archives:user:violation:list')">
<a href="javascript:;" @click="archivesViolation(record)">违章档案</a>
</a-menu-item>
<!-- <a-menu-item>
<a-popconfirm title="确认导出?" cancelText="取消" okText="确认" @confirm="() => handleDelete(record)">
<a href="javascript:;"> 导出 </a>
</a-popconfirm>
</a-menu-item> -->
</a-menu>
</a-dropdown>
</template>
</s-table>
</a-card>
</a-col>
</a-row>
</template> </template>
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { getArchivesUserList } from '@/api/archives/user' import { getArchivesUserList } from '@/api/archives/user'
import { Empty } from 'ant-design-vue'
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
export default { export default {
components: { STable, SearchCom }, components: { STable, SearchCom },
data() { data() {
return { return {
queryParam: { name: this.$route.query.archivesUserName || '', orgId: this.$route.query.archivesUserOrgId || '' }, queryParam: { name: this.$route.query.archivesUserName || ''},
columns: [ columns: [
{ title: '姓名', width: '100px', align: 'center', dataIndex: 'name', key: 'name' }, { title: '姓名', width: '100px', align: 'center', dataIndex: 'name', key: 'name' },
{ title: '受训角色', width: 'auto', align: 'center', dataIndex: 'roleName', key: 'roleName' }, // { title: '', width: 'auto', align: 'center', dataIndex: 'roleName', key: 'roleName' },
{ 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: 'yearClassHourRequire', key: 'yearClassHourRequire' }, { title: '年度学时要求/时', width: 'auto', align: 'center', dataIndex: 'yearClassHourRequire', key: 'yearClassHourRequire' },
@ -54,7 +81,24 @@ export default {
{ title: '项目学时', width: 'auto', align: 'center', dataIndex: 'projectClassHour', key: 'projectClassHour' }, { title: '项目学时', width: 'auto', align: 'center', dataIndex: 'projectClassHour', key: 'projectClassHour' },
{ title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } } { title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
], ],
loadData: parameter => { return getArchivesUserList(Object.assign(parameter, this.queryParam)).then(res => { return res }) } loadData: parameter => {
if (!this.orgId) return []
return getArchivesUserList(Object.assign(parameter, this.queryParam, { orgId: this.orgId })).then(res => {
return res
})
},
treeLoading: true,
orgTree: [],
expandedKeys: [],
selectedKeys: [],
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
},
orgId: null
} }
}, },
computed: { computed: {
@ -67,7 +111,39 @@ export default {
return { ifshow: true, formKey: 'orgId', startOrganizationId: '', defaultOrganizationId: '' }; return { ifshow: true, formKey: 'orgId', startOrganizationId: '', defaultOrganizationId: '' };
} }
}, },
created () {
this.getOrgTree()
},
methods: { methods: {
getOrgTree () {
orgList({ orgType: 1 }).then(res => {
this.treeLoading = false
this.expandedKeys = []
this.selectedKeys = []
if (!res.code === 200 || !res.data.length) {
this.orgTree = []
this.$refs.table.refresh(true)
return
}
this.orgTree = listToTree(res.data, [], 0)
console.log(this.orgTree)
this.orgId = this.orgTree[0].id
this.selectedKeys.push(this.orgId)
//
this.orgTree.forEach(item => {
this.expandedKeys.push(item.id)
})
this.handleClick(this.orgId)
})
},
/**
* 点击左侧机构树查询列表
*/
handleClick (e) {
this.orgId = e.toString()
this.$refs.table.refresh(true)
},
handleRefresh() { handleRefresh() {
this.$refs.table.refresh(true) this.$refs.table.refresh(true)
}, },
@ -77,7 +153,7 @@ export default {
path: '/archives/user/Project', query: { path: '/archives/user/Project', query: {
id: record.id, id: record.id,
archivesUserName: this.queryParam.name, archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId, archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current archivesUserPageNum: this.$refs.table.localPagination.current
} }
}); });
@ -88,7 +164,7 @@ export default {
path: '/archives/user/SelfStudy', query: { path: '/archives/user/SelfStudy', query: {
id: record.id, id: record.id,
archivesUserName: this.queryParam.name, archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId, archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current archivesUserPageNum: this.$refs.table.localPagination.current
} }
}); });
@ -99,7 +175,7 @@ export default {
path: '/archives/user/Violation', query: { path: '/archives/user/Violation', query: {
id: record.id, id: record.id,
archivesUserName: this.queryParam.name, archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId, archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current archivesUserPageNum: this.$refs.table.localPagination.current
} }
}); });
@ -115,4 +191,4 @@ export default {
.ant-card-body { .ant-card-body {
padding: 15px; padding: 15px;
} }
</style> </style>

View File

@ -69,9 +69,9 @@
</div> </div>
<br /> <br />
<div> <div>
<span v-show="this.successOssFile.length < 1">文件上传</span>&nbsp; <a-upload list-type="picture" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo" <span v-if="this.successOssFile.length < 1">文件上传</span>&nbsp; <a-upload list-type="picture" accept=".pdf" :default-file-list="this.successOssFile" :beforeUpload="beforeUpload" :remove="deleteVideo"
:disabled="this.uploadLoading"> :disabled="this.uploadLoading">
<a-button v-show="this.successOssFile.length < 1"> <a-button v-if="this.successOssFile.length < 1">
<a-icon type="upload" /> {{this.uploadButtonText}} <a-icon type="upload" /> {{this.uploadButtonText}}
</a-button>&nbsp;&nbsp;&nbsp; </a-button>&nbsp;&nbsp;&nbsp;
</a-upload> </a-upload>
@ -158,6 +158,7 @@ import { dictToTree } from '@/utils/util';
export default { export default {
data() { data() {
return { return {
courseWay: 0, // 1: , 2: pdf
schedule: 0, // schedule: 0, //
isSave: false, isSave: false,
pageName: '', pageName: '',
@ -226,16 +227,8 @@ export default {
// //
showModal() { showModal() {
this.fileUpload.visible = true; this.fileUpload.visible = true;
// this.classfiy()
}, },
// dictionaryDropDown() {
// //
// dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
// //
// this.coursewareClassfiy = dictToTree(res.data, [], 0);
// });
// },
// //
goback() { goback() {
@ -279,10 +272,15 @@ export default {
}, },
beforeUpload(file) { beforeUpload(file) {
console.log('file', file);
const _this = this; const _this = this;
console.log("fileSize",file.size)
let fileName = file.name;
let fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
if(fileExtension == 'mp4' || fileExtension == 'MP4') this.courseWay = 1;
if(fileExtension == 'pdf' || fileExtension == 'PDF') this.courseWay = 2;
// //
this.uploadLoading = true; this.uploadLoading = true;
@ -294,7 +292,7 @@ export default {
// //
const data = new FormData(); const data = new FormData();
data.append('file', file); data.append('file', file);
data.append('fileType', 'mp4'); data.append('fileType', this.fileUpload.tabkey == '1' ? 'mp4' : 'pdf');
//token //token
const header = {}; const header = {};
@ -304,13 +302,10 @@ export default {
var config = { var config = {
headers: header, headers: header,
onUploadProgress: function (e) { onUploadProgress: function (e) {
console.log(e);
//lengthComputable //lengthComputable
//lengthComputablefalsee.totale.loaded //lengthComputablefalsee.totale.loaded
if (e.lengthComputable) { if (e.lengthComputable) {
let a = ((e.loaded / e.total) * 100).toFixed(2); let a = ((e.loaded / e.total) * 100).toFixed(2);
// _this.schedule = ((e.loaded / e.total) * 100).toFixed(2) ; //
console.log('进度', a);
_this.schedule = parseInt(a) > 99 ? 99 : parseInt(a) _this.schedule = parseInt(a) > 99 ? 99 : parseInt(a)
} }
@ -340,10 +335,13 @@ export default {
} }
}) })
.catch(err => { .catch(err => {
console.log("进来了!!!!!",err);
// data.delete("file") // // data.delete("file") //
// this.uploadButtonText = ''; // this.uploadButtonText = '';
this.$message.error("上传失败!视频超出可上传大小范围");
for (let i = 0; i < this.successOssFile.length; i++) {
this.deleteVideo(this.successOssFile[i]);
}
this.$message.error("上传失败!"+this.fileUpload.tabkey == '1' ? "视频":"文件"+"超出可上传大小范围或文件已损坏!");
}); });
return false; return false;
}, },
@ -458,6 +456,7 @@ export default {
this.fileUpload.videoForm.courseId = this.$route.query.courseId; this.fileUpload.videoForm.courseId = this.$route.query.courseId;
this.fileUpload.videoForm.videoPath = this.videoPath; this.fileUpload.videoForm.videoPath = this.videoPath;
this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0; this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.videoForm.courseWay = this.courseWay
let form = {}; let form = {};
form = this.fileUpload.videoForm; form = this.fileUpload.videoForm;
return form; return form;
@ -476,6 +475,7 @@ export default {
this.fileUpload.textForm.type = this.fileUpload.tabkey; this.fileUpload.textForm.type = this.fileUpload.tabkey;
this.fileUpload.textForm.videoPath = this.videoPath; this.fileUpload.textForm.videoPath = this.videoPath;
this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0; this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.textForm.courseWay = this.courseWay;
let form = {}; let form = {};
form = this.fileUpload.textForm; form = this.fileUpload.textForm;
return form; return form;
@ -543,7 +543,6 @@ export default {
successOssFile_['url'] = element.path; successOssFile_['url'] = element.path;
successOssFile_['size'] = element.size; successOssFile_['size'] = element.size;
this.successOssFile.push(successOssFile_); this.successOssFile.push(successOssFile_);
console.log('文件问见', this.successOssFile);
}); });
if (this.courseware.type == '1') { if (this.courseware.type == '1') {