2018-05-05 13:38:03 +00:00
|
|
|
|
<cn>
|
|
|
|
|
#### 高级搜索
|
|
|
|
|
三列栅格式的表单排列方式,常用于数据表格的高级搜索。
|
|
|
|
|
有部分定制的样式代码,由于输入标签长度不确定,需要根据具体情况自行调整。
|
|
|
|
|
</cn>
|
|
|
|
|
|
|
|
|
|
<us>
|
|
|
|
|
#### Advanced search
|
|
|
|
|
Three columns layout is often used for advanced searching of data table.
|
|
|
|
|
Because the width of label is not fixed, you may need to adjust it by customizing its style.
|
|
|
|
|
</us>
|
|
|
|
|
|
2018-12-07 13:27:47 +00:00
|
|
|
|
<template>
|
2019-02-01 09:23:00 +00:00
|
|
|
|
<div id="components-form-demo-advanced-search">
|
2018-12-07 13:27:47 +00:00
|
|
|
|
<a-form
|
2019-02-01 09:23:00 +00:00
|
|
|
|
class="ant-advanced-search-form"
|
2018-12-07 13:27:47 +00:00
|
|
|
|
:form="form"
|
2019-02-01 09:23:00 +00:00
|
|
|
|
@submit="handleSearch"
|
2018-12-07 13:27:47 +00:00
|
|
|
|
>
|
|
|
|
|
<a-row :gutter="24">
|
2019-02-01 09:23:00 +00:00
|
|
|
|
<a-col
|
|
|
|
|
v-for="i in 10"
|
|
|
|
|
:key="i"
|
|
|
|
|
:span="8"
|
|
|
|
|
:style="{ display: i < count ? 'block' : 'none' }"
|
|
|
|
|
>
|
2018-12-07 13:27:47 +00:00
|
|
|
|
<a-form-item :label="`Field ${i}`">
|
2019-02-01 09:23:00 +00:00
|
|
|
|
<a-input
|
|
|
|
|
v-decorator="[
|
|
|
|
|
`field-${i}`,
|
|
|
|
|
{
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: 'Input something!',
|
|
|
|
|
}],
|
|
|
|
|
}
|
|
|
|
|
]"
|
|
|
|
|
placeholder="placeholder"
|
|
|
|
|
/>
|
2018-12-07 13:27:47 +00:00
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
2019-02-01 09:23:00 +00:00
|
|
|
|
<a-row>
|
|
|
|
|
<a-col
|
|
|
|
|
:span="24"
|
|
|
|
|
:style="{ textAlign: 'right' }"
|
|
|
|
|
>
|
|
|
|
|
<a-button
|
|
|
|
|
type="primary"
|
|
|
|
|
html-type="submit"
|
|
|
|
|
>
|
|
|
|
|
Search
|
|
|
|
|
</a-button>
|
|
|
|
|
<a-button
|
|
|
|
|
:style="{ marginLeft: '8px' }"
|
|
|
|
|
@click="handleReset"
|
|
|
|
|
>
|
|
|
|
|
Clear
|
|
|
|
|
</a-button>
|
|
|
|
|
<a
|
|
|
|
|
:style="{ marginLeft: '8px', fontSize: '12px' }"
|
|
|
|
|
@click="toggle"
|
|
|
|
|
>
|
|
|
|
|
Collapse <a-icon :type="expand ? 'up' : 'down'" />
|
|
|
|
|
</a>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</a-form>
|
|
|
|
|
<div class="search-result-list">
|
|
|
|
|
Search Result List
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2018-12-07 13:27:47 +00:00
|
|
|
|
</template>
|
2018-05-05 13:38:03 +00:00
|
|
|
|
<script>
|
|
|
|
|
|
2018-12-07 13:27:47 +00:00
|
|
|
|
export default {
|
2018-05-05 13:38:03 +00:00
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
expand: false,
|
2018-12-07 13:27:47 +00:00
|
|
|
|
form: this.$form.createForm(this),
|
2019-01-12 03:33:27 +00:00
|
|
|
|
};
|
2018-05-05 13:38:03 +00:00
|
|
|
|
},
|
2018-12-07 13:27:47 +00:00
|
|
|
|
computed: {
|
|
|
|
|
count () {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
return this.expand ? 11 : 7;
|
2018-12-07 13:27:47 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2018-05-05 13:38:03 +00:00
|
|
|
|
methods: {
|
|
|
|
|
handleSearch (e) {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
e.preventDefault();
|
2018-05-05 13:38:03 +00:00
|
|
|
|
this.form.validateFields((error, values) => {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
console.log('error', error);
|
|
|
|
|
console.log('Received values of form: ', values);
|
|
|
|
|
});
|
2018-05-05 13:38:03 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleReset () {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
this.form.resetFields();
|
2018-05-05 13:38:03 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
toggle () {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
this.expand = !this.expand;
|
2018-05-05 13:38:03 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
|
};
|
2018-05-05 13:38:03 +00:00
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.ant-advanced-search-form {
|
|
|
|
|
padding: 24px;
|
|
|
|
|
background: #fbfbfb;
|
|
|
|
|
border: 1px solid #d9d9d9;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ant-advanced-search-form .ant-form-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ant-advanced-search-form .ant-form-item-control-wrapper {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#components-form-demo-advanced-search .ant-form {
|
|
|
|
|
max-width: none;
|
|
|
|
|
}
|
|
|
|
|
#components-form-demo-advanced-search .search-result-list {
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
border: 1px dashed #e9e9e9;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
min-height: 200px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
padding-top: 80px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2018-05-08 03:20:07 +00:00
|
|
|
|
|
2018-05-05 13:38:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|