outsourceSearch.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div>
  3. <el-form label-width="80px" class="ele-form-search" @keyup.enter.native="search" @submit.native.prevent>
  4. <el-row :gutter="15">
  5. <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 5 }">
  6. <el-form-item label="计划名称:">
  7. <el-input clearable v-model="where.name" placeholder="请输入" />
  8. </el-form-item>
  9. </el-col>
  10. <!-- <el-col></el-col>-->
  11. <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
  12. <div class="ele-form-actions">
  13. <el-button type="primary" icon="el-icon-search" class="ele-btn-icon" @click="search">
  14. 查询
  15. </el-button>
  16. <el-button @click="reset" icon="el-icon-refresh-left" type="primary">重置</el-button>
  17. </div>
  18. </el-col>
  19. </el-row>
  20. </el-form>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. components: {
  26. },
  27. data() {
  28. const defaultWhere = {
  29. releaseTime: [],
  30. deliveryTime: [],
  31. createTime: []
  32. };
  33. return {
  34. where: { ...defaultWhere },
  35. }
  36. },
  37. computed: {
  38. // 是否开启响应式布局
  39. styleResponsive() {
  40. return this.$store.state.theme.styleResponsive;
  41. }
  42. },
  43. methods: {
  44. search() {
  45. const where = { ...this.where };
  46. for (const key in where) {
  47. if (Array.isArray(where[key]) && where[key].length) {
  48. where[`${key}Start`] = where[key][0];
  49. where[`${key}End`] = where[key][1];
  50. }
  51. }
  52. delete where.releaseTime;
  53. delete where.deliveryTime;
  54. delete where.createTime;
  55. this.$emit('search', where);
  56. },
  57. /* 重置 */
  58. reset() {
  59. this.where = { ...this.defaultWhere };
  60. this.search();
  61. }
  62. }
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. </style>