| | |
| | | } |
| | | |
| | | state = { |
| | | dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | searchlist: null, // 搜索条件集 |
| | | sqlVerifing: false, // sql验证中 |
| | | visible: false, // 模态框控制 |
| | |
| | | this.setState({searchlist: [...searchlist, nextProps.pasteContent]}) |
| | | this.handleSearch(nextProps.pasteContent) |
| | | } else if (!is(fromJS(nextProps.config.search), fromJS(this.props.config.search)) && !is(fromJS(nextProps.config.search), fromJS(searchlist))) { |
| | | this.setState({searchlist: nextProps.config.search}) |
| | | this.setState({searchlist: fromJS(nextProps.config.search).toJS()}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({searchlist: list}) |
| | | this.handleSearch(card) |
| | | } else { |
| | | this.setState({searchlist: list}) |
| | | this.props.updatesearch({...config, search: list}) |
| | | this.setState({searchlist: list}, ()=> { |
| | | this.props.updatesearch({...config, search: list}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | * @description 搜索条件编辑,获取搜索条件表单信息 |
| | | */ |
| | | handleSearch = (card) => { |
| | | const { searchlist } = this.state |
| | | let linkableFields = [] |
| | | |
| | | searchlist.forEach(item => { |
| | | if (item.uuid !== card.uuid && (item.type === 'select' || item.type === 'link')) { |
| | | linkableFields.push({ |
| | | value: item.field, |
| | | text: item.label |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getSearchForm(card, this.props.sysRoles) |
| | | formlist: getSearchForm(card, this.props.sysRoles, linkableFields) |
| | | }) |
| | | } |
| | | |
| | |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | sqlVerifing: false, |
| | | searchlist: _searchlist, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | }) |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | |
| | | this.setState({ |
| | | searchlist: _searchlist, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | }) |
| | | this.props.updatesearch({...config, search: _searchlist}, optionLibs) |
| | | } |
| | | }) |
| | | } |
| | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, searchlist, visible, sqlVerifing, card } = this.state |
| | | |