<template>
    <basic-container>
        <el-form ref="form" :model="formData" :rules="rules" inline>
            <el-date-picker v-model="formData.date" value-format="yyyy-MM-dd" :picker-options="pickerOptions"
                start-placeholder="开始时间" end-placeholder="结束时间" type="daterange" align="left" unlink-panels
                range-separator="-" :clearable="false" style="width:250px" />
            <el-button @click="loadData" type="primary" style="margin-left: 12px;">查询</el-button>
        </el-form>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
            @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>
                <!-- <el-button type="danger" icon="el-icon-delete" @click="handleDelete">删 除
                </el-button> -->
            </template>
            <template #menu-right>
                <!-- <el-button type="success" icon="el-icon-upload" @click="handleImport">导入
                </el-button> -->
            </template>

        </avue-crud>
    </basic-container>
</template>
<script>
export default {
    data() {
        return {
            formData: {
                method: "mes_request_stocks",
                date: []
            },
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 32,
                tip: false,
                size: 'medium',
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                searchIcon: true,
                searchIndex: 3,
                tree: false,
                border: true,
                index: true,
                selection: true,
                viewBtn: false,
                delBtn: false,
                addBtn: false,
                editBtnText: '修改',
                viewBtnIcon: ' ',
                delBtnIcon: ' ',
                editBtnIcon: ' ',
                viewBtnText: '详情',
                labelWidth: 120,
                menuWidth: 120,
                dialogWidth: 1040,
                dialogClickModal: false,
                searchEnter: true,
                excelBtn: false,
                filterBtn: true,
                searchShowBtn: false,
                columnSort: true,
                excelBtn: true,
                columnSort: true,
                index: false,
                showOverflowTooltip: true,
                menu: false,
                column: [

                    {
                        label: '物料编码',
                        prop: 'c_materiel_id',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 12,

                    },
                    {
                        label: '货位',
                        prop: 'c_place',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 12,

                    },
                    {
                        label: '数量',
                        prop: 'dec_count',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 12,

                    },
                    {
                        label: '批号',
                        prop: 'c_batch_mark',
                        search: false,
                        sortable: true,
                        filter: true,
                        span: 12,

                    },

                ]
            },
            form: {

            },
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
        }
    },
    methods: {
        handleDelete() {
            if (this.selectionList.length === 0) {
                this.$message.warning('请选择至少一条数据');
                return;
            }
            this.$confirm('确定将选择数据删除?', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
            })
        },
        // 多选
        selectionChange(list) {
            this.selectionList = list;
        },
        onLoad() {
            this.loading = true
            this.data = []
            this.page.total = this.data.length
            this.loading = false
            setTimeout(() => {
                this.selectionClear()
            }, 500)
        }
    }
}
</script>
<style lang="scss" scoped></style>