user-search.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: 6, md: 12 } : { span: 6 }">
  11. <el-form-item label="质检名称:">
  12. <el-input clearable v-model="where.name" 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="组织机构:">
  17. <auth-selection
  18. data-type="Array"
  19. v-model="where.deptIds"
  20. style="width: 100%"
  21. ></auth-selection>
  22. </el-form-item>
  23. </el-col>
  24. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  25. <el-form-item label-width="50px">
  26. <el-button
  27. type="primary"
  28. icon="el-icon-search"
  29. class="ele-btn-icon"
  30. @click="search"
  31. size="small"
  32. >
  33. 查询
  34. </el-button>
  35. <el-button
  36. @click="reset"
  37. icon="el-icon-refresh-left"
  38. size="small"
  39. type="primary"
  40. >重置</el-button
  41. >
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </el-form>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. // 默认表单数据
  51. const defaultWhere = {
  52. name: '',
  53. status: 1
  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>