travel/service/public/static/js/chunk-8eb7ee56.3f505444.js

1 line
7.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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