AIManage/src/views/manage/otherTool/index.vue

194 lines
5.2 KiB
Vue
Raw Normal View History

2024-06-18 01:16:44 +08:00
<!-- 用户管理 -->
<template>
<div class="app-container">
<el-card shadow="never" class="table-container">
<template #header>
<div class="flex justify-between">
<div>
2024-06-20 21:31:53 +08:00
<el-button type="primary" @click="openDialog('user-form')"
2024-06-18 01:16:44 +08:00
><i-ep-plus />工具链</el-button
>
</div>
2024-06-20 21:31:53 +08:00
<div>
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="工具链名称" prop="keywords">
<el-input
v-model="queryParams.keywords"
placeholder="请输入工具链名称"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<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-18 01:16:44 +08:00
</div>
</template>
<el-table
v-loading="loading"
:data="tableData"
stripe
@selection-change="handleSelectionChange"
>
2024-06-19 21:43:47 +08:00
<el-table-column label="工具链名称" align="left" prop="szmc" width="250" />
<el-table-column label="标签" align="left" prop="szlx" />
<el-table-column label="连接状态" align="left" prop="szzlx" />
<el-table-column label="工作状态" width="180" align="left" prop="bb" />
<el-table-column label="创建时间" width="180" align="left" prop="hlcjsj" />
2024-06-18 01:16:44 +08:00
<el-table-column label="操作" fixed="right" width="280">
<template #default="scope">
<el-button
2024-06-20 21:31:53 +08:00
text
type="primary"
2024-06-18 01:16:44 +08:00
size="small"
2024-06-20 22:50:57 +08:00
@click="openDialogView('user-form', scope.row.id)"
2024-06-18 01:16:44 +08:00
><i-ep-view />查看</el-button
>
<el-button
2024-06-20 21:31:53 +08:00
text
type="primary"
2024-06-18 01:16:44 +08:00
size="small"
@click="openDialog('user-form', scope.row.id)"
><i-ep-edit />修改</el-button
>
2024-06-20 21:31:53 +08:00
<el-button text type="primary" size="small" @click="handleDelete(scope.row)"
2024-06-18 01:16:44 +08:00
><i-ep-delete />删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-if="total > 0"
v-model:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="handleQuery"
/>
</el-card>
</div>
</template>
<script setup lang="ts">
defineOptions({
name: "calculateIndex",
inheritAttrs: false,
});
import { UserQuery } from "@/api/user/model";
const queryFormRef = ref(ElForm); // 查询表单
const router = useRouter();
const loading = ref(false); // 加载状态
const removeIds = ref([]); // 删除用户ID集合 用于批量删除
const queryParams = reactive<UserQuery>({
pageNum: 1,
pageSize: 10,
});
const dateTimeRange = ref("");
const total = ref(0); // 数据总数
watch(dateTimeRange, (newVal) => {
if (newVal) {
queryParams.startTime = newVal[0];
queryParams.endTime = newVal[1];
}
});
const tableData = [
{
szmc: "华为Atlas工具链",
szlx: "atlas",
szzlx: "已连接",
bb: "空闲",
hlcjsj: "2024-05-03",
},
{
szmc: "寒武纪思元工具链",
szlx: "寒武纪",
szzlx: "已断开",
bb: "- -",
hlcjsj: "2024-06-07",
2024-06-20 21:31:53 +08:00
},
2024-06-18 01:16:44 +08:00
];
/** 查询 */
function handleQuery() {
loading.value = true;
ElMessage.success("查询成功");
loading.value = false;
// UserAPI.getPage(queryParams)
// .then((data) => {
// console.log("handleQuery", data);
// pageData.value = data.list;
// total.value = data.total;
// })
// .finally(() => {
// loading.value = false;
// });
}
/** 重置查询 */
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-06-20 22:50:57 +08:00
ElMessageBox.confirm("确认删除工具链信息?", "警告", {
2024-06-18 01:16:44 +08:00
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(function () {
ElMessage.success("删除成功");
});
}
/**
* 打开弹窗
*
* @param type 弹窗类型 用户表单user-form | 用户导入user-import
* @param id 用户ID
*/
async function openDialog(type: string, id?: number) {
router.replace({ path: "/tester/otherToolEdit" });
}
2024-06-20 22:50:57 +08:00
async function openDialogView(type: string, id?: number) {
router.replace({ path: "/tester/otherToolView" });
}
2024-06-18 01:16:44 +08:00
/** 下载导入模板 */
function downloadTemplate() {
ElMessage.success("下载模板成功");
}
/** 导出用户 */
function handleExport() {
ElMessage.success("导出成功");
}
onMounted(() => {
//handleQuery();
});
2024-06-20 21:31:53 +08:00
</script>