<template>
    <div class="flex-container">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
            <!-- 搜索区域 -->
            <a-form layout="inline">
                <a-row :gutter="24">
                    <a-col :md="4" :sm="12">
                        <a-form-item  label="套餐名称">
                            <a-input  placeholder="套餐名称" v-model="queryParam.name"></a-input>
                        </a-form-item>
                    </a-col>
                    <span class="table-page-search-submitButtons" style="float: left; overflow: hidden;">
                        <a-col :md="6" :sm="24">
                            <a-button @click="search()" type="primary">查询</a-button>
                             <a-divider type="vertical"/>
                            <a-button @click="add()" type="primary">添加</a-button>
                        </a-col>
                    </span>
                </a-row>
            </a-form>
        </div>


        <!--列表-->
        <s-table :columns="columns" :data="rowdata" bordered ref="table" size="small" class="flex-filling">
            <template slot="operation" slot-scope="text,record">
                <a >编辑</a>
            </template>

        </s-table>
    </div>
</template>

<script>
    import STable from '@/components/table';
    import {findByList,choosepages,modify,insert,hidestatus} from "@/api/school-center/packageManagementAPI"
    import {cloneObject} from '@/utils/util';
    export default {
        name: "package",
        components: {
            STable,
        },
        data: function () {
            return {
                //输入框列表
                queryParam: {
                    name: '',
                },
                columns: [
                    {dataIndex: 'packageName', width: 200, title: '学校名称', align: "center"},
                    {dataIndex: 'monthFee', width: 200, title: '学校名称', align: "center"},
                    {dataIndex: 'flow', width: 200, title: '学校名称', align: "center"},
                    {dataIndex: 'voice', width: 200, title: '学校名称', align: "center"},
                    {
                        dataIndex: 'operation',
                        width: 100,
                        title: '操作',
                        align: "center",
                        scopedSlots: {customRender: 'operation'},
                        fixed: "right"
                    }]
                ,
                rowdata: parameter => {
                    let params = {
                        pageNo: parameter.pageNo,
                        pageSize: parameter.pageSize
                    }
                    //表示
                    let obj = cloneObject(this.queryParam)
                    return findByList(Object.assign(params,obj)).then(res => {
                        let data = {}
                        if (res.state !== 'success') {
                            data = {
                                data: [],
                                pageSize: parameter.pageSize,
                                pageNo: 1,
                                totalCount: 0
                            }
                        } else {
                            data = {
                                data: res.data.records,
                                pageSize: parameter.pageSize,
                                pageNo: parameter.pageNo,
                                totalCount: res.data.total
                            }
                        }
                        return data
                    })
                }
            }
        },
        methods:{
            search() {
                this.$refs.table.refresh({search: true})
            },
        }

        }
</script>

<style scoped>

</style>