| | |
| | | import Utils from '@/utils/utils.js' |
| | | import SettingUtils from './utils.jsx' |
| | | import ColumnForm from './columnform' |
| | | import OtherForm from './otherform' |
| | | import DataSource from './datasource' |
| | | import CustomScript from './customscript' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | verify: {}, |
| | | debugId: '', |
| | | activeKey: 'setting', |
| | | visible: false, |
| | | line: null, |
| | | searchKey: '', |
| | | excelColumns: [ |
| | | { |
| | |
| | | editable: true, |
| | | required: false, |
| | | keyCol: true, |
| | | width: '8%', |
| | | width: '10%', |
| | | render: (text) => { |
| | | if (text === 'image') { |
| | | return '图片' |
| | |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | { |
| | | title: '取绝对值', |
| | | dataIndex: 'abs', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | keyVals: ['number'], |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.type !== 'number') return '' |
| | | // { |
| | | // title: '取绝对值', |
| | | // dataIndex: 'abs', |
| | | // inputType: 'radio', |
| | | // editable: true, |
| | | // required: false, |
| | | // keyVals: ['number'], |
| | | // width: '10%', |
| | | // render: (text, record) => { |
| | | // if (record.type !== 'number') return '' |
| | | |
| | | if (text === 'true') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | }, |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | { |
| | | title: '0值导出', |
| | | dataIndex: 'noValue', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | keyVals: ['number'], |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.type !== 'number') return '' |
| | | // if (text === 'true') { |
| | | // return '是' |
| | | // } else { |
| | | // return '否' |
| | | // } |
| | | // }, |
| | | // options: [ |
| | | // {value: 'true', text: '是'}, |
| | | // {value: 'false', text: '否'} |
| | | // ] |
| | | // }, |
| | | // { |
| | | // title: '0值导出', |
| | | // dataIndex: 'noValue', |
| | | // inputType: 'radio', |
| | | // editable: true, |
| | | // required: false, |
| | | // keyVals: ['number'], |
| | | // width: '10%', |
| | | // render: (text, record) => { |
| | | // if (record.type !== 'number') return '' |
| | | |
| | | if (text !== 'false') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | }, |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | // if (text !== 'false') { |
| | | // return '是' |
| | | // } else { |
| | | // return '否' |
| | | // } |
| | | // }, |
| | | // options: [ |
| | | // {value: 'true', text: '是'}, |
| | | // {value: 'false', text: '否'} |
| | | // ] |
| | | // }, |
| | | { |
| | | title: '小数位', |
| | | dataIndex: 'decimal', |
| | |
| | | keyVals: ['number'], |
| | | width: '12%', |
| | | render: (text, record) => record.type === 'number' ? text : '' |
| | | } |
| | | }, |
| | | { |
| | | title: '其他', |
| | | dataIndex: 'other', |
| | | required: false, |
| | | width: '18%', |
| | | render: (_, record) => { |
| | | if (record.type === 'number') { |
| | | let val = '' |
| | | |
| | | if (record.abs === 'true') { |
| | | val += '取绝对值;' |
| | | } |
| | | if (record.noValue === 'false') { |
| | | val += '0值不导出;' |
| | | } |
| | | if (record.format) { |
| | | if (record.format === 'thdSeparator') { |
| | | val += '格式化:千分位;' |
| | | } else if (record.format === 'thdSepPm') { |
| | | val += '格式化:千分位(负值红色);' |
| | | } else if (record.format === 'percent') { |
| | | val += '格式化:百分比;' |
| | | } |
| | | } |
| | | |
| | | return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div> |
| | | } else if (record.type === 'text') { |
| | | let val = '' |
| | | |
| | | if (record.wrapText === 'true') { |
| | | val += '自动换行;' |
| | | } |
| | | if (record.noValue === 'false') { |
| | | val += '空值不导出;' |
| | | } |
| | | if (record.textFormat) { |
| | | if (record.textFormat === 'YYYY-MM-DD') { |
| | | val += '格式化:YYYY-MM-DD;' |
| | | } else if (record.textFormat === 'YYYY-MM-DD HH:mm:ss') { |
| | | val += '格式化:YYYY-MM-DD HH:mm:ss;' |
| | | } |
| | | } |
| | | |
| | | return <div>{val}<EditOutlined className="edit-other" onClick={() => {this.setState({visible: true, line: fromJS(record).toJS()})}} /></div> |
| | | } |
| | | |
| | | return '' |
| | | } |
| | | }, |
| | | ], |
| | | scriptsColumns: [ |
| | | { |
| | |
| | | col.type = 'text' |
| | | } |
| | | } |
| | | if (col.type === 'text' && col.format) { |
| | | delete col.format |
| | | } else if (col.type === 'number' && col.textFormat) { |
| | | delete col.textFormat |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | // if (columns[0] && !['image', 'text', 'number'].includes(columns[0].type)) { |
| | | // columns = columns.map(col => { |
| | | // let _cell = { |
| | | // uuid: Utils.getuuid(), |
| | | // Column: col.Column, |
| | | // Text: col.Text, |
| | | // Width: 20, |
| | | // abs: 'false', |
| | | // output: col.output || 'true', |
| | | // required: col.required || 'false', |
| | | // type: 'text', |
| | | // } |
| | | |
| | | // return _cell |
| | | // }) |
| | | // } |
| | | |
| | | this.setState({verify: {...verify, columns}}) |
| | | } |
| | | |
| | | lineSubmit = () => { |
| | | const { line, verify } = this.state |
| | | |
| | | let columns = verify.columns.map(col => { |
| | | if (col.uuid === line.uuid) { |
| | | return line |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | |
| | | this.setState({verify: {...verify, columns}, line: null, visible: false}) |
| | | } |
| | | |
| | | // 标签切换 |
| | |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey } = this.state |
| | | const { verify, excelColumns, scriptsColumns, activeKey, loading, searches, searchKey, visible, line } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | <Button className="excel-col-add mk-red" title="清空Excel列" onClick={this.clearField}> |
| | | 清空Excel列 |
| | | </Button> |
| | | <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;数值类型导出时可取绝对值以及设置小数位;导出为否时,不使用行信息;红色标题导出时列头文字为红色。</div> |
| | | <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;导出为否时,不使用行信息(文本为空,数值为0);红色标题导出时列头文字为红色。</div> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" searchKey={searchKey} wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> |
| | | </TabPane> |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | <Modal |
| | | title="" |
| | | visible={visible} |
| | | width={1000} |
| | | maskClosable={false} |
| | | closable={false} |
| | | onOk={this.lineSubmit} |
| | | onCancel={() => {this.setState({visible: false, line: null})}} |
| | | destroyOnClose |
| | | > |
| | | <OtherForm line={line} onChange={(values) => this.setState({line: values})}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |