Kaynağa Gözat

update

master
cyril.tsui 1 yıl önce
ebeveyn
işleme
79350d054e
2 değiştirilmiş dosya ile 27 ekleme ve 15 silme
  1. +27
    -12
      src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js
  2. +0
    -3
      src/pages/PublicNotice/Search_GLD/SearchForm.js

+ 27
- 12
src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js Dosyayı Görüntüle

@@ -16,14 +16,15 @@ import * as DateUtils from "utils/DateUtils";
const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => {

const [type, setType] = React.useState([]);
const [status, setStatus] = React.useState({ key: 0, label: '全部', type: 'all' });
const [status, setStatus] = React.useState([{ key: 0, label: 'All', labelCht: "全部", type: 'all' }]);

const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom);
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);
const [selectedLabelsString, setSelectedLabelsString] = React.useState('');

const { reset, register, handleSubmit } = useForm()
const onSubmit = (data) => {
data.status = selectedLabelsString
let typeArray = [];

for (let i = 0; i < type.length; i++) {
@@ -35,14 +36,14 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => {
dateFrom: data.dateFrom,
dateTo: data.dateTo,
contact: data.contact,
status: (status?.type&&status?.type!= 'all')?status?.type:"",
status: (data.status === "" || data.status.includes('all')) ? "" : data.status,
};
applySearch(temp);
};

function resetForm() {
setType([]);
setStatus({ key: 0, label: '全部', type: 'all' });
setStatus({ key: 0, label: 'All', labelCht: "全部", type: 'all' });
reset();
}

@@ -125,31 +126,45 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => {

<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
<Autocomplete
multiple
{...register("status")}
disablePortal
id="status"
filterOptions={(options)=>options}
// filterOptions={(options)=>options}
options={
localStorage.getItem('userData').creditor?
ComboData.publicNoticeStatic_Creditor:
ComboData.publicNoticeStatic
}
values={status}
inputValue={status?.labelCht}
// inputValue={status?.labelCht}
getOptionLabel={(option)=>option.labelCht}
onChange={(event, newValue) => {
if (newValue !== null) {
setStatus(newValue);
console.log(newValue)
const findAllIndex = newValue.findIndex((ele) => {
return ele.type === "all"
})

if (findAllIndex > -1) {
setStatus([newValue[findAllIndex]]);
setSelectedLabelsString('all')
} else {
const selectedLabels = newValue.map(option => option.type);
const selectedLabelsString = `${selectedLabels.join(',')}`;
setStatus(newValue);
console.log(newValue)
setSelectedLabelsString(selectedLabelsString);
}
console.log(selectedLabelsString)
console.log(status)
}}
renderInput={(params) => (
<TextField {...params}
label="狀態"
/>
)}
InputLabelProps={{
shrink: true
}}
// InputLabelProps={{
// shrink: true
// }}
/>
</Grid>
{/*<Grid item xs={9} s={6} md={5} lg={3} sx={{ml:3, mr:3, mb:3}}>*/}


+ 0
- 3
src/pages/PublicNotice/Search_GLD/SearchForm.js Dosyayı Görüntüle

@@ -31,9 +31,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu

const { reset, register, handleSubmit } = useForm()
const onSubmit = (data) => {
console.log(selectedLabelsString)
data.status = selectedLabelsString
console.log(data.status)
let typeArray = [];

for (let i = 0; i < type.length; i++) {
@@ -194,7 +192,6 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issu
id="status"
options={ComboData.publicNoticeStatic_GLD}
value={selectedStatus}
onChange={(event, newValue) => {
const findAllIndex = newValue.findIndex((ele) => {
return ele.type === "all"


Yükleniyor…
İptal
Kaydet