material-search.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <!-- 搜索表单 -->
  2. <template>
  3. <el-form
  4. label-width="50px"
  5. class="ele-form-search"
  6. @keyup.enter.native="search"
  7. @submit.native.prevent
  8. >
  9. <el-row :gutter="15">
  10. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  11. <el-form-item label="编码:" label-width="50px">
  12. <el-input clearable v-model="where.code" placeholder="请输入" />
  13. </el-form-item>
  14. </el-col>
  15. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  16. <el-form-item label="名称:" label-width="50px">
  17. <el-input clearable v-model="where.name" placeholder="请输入" />
  18. </el-form-item>
  19. </el-col>
  20. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  21. <el-form-item label="牌号:">
  22. <el-input clearable v-model="where.modle" placeholder="请输入" />
  23. </el-form-item>
  24. </el-col>
  25. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  26. <div class="ele-form-actions">
  27. <el-button
  28. type="primary"
  29. icon="el-icon-search"
  30. class="ele-btn-icon"
  31. @click="search"
  32. size="small"
  33. >
  34. 查询
  35. </el-button>
  36. <el-button @click="reset"
  37. icon="el-icon-refresh-left"
  38. size="small"
  39. type="primary"
  40. >重置</el-button>
  41. </div>
  42. </el-col>
  43. </el-row>
  44. </el-form>
  45. </template>
  46. <script>
  47. import { login } from '@/api/login';
  48. export default {
  49. data() {
  50. // 默认表单数据
  51. const defaultWhere = {
  52. name: '',
  53. groupId: ''
  54. };
  55. return {
  56. // 表单数据
  57. where: { ...defaultWhere }
  58. };
  59. },
  60. computed: {
  61. // 是否开启响应式布局
  62. styleResponsive() {
  63. return this.$store.state.theme.styleResponsive;
  64. }
  65. },
  66. methods: {
  67. /* 搜索 */
  68. search() {
  69. console.log(this.where);
  70. this.$emit('search', this.where);
  71. },
  72. /* 重置 */
  73. reset() {
  74. this.where = { ...this.defaultWhere };
  75. this.search();
  76. }
  77. }
  78. };
  79. </script>