提交代码
This commit is contained in:
parent
4843acb1b4
commit
021533d01d
|
|
@ -71,5 +71,14 @@ export function manualAnnotate(data) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getLatestDatasetVersion(datasetId) {
|
||||
return request({
|
||||
url: '/ai/annotationTask/getLatestDatasetVersion/'+datasetId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,4 +31,12 @@ export function annotationsExport(taskId) {
|
|||
})
|
||||
}
|
||||
|
||||
export function listSelect(query) {
|
||||
return request({
|
||||
url: '/ai/version/listSelect',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="待审核个数" show-overflow-tooltip align="center" prop="createBy">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.totalCount - scope.row.status0Count }}</span>
|
||||
<span>{{ scope.row.totalCount - scope.row.status0Count - scope.row.status2Count }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" min-width="140" class-name="small-padding fixed-width">
|
||||
|
|
@ -118,8 +118,7 @@
|
|||
<add-task-dialog :open="addOpen" :get-list="getList" @dialog-cancel="handleCancel"></add-task-dialog>
|
||||
|
||||
<release-version-dialog :get-list="getList" :dataset-id="datasetId" :open="releaseOpen" :task-id="taskId"
|
||||
:last-version-name="lastVersionName" @dialog-cancel="handleCancel"
|
||||
></release-version-dialog>
|
||||
:last-version-name="lastVersionName" @dialog-cancel="handleCancel"></release-version-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
|
||||
import { add } from '@/api/dataCenter/releaseVersion'
|
||||
import { getLatestDatasetVersion } from '../../../../api/dataCenter/annotationTask'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
|
@ -41,7 +42,7 @@ export default {
|
|||
},
|
||||
getList: {
|
||||
type: Function,
|
||||
required: true,
|
||||
required: true
|
||||
},
|
||||
datasetId: {
|
||||
type: Number,
|
||||
|
|
@ -52,11 +53,6 @@ export default {
|
|||
type: Number,
|
||||
default: 0,
|
||||
required: true
|
||||
},
|
||||
lastVersionName: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -67,10 +63,11 @@ export default {
|
|||
set(value) {
|
||||
this.$emit('update:open', value)
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lastVersionName: null,
|
||||
form: {
|
||||
versionName: this.lastVersionName || '' // 初始化为传入的 lastVersionName
|
||||
}, // 初始化为空
|
||||
|
|
@ -85,30 +82,36 @@ export default {
|
|||
watch: {
|
||||
isOpen(newVal) {
|
||||
if (newVal) {
|
||||
if (this.isValidVersion(this.lastVersionName)) {
|
||||
this.form.versionName = this.incrementMajorVersion(this.lastVersionName);
|
||||
} else {
|
||||
this.form.versionName = 'V1.0.0'; // 如果格式不正确,则清空
|
||||
this.getLatestDatasetVersion(this.datasetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getLatestDatasetVersion(datasetId) {
|
||||
getLatestDatasetVersion(datasetId).then(response => {
|
||||
this.lastVersionName = response.msg;
|
||||
if (this.isValidVersion(this.lastVersionName)) {
|
||||
this.form.versionName = this.incrementMajorVersion(this.lastVersionName)
|
||||
} else {
|
||||
this.form.versionName = 'V1.0.0' // 如果格式不正确,则清空
|
||||
}
|
||||
})
|
||||
},
|
||||
// 判断版本号格式是否正确
|
||||
isValidVersion(version) {
|
||||
return /^V\d{1,3}(\.\d{1,3}){2}$/.test(version);
|
||||
return /^V\d{1,3}(\.\d{1,3}){2}$/.test(version)
|
||||
},
|
||||
|
||||
// 增加大版本号
|
||||
incrementMajorVersion(version) {
|
||||
const match = version.match(/^V(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
||||
const match = version.match(/^V(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
|
||||
if (match) {
|
||||
let major = parseInt(match[1], 10);
|
||||
let major = parseInt(match[1], 10)
|
||||
// 增加主版本号
|
||||
major += 1;
|
||||
return `V${major}.0.0`; // 返回新的版本号,次版本和修订号重置为 0
|
||||
major += 1
|
||||
return `V${major}.0.0` // 返回新的版本号,次版本和修订号重置为 0
|
||||
}
|
||||
return version; // 如果格式不符合,则返回原始版本号
|
||||
return version // 如果格式不符合,则返回原始版本号
|
||||
},
|
||||
// 数据提交
|
||||
submitForm() {
|
||||
|
|
@ -128,10 +131,11 @@ export default {
|
|||
this.isOpen = false
|
||||
this.reset()
|
||||
this.$emit('dialog-cancel') // 通知父组件
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.lastVersionName = ''
|
||||
this.form = { versionName: '' } // 清空表单
|
||||
this.$refs.form.resetFields() // 调用 Element UI 的重置方法
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,10 +224,10 @@ export default {
|
|||
let reviewers = []
|
||||
this.tableData.forEach((item) => {
|
||||
if (item.type === '0') {
|
||||
reviewers.push(item)
|
||||
reviewers.push(item.id)
|
||||
}
|
||||
if (item.type === '1') {
|
||||
annotators.push(item)
|
||||
annotators.push(item.id)
|
||||
}
|
||||
})
|
||||
this.form.annotators = annotators
|
||||
|
|
|
|||
|
|
@ -63,14 +63,12 @@
|
|||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleExport(scope.row)"
|
||||
v-hasPermi="['dataCenter:version:delete']"
|
||||
>导出</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dataCenter:version:delete']"
|
||||
>删除</el-button>
|
||||
|
|
@ -190,7 +188,7 @@ export default {
|
|||
},
|
||||
handleExport(row){
|
||||
|
||||
this.download('/ai/annotations/export/' + row.taskId,{},new Date().getTime()+'.zip',{timeout: 600000})
|
||||
this.download('/ai/annotations/export/' + row.versionId,{}, new Date().getTime()+'.zip',{timeout: 600000})
|
||||
},
|
||||
handleDelete(row){
|
||||
const ids = row.versionId || this.ids;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-dialog title="版本号选择" :visible.sync="isOpen" width="400px" append-to-body :modal="false" @close="cancel"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="版本号" prop="versionId">
|
||||
<el-select v-model="form.versionId" placeholder="请选择版本" clearable style="width: 100%">
|
||||
<el-option v-for="item in versionList" :key="item.versionId" :label="item.versionName"
|
||||
:value="item.versionId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { listSelect } from '../../../../api/dataCenter/releaseVersion'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
open: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
datasetId: {
|
||||
type: String,
|
||||
default: '',
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isOpen: {
|
||||
get() {
|
||||
return this.open
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:open', value)
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
versionList: [],
|
||||
form: {},
|
||||
rules: {
|
||||
versionId: [
|
||||
{ required: true, message: '请选择版本', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isOpen(newVal, oldVal) {
|
||||
if (newVal) {
|
||||
this.listSelect()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
listSelect() {
|
||||
listSelect({ datasetId: this.datasetId }).then(res => {
|
||||
this.versionList = res.data
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
this.download('/ai/annotations/export/' + this.form.versionId, {}, new Date().getTime() + '.zip', { timeout: 600000 }).then((res) => {
|
||||
this.cancel()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.isOpen = false
|
||||
this.reset()
|
||||
this.$emit('dialog-cancel') // 通知父组件
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.versionList = []
|
||||
this.form = {} // 清空表单
|
||||
this.$refs.form.resetFields() // 调用 Element UI 的重置方法
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
|
|
@ -25,7 +25,8 @@
|
|||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['dataCenter:dataSet:create']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -36,12 +37,15 @@
|
|||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['dataCenter:dataSet:delete']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</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 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="序号" :index="indexMethod" width="50"/>
|
||||
<el-table-column label="名称" align="center" show-overflow-tooltip prop="datasetName">
|
||||
|
|
@ -49,7 +53,8 @@
|
|||
<router-link :to="{
|
||||
path: '/dataCenter/dataSet-details/index/' + scope.row.datasetId,
|
||||
query: { dataType: scope.row.dataType,_t: Date.now() }
|
||||
}" class="link-type" @click="">
|
||||
}" class="link-type" @click=""
|
||||
>
|
||||
<span>{{ scope.row.datasetName }}</span>
|
||||
</router-link>
|
||||
</template>
|
||||
|
|
@ -83,33 +88,37 @@
|
|||
type="text"
|
||||
@click="handleImport(scope.row)"
|
||||
v-hasPermi="['dataCenter:dataSet:import']"
|
||||
>导入</el-button>
|
||||
>导入
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleAnnotation(scope.row)"
|
||||
v-hasPermi="['dataCenter:task:create']"
|
||||
>标注</el-button>
|
||||
>标注
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
||||
@click="downloadFile(scope.row)"
|
||||
v-hasPermi="['dataCenter:dataSet:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
||||
@click="handleVersion(scope.row)"
|
||||
v-hasPermi="['dataCenter:version:list']"
|
||||
>版本查看</el-button>
|
||||
>版本查看
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dataCenter:dataSet:delete']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -124,9 +133,18 @@
|
|||
<!-- 添加对话框 -->
|
||||
<add-data-set-dialog :get-list="getList" :open="addOpen" @dialog-cancel="handleCancel"/>
|
||||
<!--创建标注任务-->
|
||||
<annotation-task-dialog :datasetNum="datasetNum" :dataset-id="datasetId" :open="annotationOpen" @dialog-cancel="handleCancel"/>
|
||||
<annotation-task-dialog :datasetNum="datasetNum" :dataset-id="datasetId" :open="annotationOpen"
|
||||
@dialog-cancel="handleCancel"
|
||||
/>
|
||||
<!-- 导入 -->
|
||||
<import-dialog :get-list="getList" :open="importOpen" :data-type="dataType" :dataset-id="datasetId.toString()" @dialog-cancel="handleCancel"/>
|
||||
<import-dialog :get-list="getList" :open="importOpen" :data-type="dataType" :dataset-id="datasetId.toString()"
|
||||
@dialog-cancel="handleCancel"
|
||||
/>
|
||||
|
||||
<export-dialog :get-list="getList" :open="exportOpen" :dataset-id="datasetId.toString()"
|
||||
@dialog-cancel="handleCancel"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
|
@ -134,13 +152,12 @@
|
|||
import addDataSetDialog from '../child/addDataSetDialog.vue'
|
||||
import annotationTaskDialog from '../child/annotationTaskDialog.vue'
|
||||
import importDialog from '../child/importDialog.vue'
|
||||
|
||||
import exportDialog from '../child/exportDialog.vue'
|
||||
import { list, del, setPublic } from '@/api/dataCenter/dataSet'
|
||||
|
||||
|
||||
export default {
|
||||
components: { addDataSetDialog,annotationTaskDialog,importDialog},
|
||||
name: "DataSet",
|
||||
components: { addDataSetDialog, annotationTaskDialog, importDialog, exportDialog },
|
||||
name: 'DataSet',
|
||||
data() {
|
||||
return {
|
||||
dataType: '0',
|
||||
|
|
@ -166,87 +183,89 @@ export default {
|
|||
releaseOpen: false,
|
||||
annotationOpen: false,
|
||||
importOpen: false,
|
||||
exportOpen: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
datasetName: null,
|
||||
},
|
||||
};
|
||||
datasetName: null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList()
|
||||
// 初始化表格高度
|
||||
this.updateTableHeight();
|
||||
this.updateTableHeight()
|
||||
// 监听窗口大小变化
|
||||
window.addEventListener("resize", this.updateTableHeight);
|
||||
window.addEventListener('resize', this.updateTableHeight)
|
||||
},
|
||||
methods: {
|
||||
indexMethod(index) {
|
||||
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1;
|
||||
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
|
||||
},
|
||||
updateTableHeight() {
|
||||
// 设置表格高度为窗口高度减去其他元素高度
|
||||
const headerHeight = 300; // 头部高度,可以调整
|
||||
const footerHeight = 80; // 底部高度,可以调整
|
||||
this.tableHeight = window.innerHeight - headerHeight - footerHeight;
|
||||
const headerHeight = 300 // 头部高度,可以调整
|
||||
const footerHeight = 80 // 底部高度,可以调整
|
||||
this.tableHeight = window.innerHeight - headerHeight - footerHeight
|
||||
},
|
||||
/**获取数据 **/
|
||||
getList() {
|
||||
this.loading = true
|
||||
list(this.queryParams).then(response => {
|
||||
console.log(response);
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
console.log(response)
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
handleAdd() {
|
||||
this.addOpen = true;
|
||||
this.addOpen = true
|
||||
},
|
||||
handleAnnotation(row) {
|
||||
this.annotationOpen = true;
|
||||
this.datasetId = row.datasetId;
|
||||
this.datasetNum = row.notAnnotatedCount;
|
||||
this.annotationOpen = true
|
||||
this.datasetId = row.datasetId
|
||||
this.datasetNum = row.notAnnotatedCount
|
||||
},
|
||||
handleImport(row) {
|
||||
this.importOpen = true;
|
||||
this.datasetId = row.datasetId;
|
||||
this.dataType = row.dataType;
|
||||
this.importOpen = true
|
||||
this.datasetId = row.datasetId
|
||||
this.dataType = row.dataType
|
||||
},
|
||||
handleUpdate() {
|
||||
|
||||
},
|
||||
handleVersion(row) {
|
||||
this.$tab.openPage("数据集版本管理", '/dataCenter/dataSet-version/index/' + row.datasetId,
|
||||
{_t: Date.now() });
|
||||
this.$tab.openPage('数据集版本管理', '/dataCenter/dataSet-version/index/' + row.datasetId,
|
||||
{ _t: Date.now() })
|
||||
},
|
||||
getPercentage(row) {
|
||||
if (row.annotatedCount > 0 && row.notAnnotatedCount >= 0) {
|
||||
let percentage = ((row.annotatedCount - row.notAnnotatedCount) / row.annotatedCount) * 100;
|
||||
let percentage = ((row.annotatedCount - row.notAnnotatedCount) / row.annotatedCount) * 100
|
||||
// 确保 percentage 在 0 到 100 之间
|
||||
return Math.min(Math.max(percentage, 0), 100);
|
||||
return Math.min(Math.max(percentage, 0), 100)
|
||||
}
|
||||
return 0; // 如果没有标注数据,返回 0%
|
||||
return 0 // 如果没有标注数据,返回 0%
|
||||
},
|
||||
handleDelete(row) {
|
||||
const ids = row.datasetId || this.ids;
|
||||
const ids = row.datasetId || this.ids
|
||||
this.$modal.confirm('是否确认删除数据项?').then(function() {
|
||||
return del(ids);
|
||||
return del(ids)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
change(row) {
|
||||
let text = row.isPublic === '0' ? '不公开' : '公开'
|
||||
|
|
@ -266,13 +285,14 @@ export default {
|
|||
},
|
||||
// 处理取消事件
|
||||
handleCancel() {
|
||||
this.addOpen = false;
|
||||
this.annotationOpen = false;
|
||||
this.importOpen = false;
|
||||
this.addOpen = false
|
||||
this.annotationOpen = false
|
||||
this.importOpen = false
|
||||
this.exportOpen = false
|
||||
},
|
||||
downloadFile(row) {
|
||||
const datasetId = row.datasetId;
|
||||
this.download('/ai/dataset/export/'+datasetId,{},`${new Date().getTime()}.zip`,{timeout: 600000})
|
||||
this.exportOpen = true
|
||||
this.datasetId = row.datasetId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -281,10 +301,12 @@ export default {
|
|||
.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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue