import{ap as h,m as b,aU as k,aV as L,_ as A}from"./index-design-C8wrC2s6.js";import{d as Q,aQ as S,aR as W,f as I,w as X,r as V,e as C,M as j,O as f,a4 as l,Y as a,a1 as F,R as g,_ as Y,ab as n,X as $,u as p,U as G,V as H}from"./vue-BQyCGvUQ.js";import{v as J,d as K,A as Z,B as ee,k as le,l as te,m as N,e as P}from"./element-plus-DXXGg0hD.js";const se={class:"controller-event px-3"},ae={class:"mb-1"},oe={class:"flex flex-row flex-nowrap"},ie={class:"flex flex-row justify-center mt-3"},ue={class:"flex flex-row justify-center"},re=Q({__name:"BusinessRuleListDialog",props:S({visible:{type:Boolean},zxlPrdId:{},objectObId:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:["update:visible"],setup(D){const d=D,m=W(D,"visible"),c=I([]),y=I(!1),x=async()=>{const i=d.objectObId;if(!i){c.value=[];return}y.value=!0;try{const e=await k({url:"/zxl_pm/request/bizRule.svc",method:"get",params:{cmd:"getListWithObject",zxlPrdId:d.zxlPrdId,objectObId:i}});c.value=e||[]}catch{c.value=[]}y.value=!1};X(m,i=>{x()},{immediate:!0});const s=V({visible:!1,type:"add",loading:!1,row:null}),B=C(()=>s.type==="add"),z=C(()=>s.type==="edit"),w=C(()=>s.type==="detail"),O=I(),u=V({ruleTitle:"",ruleDesc:""}),U=V({ruleTitle:[h.requireChange,h.nonNullStr]}),q=async()=>{if(!await O.value?.validate())return;const e=d.objectObId;if(!e){b({type:"warning",message:"请先绑定所属操作！"});return}s.loading=!0;try{const{ruleTitle:o,ruleDesc:r}=u,v={objectObId:e,ruleObId:z.value?s.row?.ruleObId:"",zxlPrdId:d.zxlPrdId,ruleTitle:o,ruleDesc:r};B.value&&delete v.ruleObId;const R=await k({url:"/zxl_pm/request/bizRule.svc",method:"post",params:{cmd:"saveOrUpdate"},data:v});b({type:"success",message:`${B.value?"新增":"修改"}业务规则成功`}),s.visible=!1,x()}catch(o){b({type:"error",message:o||"操作失败！"})}s.loading=!1},_=(i,e)=>{s.visible=!0,s.type=i,s.row=e||null,u.ruleTitle=e?.ruleTitle||"",u.ruleDesc=e?.ruleDesc||""},M=async i=>{if(await L({message:"确认要删除当前业务规则？",title:"提示",confirmButtonText:"确定",showCancelButton:!0,cancelButtonText:"取消",confirmButtonClass:"message-box-confim",cancelButtonClass:"message-box-cancel el-button--primary"}).then(()=>!0))try{await k({url:"/zxl_pm/request/bizRule.svc",method:"post",params:{cmd:"delete"},data:{zxlPrdId:d.zxlPrdId,ruleObId:i.ruleObId}}),x()}catch(o){b({type:"error",message:o||"操作失败！"})}};return(i,e)=>{const o=K,r=ee,v=Z,R=le,T=J;return f(),j(H,null,[l(R,{class:"business-rule-list-dialog",modelValue:m.value,"onUpdate:modelValue":e[2]||(e[2]=t=>m.value=t),onClose:t=>null,title:"业务规则","append-to-body":!0},{default:a(()=>[F((f(),j("div",se,[g("div",ae,[l(o,{type:"primary",text:"",onClick:e[0]||(e[0]=Y(t=>_("add"),["stop"]))},{default:a(()=>[...e[6]||(e[6]=[n("新增",-1)])]),_:1})]),l(v,{data:c.value,stripe:"","show-header":!0},{default:a(()=>[l(r,{prop:"ruleNo",label:"业务规则编号",width:"110"}),l(r,{prop:"ruleTitle",label:"标题","show-overflow-tooltip":""}),l(r,{prop:"ruleDesc",label:"规则说明","show-overflow-tooltip":"",width:"200"}),l(r,{prop:"ruleNote",label:"操作",width:"150"},{default:a(({row:t})=>[g("div",oe,[l(o,{type:"primary",link:"",onClick:E=>_("detail",t)},{default:a(()=>[...e[7]||(e[7]=[n("详情",-1)])]),_:1},8,["onClick"]),l(o,{type:"primary",link:"",onClick:E=>_("edit",t)},{default:a(()=>[...e[8]||(e[8]=[n("修改",-1)])]),_:1},8,["onClick"]),l(o,{type:"danger",link:"",onClick:E=>M(t)},{default:a(()=>[...e[9]||(e[9]=[n("删除",-1)])]),_:1},8,["onClick"])])]),_:1})]),_:1},8,["data"]),g("div",ie,[l(o,{type:"primary",onClick:e[1]||(e[1]=t=>m.value=!1)},{default:a(()=>[...e[10]||(e[10]=[n("关闭",-1)])]),_:1})])])),[[T,y.value]])]),_:1},8,["modelValue"]),l(R,{title:`${B.value?"新建":z.value?"编辑":"查看"}业务规则`,modelValue:s.visible,"onUpdate:modelValue":e[5]||(e[5]=t=>s.visible=t),width:"600px","append-to-body":!0},{default:a(()=>[F((f(),$(p(te),{ref_key:"editBusinessRuleFormRef",ref:O,model:u,rules:U,"label-width":"auto","label-position":"right"},{default:a(()=>[l(p(N),{label:"标题",prop:"ruleTitle",placeholder:"请输入"},{default:a(()=>[l(p(P),{modelValue:u.ruleTitle,"onUpdate:modelValue":e[3]||(e[3]=t=>u.ruleTitle=t),disabled:w.value},null,8,["modelValue","disabled"])]),_:1}),l(p(N),{label:"规则说明",prop:"ruleDesc"},{default:a(()=>[l(p(P),{modelValue:u.ruleDesc,"onUpdate:modelValue":e[4]||(e[4]=t=>u.ruleDesc=t),type:"textarea",placeholder:"请输入",disabled:w.value,autosize:{minRows:2,maxRows:6}},null,8,["modelValue","disabled"])]),_:1}),g("div",ue,[w.value?G("",!0):(f(),$(o,{key:0,type:"primary",onClick:q},{default:a(()=>[...e[11]||(e[11]=[n("确定",-1)])]),_:1}))])]),_:1},8,["model","rules"])),[[T,s.loading]])]),_:1},8,["title","modelValue"])],64)}}}),me=A(re,[["__scopeId","data-v-89a19c41"]]);export{me as B};
