<div class="main" id="main" v-cloak>
    <div class="breadcrumb-box">
        <el-breadcrumb separator="/">
            <el-breadcrumb-item><i class="el-icon-s-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">站点管理</a></el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td class="btn-group  btn-group-sm">
                <el-tooltip effect="dark" content="添加站点" placement="bottom-start">
                    <el-button size="small" v-on:click="dialog({title:'添加',url:'@Url.ActionUrl("Add")',width:'70%',height:'90%',target:'self'})">
                        添加
                    </el-button>
                </el-tooltip>
            </td>
            <td align="right">
                <template>
                    <el-select size="mini" v-model="queryData.searchField" placeholder="请选择">
                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                    <el-input  size="mini" style="width:225px;"  v-model.trim="queryData.searchKeyword" placeholder="请输入内容" clearable v-on:clear="loadData"></el-input>
                    <el-button size="mini" v-on:click="loadData()">搜索</el-button>
                </template>
            </td>
        </tr>
    </table>
    <div class="table-list-box">
        <template>
            <el-table ref="multipleTable" :data="dataList" tooltip-effect="dark" highlight-current-row  v-on:selection-change="handleSelectionChange" border>
                <el-table-column label="id" prop="Id" width="100" align="center"></el-table-column>
                <el-table-column label="站点标识" header-align="center" class-name="fa-eye-hover">
                    <template slot-scope="scope">
                        {{scope.row.Remark}}
                        <a :href="'/e/preview/Site?id='+scope.row.Id" target="_blank" title="预览"><span class="el-icon-view"></span></a>
                    </template>
                </el-table-column>
                <el-table-column label="站点名称" prop="Name" align="center"></el-table-column>
                <el-table-column label="目录" prop="Directory" align="center"></el-table-column>
                <el-table-column label="绑定域名" prop="Domain" align="center"></el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <div class="el-button-group">
                            <el-button size="small" v-on:click="dialog({title:scope.row.Remark,url:'@Url.ActionUrl("Edit")?id='+scope.row.Id,width:'70%',height:'90%',target:'self'})">修改</el-button>
                            <el-button size="small" v-on:click="submit({url:'@Url.ActionUrl("Delete")',data:{id:scope.row.Id},confirmMsg:'确定删除吗？',success:'loadData()'})">删除</el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </template>
    </div>
    <ui-page-panel v-model="pageInfo" v-if="pageInfo.RecordCount>0" v-on:change="loadData()"></ui-page-panel>
</div>



<script type="text/javascript">

    //vue实例化
    var vue = new Vue({
        el: "#main",
        data: {
            selectList:[],
            pageInfo: { PageSize:15, CurrentPage: 1, RecordCount: 0, PageCount: 1 },
            dataList: [],
            queryData: { searchField: "remark", searchKeyword: "" },
            options: [{ value: 'remark', label: '站点标识' }, { value: 'name', label: '站点名称' }, { value: 'domain', label: '绑定域名' }, { value: 'directory', label: '站点目录' }],
        },
        methods: {
            loadData: function () {
                loadData();
            },
            handleSelectionChange: function(val) {
                this.selectList = val;
            }
        }
    });

        //加载数据
    function loadData()
    {
        var serverData = extend(vue.pageInfo, vue.queryData);
        vue.ajax({
            url: "@Url.ActionUrl("PageListData")",
            data: serverData,
            success: function (responseData) {
                if (responseData != "")
                {
                    vue.dataList = responseData.Data;
                    vue.pageInfo = responseData.PageInfo;
                }
            }
        });
    }
    loadData();
</script>

