forked from gzzfw/frontEnd/gzDyh

dminyi
2024-09-07 d2280c384e4b8f6acef1e01f400e3c61c97d82d9
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import React, { useState, useRef, useEffect, Fragment } from 'react';
import { Button, Modal, Tabs, Badge, Steps } from '@arco-design/web-react';
import { Space } from 'antd';
import ProgressStep from '@/components/ProgressStep/VisitStep';
import BackModel from "./BackModel";
import { Scrollbars } from "react-custom-scrollbars";
import { getOffset, getSize } from '@/utils/utility';
import EscalationModel from './EscalationModel';
import AssignedModel from './AssignedModel';
import MatterDetail from '../../matterDetail';
import SupervisingView from "../../matterDetail/Supervising";
import * as $$ from '@/utils/utility';
 
const TabPane = Tabs.TabPane;
const Step = Steps.Step;
 
function getListCaseFlow(data) {
    return $$.ax.request({ url: `caseTask/listCaseFlow`, type: 'get', service: 'mediate', data });
}
 
export default function EventFlow(props) {
  const myButton = [
    {
      label: '受理',
      type: 'primary',
      click: () => { },
      key: 'sl',
    },
    {
      label: '提交',
      type: 'primary',
      click: () => { },
      key: 'tj',
    },
    {
      label: '自行受理',
      type: 'primary',
      click: () => { },
      key: 'zxsl',
    },
    {
      label: '回退',
      type: 'outline',
      click: () => setBackVisible(true),
      key: 'ht',
      status: 'danger'
    },
    {
      label: '交办',
      type: 'outline',
      click: () => setAssignedVisible(true),
      key: 'jb',
    },
    {
      label: '上报',
      type: 'outline',
      click: () => setEscalationVisible(true),
      key: 'sb',
    },
  ]
  const scrollRef = useRef(null)
  const [backVisible, setBackVisible] = useState(false)
  const [height, setHeight] = useState(500)
  const [escalationVisible, setEscalationVisible] = useState(false)
  const [assignedVisible, setAssignedVisible] = useState(false)
  const [staticButtonList, setStaticButtonList] = useState([])
  const [progressData, setProgressData] = useState({})
 
  useEffect(() => {
    if (props.authorData) {
      const { buttonList } = props.authorData;
      setStaticButtonList(myButton.filter(item => {
        const flag = buttonList.some(result => {
          if (result.id === item.key) {
            return true
          }
        })
        return flag
      }))
    }
  }, [props.authorData])
 
  useEffect(() => {
    getData()
    onWindowResize()
    window.addEventListener("resize", onWindowResize);
    // 返回一个函数,该函数会在组件卸载前执行  
    return () => {
      // 组件销毁时执行  
      window.removeEventListener("resize", onWindowResize);
    };
  }, [])
 
  const onWindowResize = () => {
    let offsetLeft = 0;
    let offsetTop = 0;
    if (scrollRef.current.container) {
      offsetLeft = getOffset(scrollRef.current.container).left;
      offsetTop = getOffset(scrollRef.current.container).top;
    }
    setHeight(getSize().windowH - offsetTop - 16)
  };
 
  //获取流程信息
  const getData = async () => {
    const res = await getListCaseFlow({
      caseId: props.caseId
    })
    if(res.type) {
      setProgressData(res.data)
    }
  }
 
  return (
    <Fragment>
      <div style={{ backgroundColor: '#fff', margin: '0 16px 0px 16px', paddingTop: '16px', paddingLeft: '91px' }}>
        <Steps type='navigation' current={2}>
          <Step title='来访登记' disabled />
          <Step title='事件流转' disabled />
          <Step title='办理反馈' disabled />
          <Step title='结案审核' disabled />
          <Step title='当事人评价' disabled />
          <Step title='结案归档' disabled />
        </Steps>
      </div>
 
      <div className='dataSync' style={{ marginTop: '8px' }}>
        <Scrollbars
          style={{ height: height }}
          ref={scrollRef}
          autoHide
        >
          <MatterDetail caseId={props.caseId}/>
          <div className='dataSync-hasTabPage' style={{ marginTop: '-8px' }}>
            <Tabs defaultActiveTab='1' >
              <TabPane
                key='1'
                title={
                  <span style={{ fontSize: '15px' }}>
                    流转进度
                  </span>
                }
              >
                <ProgressStep progressData={progressData} />
              </TabPane>
              <TabPane
                key='2'
                title={
                  <span style={{ fontSize: '15px' }}>
                    督办信息
                    <Badge maxCount={99} count={1000} />
                  </span>
                }
              >
                <div style={{ marginBottom: '20px' }}>
                  <SupervisingView id={''} />
                </div>
              </TabPane>
            </Tabs>
          </div>
        </Scrollbars>
        <Modal
          title='回退'
          visible={backVisible}
          onOk={() => setBackVisible(false)}
          onCancel={() => { setBackVisible(false) }}
          footer={null}
          unmountOnExit={true}
          maskClosable={false}
        >
          <BackModel caseId={props.caseId} onCancel={() => { setBackVisible(false) }}/>
        </Modal>
        <Modal
          title='上报'
          visible={escalationVisible}
          onOk={() => setEscalationVisible(false)}
          onCancel={() => { setEscalationVisible(false) }}
          footer={null}
          unmountOnExit={true}
          maskClosable={false}
        >
          <EscalationModel caseId={props.caseId} onCancel={() => { setEscalationVisible(false) }}/>
        </Modal>
        <Modal
          title='交办'
          visible={assignedVisible}
          onOk={() => setAssignedVisible(false)}
          onCancel={() => { setAssignedVisible(false) }}
          footer={null}
          unmountOnExit={true}
          maskClosable={false}
          autoFocus={false}
          focusLock={false}
        >
          <AssignedModel caseId={props.caseId} onCancel={() => { setAssignedVisible(false) }}/>
        </Modal>
        <div className="dataSync-excel">
          <Space size="large" style={{ margin: '4px 14px' }}>
            {staticButtonList?.map(item => {
              const { label, key, click, ...rest } = item;
              return <Button key={key} onClick={click} {...rest} >{label}</Button>
            })}
            <Button type='secondary' >返回上级页面</Button>
          </Space>
        </div>
      </div>
    </Fragment>
  )
}