更多筛选对话框more-select-dialog

1.主表格增删改查:查询表单

2.更多筛选查询对话框:查询表单

这二者的数据和逻辑问题

table.vue

<template>
  <div class="up-down-table-container">
    <div class="up-table-container">
      <div class="search-form-wrapper">
        <div class="title">title</div>
        <div class="seach_list">
          <el-button style="margin-right:10px" type='primary' :plain='true' @click="moreSelect">更多筛选</el-button>
        </div>
      </div>
    <moreSelectDialog ref="moreSelectDialog" @searchMoreTable="searchMoreTable"></moreSelectDialog>
  </div>
</template>
<script>
export default {
  components: {
    moreSelectDialog: () => import('../components/moreSelectDialog.vue'),
  },
  data() {
    return {
      searchForm: {},
      moreSelectForm: {},
    }
  },
  mounted() {
  },
  methods: {
    //更多筛选
    moreSelect() {
      this.$refs.moreSelectDialog.open(this.moreSelectForm,'0')
    },
    //接收更多筛选对话框传回来的搜索值
    searchMoreTable(form) {
      this.moreSelectForm = { ...form }
      this.searchForm = { ...this.searchForm, ...form }
      this.searchUpTable();
    },
  }
}
</script>

more-select-dialog.vue

<template>
  <el-dialog title="更多筛选" :visible.sync="dialogVisible" width="40%" :close-on-click-modal='false'>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item v-if="type == 0" label="状态:">
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="resetClick">重置</el-button>
      <el-button type="primary" @click="submitClick">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      form: {},
    }
  },
  methods: {
    // 打开对话框
    open(obj) {
      this.dialogVisible = true
      this.form = { ...obj }
    },
    // 关闭对话框
    close() {
      this.dialogVisible = false
    },
    // 重置按钮
    resetClick() {
      this.resetValue(this.form)
    },
    // 确定按钮
    submitClick() {
      this.$emit('searchMoreTable', this.form)
      this.dialogVisible = false
    },
    //重置条件
    returnNormalValue(value) {
      if (typeof value === 'string') {
        return ''
      }
      if (typeof value === 'number') {
        return 0
      }
      let toStrong = Object.prototype.toString
      let type = toStrong.call(value)
      if (type.includes('Date')) {
        return new Date()
      }
      if (type.includes('Object')) {
        return {}
      }
      if (type.includes('Array')) {
        return []
      }
    },
    //重置条件
    resetValue(data) {
      let searchForm = data
      for (const key in searchForm) {
        if (Object.hasOwnProperty.call(searchForm, key)) {
          searchForm[key] = this.returnNormalValue(searchForm[key])
        }
      }
    }
  }
}
</script>
<style lang="scss" scoped>
:deep(.el-form-item__label) {
  color: #303133;
}

.el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 100%;
}

:deep(.el-select){
  width: 100%;
}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值