var AttachmentService = {};
/**
 * 获取文件属性
 */
AttachmentService.getFileProperties = function (data) {
    return new Promise(function(resolve, reject) {
        $.ajax({
            url: Common.getApi(
                "/api/attachmentPanelResource/getFileProperties"
            ),
            type: "get",
            dataType: "json",
            data: data,
            beforeSend: function (request) {
                addTokenToRequest(request);
            },
            success: function (data) {
                resolve(data);
            }
        });
    });
},

    /**
     * 下载附件
     */
    AttachmentService.downloadAttachment = function (data) {
        return new Promise(function(resolve, reject) {
            $.ajax({
                url: Common.getApi("/api/file/attachmentDownloadPath"),
                type: "get",
                data: data,
                beforeSend: function (request) {
                    addTokenToRequest(request);
                },
                success: function (data) {
                    resolve(data);
                }
            });
        });
    },

    /**
     * 删除附件
     */
    AttachmentService.deleteAttachment = function (data) {
        return new Promise(function(resolve, reject) {
            $.ajax({
                url: Common.getApi(
                    "/api/attachmentPanelResource/deleteAttachment"
                ),
                type: "get",
                data: data,
                beforeSend: function (request) {
                    addTokenToRequest(request);
                },
                success: function (data) {
                    resolve(data);
                }
            });
        });
    }
