修复 city 某些城市不可以选中的问题 (#1046)

This commit is contained in:
liaoxuezhi 2020-11-10 12:25:26 +08:00 committed by GitHub
parent 71c17eee2e
commit 475da52706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

View File

@ -5,7 +5,7 @@ const path = require('path');
const fs = require('fs');
const package = require('./package.json');
const parserMarkdown = require('./scripts/md-parser');
fis.get('project.ignore').push('public/**', 'gh-pages/**');
fis.get('project.ignore').push('public/**', 'npm/**', 'gh-pages/**');
// 配置只编译哪些文件。
const Resource = fis.require('postpackager-loader/lib/resource.js');

View File

@ -349,13 +349,18 @@ export class TreeSelector extends React.Component<
@autobind
handleEdit(item: Option) {
const labelField = this.props.labelField;
this.setState({
isEditing: true,
isAdding: false,
editingItem: item,
inputValue: item[labelField]
});
const {bultinCUD, onEdit, labelField, options} = this.props;
if (!bultinCUD) {
onEdit?.(item);
} else {
this.setState({
isEditing: true,
isAdding: false,
editingItem: item,
inputValue: item[labelField]
});
}
}
@autobind

View File

@ -250,6 +250,9 @@ export class CityPicker extends React.Component<
if (db[cityCode]) {
state.cityCode = cityCode;
state.city = db[cityCode];
} else if (~db.city[provinceCode]?.indexOf(code)) {
state.cityCode = code;
state.city = db[code];
}
if (code % 100) {
@ -353,8 +356,7 @@ export class CityPicker extends React.Component<
{cityCode &&
allowDistrict &&
db.district[provinceCode] &&
db.district[provinceCode][cityCode] ? (
(db.district[provinceCode]?.[cityCode] as any)?.length ? (
<Select
disabled={disabled}
options={(db.district[provinceCode][cityCode] as Array<number>).map(