Jason Chuang hace 1 mes
padre
commit
bdfa2a2a5e
Se han modificado 5 ficheros con 11442 adiciones y 18598 borrados
  1. +11398
    -18588
      package-lock.json
  2. +6
    -1
      src/pages/GFMIS/SearchForm.js
  3. +28
    -1
      src/pages/Payment/Search_GLD/SearchForm.js
  4. +5
    -4
      src/utils/ComboData.js
  5. +5
    -4
      src/utils/HttpUtils.js

+ 11398
- 18588
package-lock.json
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 6
- 1
src/pages/GFMIS/SearchForm.js Ver fichero

@@ -46,6 +46,11 @@ const SearchPublicNoticeForm = ({ applySearch, generateXML, searchCriteria, onGr
setToDateValue(maxDate);
}, [maxDate]);

const toPayMethodArray = (opt) => {
if (!opt || opt.type === 'all') return [];
return Array.isArray(opt.type) ? opt.type : [opt.type];
};

const onSubmit = () => {
let sentDateFrom = "";
let sentDateTo = "";
@@ -63,7 +68,7 @@ const SearchPublicNoticeForm = ({ applySearch, generateXML, searchCriteria, onGr
dateFrom: sentDateFrom,
dateTo: sentDateTo,
paymentId: selectedIds.join(','),
payMethod : (payMethod?.type && payMethod?.type != 'all') ? payMethod?.type : "",
payMethod : toPayMethodArray(payMethod),
// status : (status?.type && status?.type != 'all') ? status?.type : "",
};
applySearch(temp);


+ 28
- 1
src/pages/Payment/Search_GLD/SearchForm.js Ver fichero

@@ -44,6 +44,26 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) =>
}
}, [searchCriteria]);

React.useEffect(() => {
const defaultPayMethod = ComboData.payMethod[0];
const value = searchCriteria?.payMethod; // may be [], null, undefined, or array of strings

if (!value || value.length === 0) {
setPayMethod(defaultPayMethod);
return;
}

// Find the matching entry whose type array matches value contents
const found = ComboData.payMethod.find(item =>
Array.isArray(item.type) &&
item.type.length === value.length &&
item.type.every((v, i) => v === value[i]) // strict positional match
);

setPayMethod(found ?? defaultPayMethod);
}, [searchCriteria?.payMethod]);


React.useEffect(() => {
setFromDateValue(minDate);
}, [minDate]);
@@ -52,6 +72,13 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) =>
setToDateValue(maxDate);
}, [maxDate]);

// add near the top inside the component (after useState for payMethod)
const toPayMethodArray = (opt) => {
if (!opt || opt.type === 'all') return [];
return Array.isArray(opt.type) ? opt.type : [opt.type];
};


const onSubmit = (data) => {
let sentDateFrom = "";
let sentDateTo = "";
@@ -67,7 +94,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) =>
dateFrom: sentDateFrom,
dateTo: sentDateTo,
status : (status?.type && status?.type != 'all') ? status?.type : "",
payMethod : (payMethod?.type && payMethod?.type != 'all') ? payMethod?.type : "",
payMethod : toPayMethodArray(payMethod),
start:0,
limit:10
};


+ 5
- 4
src/utils/ComboData.js Ver fichero

@@ -143,10 +143,11 @@ export const paymentStatus = [

export const payMethod = [
{ key: 0, labelCht: '全部', label: 'All', type: 'all' },
{ key: 1, labelCht: '繳費靈', label: 'PPS', type: '01,PPSB,PPS' },
{ key: 2, labelCht: '信用卡', label:'Credit Card', type: '02,BCMP,CreditCard' },
{ key: 3, labelCht: '銀聯', label:'UnionPay', type: '03,BCMP,CreditCard' },
{ key: 4, labelCht: '轉數快', label:'FPS', type: '04,BCFP,FPS' },
{ key: 1, labelCht: '繳費靈', label: 'PPS', type: ['01,PPSB,PPS'] },
{ key: 2, labelCht: '信用卡', label:'Credit Card', type: ['02,BCMP,CreditCard','03,BCMP,CreditCard'] },
{ key: 3, labelCht: '轉數快', label:'FPS', type: ['04,BCFP,FPS'] },
// { key: 3, labelCht: '銀聯', label:'UnionPay', type: '03,BCMP,CreditCard' },
// { key: 4, labelCht: '轉數快', label:'FPS', type: '04,BCFP,FPS' },
];

export const paymentMeans= [


+ 5
- 4
src/utils/HttpUtils.js Ver fichero

@@ -1,13 +1,14 @@
import axios from "axios";
import { FILE_UP_POST, FILE_DOWN_GET } from "../utils/ApiPathConst";
import qs from 'qs';

export const get = ({ url, params, onSuccess, onFail, onError }) => {
axios.get(url, {
params: params
params,
paramsSerializer: (p) => qs.stringify(p, { arrayFormat: 'repeat' }) // <-- FIX
}).then(
(response) => { onResponse(response, onSuccess, onFail); }
).catch((error) => {
// console.log(error);
return handleError(error, onError);
});
};
@@ -68,9 +69,9 @@ export const postWithFiles = ({ url, params, files, onSuccess, onFail, onError }
});
};

export const fileDownload = ({ url, fileId, skey, filename, params, method, onResponse, onError }) => {
export const fileDownload = ({ url, fileId, skey, params, method, onResponse, onError }) => {
if (!url) {
url = FILE_DOWN_GET + "/" + fileId + "/" + skey + "/" + filename
url = FILE_DOWN_GET + "/" + fileId + "/" + skey
}
if (method == 'post') {
axios.post(url, params,


Cargando…
Cancelar
Guardar