diff --git a/.gitignore b/.gitignore index f9f9a6ac8dbe93e425d27655cc7da78d5fb50c49..2043f24e1f87c920aa491da71e10603da113f023 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,6 @@ build /.umi-production /.umi-test /dist -/.mfsu \ No newline at end of file +/.mfsu + +.env \ No newline at end of file diff --git a/src/components/RightContent/AvatarDropdown.tsx b/src/components/RightContent/AvatarDropdown.tsx index c86f429e518d7ee0ad7c0d723e7fe549b91af51f..4fa5094339ffbe5e665990e1ecb76386d468dff7 100644 --- a/src/components/RightContent/AvatarDropdown.tsx +++ b/src/components/RightContent/AvatarDropdown.tsx @@ -32,19 +32,29 @@ const loginOut = async () => { // Note: There may be security issues, please note //@ts-ignore - if (["opensource", "openanolis"].includes(window.webSiteEnv)) { + if (["opensource"].includes(window.webSiteEnv)) { // window.location.href = `/api/user/logout` history.push(`/login`) return } + else if (["openanolis"].includes(window.webSiteEnv)) { + window.location.href = '/api/user/logout/' + return + } //@ts-ignore + // else if (["group"].includes(window.webSiteEnv)) { + // const { data } = await request(`/api/user/logout`) + // window.location.href = data + // return + // } + else if (["group"].includes(window.webSiteEnv)) { - const { data } = await request(`/api/user/logout`) - window.location.href = data + await request(`/api/user/logout`) + window.location.href = '/' return } - else request(`/api/user/logout`) + else await request(`/api/auth/logout/`) if (window.location.pathname !== '/login' && !redirect) { history.replace({ pathname: '/login', diff --git a/src/pages/Plan/CreatePage.tsx b/src/pages/Plan/CreatePage.tsx index 6311d98ef5673d434008028c660531d8e27bd589..c67d7a57002d8ae6b13407a0710447280f615a4f 100644 --- a/src/pages/Plan/CreatePage.tsx +++ b/src/pages/Plan/CreatePage.tsx @@ -52,11 +52,13 @@ const TestPlan: React.FC = (props) => { if (isEditPage) { const { code: c, msg: m } = await updateTestPlanDetail(plan_id, params) if (c !== 200) return message.error(m) - const { code, msg } = await updateTestPlanTasks(plan_id, { tasks: tasksAndCases?.tasks.map((i: any) => i.id) }) + if (!!tasksAndCases?.tasks.length){ + const { code, msg } = await updateTestPlanTasks(plan_id, { tasks: tasksAndCases.tasks.map((i: any) => i.id) }) if (code !== 200) { message.error(msg) return } + } onOk() refresh() message.success("操作成功") diff --git a/src/pages/Plan/components/LeftList/index.tsx b/src/pages/Plan/components/LeftList/index.tsx index 8f973b602372c5a06b702b3c5f2cadd4c681a0da..c90f8b0d8092eaa784bb7e268d925c5d649c6e2f 100644 --- a/src/pages/Plan/components/LeftList/index.tsx +++ b/src/pages/Plan/components/LeftList/index.tsx @@ -37,9 +37,15 @@ const PlanLeftContent: React.FC = () => { const createModalRef = React.useRef<{ show: () => void }>(null) - const handleSearch = async (e: any) => { - if (e.code === "Enter") run({ content: e.target.value }) - } + // const handleSearch = async (e: any) => { + // if (e.code === "Enter") run({ content: e.target.value }) + // } + + // const handleIconSearch = async (e: any) => { + // run({ content: e.target.value }) + // } + + const onSearch = (value: string) => run({ content: value }); return (
@@ -50,14 +56,15 @@ const PlanLeftContent: React.FC = () => { > {`测试方案 (${planList?.length || 0})`} - } + // onKeyUp={handleSearch} + onSearch={onSearch} + // suffix={} /> { access.canTester() && diff --git a/src/pages/Product/TestProduct/CreateProduct.tsx b/src/pages/Product/TestProduct/CreateProduct.tsx index 53dce93a2aaa7a10176fe2665f435741557d78e7..2501427b67385e55868d21ab19deb1d5b1f6c084 100644 --- a/src/pages/Product/TestProduct/CreateProduct.tsx +++ b/src/pages/Product/TestProduct/CreateProduct.tsx @@ -1,6 +1,6 @@ import { CustomForm } from "@/components/CustomStyled" import { Modal, Row, Form, Space, Button, Select, Input, message, Radio } from "antd" -import React from "react" +import React, { useEffect } from "react" import { queryTestPlanList } from "@/pages/Plan/services" import { useRequest } from "@umijs/max" import { createOneCategory, createOneProduct, editOneProduct, queryCategoryList, queryOneProduct } from "./services" @@ -53,10 +53,17 @@ const CreateProduct: React.ForwardRefRenderFunction = (props, ref) const [visible, setVisible] = React.useState(false) const [source, setSource] = React.useState(undefined) const [loading, setLoading] = React.useState(false) - + const [planList, setPlanList] = React.useState([]) const [form] = Form.useForm() - const { data, run } = useRequest(() => queryTestPlanList(), { manual: true }) + const queryPlanData = async () => { + const { data } = await queryTestPlanList(); + setPlanList(data) + } + + useEffect(()=> { + queryPlanData(); + },[]) const { run: getOneProduct } = useRequest((test_plan_id) => queryOneProduct(test_plan_id), { manual: true }) @@ -64,10 +71,11 @@ const CreateProduct: React.ForwardRefRenderFunction = (props, ref) ref, () => ({ async show(_: any = undefined) { if (Object.prototype.toString.call(_) === "[object Number]") { - const editSource = await getOneProduct(_) - form.setFieldsValue(editSource) + const editSource:any = await getOneProduct(_) + const result = planList?.find((item:any) => item.id === editSource?.origin_plan_id) + const editData = Object.prototype.toString.call(result) === '[object Object]' ? editSource : { ...editSource, origin_plan_id: null } + form.setFieldsValue(editData) } - run() setVisible(true) setSource(_) } @@ -141,7 +149,7 @@ const CreateProduct: React.ForwardRefRenderFunction = (props, ref) > + children: