Blame view

src/pages/Order/OrderWarning/components/OrderNotesEditModal.tsx 1.29 KB
1
import { RESPONSE_CODE } from '@/constants/enum';
2
import { postServiceOrderNotesEdit } from '@/services';
3
4
import { ModalForm, ProFormTextArea } from '@ant-design/pro-components';
import { Form, message } from 'antd';
5
export default ({ setNotesEditVisible, notes, ids, notesType, 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
        let body = {
28
          id: ids[0],
zhongnanhuang authored
29
          notes: values.name,
30
          notesType: notesType,
zhongnanhuang authored
31
        };
32
        const res = await postServiceOrderNotesEdit({ data: body });
33
34
35
36
37
38
39
40
41
42
        if (res.result === RESPONSE_CODE.SUCCESS) {
          message.success(res.message);
          onClose();
        }
      }}
      onOpenChange={setNotesEditVisible}
    >
      <ProFormTextArea
        width="lg"
        name="name"
43
        initialValue={notes}
44
45
46
47
48
        placeholder="填写备注内容"
      />
    </ModalForm>
  );
};