| | |
| | | config.dataSource = config.dataSource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | config.dataSource = config.dataSource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | config.dataSource = config.dataSource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | config.dataSource = config.dataSource.replace(/@lang@/ig, `'${sessionStorage.getItem('lang')}'`) |
| | | |
| | | if (/\s/.test(config.dataSource)) { // 拼接别名 |
| | | config.dataSource = '(' + config.dataSource + ') tb' |
| | |
| | | dataIndex: col.field, |
| | | title: col.label, |
| | | sorter: col.IsSort === 'true', |
| | | width: 120 |
| | | width: col.Width || 120 |
| | | }) |
| | | }) |
| | | |
| | |
| | | options: [], |
| | | columns, |
| | | value, |
| | | showValue: config.showValue, |
| | | placeholder, |
| | | arr_field: arrfield.join(','), |
| | | searchKey: '', |
| | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | exec_type: 'y', |
| | | exec_type: window.GLOB.execType || 'y', |
| | | arr_field: arr_field, |
| | | default_sql: 'true', |
| | | custom_script: '', |
| | |
| | | DateCount && console.info(`/*${config.label} 总数查询*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(sql) |
| | | param.DateCount = Utils.formatOptions(DateCount) |
| | | param.LText = Utils.formatOptions(sql, param.exec_type) |
| | | param.DateCount = Utils.formatOptions(DateCount, param.exec_type) |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | |
| | | |
| | | return item |
| | | }) |
| | | |
| | | let showValue = this.state.showValue |
| | | |
| | | if (showValue) { |
| | | if (options.findIndex(item => this.state.value === item.$$uuid) > -1) { |
| | | showValue = '' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showValue, |
| | | options: options, |
| | | total: result.total || 0, |
| | | loading: false |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.linkFields) { |
| | | config.linkFields.forEach((m, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFP', m.uuid, val, 0) |
| | | }, (i + 1) * 100) |
| | | }) |
| | | } |
| | | |
| | | this.props.onChange(val, other) |
| | | this.setState({value: val}, () => { |
| | | this.setState({value: val, showValue: ''}, () => { |
| | | if (config.enter === 'tab') { |
| | | MKEmitter.emit('mkFC', 'focus', config.tabUuid) |
| | | } else if (config.enter === 'sub') { |
| | | config.tabUuid && MKEmitter.emit('mkFC', 'focus', config.tabUuid) |
| | | if (config.subFields) { |
| | | setTimeout(() => { |
| | | this.props.onSubmit() |
| | | this.props.onSubmit(config.tabUuid) |
| | | }, 1000) |
| | | } else { |
| | | this.props.onSubmit() |
| | | this.props.onSubmit(config.tabUuid) |
| | | } |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { value, config, options, visible, loading, total, pageIndex, pageSize, columns, placeholder } = this.state |
| | | const { value, showValue, config, options, visible, loading, total, pageIndex, pageSize, columns, placeholder, searchKey } = this.state |
| | | |
| | | return <> |
| | | <Select |
| | | className="mk-pop-select" |
| | | showSearch={!!config.searchKey} |
| | | allowClear |
| | | value={value} |
| | | value={showValue || value} |
| | | onSearch={(val) => val && this.searchOption(val)} |
| | | filterOption={false} |
| | | onChange={(val) => this.selectChange(val === undefined ? '' : val)} |
| | |
| | | onCancel={() => this.setState({visible: false})} |
| | | destroyOnClose |
| | | > |
| | | {config.searchKey ? <Search placeholder={placeholder} onSearch={this.searchOption} enterButton /> : null} |
| | | {config.searchKey ? <Search placeholder={placeholder} defaultValue={searchKey} onSearch={this.searchOption} enterButton /> : null} |
| | | <Table |
| | | rowKey="$$uuid" |
| | | bordered={true} |
| | |
| | | dataSource={options} |
| | | loading={loading} |
| | | onRow={(record) => { |
| | | let className = '' |
| | | |
| | | if (record.$disabled) { |
| | | className = ' mk-disable-line ' |
| | | } else if (value === record.$$uuid) { |
| | | className = ' ant-table-row-selected ' |
| | | } |
| | | |
| | | return { |
| | | className: value === record.$$uuid ? ' ant-table-row-selected ' : '', |
| | | className: className, |
| | | onClick: () => {this.changeRow(record)}, |
| | | } |
| | | }} |