user-search.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!-- 搜索表单 -->
  2. <template>
  3. <el-form
  4. label-width="77px"
  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: 5, md: 12 } : { span: 5 }">
  11. <el-form-item label="编码:">
  12. <el-input clearable v-model.trim="where.code" placeholder="请输入" />
  13. </el-form-item>
  14. </el-col>
  15. <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
  16. <el-form-item label="名称:">
  17. <el-input clearable v-model.trim="where.name" placeholder="请输入" />
  18. </el-form-item>
  19. </el-col>
  20. <!-- <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
  21. <el-form-item label="组织机构:">
  22. <auth-selection v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
  23. </el-form-item>
  24. </el-col> -->
  25. <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
  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. >
  33. 查询
  34. </el-button>
  35. <el-button @click="reset">重置</el-button>
  36. </div>
  37. </el-col>
  38. </el-row>
  39. </el-form>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. // 默认表单数据
  45. const defaultWhere = {
  46. code: '',
  47. name: ''
  48. };
  49. return {
  50. // 表单数据
  51. where: { ...defaultWhere }
  52. };
  53. },
  54. computed: {
  55. // 是否开启响应式布局
  56. styleResponsive() {
  57. return this.$store.state.theme.styleResponsive;
  58. }
  59. },
  60. methods: {
  61. /* 搜索 */
  62. search() {
  63. this.$emit('search', this.where);
  64. },
  65. /* 重置 */
  66. reset() {
  67. this.where = { ...this.defaultWhere };
  68. this.search();
  69. }
  70. }
  71. };
  72. </script>