complete ticket agent page

pull/141/head
hyh123a 2022-04-21 08:58:21 +08:00
parent 8c59879478
commit 413ce2e012
1 changed files with 22 additions and 10 deletions

View File

@ -77,6 +77,8 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
// ticket id // ticket id
const [ticketId, setTicketId] = useState(0); const [ticketId, setTicketId] = useState(0);
// ticket body
const [ticketBody, setTicketBody] = useState({});
useEffect(() => { useEffect(() => {
let isResponseOK = false; let isResponseOK = false;
@ -372,6 +374,14 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
console.log('submitApplication', target); console.log('submitApplication', target);
hiddenModal(); hiddenModal();
// Patch the agent ticket // Patch the agent ticket
ticketFields.value.field_list.map(item => {
let item_key = item.field_key;
let value = item.field_value;
let temp = {}
temp[item_key] = value;
setTicketBody({ ...ticketBody, ...temp });
});
let isResponseOK = false; let isResponseOK = false;
fetch(APIBaseURL + '/ticket/agent/' + ticketId, { fetch(APIBaseURL + '/ticket/agent/' + ticketId, {
method: 'PATCH', method: 'PATCH',
@ -379,9 +389,7 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
'Content-type': 'application/json' 'Content-type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
title: '123', ...ticketBody,
repair_reason: '123',
tl_agree_text: '223',
transition_id: ticketTransitionField.value[0].transition_id transition_id: ticketTransitionField.value[0].transition_id
}) })
}) })
@ -404,13 +412,16 @@ const TicketAggent = ({ setRedirect, setRedirectUrl, t }) => {
console.log(err); console.log(err);
}); });
}; };
let confirmButton = () => {
message.info('Clicked on Yes.');
};
const text = ` const text = `
Hello world Hello world
`; `;
let onFieldChange = (index, { target }) => {
console.log('fieldChange', target.value);
setTicketBody({ ...ticketBody, index: target.value });
};
useEffect(() => { useEffect(() => {
console.log('ticketList', ticketList); console.log('ticketList', ticketList);
}, [ticketList]); }, [ticketList]);
@ -435,6 +446,10 @@ Hello world
console.log('ticketId', ticketId); console.log('ticketId', ticketId);
}, [ticketId]); }, [ticketId]);
useEffect(() => {
console.log('ticketBody', ticketBody);
}, [ticketBody]);
return ( return (
<Fragment> <Fragment>
<div> <div>
@ -534,6 +549,7 @@ Hello world
<Form.Item key={index} label={item.field_name} name={item.field_name}> <Form.Item key={index} label={item.field_name} name={item.field_name}>
<Input <Input
defaultValue={item.field_value} defaultValue={item.field_value}
onChange={onFieldChange.bind(this, item.field_key)}
disabled={item.field_attribute == 1 ? true : false} disabled={item.field_attribute == 1 ? true : false}
/> />
</Form.Item> </Form.Item>
@ -549,10 +565,6 @@ Hello world
disabled={item.field_attribute == 1 ? true : false} disabled={item.field_attribute == 1 ? true : false}
/> />
</Form.Item> </Form.Item>
// <InputGroup key={index}>
// <InputGroupText>{item.field_name}</InputGroupText>
// <textarea value={item.field_value} disabled />
// </InputGroup>
); );
break; break;
default: default: