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