bonus-ui/src/views/dataCenter/dataSet/child/datasetVersion.vue

225 lines
7.0 KiB
Vue
Raw Normal View History

2024-11-25 10:56:16 +08:00
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="85px">
2024-12-02 11:19:17 +08:00
<el-form-item label="版本号" prop="versionName">
2024-11-25 10:56:16 +08:00
<el-input
2024-11-27 13:43:59 +08:00
v-model="queryParams.versionName"
2024-12-02 11:19:17 +08:00
placeholder="请输入版本号"
2024-11-25 10:56:16 +08:00
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
2024-11-27 13:43:59 +08:00
v-hasPermi="['dataCenter:version:delete']"
2024-11-25 10:56:16 +08:00
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-close"
size="mini"
@click="handleClose"
>关闭</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table style="width: 100%" v-loading="loading" :data="list" :height="tableHeight" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
2024-11-27 13:43:59 +08:00
<el-table-column type="index" label="序号" :index="indexMethod" width="50" />
<el-table-column label="数据集名称" align="center" show-overflow-tooltip prop="datasetName" min-width="100" />
2024-11-25 10:56:16 +08:00
<el-table-column label="版本号" align="center" show-overflow-tooltip prop="versionName" min-width="100" />
2024-11-27 13:43:59 +08:00
<el-table-column label="发布人" align="center" show-overflow-tooltip prop="releaseUserName" min-width="100" />
2024-11-25 10:56:16 +08:00
<el-table-column label="发布时间" align="center" show-overflow-tooltip prop="createTime" min-width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
2024-11-27 13:43:59 +08:00
<el-table-column label="文件数量" align="center" show-overflow-tooltip prop="totalCount" min-width="100" />
<el-table-column label="任务名称" align="center" show-overflow-tooltip prop="taskName" min-width="100" />
<el-table-column label="标注类型" align="center" show-overflow-tooltip prop="annotationType" min-width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.ai_annotate_type" :value="scope.row.annotationType"/>
</template>
</el-table-column>
2024-11-25 10:56:16 +08:00
<el-table-column label="操作" align="center" min-width="100" class-name="small-padding fixed-width" >
<template slot-scope="scope">
2024-12-02 14:58:29 +08:00
<el-button
size="mini"
type="text"
@click="handleExport(scope.row)"
v-hasPermi="['dataCenter:version:delete']"
>导出</el-button>
2024-11-25 10:56:16 +08:00
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
2024-11-27 13:43:59 +08:00
v-hasPermi="['dataCenter:version:delete']"
2024-11-25 10:56:16 +08:00
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
2024-12-02 14:58:29 +08:00
import {list,remove,annotationsExport} from '@/api/dataCenter/releaseVersion'
2024-11-25 10:56:16 +08:00
export default {
2024-11-27 13:43:59 +08:00
dicts: ['ai_annotate_type'],
2024-11-25 10:56:16 +08:00
name: "DataSet",
data() {
return {
datasetId: 0,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
tableHeight: 0,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
addOpen: false,
releaseOpen: false,
annotationOpen:false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
2024-12-02 11:19:17 +08:00
versionName:undefined
2024-11-25 10:56:16 +08:00
},
};
},
created() {
this.datasetId = this.$route.params && this.$route.params.dataSetId;
this.getList();
// 初始化表格高度
this.updateTableHeight();
// 监听窗口大小变化
window.addEventListener("resize", this.updateTableHeight);
},
2024-11-27 13:43:59 +08:00
watch:{
datasetId(newVal, oldVal){
this.getList();
2024-12-02 11:19:17 +08:00
},
$route(to, from) {
// 每次路由变化时重新加载数据
if (to.fullPath !== from.fullPath) {
this.dataType = this.$route.query && this.$route.query.dataType
this.datasetId = this.$route.params && this.$route.params.dataSetId
this.getList()
// 初始化表格高度
this.updateTableHeight()
// 监听窗口大小变化
window.addEventListener('resize', this.updateTableHeight)
}
2024-11-27 13:43:59 +08:00
}
},
2024-11-25 10:56:16 +08:00
methods: {
2024-11-27 13:43:59 +08:00
indexMethod(index){
console.log(index);
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1;
},
2024-11-25 10:56:16 +08:00
updateTableHeight() {
// 设置表格高度为窗口高度减去其他元素高度
const headerHeight = 200; // 头部高度,可以调整
const footerHeight = 80; // 底部高度,可以调整
this.tableHeight = window.innerHeight - headerHeight - footerHeight;
},
/**获取数据 **/
getList(){
this.loading =true
2024-11-27 13:43:59 +08:00
this.queryParams.datasetId = this.datasetId;
2024-11-25 10:56:16 +08:00
list(this.queryParams).then(response => {
2024-11-27 13:43:59 +08:00
console.log(response);
2024-11-25 10:56:16 +08:00
this.list = response.rows;
this.total = response.total;
this.loading =false
})
},
/** 返回按钮操作 */
handleClose() {
const obj = { path: "/dataCenter/dataSet" };
this.$tab.closeOpenPage(obj);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
2024-12-02 14:58:29 +08:00
handleExport(row){
2024-12-03 09:02:06 +08:00
this.download('/ai/annotations/export/' + row.versionId,{}, new Date().getTime()+'.zip',{timeout: 600000})
2024-12-02 14:58:29 +08:00
},
2024-11-25 10:56:16 +08:00
handleDelete(row){
const ids = row.versionId || this.ids;
this.$modal.confirm('是否确认删除数据项?').then(function() {
return remove(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.versionId)
this.single = selection.length!==1
this.multiple = !selection.length
},
}
}
</script>
<style scoped>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style>