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

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

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

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

Loading…
Cancel
Save