提交代码

This commit is contained in:
jiang 2024-12-03 09:02:06 +08:00
parent 4843acb1b4
commit 021533d01d
8 changed files with 248 additions and 109 deletions

View File

@ -71,5 +71,14 @@ export function manualAnnotate(data) {
})
}
export function getLatestDatasetVersion(datasetId) {
return request({
url: '/ai/annotationTask/getLatestDatasetVersion/'+datasetId,
method: 'get'
})
}

View File

@ -31,4 +31,12 @@ export function annotationsExport(taskId) {
})
}
export function listSelect(query) {
return request({
url: '/ai/version/listSelect',
method: 'get',
params: query
})
}

View File

@ -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>

View File

@ -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
}

View File

@ -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

View File

@ -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;

View File

@ -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>

View File

@ -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;