|
|
@@ -31,6 +31,8 @@ const FormPanel = ({ formData }) => { |
|
|
|
const [data, setData] = React.useState({}); |
|
|
|
const [attachments, setAttachments] = React.useState([]); |
|
|
|
|
|
|
|
const [actionValue, setActionValue] = React.useState(true); |
|
|
|
|
|
|
|
const [isWarningPopUp, setIsWarningPopUp] = React.useState(false); |
|
|
|
const [warningText, setWarningText] = React.useState(""); |
|
|
|
|
|
|
@@ -50,19 +52,25 @@ const FormPanel = ({ formData }) => { |
|
|
|
vaild: yup.string().max(255, "請輸入你的登入密碼").required('請輸入你的登入密碼'), |
|
|
|
}), |
|
|
|
onSubmit: values => { |
|
|
|
if (!values.action) { |
|
|
|
if (!actionValue) { |
|
|
|
if (!attachments || attachments.length <= 0) { |
|
|
|
setWarningText("請選擇上傳檔案"); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(isOverTime()){ |
|
|
|
setWarningText("回覆逾時,請重新申請。"); |
|
|
|
setIsWarningPopUp(true); |
|
|
|
return; |
|
|
|
} |
|
|
|
// console.log(values); |
|
|
|
HttpUtils.postWithFiles({ |
|
|
|
url: UrlUtils.REPLY_PROOF, |
|
|
|
params: { |
|
|
|
id: data.id, |
|
|
|
action: values.action, |
|
|
|
action: actionValue, |
|
|
|
vaild: values.vaild, |
|
|
|
}, |
|
|
|
files: attachments ? attachments : [], |
|
|
@@ -138,19 +146,25 @@ const FormPanel = ({ formData }) => { |
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
校對回覆: {formik.values.action ? "可以付印(稿件正確)" : "未能付印(需要修改)"} |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<FileList |
|
|
|
lang="ch" |
|
|
|
refId={params.id} |
|
|
|
refType={"proofReply"} |
|
|
|
dateHideable={true} |
|
|
|
disablePagination |
|
|
|
disableSelectionOnClick |
|
|
|
disableColumnMenu |
|
|
|
disableColumnSelector |
|
|
|
hideFooter |
|
|
|
/> |
|
|
|
</Grid> |
|
|
|
{ |
|
|
|
formik.values.action ? |
|
|
|
null |
|
|
|
: |
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<FileList |
|
|
|
lang="ch" |
|
|
|
refId={params.id} |
|
|
|
refType={"proofReply"} |
|
|
|
dateHideable={true} |
|
|
|
disablePagination |
|
|
|
disableSelectionOnClick |
|
|
|
disableColumnMenu |
|
|
|
disableColumnSelector |
|
|
|
hideFooter |
|
|
|
/> |
|
|
|
</Grid> |
|
|
|
} |
|
|
|
|
|
|
|
</Grid> |
|
|
|
: |
|
|
|
( |
|
|
@@ -169,57 +183,67 @@ const FormPanel = ({ formData }) => { |
|
|
|
id="action" |
|
|
|
name="action" |
|
|
|
defaultValue={true} |
|
|
|
onChange={(event)=>{ |
|
|
|
setActionValue(event.target.value=="true"?true:false); |
|
|
|
}} |
|
|
|
> |
|
|
|
<FormControlLabel value={true} control={<Radio />} label="可以付印(稿件正確)" /> |
|
|
|
<FormControlLabel value={false} control={<Radio />} label="未能付印(需要修改)" /> |
|
|
|
</RadioGroup> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
請上載稿件修改的檔案: |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<input |
|
|
|
id="uploadFileBtn" |
|
|
|
name="file" |
|
|
|
type="file" |
|
|
|
accept=".pdf" |
|
|
|
style={{ display: 'none' }} |
|
|
|
disabled={attachments.length >= (formik.values.groupType == "A" ? 2 : 1)} |
|
|
|
onChange={(event) => { |
|
|
|
readFile(event) |
|
|
|
}} |
|
|
|
/> |
|
|
|
<label htmlFor="uploadFileBtn"> |
|
|
|
<Button |
|
|
|
component="span" |
|
|
|
variant="contained" |
|
|
|
size="large" |
|
|
|
disabled={attachments.length >= (formik.values.groupType == "A" ? 2 : 1)} |
|
|
|
>上載</Button> |
|
|
|
</label> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} /> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
{ |
|
|
|
actionValue ? |
|
|
|
null |
|
|
|
: |
|
|
|
<> |
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
請上載稿件修改的檔案: |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<input |
|
|
|
id="uploadFileBtn" |
|
|
|
name="file" |
|
|
|
type="file" |
|
|
|
accept=".pdf" |
|
|
|
style={{ display: 'none' }} |
|
|
|
disabled={attachments.length >= (formik.values.groupType == "A" ? 2 : 1)} |
|
|
|
onChange={(event) => { |
|
|
|
readFile(event) |
|
|
|
}} |
|
|
|
/> |
|
|
|
<label htmlFor="uploadFileBtn"> |
|
|
|
<Button |
|
|
|
component="span" |
|
|
|
variant="contained" |
|
|
|
size="large" |
|
|
|
disabled={attachments.length >= (formik.values.groupType == "A" ? 2 : 1)} |
|
|
|
>上載</Button> |
|
|
|
</label> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
|
|
|
|
<Grid item xs={12} md={12} textAlign="left"> |
|
|
|
<UploadFileTable key="uploadTable" recordList={attachments} setRecordList={setAttachments} /> |
|
|
|
</Grid> |
|
|
|
</> |
|
|
|
} |
|
|
|
|
|
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
|
<Stack direction="row" alignItems="center"> |
|
|
|
<FormLabel sx={{ paddingRight: 2, textAlign: "center" }}> |
|
|
|
<FormLabel sx={{ paddingRight: 2, paddingBottom: 3, textAlign: "center" }}> |
|
|
|
簽署: |
|
|
|
</FormLabel> |
|
|
|
<TextField |
|
|
|
fullWidth |
|
|
|
type="text" |
|
|
|
type="password" |
|
|
|
onChange={formik.handleChange} |
|
|
|
name="vaild" |
|
|
|
variant="outlined" |
|
|
|
error={Boolean(formik.errors["vaild"])} |
|
|
|
helperText={formik.errors["vaild"] ? formik.errors["vaild"] : ''} |
|
|
|
helperText={formik.errors["vaild"] ? formik.errors["vaild"] : ' '} |
|
|
|
placeholder="請輸入你的登入密碼" |
|
|
|
sx={ |
|
|
|
{ |
|
|
|