(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a33bcf20"],{"455c":function(e,t,s){},4741:function(e,t,s){"use strict";s.r(t);var i=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"content_wri"},[s("div",{staticClass:"header_write"},[e._v(e._s(e.template.header))]),e._l(e.template.contents,(function(t,i){return s("div",{key:i},[s("div",{staticClass:"title_weight"},[e._v(e._s(t.title)+":")]),s("quill-editor",{ref:i,refInFor:!0,staticStyle:{"margin-top":"20px"},attrs:{id:i},on:{blur:function(t){return e.onEditorBlur(t,i)},focus:function(t){return e.onEditorFocus(t,i)}},model:{value:t.content,callback:function(s){e.$set(t,"content",s)},expression:"item.content"}})],1)})),s("div",{staticClass:"title_weight"},[e._v("图片上传")]),s("div",[s("div",{staticClass:"clearfix"},[s("a-upload",{attrs:{action:"/week/fileUploadAndDownload/upload","list-type":"picture-card","file-list":e.fileList,accept:".png,.jpeg,.jpg",headers:{"x-token":e.xToken,"x-user-id":e.xUserId},remove:e.removeFile},on:{preview:e.handlePreview,change:e.handleChange}},[e.fileList.length<8?s("div",[s("a-icon",{attrs:{type:"plus"}}),s("div",{staticClass:"ant-upload-text"},[e._v(" Upload ")])],1):e._e()]),s("a-modal",{attrs:{visible:e.previewVisible,footer:null},on:{cancel:e.handleCancel}},[s("img",{staticStyle:{width:"100%"},attrs:{alt:"example",src:e.previewImage}})])],1)]),s("div",{staticClass:"title_weight"},[e._v("文件上传")]),s("div",[s("div",{staticClass:"clearfix"},[s("a-upload",{attrs:{action:"/week/fileUploadAndDownload/upload","file-list":e.fileList2,headers:{"x-token":e.xToken,"x-user-id":e.xUserId},remove:e.removeFile},on:{change:e.handleChange2}},[s("div",[s("a-button",[s("a-icon",{attrs:{type:"upload"}}),e._v(" Upload ")],1)],1)])],1)]),e._m(0),s("a-select",{class:e.sendToClass,staticStyle:{width:"100%"},attrs:{mode:"multiple",placeholder:"请选择人员"},on:{change:e.userChange},model:{value:e.sends,callback:function(t){e.sends=t},expression:"sends"}},e._l(e.userList,(function(t){return s("a-select-option",{key:t.ID},[e._v(" "+e._s(t.nickName)+" ")])})),1),"cannotSubmit"===e.sendToClass?s("span",{staticStyle:{color:"red"}},[e._v("请选择人员")]):e._e(),s("div",{staticStyle:{"text-align":"center"}},[s("a-button",{staticClass:"commit_button",attrs:{type:"primary"},on:{click:e.addReports}},[e._v(" 提交 ")])],1)],2)},a=[function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticStyle:{"font-weight":"600",margin:"20px 0 0 0"}},[s("span",{staticStyle:{color:"red"}},[e._v("*")]),e._v("发送给")])}],n=s("1da1"),r=(s("96cf"),s("d3b7"),s("159b"),s("b0c0"),s("a9e3"),s("7c15")),o=s("953d");s("a753"),s("8096"),s("14e1");function l(e){return new Promise((function(t,s){var i=new FileReader;i.readAsDataURL(e),i.onload=function(){return t(i.result)},i.onerror=function(e){return s(e)}}))}var c={name:"WriteWeeklyReport",components:{quillEditor:o["quillEditor"]},data:function(){return{fileList:[],previewVisible:!1,previewImage:"",xToken:sessionStorage.getItem("login"),xUserId:sessionStorage.getItem("userId"),pictures:[],fileList2:[],template:{},userList:[],sends:[],attachments:[],sendToClass:"canSubmit",sendTo:[]}},created:function(){this.findTempl(),this.findUserList()},methods:{handleCancel:function(){this.previewVisible=!1},handlePreview:function(e){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function s(){return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:if(e.url||e.preview){s.next=4;break}return s.next=3,l(e.originFileObj);case 3:e.preview=s.sent;case 4:t.previewImage=e.url||e.preview,t.previewVisible=!0;case 6:case"end":return s.stop()}}),s)})))()},handleChange:function(e){var t=e.fileList;this.fileList=t},handleChange2:function(e){var t=e.fileList;this.fileList2=t},removeFile:function(e){var t=this,s={};s.key=e.response.data.file.key;var i=[];this.fileList.forEach((function(e){e.response.data.file.key!==s.key&&i.push(e)})),this.fileList=i;var a=[];this.fileList2.forEach((function(e){e.response.data.file.key!==s.key&&a.push(e)})),this.fileList2=a,this.$axios.post(r["a"].DELETE_FILE.url,s).then((function(e){0===e.data.code?t.$message.success(e.data.msg):t.$message.error(e.data.msg)}))},findTempl:function(){var e=this;this.$axios.get(r["a"].GET_TEMPLATE_LIST.url).then((function(t){0===t.data.code?t.data.data.total>0?e.template=t.data.data.list[0]:e.$message.error("请先创建周报模板"):e.$message.error(t.data.msg)}))},onEditorBlur:function(e,t){document.getElementById(t).children[0].style.zIndex="1"},onEditorFocus:function(e,t){document.getElementById(t).children[0].style.zIndex="2"},findUserList:function(){var e=this,t={page:1,pageSize:99999};this.$axios.post(r["a"].GET_USER_LIST.url,t).then((function(t){0===t.data.code?e.userList=t.data.data.list:e.$message.error(t.data.msg)}))},userChange:function(e){var t=[];e.length>0&&this.userList.forEach((function(s){e.forEach((function(e){if(s.ID===e){var i={};i.id=e,i.name=s.userName,t.push(i)}}))})),this.sendTo=t,this.sendTo.length>0&&(this.sendToClass="canSubmit")},addReports:function(){var e=this,t=[];this.fileList.length>0&&this.fileList.forEach((function(e){var s={};s.key=e.response.data.file.key,s.name=e.response.data.file.name,t.push(s)})),this.pictures=t;var s=[];if(this.fileList2.length>0&&this.fileList2.forEach((function(e){var t={};t.key=e.response.data.file.key,t.name=e.response.data.file.name,s.push(t)})),this.attachments=s,0===this.sendTo.length)this.sendToClass="cannotSubmit";else{var i={};i.userId=Number(sessionStorage.getItem("userId")),i.userName=sessionStorage.getItem("userName"),i.sendTo=this.sendTo,i.pictures=this.pictures,i.attachments=this.attachments,i.header=this.template.header,i.contents=this.template.contents,this.$axios.post(r["a"].ADD_REPORT.url,i).then((function(t){0===t.data.code?(e.$message.success(t.data.msg),e.findTempl(),e.findTempl(),e.fileList=[],e.previewVisible=!1,e.previewImage="",e.pictures=[],e.fileList2=[],e.template={},e.userList=[],e.attachments=[],e.sendTo=[],e.sends=[]):e.$message.error(t.data.msg)}))}}},computed:{editor:function(){return this.$refs.myQuillEditor.quill}}},d=c,u=(s("d8bf"),s("2877")),f=Object(u["a"])(d,i,a,!1,null,null,null);t["default"]=f.exports},d8bf:function(e,t,s){"use strict";s("455c")}}]); //# sourceMappingURL=chunk-a33bcf20.30d5b533.js.map