智能标注服务管理页面和智能标注页面开发

This commit is contained in:
weiweiw 2024-12-17 13:35:29 +08:00
parent 20fab8c85b
commit 95a08837ef
5 changed files with 493 additions and 5 deletions

View File

@ -0,0 +1,46 @@
import request from '@/utils/request'
// 查询【请填写功能名称】列表
export function list(query) {
return request({
url: '/ai/intelligentAnnotation/service/list',
method: 'get',
params: query
})
}
// 查询【请填写功能名称】详细
export function getService(id) {
return request({
url: '/ai/intelligentAnnotation/getInfo/' + id,
method: 'get'
})
}
// 新增【请填写功能名称】
export function addService(data) {
return request({
url: '/ai/intelligentAnnotation/add',
method: 'post',
data: data
})
}
// 修改【请填写功能名称】
export function updateService(data) {
return request({
url: '/ai/intelligentAnnotation/update',
method: 'post',
data: data
})
}
export function delService(id) {
return request({
url: '/ai/intelligentAnnotation/delete/' + id,
method: 'post'
})
}

View File

@ -0,0 +1,277 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="智能标注服务名称" prop="serviceName" label-width="140px">
<el-input
v-model="queryParams.serviceName"
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="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['dataCenter:ailabelservice:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['dataCenter:ailabelservice:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['dataCenter:ailabelservice:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="serviceList" :height="tableHeight" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" :index="indexMethod" width="80" />
<el-table-column label="服务名称" align="center" prop="serviceName" />
<el-table-column label="服务地址" align="center" prop="serviceUrl" />
<el-table-column label="添加人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dataCenter:ailabelservice:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dataCenter:ailabelservice: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"
/>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules">
<el-form-item label="服务名称" prop="serviceName">
<el-input v-model="form.serviceName" maxlength="20" placeholder="请输入服务名称" />
</el-form-item>
<el-form-item label="服务地址" prop="serviceUrl">
<el-input v-model="form.serviceUrl" maxlength="100" placeholder="请输入服务地址带端口信息" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { list, getService, delService, addService, updateService} from "@/api/dataCenter/ailabelservice";
export default {
name: "Sample",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
tableHeight: 0,
//
showSearch: true,
//
total: 0,
//
serviceList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
serviceName: null,
serviceUrl: null,
},
//
form: {},
//
rules: {
serviceName: [
{ required: true, message: '智能标注服务名称不能为空', trigger: 'blur' },
{ min: 2, max: 20, message: '智能标注任务名称长度必须介于 2 和 20 之间', trigger: 'blur' }
],
serviceUrl: [
{ required: true, message: '智能标注服务地址不能为空', trigger: 'blur' },
{ min: 1, max: 200, message: '智能标注服务地址长度必须介于 1 和 200 之间', trigger: 'blur' }
],
}
};
},
mounted() {
},
created() {
this.getList();
//
this.updateTableHeight();
//
window.addEventListener("resize", this.updateTableHeight);
},
beforeDestroy() {
window.removeEventListener("resize", this.updateTableHeight);
},
methods: {
indexMethod(index){
console.log(index);
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1;
},
updateTableHeight() {
//
const headerHeight = 200; //
const footerHeight = 80; //
this.tableHeight = window.innerHeight - headerHeight - footerHeight;
},
/** 查询列表 */
getList() {
this.loading = true;
list(this.queryParams).then(response => {
console.log('service list:' + response)
this.serviceList = response.rows;
this.total = response.total;
console.log('response.total:' + this.total)
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
serviceName: null,
serviceUrl: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.serviceId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.serviceId || this.ids
getService(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.serviceId != null) {
updateService(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addService(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.serviceId || this.ids;
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delService(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
};
</script>

View File

@ -104,6 +104,8 @@
v-hasPermi="['dataCenter:sample:edit']"
>发布
</el-button>
<ai-label-dialog ref="aiLabelDialog" />
</template>
</el-table-column>
</el-table>
@ -131,9 +133,10 @@ import { list, setPublic } from '@/api/dataCenter/annotationTask'
import addTaskDialog from '../dialog/addTaskDialog'
import releaseVersionDialog from '../dialog/releaseVersionDialog.vue'
import { parseTime } from '@/utils/bonus'
import AILabelDialog from "@/views/dataCenter/annotationTask/dialog/aiLabelDialog.vue";
export default {
components: { releaseVersionDialog, addTaskDialog },
components: {AILabelDialog, releaseVersionDialog, addTaskDialog },
name: 'allTasks',
data() {
return {
@ -171,7 +174,8 @@ export default {
pageNum: 1,
pageSize: 10,
taskName: null
}
},
showModal: false
}
},
created() {
@ -228,7 +232,12 @@ export default {
this.releaseOpen = true
},
handleDimension(row) {
this.$modal.msgSuccess('功能开发中')
const annotationInstance = this.$root.$refs.aiLabelDialog
if (annotationInstance) {
annotationInstance.show(row)
} else {
console.error('SmartAnnotation component not found')
}
},
handleAnnotation(row) {
this.$tab.openPage('数据标注', '/dataCenter/annotationTask/dataAnnotations/index/' + row.taskId)
@ -254,6 +263,10 @@ export default {
handleCancel() {
this.addOpen = false
this.releaseOpen = false
},
handleAILabelSubmit(formData) {
console.log('Form submitted:', formData)
this.showModal = false
}
}
}

View File

@ -0,0 +1,152 @@
<template>
<el-dialog
title="启用智能标注"
:visible.sync="visible"
width="600px"
:before-close="handleClose"
custom-class="smart-annotation-dialog"
>
<div class="annotation-form">
<div class="form-section">
<h3>智能标注类型</h3>
<el-radio-group v-model="form.learningType">
<el-radio label="active">主动学习</el-radio>
<el-radio label="pre">预学习</el-radio>
</el-radio-group>
<p class="description" v-if="form.learningType === 'active'">
系统将自动使用半监督学习通过深度学习等多种手段进行智能标注使用人工标注进行优化
</p>
</div>
<div class="form-section">
<h3>算法类型</h3>
<el-radio-group v-model="form.algorithmType">
<el-radio label="fast">快速型</el-radio>
<el-radio label="precise">精准型</el-radio>
</el-radio-group>
</div>
<div class="form-section">
<h3>请选择智能标注服务节点</h3>
<el-select v-model="form.computeNode" placeholder="请选择智能标注服务节点" class="full-width">
<el-option
v-for="item in computeNodes"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<el-alert
v-if="showWarning"
type="warning"
:closable="false"
show-icon
>
启动自动标注时需数据中存在至少2个种标签且每种标签的图片不少于5张
</el-alert>
</div>
<!-- <div v-if="showWarning" class="warning-message">-->
<!-- <i class="warning-icon"></i>-->
<!-- <span>启动自动标注时需数据中存在至少2个种标签且每种标签的图片不少于5张</span>-->
<!-- </div>-->
<!-- <div class="form-actions">-->
<!-- <button class="submit-button" @click="handleSubmit">提交</button>-->
<!-- </div>-->
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="handleSubmit" :loading="loading"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'AILabelDialog',
data() {
return {
visible: false,
loading: false,
form: {
learningType: 'active',
algorithmType: 'fast',
computeNode: ''
},
computeNodes: [
{ label: '计算节点1', value: 'node1' },
{ label: '计算节点2', value: 'node2' }
],
showWarning: true,
currentRow: null
}
},
methods: {
//
show(row) {
this.currentRow = row
this.visible = true
},
resetForm() {
this.form = {
learningType: 'active',
algorithmType: 'fast',
computeNode: ''
}
this.currentRow = null
},
async handleSubmit() {
try {
this.loading = true
// vuex action
await this.$store.dispatch('annotation/submitAnnotation', {
...this.form,
row: this.currentRow
})
this.$message.success('提交成功')
this.handleClose()
} catch (error) {
this.$message.error(error.message || '提交失败')
} finally {
this.loading = false
}
},
handleClose() {
this.visible = false
this.resetForm()
},
}
}
</script>
<style scoped>
.smart-annotation-dialog {
max-width: 600px;
}
.annotation-form {
padding: 20px 0;
}
.form-section {
margin-bottom: 20px;
}
.form-section h3 {
font-size: 14px;
margin-bottom: 10px;
color: #333;
}
.description {
font-size: 12px;
color: #666;
margin-top: 8px;
line-height: 1.5;
}
.full-width {
width: 100%;
}
</style>

View File

@ -35,7 +35,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.0.56:29090`,
target: `http://127.0.0.1:18080`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
@ -63,7 +63,7 @@ module.exports = {
name: name,
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
'@': resolve('src')
}
},
plugins: [