广州矛调粤政易端
xusd
7 days ago d27794814b69d18aeb8ee96a46cae91d5613570c
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
/*
 * @Company: hugeInfo
 * @Author: lwh
 * @Date: 2022-09-13 16:01:52
 * @LastEditTime: 2023-06-28 10:55:05
 * @LastEditors: lwh
 * @Version: 1.0.0
 * @Description: 资源删除原因
 */
import React, { useState, useEffect } from 'react';
import { Button, Checkbox, Form, Space, TextareaItem, Toast } from 'dingtalk-design-mobile';
import { CloseBoldOutlined, DownArrow2Outlined } from 'dd-icons';
import obj from '../../utils/socialCard';
import MyModal from '../MyModal';
 
/**
 * title: string; // 标题
 * miniTitle: string; // 小标题
 * data: obj{}  //对象数据
 * visible: bool //显示隐藏
 * onClose: func //取消事件回调
 * onSave: func //确认事件回调
 */
const CardFollowDetailMsg = ({ title, miniTitle, data, visible, onClose, onSave }) => {
  const [roomMsg, setRoomMsg] = useState(data);
  const [outReason, setOutReason] = useState(obj.delReason.map((item) => ({ ...item, checked: item.value === '01' ? true : false })));
 
  useEffect(() => {
    setRoomMsg(data);
  }, [data]);
 
  return (
    <MyModal bodyClass="taskHandle-returnModal" visible={visible} onClose={onClose}>
      <div className="taskHandle-returnModal-title h7">{title}</div>
      <div style={{ padding: "12px 16px" }}>
        <div>
          {outReason.map((item, index) => (
            <div className="person-detail-modal-checkbox-l" key={index}>
              <Checkbox
                name={item.value}
                checked={item.checked || false}
                onChange={(e) => {
                  setOutReason(outReason.map((i) => ({ ...i, checked: i.value == item.value ? true : false })));
                  setRoomMsg({ ...roomMsg, outReason: item.value, outReasonDesc: item.label });
                }}
                className="person-detail-modal-checkbox"
              />
              <span className="person-detail-modal-checkbox-text">{item.label}</span>
            </div>
          ))}
        </div>
        <div>
          {roomMsg.outReason == '99' && (
            <Form.Item
              position="brief"
              className="person-detail-modal-input"
              label={
                <Space align="center">
                  <span style={{ fontSize: '16px' }}>{miniTitle}</span>
                  <span className="public-tag4">必填</span>
                </Space>
              }
            >
              <TextareaItem
                onChange={(value) => setRoomMsg({ ...roomMsg, deleteReason: value })}
                value={roomMsg.deleteReason}
                className="render-form-view-input-brief"
                placeholder="请输入"
                rows={5}
              />
            </Form.Item>
          )}
        </div>
      </div>
      <div className="myModal-action">
        <div onClick={onClose} className="myModal-action-item1">
          我再想想
        </div>
        <div onClick={() => onSave(roomMsg)} className="myModal-action-item2">
          确定删除
        </div>
      </div>
    </MyModal>
  );
};
 
export default CardFollowDetailMsg;