13404089107
2025-03-14 a6b15483b832fc1fc27a050c93a3a6f371b57a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import { Form, Input, Modal, Select, Upload, Space, Button, message, Row, Col, Divider } from 'antd';
import { sendRequest } from '@/utils/antdUtils';
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons';
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import { customRequest } from '@/utils/utils';
import { add, Edit, getDetail } from '../service'
 
const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 12 },
};
 
const AddEditView = ({ visible, onSave, onUpdate, onCancel, }, ref) => {
  const [form] = Form.useForm();
  const [fileList, setFileList] = useState([])//banner图片
  const [loading, setLoading] = useState(false);
  const [editData, setEditData] = useState({})
 
  const formItemLayout = {
    labelCol: { span: 6 },
    wrapperCol: { span: 20 },
  };
 
 
  useImperativeHandle(ref, () => {
    return {
      refreshData: (data) => {
 
        setEditData(data);
        if (data.id) {
          // getDetail(data.id).then(res => {
          //   if (res.data.url) {
          //     let obj = [{
          //       uid: 1,
          //       name: 'banner',
          //       url: res.data.url
          //     }]
          //     setFileList(obj)
          //     form.setFieldsValue({ image: obj })
          //   }
          //   form.setFieldsValue({name: res.data.name})
          // })
        }
      },
      clean: () => {
        form.resetFields();
        setFileList([])
      },
    };
  });
 
 
 
  // 提交表单
  const submit = () => {
    form.validateFields().then(async (values) => {
 
      values.url = fileList[0].url
      delete values.image
      if (editData.id) {
        values.id = editData.id
        onUpdate(values)
        return
      }
      onSave(values)
    })
  }
 
  return (
    <Modal
      getContainer={false}
      width="65%"
      destroyOnClose
      title={'提示'}
      open={visible}
      okText='确认'
      onCancel={() => onCancel(false)}
      onOk={submit}
    >
      <div style={{ width: '100%', textAlign: 'center', margin: '20px 0', fontWeight: 'bold' }}>确认审核{editData.type == 'sure' ? '同意' : '拒绝'}所选信息么?</div>
      <Form scrollToFirstError layout="horizontal" {...formItemLayout} form={form}>
        <Row>
          <Col span={8}>
            <Form.Item
              name="name"
              label='姓名'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
            <Form.Item
              name="name"
              label='所在社区'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
            <Form.Item
              name="name"
              label='头像上传'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
          </Col>
          <Col span={8}>
            <Form.Item
              name="name"
              label='联系电话'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
            <Form.Item
              name="name"
              label='服务对象'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item></Col>
          <Col span={8}>
            <Form.Item
              name="name"
              label='身份证号'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
            <Form.Item
              name="name"
              label='所在党组织'
              required
            >
              <Input disabled placeholder='请输入'></Input>
            </Form.Item>
          </Col>
        </Row>
        {editData.type == 'refuse' && (
          <>
            <Divider />
            <Row>
              <Col span={8}>
                <Form.Item
                  name="remark"
                  label='拒绝理由'
                  rules={[{ required: true, message: '拒绝理由必填' }]}
                >
                  <Input.TextArea placeholder='请输入拒绝理由'></Input.TextArea>
                </Form.Item>
              </Col>
            </Row>
          </>
        )}
 
 
      </Form>
    </Modal>
  );
};
 
export default forwardRef(AddEditView);