issue/pr各下拉列表增加搜索功能

This commit is contained in:
caishi 2022-04-26 17:48:21 +08:00
parent b59409e2fc
commit 4cd25cffc7
5 changed files with 95 additions and 6 deletions

View File

@ -338,6 +338,28 @@ class CreateMerge extends Component {
return <div dangerouslySetInnerHTML={{ __html: html }}></div>;
};
// 源分支-分支搜索
changePullValue=(value,cate)=>{
const branchParams = getBranchParams(this.props.location.pathname);
const { pullOwner , projectId } = branchParams;
const url = `/${pullOwner}/${projectId}/pulls/new.json`;
axios.get(url,{
params:{branch_name:value || undefined}
}).then(result=>{
if(result){
if(cate === "pull"){
this.setState({
pullBranch:result.data.branches
})
}else{
this.setState({
mergeBranch:result.data.branches
})
}
}
}).catch(error=>{})
}
render() {
const {
data,
@ -380,6 +402,7 @@ class CreateMerge extends Component {
className="merge-flex1 flex1 matchwidth"
dropdownMatchSelectWidth={false}
dropdownClassName="overlihide"
onSearch={(e)=>this.changePullValue(e,"pull")}
>
{this.renderBrances(pullBranches)}
</Select>
@ -408,6 +431,7 @@ class CreateMerge extends Component {
className="merge-flex1 flex1 matchwidth"
dropdownMatchSelectWidth={false}
dropdownClassName="overlihide"
onSearch={(e)=>this.changePullValue(e,"merge")}
>
{this.renderBrances(mergeBranches)}
</Select>

View File

@ -226,4 +226,7 @@ form .ant-cascader-picker, form .ant-select {
/* 距离底部加大 @列表被遮挡 */
.updateMerge{
margin: 30px auto 60px;
}
.searchIcon .ant-select-arrow{
margin-top:-9px
}

View File

@ -315,7 +315,16 @@ class MergeForm extends Component {
{getFieldDecorator("assigned_to_id", {
initialValue: assigned_to_id,
})(
<Select placeholder="未选择审查人员" showSearch>
<Select
placeholder="未选择审查人员"
showSearch
className="searchIcon"
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option key={0} value={""}>未选择审查人员</Option>
{this.renderSelect(members)}
</Select>
@ -330,6 +339,12 @@ class MergeForm extends Component {
issue_versions && issue_versions.length > 0? "未选择里程碑": "请添加里程碑"
}
showSearch
className="searchIcon"
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option key={0} value={""}>{issue_versions && issue_versions.length > 0? "未选择里程碑": "请添加里程碑"}</Option>
{this.renderSelect(issue_versions)}
@ -345,6 +360,12 @@ class MergeForm extends Component {
issue_tags && issue_tags.length > 0 ? "未选择标记" : "请在仓库设置里添加标记"
}
showSearch
className="searchIcon"
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option key={0} value={""}>{issue_tags && issue_tags.length > 0 ? "未选择标记" : "请在仓库设置里添加标记"}</Option>
{this.renderSelect(issue_tags)}

View File

@ -710,4 +710,8 @@ a.issue-type-button.active:hover {
.boder-4{border-radius: 4px;}
.pbt20{padding: 20px 0;}
.inline-block{display: inline-block;}
.pd10{padding: 10px;}
.pd10{padding: 10px;}
.searchIcon .ant-select-arrow{
margin-top:-9px
}

View File

@ -437,7 +437,17 @@ class order_form extends Component {
<div className="pd20 background-f issue-form-right">
<Form.Item label="指派成员">
{getFieldDecorator("assigned_to_id", {rules: []})(
<Select>
<Select
showSearch
className="searchIcon"
showArrow={true}
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0
}
placeholder="搜索成员"
>
<Option value={""}>未指派成员</Option>
{this.renderSelect(
issue_chosen && issue_chosen.assign_user
@ -485,7 +495,16 @@ class order_form extends Component {
<Form.Item label="里程碑">
{getFieldDecorator("fixed_version_id", {rules: []})(
<Select>
<Select
showSearch
className="searchIcon"
showArrow={true}
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value={""}>
{issue_chosen && issue_chosen.issue_version.length > 0
? "未选择里程碑"
@ -499,7 +518,16 @@ class order_form extends Component {
</Form.Item>
<Form.Item label="标记">
{getFieldDecorator("issue_tag_ids", {rules: []})(
<Select>
<Select
showSearch
className="searchIcon"
showArrow={true}
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value={""}>
{issue_chosen && issue_chosen.issue_tag.length > 0
? "未选择标记"
@ -537,7 +565,16 @@ class order_form extends Component {
{getFieldDecorator("branch_name", {
rules: []
})(
<Select>
<Select
showSearch
className="searchIcon"
showArrow={true}
suffixIcon={<i className="iconfont icon-sousuo1"></i>}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
<Option value={""}>分支未指定</Option>
{branches && branches.length > 0 && branches.map((item, key) => {
return (