@{ 
    List<string> fieldList = ViewBag.FieldList;
}
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
            <form method="post" class="form-horizontal form  form-control-sm ui-validForm" action="@Url.Action()" data-custom-params="beforeSubmit:'BeforeSubmit'">
           
                <div class="conditionBox">
                    <div class="control-group">
                        <label class="control-label">导入栏目：</label>
                        <div class="controls form-inline">
                            <select class="form-control form-control-sm" name="column_id" id="column_id" data-validate="dataType:'*" nullMsg:'请选择要导入的栏目！">
                            </select>
                            <span class="help-block">如excle表中包含column_id字段，则表中的数值优先。</span>
                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label">导入默认状态：</label>
                        <div class="controls form-inline">
                            <select class="form-control form-control-sm" name="state" id="state">
                                <option value="1">已审核</option>
                                <option value="0">待审核</option>
                                <option value="-1">退稿</option>
                                <option value="-2">草稿</option>
                            </select>
                            <span class="help-block">如excle表中包含state字段，则表中的数值优先。</span>
                        </div>
                    </div>
                </div>

               
                <div class="control-group">
                    <label class="control-label">上传Excle文件</label>
                    <div class="controls form-inline">
                        <input type="text" name="filePath" id="filePath"  readonly class="ui-uploadPanel form-control form-control-sm"  data-validate="dataType:'*" nullMsg:'请先上传excle文件！" data-custom-params="url:'@Url.Action("Index","UploadPanel")',rename:1,fileSingleSizeLimit:'10240',fileNumLimit:1,extensions:'xls,xlsx',uploadRootPath:'/Upload/Temp/'"/>
                        <span class="help-block">只能上传.xls或.xlsx格式的excle文件</span>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">Excle表名</label>
                    <div class="controls form-inline">
                        <input type="text" name="sheetName" id="sheetName" value="Sheet1" class="form-control form-control-sm" data-validate="dataType:'str" nullMsg:'请填写表名！" errorMsg:'表名请用英文字符或数字！"/>
                        <span class="help-block">Excle表名建议用英文字符加数字，不要用中文字符</span>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">是否异步导入</label>
                    <div class="controls form-inline">
                        <input type="checkbox" name="isAsync" id="isAsync" value="1" />异步导入
                        <span class="help-block">如果Excle数据较大建议采用异步导入。</span>
                    </div>
                </div>

                <div class="postarea">
                    <div class="control-group">
                        <div class="controls">
                            @Html.AntiForgeryToken()
                            <input type="hidden" id="table_id" name="table_id" value="@ViewBag.TableId" />
                            <button type="button" class="btn btn-primary btn-sm ui-pagePost" data-custom-params="url:'@Url.Action()',callBack:'CallBack'">确定</button>
                            <button type="button" class="btn btn-default btn-sm ui-closeDialog">关闭</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    //判断是否和父级页面域名一样

    if (parent.location == self.location) {
        $(".main").html("无效的请求！");
    }

    //判断域名是否匹配
    if (document.domain != parent.document.domain) {
        $(".main").html("非法请求！");
    }

    //绑定栏目
    var columnData = CallAjax("get", false, "/E/column/GetList?table_id=@ViewBag.TableId&uid=@ViewBag.Uid");
    var columnParam = { valueField: "id", textField: "name", isTree: true, linkage: false, onlySelectFinal:true};
    $("#column_id").FillSelect(columnData, columnParam);


    function BeforeSubmit()
    {
        return true;
    }

    function CallBack(jsonData)
    {
        parent.Msg("数据导入中，请稍微刷新页面查看！")
        CloseDialog();
    }

</script>
