You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.8 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{o as z,r as d,c as L,d as p,e as _,k as r,q as x,h as T,i as u,f as v,w as g,aX as j,E as m,bk as A,F as b,t as V,j as w,g as R}from"./index-e65958bd.js";const D={style:{display:"flex"}},F={style:{width:"750px","margin-right":"40px"}},G={style:{display:"flex"}},S={style:{display:"flex","justify-content":"center","align-items":"center"}},X={__name:"RatioMngr",setup(q){let t=R([]),c=R(!1);const h=()=>{c.value=!0,j({}).then(o=>{c.value=!1,o.status?t.value=o.data:m.error(o.msg)})},C=()=>{let o=!1,e=0;if(t.value.forEach((l,n)=>{l.ratio>=0&&l.ratio<=100?e=e+Number(l.ratio):m.error("第"+(n+1)+"个渠道数据不正确")}),e==100?o=!0:(o=!1,m.error("各渠道总和应为100当前为"+e)),!o)return!1;c.value=!0,A({ratioInfo:t.value}).then(l=>{c.value=!1,l.status?(m({message:"保存成功",type:"success"}),h()):m.error(l.msg)})},I=o=>t.value.filter(e=>e.id!==o.id),E=(o,e)=>{const l=t.value[o].id;t.value.forEach(n=>{if(n.id===l)return;const s=e.includes(n.id),f=n.link.includes(l);s&&!f?n.link.push(l):!s&&f&&(n.link=n.link.filter(y=>y!==l))})},B=(o,e)=>{const l=t.value[o].id,n=t.value.find(s=>s.id===e);n&&(n.link=n.link.filter(s=>s!==l))};return z(()=>{h()}),(o,e)=>{const l=d("el-input"),n=d("el-option"),s=d("el-select"),f=d("el-form-item"),y=d("el-form"),M=d("el-button"),N=L("loading");return p(),_("div",null,[e[3]||(e[3]=r("div",{style:{margin:"12px",color:"#999"}},[x(" 设置说明: "),r("div",null,"1预约渠道设置默认数量百分比用于为“预约计划”按比例自动分配数量此次设置各个渠道的数值总数应为100如果不想给某个渠道分配可设置为0 "),r("div",null," 2渠道合并合并后的号源池可共用 ")],-1)),T((p(),_("div",D,[r("div",F,[v(y,{model:u(t),"label-width":"auto",style:{"max-width":"600px"}},{default:g(()=>[(p(!0),_(b,null,V(u(t),(k,i)=>(p(),w(f,{key:i,label:k.name},{default:g(()=>[r("div",G,[v(l,{size:"large",type:"number",min:"0",max:"100",modelValue:u(t)[i].ratio,"onUpdate:modelValue":a=>u(t)[i].ratio=a,style:{"margin-left":"10px",width:"250px"}},null,8,["modelValue","onUpdate:modelValue"]),e[0]||(e[0]=r("div",{style:{"margin-left":"10px","margin-right":"40px"}},"%",-1)),e[1]||(e[1]=r("div",{style:{width:"100px",color:"#75b96c"}},"号源池合并",-1)),v(s,{size:"large",modelValue:u(t)[i].link,"onUpdate:modelValue":a=>u(t)[i].link=a,multiple:"",placeholder:"未合并",style:{width:"240px"},onRemoveTag:a=>B(i,a),onChange:a=>E(i,u(t)[i].link)},{default:g(()=>[(p(!0),_(b,null,V(I(k),(a,U)=>(p(),w(n,{key:U,label:a.name,value:a.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onRemoveTag","onChange"])])]),_:2},1032,["label"]))),128))]),_:1},8,["model"])]),r("div",S,[v(M,{type:"primary",onClick:C,style:{height:"70px",width:"100px"}},{default:g(()=>[...e[2]||(e[2]=[x(" 确定 ",-1)])]),_:1})])])),[[N,u(c)]])])}}};export{X as default};