"// ??\nimport { Modal, Form, Table, Typography, Button, message } from 'antd';\nimport React, { useEffect, useState } from 'react';\nimport SqlTable from '../testConfig/SqlTable';\nimport { largeVersionV1LargeDeployList } from '@/services/fortest';\nimport { APPACTION_STATUS } from '@/constant/const';\nimport { largeVersionV1LargeDeploy } from '@/services/large-versionV1';\nconst { Title } = Typography;\n\nconst TestingStageModal = (props) => {\n const { children, stageData, test, largeVersionId, listProjects } = props;\n const [visible, setVisible] = useState(false);\n const [form] = Form.useForm();\n const [selectesRowkey, setSelectedRowKeys] = useState([]);\n const [datas, setDatas] = useState([]);\n const [dbConfigInfosData, setDbConfigInfosData] = useState([]);\n const [selectTestRows, setSelectTestRows] = useState([]);\n const [sqlRows, setSqlRows] = useState([]); \n\n const handleSelect = (selectedRowKeys, selectedRows) => {\n setSelectedRowKeys(selectedRowKeys);\n setSelectTestRows(selectedRows);\n };\n\n const handleSqlRowsChange = (rows) => {\n setSqlRows(rows);\n console.log(rows, 30);\n };\n useEffect(() => {\n if (visible && stageData) {\n largeDeployList(); //应用信息列表\n }\n }, [visible, stageData]);\n\n const largeDeployList = async () => {\n const { data } = await largeVersionV1LargeDeployList({\n largeVersionId: largeVersionId,\n env: 'test',\n projectId: stageData.projectId,\n });\n const applicationInfosData = data[0]?.largeVersionDeployConfigVO?.applicationInfos || [];\n setDatas(applicationInfosData);\n setDbConfigInfosData(data[0]?.largeVersionDeployConfigVO?.dbConfigInfos);\n };\n const handleUpdate = async () => {\n const params = {\n largeVersionId: largeVersionId,\n env: 'test',\n projectId: stageData.projectId,\n largeVersionDeployConfigVO: {\n largeVersionId: largeVersionId,\n env: 'test',\n projectId: stageData.projectId,\n projectName: stageData.projectName,\n applicationInfos: selectTestRows,\n dbConfigInfos: sqlRows,\n },\n };\n\n const data = await largeVersionV1LargeDeploy(params);\n if (!data.errorCode) {\n message.success('保存成功');\n setVisible(fasle);\n if (listProjects) {\n listProjects();\n }\n } else {\n message.error(data.message);\n }\n console.log(data, 5444);\n };\n const columns = [\n // { title: '全选', dataIndex: 'name' },\n { title: '部署顺序', dataIndex: 'deployOrder' },\n { title: '制品镜像id', dataIndex: 'imageId' },\n { title: '应用id', dataIndex: 'appId' },\n { title: '部署状态', dataIndex: 'deployStatus', width: 160, fixed: 'right', render: (_, record) => { return ({APPACTION_STATUS[record.deployStatus]}) } },\n ];\n return (\n <>\n {React.cloneElement(children, {\n onClick: () => {\n setVisible(true);\n },\n })}\n <Modal\n title={test === 'arrange' ? '部署' : '详情'}\n open={visible}\n width={800}\n layout="horizontal"\n onOk={handleUpdate}\n onCancel={() => setVisible(false)}\n maskClosable={false}\n footer={[\n <>\n <Button onClick={() => setVisible(false)}>取消\n <Button type="primary" onClick={handleUpdate} disabled={test === 'details'}>\n 确定\n \n </>,\n ]}\n >\n {/*

/}\n
\n {/ /}\n <div style={{ marginTop: 24 }}>\n 应用信息列表\n
\n <Table\n rowKey={(record) => record.appId}\n columns={columns}\n dataSource={datas}\n pagination={false}\n rowSelection={{\n selectedRowKeys: selectesRowkey,\n onChange: handleSelect,\n }}\n />\n {/ { SQL信息列表} /}\n <SqlTable\n dbConfigInfosData={dbConfigInfosData}\n onSelectRowsChange={handleSqlRowsChange}\n />\n
\n\n {/ */}\n \n </>\n );\n};\nexport default TestingStageModal;表格已经 rowKey={(record) => record.appId}为啥还报红devScripts.js:6523 Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of Panel. It was passed a child from TestingStageModal. See https://fb.me/react-warning-keys for more information.\n in Fragment (created by TestingStageModal)\n in Panel (created by CSSMotion)\n in DomWrapper (created by CSSMotion)\n in CSSMotion (created by Content)\n in Content (created by Dialog)\n in div (created by Dialog)\n in div (created by Dialog)\n in Dialog (created by Dialog)\n in Portal (created by Dialog)\n in Dialog (created by Modal)\n in NoFormStyle (created by Modal)\n in NoCompactStyle (created by Modal)\n in Modal (at TestingStageModal.js:86)\n in TestingStageModal (at TestingStage.js:73)\n in td (created by Cell)\n in Cell\n in Cell (created by WrappedCell)\n in WrappedCell (created by BodyRow)\n in tr (created by BodyRow)\n in BodyRow (created by Body)\n in tbody (created by Body)\n in Provider (created by Body)\n in Body (created by Table)\n in table (created by Table)\n in div (created by Table)\n in div (created by Table)\n in Unknown\n in Unknown (created by Table)\n in div (created by Table)\n in Table (created by ForwardRef(InternalTable))\n in div (created by Context.Consumer)\n in div (created by Context.Consumer)\n in Spin (created by Spin)\n in Spin (created by ForwardRef(InternalTable))\n in div (created by ForwardRef(InternalTable))\n in ForwardRef(InternalTable) (at TestingStage.js:119)\n in TestingStage (at StepDetail/index.js:36)\n in div (created by ForwardRef)\n in div (created by ForwardRef)\n in ForwardRef (at StepDetail/index.js:49)\n in StepDetail (created by LoadableComponent)\n in LoadableComponent (created by Context.Consumer)\n in Route (created by Context.Consumer)\n in Switch (created by Context.Consumer)\n in Route (created by Context.Consumer)\n in Switch (created by Context.Consumer)\n in Authorized (at BasicLayout.tsx:237)\n in div (at WatchMark/index.tsx:160)\n in WaterMark (at BasicLayout.tsx:233)\n in div (created by GridContent)\n in GridContent (created by WrapContent)\n in div (created by WrapContent)\n in ProviderChildren (created by Context.Consumer)\n in LocaleReceiver (created by ConfigProvider)\n in ConfigProvider (created by WrapContent)\n in main (created by ForwardRef)\n in ForwardRef (created by Content)\n in Content (created by WrapContent)\n in WrapContent (created by ResizeObserver)\n in ResizeObserver (created by ResizeObserverContent)\n in div (created by ResizeObserverContent)\n in ResizeObserverContent (created by BasicLayout)\n in section (created by ForwardRef)\n in ForwardRef (created by Layout)\n in Layout (created by BasicLayout)\n in section (created by ForwardRef)\n in ForwardRef (created by Layout)\n in Layout (created by BasicLayout)\n in div (created by BasicLayout)\n in Provider (created by BasicLayout)\n in BasicLayout (at BasicLayout.tsx:189)\n in BasicLayout (created by Connect(BasicLayout))\n in Connect(BasicLayout) (created by LoadableComponent)\n in LoadableComponent (created by Context.Consumer)\n in Route (created by Context.Consumer)\n in Switch (created by Context.Consumer)\n in SecurityLayout (created by Connect(SecurityLayout))\n in Connect(SecurityLayout) (created by LoadableComponent)\n in LoadableComponent (created by Context.Consumer)\n in Route (created by RouterComponent)\n in Switch (created by RouterComponent)\n in Router (created by RouterComponent)\n in RouterComponent\n in Provider (created by _DvaContainer)\n in _DvaContainer\n in Unknown\n in FormProvider (created by ProviderChildren)\n in LocaleProvider (created by ProviderChildren)\n in ProviderChildren (created by Context.Consumer)\n in LocaleReceiver (created by ConfigProvider)\n in ConfigProvider (at locale.tsx:57)\n in _LocaleContainer\n in Unknown

测试阶段 Modal - 部署和详情

原文地址: https://www.cveoy.top/t/topic/pLjR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录