(("undefined"!==typeof self?self:this)["webpackJsonpkk_form_design"]=("undefined"!==typeof self?self:this)["webpackJsonpkk_form_design"]||[]).push([[38],{"1f3b":function(e,t,i){"use strict";i.r(t);var o=function(){var e=this,t=e._self._c;return t("div",{staticClass:"upload-img-box-9136076486841527",style:{width:e.record.options.width}},[t("Upload",{attrs:{name:e.config.uploadImageName||e.record.options.fileName,headers:e.config.uploadImageHeaders||e.record.options.headers,data:e.config.uploadImageData||e.optionsData,action:e.config.uploadImage||e.record.options.action,multiple:e.record.options.multiple,listType:e.record.options.listType,disabled:e.record.options.disabled||e.parentDisabled,fileList:e.fileList,accept:"image/gif, image/jpeg, image/png",remove:e.remove,beforeUpload:e.beforeUpload},on:{change:e.handleChange,preview:e.handlePreview}},["picture-card"!==e.record.options.listType&&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(),"picture-card"===e.record.options.listType&&e.fileList.length<e.record.options.limit?t("div",{attrs:{disabled:e.record.options.disabled||e.parentDisabled}},[t("a-icon",{attrs:{type:"plus"}}),t("div",{staticClass:"ant-upload-text"},[e._v(e._s(e.record.options.placeholder))])],1):e._e()],1),t("a-modal",{attrs:{visible:e.previewVisible,footer:null},on:{cancel:e.handleCancel}},[t("img",{staticStyle:{width:"100%"},attrs:{alt:"example",src:e.previewImageUrl}})])],1)},a=[],s=(i("a450"),i("e74d")),n=i("6927"),r=s["c"].getComponent("upload"),l=s["c"].getComponent("aButton").component,d={name:"KUploadImg",props:["record","value","config","parentDisabled"],components:{Upload:r.component,Button:l},data:function(){return{fileList:[],previewVisible:!1,previewImageUrl:""}},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 console.error(e),{}}}},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:"img",name:e.name,status:e.status,uid:e.uid,url:t.data.url||""}}return{type:"img",name:e.name,status:e.status,uid:e.uid,url:e.url||""}}));e.$emit("change",t),e.$emit("input",t)}),10)},handlePreview:function(e){this.previewImageUrl=e.url||e.thumbUrl,this.previewVisible=!0},handleCancel:function(){this.previewVisible=!1},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=d,c=i("e607"),u=Object(c["a"])(p,o,a,!1,null,null,null),h=u.exports;t["default"]=h}}]);