importDialog-legacy-7212ca5b.js 15 KB

1
  1. !function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,s=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return l=e.done,e},e:function(e){s=!0,i=e},f:function(){try{l||null==o.return||o.return()}finally{if(s)throw i}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,o=new Array(t);a<t;a++)o[a]=e[a];return o}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,o)}return a}function n(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function r(t,a,o){var n;return n=function(t,a){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,a||"default");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(t)}(a,"string"),(a="symbol"==e(n)?n:String(n))in t?Object.defineProperty(t,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[a]=o,t}System.register(["./vendor-legacy-8856a2a6.js","./XLSXUtils-legacy-d51f9cbf.js","./index-legacy-240e7575.js","./on-icon-legacy-4d9470cc.js"],(function(e,a){"use strict";var o,r,i,l,s,c,u,d,p,f=document.createElement("style");return f.textContent=".template-box[data-v-3c1fd9b0]{display:grid;grid-template-columns:1fr 1fr;padding:20px 40px;grid-row-gap:20px;grid-column-gap:20px}.template-list[data-v-3c1fd9b0]{width:100%;height:200px;background:linear-gradient(180deg,rgba(38,92,240,.1) 5%,rgba(38,92,240,.04) 100%);display:flex;color:#1651ee;font-size:14px;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;border-radius:4px}.template-list img[data-v-3c1fd9b0]{width:20px;height:20px;margin-bottom:20px}.steps[data-v-c1e5f148]{width:80%;height:40px;text-align:center;margin:0 auto 0 40px}.steps .el-steps[data-v-c1e5f148]{background-color:rgba(38,92,240,.05)}.drawer_main[data-v-c1e5f148]{width:90%;margin:40px auto 0}.drawer_main p[data-v-c1e5f148]{line-height:36px;font-size:14px}.drawer_main .astrict[data-v-c1e5f148]{text-indent:3em;color:#878787;line-height:24px;font-size:12px}.table[data-v-c1e5f148]{width:90%;margin:40px auto 0}.footer[data-v-c1e5f148]{position:absolute;width:90%;bottom:4%;left:50%;transform:translate(-50%);display:flex;justify-content:space-between}[data-v-c1e5f148] .el-drawer.rtl{width:50%!important;background-color:#fff!important;border-radius:20px 0 0 20px}[data-v-c1e5f148] .el-tabs__nav{display:flex;align-items:flex-end}[data-v-c1e5f148] .el-tabs__item{width:100px;text-align:center;height:40px;background:#fff;border-radius:10px 10px 0 0;margin-right:15px;padding:0}[data-v-c1e5f148] .el-tabs__item.is-active{height:45px;line-height:45px}[data-v-c1e5f148] .el-tabs__active-bar,[data-v-c1e5f148] .el-tabs__nav-wrap:after{height:0}[data-v-c1e5f148] .el-tabs__content{background-color:#fff;padding:20px;margin-bottom:60px}[data-v-c1e5f148] .el-tabs__header{margin:0}[data-v-c1e5f148] .el-step__icon{position:absolute;left:0}[data-v-c1e5f148] .el-step__icon-inner{display:none}[data-v-c1e5f148] .el-step__main{position:absolute;left:0;width:85px;top:25px}[data-v-c1e5f148] .el-step__head.is-success{color:#265cf0;border-color:#265cf0}[data-v-c1e5f148] .el-step__title.is-success{color:#265cf0}[data-v-c1e5f148] .el-step__line{background-color:#b8cbff}[data-v-c1e5f148] .el-step__head.is-process,[data-v-c1e5f148] .el-step__head.is-wait{color:#b8cbff;border-color:#b8cbff}[data-v-c1e5f148] .el-step__title.is-process,[data-v-c1e5f148] .el-step__title.is-process,[data-v-c1e5f148] .el-step__title.is-wait{color:#333;font-weight:400}.el-table .el-table__row:hover td[data-v-c1e5f148],.el-table .el-table__row .is-center:hover td[data-v-c1e5f148],.el-radio-button__inner[data-v-c1e5f148]:hover{color:#1651ee}.el-radio-button__orig-radio:checked+.el-radio-button__inner[data-v-c1e5f148]{background-color:#5f8bff}.el-message.el-message--info[data-v-c1e5f148]{background-color:#e7fafb;border-color:#e7fafb;color:#1651ee}.el-message.el-message--info .el-message__icon.el-icon-info[data-v-c1e5f148],.el-message.el-message--info .el-message__content[data-v-c1e5f148]{color:#1651ee}.excel-upload-input[data-v-c1e5f148]{display:none;z-index:-99999}\n",document.head.appendChild(f),{setters:[function(e){o=e.r,r=e.h,i=e.o,l=e.e},function(e){s=e.I,c=e.E},function(e){u=e.n,d=e.$},function(e){p=e.b}],execute:function(){var a=u({__name:"templateListDialog",setup:function(e,t){var a=t.expose,n=o(!1),r=o([]);function i(){n.value=!0;var e={offset:0,limit:9999,ordering:"-id",del_flag:0,status:1,is_default:0,company:d.getters.company};HTTP.get("used_customer_templates",e).then((function(e){r.value=e.data.results}))}return a({init:i}),{__sfc:!0,drawer:n,templateList:r,init:i,getListClose:function(){n.value=!1},getUploadUrl:function(e){HTTP.post("download_clue_customer_template",{template_id:e.id,type:2}).then((function(e){if(0==e.code){var t=document.createElement("a");t.href="http://sms.9haoai.com/"+e.data,t.download="",t.style.display="none",document.body.appendChild(t),t.click(),setTimeout((function(){document.body.removeChild(t)}),100)}}))}}}},(function(){var e=this,t=e._self._c,a=e._self._setupProxy;return t("el-drawer",{attrs:{title:"模板下载",visible:a.drawer,"before-close":a.getListClose,direction:"rtl","append-to-body":!0,"destroy-on-close":!0},on:{"update:visible":function(e){a.drawer=e}}},[t("div",{staticClass:"template-box"},e._l(a.templateList,(function(o){return t("div",{staticClass:"template-list",on:{click:function(e){return a.getUploadUrl(o)}}},[t("img",{attrs:{src:p,alt:""}}),t("div",[e._v("点击下载"+e._s(o.name))])])})),0),t("div",{staticClass:"footer",staticStyle:{display:"flex","justify-content":"flex-end",margin:"40px"}},[t("el-button",{attrs:{type:"primary"},on:{click:a.getListClose}},[e._v("返回")])],1)])}),[],!1,null,"3c1fd9b0",null,null).exports;e("i",u({__name:"importDialog",emits:["getList"],setup:function(e,u){var p=u.expose,f=u.emit,v=o(!1),_=o(),m=function(e){v.value=!0,_.value=e},g=r((function(){return T.value?"历史导入记录":"导入"})),b=r((function(){return 2!=y.value})),h=o(),y=o(1),x=o(),w=o([{name:""}]),k=o(),S=o(0),C=o(0),j=o(0);var T=o(!1),L=o([]),O=function(){HTTP.get("history_import",{is_self:_.value.is_self,type:_.value.import_type,ordering:"-id"}).then((function(e){L.value=e.data.results}))};return i((function(){})),p({init:m}),{__sfc:!0,emits:f,drawer:v,type:_,init:m,title:g,isImport:b,templateListRef:h,isActive:y,excel_upload_input:x,selectFile:function(){x.value.click()},files:w,event:k,inputChange:function(e){console.log("inputChange______",e),e.target.files.length?(w.value=e.target.files,k.value=e,y.value=2):(y.value=1,w.value=[{name:""}],k.value=null)},total_count:S,success_count:C,fail_count:j,handleImport:function(){y.value=2;var e=l.exports.Loading.service({lock:!0,text:"正在导入数据...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"});s(k.value).then((function(t){console.log("resp",t);var a=[];t.data[0].map((function(e){var t={};t.name=e["*客户名称"],t.source=e["*客户来源"],t.video_link=e["视频链接"],t.belong_to_blogger=e["所属博主"]||"",t.contact=e["客户联系人"]||"",t.phone=e["*客户手机"],t.tel=e["客户电话"]||"",t.wechat=e["*客户微信"]||"",t.industry=e["客户行业"]||"",t.remarks=e["备注"]||"",a.push(t)})),console.log("import_datas",a);var o=n({import_datas:a},_.value);HTTP.post("upload_xml",o).then((function(t){console.log("res",t),l.exports.Message({type:"success",message:"文件上传成功!",offset:"20px"}),S.value=t.data.total_count,C.value=t.data.success_count,j.value=t.data.fail_count,e.close(),y.value=3,f("getList")}))})).catch((function(t){l.exports.Message({type:"error",message:"上传失败!".concat(t),offset:"20px"}),e.close()}))},readExcel:function(){y.value=2;var e=l.exports.Loading.service({lock:!0,text:"正在导入数据...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"});s(k.value).then((function(a){var o=[],r=!1;if(a.data[0].map((function(e){var n={};if(!e.phone)return r=!0;e.phone=e.phone.toString();var i,l=t(a.headers[0]);try{for(l.s();!(i=l.n()).done;){var s=i.value;s in e&&(n[s]=e[s])}}catch(c){l.e(c)}finally{l.f()}o.push(n)})),r&&l.exports.Message.error("手机号不能为空"),r)return e.close();o.splice(0,1),console.log("import_datas",o);var i=n({import_datas:o},_.value);HTTP.post("upload_xml",i).then((function(t){console.log("res",t),l.exports.Message({type:"success",message:"文件上传成功!",offset:"20px"}),S.value=t.data.total_count,C.value=t.data.success_count,j.value=t.data.fail_count,e.close(),y.value=3,f("getList")}))}))},close:function(){y.value=1,w.value=[{name:""}],k.value=null,v.value=!1,T.value=!1},isShowTable:T,exportRecord:function(){O(),T.value=!0},tableData:L,get_history_import:O,handleExport:function(e){var t=l.exports.Loading.service({lock:!0,text:"正在导出数据...",spinner:"el-icon-loading",background:"rgba(255, 255, 255, 0.7)"}),a={name:"客户名称",source:"客户来源",video_link:"视频链接",belong_to_blogger:"所属博主",contact:"客户联系人",phone:"客户手机",tel:"客户电话",wechat:"客户微信",industry:"客户行业",remarks:"备注",reason:"失败原因"},o={list:[]};o.fileName="".concat(e.operator,"的导入失败记录 导入失败时间").concat(e.create_date),o.sheetName="导入失败记录",o.headers=a,o.list=e.fail_results,o.cols=[{width:20},{width:20},{width:50},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20},{width:20}];try{c(o),t.close(),l.exports.Message({type:"success",message:"导出成功!",offset:"20px"})}catch(n){l.exports.Message({type:"error",message:"导出失败!",offset:"20px"})}},downloadTemplate:function(){var e={offset:0,limit:9999,ordering:"-id",del_flag:0,status:1,is_default:0,company:d.getters.company};HTTP.get("used_customer_templates",e).then((function(e){0==e.code&&(0==e.data.results.length?l.exports.Message.error("暂无下载模板"):1==e.data.results.length?HTTP.post("download_clue_customer_template",{template_id:e.data.results[0].id,type:2}).then((function(e){if(0==e.code){var t=document.createElement("a");t.href="http://sms.9haoai.com/"+e.data,t.download="",t.style.display="none",document.body.appendChild(t),t.click(),setTimeout((function(){document.body.removeChild(t)}),100)}})):h.value.init())}))},getListClose:function(){y.value=1,w.value=[{name:""}],k.value=null,v.value=!1,T.value=!1,f("getList")},templateListDialog:a}}},(function(){var e,t=this,a=t._self._c,o=t._self._setupProxy;return a("el-drawer",{attrs:{title:o.title,visible:o.drawer,"before-close":o.getListClose,direction:"rtl","append-to-body":!0,"destroy-on-close":!0},on:{"update:visible":function(e){o.drawer=e}}},[o.isShowTable?t._e():a("div",[a("div",{staticClass:"steps"},[a("el-steps",{attrs:{active:o.isActive,"finish-status":"success"}},[a("el-step",{attrs:{title:"1.上传文件"}}),a("el-step",{attrs:{title:"2.确认导入"}}),a("el-step",{attrs:{title:"3.导入成功"}})],1)],1),a("div",{staticClass:"drawer_main"},[3!==o.isActive?a("div",[a("p",[t._v(" 一、请按照数据模板准备要导入的数据。"),a("el-button",{attrs:{type:"text"},on:{click:o.downloadTemplate}},[t._v("点击下载《客户模板》")])],1),a("p",{staticClass:"astrict"},[t._v("导入文件请勿超过2MB(约10000条数据)")]),a("p",[t._v("二、跟现有数据重复时,将无法导入。")]),a("p",[t._v("三、请选择需要导入的文件。")]),a("div",{staticStyle:{display:"flex","align-items":"center"}},[a("el-button",{attrs:{type:"primary"},on:{click:o.selectFile}},[t._v("选择文件")]),a("div",{staticStyle:{"margin-left":"15px"}},[t._v(t._s(null===(e=o.files[0])||void 0===e?void 0:e.name))])],1),a("input",{ref:"excel_upload_input",staticClass:"excel-upload-input",attrs:{type:"file",accept:".xlsx, .xls"},on:{change:o.inputChange}})]):t._e(),3===o.isActive?a("p",{staticClass:"steps"},[t._v(" 本次导入总数据"+t._s(o.total_count)+"条,成功"),a("span",{staticStyle:{color:"#55ca4a"}},[t._v(t._s(o.success_count))]),t._v("条数据,失败"),a("span",{staticStyle:{color:"#e7405c"}},[t._v(t._s(o.fail_count))]),t._v("条 ")]):t._e()]),a("div",{staticClass:"footer"},[a("el-button",{attrs:{type:"text"},on:{click:o.exportRecord}},[t._v("历史导出记录")]),a("div",{staticClass:"btn"},[a("el-button",{attrs:{type:"primary"},on:{click:o.close}},[t._v("取消")]),a("el-button",{attrs:{type:"primary",disabled:o.isImport},on:{click:o.readExcel}},[t._v("确认导入")])],1)],1)]),o.isShowTable?a("div",{staticClass:"table"},[a("el-table",{attrs:{data:o.tableData,border:"","header-cell-style":{background:"#F6FAFF"}}},[a("el-table-column",{attrs:{prop:"create_date",label:"导入时间",width:"200px"}}),a("el-table-column",{attrs:{prop:"operator",label:"操作人",width:"150px"}}),a("el-table-column",{attrs:{label:"导入结果"},scopedSlots:t._u([{key:"default",fn:function(e){var a=e.row;return[t._v(" 导入"+t._s(a.total_count)+"条,成功"+t._s(a.success_count)+"条,失败"+t._s(a.fail_count)+"条 ")]}}],null,!1,2343028739)}),a("el-table-column",{attrs:{label:"操作",width:"150px"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[a("el-button",{attrs:{type:"text"},on:{click:function(e){return o.handleExport(n)}}},[t._v("下载导入失败文件")])]}}],null,!1,3798198711)})],1),a("div",{staticClass:"footer",staticStyle:{"justify-content":"flex-end"}},[a("el-button",{attrs:{type:"primary"},on:{click:function(e){o.isShowTable=!o.isShowTable}}},[t._v("返回")])],1)],1):t._e(),a(o.templateListDialog,{ref:"templateListRef"})],1)}),[],!1,null,"c1e5f148",null,null).exports)}}}))}();