修复了在当前表格当前页删除为空的情况下页面被锁死的bug
This commit is contained in:
@@ -12,9 +12,7 @@
|
||||
:show-file-list="false"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
只能上传jpg/png文件,且不超过500kb
|
||||
</div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -35,33 +33,20 @@
|
||||
<div>{{ scope.row.UpdatedAt | formatDate }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="文件名"
|
||||
prop="name"
|
||||
width="180"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="链接"
|
||||
prop="url"
|
||||
min-width="300"
|
||||
></el-table-column>
|
||||
<el-table-column label="文件名" prop="name" width="180"></el-table-column>
|
||||
<el-table-column label="链接" prop="url" min-width="300"></el-table-column>
|
||||
<el-table-column label="标签" prop="tag" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="scope.row.tag === 'jpg' ? 'primary' : 'success'"
|
||||
disable-transitions
|
||||
>{{ scope.row.tag }}</el-tag
|
||||
>
|
||||
>{{ scope.row.tag }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="downloadFile(scope.row)" size="small" type="text"
|
||||
>下载</el-button
|
||||
>
|
||||
<el-button @click="deleteFile(scope.row)" size="small" type="text"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button @click="downloadFile(scope.row)" size="small" type="text">下载</el-button>
|
||||
<el-button @click="deleteFile(scope.row)" size="small" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -93,7 +78,7 @@ export default {
|
||||
mixins: [infoList],
|
||||
components: {
|
||||
CustomPic,
|
||||
UploadImage,
|
||||
UploadImage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -101,43 +86,46 @@ export default {
|
||||
listApi: getFileList,
|
||||
path: path,
|
||||
tableData: [],
|
||||
imageUrl: "",
|
||||
imageUrl: ""
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters("user", ["userInfo", "token"]),
|
||||
...mapGetters("user", ["userInfo", "token"])
|
||||
},
|
||||
filters: {
|
||||
formatDate: function (time) {
|
||||
formatDate: function(time) {
|
||||
if (time != null && time != "") {
|
||||
var date = new Date(time);
|
||||
return formatTimeToStr(date, "yyyy-MM-dd hh:mm:ss");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async deleteFile(row) {
|
||||
this.$confirm("此操作将永久文件, 是否继续?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteFile(row);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "删除成功!",
|
||||
message: "删除成功!"
|
||||
});
|
||||
if (this.tableData.length == 1) {
|
||||
this.page--;
|
||||
}
|
||||
this.getTableData();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: "info",
|
||||
message: "已取消删除",
|
||||
message: "已取消删除"
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -161,7 +149,7 @@ export default {
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "上传成功",
|
||||
message: "上传成功"
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.getTableData();
|
||||
@@ -169,23 +157,23 @@ export default {
|
||||
} else {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: res.msg,
|
||||
message: res.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
uploadError() {
|
||||
this.$message({
|
||||
type: "error",
|
||||
message: "上传失败",
|
||||
message: "上传失败"
|
||||
});
|
||||
this.fullscreenLoading = false;
|
||||
},
|
||||
downloadFile(row) {
|
||||
downloadImage(row.url, row.name);
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableData();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user