<div class="main" id="main">
    <el-form label-position="left">
        <el-form-item label="">
            <ui-file-upload action="@Url.ActionUrl("Upload")" btn-txt="选择要上传的文件" v-model="file" return-type="string" :limit="limit" :max-size="0" :file-list='[]' :accept="accept"
                            :data="{savePath:path,isFileAdmin:true,fileType:'files',limitName:limitName,deleteRepeat:deleteRepeat,siteId:'@ViewBag.CurrentSiteId'}"
                            v-validate="{data:file,dataType:'*',nullMsg:'请选择上传文件'}">
                <i class="el-icon-plus"></i>
            </ui-file-upload>
            <span class="help-block validate-tips-box" v-show="replace=='1'">上传后将自动命名为<el-link type="danger">{{name}}</el-link>并覆盖旧文件，系统文件请谨慎此操作，避免运行出错。</span>
            <span class="help-block validate-tips-box" v-show="replace=='0'">按住Ctrl键可实现多文件上传，注意不能上传同名文件，如需上传同名文件请采用<span class="el-icon-upload"></span>替换功能。</span>
        </el-form-item>
    </el-form>
    <div class="footer-submit-bar">
        <el-button type="primary" v-on:click="confirm">确定</el-button>
        <el-button onclick="closeSelf()">关闭</el-button>
    </div>
</div>
<script type="text/javascript">
    var replace = request("replace");
    if (replace != "1") {
        replace = "0";
    }
    var name = request("name");
    var formData = { replace:replace,name: name, file: [], path: "", limit: 0, limitName: "", deleteRepeat: false,accept: "*" };
    if (replace == "1" && !isNullOrEmpty(name)) {
        formData.limit = 1;
        formData.deleteRepeat = true;
        formData.accept = name.substring(name.lastIndexOf("."));
        formData.limitName = name.substring(0, name.lastIndexOf("."));
    };
    formData.path = "@Request.QueryString["path"]" + parent.vue.path.join("/");
    console.log(formData);
    var vue = new Vue({
        el: "#main",
        data: formData,
        methods: {
            confirm: function () {
                parent.loadData();
                closeSelf();
            },
        },
    });
</script>