AIManage/src/views/connection/index.vue

172 lines
5.5 KiB
Vue
Raw Normal View History

2024-06-20 23:49:38 +08:00
<!-- 用户管理 -->
2024-06-17 23:47:02 +08:00
<template>
2024-06-20 23:49:38 +08:00
<div class="app-container">
2024-07-26 22:56:44 +08:00
<div class="search-container">
2024-06-20 23:49:38 +08:00
<el-form ref="queryFormRef" :model="queryParams" :inline="true" style="flex-grow: 1;text-align: right;">
2024-07-07 19:15:46 +08:00
<el-form-item label="" prop="connection_name">
<el-input v-model="queryParams.connection_name" placeholder="请输入互联名将,标签,模型名称" clearable style="width: 250px"
2024-06-20 23:49:38 +08:00
@keyup.enter="handleQuery" />
2024-07-26 22:56:44 +08:00
</el-form-item>
2024-06-20 23:49:38 +08:00
<el-form-item>
<el-button type="primary" @click="handleQuery"><i-ep-search />搜索</el-button>
<el-button @click="resetQuery">
<i-ep-refresh />
重置</el-button>
</el-form-item>
</el-form>
</div>
2024-06-17 23:47:02 +08:00
2024-07-26 22:56:44 +08:00
<el-card shadow="never" class="table-container">
2024-06-20 23:49:38 +08:00
2024-07-07 19:15:46 +08:00
<el-table v-loading="loading" :data="info.data" stripe @selection-change="handleSelectionChange">
<el-table-column label="模型名称" align="left" prop="model_name" />
2024-07-26 22:56:44 +08:00
<el-table-column label="网络名称" align="left" prop="modl_net_type" width="120" />
<el-table-column label="模型类型" align="left" prop="modl_net_type">
<template #default="{ row }">{{ row.modl_main_type_name }}/{{ row.modl_sub_type_name }}</template>
2024-07-07 19:15:46 +08:00
</el-table-column>
<el-table-column label="版本" align="left" prop="connection_version" />
2024-07-26 22:56:44 +08:00
<el-table-column label="互联名称" align="left" prop="connection_name" width="120" />
<el-table-column label="互联说明" align="left" prop="connection_desc" />
2024-07-07 19:15:46 +08:00
<el-table-column label="互联创建时间" width="120" align="left" prop="create_time" />
<el-table-column label="创建用户" width="100" align="left" prop="user_name" />
<el-table-column label="状态" width="100" align="left" prop="connection_created">
2024-06-20 23:49:38 +08:00
<template #default="scope">
2024-07-07 19:15:46 +08:00
<el-button type="success" size="small" v-if="scope.row.connection_created"></el-button>
2024-06-20 23:49:38 +08:00
<el-button type="info" size="small" v-else plain>未互联</el-button>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="270">
<template #default="scope">
2024-07-07 19:15:46 +08:00
<template v-if="scope.row.connection_created">
2024-07-26 22:56:44 +08:00
<el-button text type="primary" size="small" @click="doShowDetail(scope.row)"><i-ep-edit />查看</el-button>
<el-button text type="primary" size="small"
@click="doEdit(scope.row.connection_id)"><i-ep-link />修改互联</el-button>
<el-button text type="primary" size="small" @click="handleDelete(scope.row)"><i-ep-delete />删除</el-button>
2024-06-20 23:49:38 +08:00
</template>
<template v-else>
2024-07-26 22:56:44 +08:00
<el-button text type="primary" size="small" @click="doAdd(scope.row)"></el-button>
2024-06-20 23:49:38 +08:00
</template>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="card-footer">
2024-07-07 19:15:46 +08:00
<pagination v-if="info.total > 0" v-model:total="info.total" v-model:page="queryParams.page_num"
v-model:limit="queryParams.page_size" @pagination="handleQuery" />
2024-06-20 23:49:38 +08:00
</el-card>
2024-06-17 23:47:02 +08:00
</div>
</template>
2024-06-20 23:49:38 +08:00
<script setup lang="ts">
import { UserQuery } from "@/api/user/model";
2024-07-07 19:15:46 +08:00
import ConnApi from '@/api/connection'
2024-06-20 23:49:38 +08:00
const queryFormRef = ref(ElForm); // 查询表单
const router = useRouter();
const loading = ref(false); // 加载状态
const removeIds = ref([]); // 删除用户ID集合 用于批量删除
2024-07-07 19:15:46 +08:00
const queryParams = reactive<any>({
page_num: 1,
page_size: 10,
2024-07-26 22:56:44 +08:00
connection_name: ''
2024-06-20 23:49:38 +08:00
});
const dateTimeRange = ref("");
const total = ref(100); // 数据总数
2024-07-26 22:56:44 +08:00
const info = reactive({
total: 0,
data: []
2024-07-07 19:15:46 +08:00
})
2024-06-20 23:49:38 +08:00
watch(dateTimeRange, (newVal) => {
if (newVal) {
queryParams.startTime = newVal[0];
queryParams.endTime = newVal[1];
}
});
/** 查询 */
function handleQuery() {
loading.value = true;
2024-07-26 22:56:44 +08:00
ConnApi.list(queryParams).then(d => {
2024-07-07 19:15:46 +08:00
loading.value = false;
2024-07-26 22:56:44 +08:00
info.total = d.data?.data?.total || 0;
info.data = d.data?.data?.connection_list || [];
});
2024-06-20 23:49:38 +08:00
}
2024-07-26 22:56:44 +08:00
function doUploadModel() {
2024-07-14 22:26:43 +08:00
router.push({ path: "/modelMgr/uploadModel" });
2024-06-20 23:49:38 +08:00
}
/** 重置查询 */
function resetQuery() {
queryFormRef.value.resetFields();
dateTimeRange.value = "";
queryParams.pageNum = 1;
queryParams.deptId = undefined;
queryParams.startTime = undefined;
queryParams.endTime = undefined;
handleQuery();
}
/** 行选中 */
function handleSelectionChange(selection: any) {
removeIds.value = selection.map((item: any) => item.id);
}
/** 删除数据 */
function handleDelete(row: { [key: string]: any }) {
2024-07-07 19:15:46 +08:00
ElMessageBox.confirm("确认删除互联?", "警告", {
2024-06-20 23:49:38 +08:00
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
2024-07-26 22:56:44 +08:00
ConnApi.deleteConnect(row.connection_id).then(d => {
if (d.data.code == 0) {
ElMessage.success("删除互联成功");
2024-07-07 19:15:46 +08:00
}
2024-07-26 22:56:44 +08:00
});
2024-06-20 23:49:38 +08:00
});
}
2024-07-26 22:56:44 +08:00
const doShowDetail = (row: any) => {
router.push({ path: "/connection/detail", query: { id: row.connection_id } })
2024-06-20 23:49:38 +08:00
}
2024-07-26 22:56:44 +08:00
const doEdit = (row: any) => {
router.push({ path: "/connection/edit", query: { id: row.connection_id, type: 'edit' } })
2024-06-20 23:49:38 +08:00
}
2024-07-26 22:56:44 +08:00
const doAdd = (row: any) => {
router.push({ path: "/connection/edit", query: { id: row.connection_id, type: 'add' } })
2024-06-20 23:49:38 +08:00
}
onMounted(() => {
2024-07-07 19:15:46 +08:00
handleQuery();
2024-06-20 23:49:38 +08:00
});
2024-06-17 23:47:02 +08:00
</script>
2024-06-20 23:49:38 +08:00
<style scoped lang='scss'>
2024-07-26 22:56:44 +08:00
.search-container {
display: flex;
2024-06-20 23:49:38 +08:00
}
2024-07-26 22:56:44 +08:00
.card-footer {
2024-06-20 23:49:38 +08:00
position: fixed;
width: calc(100% - 215px);
bottom: 0px;
2024-07-26 22:56:44 +08:00
:deep(.el-card__body) {
padding: 0px;
.el-pagination {
2024-06-20 23:49:38 +08:00
justify-content: end;
}
}
}
</style>