modal.ffdded.js 6.3 KB

1
  1. import{_ as $,d as G,w as y,ag as J,bs as O,x as L,r as o,o as r,G as _,C as t,j as u,l,c as h,F as V,D as A,h as T,J as U,a as M,M as H,aq as K,aN as k}from"./index.js";import{d as Q}from"./index.da6d65fd.js";import{d as W,e as X}from"./index.b7e2fe70.js";import Y from"./platform-modal.118c44.js";const _e=[{value:"0",label:"\u7981\u7528",type:"warning"},{value:"1",label:"\u542F\u7528",type:"success"}],Z=[{value:"0",label:"\u65E0\u5BF9\u63A5"},{value:"1",label:"\u6709\u8D5E\u5E73\u53F0"},{value:"2",label:"BBC"}],ee=[{value:"1",label:"ToB"},{value:"2",label:"ToC"}],le=[{value:"0",label:"\u4E0D\u9009\u652F\u4ED8\u6E20\u9053"},{value:"1",label:"\u9009\u62E9\u652F\u4ED8\u6E20\u9053"}],ue={platform_name:[{required:!0,message:"\u5E73\u53F0\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],platform_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u5BF9\u63A5\u5E73\u53F0",trigger:"change"}],use_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u5E73\u53F0\u7C7B\u578B",trigger:"change"}],is_select_pay_rate:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u5F00\u542F\u652F\u4ED8\u6E20\u9053",trigger:"change"}],pay_list:[{type:"array",required:!0,message:"\u5185\u5BB9\u914D\u7F6E\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}]},ae=()=>({use_type:"1",platform_name:"",platform_type:"0",is_select_pay_rate:"0",pay_list:[],desc:0}),te={class:"flex justify-between"},se=T("p",null,"\u64CD\u4F5C",-1),oe={class:"flex w-full justify-end"},ne=G({__name:"modal",props:{data:{type:null,required:!0},visible:{type:Boolean,required:!0},disabled:{type:Boolean,required:!0}},emits:["refresh"],setup(x,{emit:j}){const F=x,z=y([]),N=J(()=>a.value.id?F.disabled?"\u67E5\u770B\u5E73\u53F0":"\u7F16\u8F91\u5E73\u53F0":"\u6DFB\u52A0\u5E73\u53F0"),a=O(F,"data"),c=O(F,"visible"),v=y(!1),q=y(null);async function R(){const i=await Q({size:100});z.value=i.code===0?i.data.list:[]}function I(){a.value=ae(),c.value=!1}const b=y(!1);async function S(){try{await q.value.validate();const{id:i,platform_name:s,platform_type:B,use_type:p,is_select_pay_rate:m,pay_list:f,desc:E}=a.value,n={id:i,platform_name:s,platform_type:B,use_type:p,is_select_pay_rate:m,pay_list:f,desc:E},d=i===void 0||!i;if(n.is_select_pay_rate==="1")if(n.pay_list.length===0){k.warning("\u8BF7\u6DFB\u52A0\u81F3\u5C11\u4E00\u4E2A\u652F\u4ED8\u6E20\u9053!");return}else n.pay_list=n.pay_list.map(({id:C,...w})=>({...w,channel_id:C}));else n.pay_list=[];d&&delete n.id;const g=d?W:X;b.value=!0;const D=await g(n);b.value=!1,D.code===0?(c.value=!1,k.success(`${d?"\u6DFB\u52A0":"\u66F4\u65B0"}\u6210\u529F`),j("refresh")):k.warning(`${d?"\u6DFB\u52A0":"\u66F4\u65B0"}\u5931\u8D25`)}catch{}}return L(R),(i,s)=>{const B=o("ElInput"),p=o("ElFormItem"),m=o("ElCol"),f=o("ElOption"),E=o("ElSelect"),n=o("ElTableColumn"),d=o("ElButton"),g=o("ElTooltip"),D=o("ElTable"),C=o("ElRow"),w=o("ElForm"),P=o("ElDialog");return r(),_(P,{modelValue:l(c),"onUpdate:modelValue":s[7]||(s[7]=e=>K(c)?c.value=e:null),title:l(N),center:"",onClose:I},{default:t(()=>[u(w,{model:l(a),rules:l(ue),size:"small",ref_key:"formRef",ref:q,disabled:x.disabled},{default:t(()=>[u(C,{gutter:10},{default:t(()=>[u(m,{span:24},{default:t(()=>[u(p,{label:"\u5E73\u53F0\u540D\u79F0",prop:"platform_name"},{default:t(()=>[u(B,{modelValue:l(a).platform_name,"onUpdate:modelValue":s[0]||(s[0]=e=>l(a).platform_name=e),style:{width:"100%"},placeholder:"\u5E73\u53F0\u540D\u79F0",maxlength:50,"show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),u(m,{span:8},{default:t(()=>[u(p,{label:"\u5E73\u53F0\u7C7B\u578B",prop:"use_type"},{default:t(()=>[u(E,{modelValue:l(a).use_type,"onUpdate:modelValue":s[1]||(s[1]=e=>l(a).use_type=e),disabled:l(a).id,style:{width:"100%"},placeholder:"\u5E73\u53F0\u7C7B\u578B"},{default:t(()=>[(r(!0),h(V,null,A(l(ee),e=>(r(),_(f,{key:e.value,value:e.value,label:e.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),u(m,{span:8},{default:t(()=>[u(p,{label:"\u5BF9\u63A5\u5E73\u53F0",prop:"platform_type"},{default:t(()=>[u(E,{modelValue:l(a).platform_type,"onUpdate:modelValue":s[2]||(s[2]=e=>l(a).platform_type=e),disabled:l(a).id,style:{width:"100%"},placeholder:"\u5BF9\u63A5\u5E73\u53F0"},{default:t(()=>[(r(!0),h(V,null,A(l(Z),e=>(r(),_(f,{key:e.value,value:e.value,label:e.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),u(m,{span:8},{default:t(()=>[u(p,{label:"\u662F\u5426\u5F00\u542F\u652F\u4ED8\u6E20\u9053",prop:"is_select_pay_rate"},{default:t(()=>[u(E,{modelValue:l(a).is_select_pay_rate,"onUpdate:modelValue":s[3]||(s[3]=e=>l(a).is_select_pay_rate=e),disabled:l(a).id,style:{width:"100%"},placeholder:"\u662F\u5426\u5F00\u542F\u652F\u4ED8\u6E20\u9053"},{default:t(()=>[(r(!0),h(V,null,A(l(le),e=>(r(),_(f,{key:e.value,value:e.value,label:e.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),l(a).is_select_pay_rate==="1"?(r(),_(m,{key:0,span:24},{default:t(()=>[u(p,{label:"\u652F\u4ED8\u6E20\u9053"},{default:t(()=>[u(D,{data:l(a).pay_list,border:"",size:"small","max-height":"200px"},{default:t(()=>[u(n,{label:"\u6E20\u9053\u540D\u79F0",prop:"channel_name",showOverflowTooltip:""}),u(n,{label:"\u4E1A\u52A1\u516C\u53F8",prop:"companyName",showOverflowTooltip:""}),l(a).id?M("v-if",!0):(r(),_(n,{key:0,label:"\u64CD\u4F5C",width:"80px"},{header:t(()=>[T("div",te,[se,u(g,{placement:"top",content:"\u6DFB\u52A0"},{default:t(()=>[u(d,{size:"small",type:"primary",link:"",icon:l(U)("add"),onClick:s[4]||(s[4]=e=>v.value=!0)},null,8,["icon"])]),_:1})])]),default:t(({$index:e})=>[u(d,{size:"small",type:"primary",link:"",icon:l(U)("delete"),onClick:()=>l(a).pay_list.splice(e,1)},null,8,["icon","onClick"])]),_:1}))]),_:1},8,["data"])]),_:1})]),_:1})):M("v-if",!0)]),_:1}),T("div",oe,[u(d,{type:"primary",loading:b.value,onClick:S},{default:t(()=>[H("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1},8,["model","rules","disabled"]),u(Y,{visible:v.value,"onUpdate:visible":s[5]||(s[5]=e=>v.value=e),pay_list:l(a).pay_list,"onUpdate:pay_list":s[6]||(s[6]=e=>l(a).pay_list=e)},null,8,["visible","pay_list"])]),_:1},8,["modelValue","title"])}}});var re=$(ne,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/terrace/components/modal.vue"]]),ce=Object.freeze(Object.defineProperty({__proto__:null,default:re},Symbol.toStringTag,{value:"Module"}));export{re as M,ae as i,ce as m,Z as p,_e as s};