From d23f64435b55f27bd2e0922ccc29873e02d367a8 Mon Sep 17 00:00:00 2001 From: wulibaibao <13366578180@163.com> Date: Mon, 8 Aug 2022 15:04:11 +0800 Subject: [PATCH] fix: ts error --- config/config.ts | 22 ++ config/routes.ts | 10 +- package.json | 294 +++++++++--------- src/components/RichTextEditor/index.tsx | 16 +- src/pages/Demand/components/AddDemand.tsx | 7 +- src/pages/Outline/index.tsx | 14 +- src/pages/Plan/CreatePage.tsx | 53 ++-- src/pages/Plan/components/AddModal.tsx | 190 +++++++++-- .../components/ContentTable/Suite.table.tsx | 21 +- .../components/ContentTable/Task.table.tsx | 20 +- src/pages/Plan/components/LeftList/index.tsx | 14 +- .../Plan/components/RightContent/index.tsx | 58 ++-- .../components/SelectModal/Suite.selet.tsx | 16 +- .../components/SelectModal/Task.select.tsx | 19 +- src/pages/Plan/index.tsx | 21 +- src/pages/Plan/services.ts | 64 ++-- src/pages/Task/components/AddTaskModal.tsx | 78 +++-- src/pages/Task/components/CaseTable.tsx | 4 +- src/pages/Task/components/InsertRunResult.tsx | 16 +- 19 files changed, 573 insertions(+), 364 deletions(-) diff --git a/config/config.ts b/config/config.ts index 7cb80d4..5f8ab02 100644 --- a/config/config.ts +++ b/config/config.ts @@ -76,4 +76,26 @@ export default defineConfig({ // mfsu: {}, webpack5: {}, // exportStatic: {}, + chunks: ['vendors', 'umi'], + chainWebpack: function (config, { webpack }) { + config.merge({ + optimization: { + splitChunks: { + chunks: 'all', + minSize: 30000, + minChunks: 3, + automaticNameDelimiter: '.', + cacheGroups: { + vendor: { + name: 'vendors', + test({ resource }: any) { + return /[\\/]node_modules[\\/]/.test(resource); + }, + priority: 10, + }, + }, + }, + }, + }); + }, }); diff --git a/config/routes.ts b/config/routes.ts index 3a0d944..50785d0 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -64,11 +64,11 @@ }, ] }, - { - path: "/server", - name: "server", - component: "./Server", - }, + // { + // path: "/server", + // name: "server", + // component: "./Server", + // }, { path: "/sys", name: "sys", diff --git a/package.json b/package.json index f180e12..3b35577 100644 --- a/package.json +++ b/package.json @@ -1,148 +1,148 @@ { - "name": "test-lib-front", - "version": "1.0.0", - "private": true, - "description": "An out-of-box UI solution for enterprise applications", - "scripts": { - "analyze": "cross-env ANALYZE=1 umi build", - "build": "umi build", - "build:keep": "umi build && yarn oss-test", - "deploy": "npm run build && npm run gh-pages", - "dev": "npm run start:dev", - "gh-pages": "gh-pages -d dist", - "i18n-remove": "pro i18n-remove --locale=zh-CN --write", - "postinstall": "umi g tmp", - "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc", - "lint-staged": "lint-staged", - "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", - "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style", - "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", - "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto", - "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", - "openapi": "umi openapi", - "precommit": "lint-staged", - "prettier": "prettier -c --write \"src/**/*\"", - "start": "cross-env UMI_ENV=dev umi dev", - "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev", - "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev", - "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev", - "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev", - "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev", - "pretest": "node ./tests/beforeTest", - "test": "umi test", - "test:all": "node ./tests/run-tests.js", - "test:component": "umi test ./src/components", - "serve": "umi-serve", - "tsc": "tsc --noEmit", - "oss-test": "cross-env NODE_ENV=develepment perfix=test-lib-front node upload.js" - }, - "lint-staged": { - "**/*.less": "stylelint --syntax less", - "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", - "**/*.{js,jsx,tsx,ts,less,md,json}": [ - "prettier --write" - ] - }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 10" - ], - "dependencies": { - "@ant-design/charts": "^0.9.4", - "@ant-design/icons": "^4.7.0", - "@ant-design/pro-descriptions": "^1.6.8", - "@ant-design/pro-form": "^1.18.3", - "@ant-design/pro-layout": "^6.15.3", - "@ant-design/pro-table": "^2.30.8", - "@antv/data-set": "^0.11.0", - "@antv/l7": "^2.3.7", - "@antv/l7-maps": "^2.3.7", - "@antv/l7-react": "^2.1.9", - "@types/react-color": "^3.0.6", - "@types/react-custom-scrollbars": "^4.0.10", - "@types/reactcss": "^1.2.6", - "@types/styled-components": "^5.1.24", - "@types/yamljs": "^0.2.31", - "@umijs/route-utils": "^1.0.36", - "@wangeditor/editor": "^5.0.1", - "@wangeditor/plugin-md": "^1.0.0", - "ahooks": "^3.1.13", - "antd": "^4.21.0", - "bizcharts": "^3.5.3-beta.0", - "bizcharts-plugin-slider": "^2.1.1-beta.1", - "classnames": "^2.2.6", - "clipboard": "^2.0.11", - "echarts": "^5.3.2", - "gg-editor": "^2.0.2", - "html2canvas": "^1.4.1", - "html2pdf.js": "^0.10.1", - "immutability-helper": "^3.1.1", - "jspdf": "^2.5.1", - "lodash": "^4.17.11", - "lodash-decorators": "^6.0.0", - "moment": "^2.25.3", - "numeral": "^2.0.6", - "nzh": "^1.0.3", - "omit.js": "^2.0.2", - "react": "^17.0.0", - "react-color": "^2.19.3", - "react-custom-scrollbars": "^4.2.1", - "react-dev-inspector": "^1.1.1", - "react-dnd": "^14.0.4", - "react-dnd-html5-backend": "^14.0.2", - "react-dom": "^17.0.0", - "react-fittext": "^1.0.0", - "react-helmet-async": "^1.0.4", - "react-router": "^4.3.1", - "react-split-pane": "^0.1.92", - "reactcss": "^1.2.3", - "styled-components": "^5.3.5", - "umi": "^3.5.23", - "umi-serve": "^1.9.10", - "yamljs": "^0.3.0" - }, - "devDependencies": { - "@ant-design/pro-cli": "^2.0.2", - "@types/express": "^4.17.0", - "@types/history": "^4.7.2", - "@types/jest": "^26.0.0", - "@types/lodash": "^4.14.144", - "@types/react": "^17.0.0", - "@types/react-dom": "^17.0.0", - "@types/react-helmet": "^6.1.0", - "@umijs/fabric": "^2.6.2", - "@umijs/openapi": "^1.1.14", - "@umijs/plugin-blocks": "^2.0.5", - "@umijs/plugin-esbuild": "^1.0.1", - "@umijs/plugin-openapi": "^1.2.0", - "@umijs/preset-ant-design-pro": "^1.2.0", - "@umijs/preset-dumi": "^1.1.7", - "@umijs/preset-react": "^1.8.17", - "@umijs/yorkie": "^2.0.3", - "carlo": "^0.9.46", - "cross-env": "^7.0.0", - "cross-port-killer": "^1.1.1", - "detect-installer": "^1.0.1", - "enzyme": "^3.11.0", - "eslint": "^7.1.0", - "express": "^4.17.1", - "gh-pages": "^3.0.0", - "jsdom-global": "^3.0.2", - "lint-staged": "^10.0.0", - "mockjs": "^1.0.1-beta3", - "prettier": "^2.3.2", - "puppeteer-core": "^8.0.0", - "stylelint": "^13.0.0", - "typescript": "^4.2.2" - }, - "engines": { - "node": ">=10.0.0" - }, - "gitHooks": { - "commit-msg": "fabric verify-commit" - }, - "resolutions": { - "styled-components": "^5" - } -} \ No newline at end of file + "name": "test-lib-front", + "version": "1.0.0", + "private": true, + "description": "An out-of-box UI solution for enterprise applications", + "scripts": { + "analyze": "cross-env ANALYZE=1 umi build", + "build": "umi build", + "build:keep": "umi build && yarn oss-test", + "deploy": "npm run build && npm run gh-pages", + "dev": "npm run start:dev", + "gh-pages": "gh-pages -d dist", + "i18n-remove": "pro i18n-remove --locale=zh-CN --write", + "postinstall": "umi g tmp", + "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc", + "lint-staged": "lint-staged", + "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", + "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style", + "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", + "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto", + "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", + "openapi": "umi openapi", + "precommit": "lint-staged", + "prettier": "prettier -c --write \"src/**/*\"", + "start": "cross-env UMI_ENV=dev umi dev", + "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev", + "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev", + "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev", + "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev", + "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev", + "pretest": "node ./tests/beforeTest", + "test": "umi test", + "test:all": "node ./tests/run-tests.js", + "test:component": "umi test ./src/components", + "serve": "umi-serve", + "tsc": "tsc --noEmit", + "oss-test": "cross-env NODE_ENV=develepment perfix=test-lib-front node upload.js" + }, + "lint-staged": { + "**/*.less": "stylelint --syntax less", + "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", + "**/*.{js,jsx,tsx,ts,less,md,json}": [ + "prettier --write" + ] + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 10" + ], + "dependencies": { + "@ant-design/charts": "^0.9.4", + "@ant-design/icons": "^4.7.0", + "@ant-design/pro-descriptions": "^1.6.8", + "@ant-design/pro-form": "^1.18.3", + "@ant-design/pro-layout": "^6.15.3", + "@ant-design/pro-table": "^2.30.8", + "@antv/data-set": "^0.11.0", + "@antv/l7": "^2.3.7", + "@antv/l7-maps": "^2.3.7", + "@antv/l7-react": "^2.1.9", + "@types/react-color": "^3.0.6", + "@types/react-custom-scrollbars": "^4.0.10", + "@types/reactcss": "^1.2.6", + "@types/styled-components": "^5.1.24", + "@types/yamljs": "^0.2.31", + "@umijs/route-utils": "^1.0.36", + "@wangeditor/editor": "^5.1.12", + "@wangeditor/plugin-md": "^1.0.0", + "ahooks": "^3.1.13", + "antd": "^4.21.0", + "bizcharts": "^3.5.3-beta.0", + "bizcharts-plugin-slider": "^2.1.1-beta.1", + "classnames": "^2.2.6", + "clipboard": "^2.0.11", + "echarts": "^5.3.2", + "gg-editor": "^2.0.2", + "html2canvas": "^1.4.1", + "html2pdf.js": "^0.10.1", + "immutability-helper": "^3.1.1", + "jspdf": "^2.5.1", + "lodash": "^4.17.11", + "lodash-decorators": "^6.0.0", + "moment": "^2.25.3", + "numeral": "^2.0.6", + "nzh": "^1.0.3", + "omit.js": "^2.0.2", + "react": "^17.0.0", + "react-color": "^2.19.3", + "react-custom-scrollbars": "^4.2.1", + "react-dev-inspector": "^1.1.1", + "react-dnd": "^14.0.4", + "react-dnd-html5-backend": "^14.0.2", + "react-dom": "^17.0.0", + "react-fittext": "^1.0.0", + "react-helmet-async": "^1.0.4", + "react-router": "^4.3.1", + "react-split-pane": "^0.1.92", + "reactcss": "^1.2.3", + "styled-components": "^5.3.5", + "umi": "^3.5.23", + "umi-serve": "^1.9.10", + "yamljs": "^0.3.0" + }, + "devDependencies": { + "@ant-design/pro-cli": "^2.0.2", + "@types/express": "^4.17.0", + "@types/history": "^4.7.2", + "@types/jest": "^26.0.0", + "@types/lodash": "^4.14.144", + "@types/react": "^17.0.0", + "@types/react-dom": "^17.0.0", + "@types/react-helmet": "^6.1.0", + "@umijs/fabric": "^2.6.2", + "@umijs/openapi": "^1.1.14", + "@umijs/plugin-blocks": "^2.0.5", + "@umijs/plugin-esbuild": "^1.4.1", + "@umijs/plugin-openapi": "^1.2.0", + "@umijs/preset-ant-design-pro": "^1.2.0", + "@umijs/preset-dumi": "^1.1.7", + "@umijs/preset-react": "^1.8.17", + "@umijs/yorkie": "^2.0.3", + "carlo": "^0.9.46", + "cross-env": "^7.0.0", + "cross-port-killer": "^1.1.1", + "detect-installer": "^1.0.1", + "enzyme": "^3.11.0", + "eslint": "^7.1.0", + "express": "^4.17.1", + "gh-pages": "^3.0.0", + "jsdom-global": "^3.0.2", + "lint-staged": "^10.0.0", + "mockjs": "^1.0.1-beta3", + "prettier": "^2.3.2", + "puppeteer-core": "^8.0.0", + "stylelint": "^13.0.0", + "typescript": "^4.2.2" + }, + "engines": { + "node": ">=10.0.0" + }, + "gitHooks": { + "commit-msg": "fabric verify-commit" + }, + "resolutions": { + "styled-components": "^5" + } +} diff --git a/src/components/RichTextEditor/index.tsx b/src/components/RichTextEditor/index.tsx index 35568d9..ff9007c 100644 --- a/src/components/RichTextEditor/index.tsx +++ b/src/components/RichTextEditor/index.tsx @@ -31,12 +31,13 @@ const customUpload = async (file: File, insertFn: any) => { } const RichTextEditor: React.FC = (props) => { - const { defaultValue, onEditorChange, config = {} } = props + const { defaultValue = [], onEditorChange, config = {} } = props const toolbar = React.useRef(null) const editor = React.useRef(null) as any React.useEffect(() => { + console.log("effect") const riceEditor = createEditor({ selector: editor.current, content: defaultValue || [], @@ -56,10 +57,10 @@ const RichTextEditor: React.FC = (props) => { config: toolbarConfig }) - onEditorChange && onEditorChange(vm) + onEditorChange?.(vm) }, onChange(vm) { - onEditorChange && onEditorChange(vm) + onEditorChange?.(vm) }, customAlert(s, t) { message[t || 'info'](s) @@ -71,7 +72,7 @@ const RichTextEditor: React.FC = (props) => { return () => { riceEditor?.destroy() } - }, [defaultValue]) + }, [defaultValue, config, onEditorChange]) const size = useSize(toolbar); @@ -83,4 +84,9 @@ const RichTextEditor: React.FC = (props) => { ) } -export default RichTextEditor \ No newline at end of file +export default React.memo( + RichTextEditor, + (prevProps, nextProps) => { + return prevProps.defaultValue?.toString() === nextProps.defaultValue?.toString() + } +) \ No newline at end of file diff --git a/src/pages/Demand/components/AddDemand.tsx b/src/pages/Demand/components/AddDemand.tsx index 02bd6c6..66c7ce4 100644 --- a/src/pages/Demand/components/AddDemand.tsx +++ b/src/pages/Demand/components/AddDemand.tsx @@ -13,9 +13,7 @@ type IProps = { onCancel?: () => void; } -type IRefs = { - [k: string]: any -} +type IRefs = Record type optionType = { value: React.ReactText; @@ -34,7 +32,7 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re const [isVeiw, setIsVeiw] = React.useState(false) const [source, setSource] = React.useState(undefined) - const textEditorRef = React.useRef([]) as any + const textEditorRef = React.useRef(null) as any const promiseQuest = async (questFn: promiseRequest, id?: number) => { const result = await questFn(id) @@ -81,6 +79,7 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re setIsLoading(false) setSource(undefined) setIsVeiw(false) + textEditorRef.current = null } const handleOk = async () => { diff --git a/src/pages/Outline/index.tsx b/src/pages/Outline/index.tsx index 09ff7bb..f5b662c 100644 --- a/src/pages/Outline/index.tsx +++ b/src/pages/Outline/index.tsx @@ -1,11 +1,12 @@ import React from 'react'; -import { Table, Space, Typography, Row, Button, message, TableColumnProps } from 'antd'; +import { Table, Space, Typography, Row, Button, message } from 'antd'; import { queryTableList, download } from './services'; import { useRequest } from 'ahooks'; import AddModal from './components/AddModal'; import DeleteModal from './components/DeleteModal'; import { deleteOutline } from './services'; import { useAccess } from 'umi' +import type { TableColumnProps } from "antd" import OverflowText from "@/components/Public/OverflowText" const DEFAULT_PAGE_QUERY = { page_size: 20, page_num: 1 }; @@ -42,7 +43,6 @@ const TestDemand: React.FC = () => { deleteModalRef.current?.show(row); }; - const handleDownload = async (row: any) => { const data = await download(row.id); const fileContent = row.name.split('.'); @@ -77,25 +77,25 @@ const TestDemand: React.FC = () => { dataIndex: 'remark', ellipsis: true, width: 200, - render(_, row) { - return + render(_) { + return {_} } }, { title: '创建人', dataIndex: 'owner', - render(_, row) { + render(_) { return _ || "-" } }, { title: '创建日期', dataIndex: 'gmt_created', - render(_, row) { + render(_) { return _ || "-" } }, - //@ts-ignore + /* @ts-ignore */ access.canTester() && { title: '操作', diff --git a/src/pages/Plan/CreatePage.tsx b/src/pages/Plan/CreatePage.tsx index e7906d2..fba3a74 100644 --- a/src/pages/Plan/CreatePage.tsx +++ b/src/pages/Plan/CreatePage.tsx @@ -1,11 +1,9 @@ import React from "react" -import { Table, Space, Typography, Row, Button, Col, Spin, Form, message, Input, Select } from "antd" -import { createTestPlan, queryTestPlanList, updateTestPlanDetail } from "./services" -import Loading from "@/components/Loading" +import { Space, Typography, Row, Button, Form, message, Input, Select } from "antd" +import { createTestPlan, updateTestPlanDetail, updateTestPlanTasks } from "./services" import { history, request, useParams, useRequest } from "umi" import RichTextEditor from "@/components/RichTextEditor" -import SuiteTable from "@/pages/Plan/components/ContentTable/Suite.table" import TaskTable from "@/pages/Plan/components/ContentTable/Task.table" import { CustomForm } from "@/components/CustomStyled" import { usePlanProvider } from "./hooks" @@ -16,9 +14,7 @@ import { usePlanProvider } from "./hooks" * */ -type IProps = { - [k: string]: any; -} +type IProps = Record const TestPlan: React.FC = (props) => { const { route } = props @@ -35,35 +31,44 @@ const TestPlan: React.FC = (props) => { }, [source]) const [baseData, setBaseData] = React.useState({}) - const { data: requirement, run } = useRequest(() => request(`/api/requirement`), { initialData: [], manual: true }) - - React.useEffect(() => { - run() - }, []) + const doc = React.useRef(null) as any + const { data: requirement } = useRequest(() => request(`/api/requirement`), { initialData: [] }) const handleSave = () => { form.validateFields() .then(async (values) => { const { tasksAndCases } = baseData - const params = { ...baseData, ...values, reviewers: "xxxx", tasks: tasksAndCases?.tasks ? tasksAndCases?.tasks.map((i: any) => i.id) : [] } + const params = { + // ...baseData, + ...values, + reviewers: "xxxx", + tasks: [], + content: doc.current?.children + } const isEditPage = plan_id && source - const { data, code, msg } = isEditPage ? - await updateTestPlanDetail(plan_id, params) : - await createTestPlan(params) - if (code !== 200) { - message.error(msg) - return - } 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 (code !== 200) { + message.error(msg) + return + } onOk() refresh() message.success("操作成功") } - else + else { + const { data, code, msg } = await createTestPlan(params) + if (code !== 200) { + message.error(msg) + return + } history.push(`/plan/${data.id}`) + } }) } @@ -71,7 +76,7 @@ const TestPlan: React.FC = (props) => {
- 新建方案 + {"编辑方案"} 基础信息 @@ -101,14 +106,14 @@ const TestPlan: React.FC = (props) => { 描述
setBaseData((p: any) => ({ ...p, content: vm.children }))} + onEditorChange={(vm: any) => doc.current = vm} />
diff --git a/src/pages/Plan/components/AddModal.tsx b/src/pages/Plan/components/AddModal.tsx index cecbda2..509785c 100644 --- a/src/pages/Plan/components/AddModal.tsx +++ b/src/pages/Plan/components/AddModal.tsx @@ -1,22 +1,34 @@ import React from "react" -import { Modal, Form, Input, Space, Button } from "antd" +import { Modal, Form, Select, Space, Button, Row, Col, Input, Result, message } from "antd" +import { useRequest, request, history } from "umi"; +import RichTextEditor from "@/components/RichTextEditor" +import { createTestPlan, updateTestPlanTasks } from "@/pages/Plan/services" +import TaskSelect from "./SelectModal/Task.select"; +import { usePlanProvider } from "@/pages/Plan/hooks" type IProps = { - onOk: () => void; - onCancel?: () => void; + onOk?: () => void; } -type IRefs = { - [k: string]: any -} +type IRefs = Record const ReactComponent: React.ForwardRefRenderFunction = (props, ref) => { - const { onOk } = props + /* const { onOk } = props */ + const { refresh } = usePlanProvider() const [visible, setVisible] = React.useState(false) const [loading, setLoading] = React.useState(false) const [source, setSource] = React.useState(undefined) + const [isEdit, setIsEdit] = React.useState(true) + + const vm = React.useRef(null) as any + const addTaskModalRef = React.useRef(null) as any + + const [form] = Form.useForm() + + const { data: requirement } = useRequest(() => request(`/api/requirement`), {}) + React.useImperativeHandle(ref, () => ({ show(_: any) { setSource(_) @@ -25,42 +37,172 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re } })) - const [form] = Form.useForm() - const handleCancel = () => { setVisible(false) setLoading(false) setSource(undefined) + setIsEdit(true) + form.resetFields() + vm.current = null } - const handleOk = async () => { + const handleCreatePlan = () => { if (loading) return - setLoading(true) - onOk() + form.validateFields() + .then(async (values: any) => { + const params = { + ...values, + content: vm.current?.getText() ? vm.current?.children : [], + reviewers: "xxx", + tasks: [], + } + setLoading(true) + const { data, code, msg } = await createTestPlan(params) + setLoading(false) + if (code !== 200) return message.error(msg) + setSource(data) + setIsEdit(false) + refresh() + }) + .catch(err => { + console.log(err) + }) + } + + const handleViewPlan = async (list?: any) => { + if (list) { + const tasks = list.map((i: any) => i.id) + const { code } = await updateTestPlanTasks(source?.id, { tasks }) + if (code !== 200) return + message.success("操作成功!") + } + history.push(`/plan/${source?.id}`) handleCancel() } return ( - - + + { + isEdit ? + : + + }
} + centered onCancel={handleCancel} - onOk={handleOk} > -
- - - -
+ { + isEdit ? +
+ + + + + + +
+ vm.current = p} + /> +
+
+ + + { + requirement && + + ({ label: i.name, value: i.id })) - } + options={wsList} showSearch + onChange={(val) => setWorkspaceId(val.value)} + placeholder="请选择Workspace" + labelInValue filterOption={ (input, option: any) => { return ( @@ -325,18 +339,14 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re ) } } - placeholder="请选择测试设备" /> - - {/* T-One Setting */} - +