update code

main
haha 2024-07-19 00:41:51 +08:00
parent 45ce30d5d0
commit 459794f0a1
6 changed files with 486 additions and 14 deletions

View File

@ -59,10 +59,21 @@ const fontColor = computed(() => {
background-color: rgb(1, 169, 255); background-color: rgb(1, 169, 255);
border-radius: 4px; border-radius: 4px;
} }
.lf-ai-node,.lf-element-text{
cursor:pointer !important; .lf-ai-node,
.lf-element-text {
cursor: pointer !important;
} }
.card-footer{
.card-footer {
z-index: 99; z-index: 99;
} }
.command {
cursor: pointer;
}
.blue {
color: var(--el-color-primary);
}
</style> </style>

View File

@ -21,8 +21,18 @@ const userOperation=(operation_id)=>{
}); });
} }
//获取编译部署日志
const compileDeploy=(operation_id)=>{
return request({
url: `/logs/compile_deploy/${operation_id}`,
method: "get"
});
}
export default { export default {
serverState, serverState,
userOperationNotice, userOperationNotice,
userOperation userOperation,
compileDeploy
} }

View File

@ -48,7 +48,7 @@
<el-table-column label="部署时间" align="left" prop="deployed_time" width="160" /> <el-table-column label="部署时间" align="left" prop="deployed_time" width="160" />
<el-table-column label="量化和编译参数" align="left" prop="tool_params_name" width="160"> <el-table-column label="量化和编译参数" align="left" prop="tool_params_name" width="160">
<template #default="scope"> <template #default="scope">
<span class="args-state state-2">{{ <span class="args-state state-2 command" @click.stop="doChoice(scope.row)">{{
scope.row.tool_params_name ? scope.row.tool_params_name : "请选择" scope.row.tool_params_name ? scope.row.tool_params_name : "请选择"
}}</span> }}</span>
</template> </template>
@ -74,10 +74,12 @@
</div> </div>
</div> </div>
</el-card> </el-card>
<choiceToolsParamDlg ref="choiceToolParamDlg" @success="doChoiceSuccess" />
</template> </template>
<script setup> <script setup>
import taskApi from "@/api/task"; import taskApi from "@/api/task";
import choiceToolsParamDlg from './choiceToolsParamDlg.vue';
const props = defineProps({ const props = defineProps({
modelInfo: { modelInfo: {
type: Object, type: Object,
@ -86,7 +88,7 @@ const props = defineProps({
}, },
}); });
let dataTb = ref(); let dataTb = ref();
let choiceToolParamDlg = ref();
const loading = ref(false); // const loading = ref(false); //
const doRowClick = (row, a, b) => { const doRowClick = (row, a, b) => {
if (b.target.classList.contains("el-checkbox__inner")) { if (b.target.classList.contains("el-checkbox__inner")) {
@ -100,8 +102,17 @@ const info = reactive({
tableData: [], tableData: [],
state: 0, state: 0,
logs: [], logs: [],
editItem: null,
}); });
const doChoice = row => {
info.editItem = row;
choiceToolParamDlg.value.showDialog(row);
}
const doChoiceSuccess = item => {
info.editItem.tool_params_id = item.params_id
info.editItem.tool_params_name = item.params_name
}
/** 查询 */ /** 查询 */
function handleQuery() { function handleQuery() {
loading.value = true; loading.value = true;

View File

@ -106,14 +106,22 @@ const addLogs = msg => {
} }
// //
const doGetComplieLogs = () => { const doGetComplieLogs = () => {
let ajaxs = info.optIds.filter(d => d.state == 0).map(o => { let ajaxs = [];
return logsApi.userOperation(o.id); info.optIds.filter(d => d.state == 0).forEach(o => {
ajaxs.push(logsApi.userOperation(o.id));
ajaxs.push(logsApi.compileDeploy(o.id));
}) })
request.all(ajaxs).then(d => { request.all(ajaxs).then(d => {
d.forEach((it, idx) => { d.forEach((it, idx) => {
let msg = it.data.data; let msg = it.data.data;
addLogs({ msg: msg.operation_result }); if (msg.operation_result) {
info.optIds[idx].state = msg.operation_finished ? 1 : 0; addLogs({ msg: msg.operation_result });
info.optIds[idx].state = msg.operation_finished ? 1 : 0;
}
if (msg.log_msg) {
addLogs({ msg: `[${msg.update_time}${msg.logs_level}]${msg.log_msg}` })
}
}); });
if (info.optIds.filter(d => d.state == 0).length > 0) { if (info.optIds.filter(d => d.state == 0).length > 0) {
setTimeout(doGetComplieLogs, 2000); setTimeout(doGetComplieLogs, 2000);
@ -145,14 +153,21 @@ const doDeploy = () => {
}; };
const doGetDeployLogs = () => { const doGetDeployLogs = () => {
let ajaxs = info.optIds.filter(d => d.state == 0).map(o => { let ajaxs = [];
return logsApi.userOperation(o.id); info.optIds.filter(d => d.state == 0).forEach(o => {
ajaxs.push(logsApi.userOperation(o.id));
ajaxs.push(logsApi.compileDeploy(o.id));
}) })
request.all(ajaxs).then(d => { request.all(ajaxs).then(d => {
d.forEach((it, idx) => { d.forEach((it, idx) => {
let msg = it.data.data; let msg = it.data.data;
addLogs({ msg: msg.operation_result }); if (msg.operation_result) {
info.optIds[idx].state = msg.operation_finished ? 1 : 0; addLogs({ msg: msg.operation_result });
info.optIds[idx].state = msg.operation_finished ? 1 : 0;
}
if (msg.log_msg) {
addLogs({ msg: `[${msg.update_time}${msg.logs_level}]${msg.log_msg}` })
}
}); });
if (info.optIds.filter(d => d.state == 0).length > 0) { if (info.optIds.filter(d => d.state == 0).length > 0) {
setTimeout(doGetDeployLogs, 2000); setTimeout(doGetDeployLogs, 2000);

View File

@ -0,0 +1,97 @@
<template>
<el-dialog v-model="info.show" title="工具链运行参数列表" :close-on-press-escape="false" :close-on-click-modal="false"
align-center append-to-body width="960px" modal-class="choice-tool-param-dlg">
<el-table v-loading="info.loading" :data="info.tableData" stripe @row-click="doRowClick" max-height="400px">
<el-table-column align="center" width="55" label="选择">
<template #default="scope">
<el-radio v-model="info.selData" :label="scope.row.params_id + ''"
@change="handleChange(scope.row)">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column label="运行参数名称" align="left" prop="params_name" />
<el-table-column label="参数描述信息" align="left" prop="params_desc" />
<el-table-column label="适用模型类型" align="left" prop="modl_sub_type_name" width="120" />
<el-table-column label="创建用户" align="left" prop="user_name" />
<el-table-column label="创建时间" align="left" prop="create_time" width="120" />
<el-table-column label="操作" align="left" prop="user_id">
<template #default="scope">
<span class="command blue" @click.stop="showParam(scope.row)">查看参数</span>
</template>
</el-table-column>
</el-table>
<template #footer>
<div style="text-align: center">
<el-button type="primary" @click="doOk"></el-button>
<el-button @click="doCancel"></el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="info.showJsonDlg" title="查看工具链运行参数" :close-on-press-escape="false" :close-on-click-modal="false"
align-center append-to-body width="800px" modal-class="show-tool-param-dlg">
<pre v-html="info.showItem.params_content"></pre>
<template #footer>
<div style="text-align: center">
<el-button type="primary" @click="info.showJsonDlg = false">关闭</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import toolApi from '@/api/tool'
let info = reactive({
loading: false,
show: false,
data: null,
selData: "",
tableData: [],
showItem: null,
showJsonDlg: false
});
const emit = defineEmits(["success"]);
const doRowClick = (row) => {
info.selData = row.params_id + "";
}
const showParam = row => {
info.showItem = row;
info.showJsonDlg = true;
}
const doOk = () => {
if (info.selData) {
let items = info.tableData.filter(d => d.params_id == info.selData);
if (items.length > 0) {
emit("success", items[0]);
info.show = false;
return;
}
}
ElMessage.error("请选择工具链运行参数!");
}
const doCancel = () => {
info.show = false;
}
const showDialog = (opt) => {
info.show = true;
info.data = opt;
info.selData = opt.tool_params_id;
loadData();
}
const loadData = () => {
info.loading = true;
toolApi.paramsList({ page_num: 1, page_size: 100, tool_id: info.data.tool_id }).then(d => {
info.tableData = d.data.data.ParamsList || [];
info.loading = false;
});
}
defineExpose({
showDialog
})
</script>
<style scoped lang='scss'>
.choice-tool-param-dlg {}
</style>
<style lang='scss'>
.choice-tool-param-dlg {}
</style>

File diff suppressed because one or more lines are too long