Commit 9c48b908 authored by 赵啸非's avatar 赵啸非

更新附件添加多个设置

parent f7aff401
...@@ -113,6 +113,42 @@ export default { ...@@ -113,6 +113,42 @@ export default {
value: { value: {
handler(val) { handler(val) {
if (val) { if (val) {
this.showFileList();
// let temp = 1;
// // 首先将值转为数组
// const filePathlist = this.value.split(',');
// // 然后将数组转为对象数组
// const fileNamelist =this.fileName.split(',');
// for (var i = 0; i < filePathlist.length; i++) {
// let item = {}
// console.log(fileNamelist.length===filePathlist.length)
// if(fileNamelist.length===filePathlist.length){
// item.name = fileNamelist[i];
// }else{
// item.name = filePathlist[i];
// }
// item.url = filePathlist[i];
// item.uid = new Date().getTime() + temp++;
// this.fileList.push(item)
// }
} else {
this.fileList = [];
return [];
}
}
}
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
showFileList(){
let temp = 1; let temp = 1;
// 首先将值转为数组 // 首先将值转为数组
const filePathlist = this.value.split(','); const filePathlist = this.value.split(',');
...@@ -120,31 +156,19 @@ export default { ...@@ -120,31 +156,19 @@ export default {
const fileNamelist =this.fileName.split(','); const fileNamelist =this.fileName.split(',');
for (var i = 0; i < filePathlist.length; i++) { for (var i = 0; i < filePathlist.length; i++) {
let item = {} let item = {}
console.log(fileNamelist.length===filePathlist.length) console.log(fileNamelist.length === filePathlist.length)
if(fileNamelist.length===filePathlist.length){ if (fileNamelist.length === filePathlist.length) {
item.name = fileNamelist[i]; item.name = fileNamelist[i];
}else{ } else {
item.name = filePathlist[i]; item.name = filePathlist[i];
} }
item.url = filePathlist[i]; item.url = filePathlist[i];
item.uid = new Date().getTime() + temp++; item.uid = new Date().getTime() + temp++;
this.fileList.push(item) this.fileList.push(item)
} }
} else {
this.fileList = [];
return [];
}
}
}
}, },
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
// 上传前校检格式和大小 // 上传前校检格式和大小
handleBeforeUpload(file) { handleBeforeUpload(file) {
// 校检文件类型 // 校检文件类型
...@@ -218,6 +242,8 @@ export default { ...@@ -218,6 +242,8 @@ export default {
} }
}, },
created() { created() {
console.log("file create")
this.showFileList();
// this.fileList = this.list; // this.fileList = this.list;
}, },
}; };
......
...@@ -102,7 +102,7 @@ function getComponent(fileName) { ...@@ -102,7 +102,7 @@ function getComponent(fileName) {
try { try {
return require('./views/' + fileName).default return require('./views/' + fileName).default
} catch (error) { } catch (error) {
console.log("error:",error) //console.log("error:",error)
return fileNotFound; return fileNotFound;
} }
} }
......
...@@ -125,8 +125,6 @@ ...@@ -125,8 +125,6 @@
}, },
/**获取数据后弹框 */ /**获取数据后弹框 */
afterRender(data) { afterRender(data) {
console.log(data)
console.log(this.form)
this.open = true; this.open = true;
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment