Bläddra i källkod

add application

master
Anna Ho 1 år sedan
förälder
incheckning
f65558f2fc
9 ändrade filer med 134 tillägg och 97 borttagningar
  1. +20
    -7
      src/pages/PublicNotice/ApplyForm/index.js
  2. +5
    -12
      src/pages/PublicNotice/ListPanel/InProgressTab.js
  3. +2
    -12
      src/pages/PublicNotice/ListPanel/PendingPaymentTab.js
  4. +5
    -12
      src/pages/PublicNotice/ListPanel/PendingPublishTab.js
  5. +7
    -20
      src/pages/PublicNotice/ListPanel/SubmittedTab.js
  6. +9
    -9
      src/pages/PublicNotice/ListPanel/index.js
  7. +1
    -1
      src/utils/ApiPathConst.js
  8. +27
    -1
      src/utils/FieldUtils.js
  9. +58
    -23
      src/utils/HttpUtils.js

+ 20
- 7
src/pages/PublicNotice/ApplyForm/index.js Visa fil

@@ -40,14 +40,10 @@ const PublicNoticeApplyForm = () => {
}),
onSubmit:values=>{
console.log(values);
HttpUtils.post({
url: UrlUtils.POST_PUBLIC_NOTICE_SAVE,
HttpUtils.postWithFiles({
url: UrlUtils.POST_PUBLIC_NOTICE_APPLY,
params: {
id: 0,
group: values.chName,
groupTitle: values.groupTitle,
groupNo: values.groupNo,
issueId: values.issueId,
contactPerson: values.contactPerson,
contactTelNo: {
countryCode: values.tel_countryCode,
@@ -58,8 +54,8 @@ const PublicNoticeApplyForm = () => {
faxNumber: values.faxNumber
},
remarks:values.remarks,
file: attachment
},
files: [attachment],
onSuccess: function(){
loadDataFun();
}
@@ -137,6 +133,23 @@ const PublicNoticeApplyForm = () => {
form: formik
})}
<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}>
<center>
<input


+ 5
- 12
src/pages/PublicNotice/ListPanel/InProgressTab.js Visa fil

@@ -2,9 +2,10 @@
import * as React from 'react';
import {
DataGrid,
GridActionsCellItem,
} from "@mui/x-data-grid";
import * as Icon from '../../../utils/IconUtils';
import {
Button
} from '@mui/material';
import * as DateUtils from "../../../utils/DateUtils"
// ==============================|| EVENT TABLE ||============================== //

@@ -51,16 +52,8 @@ export default function SubmittedTab({rows}) {
headerName: '',
width: 50,
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
src/pages/PublicNotice/ListPanel/PendingPaymentTab.js Visa fil

@@ -2,12 +2,10 @@
import * as React from 'react';
import {
DataGrid,
GridActionsCellItem,
} from "@mui/x-data-grid";
import {
Button
} from '@mui/material';
import * as Icon from 'utils/IconUtils';
import * as DateUtils from "utils/DateUtils"
// ==============================|| EVENT TABLE ||============================== //

@@ -54,16 +52,8 @@ export default function SubmittedTab({rows}) {
headerName: '',
width: 50,
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>;
},
}
];


+ 5
- 12
src/pages/PublicNotice/ListPanel/PendingPublishTab.js Visa fil

@@ -2,9 +2,10 @@
import * as React from 'react';
import {
DataGrid,
GridActionsCellItem,
} from "@mui/x-data-grid";
import * as Icon from 'utils/IconUtils';
import {
Button
} from '@mui/material';
import * as DateUtils from "utils/DateUtils"
// ==============================|| EVENT TABLE ||============================== //

@@ -51,16 +52,8 @@ export default function SubmittedTab({rows}) {
headerName: '',
width: 50,
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>;
},
}
];


+ 7
- 20
src/pages/PublicNotice/ListPanel/SubmittedTab.js Visa fil

@@ -2,10 +2,11 @@
import * as React from 'react';
import {
DataGrid,
GridActionsCellItem,
} 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 ||============================== //

export default function SubmittedTab({rows}) {
@@ -24,7 +25,7 @@ export default function SubmittedTab({rows}) {
headerName: '提交日期',
flex: 1,
valueGetter:(params)=>{
return DateUtils.datetimeStr(params.value);
return DateUtils.datetimeStr(params?.value);
}
},
{
@@ -32,18 +33,12 @@ export default function SubmittedTab({rows}) {
field: 'remarks',
headerName: '我的備註',
flex: 1,
valueGetter:(params)=>{
return DateUtils.datetimeStr(params.value);
}
},
{
id: 'status',
field: 'status',
headerName: '狀態',
flex: 1,
valueGetter:(params)=>{
return DateUtils.datetimeStr(params.value);
}
},
{
field: 'actions',
@@ -51,16 +46,8 @@ export default function SubmittedTab({rows}) {
headerName: '',
width: 50,
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>;
},
}
];


+ 9
- 9
src/pages/PublicNotice/ListPanel/index.js Visa fil

@@ -47,12 +47,12 @@ const PublicNotice = () => {
const loadData = ()=>{
setLoding(true);
HttpUtils.get({
url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST}`,
url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST_ListByStatus}`,
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}>
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<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" />
</TabList>
</Box>


+ 1
- 1
src/utils/ApiPathConst.js Visa fil

@@ -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_ListByStatus = apiPath+'/application/status-list';
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
export const POST_ADMIN_USER_REGISTER = apiPath+'/user/registry';


+ 27
- 1
src/utils/FieldUtils.js Visa fil

@@ -43,6 +43,30 @@ export const getTextField=({label, valueName, form, disabled})=>{
</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})=>{
return <Grid item lg={4}>
<Grid container alignItems={"center"}>
@@ -155,11 +179,12 @@ export const getComboField=({label,dataList, valueName, form, disabled, getOptio
</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]);

return <TextField
fullWidth
multiline={multiline}
id={valueName}
name={valueName}
type={type}
@@ -176,5 +201,6 @@ export const initField=({type, valueName, form, disabled, placeholder, inputProp
background: "#f8f8f8",
},
}}
{...props}
/>
}

+ 58
- 23
src/utils/HttpUtils.js Visa fil

@@ -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}) =>{
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
});
};




Laddar…
Avbryt
Spara