1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import { useAjax } from "@/Hook/useAjax";
- import { addV3StrategyApi } from "@/services/adqV3";
- import { Button, Form, Input, message, Modal } from "antd"
- import React, { useState } from "react"
- import '../../index.less'
- interface Props {
- strategyValue: {
- adData: any[],
- addelivery: PULLIN.AddeliveryProps,
- accountCreateLogs: PULLIN.AccountCreateLogsProps[],
- materialData: any,
- textData: any
- }
- putInType?: 'NOVEL' | 'GAME'
- }
- /**
- * 存为策略组
- * @returns
- */
- const TacticsS: React.FC<Props> = ({ strategyValue, putInType }) => {
- /*********************************/
- const [form] = Form.useForm();
- const [visible, setVisible] = useState<boolean>(false)
- const addV3Strategy = useAjax((params) => addV3StrategyApi(params))
- /*********************************/
- const seve = () => {
- setVisible(true)
- }
- const handleOk = () => {
- form.validateFields().then(values => {
- addV3Strategy.run({ ...values, strategyValue: JSON.stringify(strategyValue), type: 'updateAd', taskType: putInType }).then(res => {
- if (res) {
- message.success('保存成功')
- form.resetFields()
- setVisible(false)
- }
- })
- })
- }
- return <>
- <Button type='primary' onClick={seve}>存为策略组</Button>
- {visible && <Modal
- title="存为策略组"
- open={visible}
- onCancel={() => { form.resetFields(); setVisible(false) }}
- onOk={handleOk}
- confirmLoading={addV3Strategy.loading}
- className="modalResetCss"
- >
- <Form
- form={form}
- layout='vertical'
- name="saveUpdateAd"
- colon={false}
- initialValues={{}}
- >
- <Form.Item label={<strong>策略组名称</strong>} name='strategyKey' rules={[{ required: true, message: '请输入策略组名称' }]}>
- <Input placeholder="请输入策略组名称" showCount maxLength={30} />
- </Form.Item>
- </Form>
- </Modal>}
- </>
- }
- export default React.memo(TacticsS)
|