(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d228cf1"],{db85:function(e,t,o){"use strict";o.r(t);var i=function(){var e=this,t=e._self._c;return t("div",{style:{width:e.record.options.width}},[e.record.options.drag?t("UploadDragger",{class:{"hide-upload-drag":!(e.fileList.length<e.record.options.limit)},attrs:{disabled:e.record.options.disabled||e.parentDisabled,name:e.config.uploadFileName||e.record.options.fileName,headers:e.config.uploadFileHeaders||e.record.options.headers,data:e.config.uploadFileData||e.optionsData,action:e.config.uploadFile||e.record.options.action,multiple:e.record.options.multiple,fileList:e.fileList,remove:e.remove,beforeUpload:e.beforeUpload},on:{preview:e.handlePreview,change:e.handleChange}},[t("p",{staticClass:"ant-upload-drag-icon"},[t("a-icon",{attrs:{type:"cloud-upload"}})],1),t("p",{staticClass:"ant-upload-text"},[e._v("单击或拖动文件到此区域")])]):t("Upload",{attrs:{disabled:e.record.options.disabled||e.parentDisabled,name:e.config.uploadFileName||e.record.options.fileName,headers:e.config.uploadFileHeaders||e.record.options.headers,data:e.config.uploadFileData||e.optionsData,action:e.config.uploadFile||e.record.options.action,multiple:e.record.options.multiple,fileList:e.fileList,remove:e.remove,beforeUpload:e.beforeUpload},on:{preview:e.handlePreview,change:e.handleChange}},[e.fileList.length<e.record.options.limit?t("Button",{attrs:{disabled:e.record.options.disabled||e.parentDisabled}},[t("a-icon",{attrs:{type:"upload"}}),e._v(" "+e._s(e.record.options.placeholder)+" ")],1):e._e()],1)],1)},a=[],n=(o("3b18"),o("f64c")),r=(o("d81d"),o("a434"),o("b0c0"),o("b64b"),o("d3b7"),o("3ca3"),o("ddb0"),o("2b3d"),o("bf19"),o("9861"),o("96f9")),l=r["c"].getComponent("upload"),s=r["c"].getComponent("uploadDragger"),d=r["c"].getComponent("aButton").component,c={name:"KUploadFile",props:["record","value","config","parentDisabled","dynamicData"],components:{Upload:l.component,UploadDragger:s.component,Button:d},data:function(){return{fileList:[]}},watch:{value:{handler:function(e){e&&this.setFileList()},immediate:!0,deep:!0}},computed:{optionsData:function(){try{return JSON.parse(this.record.options.data)}catch(e){return{}}}},methods:{setFileList:function(){"string"===typeof this.value?(this.fileList=JSON.parse(this.value),this.handleSelectChange()):this.fileList=this.value},handleSelectChange:function(){var e=this;setTimeout((function(){var t=e.fileList.map((function(e){if("undefined"!==typeof e.response){var t=e.response;return{type:"file",name:e.name,status:e.status,uid:t.data.fileId||Date.now(),url:t.data.url||""}}return{type:"file",name:e.name,status:e.status,uid:e.uid,url:e.url||""}}));e.$emit("change",t),e.$emit("input",t)}),10)},handlePreview:function(e){var t=this,o=this.record.options.downloadWay,i=this.record.options.dynamicFun;if("a"===o){var a=document.createElement("a");a.href=e.url||e.thumbUrl,a.download=e.name,a.click()}else"ajax"===o?this.getBlob(e.url||e.thumbUrl).then((function(o){t.saveAs(o,e.name)})):"dynamic"===o&&this.dynamicData[i](e)},getBlob:function(e){return new Promise((function(t){var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="blob",o.onload=function(){200===o.status&&t(o.response)},o.send()}))},saveAs:function(e,t){if(window.navigator.msSaveOrOpenBlob)navigator.msSaveBlob(e,t);else{var o=document.createElement("a"),i=document.querySelector("body");o.href=window.URL.createObjectURL(e),o.download=t,o.style.display="none",i.appendChild(o),o.click(),i.removeChild(o),window.URL.revokeObjectURL(o.href)}},remove:function(){this.handleSelectChange()},beforeUpload:function(e,t){t.length+this.fileList.length>this.record.options.limit&&(n["a"].warning("最大上传数量为".concat(this.record.options.limit)),t.splice(this.record.options.limit-this.fileList.length))},handleChange:function(e){if(this.fileList=e.fileList,"done"===e.file.status){var t=e.file.response;0===t.code?this.handleSelectChange():(this.fileList.pop(),n["a"].error("文件上传失败"))}else"error"===e.file.status&&n["a"].error("文件上传失败")}}},p=c,u=o("2877"),f=Object(u["a"])(p,i,a,!1,null,null,null),h=f.exports;t["default"]=h}}]);