style: 优化单个文件重建索引操作

This commit is contained in:
jmal 2024-07-12 16:29:53 +08:00
parent ba3686bf80
commit b117cad0f3

View File

@ -17,7 +17,19 @@
</div> </div>
<el-form class="details-form"> <el-form class="details-form">
<el-form-item label="重建索引:" class="details-scan"> <el-form-item label="重建索引:" class="details-scan">
<el-button type="primary" size="mini" :loading="syncLoading" @click="scanDirectory(rowContextData)" ><i class="el-icon-refresh"></i></el-button> <el-popover
placement="bottom"
trigger="click">
<p class="el-popconfirm__main">
<i class="el-popconfirm__icon el-icon-question" style="color: rgb(255, 153, 0);"></i>
是否开始扫描?
</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="cancelScan()">取消</el-button>
<el-button type="primary" size="mini" @click="scanDirectory(rowContextData)">确定</el-button>
</div>
<el-button slot="reference" id="scanDirectoryBtn-file" type="primary" size="small" :loading="syncLoading"><i class="el-icon-refresh"></i></el-button>
</el-popover>
<span v-show="syncPercent < 100">正在同步文件基本信息: {{ syncPercent }}%</span> <span v-show="syncPercent < 100">正在同步文件基本信息: {{ syncPercent }}%</span>
<span v-show="indexingPercent > 0 && indexingPercent < 100">正在为文件内容创建索引: </span><span v-show="indexingPercent > 0 && indexingPercent < 100">{{ indexingPercent }}%</span> <span v-show="indexingPercent > 0 && indexingPercent < 100">正在为文件内容创建索引: </span><span v-show="indexingPercent > 0 && indexingPercent < 100">{{ indexingPercent }}%</span>
</el-form-item> </el-form-item>
@ -162,20 +174,18 @@ export default {
} }
this.syncLoading = !((this.syncPercent === 100 && this.indexingPercent === 100) || (this.syncPercent === 0 && this.indexingPercent === 0)); this.syncLoading = !((this.syncPercent === 100 && this.indexingPercent === 100) || (this.syncPercent === 0 && this.indexingPercent === 0));
}, },
cancelScan() {
document.getElementById('scanDirectoryBtn-file').click()
},
scanDirectory(file) { scanDirectory(file) {
this.$confirm('是否开始扫描? ', '提示', { this.cancelScan()
confirmButtonText: '确定', this.syncLoading = true
cancelButtonText: '取消', this.syncPercent = 0
type: 'warning' this.clickSync = true
}).then(() => { settingApi.syncUser({username: this.$store.state.user.name, path: decodeURIComponent(file.path + file.name)}).then(() => {
this.syncLoading = true this.clickSync = false
this.syncPercent = 0 }).catch(() => {
this.clickSync = true this.clickSync = false
settingApi.syncUser({username: this.$store.state.user.name, path: decodeURIComponent(file.path + file.name)}).then(() => {
this.clickSync = false
}).catch(() => {
this.clickSync = false
})
}) })
}, },
} }
@ -216,6 +226,9 @@ export default {
} }
>>> .details-scan { >>> .details-scan {
.el-form-item__label {
line-height: 32.5px;
}
margin-bottom: 10px; margin-bottom: 10px;
.el-button--mini, .el-button--mini.is-round { .el-button--mini, .el-button--mini.is-round {
padding: 5px 15px; padding: 5px 15px;