舆情报告文件上传修改⌈ 由填写文件地址改为上传文件格式 ⌋、去除多余打印的日志

main
吕天方 7 months ago
parent 1f9bea81f0
commit 7296b32051

@ -473,7 +473,7 @@ export default {
this.form.fileName = ""; this.form.fileName = "";
this.form.fileUrl = ""; this.form.fileUrl = "";
} }
console.log(this.form, "this.form"); // console.log(this.form, "this.form");
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {

@ -287,7 +287,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="上传文件"> <el-form-item label="上传文件">
<div class="updataFile"> <!-- <div class="updataFile">
<div class="fileHeader"> <div class="fileHeader">
<div class="names">文件名称</div> <div class="names">文件名称</div>
<div class="urls">文件路径(完整路径)</div> <div class="urls">文件路径(完整路径)</div>
@ -318,7 +318,8 @@
<div @click="removeFile(index)" class="fileIcon"> <div @click="removeFile(index)" class="fileIcon">
<i class="el-icon-remove-outline"></i> <i class="el-icon-remove-outline"></i>
</div> </div>
</div> </div> -->
<fileUpload v-model="fileNameS" :limit="1" />
</el-form-item> </el-form-item>
<el-form-item label="标题名称" prop="title"> <el-form-item label="标题名称" prop="title">
<el-input v-model="form.title" placeholder="请输入标题名称" /> <el-input v-model="form.title" placeholder="请输入标题名称" />
@ -534,7 +535,7 @@ export default {
}, },
methods: { methods: {
files(e) { files(e) {
console.log(e); // console.log(e);
if (!e.fileUrl) return []; if (!e.fileUrl) return [];
let newA = e.fileUrl.split(","); let newA = e.fileUrl.split(",");
let newB = e.fileName.split(","); let newB = e.fileName.split(",");
@ -624,30 +625,30 @@ export default {
.catch(() => {}); .catch(() => {});
}, },
// //
addFile() { // addFile() {
if (this.fileNameS.length <= 0) { // if (this.fileNameS.length <= 0) {
this.fileNameS.push({ // this.fileNameS.push({
fileName: "", // fileName: "",
fileUrl: "", // fileUrl: "",
}); // });
} else { // } else {
if ( // if (
this.fileNameS[this.fileNameS.length - 1].fileUrl != "" && // this.fileNameS[this.fileNameS.length - 1].fileUrl != "" &&
this.fileNameS[this.fileNameS.length - 1].fileName != "" // this.fileNameS[this.fileNameS.length - 1].fileName != ""
) { // ) {
this.fileNameS.push({ // this.fileNameS.push({
fileName: "", // fileName: "",
fileUrl: "", // fileUrl: "",
}); // });
} else { // } else {
this.$modal.msgError("请完整填写上一条"); // this.$modal.msgError("");
} // }
} // }
}, // },
// //
removeFile(index) { // removeFile(index) {
this.fileNameS.splice(index, 1); // this.fileNameS.splice(index, 1);
}, // },
/** 查询舆情报告列表 */ /** 查询舆情报告列表 */
getList(e) { getList(e) {
this.loading = true; this.loading = true;
@ -738,12 +739,13 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.fileNameS = [ this.fileNameS = []
{ // this.fileNameS = [
fileName: "", // {
fileUrl: "", // fileName: "",
}, // fileUrl: "",
]; // },
// ];
this.open = true; this.open = true;
this.title = "添加舆情报告"; this.title = "添加舆情报告";
}, },
@ -787,11 +789,22 @@ export default {
submitForm() { submitForm() {
let arr1 = []; let arr1 = [];
let arr2 = []; let arr2 = [];
let reg = new RegExp("http");
if (this.fileNameS.length > 0) { if (this.fileNameS.length > 0) {
// this.fileNameS.forEach((value) => {
// if (value.fileName && value.fileUrl) {
// arr1.push(value.fileName);
// arr2.push(value.fileUrl);
// }
// });
// this.form.fileName = arr1.join(",");
// this.form.fileUrl = arr2.join(",");
this.fileNameS.forEach((value) => { this.fileNameS.forEach((value) => {
if (value.fileName && value.fileUrl) { arr1.push(value.name);
arr1.push(value.fileName); if (reg.test(value.url)) {
arr2.push(value.fileUrl); arr2.push(value.url);
} else {
arr2.push(process.env.VUE_APP_BASE_API + value.url);
} }
}); });
this.form.fileName = arr1.join(","); this.form.fileName = arr1.join(",");

Loading…
Cancel
Save