@@ -40,14 +40,10 @@ const PublicNoticeApplyForm = () => { | |||||
}), | }), | ||||
onSubmit:values=>{ | onSubmit:values=>{ | ||||
console.log(values); | console.log(values); | ||||
HttpUtils.post({ | |||||
url: UrlUtils.POST_PUBLIC_NOTICE_SAVE, | |||||
HttpUtils.postWithFiles({ | |||||
url: UrlUtils.POST_PUBLIC_NOTICE_APPLY, | |||||
params: { | params: { | ||||
id: 0, | id: 0, | ||||
group: values.chName, | |||||
groupTitle: values.groupTitle, | |||||
groupNo: values.groupNo, | |||||
issueId: values.issueId, | |||||
contactPerson: values.contactPerson, | contactPerson: values.contactPerson, | ||||
contactTelNo: { | contactTelNo: { | ||||
countryCode: values.tel_countryCode, | countryCode: values.tel_countryCode, | ||||
@@ -58,8 +54,8 @@ const PublicNoticeApplyForm = () => { | |||||
faxNumber: values.faxNumber | faxNumber: values.faxNumber | ||||
}, | }, | ||||
remarks:values.remarks, | remarks:values.remarks, | ||||
file: attachment | |||||
}, | }, | ||||
files: [attachment], | |||||
onSuccess: function(){ | onSuccess: function(){ | ||||
loadDataFun(); | loadDataFun(); | ||||
} | } | ||||
@@ -137,6 +133,23 @@ const PublicNoticeApplyForm = () => { | |||||
form: formik | form: formik | ||||
})} | })} | ||||
<Grid item lg={4}></Grid> | <Grid item lg={4}></Grid> | ||||
<Grid item lg={4}></Grid> | |||||
{FieldUtils.getPhoneField({ | |||||
label:"Issue:", | |||||
valueName:{ | |||||
code: "issueId", | |||||
num:"issueId" | |||||
}, | |||||
form: formik | |||||
})} | |||||
<Grid item lg={4}></Grid> | |||||
<Grid item lg={4}></Grid> | |||||
{FieldUtils.getTextArea({ | |||||
label:"備註:", | |||||
valueName:"remarks", | |||||
form: formik | |||||
})} | |||||
<Grid item lg={4}></Grid> | |||||
<Grid item lg={12}> | <Grid item lg={12}> | ||||
<center> | <center> | ||||
<input | <input | ||||
@@ -2,9 +2,10 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { | import { | ||||
DataGrid, | DataGrid, | ||||
GridActionsCellItem, | |||||
} from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
import * as Icon from '../../../utils/IconUtils'; | |||||
import { | |||||
Button | |||||
} from '@mui/material'; | |||||
import * as DateUtils from "../../../utils/DateUtils" | import * as DateUtils from "../../../utils/DateUtils" | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
@@ -51,16 +52,8 @@ export default function SubmittedTab({rows}) { | |||||
headerName: '', | headerName: '', | ||||
width: 50, | width: 50, | ||||
cellClassName: 'actions', | cellClassName: 'actions', | ||||
getActions: (params) => { | |||||
return [ | |||||
<GridActionsCellItem | |||||
key="OutSave" | |||||
icon={<Icon.Download/>} | |||||
label="查看詳細" | |||||
className="textPrimary" | |||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | |||||
color="primary" | |||||
/>] | |||||
renderCell: () => { | |||||
return <Button onClick={()=>{}}>查看詳細</Button>; | |||||
}, | }, | ||||
} | } | ||||
]; | ]; | ||||
@@ -2,12 +2,10 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { | import { | ||||
DataGrid, | DataGrid, | ||||
GridActionsCellItem, | |||||
} from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
import { | import { | ||||
Button | Button | ||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import * as Icon from 'utils/IconUtils'; | |||||
import * as DateUtils from "utils/DateUtils" | import * as DateUtils from "utils/DateUtils" | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
@@ -54,16 +52,8 @@ export default function SubmittedTab({rows}) { | |||||
headerName: '', | headerName: '', | ||||
width: 50, | width: 50, | ||||
cellClassName: 'actions', | cellClassName: 'actions', | ||||
getActions: (params) => { | |||||
return [ | |||||
<GridActionsCellItem | |||||
key="OutSave" | |||||
icon={<Icon.Download/>} | |||||
label="查看詳細" | |||||
className="textPrimary" | |||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | |||||
color="primary" | |||||
/>] | |||||
renderCell: () => { | |||||
return <Button onClick={()=>{}}>查看詳細</Button>; | |||||
}, | }, | ||||
} | } | ||||
]; | ]; | ||||
@@ -2,9 +2,10 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { | import { | ||||
DataGrid, | DataGrid, | ||||
GridActionsCellItem, | |||||
} from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
import * as Icon from 'utils/IconUtils'; | |||||
import { | |||||
Button | |||||
} from '@mui/material'; | |||||
import * as DateUtils from "utils/DateUtils" | import * as DateUtils from "utils/DateUtils" | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
@@ -51,16 +52,8 @@ export default function SubmittedTab({rows}) { | |||||
headerName: '', | headerName: '', | ||||
width: 50, | width: 50, | ||||
cellClassName: 'actions', | cellClassName: 'actions', | ||||
getActions: (params) => { | |||||
return [ | |||||
<GridActionsCellItem | |||||
key="OutSave" | |||||
icon={<Icon.Download/>} | |||||
label="查看詳細" | |||||
className="textPrimary" | |||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | |||||
color="primary" | |||||
/>] | |||||
renderCell: () => { | |||||
return <Button onClick={()=>{}}>查看詳細</Button>; | |||||
}, | }, | ||||
} | } | ||||
]; | ]; | ||||
@@ -2,10 +2,11 @@ | |||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { | import { | ||||
DataGrid, | DataGrid, | ||||
GridActionsCellItem, | |||||
} from "@mui/x-data-grid"; | } from "@mui/x-data-grid"; | ||||
import * as Icon from '../../../utils/IconUtils'; | |||||
import * as DateUtils from "../../../utils/DateUtils" | |||||
import { | |||||
Button | |||||
} from '@mui/material'; | |||||
import * as DateUtils from "utils/DateUtils" | |||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SubmittedTab({rows}) { | export default function SubmittedTab({rows}) { | ||||
@@ -24,7 +25,7 @@ export default function SubmittedTab({rows}) { | |||||
headerName: '提交日期', | headerName: '提交日期', | ||||
flex: 1, | flex: 1, | ||||
valueGetter:(params)=>{ | valueGetter:(params)=>{ | ||||
return DateUtils.datetimeStr(params.value); | |||||
return DateUtils.datetimeStr(params?.value); | |||||
} | } | ||||
}, | }, | ||||
{ | { | ||||
@@ -32,18 +33,12 @@ export default function SubmittedTab({rows}) { | |||||
field: 'remarks', | field: 'remarks', | ||||
headerName: '我的備註', | headerName: '我的備註', | ||||
flex: 1, | flex: 1, | ||||
valueGetter:(params)=>{ | |||||
return DateUtils.datetimeStr(params.value); | |||||
} | |||||
}, | }, | ||||
{ | { | ||||
id: 'status', | id: 'status', | ||||
field: 'status', | field: 'status', | ||||
headerName: '狀態', | headerName: '狀態', | ||||
flex: 1, | flex: 1, | ||||
valueGetter:(params)=>{ | |||||
return DateUtils.datetimeStr(params.value); | |||||
} | |||||
}, | }, | ||||
{ | { | ||||
field: 'actions', | field: 'actions', | ||||
@@ -51,16 +46,8 @@ export default function SubmittedTab({rows}) { | |||||
headerName: '', | headerName: '', | ||||
width: 50, | width: 50, | ||||
cellClassName: 'actions', | cellClassName: 'actions', | ||||
getActions: (params) => { | |||||
return [ | |||||
<GridActionsCellItem | |||||
key="OutSave" | |||||
icon={<Icon.Download/>} | |||||
label="查看詳細" | |||||
className="textPrimary" | |||||
onClick={onDownloadClick(params.id, params.row.skey, params.row.filename)} | |||||
color="primary" | |||||
/>] | |||||
renderCell: () => { | |||||
return <Button onClick={()=>{}}>查看詳細</Button>; | |||||
}, | }, | ||||
} | } | ||||
]; | ]; | ||||
@@ -47,12 +47,12 @@ const PublicNotice = () => { | |||||
const loadData = ()=>{ | const loadData = ()=>{ | ||||
setLoding(true); | setLoding(true); | ||||
HttpUtils.get({ | HttpUtils.get({ | ||||
url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST}`, | |||||
url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST_ListByStatus}`, | |||||
onSuccess: function(response){ | onSuccess: function(response){ | ||||
setSubmittedList(response.data["submitted"]); | |||||
setInProgressList(response.data["inProgress"]); | |||||
setPendingPaymentList(response.data["pendingPayment"]); | |||||
setPendingPublishList(response.data["pendingPublish"]); | |||||
setSubmittedList(response["submitted"]); | |||||
setInProgressList(response["inProgress"]); | |||||
setPendingPaymentList(response["pendingPayment"]); | |||||
setPendingPublishList(response["pendingPublish"]); | |||||
} | } | ||||
}); | }); | ||||
}; | }; | ||||
@@ -85,10 +85,10 @@ const PublicNotice = () => { | |||||
<TabContext value={selectedTab}> | <TabContext value={selectedTab}> | ||||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | <Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||||
<TabList onChange={handleChange} aria-label="lab API tabs example"> | <TabList onChange={handleChange} aria-label="lab API tabs example"> | ||||
<Tab label="已提交" value="1" /> | |||||
<Tab label="處理中" value="2" /> | |||||
<Tab label="待付款" value="3" /> | |||||
<Tab label="待發佈" value="4" /> | |||||
<Tab label={"已提交("+submittedList.length+")"} value="1" /> | |||||
<Tab label={"處理中("+inProgressList.length+")"} value="2" /> | |||||
<Tab label={"待付款("+pendingPaymentList.length+")"} value="3" /> | |||||
<Tab label={"待發佈("+pendingPublishList.length+")"} value="4" /> | |||||
<Tab label="搜尋申請記錄" value="5" /> | <Tab label="搜尋申請記錄" value="5" /> | ||||
</TabList> | </TabList> | ||||
</Box> | </Box> | ||||
@@ -50,7 +50,7 @@ export const GET_SET_UN_PRIMARY_USER = apiPath+'/user/un-primary'; | |||||
export const GET_PUBLIC_NOTICE_LIST = apiPath+'/application/list'; | export const GET_PUBLIC_NOTICE_LIST = apiPath+'/application/list'; | ||||
export const GET_PUBLIC_NOTICE_LIST_ListByStatus = apiPath+'/application/status-list'; | export const GET_PUBLIC_NOTICE_LIST_ListByStatus = apiPath+'/application/status-list'; | ||||
export const GET_PUBLIC_NOTICE_getApplyUser = apiPath+'/application/get-apply-user'; | export const GET_PUBLIC_NOTICE_getApplyUser = apiPath+'/application/get-apply-user'; | ||||
export const POST_PUBLIC_NOTICE_SAVE = apiPath+'/application/save'; | |||||
export const POST_PUBLIC_NOTICE_APPLY = apiPath+'/application/apply'; | |||||
//GLD User | //GLD User | ||||
export const POST_ADMIN_USER_REGISTER = apiPath+'/user/registry'; | export const POST_ADMIN_USER_REGISTER = apiPath+'/user/registry'; | ||||
@@ -43,6 +43,30 @@ export const getTextField=({label, valueName, form, disabled})=>{ | |||||
</Grid>; | </Grid>; | ||||
} | } | ||||
export const getTextArea=({label, valueName, form, disabled, ...props})=>{ | |||||
return <Grid item lg={4} > | |||||
<Grid container alignItems={"center"}> | |||||
<Grid item xs={4} s={4} md={4} lg={4} | |||||
sx={{ml: 3, mr: 3, display: 'flex', alignItems: 'center'}}> | |||||
{label} | |||||
</Grid> | |||||
<Grid item xs={7} s={7} md={7} lg={6}> | |||||
{initField({ | |||||
type:"text", | |||||
valueName:valueName, | |||||
form:form, | |||||
disabled:disabled, | |||||
multiline: true, | |||||
row:10, | |||||
minRows: 4, | |||||
maxRows: 4, | |||||
props | |||||
})} | |||||
</Grid> | |||||
</Grid> | |||||
</Grid>; | |||||
} | |||||
export const getPhoneField=({label, valueName, form, disabled})=>{ | export const getPhoneField=({label, valueName, form, disabled})=>{ | ||||
return <Grid item lg={4}> | return <Grid item lg={4}> | ||||
<Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
@@ -155,11 +179,12 @@ export const getComboField=({label,dataList, valueName, form, disabled, getOptio | |||||
</Grid>; | </Grid>; | ||||
} | } | ||||
export const initField=({type, valueName, form, disabled, placeholder, inputProps})=>{ | |||||
export const initField=({type, valueName, form, disabled, multiline, placeholder, inputProps, ...props})=>{ | |||||
let err = Boolean(form.errors[valueName]); | let err = Boolean(form.errors[valueName]); | ||||
return <TextField | return <TextField | ||||
fullWidth | fullWidth | ||||
multiline={multiline} | |||||
id={valueName} | id={valueName} | ||||
name={valueName} | name={valueName} | ||||
type={type} | type={type} | ||||
@@ -176,5 +201,6 @@ export const initField=({type, valueName, form, disabled, placeholder, inputProp | |||||
background: "#f8f8f8", | background: "#f8f8f8", | ||||
}, | }, | ||||
}} | }} | ||||
{...props} | |||||
/> | /> | ||||
} | } |
@@ -35,6 +35,29 @@ export const post = ({url, params, onSuccess, onFail, onError, headers}) =>{ | |||||
}); | }); | ||||
}; | }; | ||||
export const postWithFiles = ({url, params, files, onSuccess, onFail, onError}) =>{ | |||||
var formData = new FormData(); | |||||
for (let i = 0; i < files.length; i++){ | |||||
const file = files[i] | |||||
formData.append("multipartFileList", file); | |||||
} | |||||
for (var key in params) { | |||||
if(typeof(params[key]) ==='object'){ | |||||
formData.append(key, JSON.stringify(params[key])); | |||||
}else{ | |||||
formData.append(key, params[key]?params[key]:null); | |||||
} | |||||
} | |||||
axios.post(url,formData, | |||||
{headers: {"Content-Type":"multipart/form-data"}}) | |||||
.then( | |||||
(response)=>{onResponse(response, onSuccess, onFail);} | |||||
).catch(error => { | |||||
return handleError(error,onError); | |||||
}); | |||||
}; | |||||
export const fileDownload = ({fileId, skey, filename, onError}) =>{ | export const fileDownload = ({fileId, skey, filename, onError}) =>{ | ||||
axios.get( FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename, | axios.get( FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename, | ||||
{ | { | ||||
@@ -56,29 +79,41 @@ export const fileDownload = ({fileId, skey, filename, onError}) =>{ | |||||
}); | }); | ||||
}; | }; | ||||
export const fileUpload = ({ refType, refId, files,refCode, onSuccess, onFail, onError}) =>{ | |||||
console.log(files); | |||||
var formData = new FormData(); | |||||
for (let i = 0; i < files.length; i++){ | |||||
const file = files[i] | |||||
formData.append("multipartFileList", file); | |||||
} | |||||
// formData.append("multipartFile", file); | |||||
formData.append("refType", refType); | |||||
formData.append("refId", refId); | |||||
if(refCode){ | |||||
formData.append("refCode", refCode); | |||||
} | |||||
console.log(formData) | |||||
axios.post(FILE_UP_POST,formData,{ | |||||
headers: { | |||||
"Content-Type":"multipart/form-data" | |||||
} | |||||
}).then( | |||||
(response)=>{ | |||||
onResponse(response,onSuccess,onFail); | |||||
} | |||||
).catch(error => { return handleError(error, onError); }); | |||||
export const fileUpload = ({ refType, refId, files, refCode, onSuccess, onFail, onError}) =>{ | |||||
// console.log(files); | |||||
// var formData = new FormData(); | |||||
// for (let i = 0; i < files.length; i++){ | |||||
// const file = files[i] | |||||
// formData.append("multipartFileList", file); | |||||
// } | |||||
// // formData.append("multipartFile", file); | |||||
// formData.append("refType", refType); | |||||
// formData.append("refId", refId); | |||||
// if(refCode){ | |||||
// formData.append("refCode", refCode); | |||||
// } | |||||
// console.log(formData) | |||||
// axios.post(FILE_UP_POST,formData,{ | |||||
// headers: { | |||||
// "Content-Type":"multipart/form-data" | |||||
// } | |||||
// }).then( | |||||
// (response)=>{ | |||||
// onResponse(response,onSuccess,onFail); | |||||
// } | |||||
// ).catch(error => { return handleError(error, onError); }); | |||||
postWithFiles({ | |||||
url: FILE_UP_POST, | |||||
params:{ | |||||
refType: refType, | |||||
refId: refId, | |||||
refCode: refCode | |||||
}, | |||||
files: files, | |||||
onSuccess: onSuccess, | |||||
onFail:onFail, | |||||
onError:onError | |||||
}); | |||||
}; | }; | ||||