forked from gzzfw/frontEnd/gzDyh

liuwh
2024-09-14 221546808c11df777199def992e4abbf1fc31b5a
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
 
/*
 * @Author: dminyi 1301963064@qq.com
 * @Date: 2024-08-09 09:59:43
 * @LastEditors: dminyi 1301963064@qq.com
 * @LastEditTime: 2024-09-11 12:20:34
 * @FilePath: \gzDyh\gz-customerSystem\src\views\basicInformation\organization\index.jsx
 * @Description: 来访登记
 * 
 */
 
import React, { useEffect, useState } from "react";
import NewPage from '@/components/NewPage';
import "@arco-themes/react-gzzz/css/arco.css";
import '../index.less';
import { Typography, Steps, Tabs } from '@arco-design/web-react';
import { Audit, Matter, applyRecord, transfer, Aimge, examine } from '@/assets/images'
import MatterDetail from '../matterDetail';
import Handle from './component/handle';
import AuditView from './component/AuditView';
import { AiQuestion } from '../visit/component/levelDetail';
import * as $$ from '@/utils/utility';
import ApplyInfo from "../matterDetail/ApplyInfo";
 
 
const Step = Steps.Step;
const TabPane = Tabs.TabPane;
const style = {
    // textAlign: 'center',
    // marginTop: 20,
};
 
function getCaseApi(data) {
    return $$.ax.request({ urlAi: `case-law/get-case`, typeAi: 'post', service: 'mediate', data });
}
 
function getLawApi(data) {
    return $$.ax.request({ urlAi: `case-law/get-law`, typeAi: 'post', service: 'mediate', data });
}
 
function getTabButton(caseTaskId) {
    return $$.ax.request({ url: `caseTask/getTabButton?caseTaskId=` + caseTaskId, type: 'get', service: 'mediate' });
}
 
function getCaseInfoApi(id) {
    return $$.ax.request({ url: '/caseInfo/getCaseInfo?id=' + id, type: 'get', service: 'mediate' });
}
 
const Organization = () => {
    const caseTaskId = $$.getQueryString('caseTaskId')
    const caseId = $$.getQueryString('caseId')
    const [current, setCurrent] = useState(3);
    const [tabsActive, setTabsActive] = useState('sxxq');
    const [AiQuestionView, setAiQuestionView] = useState(false)
    const [aiData, setAiData] = useState([])
    const [aiLawData, setAiLawData] = useState([]);
    const [caseDetailAi, setCaseDetailAi] = useState({});
    const [authorData, setAuthorData] = useState({});
    const [tabsList, setTabsList] = useState([]);
    const myTab = [
        {
            img: Matter,
            label: '详情',
            key: "dslxq"
        },
        {
            img: Matter,
            label: '事项详情',
            key: "sxxq"
        },
        {
            img: transfer,
            label: '事项办理',
            key: "sxbl",
            isNeedStep: true,
        },
        {
            img: applyRecord,
            label: '申请记录',
            key: "sqjl",
        },
        {
            img: examine,
            label: '联合处置审核',
            key: 'lhczsh',
        },
    ]
 
    useEffect(() => {
        getCaseInfo(caseId)
        getAuthor();
    }, [])
 
    const handleAi = () => {
        setAiQuestionView(true)
    }
 
    const getCase = async (caseDes, caseClaim) => {
        const res = await getCaseApi({
            caseDes: caseDes,
            caseClaim: caseClaim,
            caseId: caseId
        })
        if (res.type) {
            setAiData(res.data)
        }
    }
 
    const getLaw = async (caseDes, caseClaim) => {
        const res = await getLawApi({
            caseDes: caseDes,
            caseClaim: caseClaim,
            caseId: caseId
        })
        if (res.type) {
            setAiLawData(res.data)
        }
    }
 
    const getAuthor = async () => {
        const res = await getTabButton(caseTaskId)
        if (res.type) {
            const { tabList } = res.data
            setAuthorData(res.data)
            if (tabList.length === 0) {
                //没有tab就不展示
            } else {
                setTabsList(myTab.filter(item => {
                    const flag = tabList.some(result => {
                        if (result.id === item.key) {
                            return true
                        }
                    })
                    return flag
                }))
                setTabsActive(tabList[0].id)
            }
        }
    }
 
    const getCaseInfo = async (id) => {
        const res = await getCaseInfoApi(id)
        if (res.type) {
            console.log(res, 'res')
            let caseDes = res.data.caseDes;
            let caseClaim = res.data.caseClaim;
            setCaseDetailAi(caseDes)
            getCase(caseDes, caseClaim);
            getLaw(caseDes, caseClaim);
        }
    }
 
    //根据id定义组件
    const getTypeDom = (key) => {
        if (key === 'sxxq' || key === 'dslxq') {
            return <MatterDetail hasApplet={true} hasEditBtn={true} authorData={authorData} caseId={caseId} />
        }
        if (key === 'sxbl') {
            return <Handle authorData={authorData} caseId={caseId} caseTaskId={caseTaskId} />
        }
        if (key === 'sqjl') {
            return <ApplyInfo />
        }
        if (key === 'lhczsh') {
            return <AuditView authorData={authorData} caseId={caseId} caseTaskId={caseTaskId} />
        }
    }
 
    return (
        <div style={{ position: 'relative', height: '100vh' }}>
            <NewPage
                pageHead={
                    { breadcrumbData: [{ title: '工作台' }, { title: '事件中心' }], title: '办理反馈' }
                }
            >
                <Tabs
                    onChange={(v) => setTabsActive(v)}
                    className='myTabContent'
                    activeTab={tabsActive}
                >
                    {tabsList?.map(item => {
                        return <TabPane
                            key={item.key}
                            title={
                                <span>
                                    {tabsActive === item.key && <img src={item.img} alt="" style={{ width: '16px', height: '16px', margin: '-5px 12px 0px 0px' }} />}
                                    <span style={{ fontSize: '16px' }}>{item.label}</span>
                                </span>
                            }
                        >
                            {
                                item.isNeedStep && <div style={{ backgroundColor: '#fff', margin: '0px 16px 0px 16px', paddingTop: '16px', paddingLeft: '91px' }}>
                                    <Steps type='navigation' current={current}>
                                        <Step title='来访登记' disabled />
                                        <Step title='事件流转' disabled />
                                        <Step title='办理反馈' disabled />
                                        <Step title='结案审核' disabled />
                                        <Step title='当事人评价' disabled />
                                        <Step title='结案归档' disabled />
                                    </Steps>
                                </div>
                            }
                            {getTypeDom(item.key)}
                        </TabPane>
                    })}
                </Tabs>
            </NewPage>
            <div className="gradient-box" onClick={() => handleAi()}>
                <div><img src={Aimge} alt='' style={{ width: '111px', height: '120px' }} /></div>
                <div style={{ color: '#FFFFFF' }}>穗调解数智人</div>
            </div>
            <AiQuestion
                visible={AiQuestionView}
                onClose={() => setAiQuestionView(false)}
                aiData={aiData}
                aiLawData={aiLawData}
                caseDetailAi={caseDetailAi}
            />
        </div>
    )
}
 
export default Organization;