import React, {Fragment} from "react"; import {Button, Dropdown, MenuProps, message, Modal, Popconfirm, Space} from "antd"; import {DownOutlined, QuestionCircleOutlined} from "@ant-design/icons"; import {DetailForm} from "@/app/ui/task/four/DetailForm"; import {commonUpdate, deleteTask, OPERATION_BUTTON_TYPE} from "@/app/lib/task/project/data"; import Link from "next/link"; export interface OperationButtonProps { itemId: number, pid: number, pPid: number, operationId?: string, refreshDate?: () => void, } interface OperationModelProps { operationId: number | undefined, pPid: number, pid: number, openModal: boolean } class OperationButton extends React.Component { constructor(props: OperationButtonProps) { super(props); this.state = { pid: props.pid, pPid: props.pPid, operationId: undefined, openModal: false }; } render() { const handleCancel = () => { this.setState({...this.state, openModal: false}) if (this.state.operationId !== OPERATION_BUTTON_TYPE.DETAIL) { this.props.refreshDate?.() } } const onClick: MenuProps['onClick'] = ({key}) => { console.log(key) }; const items: MenuProps['items'] = [ { key: OPERATION_BUTTON_TYPE.DETAIL, label: { this.setState({openModal: true, operationId: OPERATION_BUTTON_TYPE.DETAIL}) }}>任务详情, }, { key: OPERATION_BUTTON_TYPE.ADD_CHILD, label: { this.setState({openModal: true, operationId: OPERATION_BUTTON_TYPE.ADD_CHILD}) }}>添加支线任务, }, { key: OPERATION_BUTTON_TYPE.UPDATE, label: { this.setState({openModal: true, operationId: OPERATION_BUTTON_TYPE.UPDATE}) }}>修改任务, }, { key: OPERATION_BUTTON_TYPE.DELETE, label: } okText="确认" cancelText="取消" onConfirm={() => { deleteTask(this.props.itemId).then((response => { console.log('response', response) if (response.status.success) { message.success("删除任务成功:" + response.data) this.props.refreshDate?.() } })); }} >删除任务, }, { key: OPERATION_BUTTON_TYPE.COMPLETE, label: { commonUpdate({ updateColoumList:[{ name:'state', code:'state', value:'7' }], conditionColoumList:[{ name:'id', code:'id', operateType:'=', value:this.props.itemId }] }).then((response => { console.log('response', response) if (response.status.success) { message.success("完成任务成功") this.props.refreshDate?.() } })); }} >完成任务, }, { key: OPERATION_BUTTON_TYPE.SHOW_FOUR, label: 四象限显示子任务, } ]; return { e.preventDefault() }}> 操作 // Return // , // , // , // ]} > } } export default OperationButton;