| | |
| | | if (Array.isArray(res.mk_ex_data) && res.mk_ex_data.length > 0) { |
| | | let pices = res.mk_ex_data.map(item => { |
| | | item.$pice = true |
| | | item.$record = record |
| | | item.$record = {...record} |
| | | |
| | | if (item.hasOwnProperty('mk_api_key')) { |
| | | item.$record.mk_api_key = item.mk_api_key || record.mk_api_key || '' |
| | | |
| | | delete item.mk_api_key |
| | | } |
| | | return item |
| | | }) |
| | | params = [...pices, ...params] |
| | |
| | | if (newval === '$empty' && item.initval) { |
| | | newval = moment().subtract(item.initval, 'days').format(_format) |
| | | } |
| | | |
| | | if (item.minDate) { |
| | | if (item.minDate === 'custom') { |
| | | if (/^\d{4}-\d{2}-\d{2}$/.test(item.minDateField)) { |
| | | item.minDate = moment(item.minDateField).format('YYYY-MM-DD') |
| | | } else { |
| | | let val = data[item.minDateField.toLowerCase()] |
| | | item.minDate = val ? moment(val).format('YYYY-MM-DD') : '' |
| | | } |
| | | |
| | | item.minDate = item.minDate === 'Invalid date' ? '' : item.minDate |
| | | } else { |
| | | item.minDate = moment().add(item.minDate, 'days').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | if (item.maxDate) { |
| | | if (item.maxDate === 'custom') { |
| | | if (/^\d{4}-\d{2}-\d{2}$/.test(item.maxDateField)) { |
| | | item.maxDate = moment(item.maxDateField).format('YYYY-MM-DD') |
| | | } else { |
| | | let val = data[item.maxDateField.toLowerCase()] |
| | | item.maxDate = val ? moment(val).format('YYYY-MM-DD') : '' |
| | | } |
| | | |
| | | item.maxDate = item.maxDate === 'Invalid date' ? '' : item.maxDate |
| | | } else { |
| | | item.maxDate = moment().add(item.maxDate, 'days').format('YYYY-MM-DD') |
| | | } |
| | | } |
| | | } else if (item.type === 'datemonth') { |
| | | if (newval !== '$empty') { |
| | | newval = moment(newval, 'YYYY-MM').format('YYYY-MM') |
| | |
| | | |
| | | this.state = { |
| | | value, |
| | | minDate: config.minDate ? moment().add(config.minDate, 'days').startOf('day') : '', |
| | | maxDate: config.maxDate ? moment().add(config.maxDate, 'days').endOf('day') : '', |
| | | minDate: config.minDate ? moment(config.minDate).startOf('day') : '', |
| | | maxDate: config.maxDate ? moment(config.maxDate).endOf('day') : '', |
| | | mode, |
| | | format |
| | | } |
| | |
| | | val = val + ':00' |
| | | } |
| | | } |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) { |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | } |
| | | } |
| | | |
| | | if (item.type === 'group') { |
| | |
| | | val = val + ':00' |
| | | } |
| | | } |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) { |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | } |
| | | } |
| | | }) |
| | | this.setState({advanceValues}) |
| | |
| | | val = val + ':00' |
| | | } |
| | | } |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) { |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | } |
| | | } |
| | | |
| | | return item |
| | |
| | | val = val + ':00' |
| | | } |
| | | } |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | if (['text', 'date', 'datemonth', 'dateweek', 'daterange'].includes(item.type)) { |
| | | advanceValues.push({field: item.field, type: item.type, label: item.label, value: val}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | |
| | | }, { |
| | | value: '-90', |
| | | text: '前90天' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'minDateField', |
| | | label: '最小值(字段)', |
| | | initVal: card.minDateField || '', |
| | | tooltip: '最小值对应字段,也可自定义固定值,格式为YYYY-MM-DD。', |
| | | required: true, |
| | | readonly: false, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | }, { |
| | | value: '-90', |
| | | text: '前90天' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'maxDateField', |
| | | label: '最大值(字段)', |
| | | initVal: card.maxDateField || '', |
| | | tooltip: '最大值对应字段,也可自定义固定值,格式为YYYY-MM-DD。', |
| | | required: true, |
| | | readonly: false, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'precision', |
| | | label: '精确度', |
| | |
| | | check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], |
| | | date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], |
| | | datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'place', 'marginTop', 'marginBottom'], |
| | | datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], |
| | | // datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], |
| | | textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'place', 'count', 'placeholder', 'marginTop', 'marginBottom'], |
| | | cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'marginTop', 'marginBottom', 'separator'], |
| | | color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'colorType', 'extra', 'marginTop', 'marginBottom'], |
| | |
| | | } |
| | | } else { |
| | | shows.push('fieldlength', 'checkAll') |
| | | reTooltip.initval = '添加多个初始值请使用逗号分隔。' |
| | | reTooltip.initval = '添加多个初始值请使用逗号分隔。' |
| | | } |
| | | |
| | | shows.push('linkField') |
| | |
| | | if (this.record.readonly === 'true' && this.record.hidden !== 'true') { |
| | | shows.push('unchecked') |
| | | } |
| | | } else if (['date', 'datemonth', 'datetime'].includes(type)) { |
| | | } else if (['date', 'datemonth'].includes(type)) { |
| | | reOptions.initval = dateOptions[type] |
| | | reTypes.initval = 'select' |
| | | if (type === 'date') { |
| | | if (this.record.minDate === 'custom') { |
| | | shows.push('minDateField') |
| | | } |
| | | if (this.record.maxDate === 'custom') { |
| | | shows.push('maxDateField') |
| | | } |
| | | } |
| | | } else if (type === 'switch' || type === 'check') { |
| | | reOptions.initval = [ |
| | | {value: true, text: '开'}, |
| | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | | |
| | | complete = (key, option) => { |
| | | complete = (option) => { |
| | | let label = option.props.label |
| | | |
| | | this.props.form.setFieldsValue({label: label}) |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.key === 'field' && item.options && item.options.length > 0) { |
| | | if (['field', 'minDateField', 'maxDateField'].includes(item.key) && item.options && item.options.length > 0) { |
| | | content = <AutoComplete |
| | | dataSource={item.options.map((cell) => <AutoComplete.Option label={cell.label} value={cell.field} key={cell.uuid}> |
| | | {cell.field} |
| | | </AutoComplete.Option>)} |
| | | filterOption={(input, option) => option.props.children.indexOf(input) > -1} |
| | | onSelect={this.complete} |
| | | onSelect={(val, option) => item.key === 'field' && this.complete(option)} |
| | | placeholder="" |
| | | > |
| | | <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |