import{I as F}from"./IndexPagePro-904e4e7b.js";import{_ as N}from"./index.vue_vue_type_script_setup_true_name_SearchForm_lang-692eb4fd.js";import O from"./index-5cc06ed5.js";import{g as M,a as P,j as V,b as B}from"./common-8a6acaa7.js";import{g as L}from"./tagManage-2aab0a1e.js";import{d as E,p as n,o as K,i as b,a as z,z as I,m as _,k as l,e as r}from"./index-deffec86.js";const Q=E({__name:"activetyStatistics",setup(J){const i=n([]),g=n(!1),s=n("53"),o=n({}),u=n(""),y=n([]),f=n([]),h=n([]),v=n([{label:"\u9879\u76EE\u5206\u7C7B",prop:"type_tag_ids",enum:h,fieldNames:{value:"tag_id",label:"tag_id_str",children:"tag_id_arr"},search:{el:"cascader",props:{props:{multiple:!0},collapseTags:!0},placeholder:"\u8BF7\u9009\u62E9\u9879\u76EE\u5206\u7C7B"}},{label:"\u4E3E\u529E\u5E74\u4EFD",prop:"year",search:{el:"date-picker",props:{type:"year",format:"YYYY",valueFormat:"YYYY"},placeholder:"\u8BF7\u9009\u62E9\u4E3E\u529E\u5E74\u4EFD"}},{label:"\u65F6\u95F4\u7B5B\u9009",prop:"times",search:{el:"date-picker",props:{type:"daterange",format:"YYYY/MM/DD",valueFormat:"YYYY-MM-DD"},placeholder:"\u8BF7\u9009\u62E9\u65F6\u95F4"}}]),Y=async()=>{const{data:e}=await L({page:1,size:999,type:"event_activity_plan_project_kind",is_show_tag_id:1});e.list.forEach(a=>{a.tag_id=a.tag_group_id,a.tag_id_str=a.name}),h.value=e.list.filter(a=>a.tag_id_arr&&a.tag_id_arr.length)},j=async()=>{var t;let e=await M({with_up:0});f.value=e.data;let a=(t=e==null?void 0:e.data[0])==null?void 0:t.company_area_id;y.value=[a],u.value=String(a)},m=n({}),w=async e=>{const{data:a}=await B({company_area_id:e,level:`${e}`.length>4?4:""});o.value={},a[0].next.forEach(t=>{o.value[t.company_area_id]=t.name})},C=e=>{if(e=JSON.parse(JSON.stringify(e)),e.type_tag_ids&&e.type_tag_ids.length>0){let a=[];e.type_tag_ids.forEach(t=>{t instanceof Array?a.push(t[t.length-1]):a.push(t)}),e.type_tag_ids=a.join(",")}return e.times&&e.times.length&&(e.end_date=e.times[1],e.start_date=e.times[0],delete e.times),e.year||(e.year="all"),e},p=async()=>{await w(s.value),g.value=!0;const{data:e}=await P({...C(m.value),company_area_id:s.value}),{count:a,join_num:t,match_number:d,plan_count:x,plan_join_num:T,plan_match_num:D}=e;e.area_data?(i.value=Object.keys(o.value).map(c=>e.area_data[c]?(e.area_data[c].type_name=o.value[c],e.area_data[c]):{type_name:o.value[c],count:0,join_num:0,match_number:0,plan_count:0,plan_join_num:0,plan_match_num:0}),i.value.push({type_name:"\u5408\u8BA1",count:a,join_num:t,match_number:d,plan_count:x,plan_join_num:T,plan_match_num:D})):i.value=[],g.value=!1},S=()=>{m.value={},p()},A=async()=>{const{data:e}=await V({});v.value[0].enum=e.map(a=>({label:a.name,value:a.type_id}))},k=({type:e,value:a})=>{e==="custom"?s.value=Array.isArray(a)?a.join(","):String(a):s.value=String(a),p()};return K(async()=>{await j(),Y(),s.value=u.value,await A(),p()}),(e,a)=>{const t=b("el-table-column"),d=b("el-table");return z(),I(F,{filterWidth:280},{treeCard:_(()=>[l(O,{ref:"TreeFilterRef",title:"\u533A\u57DF",data:r(f),defaultValue:r(u),expandKeys:r(y),onChange:k},null,8,["data","defaultValue","expandKeys"])]),searchForm:_(()=>[l(N,{"search-param":r(m),columns:r(v),search:p,reset:S},null,8,["search-param","columns"])]),default:_(()=>[l(d,{data:r(i),border:"",style:{width:"100%"}},{default:_(()=>[l(t,{prop:"type_name",label:"\u533A\u57DF\u540D\u79F0",align:"center"}),l(t,{prop:"plan_count",label:"\u8D5B\u4E8B\u6D3B\u52A8\u8BA1\u5212",align:"center"}),l(t,{prop:"count",label:"\u8D5B\u4E8B\u6D3B\u52A8\u6570\u91CF",align:"center"}),l(t,{prop:"plan_match_num",label:"\u9884\u8BA1\u4E3E\u529E\u573A\u6B21",align:"center"}),l(t,{prop:"match_number",label:"\u5B9E\u9645\u4E3E\u529E\u573A\u6B21",align:"center"}),l(t,{prop:"plan_join_num",label:"\u9884\u8BA1\u53C2\u4E0E\u4EBA\u6570",align:"center"}),l(t,{prop:"join_num",label:"\u5B9E\u9645\u53C2\u4E0E\u4EBA\u6570",align:"center"})]),_:1},8,["data"])]),_:1})}}});export{Q as default};
