广州市综治平台前端
xusd
1 days ago bdeacb9f02dfa74bac74296a4a2c989a8e0d45ff
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
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-04-07 16:53:32
 * @LastEditTime: 2023-06-27 14:44:43
 * @LastEditors: lihl
 * @Version: 1.0.0
 * @Description: 已达成协议要点(修改mediationWindow-textarea的背景图片 放.less文件中会有冲突)
 */
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { Input } from 'antd';
import { useSearchParams } from 'react-router-dom';
import * as $$ from '../../../utils/utility';
import textareaImg from '../../../assets/images/icon/window_letterBg.png'
const { TextArea } = Input;
 
// 修改达成协议
function updateAgreementMsgApi (submitData) {
  return $$.ax.request({ url: 'caseInfo/pcWindowUpCaseAgrees', type: 'post', data: submitData, service: 'mediate' });
}
 
/**
 * caseAgree, // 达成协议内容
 * getDisputeData, // 获取纠纷信息方法
 */
const ConcludeContent = ({ caseAgree, getDisputeData }) => {
  const [searchParams] = useSearchParams();
 
  const caseId = searchParams.get('caseId');
 
  const [agreementMsg, setAgreementMsg] = useState();
 
  // 修改达成协议
  async function updateAgreementMsg () {
    const res = await updateAgreementMsgApi({ caseId, agreeContent: agreementMsg });
    if (res.type) {
      getDisputeData();
      $$.infoSuccess({ content: `${$$.timeFormat(new Date())}更新成功` });
    }
  }
 
  useEffect(() => {
    setAgreementMsg(caseAgree);
  }, [caseAgree]);
 
  return (
    <div className="mediationWindow-textarea" style={{ backgroundImage: `url(${textareaImg})` }}>
      <TextArea
        bordered={false}
        autoSize={{ minRows: 3 }}
        value={agreementMsg}
        placeholder="可编辑已达成内容"
        onChange={(e) => setAgreementMsg(e.target.value)}
        onBlur={updateAgreementMsg}
      />
    </div>
  );
};
 
ConcludeContent.propTypes = {
  caseAgree: PropTypes.string,
  getDisputeData: PropTypes.func,
};
 
export default ConcludeContent;