12 |
- import{E as e,R as a,o as l,r as s,u as t,O as i,a1 as r,a2 as d,F as o,k as c,l as n,X as u,p as v,v as p}from"../element-plus/element-plus.DqqeXZzT.js";import{d as m}from"../vuedraggable/vuedraggable.5P1kLX_e.js";import{h as f,_ as h}from"../../assets/index-DYMYfyXS.js";import{_}from"../lodash/lodash.S3QqMfIB.js";import{d as g,r as y,ae as b,o as k,J as w,K as x,a as V,O as C,T as A,Q as M,c as E,a9 as I,S,U as K,R as P,u as U,ba as D,b8 as N,i as $,n as j,L}from"../@vue/@vue.lccsL1Mu.js";const T=e=>(D("data-v-7392b274"),e=e(),N(),e),O={class:"my-header"},z=["id"],F={class:"container"},R={class:"indicator-wrapper"},B={class:"indicator-side"},J=["onClick"],Q={class:"indicator-body"},W=["id"],X={class:"indicator-group"},q={class:"indicator-drag"},G={class:"indicator-content"},H=T((()=>V("div",{class:"drag-title"},"已选指标",-1))),Y=T((()=>V("div",{class:"drag-sec"},"拖动可自定义指标顺序",-1))),Z={class:"indicator-limit_low"},ee={class:"drag-block"},ae=T((()=>V("div",{class:"drag-sepreate"},"以上指标将横向固定",-1))),le={class:"indicator-limit-many"},se={class:"drag-block mg2 flex_between"},te={class:"white-dh flex_1"},ie={class:"dialog-footer flex_between"},re={class:"flex flex_1"},de={style:{"margin-right":"30px"}},oe=P("取消"),ce=P("应用"),ne=h(g({__name:"indexDialog",emits:["saveSuccess"],setup(u,{expose:v,emit:p}){const h=y(!1),g=y("media_base"),D=y(""),N=y([]),$=y([]),j=y([]),L=y([]),T=y([]),ne=y(),ue=y(!1),ve=y(""),pe=y({}),me=()=>{if(ue.value&&(""==ve.value||!ve.value))return void e.warning("请输入自定义指标名");if(0==j.value.length)return void e.warning("请选择自定义指标");let a=[];var l;a=T.value.map((e=>e.key_value)),a=a.concat(L.value.map((e=>e.key_value))),pe.value&&pe.value.id?(l={temp_id:pe.value.id,name:ve.value,kpis:a},new Promise((async(a,s)=>{const t=await f.post("/api/ad/editAdKpisTemplate",l);0==t.errNo&&t.rst?a(t.rst):(e.error(t.errMsg),s())}))).then((a=>{e.success(`编辑自定义指标“${ve.value}”成功!`),h.value=!1,p("saveSuccess",{refreshList:1==pe.value.checked})})):function(a){return new Promise((async(l,s)=>{const t=await f.post("/api/ad/adKpisTemplateSave",a);0==t.errNo&&t.rst?l(t.rst):(e.error(t.errMsg),s())}))}({temp_type:ue.value?2:1,name:ue.value?ve.value:"",kpis:a,type:g.value}).then((a=>{ue.value?e.success(`新建并应用自定义指标“${ve.value}”成功!`):e.success("应用自定义指标成功!"),h.value=!1,p("saveSuccess",{refreshList:!0})}))},fe=()=>{if(D.value&&""!=D.value){let e=[];$.value.forEach((a=>{let l=_.cloneDeep(a);l.child.forEach((a=>{if(-1!=a.label.indexOf(D.value)){let s=e.filter((e=>e.key_value==l.key_value));s.length>0?s[0].child.push(a):e.push(Object.assign(l,{child:[a]}))}}))})),N.value=e}else N.value=_.cloneDeep($.value)},he=()=>{let e=T.value.map((e=>e.key_value));L.value=[],j.value.forEach((a=>{N.value.forEach((l=>{let s=l.child.filter((e=>e.key_value==a));s.length>0&&-1==e.indexOf(a)&&L.value.push(s[0])}))}))};return v({initFun:(l,s,t)=>{if(h.value=l,g.value=s,l){const l=a.service({lock:!0,text:"加载中",background:"rgba(255,255,255,0.6)"});(i={type:g.value},new Promise((async(a,l)=>{const s=await f.get("/api/ad/adDefaultKpis",i);0==s.errNo&&Array.isArray(s.rst)?a(s.rst):(e.error(s.errMsg),l())}))).then((a=>{Array.isArray(a)?(ue.value=!1,ve.value="",N.value=a,$.value=_.cloneDeep(a),a.length>0&&(ne.value=a[0].key_value),T.value=[],N.value.forEach((e=>{e.child.forEach((e=>{1==e.disabled&&T.value.push(e)}))})),t?.id?(ue.value=!0,ve.value=t.name,pe.value=t):pe.value={},function(a){return new Promise((async(l,s)=>{const t=await f.get("/api/ad/getAdKpisDetails",a);0==t.errNo&&t.rst?l(t.rst):(e.error(t.errMsg),s())}))}({type:g.value,temp_id:t?.id?t?.id:""}).then((e=>{l.close(),e.kpis&&(j.value=e.kpis.split(","),he())})).catch((()=>{l.close()}))):l.close()})).catch((()=>{l.close()}))}var i}}),(e,a)=>{const u=b("Search"),v=l,p=s,f=t,_=i,g=r,y=d,$=o,_e=b("CloseBold"),ge=c,ye=n;return k(),w(ye,{class:"gdt-dialog",modelValue:h.value,"onUpdate:modelValue":a[6]||(a[6]=e=>h.value=e),"close-on-click-modal":!1,"destroy-on-close":!0,"show-close":!1,width:"1098",top:"60px"},{header:x((({close:e,titleId:a,titleClass:l})=>[V("div",O,[V("h4",{id:a,class:C(l)},"自定义指标",10,z)])])),footer:x((()=>[V("div",ie,[V("div",re,[A(f,{style:{width:"160px","margin-left":"20px"},disabled:!(!pe.value||!pe.value.id),modelValue:ue.value,"onUpdate:modelValue":a[3]||(a[3]=e=>ue.value=e),label:"保存为常用自定义指标",size:"default"},null,8,["disabled","modelValue"]),ue.value?(k(),w(p,{key:0,style:{width:"260px","margin-left":"8px"},modelValue:ve.value,"onUpdate:modelValue":a[4]||(a[4]=e=>ve.value=e),modelModifiers:{trim:!0},placeholder:"请输入自定义指标名"},null,8,["modelValue"])):M("",!0)]),V("div",de,[A(ge,{onClick:a[5]||(a[5]=e=>h.value=!1)},{default:x((()=>[oe])),_:1}),A(ge,{type:"primary",onClick:me},{default:x((()=>[ce])),_:1})])])])),default:x((()=>[V("div",F,[A(p,{modelValue:D.value,"onUpdate:modelValue":a[0]||(a[0]=e=>D.value=e),modelModifiers:{trim:!0},onInput:fe,clearable:"",class:"seachWrap",placeholder:"输入指标名称搜索"},{append:x((()=>[A(v,null,{default:x((()=>[A(u)])),_:1})])),_:1},8,["modelValue"]),V("div",R,[V("div",B,[(k(!0),E(K,null,I(N.value,(e=>(k(),E("div",{class:C(["indicator-category",e.key_value==ne.value?"indicator-category--active":""]),onClick:a=>(e=>{ne.value=e.key_value;const a=document.getElementById(`indicators_parend_${e.key_value}`);a&&a.scrollIntoView({behavior:"smooth"})})(e)},S(e.label),11,J)))),256))]),V("div",Q,[A($,{modelValue:j.value,"onUpdate:modelValue":a[1]||(a[1]=e=>j.value=e),size:"default",onChange:he},{default:x((()=>[(k(!0),E(K,null,I(N.value,(e=>(k(),E("div",{class:"indicator-block",id:`indicators_parend_${e.key_value}`},[V("div",X,[V("span",null,S(e.label),1)]),A(y,{gutter:1},{default:x((()=>[(k(!0),E(K,null,I(e.child,(e=>(k(),w(g,{span:8},{default:x((()=>[A(_,{content:`${e.tooltip}`,disabled:!e.tooltip||e.tooltip==e.label&&e.label?.length<16,placement:"top"},{default:x((()=>[A(f,{class:"checkbox-item",label:e.key_value,disabled:1==e.disabled},{default:x((()=>[P(S(e.label),1)])),_:2},1032,["label","disabled"])])),_:2},1032,["content","disabled"])])),_:2},1024)))),256))])),_:2},1024)],8,W)))),256))])),_:1},8,["modelValue"])])])]),V("div",q,[V("div",G,[H,Y,V("div",Z,[(k(!0),E(K,null,I(T.value,(e=>(k(),E("div",ee,S(e.label),1)))),256))]),ae]),V("div",le,[A(U(m),{modelValue:L.value,"onUpdate:modelValue":a[2]||(a[2]=e=>L.value=e),"item-key":"key_value"},{item:x((({element:e})=>[V("div",se,[A(_,{content:e.label,disabled:e.label?.length<9,placement:"top"},{default:x((()=>[V("div",te,S(e.label),1)])),_:2},1032,["content","disabled"]),A(v,{class:"deleteIcon",onClick:a=>{return l=e,j.value=j.value.filter((e=>e!=l.key_value)),void he();var l}},{default:x((()=>[A(_e)])),_:2},1032,["onClick"])])])),_:1},8,["modelValue"])])])])),_:1},8,["modelValue"])}}}),[["__scopeId","data-v-7392b274"]]),ue=(e=>(D("data-v-0d2ca8b0"),e=e(),N(),e))((()=>V("div",{class:"selector-title"},"常用自定义指标",-1))),ve={class:"selector-con"},pe=["onClick"],me={class:"selector-icon"},fe=P("自定义指标"),he=h(g({__name:"index",props:{type:{default:"media_base"}},emits:["refresh"],setup(a,{emit:s}){const t=a,r=y(!1),d=y([]);$((()=>{j((()=>{o()}))}));const o=()=>{var a;r.value=!0,(a={type:t.type},new Promise((async(l,s)=>{const t=await f.get("/api/ad/getAdKpisTemplate",a);0==t.errNo&&Array.isArray(t.rst)?l(t.rst):(e.error(t.errMsg),s())}))).then((e=>{d.value=e,r.value=!1})).catch((()=>{r.value=!1}))},n=a=>{var l;r.value=!0,(l={temp_id:a.id,type:t.type},new Promise((async(a,s)=>{const t=await f.post("/api/ad/selectAdKpisTemplate",l);0==t.errNo&&t.rst?a(t.rst):(e.error(t.errMsg),s())}))).then((l=>{e.success(`自定义指标“${a.name}”应用成功!`),h({refreshList:!0}),r.value=!1})).catch((()=>{r.value=!1}))},m=a=>{var l;r.value=!0,(l={temp_id:a.id},new Promise((async(a,s)=>{const t=await f.post("/api/ad/delAdKpisTemplate",l);0==t.errNo&&t.rst?a(t.rst):(e.error(t.errMsg),s())}))).then((l=>{e.success(`删除自定义指标“${a.name}”成功!`),h({refreshList:!0}),r.value=!1})).catch((()=>{r.value=!1}))},h=e=>{e.refreshList&&s("refresh"),o()},_=y(),g=e=>{_.value?.initFun(!0,t.type,e)};return(e,a)=>{const s=i,t=b("EditPen"),o=l,f=b("Delete"),y=u,w=c,M=v,P=p;return k(),E(K,null,[A(M,{placement:"bottom",title:"",width:260,trigger:"click",disabled:d.value.length<=0},{reference:x((()=>[A(w,{icon:"SetUp",plain:"",onClick:a[1]||(a[1]=e=>d.value.length<=0&&g())},{default:x((()=>[fe])),_:1})])),default:x((()=>[L((k(),E("div",null,[ue,V("div",ve,[(k(!0),E(K,null,I(d.value,(e=>(k(),E("div",{class:C(["selector-item",1==e.checked&&"selector-item__active","flex_between"])},[A(s,{content:e.name,disabled:e.name?.length<14,placement:"top"},{default:x((()=>[V("div",{class:"selector-name",onClick:a=>n(e)},S(e.name),9,pe)])),_:2},1032,["content","disabled"]),V("div",me,[A(o,{class:"rMar5 pointer f14",onClick:a=>g(e)},{default:x((()=>[A(t)])),_:2},1032,["onClick"]),A(y,{title:"确定删除该模版?",width:"200",onConfirm:a=>m(e)},{reference:x((()=>[A(o,{class:"pointer f14"},{default:x((()=>[A(f)])),_:1})])),_:2},1032,["onConfirm"])])],2)))),256))]),V("div",{class:"selector-lock",onClick:a[0]||(a[0]=e=>g())},"自定义")])),[[P,r.value]])])),_:1},8,["disabled"]),A(ne,{ref_key:"IndicatorsRef",ref:_,onSaveSuccess:h},null,512)],64)}}}),[["__scopeId","data-v-0d2ca8b0"]]);export{he as I};
|