forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-05 65c8026eaeff3d769a1d168933e13035708233e0
gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx
@@ -9,14 +9,15 @@
import { scan } from '@/assets/images/icon'
import DocumentScanner from './FileUpLoad'
import * as $$ from '@/utils/utility';
import {
  IconLink,
} from '@arco-design/web-react/icon';
import CaseResult from './CaseResult'
import ArcoUpload from '@/components/ArcoUpload';
const InputSearch = Input.Search;
const FormItem = Form.Item;
const TabPane = Tabs.TabPane;
const appUrl = $$.appUrl;
const style = {
  textAlign: 'center',
@@ -75,13 +76,33 @@
  },
];
function getByIdRoleApi(id) {
  return $$.ax.request({ url: 'ctUser/getByIdRole?id=' + id, type: 'get', service: 'cust' });
}
function choosePrincipalApi(id) {
  return $$.ax.request({ url: 'caseInfoUnfold/choosePrincipal?caseId=24083010062110001&userId=' + id, type: 'get', service: 'mediate' });
}
function delFile(id) {
  return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
}
function getNewTimeIdApi(id) {
  return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
}
const Handle = () => {
  const formRef = useRef();
  const [selectedTab, setSelectedTab] = useState('1'); // 默认选中第一个 tab
  const [wantUser, setWantUser] = useState({});
  const [formView, setFormView] = useState(false);
  const [personView, setPersonView] = useState(false);
  const [data, setData] = useState({})
  const [caseResult, SetCaseResult] = useState(false);
  const tabs = [
    { index: '1', label: '承办部门' },
@@ -89,13 +110,15 @@
  ];
  const [isModalVisible, setIsModalVisible] = useState(false);
  const formRef = useRef(null);
  const [id, setId] = useState('')
  const handleTabChange = (newTabIndex) => {
    setSelectedTab(newTabIndex);
  };
  const handleCheckedKeys = (userId) => {
    choosePrincipal(userId)
  }
  const [records, setRecords] = useState([
    {
@@ -195,9 +218,59 @@
    setScannerVisible(true);
  };
  const getByIdRole = async () => {
    const res = await getByIdRoleApi('2105180249501982')
    if (res.type) {
      let data = res.data
      setData(data)
    }
  }
  const choosePrincipal = async (id) => {
    console.log(id, 'choosePrincipalId')
    const res = await choosePrincipalApi(id)
    if (res.type) {
      let data = res.data
      console.log(data, 'choosePrincipalchoosePrincipal')
    }
  }
  //删除文件
  const handleDelFile = async (id) => {
    const res = await delFile(id)
    if (res.type) {
      $$.infoSuccess({ content: '删除成功!' });
    }
  }
  const getNewTimeId = async () => {
    const res = await getNewTimeIdApi()
    if (res.type) {
      setId(res.data)
    }
  }
  const addMark = () => {
    setFormView(!formView);
    getNewTimeId()
  }
  const handleFinish = () => {
    console.log(formRef.current.getFields(), formRef, 'formRef.current.getFields()', 'formRef')
  }
  const Supervising = () => {
  }
  useEffect(() => {
    getByIdRole()
  }, [])
  return (
@@ -218,7 +291,7 @@
              <div><div className="title-text">经办人:</div></div>
              <div style={{ display: 'flex' }}>
                <div>王一顺</div>
                <img src={register} alt='' style={{ width: '14px', height: '14px', marginLeft: '8px', marginTop: '4px' }} />
                <img onClick={() => setPersonView(!personView)} src={register} alt='' style={{ width: '14px', height: '14px', marginLeft: '8px', marginTop: '4px' }} />
              </div>
            </Col>
            <Col span={8} style={{ display: 'flex' }}>
@@ -249,7 +322,7 @@
                <FormItem label={<div style={{ display: 'flex' }}>
                  <span style={{ color: '#86909C' }}>经办人</span>
                  <Tooltip>
                    <img onClick={() => setPersonView(!personView)} src={question1} alt="" style={{ width: '13px', height: '13px', margin: '4px 4px 0px 4px' }} />
                    <img src={question1} alt="" style={{ width: '13px', height: '13px', margin: '4px 4px 0px 4px' }} />
                  </Tooltip>
                </div>
                }
@@ -321,50 +394,61 @@
                      </Space>
                    </Col>
                    <Col span={24}>
                      <FormItem
                        label={<div style={{ display: 'flex' }}>
                          办理意见
                          <img src={scan} alt="" style={{ marginRight: '-2px', marginLeft: '8px' }} />
                          <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={openScanner}>识别材料</div>
                        </div>
                        }
                        field='caseDes'
                        rules={[{ message: '请填写事项概况', required: true }]}
                      <Form
                        ref={formRef}
                        layout='vertical'
                        requiredSymbol={false}
                        scrollToFirstError={true}
                      >
                        <Input.TextArea
                          maxLength={2000}
                          showWordLimit
                          rows={5}
                          placeholder='请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过'
                          wrapperStyle={{ width: '100%' }}
                        />
                      </FormItem>
                    </Col>
                    <Col span={24}>
                      <FormItem
                        label={<div style={{ display: 'flex' }}>
                          办理附件
                        </div>
                        }
                        field='caseDes'
                        rules={[{ message: '请填写事项概况', required: true }]}
                      >
                        <Upload
                          drag
                          multiple
                          accept='image/*'
                          action='/'
                          onDrop={(e) => {
                          }}
                          tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
                          showUploadList={{
                            fileIcon: <IconLink style={{ color: '#1D2129' }} />,
                          }}
                        />
                      </FormItem>
                        <Row gutter={[32, 0]}>
                          <Col  span={24}>
                            <FormItem
                              label={<div style={{ display: 'flex' }}>
                                办理意见
                                <img src={scan} alt="" style={{ marginRight: '-2px', marginLeft: '8px' }} />
                                <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={openScanner}>识别材料</div>
                              </div>
                              }
                              field='caseDes'
                              rules={[{ message: '请填写事项概况', required: true }]}
                            >
                              <Input.TextArea
                                maxLength={200}
                                showWordLimit
                                rows={5}
                                placeholder='请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过'
                                wrapperStyle={{ width: '100%' }}
                              />
                            </FormItem>
                          </Col>
                          <Col span={24}>
                            <FormItem
                              label={<div style={{ display: 'flex' }}>
                                办理附件
                              </div>
                              }
                              field='caseDes'
                              rules={[{ message: '请填写事项概况', required: true }]}
                            >
                              <ArcoUpload
                                params={{
                                  action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId='24083010062110001'&&ownerId=${id}&ownerType=22_00018-102`,
                                }}
                                field='file1'
                                // handleChangeFile={handleChangeFile}
                                label=''
                                // editData={props.editData}
                                handleDelFile={handleDelFile}
                              />
                            </FormItem>
                          </Col>
                        </Row>
                      </Form>
                    </Col>
                    <Space size='middle'>
                      <Button type='primary'>保存</Button>
                      <Button type='primary' onClick={() => handleFinish()}>保存</Button>
                      <Button type='secondary'>取消添加</Button>
                    </Space>
                  </div>
@@ -373,9 +457,10 @@
              </Col>
            </Form>
            <Space style={{ marginTop: '38px', bottom: '4px' }}>
              <Button type="primary" style={{ backgroundColor: '#1A6FB8' }} onClick={() => setFormView(!formView)}>添加办理记录</Button>
              <Button type='outline' style={{ color: '#1A6FB8', border: '1px solid #1A6FB8' }} >结案申请</Button>
              <Button type="primary" style={{ backgroundColor: '#1A6FB8' }} onClick={() => addMark()}>添加办理记录</Button>
              <Button type='outline' style={{ color: '#1A6FB8', border: '1px solid #1A6FB8' }}>联合处置申请</Button>
              <Button type='outline' style={{ color: '#1A6FB8', border: '1px solid #1A6FB8' }} onClick={() => SetCaseResult(!caseResult)}>结案申请</Button>
              <Button type='outline' style={{ color: '#EF6C24', border: '1px solid #EF6C24' }} onClick={() => Supervising(!caseResult)}>督办</Button>
              <Button type='secondary'>返回上级页面</Button>
            </Space>
          </div>
@@ -434,8 +519,10 @@
          visible={isModalVisible}
          checkKeys={wantUser.wantUserId ? [{ label: wantUser.wantUserName, value: wantUser.wantUserId }] : undefined}
          onOk={(value) => {
            console.log(value.key, value, 'value.key', 'value')
            setIsModalVisible(false);
            setWantUser({ wantUserId: value.keys[0], wantUserName: value.items[0].name });
            handleCheckedKeys(value.keys?.[0])
          }}
          onClose={() => setIsModalVisible(false)}
        />
@@ -447,8 +534,28 @@
        />
        <Modal visible={personView} onCancel={() => setPersonView(false)} title='工作人员信息' centered footer={null}>
          <table border="1" align="center" cellpadding="5" className="table">
            <tr>
              <th bgcolor="#F7F8FA" className="table-title" width="120">姓名</th>
              <td width='380'><div style={{ display: 'flex' }}><div>{data.trueName}</div></div></td>
              <th bgcolor="#F7F8FA" className="table-title" width="120">登录账号</th>
              <td width='380'>{data.acc}</td>
            </tr>
            <tr>
              <th bgcolor="#F7F8FA" className="table-title">手机号码</th>
              <td>{data.mobile}</td>
              <th bgcolor="#F7F8FA" className="table-title">工作电话</th>
              <td>020-83002020</td>
            </tr>
            <tr>
              <th bgcolor="#F7F8FA" className="table-title">所属部门</th>
              <td>{data.deptName}</td>
              <th bgcolor="#F7F8FA" className="table-title">职务</th>
              <td>主任</td>
            </tr>
          </table>
        </Modal>
        <CaseResult visible={caseResult} handleOnCancel={() => SetCaseResult(false)} />
      </div>
    </>