"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[3120],{3302:function(t,e,s){s.r(e),s.d(e,{default:function(){return c}});var a=function(){var t=this,e=t._self._c;return e("Modal",{ref:"modal",attrs:{autoOpen:!0,fullHeight:!0},on:{closed:function(e){return t.$emit("closed")}}},[e("div",{staticClass:"uk-padding-small"},[e("h4",{staticClass:"uk-margin-remove"},[t._v(" Отчеты c "),e("DatePicker",{staticStyle:{width:"130px"},attrs:{format:"DD.MM.YYYY",lang:"ru",editable:!1,"append-to-body":!0,"first-day-of-week":1},model:{value:t.from,callback:function(e){t.from=e},expression:"from"}}),t._v(" по "),e("DatePicker",{staticStyle:{width:"130px"},attrs:{format:"DD.MM.YYYY",lang:"ru",editable:!1,"append-to-body":!0,"first-day-of-week":1},model:{value:t.to,callback:function(e){t.to=e},expression:"to"}})],1)]),e("div",{staticClass:"uk-padding-small",staticStyle:{"flex-grow":"1","min-height":"1px",overflow:"auto",position:"relative"}},[null===t.reports?e("loader"):t.reports.length?e("ul",{staticClass:"pos-list"},t._l(t.reports,(function(s,a){return e("li",{key:a,staticClass:"pos-list-item"},[e("div",{staticClass:"pos-list-item-status",class:{success:"DONE"===s.STATE,warning:"DONE"!==s.STATE}}),e("div",{staticClass:"pos-list-item-body"},[e("div",{staticClass:"pos-list-item-body-content"},[e("h5",[t._v(t._s(s.REPORT_NAME))]),"DONE"===s.STATE?e("div",[t._v(" Скачать: "),e("span",t._l(s.links,(function(s){return e("a",{key:s.url,attrs:{href:s.url,target:"_blank"}},[t._v(t._s(s.name))])})),0)]):t._e(),"DONE"!==s.STATE?e("div",[e("a",{attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.cancelReport(s)}}},[t._v("отмена")])]):t._e()]),e("div",{staticClass:"pos-list-item-body-footer"},[e("ul",{staticClass:"pos-list-item-body-meta"},[e("li",{staticClass:"pos-list-item-body-meta-item"},[e("div",[e("div",{staticClass:"pos-list-item-body-meta-item--key"},[t._v(" Дата: ")]),e("div",{staticClass:"pos-list-item-body-meta-item--val"},[t._v(" "+t._s(s.REP_DATE)+" ")])])]),e("li",{staticClass:"pos-list-item-body-meta-item"},[e("div",[e("div",{staticClass:"pos-list-item-body-meta-item--key"},[t._v(" Состояние: ")]),e("div",{staticClass:"pos-list-item-body-meta-item--val"},[t._v(" "+t._s(t.states[s.STATE])+" ")])])])])])])])})),0):e("h3",[t._v("Отчеты не найдены")])],1)])},r=[],i=s(3216),o=s(9148),l={name:"ModalReportsAppserv",components:{Modal:()=>s.e(8362).then(s.bind(s,2215)),Loader:()=>s.e(8326).then(s.bind(s,1259))},data(){return{from:o().subtract(1,"M").toDate(),to:o().toDate(),reports:null,states:{RUNNING:"выполняется",DONE:"готов"}}},watch:{from(){this.reports=null,this.reload()},to(){this.reports=null,this.reload()}},mounted(){this.interval=setInterval((()=>{this.reload()}),1e4),this.reload()},beforeDestroy(){this.interval&&(clearInterval(this.interval),this.interval=null)},methods:{async reload(){let t=await i.vd.select("CRM_GET_USER_REPORT_LIST",{date_from:o(this.from).format("DD.MM.YYYY"),date_to:o(this.to).format("DD.MM.YYYY")},100);t.forEach((t=>{t.links=[],t.RESULT_TYPE||(t.RESULT_TYPE=""),-1!==t.RESULT_TYPE.indexOf("FASTREPORT2")?t.OUT_FORMAT.split(",").forEach((e=>{t.links.push({name:e,url:i.$W.reporter+"/report/get?token="+i.FH.token+"&report="+t.DOC_REPORT_ID+"&delayed_rep=1&format="+e})})):-1!==t.RESULT_TYPE.indexOf("FASTREPORT")?t.OUT_FORMAT.split(",").forEach((e=>{t.links.push({name:e,url:i.$W.oldReporter+"result?token="+i.FH.token+"&report="+t.DOC_REPORT_ID+"&delayed_rep=1&format="+e})})):"TABLE"===t.RESULT_TYPE||"EXCEL"===t.RESULT_TYPE?t.links.push({name:"xls",url:i.$W.reporter+"report/getReportResult?token="+i.FH.token+"&report="+t.DOC_REPORT_ID+"&format=rawxml"}):"ACCESS"===t.RESULT_TYPE&&t.links.push({name:"xls",url:i.$W.reporter+"report/getReportResult?token="+i.FH.token+"&report="+t.DOC_REPORT_ID+"&format=access"})})),this.reports=t},async cancelReport(t){this.reports=null,await i.vd.query("CRM_STOP_REPORT_JOB",{report_id:t.DOC_REPORT_ID}),await this.reload()}}},n=l,d=s(1656),p=(0,d.A)(n,a,r,!1,null,null,null),c=p.exports}}]);
//# sourceMappingURL=ModalReportsAppserv.01bd3f14.js.map