工具-功能联调

main
ysn 10 hours ago
parent 53ff0ebabe
commit 9a659a4475
  1. 52
      src/views/utility/index.vue

@ -51,7 +51,13 @@
<el-table-column label="进度" width="150" align="center">
<template slot-scope="scope">
<div class="progress-container">
<el-progress :percentage="scope.row.is_success ? 100 : 0" />
<el-progress
:percentage="
scope.row.is_success
? 100
: scope.row.upload_percent || 0
"
/>
</div>
</template>
</el-table-column>
@ -68,25 +74,15 @@
<el-table-column label="状态" width="100" align="center">
<template slot-scope="scope">
<el-tag
:type="
getStatusType(
scope.row.transfer_type,
scope.row
)
"
:type="getStatusType(scope.row.transfer_type, scope.row)"
size="mini"
>
{{
getStatusText(
scope.row.transfer_type,
scope.row
)
}}
{{ getStatusText(scope.row.transfer_type, scope.row) }}
</el-tag>
</template>
</el-table-column>
<!-- 操作按钮 -->
<el-table-column label="操作" width="180" align="center">
<el-table-column label="操作" width="220" align="center">
<template slot-scope="scope">
<el-button
v-if="scope.row.transfer_type === 3 && scope.row.file_url"
@ -104,24 +100,14 @@
>
打开位置
</el-button>
<!-- <el-button
v-if="scope.row.transfer_type === 1"
type="text"
size="mini"
icon="el-icon-upload2"
disabled
>
已上传
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-delete"
style="color: #f56c6c"
@click="handleDeleteItem(scope.row)"
>
删除
</el-button> -->
</el-button>
</template>
</el-table-column>
</el-table>
@ -251,7 +237,6 @@ export default {
getStatusText(type, row) {
const isSuccess = row.is_success;
const isUploading = row.is_uploading;
if (type === 3) {
//
if (isUploading && !isSuccess) return "上传中";
@ -267,7 +252,6 @@ export default {
getStatusType(type, row) {
const isSuccess = row.is_success;
const isUploading = row.is_uploading;
if (isUploading && !isSuccess) return "warning";
if (!isSuccess) return "danger";
return "success";
@ -284,10 +268,12 @@ export default {
//
handleOpenLocation(item) {
if (item.file_url) {
this.$modal.msg("浏览器安全限制:请下载后在下载列表打开文件夹");
this.$modal.msg("浏览器安全限制:请下载文件后在下载列表中打开文件夹");
//
const a = document.createElement("a");
a.href = item.file_url;
a.download = item.file_name;
a.target = "_blank";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@ -340,6 +326,16 @@ export default {
const record = this.transferRecords.find((r) => r.id === id);
if (record) {
record.is_success = isSuccess;
record.is_uploading = false;
this.saveTransferRecords();
}
},
//
updateUploadProgress(id, percent) {
const record = this.transferRecords.find((r) => r.id === id);
if (record) {
record.upload_percent = percent;
record.is_uploading = percent < 100;
this.saveTransferRecords();
}
},

Loading…
Cancel
Save