goview_vue/dist/static/js/index-7f30d867.js
2023-06-06 13:24:29 +08:00

2 lines
6.1 KiB
JavaScript

var j=(v,m,l)=>new Promise((b,o)=>{var _=r=>{try{u(l.next(r))}catch(p){o(p)}},w=r=>{try{u(l.throw(r))}catch(p){o(p)}},u=r=>r.done?b(r.value):Promise.resolve(r.value).then(_,w);u((l=l.apply(v,m)).next())});import{d as F,$ as k,j as R,aQ as z,J,r as s,o as A,D as P,w as t,b as e,n as H,e as c,t as h,u as a,h as G,be as K,O as W,a1 as X,b8 as Y,cB as Z,c as ee,d1 as E,bs as te,ab as O,bt as ae}from"./index-4ec2ce15.js";import{i as oe}from"./icon-42fa39e7.js";import{S as T}from"./SettingItem-35031211.js";import{S as I}from"./SettingItemBox-f60eaa4e.js";import"./chartEditStore-bfc6c223.js";import{u as L}from"./useTargetData.hook-06bbbd45.js";import{R as ne,a as se}from"./pondIndex.vue_vue_type_style_index_0_scoped_bc18493e_lang-51a9fc87.js";import{u as le}from"./useSync.hook-dcdbd18a.js";import"./index-8433d189.js";import"./EditorWorker-43e8cbc4.js";import"./editorWorker-43a98755.js";import"./chartLayoutStore-810503fe.js";import"./index-96c3a075.js";import{C as re}from"./index-9703cacc.js";/* empty css */import"./plugin-ae137233.js";import"./project.api-0931840b.js";import"./index-64867e41.js";import"./CollapseItem.vue_vue_type_script_setup_true_lang-77b092a0.js";import"./index.esm.min-2eecdcbd.js";import"./fileTypeEnum-21359a08.js";const ce={class:"go-pr-3"},ue=F({__name:"index",props:{modelShow:Boolean,targetData:Object,saveBtnText:String||null},emits:["update:modelShow","sendHandle"],setup(v,{emit:m}){const l=v,{targetData:b}=L(),{dataSyncUpdate:o}=le(),{chartConfig:_}=k(l.targetData),{requestContentType:w}=k(l.targetData.request),u=R(!1),r={[z.DEFAULT]:"普通请求",[z.SQL]:"SQL 请求"};J(()=>l.modelShow,i=>{u.value=i},{immediate:!0});const p=()=>{m("update:modelShow",!1),m("sendHandle"),o()};return(i,f)=>{const q=s("n-space"),S=s("n-scrollbar"),g=s("n-text"),U=s("n-tag"),x=s("n-button"),B=s("n-card"),d=s("n-modal");return A(),P(d,{class:"go-chart-data-request",show:u.value,"onUpdate:show":f[0]||(f[0]=n=>u.value=n),"mask-closable":!1,closeOnEsc:!1},{default:t(()=>[e(B,{bordered:!1,role:"dialog",size:"small","aria-modal":"true",style:{width:"1000px",height:"800px"}},{header:t(()=>[]),"header-extra":t(()=>[]),action:t(()=>[e(q,{justify:"space-between"},{default:t(()=>[H("div",null,[e(g,null,{default:t(()=>[c("「 "+h(a(_).categoryName)+" 」",1)]),_:1}),e(g,null,{default:t(()=>[c("—— ")]),_:1}),e(U,{type:"primary",bordered:!1,style:{"border-radius":"5px"}},{default:t(()=>[c(h(r[a(w)]),1)]),_:1})]),e(x,{type:"primary",onClick:p},{default:t(()=>[c(h(v.saveBtnText||"保存 & 发送请求"),1)]),_:1})]),_:1})]),default:t(()=>[e(S,{style:{"max-height":"718px"}},{default:t(()=>[H("div",ce,[e(q,{vertical:""},{default:t(()=>{var n;return[e(a(ne)),e(a(se),{"target-data-request":(n=a(b))==null?void 0:n.request},null,8,["target-data-request"])]}),_:1})])]),_:1})]),_:1})]),_:1},8,["show"])}}}),de=G(ue,[["__scopeId","data-v-3ec3a7fe"]]),ie={class:"go-chart-configurations-data-ajax"},pe={class:"go-absolute-center"},me=F({__name:"index",setup(v){K(d=>({"72bc7361":B.value}));const{HelpOutlineIcon:m,FlashIcon:l,PulseIcon:b}=oe.ionicons5,{targetData:o,chartEditStore:_}=L(),{requestOriginUrl:w,requestInterval:u,requestIntervalUnit:r}=k(_.getRequestGlobalConfig),p=W(),i=R(!1),f=R(!1),q=R(!1);let S=0,g;const U=()=>{f.value=!0},x=()=>j(this,null,function*(){var d;if((d=o.value)!=null&&d.request){i.value=!0;try{const n=yield te(O(o.value.request),O(_.getRequestGlobalConfig));if(i.value=!1,n){const{data:C}=n;!C&&!o.value.filter&&window.$message.warning("您的数据不符合默认格式,请配置过滤器!"),o.value.option.dataset=ae(C,n,o.value.filter),q.value=!0;return}window.$message.warning("没有拿到返回值,请检查接口!")}catch(n){console.error(n),i.value=!1,window.$message.warning("数据异常,请检查参数!")}}}),B=X(()=>p.getAppTheme);return Y(()=>{var n;const d=(n=o.value)==null?void 0:n.filter;g!==d&&S&&(g=d,x()),S++}),Z(()=>{g=null}),(d,n)=>{const C=s("n-tag"),y=s("n-input"),D=s("n-icon"),$=s("n-button"),N=s("n-card"),Q=s("n-tooltip"),V=s("go-skeleton");return A(),ee("div",ie,[e(N,{class:"n-card-shallow"},{default:t(()=>[e(a(I),{name:"请求配置"},{default:t(()=>[e(a(T),{name:"类型"},{default:t(()=>[e(C,{bordered:!1,type:"primary",style:{"border-radius":"5px"}},{default:t(()=>[c(h(a(o).request.requestContentType===a(z).DEFAULT?"普通请求":"SQL请求"),1)]),_:1})]),_:1}),e(a(T),{name:"方式"},{default:t(()=>[e(y,{size:"small",placeholder:a(o).request.requestHttpType||"暂无",disabled:!0},null,8,["placeholder"])]),_:1}),e(a(T),{name:"组件间隔"},{default:t(()=>[e(y,{size:"small",placeholder:`${a(o).request.requestInterval||"暂无"}`,disabled:!0},{suffix:t(()=>[c(h(a(E)[a(o).request.requestIntervalUnit]),1)]),_:1},8,["placeholder"])]),_:1}),e(a(T),{name:"全局间隔(默认)"},{default:t(()=>[e(y,{size:"small",placeholder:`${a(u)||"暂无"} `,disabled:!0},{suffix:t(()=>[c(h(a(E)[a(r)]),1)]),_:1},8,["placeholder"])]),_:1})]),_:1}),e(a(I),{name:"源地址",alone:!0},{default:t(()=>[e(y,{size:"small",placeholder:a(w)||"暂无",disabled:!0},{prefix:t(()=>[e(D,{component:a(b)},null,8,["component"])]),_:1},8,["placeholder"])]),_:1}),e(a(I),{name:"组件地址",alone:!0},{default:t(()=>[e(y,{size:"small",placeholder:a(o).request.requestUrl||"暂无",disabled:!0},{prefix:t(()=>[e(D,{component:a(l)},null,8,["component"])]),_:1},8,["placeholder"])]),_:1}),H("div",{class:"edit-text",onClick:U},[H("div",pe,[e($,{type:"primary",secondary:""},{default:t(()=>[c("编辑配置")]),_:1})])])]),_:1}),e(a(I),{alone:!0},{name:t(()=>[c(" 测试 "),e(Q,{trigger:"hover"},{trigger:t(()=>[e(D,{size:"21",depth:3},{default:t(()=>[e(a(m))]),_:1})]),default:t(()=>[c(" 默认赋值给 dataset 字段 ")]),_:1})]),default:t(()=>[e($,{type:"primary",ghost:"",onClick:x},{icon:t(()=>[e(D,null,{default:t(()=>[e(a(l))]),_:1})]),default:t(()=>[c(" 发送请求 ")]),_:1})]),_:1}),e(a(re),{show:q.value&&!i.value,ajax:!0},null,8,["show"]),e(V,{load:i.value,repeat:3},null,8,["load"]),e(a(de),{modelShow:f.value,"onUpdate:modelShow":n[0]||(n[0]=M=>f.value=M),targetData:a(o),onSendHandle:x},null,8,["modelShow","targetData"])])}}});const je=G(me,[["__scopeId","data-v-7cdcb3c8"]]);export{je as default};