(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c63d9f50"],{"50fc":function(e,t,o){"use strict";o.d(t,"e",(function(){return r})),o.d(t,"b",(function(){return a})),o.d(t,"f",(function(){return i})),o.d(t,"g",(function(){return c})),o.d(t,"d",(function(){return s})),o.d(t,"a",(function(){return d})),o.d(t,"c",(function(){return l})),o.d(t,"i",(function(){return u})),o.d(t,"h",(function(){return f}));o("99af");var n=o("b775");function r(){return Object(n["a"])({url:"admin/products/list",method:"get"})}function a(e){return Object(n["a"])({url:"/admin/products/add",method:"post",data:e})}function i(e){var t,o;return Object(n["a"])({url:"/admin/products/list?page=".concat(e.page,"&limit=").concat(e.limit,"&product_name=").concat(null!==(t=e.product_name)&&void 0!==t?t:"","&third_product_id=").concat(null!==(o=e.third_product_id)&&void 0!==o?o:""),method:"get"})}function c(e){return Object(n["a"])({url:"/admin/products/add",method:"post",data:e})}function s(e){return Object(n["a"])({url:"/admin/products/productschedules?id=".concat(e.id,"&date=").concat(e.date),method:"get"})}function d(e){return Object(n["a"])({url:"/admin/products/addproductschedules",method:"post",data:e})}function l(){return Object(n["a"])({url:"/admin/setting/getContractSetting",method:"get"})}function u(e){return Object(n["a"])({url:"/admin/setting/savecontractsetting",method:"post",data:e})}function f(){return Object(n["a"])({url:"/admin/setting/getContractSetting",method:"get"})}},"6e6c":function(e,t,o){},8233:function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"contract"},[o("div",{staticClass:"lay"},[o("div",{staticClass:"flex"},[o("el-button",{attrs:{type:"text"}},[e._v("境内合同:")]),o("el-button",{attrs:{type:"primary",icon:"el-icon-upload "},on:{click:function(t){return e.openDialog(1)}}},[e._v(" 上传境内合同 ")]),e.contractObj.domestic?o("el-button",{attrs:{type:"success"},on:{click:function(t){return e.downloadWord(1)}}},[e._v(" 下载境内合同 ")]):e._e()],1),o("div",{staticClass:"flex"},[o("el-button",{attrs:{type:"text"}},[e._v("境外合同:")]),o("el-button",{attrs:{type:"danger",icon:"el-icon-s-promotion"},on:{click:function(t){return e.openDialog(2)}}},[e._v(" 上传境外合同 ")]),e.contractObj.abroad?o("el-button",{attrs:{type:"success"},on:{click:function(t){return e.downloadWord(2)}}},[e._v(" 下载境外合同 ")]):e._e()],1)]),o("el-dialog",{attrs:{visible:e.dialogVisible,title:e.dialogTitle},on:{"update:visible":function(t){e.dialogVisible=t},open:e.onOpen,close:e.onClose}},[o("el-form",{ref:"elForm",attrs:{model:e.formData,size:"medium","label-width":"120px"}},[o("el-form-item",{attrs:{label:"上传",prop:"trip_info",required:""}},[o("el-upload",{ref:"field105",attrs:{action:"","before-upload":e.wordBeforeUpload,"http-request":e.handlesAvatarSuccess,"on-success":e.handleWordSuccess,"on-error":e.handleUploadError,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,limit:1,"file-list":e.fieldFileList,accept:".pdf,.docx,.xlsx"}},[o("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-upload"}},[e._v("点击上传")])],1)],1)],1),o("div",{attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:e.close}},[e._v("取消")]),o("el-button",{attrs:{type:"primary"},on:{click:e.handelConfirm}},[e._v("确定")])],1)],1)],1)},r=[],a=o("c7eb"),i=o("1da1"),c=(o("99af"),o("c740"),o("caad"),o("d81d"),o("a434"),o("b0c0"),o("d3b7"),o("3ca3"),o("ddb0"),o("2b3d"),o("bf19"),o("9861"),o("50fc")),s=o("5f87"),d={data:function(){return{contractObj:{},dialogVisible:!1,dialogTitle:"",fieldFileList:[],formData:{domestic:"",abroad:""},uploadPercent:0}},created:function(){this.getList()},methods:{getList:function(){var e=this;return Object(i["a"])(Object(a["a"])().mark((function t(){var o;return Object(a["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(c["c"])();case 2:o=t.sent,e.contractObj=o.data;case 4:case"end":return t.stop()}}),t)})))()},downloadWord:function(e){var t=this;return Object(i["a"])(Object(a["a"])().mark((function o(){var n,r;return Object(a["a"])().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.next=2,Object(c["h"])();case 2:n=o.sent,0===n.error&&(r=1===e?n.data.domestic:n.data.abroad,r?fetch(r).then((function(e){return e.blob()})).then((function(e){var t=document.createElement("a"),o=URL.createObjectURL(e);t.href=o,t.download=r.split("/").pop(),document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(o)})).catch((function(e){t.$message({showClose:!0,message:"下载失败",type:"error"}),console.error("Download error:",e)})):t.$message({showClose:!0,message:"暂无下载链接",type:"warning"})),console.log(n,"下载合同");case 5:case"end":return o.stop()}}),o)})))()},onOpen:function(){},onClose:function(){this.$refs["elForm"].resetFields(),this.$refs.field105.uploadFiles=[],this.fieldFileList=[],this.formData={domestic:"",abroad:""}},close:function(){console.log("1111",this.$refs.field105.uploadFiles),this.dialogVisible=!1,this.$refs.field105.uploadFiles=[]},openDialog:function(e){this.dialogTitle=1===e?"境内合同":"境外合同",this.dialogVisible=!0},handelConfirm:function(){var e=this;return Object(i["a"])(Object(a["a"])().mark((function t(){var o,n,r,i;return Object(a["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(o="境内合同"===e.dialogTitle,n=o?"domestic":"abroad",r="请上传".concat(o?"境内":"境外","合同"),e.formData[n]){t.next=5;break}return t.abrupt("return",e.$message.error(r));case 5:return t.next=7,Object(c["i"])(e.formData);case 7:i=t.sent,0===i.error&&(e.$message.success("上传成功"),e.getList()),e.close(),console.log(i,"wwww");case 11:case"end":return t.stop()}}),t)})))()},handlesAvatarSuccess:function(e){var t=this;return Object(i["a"])(Object(a["a"])().mark((function o(){var n,r,i,c;return Object(a["a"])().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return o.prev=0,n=new FormData,n.append("file",e.file),o.next=5,t.$axios.post("/admin/upload/index",n,{headers:{"Content-type":"multipart/form-data","X-Token":Object(s["a"])()}});case 5:r=o.sent,console.log(r,"收拾收拾"),0===r.error&&e.onSuccess(r),o.next=17;break;case 10:o.prev=10,o.t0=o["catch"](0),console.log(e,"error--handlesAvatarSuccess"),i=e.file.uid,c=t.$refs.field105.uploadFiles.findIndex((function(e){return e.uid===i})),t.$refs.field105.uploadFiles.splice(c,1),t.$message.error("上传失败");case 17:case"end":return o.stop()}}),o,null,[[0,10]])})))()},handleWordSuccess:function(e,t,o,n){if(console.log(e,t,o,"成功了"),e){var r="境内合同"===this.dialogTitle,a="".concat(window.location.protocol,"//").concat(window.location.host).concat(e.data);r?this.formData.domestic=a:this.formData.abroad=a,this.fieldFileList=[{name:t.name,uid:t.uid,url:a}],this.$message.success("上传成功")}},beforeRemove:function(e,t){return this.$confirm("确定移除 ".concat(e.name,"?"))},handleRemove:function(e,t){var o=this;console.log(e,t,"handleRemove"),this.formData.abroad="",this.formData.domestic="",this.fieldFileList.map((function(t,n){t.uid===e.uid&&o.fieldFileList.splice(n,1)}))},handleUploadError:function(e,t){var o=this;this.$message.error("上传失败: ".concat(t.name)),console.log(this.fieldFileList,"失败了"),this.fieldFileList.map((function(e,n){e.uid===t.uid&&o.fieldFileList.splice(n,1)}))},wordBeforeUpload:function(e){var t=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(e.type);return t||this.$message.error("只允许上传 PDF、DOCX、XLSX 格式的文件"),t}}},l=d,u=(o("9b0c"),o("2877")),f=Object(u["a"])(l,n,r,!1,null,"4eca529c",null);t["default"]=f.exports},"9b0c":function(e,t,o){"use strict";o("6e6c")}}]);