diff --git a/src/views/project/ProjectManagement.vue b/src/views/project/ProjectManagement.vue index 45b9c35..c524b52 100644 --- a/src/views/project/ProjectManagement.vue +++ b/src/views/project/ProjectManagement.vue @@ -2,8 +2,11 @@ import { ref, onMounted } from "vue"; import { http } from "@/utils/http"; import { useRouter } from "vue-router"; +import type { FormInstance } from "element-plus"; import { ArrowDown } from "@element-plus/icons-vue"; +const uploadVisible = ref(false); +const importVisible = ref(false); const showDropdown = ref(false); const getStatLabel = (key: string): string => { @@ -46,6 +49,33 @@ interface Project { projectSource: string; } +interface ImportForm { + userUUID: string; + repoUrl: string; + repoType: string; + repoUsername?: string; + repoPassword?: string; + repoToken?: string; +} + +const importRules = { + repoUrl: [{ required: true, message: "请输入仓库地址", trigger: "blur" }], + repoType: [{ required: true, message: "请选择仓库类型", trigger: "change" }] +}; + +const importForm = ref({ + userUUID: null, + repoUrl: null, + repoType: null, + repoUsername: null, + repoPassword: null, + repoToken: null +}); + +const importFormRef = ref(); + +const repoVis = ref("public"); // public or private + const _projects = ref([ { name: "TestProject", @@ -97,7 +127,12 @@ const fetchProjects = async () => { scanType: null, scanTime: null, // TODO: 项目地址和来源 - projectSource: null + projectSource: + res[i].projectType == "upload" + ? "本地上传" + : res[i].projectType == "github" + ? "Github" + : "Gitlab" }); } projectStats.value.totalProjects = res.length; @@ -106,6 +141,30 @@ const fetchProjects = async () => { projectStats.value.scanned = scanned; }; +const handleSubmitImport = async (formRef: FormInstance | undefined) => { + if (!formRef) return; + await formRef.validate((valid, fields) => { + if (valid) { + console.log(importForm.value); + importVisible.value = false; + } else { + console.log("error submit", fields); + } + }); +}; + +const handleClose = () => { + importFormRef.value.resetFields(); + importForm.value = { + userUUID: null, + repoUrl: null, + repoType: null, + repoUsername: null, + repoPassword: null, + repoToken: null + }; +}; + onMounted(async () => { fetchProjects(); }); @@ -130,8 +189,12 @@ const navigateToDetails = () => { @@ -183,6 +246,66 @@ const navigateToDetails = () => { + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
+ +
+