| | |
| | | }) |
| | | |
| | | Object.keys(values).forEach(key => { |
| | | let _value = '' |
| | | if (this.state.datatype[key] === 'datetime') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'datemonth') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'date') { |
| | | let _value = '' |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD') |
| | | } |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | } else if (this.state.datatype[key] === 'number') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } else if (this.state.datatype[key] === 'multiselect') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] ? values[key].join(',') : '' |
| | | }) |
| | | _value = values[key] ? values[key].join(',') : '' |
| | | |
| | | } else if (this.state.datatype[key] === 'fileupload') { |
| | | let vals = [] |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: vals.join(',') |
| | | }) |
| | | _value = vals.join(',') |
| | | } else if (this.state.datatype[key] === 'text') { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | }) |
| | | _value = values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '') |
| | | |
| | | } else { |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: values[key] |
| | | }) |
| | | _value = values[key] |
| | | |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | | }) |
| | | }) |
| | | |
| | | resolve(search) |