广州市综治平台前端
xusd
7 days ago 544148eddae96db824423cd059ebecb9d13c392e
src/components/personCard/DetailDialog.jsx
@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react'
import KeyVisits from "./KeyVisits";
import React, { useEffect, useState } from 'react';
import KeyVisits from './KeyVisits';
import { majorStatus_1 } from '@/assets/images';
import { Scrollbars } from "react-custom-scrollbars";
import { Scrollbars } from 'react-custom-scrollbars';
import PreviewImage from '../PreviewImage';
import MyPDF from '../MyPDF';
import { checkIdCard } from "../../utils/utility";
import { checkIdCard } from '../../utils/utility';
import { Tooltip } from '@arco-design/web-react';
import * as $$ from '@/utils/utility';
const appUrl = $$.appUrl;
@@ -86,7 +86,6 @@
        value: '',
        field: 'age',
      },
    ],
    [
      {
@@ -101,7 +100,7 @@
        field: 'extreme',
      },
    ],
  ]
   ];
  const legalList = [
    [
      {
@@ -146,7 +145,7 @@
        label: '住所',
        value: '',
        field: 'placeAddr',
        isRow: true
            isRow: true,
      },
    ],
    [
@@ -163,7 +162,7 @@
        field: 'file1',
      },
    ],
  ]
   ];
  const organizationList = [
    [
      {
@@ -208,7 +207,7 @@
        label: '住所',
        value: '',
        field: 'placeAddr',
        isRow: true
            isRow: true,
      },
    ],
    [
@@ -225,7 +224,7 @@
        field: 'file1',
      },
    ],
  ]
   ];
  const agentList = [
    [
      {
@@ -306,7 +305,7 @@
        label: '代理对象',
        value: '',
        field: 'personId',
        isRow: true
            isRow: true,
      },
    ],
    [
@@ -323,8 +322,8 @@
        field: 'file1',
      },
    ],
  ]
  const [tableList, setTableList] = useState([])
   ];
   const [tableList, setTableList] = useState([]);
  const [certiNo, setCertiNo] = useState('');
  const [certiShow, setCertiShow] = useState(false);
  // 反应诉求记录
@@ -334,25 +333,25 @@
  const [search, setSearch] = useState({ page: 1, size: 5 });
  function getAllApi(num) {
    countPerson(num)
    pagePerson({ ...search, certiNo: num })
      countPerson(num);
      pagePerson({ ...search, certiNo: num });
  }
  // 根据个人身份证号查询重点人员信息
  async function getLabelInfo(idCard) {
    const res = await getLabelInfoApi({ idNumber: idCard })
      const res = await getLabelInfoApi({ idNumber: idCard });
    if (res.type) {
      let data = res.data || {};
      console.log('res.data', res.data);
      setLabelInfo(data?.labelList)
         setLabelInfo(data?.labelList);
    }
  }
  // 个人案件统计
  async function countPerson(idCard) {
    const res = await countPersonApi({ certiNo: idCard })
      const res = await countPersonApi({ certiNo: idCard });
    if (res.type) {
      setHisData(res.data || {})
         setHisData(res.data || {});
    }
  }
@@ -373,7 +372,7 @@
  // 页码修改
  function handleChangePage(page, pageSize, field, order) {
    let paramsObj = Object.assign(search, { page, size: pageSize });
    paramsObj = { ...paramsObj }
      paramsObj = { ...paramsObj };
    setSearch(paramsObj);
    pagePerson(paramsObj);
@@ -381,94 +380,107 @@
  useEffect(() => {
    if (checkIdCard(props.editData?.certiNo)) {
      setCertiShow(true)
      setCertiNo(props.editData?.certiNo)
      getAllApi(props.editData?.certiNo)
         setCertiShow(true);
         setCertiNo(props.editData?.certiNo);
         getAllApi(props.editData?.certiNo);
    }
    const data = props.editData
    let newList
    let mapList = []
    if (data.perClass === "09_01001-1") {
      const data = props.editData;
      let newList;
      let mapList = [];
      if (data.perClass === '09_01001-1') {
      //自然人
      mapList = nuturalList
         mapList = nuturalList;
    }
    if (data.perClass === "09_01001-2") {
      if (data.perClass === '09_01001-2') {
      //法人组织
      mapList = legalList
         mapList = legalList;
    }
    if (data.perClass === "09_01001-3") {
      if (data.perClass === '09_01001-3') {
      //非法人组织
      mapList = organizationList
         mapList = organizationList;
    }
    if (data.perType === "24_00006-1" || data.perType === "24_00006-2") {
      if (data.perType === '24_00006-1' || data.perType === '24_00006-2') {
      //代理人
      mapList = agentList
         mapList = agentList;
    }
    newList = mapList.map(item => {
      return item.map(res => {
      newList = mapList.map((item) => {
         return item.map((res) => {
        if (res.isFile) {
          return {
            ...res,
            value: <>
                  value: (
                     <>
              {data[res.field]?.map((item, index) => {
                if (item.response) {
                  //新上传的,前端数据
                  const newData = item.response.data[0]
                  return <div style={{ display: 'inline-block' }}>
                    {newData.suffix === 'pdf' ? <MyPDF name={newData.name} fileUrl={newData.showUrl} /> : <PreviewImage name={newData.name} src={newData.showUrl} />}
                              const newData = item.response.data[0];
                              return (
                                 <div style={{ display: 'inline-block' }}>
                                    <MyPDF key={index} name={newData.name} fileUrl={newData.showUrl} fileType={newData.suffix} />
                    {index !== data[res.field].length - 1 && <>,</>}
                  </div>
                              );
                } else {
                  return <div style={{ display: 'inline-block' }}>
                    {item.suffix === 'pdf' ? <MyPDF name={item.name} fileUrl={item.showUrl} /> : <PreviewImage name={item.name} src={item.showUrl} />}
                              return (
                                 <div style={{ display: 'inline-block' }}>
                                    <MyPDF key={index} name={item.name} fileUrl={item.showUrl} fileType={item.suffix} />
                    {index !== data[res.field].length - 1 && <>,</>}
                  </div>
                              );
                }
              })}
            </>
          }
                  ),
               };
        }
        if (res.isName) {
          return {
            ...res,
            value: data[res.field],
            perClass: data.perClassName || data.perTypeName
          }
                  perClass: data.perClassName || data.perTypeName,
               };
        } else {
          if (res.field === 'personId') {
            const filterValue = props.personData.filter(result => data[res.field].indexOf(result.id) != -1).map(result => result.trueName).join(',')
                  const filterValue = props.personData
                     .filter((result) => data[res.field].indexOf(result.id) != -1)
                     .map((result) => result.trueName)
                     .join(',');
            return {
              ...res,
              value: filterValue
            }
                     value: filterValue,
                  };
          } else if (res.field === 'extreme') {
            return {
              ...res,
              label: <div style={{
                     label: (
                        <div
                           style={{
                padding: '8px', 
                display: 'flex', 
                gap: '8px', 
                alignItems: 'center',
                color: data[res.field] === 1 ? '#F53F3F' : 'inherit'
              }} className='title-text-red'>
                              color: data[res.field] === 1 ? '#F53F3F' : 'inherit',
                           }}
                           className="title-text-red"
                        >
                {data[res.field] === 1 && <img src={majorStatus_1} alt="" srcset="" />}
                <Tooltip content='是否有个人极端倾向'>{$$.ellipsis('是否有个人极端倾向', 6)}</Tooltip>
              </div>,
              value: data[res.field] === 1 ? '是' : data[res.field] === 0 ? '否' : '-'
            }
                           <Tooltip content="是否有个人极端倾向">{$$.ellipsis('是否有个人极端倾向', 6)}</Tooltip>
                        </div>
                     ),
                     value: data[res.field] === 1 ? '是' : data[res.field] === 0 ? '否' : '-',
                  };
          } else {
            return {
              ...res,
              value: data[res.field]
                     value: data[res.field],
                  };
            }
          }
        }
      })
    })
         });
      });
    setTableList(newList)
  }, [])
      setTableList(newList);
   }, []);
  return (
    <Scrollbars
@@ -478,13 +490,15 @@
      autoHeightMax={590}
    >
      <table border="1" align="center" cellpadding="8" className="table" style={{ marginBottom: '20px' }}>
        {
          tableList?.map((item, index) => {
            return <tr key={'tableList' + index}>
              {
                item?.map(res => {
                  return <>
                    <th bgcolor="#F7F8FA" className="table-title" width={150}>{res.label}</th>
            {tableList?.map((item, index) => {
               return (
                  <tr key={'tableList' + index}>
                     {item?.map((res) => {
                        return (
                           <>
                              <th bgcolor="#F7F8FA" className="table-title" width={150}>
                                 {res.label}
                              </th>
                    <td width={320} colspan={res.isRow ? '3' : '1'}>
                      <div style={{ display: 'flex', minHeight: '22px' }}>
                        <div>{res.value}</div>
@@ -492,19 +506,18 @@
                      </div>
                    </td>
                  </>
                })
              }
                        );
                     })}
            </tr>
          })
        }
               );
            })}
      </table>
      {/* 重复来访重点人员 */}
      {
        certiShow &&
         {certiShow && (
        <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
          <KeyVisits labelInfo={labelInfo} data={hisData} fakeData={fakeData} search={search} handleChangePage={handleChangePage} />
        </div>
      }
         )}
    </Scrollbars>
  )
   );
}