forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-08-19 dad8ee5b2c6d2359d2821653baee2847f97d542e
feat: 添加当事人信息逻辑
3 files modified
165 ■■■■ changed files
gz-customerSystem/src/components/personCard/index.jsx 24 ●●●● patch | view | raw | blame | history
gz-customerSystem/src/views/register/visit/component/agentDialog.jsx 48 ●●●● patch | view | raw | blame | history
gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx 93 ●●●● patch | view | raw | blame | history
gz-customerSystem/src/components/personCard/index.jsx
@@ -19,7 +19,13 @@
 * handleDeleteParty, // 删除当事人
 */
const PersonCard = ({ isCheck, data, handleCheckParty, handleDeleteParty, handleAdd }) => {
    let isAgent = false
    const typeList = data.map(item => {
        return item.partyType
    })//获取有多少申请人和被申请人
    if (typeList.indexOf(0) != -1 && typeList.indexOf(1) != -1) {
        isAgent = true
    }
    return (
        <Row gutter={[24, 16]}>
            {data.map((x, t) => (
@@ -31,7 +37,12 @@
                        >
                            {x.trueName.substr(0, 1)}
                            <div className="public-personCard-card-check">查看</div>
                            <img src={del} alt='' style={{ width: '16px', height: '16px', position: 'absolute', top: '-8px', left: '56px' }} />
                            <img
                                src={del}
                                alt=''
                                style={{ width: '16px', height: '16px', position: 'absolute', top: '-8px', left: '56px' }}
                                onClick={(event) => { handleDeleteParty(event, x) }}
                            />
                        </div>
                        <div className="public-personCard-content">
                            <div className="public-personCard-title">
@@ -56,6 +67,13 @@
                                    <div>法定代表人:{x.companyName}</div>
                                </>
                            }
                            {
                                x.perClass === '09_01001-3' &&
                                <>
                                    <div>组织机构代码:{x.mobile}</div>
                                    <div>机构代表人:{x.companyName}</div>
                                </>
                            }
                            <Space style={{ display: 'flex', flexWrap: 'wrap' }}>
                                {x.remark?.map((item, index) => (
                                    <div key={index} style={{ lineHeight: '22px', padding: '0px 8px', backgroundColor: `${item.color}`, width: 'fit-content', borderRadius: '4px', marginTop: '4px', color: '#fff' }}>{item.label}</div>
@@ -71,7 +89,7 @@
                        title={(<Space direction='vertical '>
                            <div className="dataSync-btnApply" style={{ backgroundColor: '#1A6FB8' }} onClick={() => { handleAdd(0) }}>申请方</div>
                            <div className="dataSync-btnApply" style={{ backgroundColor: '#FA8C16' }} onClick={() => { handleAdd(1) }}>被申请方</div>
                            <div className="dataSync-btnApply" style={{ backgroundColor: '#3491FA' }} onClick={() => { handleAdd(2) }}>代理人</div>
                            {isAgent && <div className="dataSync-btnApply" style={{ backgroundColor: '#3491FA' }} onClick={() => { handleAdd(2) }}>代理人</div>}
                        </Space>)}
                        placement={data.length !== 0 && data.length % 3 === 0 ? 'left' : "right"}
                        color='#ffff'
gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
@@ -13,13 +13,29 @@
const CheckboxGroup = Checkbox.Group;
export default function AgentDialog(props) {
  const formRef = useRef();
  //保存信息
  const handleSave = () => {
    if (formRef.current) {
      formRef.current.validate(undefined, (errors, values) => {
        props.handleAddParty({
          ...values,
          // partyType: props.dialogType,
          // perClass: perClass,
          // perClassName: props.dialogType === 0 ? '申请方代理人' : '被申请方当事人'
        })
        props.onClose()
      });
    }
  }
  return (
    <div className="applyDialog">
      <div style={{ height: '590px', overflowY: 'scroll' }}>
        <Row gutter={[16, 16]} style={{ margin: '0 2px 0 0' }}>
          <Col span={24}>
            <Form
              ref={props.formRef}
              ref={formRef}
              layout='vertical'
              requiredSymbol={false}
              initialValues={{
@@ -64,7 +80,8 @@
                <Col span={12}>
                  <FormItem
                    label={(<div style={{ display: 'flex' }}>姓名<div className="must">必填</div></div>)}
                    field='name'
                    field='trueName'
                    rules={[{ required: true, message: '请输入姓名' }]}
                  >
                    <Input placeholder='请填写' />
                  </FormItem>
@@ -72,7 +89,11 @@
                <Col span={12}>
                  <FormItem
                    label={(<div style={{ display: 'flex' }}>联系方式<div className="must">必填</div></div>)}
                    field='phone'
                    field='personNumber'
                    rules={[
                      { required: true, message: '请输入联系方式' },
                      { match: /^\+?(\d{1,3})?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})$/, message: '请输入正确的电话号码' },
                    ]}
                  >
                    <Input placeholder='请填写' />
                  </FormItem>
@@ -80,7 +101,8 @@
                <Col span={12}>
                  <FormItem
                    label={(<div style={{ display: 'flex' }}>证件类型<div className="must">必填</div></div>)}
                    field='zhengjian'
                    field='docType'
                    rules={[{ required: true, message: '请选择证件类型' }]}
                  >
                    <Select placeholder='请选择' allowClear>
                      {['居民身份证',].map((option, index) => (
@@ -94,8 +116,11 @@
                <Col span={12}>
                  <FormItem
                    label={(<div style={{ display: 'flex' }}>证件号码<div className="must">必填</div></div>)}
                    rules={[{ required: true }]}
                    field='peopleNumber'
                    rules={[
                      { required: true, message: '请输入证件号码' },
                      { match: /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])\d{3}(\d|X)$/, message: '请输入正确的证件号码' }
                    ]}
                    field='mobile'
                  >
                    <InputSearch
                      searchButton='读取卡证'
@@ -190,7 +215,14 @@
                    rules={[{ required: true }]}
                    field='dailimap'
                  >
                    <CheckboxGroup direction='vertical' options={['张三丰', '广东好又多贸易有限公司', '广东科贸创意有限公司']} />
                    <CheckboxGroup
                      direction='vertical'
                      options={props.fakeData.map(x => ({
                        label: <span>{x.trueName}&nbsp;&nbsp;<span style={{ color: '#86909c' }}>({x.perClassName})</span></span>,
                        value: x.id,
                      }))}
                    >
                    </CheckboxGroup>
                  </FormItem>
                </Col>
              </Row>
@@ -207,7 +239,7 @@
        <Button
          type="primary"
          className="dialogPrimary"
        // onClick={handleSave}
          onClick={handleSave}
        >
          保存信息
        </Button>
gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -33,67 +33,7 @@
const VisitorRegister = (props) => {
  const [dialogType, setDialogType] = useState(0);//添加当事人的类型
  const [addVisabled, setAddVisabled] = useState(false);//添加当事人弹窗控制
  const [fakeData, setFakeData] = useState([
    // {
    //   id: 3,
    //   perClassName: '申请方当事人',
    //   trueName: '蓝海科技有限公司',
    //   mobile: '9144010188453Z',
    //   company: true,
    //   companyName: '张晓梅',//公司法人
    //   partyType: 0,//申请人:0,被申请人:1
    // },
    // {
    //   id: 1,
    //   perClassName: '申请方代理人',
    //   trueName: '王小明',
    //   mobile: '410106198802121125',
    //   person: true,
    //   personNumber: '13388888888',//联系方式
    //   partyType: 'applicant',
    // },
    // {
    //   id: 2,
    //   perClassName: '被申请方当事人',
    //   trueName: '大海科技有限公司',
    //   mobile: '13800000002',
    //   company: true,
    //   companyName: '郭小聪',//公司法人
    //   partyType: 'respondent',//被申请方
    //   type: 1,
    //   remark: [{ label: '精神障碍', color: '#C64FBE' }, { label: '吸毒', color: '#D8A247' }, { label: '社区矫正', color: '#B82F6E' }, { label: '刑满释放', color: '#199C8F' }, { label: '流浪', color: '#3ECB7A' }, { label: '重点青少年', color: '#117AC1' }, { label: '涉稳涉访', color: '#6865D7' }, { label: '潜在风险', color: '#2661CE' }]
    // },
    // {
    //   id: 2,
    //   perClassName: '被申请方代理人',
    //   trueName: '张三',
    //   mobile: '13800000002',
    //   person: true,
    //   personNumber: '13399999999',//联系方式
    //   partyType: 'respondent',
    //   remark: [{ label: '精神障碍', color: '#C64FBE' }]
    // },
    // {
    //   id: 2,
    //   perClassName: '被申请方代理人',
    //   trueName: '张三',
    //   mobile: '13800000002',
    //   person: true,
    //   personNumber: '13399999999',//联系方式
    //   partyType: 'respondent',
    //   remark: [{ label: '精神障碍', color: '#C64FBE' }]
    // },
    // {
    //   id: 2,
    //   perClassName: '被申请方代理人',
    //   trueName: '张三',
    //   mobile: '13800000002',
    //   person: true,
    //   personNumber: '13399999999',//联系方式
    //   partyType: 'respondent',
    //   remark: [{ label: '精神障碍', color: '#C64FBE' }]
    // },
  ]);//当事人信息数据
  const [fakeData, setFakeData] = useState([]);//当事人信息数据
  const [scanFile, setScanFile] = useState(false);
  const [filesList, setFilesList] = useState([]);
  const [scanImage, setScanImage] = useState(false);
@@ -106,6 +46,7 @@
  const [fileTip, setFileTip] = useState('0');
  const [detailVisabled, setDetailVisabled] = useState(false);//查看信息弹窗控制
  const [mapView, setMapView] = useState(false);
  const [flagId, setFlagId] = useState(0);//赋予当事人唯一id,用于删除
  const formRef = useRef();
@@ -126,9 +67,6 @@
        return [evidenceMaterials, evidenceMaterials_active];
    }
  }
  const formType = (type) => {
    if (type === '09_01010-1') {
@@ -398,7 +336,7 @@
  //查看
  const handleCheckParty = (value) => {
    console.log(value);
    setDialogType(value.type)
    setDialogType(value.partyType)
    setDetailVisabled(true)
  }
@@ -432,9 +370,19 @@
  //添加当事人
  const handleAddParty = (value) => {
    console.log(value);
    setFakeData([...fakeData, value])
    setFakeData([...fakeData, {
      ...value,
      id: flagId
    }])
    setFlagId(flagId + 1)
  }
  //删除当事人
  const handleDeleteParty = (event, value) => {
    event.stopPropagation();
    const filterData = fakeData.filter(item => item.id !== value.id)
    setFakeData(filterData)
  }
  return (
@@ -452,6 +400,7 @@
          data={fakeData}
          handleCheckParty={handleCheckParty}
          handleAdd={handleAdd}
          handleDeleteParty={handleDeleteParty}
        />
      </div>
      <Col span={24} style={{ display: 'flex', alignItems: 'center', marginBottom: '8px' }}>
@@ -764,7 +713,11 @@
        focusLock={true}
        footer={null}
      >
        <ApplyDialog dialogType={dialogType} onClose={() => setAddVisabled(false)} handleAddParty={handleAddParty}/>
        <ApplyDialog
          dialogType={dialogType}
          onClose={() => setAddVisabled(false)}
          handleAddParty={handleAddParty}
        />
      </Modal>
      <Modal
        title={'添加代理人'}
@@ -775,7 +728,11 @@
        focusLock={true}
        footer={null}
      >
        <AgentDialog />
        <AgentDialog
          handleAddParty={handleAddParty}
          onClose={() => setAgentVisible(false)}
          fakeData={fakeData}
        />
      </Modal>
      <Modal
        title={'查看' + peopleMap[dialogType]}