附件批量上传vue提交
This commit is contained in:
parent
48f7ce4c54
commit
575939eb8b
@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<div class="data-import">
|
||||||
|
<div class="top-box">
|
||||||
|
<div class="title-box">附件批量导入</div>
|
||||||
|
<div class="step-box">
|
||||||
|
<el-steps :active="info.activeStep" finish-status="success">
|
||||||
|
<el-step :title="item.title" v-for="item in info.steps" />
|
||||||
|
</el-steps>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bottom-box">
|
||||||
|
<div class="empty-box" v-if="info.fileList.length === 0">
|
||||||
|
<el-empty></el-empty>
|
||||||
|
<div class="upload-box">
|
||||||
|
<el-upload
|
||||||
|
class="upload-demo"
|
||||||
|
:action="info.uploadAction"
|
||||||
|
:on-preview="handlePreview"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:before-remove="beforeRemove"
|
||||||
|
:on-success="handleSuccess"
|
||||||
|
:limit="100"
|
||||||
|
multiple
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:show-file-list="false"
|
||||||
|
>
|
||||||
|
<awsui-button type="primary" @click="handleUploadBtn">导入文件</awsui-button>
|
||||||
|
<template #tip>
|
||||||
|
<!--<div class="el-upload__tip">
|
||||||
|
仅支持Word格式文本
|
||||||
|
</div>-->
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="file-list-box" v-else>
|
||||||
|
<el-scrollbar height="400px">
|
||||||
|
<div v-for="item in info.fileList" :key="item" class="scrollbar-demo-item">
|
||||||
|
<div>{{ item.name }}</div>
|
||||||
|
</div>
|
||||||
|
</el-scrollbar>
|
||||||
|
</div>
|
||||||
|
<div class="action-box">
|
||||||
|
<awsui-button style="cursor: pointer" type="primary" @click="next">下一步</awsui-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent,getCurrentInstance,reactive,ref } from 'vue';
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "batch-import",
|
||||||
|
setup() {
|
||||||
|
const { proxy: $this } = getCurrentInstance();
|
||||||
|
let info = reactive({
|
||||||
|
activeStep: 0,
|
||||||
|
steps: [{title:"上传"},{title:"校验"},{title:"结果"}],
|
||||||
|
fileList: [],
|
||||||
|
uploadAction: '',
|
||||||
|
repositoryName: 'migration',
|
||||||
|
groupValue: 'yili',
|
||||||
|
fileValue: '',
|
||||||
|
appId: 'com.actionsoft.apps.coe.pal.datamigration',
|
||||||
|
fileName: '',
|
||||||
|
fileNames:''
|
||||||
|
});
|
||||||
|
const handlePreview = () => {}
|
||||||
|
const handleRemove = () => {}
|
||||||
|
const beforeRemove = () => {}
|
||||||
|
const handleExceed = () => {}
|
||||||
|
const handleSuccess = (res: any,uploadFile: any,uploadFiles: any) => {
|
||||||
|
|
||||||
|
console.log(res,'---',uploadFile,'----',uploadFiles)
|
||||||
|
|
||||||
|
info.fileNames += res.files.name+ ",";
|
||||||
|
info.fileName = res.files.name
|
||||||
|
let tempFileObj = {id: uploadFile.uid,name: res.files.name,downloadUrl: res.data.data.attrs.downloadUrl}
|
||||||
|
info.fileList.push(tempFileObj)
|
||||||
|
console.info('fileList',info.fileList)
|
||||||
|
|
||||||
|
console.info("==================="+info.fileNames)
|
||||||
|
}
|
||||||
|
const next = () => {
|
||||||
|
if (info.fileList.length === 0) {
|
||||||
|
$this.$message({type:'warning',message:'请上传文件'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
info.fileNames = info.fileNames.substr(0, info.fileNames.length - 1);
|
||||||
|
let param = {
|
||||||
|
url: './jd',
|
||||||
|
data: {
|
||||||
|
cmd: 'com.actionsoft.apps.coe.pal.batch_files_import',
|
||||||
|
sid: settingParam.sessionId,
|
||||||
|
wsId: settingParam.wsId ? settingParam.wsId : '6f4e292c-1b90-4dd2-8c20-7da159cb20a5',
|
||||||
|
groupValue: info.groupValue,
|
||||||
|
fileValue: info.fileValue,
|
||||||
|
fileName: info.fileNames
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this.awsuiaxios.post(param)
|
||||||
|
.then((ro: any) => {
|
||||||
|
console.log(ro)
|
||||||
|
if (ro.result === 'ok') {
|
||||||
|
$this.$message({type:'warning',message:'附件数据导入成功'});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err: any) => {})
|
||||||
|
}
|
||||||
|
const handleUploadBtn = () => {
|
||||||
|
info.fileValue = 'BatchFilesType' + new Date().getTime()
|
||||||
|
info.uploadAction = axiosBaseUrl +'uf?sid='+settingParam.sessionId+'&repositoryName='+info.repositoryName+'&groupValue='
|
||||||
|
+ info.groupValue+'&fileValue='+info.fileValue+'&appId='+ info.appId;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
info,
|
||||||
|
handlePreview,
|
||||||
|
handleRemove,
|
||||||
|
beforeRemove,
|
||||||
|
handleExceed,
|
||||||
|
handleUploadBtn,
|
||||||
|
handleSuccess,
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.data-import {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #F7F7FB;
|
||||||
|
.top-box {
|
||||||
|
height: 75px;
|
||||||
|
margin: 0 35px 0 35px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.title-box {
|
||||||
|
line-height: 75px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.step-box {
|
||||||
|
width: 45%;
|
||||||
|
padding: 15px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bottom-box {
|
||||||
|
height: 650px;
|
||||||
|
margin: 0 35px 0 35px;
|
||||||
|
background-color: rgb(255,255,255);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
.empty-box {
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
.upload-box {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.file-list-box {
|
||||||
|
width: 100%;
|
||||||
|
:deep(.el-scrollbar) {
|
||||||
|
padding: 0 25px;
|
||||||
|
}
|
||||||
|
.scrollbar-demo-item {
|
||||||
|
font-size: 16px;
|
||||||
|
height: 35px;
|
||||||
|
margin: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--el-color-primary-light-9);
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
line-height: 35px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -50,6 +50,7 @@ import SystemImport from '@/components/system-import.vue';
|
|||||||
import PositionImport from '@/components/position-import.vue';
|
import PositionImport from '@/components/position-import.vue';
|
||||||
import ProcessVersionImport from "@/components/process-version-import.vue";
|
import ProcessVersionImport from "@/components/process-version-import.vue";
|
||||||
import SystemTextImport from "@/components/system-text-import.vue";
|
import SystemTextImport from "@/components/system-text-import.vue";
|
||||||
|
import BatchImportAccessories from "@/components/batch-import-accessories.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
@ -64,7 +65,8 @@ export default defineComponent({
|
|||||||
SystemImport,
|
SystemImport,
|
||||||
PositionImport,
|
PositionImport,
|
||||||
ProcessVersionImport,
|
ProcessVersionImport,
|
||||||
SystemTextImport
|
SystemTextImport,
|
||||||
|
BatchImportAccessories
|
||||||
},
|
},
|
||||||
setup(){
|
setup(){
|
||||||
// const { proxy: $this } = getCurrentInstance();
|
// const { proxy: $this } = getCurrentInstance();
|
||||||
@ -84,6 +86,7 @@ export default defineComponent({
|
|||||||
{label:"绩效导入",name:"performanceImport",icon:""},// word
|
{label:"绩效导入",name:"performanceImport",icon:""},// word
|
||||||
{label:"版本批处理",name:"processVersionImport",icon:""},// excel
|
{label:"版本批处理",name:"processVersionImport",icon:""},// excel
|
||||||
{label:"制度正文导入",name:"systemTextImport",icon:""},// xml
|
{label:"制度正文导入",name:"systemTextImport",icon:""},// xml
|
||||||
|
{label:"附件批量导入",name:"batchImportAccessories",icon:""},//
|
||||||
],
|
],
|
||||||
flagBit: 1
|
flagBit: 1
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user