contactSearch.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!-- 搜索表单 -->
  2. <template>
  3. <el-form
  4. label-width="100px"
  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="编码/代号:" prop="codeOrSerialNo">
  12. <el-input
  13. clearable
  14. v-model="params.codeOrSerialNo"
  15. placeholder="请输入"
  16. maxlength="50"
  17. ></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  21. <el-form-item label="客户名称:" prop="name">
  22. <el-input
  23. clearable
  24. placeholder="请输入"
  25. v-model.trim="params.name"
  26. ></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  30. <el-form-item label="是否启用:" prop="codeOrSerialNo">
  31. <el-select v-model="params.status" placeholder="请选择" class="w100" clearable>
  32. <el-option
  33. v-for="item in statusList"
  34. :key="item.value"
  35. :label="item.label"
  36. :value="item.value"
  37. ></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  42. <div class="ele-form-actions">
  43. <el-button
  44. type="primary"
  45. icon="el-icon-search"
  46. class="ele-btn-icon"
  47. @click="search"
  48. >
  49. 查询
  50. </el-button>
  51. <el-button @click="reset">重置</el-button>
  52. </div>
  53. </el-col>
  54. </el-row>
  55. </el-form>
  56. </template>
  57. <script>
  58. export default {
  59. data () {
  60. // 默认表单数据
  61. const defaultParams = {
  62. type: 1,
  63. name: '',
  64. codeOrSerialNo: '',
  65. status: ''
  66. };
  67. return {
  68. defaultParams,
  69. // 表单数据
  70. params: { ...defaultParams },
  71. // 状态数据源
  72. statusList: [
  73. {value: 1, label: "启用"},
  74. {value: 2, label: "禁用"}
  75. ],
  76. };
  77. },
  78. computed: {
  79. // 是否开启响应式布局
  80. styleResponsive () {
  81. return true;
  82. }
  83. },
  84. methods: {
  85. /* 搜索 */
  86. search () {
  87. console.log(this.current);
  88. this.$emit('search', {
  89. ...this.params
  90. });
  91. },
  92. /* 重置 */
  93. reset () {
  94. this.params = { ...this.defaultParams };
  95. this.search();
  96. }
  97. }
  98. };
  99. </script>