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,9 +1,30 @@
<template>
<a-row :gutter="24" >
<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="false"
:defaultExpandedKeys="expandedKeys"
:defaultSelectedKeys="selectedKeys"
:replaceFields="replaceFields" />
</div>
<div v-else>
<a-empty :image="simpleImage" />
</div>
</a-card>
</a-col>
<a-col :md="19" :sm="24">
<a-card :bordered="false" title="人员档案">
<div class="table-page-search-wrapper">
<SearchCom :form="queryParam" :list="queryOptions" :orgTree="orgTreeOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom>
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
<a-button type="primary" :style="{float: 'right'}">导出</a-button>
<!-- <a-button type="primary" :style="{float: 'right'}">导出</a-button> -->
</div>
</div>
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.archivesUserPageNum) || 1">
@ -16,36 +37,42 @@
<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-menu-item v-if="hasPerm('archives:user:selfStudy:list')">
<a href="javascript:;" @click="archivesSelfStudy(record)">自学档案</a>
</a-menu-item>
</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-menu-item>
<a-popconfirm title="确认导出?" cancelText="取消" okText="确认" @confirm="() => handleDelete(record)">
<a href="javascript:;"> 导出 </a>
</a-popconfirm>
</a-menu-item>
</a-menu-item> -->
</a-menu>
</a-dropdown>
</template>
</s-table>
</a-card>
</a-col>
</a-row>
</template>
<script>
import { STable, SearchCom } from '@/components'
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 {
components: { STable, SearchCom },
data() {
return {
queryParam: { name: this.$route.query.archivesUserName || '', orgId: this.$route.query.archivesUserOrgId || '' },
queryParam: { name: this.$route.query.archivesUserName || ''},
columns: [
{ 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: 'bmOrgName', key: 'bmOrgName' },
{ 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: '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: {
@ -67,7 +111,39 @@ export default {
return { ifshow: true, formKey: 'orgId', startOrganizationId: '', defaultOrganizationId: '' };
}
},
created () {
this.getOrgTree()
},
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() {
this.$refs.table.refresh(true)
},
@ -77,7 +153,7 @@ export default {
path: '/archives/user/Project', query: {
id: record.id,
archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId,
archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current
}
});
@ -88,7 +164,7 @@ export default {
path: '/archives/user/SelfStudy', query: {
id: record.id,
archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId,
archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current
}
});
@ -99,7 +175,7 @@ export default {
path: '/archives/user/Violation', query: {
id: record.id,
archivesUserName: this.queryParam.name,
archivesUserOrgId: this.queryParam.orgId,
archivesUserOrgId: this.orgId,
archivesUserPageNum: this.$refs.table.localPagination.current
}
});

View File

@ -69,9 +69,9 @@
</div>
<br />
<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">
<a-button v-show="this.successOssFile.length < 1">
<a-button v-if="this.successOssFile.length < 1">
<a-icon type="upload" /> {{this.uploadButtonText}}
</a-button>&nbsp;&nbsp;&nbsp;
</a-upload>
@ -158,6 +158,7 @@ import { dictToTree } from '@/utils/util';
export default {
data() {
return {
courseWay: 0, // 1: , 2: pdf
schedule: 0, //
isSave: false,
pageName: '',
@ -226,16 +227,8 @@ export default {
//
showModal() {
this.fileUpload.visible = true;
// this.classfiy()
},
// dictionaryDropDown() {
// //
// dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
// //
// this.coursewareClassfiy = dictToTree(res.data, [], 0);
// });
// },
//
goback() {
@ -279,10 +272,15 @@ export default {
},
beforeUpload(file) {
console.log('file', file);
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;
@ -294,7 +292,7 @@ export default {
//
const data = new FormData();
data.append('file', file);
data.append('fileType', 'mp4');
data.append('fileType', this.fileUpload.tabkey == '1' ? 'mp4' : 'pdf');
//token
const header = {};
@ -304,13 +302,10 @@ export default {
var config = {
headers: header,
onUploadProgress: function (e) {
console.log(e);
//lengthComputable
//lengthComputablefalsee.totale.loaded
if (e.lengthComputable) {
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)
}
@ -340,10 +335,13 @@ export default {
}
})
.catch(err => {
console.log("进来了!!!!!",err);
// data.delete("file") //
// 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;
},
@ -458,6 +456,7 @@ export default {
this.fileUpload.videoForm.courseId = this.$route.query.courseId;
this.fileUpload.videoForm.videoPath = this.videoPath;
this.fileUpload.videoForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.videoForm.courseWay = this.courseWay
let form = {};
form = this.fileUpload.videoForm;
return form;
@ -476,6 +475,7 @@ export default {
this.fileUpload.textForm.type = this.fileUpload.tabkey;
this.fileUpload.textForm.videoPath = this.videoPath;
this.fileUpload.textForm.ifResources = this.$route.query.ifResources || 0;
this.fileUpload.textForm.courseWay = this.courseWay;
let form = {};
form = this.fileUpload.textForm;
return form;
@ -543,7 +543,6 @@ export default {
successOssFile_['url'] = element.path;
successOssFile_['size'] = element.size;
this.successOssFile.push(successOssFile_);
console.log('文件问见', this.successOssFile);
});
if (this.courseware.type == '1') {