AIManage/src/views/manage/calculate/view.vue

236 lines
6.6 KiB
Vue
Raw Normal View History

2024-07-14 22:25:26 +08:00
<!-- 算子管理 -->
2024-06-21 00:19:54 +08:00
<template>
2024-06-21 00:50:41 +08:00
<div class="app-container model-detail">
2024-07-14 22:25:26 +08:00
<!-- 算子管理详情 -->
2024-06-21 00:50:41 +08:00
<el-card>
2024-07-14 22:25:26 +08:00
<template #header
><svg-icon
icon-class="pause"
style="width: 20px; height: 20px"
/></template
>
2024-07-19 00:17:05 +08:00
<el-form ref="formRef" v-loading="loading" label-width="100px" size="small">
<el-row>
<el-col :span="24">
2024-07-14 22:25:26 +08:00
<el-form-item label="算子名称">{{ dataInfo.operator_name }}</el-form-item>
2024-07-19 00:17:05 +08:00
</el-col>
</el-row>
<el-row>
<el-col :span="12">
2024-07-11 01:27:21 +08:00
<el-form-item label="算子主类型">
2024-07-14 22:25:26 +08:00
{{ dataInfo.oper_main_type_name }}</el-form-item
2024-06-24 23:18:47 +08:00
>
2024-07-19 00:17:05 +08:00
</el-col>
<el-col :span="12">
2024-07-11 01:27:21 +08:00
<el-form-item label="算子子类型">
2024-07-14 22:25:26 +08:00
{{ dataInfo.oper_sub_type_name }}</el-form-item
2024-06-24 23:18:47 +08:00
>
2024-07-19 00:17:05 +08:00
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="创建人"> {{ dataInfo.user_name }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="创建时间"> {{ dataInfo.create_time }}</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
2024-07-11 01:27:21 +08:00
<el-form-item label="算子说明">
2024-06-21 00:19:54 +08:00
<el-input
2024-07-11 01:27:21 +08:00
v-model="dataInfo.operator_desc"
2024-06-21 00:19:54 +08:00
:disabled="true"
placeholder="请输入数据集名称"
:rows="3"
type="textarea"
/>
</el-form-item>
2024-07-19 00:17:05 +08:00
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="输入参数">
2024-06-21 00:19:54 +08:00
<el-input
2024-07-19 00:17:05 +08:00
v-model="dataInfo.parametersInputs"
2024-06-21 00:19:54 +08:00
:disabled="true"
2024-07-19 00:17:05 +08:00
placeholder="请填写输入参数"
:rows="8"
2024-06-21 00:19:54 +08:00
type="textarea"
/>
</el-form-item>
2024-07-19 00:17:05 +08:00
</el-col>
<el-col :span="12">
<el-form-item label="输出参数">
2024-06-21 00:19:54 +08:00
<el-input
2024-07-19 00:17:05 +08:00
v-model="dataInfo.parametersOutputs"
2024-06-21 00:19:54 +08:00
:disabled="true"
2024-07-19 00:17:05 +08:00
placeholder="请填写输出参数"
:rows="8"
2024-06-21 00:19:54 +08:00
type="textarea"
/>
2024-07-19 00:17:05 +08:00
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-row style="padding: 10px 15px">
<el-col :lg="24" :xs="24">
<el-button type="primary" @click="handlePushParams"
><i-ep-plus />添加算子程序</el-button
>
<el-button type="primary" @click="handleDownloadPs"
><i-ep-download />文件例程下载</el-button
>
</el-col>
</el-row>
<el-card style="padding-bottom: 50px;">
<template #header
><svg-icon
icon-class="pause"
style="width: 20px; height: 20px"
/></template
>
<el-table :data="pageData" stripe v-loading="tableLoading">
<el-table-column label="程序适应硬件" align="left" prop="cmpt_hardware_type" />
<el-table-column label="程序版本" align="left" prop="program_version" />
<el-table-column label="创建时间" align="left" prop="create_time" />
<el-table-column label="上传用户" align="left" prop="user_name" />
2024-07-23 17:34:24 +08:00
<el-table-column label="操作" fixed="right" align="center" width="150">
2024-07-19 00:17:05 +08:00
<template #default="scope">
<el-button text type="primary" size="small" @click="handleDelete(scope.row)"
><i-ep-delete />删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-if="total > 0"
v-model:total="total"
v-model:page="queryParams.page_num"
v-model:limit="queryParams.page_size"
@pagination="handleQuery"
/>
2024-06-21 00:19:54 +08:00
</el-card>
2024-06-21 00:50:41 +08:00
<el-card class="card-footer">
2024-07-14 22:25:26 +08:00
<el-button @click="closeBack"><i-ep-close /> </el-button>
2024-06-21 00:19:54 +08:00
</el-card>
2024-07-23 16:29:35 +08:00
<paramDialog ref="paramDialogRef" @myQuery="handleQuery"></paramDialog>
2024-06-21 00:19:54 +08:00
</div>
</template>
<script setup lang="ts">
2024-07-14 22:25:26 +08:00
import OperatorApi from "@/api/operator";
2024-07-19 00:17:05 +08:00
import paramDialog from "../calculateParam/dialog.vue";
2024-06-21 00:19:54 +08:00
2024-07-14 22:25:26 +08:00
const route = useRoute();
2024-06-21 00:19:54 +08:00
const router = useRouter();
const loading = ref(false); // 加载状态
2024-07-11 01:27:21 +08:00
// 算子表单数据
const dataInfo = ref({});
2024-06-21 00:19:54 +08:00
2024-07-19 00:17:05 +08:00
const queryParams = reactive({
page_num: 1,
page_size: 10,
operation_id: null,
});
const total = ref(0); // 数据总数
const pageData = ref([]); // 分页数据
const tableLoading = ref(false); // 加载状态
const paramDialogRef = ref(""); // 算子程序子组件
2024-06-21 00:19:54 +08:00
/** 返回默认页面 */
function closeBack() {
2024-07-14 22:48:26 +08:00
router.push({ path: "/operatorLibrary/calculate" });
2024-06-21 00:19:54 +08:00
}
2024-07-19 00:17:05 +08:00
/** 删除算子程序 */
function handleDelete(program_id) {
ElMessageBox.confirm("确认删除算子程序?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
OperatorApi.deletePrograms(program_id).then((res) => {
ElMessage.success("删除成功");
handleQuery();
});
});
}
/** 查询算子程序 */
function handleQuery() {
tableLoading.value = true;
OperatorApi.getPrograms(queryParams)
.then((res) => {
pageData.value = res.data.data.program_list;
total.value = res.data.data.total;
})
.finally(() => {
tableLoading.value = false;
});
}
/** 添加算子程序 */
function handlePushParams(){
paramDialogRef.value.show(dataInfo.value);
}
/** 文件例程下载 */
function handleDownloadPs(){
ElMessage.error("【error】待提供");
}
2024-07-11 01:27:21 +08:00
/** 初始化数据 */
2024-07-14 23:52:30 +08:00
function initData() {
2024-07-14 22:25:26 +08:00
let id = route.query.id;
2024-07-11 01:27:21 +08:00
loading.value = true;
2024-07-19 00:17:05 +08:00
queryParams.operation_id = id;
handleQuery();
2024-07-14 22:25:26 +08:00
OperatorApi.findOne(id)
.then((res) => {
//JSON转换
2024-07-19 00:17:05 +08:00
let parameters = res.data.data.parameters;
res.data.data.parametersInputs = JSON.stringify(parameters.inputs);
res.data.data.parametersOutputs = JSON.stringify(parameters.outputs);
2024-07-14 22:25:26 +08:00
dataInfo.value = res.data.data;
})
.finally(() => {
loading.value = false;
});
2024-07-11 01:27:21 +08:00
}
2024-06-21 00:19:54 +08:00
onMounted(() => {
2024-07-11 01:27:21 +08:00
initData();
2024-06-21 00:19:54 +08:00
});
</script>
2024-07-14 22:25:26 +08:00
<style scoped lang="scss">
.model-detail {
:deep(.el-card__header) {
padding: 8px 4px;
display: flex;
align-items: center;
}
2024-06-21 00:50:41 +08:00
}
2024-07-14 22:25:26 +08:00
.sp-file {
color: #29d;
2024-06-21 00:50:41 +08:00
}
2024-07-14 22:25:26 +08:00
.tb-base-info {
line-height: 30px;
2024-06-21 00:50:41 +08:00
}
2024-07-14 22:25:26 +08:00
:deep(.svg-icon) {
margin-right: 8px;
2024-06-21 00:50:41 +08:00
}
2024-07-14 22:25:26 +08:00
.card-footer {
2024-06-21 00:19:54 +08:00
position: fixed;
2024-06-21 00:50:41 +08:00
width: calc(100% - 215px);
2024-06-21 00:19:54 +08:00
bottom: 0px;
2024-07-14 22:25:26 +08:00
:deep(.el-card__body) {
padding: 10px;
.el-pagination {
2024-06-21 00:50:41 +08:00
justify-content: end;
}
}
2024-06-21 00:19:54 +08:00
}
</style>