提交代码

main
姜玉琦 2024-09-20 15:19:24 +08:00
parent 1f4b91d8d8
commit dac0fcc10b
3 changed files with 36 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import '@logicflow/core/dist/style/index.css';
import { Menu } from "@logicflow/extension";
import AiNodeExtension from '@/components/flow/index'
import RegisteMenu from '@/components/flow/menu.js'
import OperatorApi from '@/api/operator'
const emit = defineEmits(["initLf", "updateNode", "nodeClick"])
const themeApprove = {
rect: { //
@ -66,10 +67,13 @@ const initEvent = (lf) => {
emit("nodeClick", node)
});
lf.on("node:dnd-add", data => {
nodeData = data.data;
showProp.value = true
nodePropKey.value++
doUpdateState()
//OperatorApi.findOne(data.data.properties.data.id).then(res => {
// data.data.properties.data.parameters = res.data.data.parameters;
nodeData = data.data;
showProp.value = true
nodePropKey.value++
doUpdateState()
// });
});
lf.on("anchor:dragend", (a, b, c) => {
updateEdges(a, b, c);

View File

@ -58,7 +58,9 @@ const dragNode = (it, t) => {
if (t == 5) {
color = '#4C8DD1';
}
props.lf.dnd.startDrag({
OperApi.findOne(it.operator_id).then(res => {
it.parameters = res.data.data.parameters;
props.lf.dnd.startDrag({
type: 'ai-node',
text: it.text,
properties: {
@ -67,6 +69,7 @@ const dragNode = (it, t) => {
data: it
}
})
});
}
const info = reactive({
list1: [],
@ -150,7 +153,7 @@ const initData = () => {
info.list2 = tmps.filter(d => d.oper_main_type == "post_process");
info.list3 = tmps.filter(d => d.oper_main_type == "inference");
info.list4 = tmps.filter(d => d.oper_main_type == "data_source");
info.list5 = tmps.filter(d => d.oper_main_type == "data_report");
info.list5 = tmps.filter(d => d.oper_main_type == "data_reporter");
});
}
onMounted(() => {

View File

@ -111,7 +111,7 @@
<el-button type="primary" @click="handleSubmit"><i-ep-check /> </el-button>
<el-button @click="closeBack"><i-ep-close /> </el-button>
</el-card>
<el-dialog v-model="dialogVisible" title="上传标注图片" width="880" append-to-body style="max-height:600px;">
<el-dialog v-model="dialogVisible" title="上传标注图片" width="880" append-to-body style="max-height:650px;">
<el-card v-loading.fullscreen.lock="uploadLoading">
<el-upload v-model:file-list="uploadImgFileList" class="upload-demo upload-demo-3"
:before-remove="handleRemoveFiles" :auto-upload="autoUpload" :on-change="handleChangeFiles"
@ -130,7 +130,7 @@
<!-- 弹窗底部操作按钮 -->
<template #footer>
<div class="dialog-footer">
<el-button type="primary" :disabled="uploadImgFileList.length == 0" @click="startUploadFiles"></el-button>
<el-button type="primary" :disabled="uploadImgFileList.length == 0" @click="checkUploadFiles"></el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</template>
@ -279,15 +279,29 @@ function handleRemoveFiles(uploadFile, uploadFiles) {
}
/** 开始上传文件 */
function startUploadFiles() {
function checkUploadFiles() {
var element = document.getElementsByClassName("upload-demo-3")[0];
var errors = element.querySelectorAll(".mylabel--error");
if (errors.length > 0) {
ElMessage.error(errors.length + " 个图片未上传标注文件!请上传或删除图片。");
return false;
ElMessageBox.confirm(errors.length + " 个图片未上传标注文件!是否继续上传已标注数据集信息?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
startUploadFiles();
});
}else{
startUploadFiles();
}
}
/** 开始上传文件 */
function startUploadFiles() {
uploadImgFileList.value.forEach((item) => {
let json = uploadJsonList.value.filter((it) => disName(item.name, it.name));
if(form.value.dats_label_type != "no_label" && json.length==0){
return;
}
const formData = new FormData();
formData.append("image_file_name", item.name);
formData.append("image_file", item.raw);
@ -564,6 +578,10 @@ onMounted(() => {
margin-left: 10px;
}
.el-dialog__body{
max-height: 520px;
}
.dialog-footer {
text-align: center;
}