提交 bf922ed1 authored 作者: 钟是志's avatar 钟是志

18983 职业技能竞赛选择指导老师,第一次输入工号和姓名,可以搜索到。再次搜索其它老师工号,姓名、还有根据学院搜索,有时候根本搜索不到。属于大bug,要解决。用户体验很差。

上级 c4b6843d
...@@ -375,13 +375,18 @@ export default class tableCom extends Component { ...@@ -375,13 +375,18 @@ export default class tableCom extends Component {
count = []; count = [];
handleSearch = (selectedKeys, confirm) => { handleSearch = (selectedKeys, confirm) => {
confirm(); confirm();
this.setState({searchText: selectedKeys[0]}); this.setState({searchText: selectedKeys[0]});
}; };
handleReset = clearFilters => { handleReset = clearFilters => {
clearFilters(); clearFilters();
this.setState({searchText: ''}); this.resetSearchText();
};
resetSearchText = () => {
this.setState({
searchText: '',
});
}; };
getColumnSearchProps = (dataIndex, title) => ({ getColumnSearchProps = (dataIndex, title) => ({
...@@ -445,20 +450,20 @@ export default class tableCom extends Component { ...@@ -445,20 +450,20 @@ export default class tableCom extends Component {
} }
}, },
}); });
searchJson=(value,json,level,labs)=>{ searchJson = (value, json, level, labs) => {
for(var i=0;i<json.length;i++){ for (var i = 0; i < json.length; i++) {
if(json[i].value==value[level]){ if (json[i].value == value[level]) {
labs.push(json[i].label) labs.push(json[i].label)
if(json[i].children){ if (json[i].children) {
this.searchJson(value,json[i].children,level+1,labs); this.searchJson(value, json[i].children, level + 1, labs);
} }
break; break;
} }
} }
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
const {json, mapData, obj} = props; const {json, mapData, obj} = props;
if (json == null || this.props.safe) { if (json == null || this.props.safe) {
...@@ -560,10 +565,10 @@ export default class tableCom extends Component { ...@@ -560,10 +565,10 @@ export default class tableCom extends Component {
} }
} }
dataFilter = ['Select', 'Radio', 'Checkbox','Cascader']; dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];
getData = (json, dataColumn, obj, init) => { getData = (json, dataColumn, obj, init) => {
const allValues = JSON.stringify(obj); const allValues = JSON.stringify(obj);
if (json.comName == 'TableSelect') { if (json.comName == 'TableSelect') {
const {dispatch} = this.props; const {dispatch} = this.props;
...@@ -677,9 +682,9 @@ export default class tableCom extends Component { ...@@ -677,9 +682,9 @@ export default class tableCom extends Component {
}); });
} }
} }
if (json.optionType != null && this.dataFilter.includes(json.comName)) { if (json.optionType != null && this.dataFilter.includes(json.comName)) {
switch (json.optionType) { switch (json.optionType) {
case 'reference': case 'reference':
if (dataColumn.referenceObjId != null) { if (dataColumn.referenceObjId != null) {
...@@ -714,30 +719,30 @@ export default class tableCom extends Component { ...@@ -714,30 +719,30 @@ export default class tableCom extends Component {
break; break;
case 'func': case 'func':
if (json.funcs != null && json.funcs != '') { if (json.funcs != null && json.funcs != '') {
if(json.comName=="Cascader"){ if (json.comName == "Cascader") {
try { try {
this.getFunctionValue(json.funcs, {base52: this.props.uuid}, json, () => { this.getFunctionValue(json.funcs, {base52: this.props.uuid}, json, () => {
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
let vlu = this.props.form.getFieldValue(base52); let vlu = this.props.form.getFieldValue(base52);
const labs = []; const labs = [];
this.searchJson(vlu,this.state.options,0,labs) this.searchJson(vlu, this.state.options, 0, labs)
this.setState({labels: labs}); this.setState({labels: labs});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
const vlu = obj[base52]; const vlu = obj[base52];
const labs = []; const labs = [];
this.searchJson(vlu,this.state.options,0,labs) this.searchJson(vlu, this.state.options, 0, labs)
this.setState({labels: labs}); this.setState({labels: labs});
} }
}); });
} catch (e) { } catch (e) {
message.error('公式选项配置存在问题'); message.error('公式选项配置存在问题');
} }
}else{ } else {
try { try {
this.getFunctionValue(json.funcs, {base52: this.props.uuid}, json, () => { this.getFunctionValue(json.funcs, {base52: this.props.uuid}, json, () => {
if (init != null && Object.keys(init).length > 0) { if (init != null && Object.keys(init).length > 0) {
...@@ -758,13 +763,13 @@ export default class tableCom extends Component { ...@@ -758,13 +763,13 @@ export default class tableCom extends Component {
} }
} }
} }
this.setState({labels: labs}); this.setState({labels: labs});
} else if (!this.props.isEdit && Object.keys(obj).length > 0) { } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
let base52 = dataColumn.base52; let base52 = dataColumn.base52;
const vlu = obj[base52]; const vlu = obj[base52];
const labs = []; const labs = [];
if (vlu instanceof Array) { if (vlu instanceof Array) {
for (var i = 0; i < this.state.options.length; i++) { for (var i = 0; i < this.state.options.length; i++) {
...@@ -780,18 +785,15 @@ export default class tableCom extends Component { ...@@ -780,18 +785,15 @@ export default class tableCom extends Component {
} }
} }
} }
this.setState({labels: labs}); this.setState({labels: labs});
} }
}); });
} catch (e) { } catch (e) {
message.error('公式选项配置存在问题'); message.error('公式选项配置存在问题');
} }
}
}
} }
...@@ -2087,12 +2089,12 @@ export default class tableCom extends Component { ...@@ -2087,12 +2089,12 @@ export default class tableCom extends Component {
break; break;
case 'Cascader': case 'Cascader':
cm= <span> cm = <span>
{labels != null {labels != null
? labels.join(json.spliter?json.spliter:"") ? labels.join(json.spliter ? json.spliter : "")
: ''} : ''}
</span> </span>
break; break;
case 'TableSelect': case 'TableSelect':
const ds = const ds =
obj[dataColumn.base52] && obj[dataColumn.base52].selects obj[dataColumn.base52] && obj[dataColumn.base52].selects
...@@ -2815,11 +2817,11 @@ export default class tableCom extends Component { ...@@ -2815,11 +2817,11 @@ export default class tableCom extends Component {
? json.vlds ? json.vlds
: [{required: required, message: '请选择' + dataColumn.title}], : [{required: required, message: '请选择' + dataColumn.title}],
})(<Cascader options={options} })(<Cascader options={options}
allowClear allowClear
showSearch showSearch
disabled={disabled} disabled={disabled}
placeholder={json.placeholder} placeholder={json.placeholder}
style={{width: json.width}} />); style={{width: json.width}}/>);
if ( if (
get === 'mobile' && get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) || ((json.isMobileLabel != null && json.isMobileLabel) ||
...@@ -2873,6 +2875,7 @@ export default class tableCom extends Component { ...@@ -2873,6 +2875,7 @@ export default class tableCom extends Component {
columns={this.state.columns} columns={this.state.columns}
dataSource={this.state.dataSource} dataSource={this.state.dataSource}
sqlModel={this.state.sqlModel} sqlModel={this.state.sqlModel}
resetSearchText={this.resetSearchText}
/>, />,
); );
if ( if (
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论