user-search.vue 2.0 KB

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