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

189 lines
5.8 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">
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入数据集名称"
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"
v-hasPermi="['dataCenter:dataSet:remove']"
>删除</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" />
<el-table-column type="index" label="序号" min-width="50" />
<el-table-column label="数据集名称" align="center" show-overflow-tooltip prop="versionName" min-width="100" />
<el-table-column label="版本号" align="center" show-overflow-tooltip prop="versionName" min-width="100" />
<el-table-column label="发布人" align="center" show-overflow-tooltip prop="fileName" min-width="100" />
<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>
<el-table-column label="文件数量" align="center" show-overflow-tooltip prop="fileName" min-width="100" />
<el-table-column label="任务名称" align="center" show-overflow-tooltip prop="fileName" min-width="100" />
<el-table-column label="标注类型" align="center" show-overflow-tooltip prop="fileName" min-width="100" />
<el-table-column label="已审核数量" align="center" show-overflow-tooltip prop="fileName" min-width="100" />
<el-table-column label="操作" align="center" min-width="100" class-name="small-padding fixed-width" >
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dataCenter:sample:remove']"
>删除</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>
import {list,remove} from '@/api/dataCenter/releaseVersion'
export default {
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,
},
};
},
created() {
this.datasetId = this.$route.params && this.$route.params.dataSetId;
this.getList();
// 初始化表格高度
this.updateTableHeight();
// 监听窗口大小变化
window.addEventListener("resize", this.updateTableHeight);
},
methods: {
updateTableHeight() {
// 设置表格高度为窗口高度减去其他元素高度
const headerHeight = 200; // 头部高度,可以调整
const footerHeight = 80; // 底部高度,可以调整
this.tableHeight = window.innerHeight - headerHeight - footerHeight;
},
/**获取数据 **/
getList(){
this.loading =true
this.queryParams.dataSetId = this.datasetId;
list(this.queryParams).then(response => {
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();
},
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>