修改上传文件组件

This commit is contained in:
qq787203167
2022-02-22 15:13:07 +08:00
parent ffe34f6313
commit 6c432ddfa5
4 changed files with 176 additions and 256 deletions
@@ -293,16 +293,25 @@
// moment(date).format('YYYY-MM-DD')
},
clickButtonToUpload(current) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = current
getAction('sys/common/getFileInfos', { connectId: this.formInline[current] }).then((res) => {
if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result)
} else {
this.$refs.uploadFile.perentHandleFunc()
}
})
},
/** 上传文件的回调 */
uploadSuccess(data) {
console.log(data)
let attIdList = []
data.map(item => {
attIdList.push(item.id || data.name)
})
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
+9 -7
View File
@@ -66,8 +66,8 @@
columns: [],
selectedRowKeys: [],
dataSource: [],
pageNo: '1',
pageSize: '10',
pageNo: 1,
pageSize: 10,
total: 0,
searchParmes: {},
loading: false
@@ -102,7 +102,7 @@
})
})
let width
if (this.OperationList.length > 0){
if (this.OperationList.length > 0) {
width = this.OperationList.length * 55
}
if (this.showAction) {
@@ -118,10 +118,12 @@
})
},
getTableList() {
let pageNo = JSON.parse(JSON.stringify(this.pageNo))
let pageSize = JSON.parse(JSON.stringify(this.pageSize))
let params = {
...this.searchParmes,
pageNo: this.pageNo,
pageSize: this.pageSize
pageNo: pageNo + '',
pageSize: pageSize + ''
}
this.loading = true
postAction(this.url.tableList, params).then((res) => {
@@ -133,11 +135,11 @@
})
},
onChange(page, pageSize) {
this.pageNo = page+''
this.pageNo = page
this.getTableList()
},
SizeChange(page, pageSize) {
this.pageSize = pageSize+''
this.pageSize = pageSize
this.getTableList()
},
onSelectChange() {
@@ -50,7 +50,6 @@
methods:{
perentHandleFunc(data){
this.myfileList = data
this.fileList = data
if (data && data.length > 0){
this.myfileList.forEach((res)=>{
res.name = res.fileName
@@ -58,7 +57,6 @@
})
}else {
this.myfileList = []
this.fileList = []
}
},
beforeUpload(file) {