添加上传文件选择模式

This commit is contained in:
RenCheng 2025-03-02 23:06:18 +08:00
parent f91d4b9de7
commit 6642af099f
2 changed files with 30 additions and 6 deletions

View File

@ -2,6 +2,11 @@
<div>
<a-row type="flex">
<a-col flex="auto">
<a-select placeholder="选择模式" option-filter-prop="children" size="large" v-model="schemaName" style="width: 200px;">
<a-select-option v-for="d in allSchemaName" :key="d">
{{ d }}
</a-select-option>
</a-select>
<a-upload
class="upload-wrapper"
:showUploadList="false"
@ -55,7 +60,7 @@
<script>
import SparkMD5 from 'spark-md5'
import { postAction,downloadFile2 } from '@/api/manage'
import { getAction,postAction,downloadFile2 } from '@/api/manage'
import { verifyFileExist } from '@/api/fileapi'
@ -87,7 +92,7 @@ export default {
dataLinkType: {
type: String,
default: '1'
}
},
},
data () {
return {
@ -95,9 +100,14 @@ export default {
isStop: false,
fileList: [],
tableDate: [],
schemaName:"",
allSchemaName:[]
}
},
created () {
this.getAllSchemaName();
this.deleteFile();
},
methods: {
stop (record) {
this.isStop = true
@ -119,15 +129,24 @@ export default {
}
})
},
//
setFileList (fileList) {
this.tableDate = fileList
},
deleteFile () {
this.fileList = []
this.tableDate = []
this.schemaName =""
},
getAllSchemaName(){
getAction("/fileDataLink/getAllSchemaName").then((res) => {
if (res.success) {
console.log(res)
this.allSchemaName = res.result;
}else{
this.$message.warning(res.message);
}
});
},
getFileList () {
return this.tableDate
@ -177,6 +196,10 @@ export default {
* 自定义上传事件
*/
customRequestUpload ({ file }) {
if(this.schemaName ==""){
this.$message.warning("请先选择上传的模式");
return
}
//
const currentRow = this.tableDate.find((row) => row.uid === file.uid)
if (currentRow) {
@ -243,6 +266,7 @@ export default {
formData.append('currShareM5', currShareM5)
formData.append('file', file)
formData.append("dataLinkType",this.dataLinkType);
formData.append("schemaName",this.schemaName);
return formData
},
@ -394,7 +418,6 @@ export default {
<style lang="less" scoped>
.upload-wrapper{
display: inline-block;
width: calc(100% - 10px);
/deep/.ant-upload{
width: 100%;
}

View File

@ -93,6 +93,7 @@
tableName:'',
dataLinkType:'1'
},
schemaName:"",
columns: [
{
title: '#',