SearchForm.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div>
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline">
  5. <a-row :gutter="48">
  6. <a-col :md="8" :sm="24">
  7. <a-form-item label="code">
  8. <a-input v-model="queryParam.code" placeholder="请输入code"/>
  9. </a-form-item>
  10. </a-col>
  11. <a-col :md="8" :sm="24">
  12. <a-form-item label="社交内容">
  13. <a-input v-model="queryParam.content" placeholder="请输入社交内容"/>
  14. </a-form-item>
  15. </a-col>
  16. <template v-if="advanced">
  17. <a-col :md="8" :sm="24">
  18. <a-form-item label="展示类型">
  19. <a-select v-model="queryParam.showType" placeholder="请选择" default-value="0">
  20. <a-select-option value="1">图片</a-select-option>
  21. <a-select-option value="2">文本信息</a-select-option>
  22. <a-select-option value="3">跳转链接</a-select-option>
  23. </a-select>
  24. </a-form-item>
  25. </a-col>
  26. </template>
  27. <a-col :md="!advanced && 8 || 24" :sm="24">
  28. <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
  29. <a-button type="primary" @click="handlerSearch">查询</a-button>
  30. <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
  31. <a @click="toggleAdvanced" style="margin-left: 8px">
  32. {{ advanced ? '收起' : '展开' }}
  33. <a-icon :type="advanced ? 'up' : 'down'"/>
  34. </a>
  35. </span>
  36. </a-col>
  37. </a-row>
  38. </a-form>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. name: 'SearchForm',
  45. props: {},
  46. components: {},
  47. data () {
  48. return {
  49. // 高级搜索 展开/关闭
  50. advanced: false,
  51. // 查询参数
  52. queryParam: {}
  53. }
  54. },
  55. methods: {
  56. handlerSearch () {
  57. console.log(this.queryParam)
  58. this.$emit('reloadData', this.queryParam)
  59. },
  60. toggleAdvanced () {
  61. this.advanced = !this.advanced
  62. },
  63. resetSearchForm () {
  64. this.queryParam = {}
  65. }
  66. },
  67. mounted () {}
  68. }
  69. </script>
  70. <style scoped>
  71. </style>