添加上传文件选择模式
This commit is contained in:
parent
f91d4b9de7
commit
6642af099f
|
@ -2,6 +2,11 @@
|
||||||
<div>
|
<div>
|
||||||
<a-row type="flex">
|
<a-row type="flex">
|
||||||
<a-col flex="auto">
|
<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
|
<a-upload
|
||||||
class="upload-wrapper"
|
class="upload-wrapper"
|
||||||
:showUploadList="false"
|
:showUploadList="false"
|
||||||
|
@ -55,7 +60,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import SparkMD5 from 'spark-md5'
|
import SparkMD5 from 'spark-md5'
|
||||||
import { postAction,downloadFile2 } from '@/api/manage'
|
import { getAction,postAction,downloadFile2 } from '@/api/manage'
|
||||||
import { verifyFileExist } from '@/api/fileapi'
|
import { verifyFileExist } from '@/api/fileapi'
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +92,7 @@ export default {
|
||||||
dataLinkType: {
|
dataLinkType: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '1'
|
default: '1'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -95,9 +100,14 @@ export default {
|
||||||
isStop: false,
|
isStop: false,
|
||||||
fileList: [],
|
fileList: [],
|
||||||
tableDate: [],
|
tableDate: [],
|
||||||
|
schemaName:"",
|
||||||
|
allSchemaName:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.getAllSchemaName();
|
||||||
|
this.deleteFile();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
stop (record) {
|
stop (record) {
|
||||||
this.isStop = true
|
this.isStop = true
|
||||||
|
@ -119,15 +129,24 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 从外部设置已有文件列表
|
// 从外部设置已有文件列表
|
||||||
setFileList (fileList) {
|
setFileList (fileList) {
|
||||||
this.tableDate = fileList
|
this.tableDate = fileList
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteFile () {
|
deleteFile () {
|
||||||
this.fileList = []
|
this.fileList = []
|
||||||
this.tableDate = []
|
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 () {
|
getFileList () {
|
||||||
return this.tableDate
|
return this.tableDate
|
||||||
|
@ -177,6 +196,10 @@ export default {
|
||||||
* 自定义上传事件
|
* 自定义上传事件
|
||||||
*/
|
*/
|
||||||
customRequestUpload ({ file }) {
|
customRequestUpload ({ file }) {
|
||||||
|
if(this.schemaName ==""){
|
||||||
|
this.$message.warning("请先选择上传的模式");
|
||||||
|
return
|
||||||
|
}
|
||||||
// 开始执行上传逻辑
|
// 开始执行上传逻辑
|
||||||
const currentRow = this.tableDate.find((row) => row.uid === file.uid)
|
const currentRow = this.tableDate.find((row) => row.uid === file.uid)
|
||||||
if (currentRow) {
|
if (currentRow) {
|
||||||
|
@ -243,6 +266,7 @@ export default {
|
||||||
formData.append('currShareM5', currShareM5)
|
formData.append('currShareM5', currShareM5)
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
formData.append("dataLinkType",this.dataLinkType);
|
formData.append("dataLinkType",this.dataLinkType);
|
||||||
|
formData.append("schemaName",this.schemaName);
|
||||||
return formData
|
return formData
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -394,7 +418,6 @@ export default {
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.upload-wrapper{
|
.upload-wrapper{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: calc(100% - 10px);
|
|
||||||
/deep/.ant-upload{
|
/deep/.ant-upload{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
tableName:'',
|
tableName:'',
|
||||||
dataLinkType:'1'
|
dataLinkType:'1'
|
||||||
},
|
},
|
||||||
|
schemaName:"",
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: '#',
|
title: '#',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user