| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: '必填', |
| | | initVal: card.required || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: '默认值', |
| | |
| | | }, { |
| | | value: 'fixed', |
| | | text: '定宽' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: '必填', |
| | | initVal: card.required || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | getOptions = () => { |
| | | let _options = fromJS(columnTypeOptions[this.record.type]).toJS() |
| | | |
| | | let reLabel = {} |
| | | |
| | | if (['number', 'text'].includes(this.record.type) && this.record.editable === 'true') { |
| | | _options.push('ctrlField') |
| | | if (this.record.ctrlField) { |
| | |
| | | } else { |
| | | _options.push('required', 'enter') |
| | | } |
| | | |
| | | reLabel.required = '必填' |
| | | } else if (this.record.type === 'number') { |
| | | _options.push('max', 'min', 'enter', 'clearField') |
| | | _options.push('max', 'min', 'required', 'enter', 'clearField') |
| | | |
| | | reLabel.required = '不等于0' |
| | | } |
| | | } else if (this.record.type === 'extend') { |
| | | if (this.record.colUnit === 'day') { |
| | |
| | | } |
| | | } |
| | | |
| | | return _options |
| | | return {options: _options, reLabel} |
| | | } |
| | | |
| | | editColumn = (column) => { |
| | |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | formlist: formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | if (item.key === 'formula') { |
| | | item.fields = this.props.fields.map(col => col.field) |
| | |
| | | this.record.IsSort = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | let _field = '' |
| | | if (value === 'formula') { |
| | |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | this.record.type = values.type |
| | | |
| | | if (values.type !== _type) { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (key === 'editType') { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort', 'textFormat'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | |
| | | if (config.noValue === 'hide' && !value) { |
| | | value = 0 |
| | | } |
| | | |
| | | if (config.required === 'true' && !value) { |
| | | err = `${config.label}不可为${config.noValue === 'hide' ? '空' : '0'}` |
| | | } else { |
| | | if (typeof(config.max) === 'number' && value > config.max) { |
| | | err = config.label + '最大为' + config.max |
| | |
| | | } else if (col.type === 'number') { |
| | | let val = record[col.field] |
| | | |
| | | if (col.noValue === 'hide' && !val) { |
| | | if (col.required === 'true' && !val) { |
| | | err = `${col.label}不可为${col.noValue === 'hide' ? '空' : '0'}` |
| | | } else if (col.noValue === 'hide' && !val) { |
| | | if (col.clearField && checkForms.includes(col.clearField) && !record[col.clearField]) { |
| | | err = `请填写 ${col.label} 或 ${col.clearName}` |
| | | } |
| | |
| | | item[col.field] = val |
| | | } else if (col.type === 'number') { |
| | | let val = item[col.field] |
| | | if (col.noValue === 'hide' && !val) { |
| | | if (col.required === 'true' && !val) { |
| | | err = `${col.label}不可为${col.noValue === 'hide' ? '空' : '0'}` |
| | | } else if (col.noValue === 'hide' && !val) { |
| | | if (col.clearField && checkForms.includes(col.clearField) && !item[col.clearField]) { |
| | | let msg = `请填写 ${col.label} 或 ${col.clearName}` |
| | | if (!line.includes(msg)) { |
| | |
| | | message: item.label + '不可为空!' |
| | | }] |
| | | |
| | | if (typeof(item.min) === 'number' || typeof(item.max) === 'number') { |
| | | if (typeof(item.min) === 'number' || typeof(item.max) === 'number' || item.notZero === 'true') { |
| | | item.rules.push({ |
| | | validator: (rule, value, callback) => { |
| | | if (isNaN(value)) { |
| | | callback() |
| | | } else if (item.notZero === 'true' && value === 0) { |
| | | callback(item.label + '不可为0') |
| | | } else if (typeof(item.min) === 'number' && value < item.min) { |
| | | if (item.min < 1e-6) { |
| | | if (item.min === 1e-6) { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'notZero', |
| | | label: "不可为0", |
| | | initVal: card.notZero || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'database', |
| | | label: '数据库', |
| | | initVal: card.database || 'local', |
| | |
| | | |
| | | const modalTypeOptions = { |
| | | text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType', 'constant', 'mkfocus'], |
| | | number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom', 'mkfocus', 'format'], |
| | | number: ['initval', 'readonly', 'notZero', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom', 'mkfocus', 'format'], |
| | | select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], |
| | | checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'], |
| | | radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'], |