From d105de9167cfad3bb371fc48ec211a058e5b8e79 Mon Sep 17 00:00:00 2001 From: hyh123a Date: Wed, 20 Apr 2022 18:25:12 +0800 Subject: [PATCH] add the ticker record button --- .../MyEMS/Ticket/TicketApplication.js | 79 ++++++++++++++++++- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/myems-web/src/components/MyEMS/Ticket/TicketApplication.js b/myems-web/src/components/MyEMS/Ticket/TicketApplication.js index 09f42c95..406a4c55 100644 --- a/myems-web/src/components/MyEMS/Ticket/TicketApplication.js +++ b/myems-web/src/components/MyEMS/Ticket/TicketApplication.js @@ -37,7 +37,7 @@ import { toast } from 'react-toastify'; import ButtonIcon from '../../common/ButtonIcon'; import { APIBaseURL } from '../../../config'; import { join } from 'lodash'; -import { Steps } from 'antd'; +import { Steps, Timeline } from 'antd'; const { Step } = Steps; @@ -160,6 +160,7 @@ const TicketApplication = ({ setRedirect, setRedirectUrl, t }) => { {t('View State')} + {t('View Record')} {t('View Workflow')} @@ -372,8 +373,40 @@ const TicketApplication = ({ setRedirect, setRedirectUrl, t }) => { }); }; - let hiddenTicketWorkflowModal = () => { - setModalIsShown(false); + let viewTicketRecordModal = (id, e) => { + console.log('View Ticket Record', id); + // Get Ticket Status + let isResponseOK = false; + fetch(APIBaseURL + '/ticket/status/' + id, { + method: 'GET', + headers: { + 'Content-type': 'application/json' + }, + body: null + }) + .then(response => { + console.log(response); + if (response.ok) { + isResponseOK = true; + } + return response.json(); + }) + .then(json => { + if (isResponseOK) { + console.log('/ticket/record ---', json); + console.log('/ticket/record ---', json['data']); + let temp = json.data; + console.log('temp', temp); + setTicketStatus({ ...temp }); + setModalIsShown(true); + setOpenedModalName('Record'); + } else { + toast.error(json.description); + } + }) + .catch(err => { + console.log(err); + }); }; let viewTicketWorkflowModal = (id, e) => { @@ -400,9 +433,14 @@ const TicketApplication = ({ setRedirect, setRedirectUrl, t }) => { console.log('switch status'); return {t('Ticket Status')}; + case 'Record': + console.log('switch record'); + return {t('Ticket Record')}; + case 'Workflow': console.log('switch workflow'); return {t('Ticket Workflow')}; + default: console.log('switch none'); return {t('Ticket None')}; @@ -453,16 +491,42 @@ const TicketApplication = ({ setRedirect, setRedirectUrl, t }) => { let description_time = item.state_flow_log_list[0].transition.transition_name; description = description_user + description_operation + '@' + description_time; } - return ; + return ; })} )} ); + case 'Record': + console.log('switch Record'); + return ( + + {ticketStatus && ( + + {ticketStatus.value + .filter(item => item.state_flow_log_list.length > 0) + .map((item, index) => { + let description_user = item.state_flow_log_list[0].participant_info.participant_alias; + let description_time = item.state_flow_log_list[0].gmt_created; + let description_operation = item.state_flow_log_list[0].transition.transition_name; + let description = "用户'" + description_user + "'发起了'" + description_operation + "'操作"; + return ( + + {description} + + ); + })} + + + )} + + ); + case 'Workflow': console.log('switch workflow'); return {t('Ticket Workflow')}; + default: console.log('switch none'); return {}; @@ -488,6 +552,13 @@ const TicketApplication = ({ setRedirect, setRedirectUrl, t }) => { ); + case 'Record': + return ( + + + + ); + case 'Workflow': return (