Commit 692553ae by LJM

进出库日志日期筛选

parent 7ac44113
......@@ -20,6 +20,20 @@
<el-button @click="resetForm('formParam')">重置</el-button>
</el-form-item>
</el-form>
<!-- 日期筛选-->
<div class="time-filter row verCenter bothSide">
<div></div>
<div class="filter-btns" style="text-align: right;">
<el-radio-group v-model="activeTimeBtn" @change="handleTimeFilter">
<el-radio-button :label="3">近3天</el-radio-button>
<el-radio-button :label="7">近7天</el-radio-button>
<el-radio-button :label="15">近15天</el-radio-button>
<el-radio-button :label="30">近30天</el-radio-button>
</el-radio-group>
</div>
</div>
<!--列表区-->
<div class="data-box">
<el-table :data="list" border max-height="600" @selection-change="handleSelectionChange">
......@@ -43,11 +57,11 @@
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
import {Autocomplete, Button, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, RadioButton, RadioGroup, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(Button).use(Link).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider);
Vue.use(Button).use(Link).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider).use(RadioGroup).use(RadioButton);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "inOutStockLog",
......@@ -60,12 +74,15 @@ export default {
list: [],
formParam: {
goods_name: '',
types: []
}
types: [],
start_time: '',
end_time: ''
},
activeTimeBtn: 7
};
},
created() {
this.getData()
this.handleTimeFilter(7);
},
methods: {
getData() {
......@@ -123,8 +140,11 @@ export default {
* @param formName
*/
resetForm(formName) {
this.formParam.date = '';
this.activeTimeBtn = '';
this.formParam.start_time = '';
this.formParam.end_time = '';
this.$refs[formName].resetFields();
this.getData();
},
/**
* 列表分页条数筛选监听
......@@ -148,6 +168,35 @@ export default {
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 添加时间筛选处理方法
*/
handleTimeFilter() {
const days = this.activeTimeBtn;
// 计算开始时间和结束时间
const end = new Date();
const start = new Date();
start.setDate(start.getDate() - days);
// 格式化日期
this.formParam.start_time = this.formatDate(start);
this.formParam.end_time = this.formatDate(end);
// 重新获取数据
this.page = 1;
this.getData();
},
/**
* 格式化日期的辅助方法
* @param date
*/
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
},
components: {
......@@ -156,5 +205,11 @@ export default {
};
</script>
<style scoped>
.time-filter {
margin: 15px 0;
}
.filter-btns .el-radio-group {
margin-left: 0px !important;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment