zlisen il y a 3 ans
Parent
révision
6bf2a26579
1 fichiers modifiés avec 27 ajouts et 16 suppressions
  1. 27
    16
      src/pages/findRoom/buyRoom/audit.jsx

+ 27
- 16
src/pages/findRoom/buyRoom/audit.jsx Voir le fichier

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Card, Radio, notification, Select } from 'antd';
2
+import { Form, Input, Button, Card, Radio, notification, Select,Checkbox } from 'antd';
3 3
 import moment from 'moment';
4 4
 import request from '@/utils/request';
5 5
 import apis from '@/services/apis';
@@ -20,7 +20,6 @@ const tailFormItemLayout = {
20 20
     sm: { span: 16 },
21 21
   },
22 22
 };
23
-const questionnaire = `[{"question":"你的购房预算是多少?","key":"minPrice","type":"range","result":1000000,"resultId":null,"options":[100,500]},{"question":"你的购房预算是多少?","key":"maxPrice","type":"range","result":2910000,"resultId":null,"options":[100,500]},{"question":"你想购买的是新房还是二手房?","key":"isNew","type":"checkbox","result":"新房","resultId":1,"options":[{"name":"新房","id":1},{"name":"二手房","id":2},{"name":"不限","id":3}]},{"question":"你想住几居室的房子?","key":"layout","type":"checkbox","result":"三室二厅","resultId":5,"options":[{"name":"一室一厅","id":1},{"name":"二室一厅","id":2},{"name":"二室二厅","id":3},{"name":"三室一厅","id":4},{"name":"三室二厅","id":5},{"name":"四室一厅","id":6},{"name":"四室二厅","id":7},{"name":"五室及以上","id":8}]},{"question":"你的购房目的?","key":"purpose","type":"checkbox","result":"教育","resultId":5,"options":[{"name":"刚需","id":1},{"name":"结婚","id":2},{"name":"养老","id":3},{"name":"改善","id":4},{"name":"教育","id":5},{"name":"投资","id":6}]},{"question":"你更注重项目的哪些优势?","key":"advantage","type":"checkbox","result":"学区","resultId":2,"options":[{"name":"发展规划","id":1},{"name":"学区","id":2},{"name":"交通","id":3},{"name":"配套","id":4},{"name":"环境","id":5}]},{"question":"你对小区物业管理和社区设施有什么要求?","key":"facility","type":"checkbox","result":"楼栋管家","resultId":1,"remark":"","options":[{"name":"楼栋管家","id":1},{"name":"金钥匙服务","id":2},{"name":"社区娱乐","id":3},{"name":"会所功能","id":4}]},{"question":"你想买多大面积?","key":"area","type":"checkbox","result":"110-130㎡","resultId":4,"options":[{"name":"60㎡以下","id":1},{"name":"60-90㎡","id":2},{"name":"90-110㎡","id":3},{"name":"110-130㎡","id":4},{"name":"130-150㎡","id":5},{"name":"150-200㎡","id":6},{"name":"200㎡以上","id":7}]},{"question":"你更喜欢的朝向?","key":"orientation","type":"checkbox","result":"朝南","resultId":2,"options":[{"name":"朝东","id":1},{"name":"朝南","id":2},{"name":"朝西","id":3},{"name":"朝北","id":4},{"name":"南北通透","id":5}]},{"question":"你想住高楼层还是低楼层?","key":"isHigh","type":"checkbox","result":"低楼层","resultId":1,"options":[{"name":"低楼层","id":1},{"name":"中楼层","id":2},{"name":"高楼层","id":3},{"name":"低层","id":4},{"name":"顶层","id":5}]},{"question":"你对楼龄的要求是?","key":"buildingAge","type":"checkbox","result":"5年以内","resultId":1,"options":[{"name":"5年以内","id":1},{"name":"10年以内","id":2},{"name":"15年以内","id":3},{"name":"20年以内","id":4},{"name":"20年以上","id":5}]},{"result":null,"key":"intentArea","question":"意向区域"},{"question":"创建人小程序人员","result":"b47e82b90071ba6142c07436c80be81f","key":"personId"}]`;
24 23
 const openNotificationWithIcon = (type, message) => {
25 24
   notification[type]({
26 25
     message,
@@ -56,6 +55,7 @@ function body(props) {
56 55
       // res.reportDate = moment(res.reportDate)
57 56
       if (res) {
58 57
         const b = {};
58
+        console.log(JSON.parse(res?.questionnaire))
59 59
         JSON.parse(res?.questionnaire)?.map(x => {
60 60
           if (x.key === 'intentArea') {
61 61
             return;
@@ -66,7 +66,11 @@ function body(props) {
66 66
           }
67 67
           if (x.type === 'checkbox') {
68 68
             b[x.key] = x.resultId;
69
-          } else {
69
+          } 
70
+          if (x.type === 'checkboxs') {
71
+            b[x.key] = x.options.filter(r=>r.selected).map(t=>t.id);
72
+          }
73
+          else {
70 74
             b[x.key] = x.result;
71 75
           }
72 76
         });
@@ -186,24 +190,31 @@ function body(props) {
186 190
         </Form.Item>
187 191
         <Form.Item label="侧重优势">
188 192
           {getFieldDecorator('advantage')(
189
-            <Select placeholder="侧重优势" disabled={disabled}>
190
-              <Option value={1}>发展规划</Option>
191
-              <Option value={2}>学区</Option>
192
-              <Option value={3}>交通</Option>
193
-              <Option value={4}>配套</Option>
194
-              <Option value={5}>环境</Option>
195
-            </Select>,
193
+            <Checkbox.Group disabled={disabled}>
194
+            <Checkbox value={1}>发展规划</Checkbox>
195
+            <Checkbox value={2}>学区</Checkbox>
196
+            <Checkbox value={3}>交通</Checkbox>
197
+            <Checkbox value={4}>配套</Checkbox>
198
+            <Checkbox value={5}>环境</Checkbox>
199
+          </Checkbox.Group>,
200
+            // <Select placeholder="侧重优势" disabled={disabled}>
201
+            //   <Option value={1}>发展规划</Option>
202
+            //   <Option value={2}>学区</Option>
203
+            //   <Option value={3}>交通</Option>
204
+            //   <Option value={4}>配套</Option>
205
+            //   <Option value={5}>环境</Option>
206
+            // </Select>,
196 207
           )}
197 208
         </Form.Item>
198 209
 
199 210
         <Form.Item label="社区要求">
200 211
           {getFieldDecorator('facility')(
201
-            <Select placeholder="社区要求" disabled={disabled}>
202
-              <Option value={1}>楼栋管家</Option>
203
-              <Option value={2}>金钥匙服务</Option>
204
-              <Option value={3}>社区娱乐</Option>
205
-              <Option value={4}>会所功能</Option>
206
-            </Select>,
212
+            <Checkbox.Group placeholder="社区要求" disabled={disabled}>
213
+              <Checkbox value={1}>楼栋管家</Checkbox>
214
+              <Checkbox value={2}>金钥匙服务</Checkbox>
215
+              <Checkbox value={3}>社区娱乐</Checkbox>
216
+              <Checkbox value={4}>会所功能</Checkbox>
217
+            </Checkbox.Group>,
207 218
           )}
208 219
         </Form.Item>
209 220