@@ -72,7 +72,6 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { | |||||
setIsWarningPopUp(true); | setIsWarningPopUp(true); | ||||
return; | return; | ||||
} | } | ||||
// console.log(values); | |||||
HttpUtils.postWithFiles({ | HttpUtils.postWithFiles({ | ||||
url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | ||||
params: { | params: { | ||||
@@ -177,7 +176,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { | |||||
id="issueId" | id="issueId" | ||||
name="issueId" | name="issueId" | ||||
defaultValue={issueId} | defaultValue={issueId} | ||||
onChange={(event)=>{ | |||||
onChange={(event) => { | |||||
setIssueId(event.target.value); | setIssueId(event.target.value); | ||||
}} | }} | ||||
> | > | ||||
@@ -188,6 +187,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
<Grid container direction="row" justifyContent="flex-start" alignItems="center"> | <Grid container direction="row" justifyContent="flex-start" alignItems="center"> | ||||
<Grid item xs={12} md={3} lg={3} | <Grid item xs={12} md={3} lg={3} | ||||
@@ -215,10 +215,10 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { | |||||
size="large" | size="large" | ||||
>{attachment ? "上傳檔案" : "重新上傳"}</Button> | >{attachment ? "上傳檔案" : "重新上傳"}</Button> | ||||
</label> | </label> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={12} lg={12}> | <Grid item xs={12} md={12} lg={12}> | ||||
{FieldUtils.getTextArea({ | {FieldUtils.getTextArea({ | ||||
label: "備註:", | label: "備註:", | ||||
@@ -37,6 +37,7 @@ const ApplyForm = () => { | |||||
response["fax_countryCode"] = response?.contactFaxNo?.countryCode; | response["fax_countryCode"] = response?.contactFaxNo?.countryCode; | ||||
response["faxNumber"] = response?.contactFaxNo?.faxNumber; | response["faxNumber"] = response?.contactFaxNo?.faxNumber; | ||||
response["issueId"] = response?.gazetteIssueList[0].id; | response["issueId"] = response?.gazetteIssueList[0].id; | ||||
response["remarks"] = ""; | |||||
var selection = []; | var selection = []; | ||||
for (var i = 0; i < response?.gazetteIssueList?.length; i++) { | for (var i = 0; i < response?.gazetteIssueList?.length; i++) { | ||||
@@ -45,7 +46,6 @@ const ApplyForm = () => { | |||||
selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />); | selection.push(<FormControlLabel value={data.id} control={<Radio />} label={label} />); | ||||
} | } | ||||
setSelection(selection); | setSelection(selection); | ||||
console.log(response.issueId) | |||||
setUserData(response); | setUserData(response); | ||||
} | } | ||||
}); | }); | ||||
@@ -506,7 +506,7 @@ const ApplicationDetailCard = ( | |||||
<FormLabel><Typography variant="h5">備註:</Typography></FormLabel> | <FormLabel><Typography variant="h5">備註:</Typography></FormLabel> | ||||
</Grid> | </Grid> | ||||
<Grid item xs={12} md={9} lg={9}> | <Grid item xs={12} md={9} lg={9}> | ||||
<FormLabel><Typography variant="h5">{currentApplicationDetailData.remarks}</Typography></FormLabel> | |||||
<Typography variant="h5">{currentApplicationDetailData.remarks}</Typography> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -67,15 +67,7 @@ export const getTextArea = ({ label, valueName, form, disabled, inputProps, ...p | |||||
} | } | ||||
export const getPhoneField = ({ label, valueName, form, disabled }) => { | export const getPhoneField = ({ label, valueName, form, disabled }) => { | ||||
form.handleChange = (event) => { | |||||
const value = event.target.value; | |||||
const name = event.target.name; | |||||
if (value.match(/[^0-9]/)) { | |||||
return event.preventDefault(); | |||||
} | |||||
if (valueName.code === name) form.setFieldValue(valueName.code, value) | |||||
if (valueName.num === name) form.setFieldValue(valueName.num, value) | |||||
} | |||||
return <Grid container alignItems={"center"}> | return <Grid container alignItems={"center"}> | ||||
<Grid item xs={12} md={3} lg={3} | <Grid item xs={12} md={3} lg={3} | ||||
sx={{ display: 'flex', alignItems: 'center' }}> | sx={{ display: 'flex', alignItems: 'center' }}> | ||||
@@ -88,13 +80,31 @@ export const getPhoneField = ({ label, valueName, form, disabled }) => { | |||||
valueName: valueName.code, | valueName: valueName.code, | ||||
form: form, | form: form, | ||||
disabled: disabled, | disabled: disabled, | ||||
width: '35%' | |||||
width: '35%', | |||||
handleChange: (event) => { | |||||
const value = event.target.value; | |||||
const name = event.target.name; | |||||
if (value.match(/[^0-9]/)) { | |||||
return event.preventDefault(); | |||||
} | |||||
if (valueName.code === name) form.setFieldValue(valueName.code, value) | |||||
if (valueName.num === name) form.setFieldValue(valueName.num, value) | |||||
} | |||||
})} | })} | ||||
{initField({ | {initField({ | ||||
type: "tel", | type: "tel", | ||||
valueName: valueName.num, | valueName: valueName.num, | ||||
form: form, | form: form, | ||||
disabled: disabled | |||||
disabled: disabled, | |||||
handleChange: (event) => { | |||||
const value = event.target.value; | |||||
const name = event.target.name; | |||||
if (value.match(/[^0-9]/)) { | |||||
return event.preventDefault(); | |||||
} | |||||
if (valueName.code === name) form.setFieldValue(valueName.code, value) | |||||
if (valueName.num === name) form.setFieldValue(valueName.num, value) | |||||
} | |||||
})} | })} | ||||
</Stack> | </Stack> | ||||
</Grid> | </Grid> | ||||
@@ -160,7 +170,7 @@ export const getComboField = ({ label, dataList, valueName, form, disabled, getO | |||||
</Grid>; | </Grid>; | ||||
} | } | ||||
export const initField = ({ type, valueName, form, disabled, multiline, placeholder, inputProps, width, ...props }) => { | |||||
export const initField = ({ type, valueName, form, disabled, multiline, handleChange, placeholder, inputProps, width, ...props }) => { | |||||
let err = Boolean(form.errors[valueName]); | let err = Boolean(form.errors[valueName]); | ||||
return <TextField | return <TextField | ||||
@@ -173,7 +183,7 @@ export const initField = ({ type, valueName, form, disabled, multiline, placehol | |||||
inputProps={inputProps} | inputProps={inputProps} | ||||
error={err} | error={err} | ||||
helperText={form.errors[valueName] ? form.errors[valueName] : ''} | helperText={form.errors[valueName] ? form.errors[valueName] : ''} | ||||
onChange={form.handleChange} | |||||
onChange={handleChange ? handleChange : form.handleChange} | |||||
value={form.values[valueName]} | value={form.values[valueName]} | ||||
disabled={disabled} | disabled={disabled} | ||||
sx={{ | sx={{ | ||||