Blame view

src/pages/Order/components/OrderNotesEditModal.tsx 1.31 KB
1
2
3
4
import { RESPONSE_CODE } from '@/constants/enum';
import { postServiceOrderDetails } from '@/services';
import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
import { Form, message } from 'antd';
zhongnanhuang authored
5
export default ({ setNotesEditVisible, data, isMianOrder, onClose }) => {
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  const [form] = Form.useForm<{ name: string; company: string }>();
  return (
    <ModalForm<{
      name: string;
      company: string;
    }>
      width={500}
      open
      title="修改备注"
      form={form}
      autoFocusFirstInput
      modalProps={{
        okText: '保存',
        cancelText: '取消',
        destroyOnClose: true,
        onCancel: () => {
          setNotesEditVisible(false);
        },
      }}
      submitTimeout={2000}
      onFinish={async (values) => {
zhongnanhuang authored
27
28
29
30
31
        let body = {
          id: data.id,
          notes: values.name,
          checkSubOrderOrMainOrder: isMianOrder,
        };
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
        const res = await postServiceOrderDetails({ data: body });
        if (res.result === RESPONSE_CODE.SUCCESS) {
          message.success(res.message);
          onClose();
        }
      }}
      onOpenChange={setNotesEditVisible}
    >
      <ProFormTextArea
        width="lg"
        name="name"
        initialValue={data.notes}
        placeholder="填写备注内容"
      />
    </ModalForm>
  );
};