import{A as e,C as t,E as n,M as r,S as i,St as a,T as o,X as s,_ as c,bt as l,dt as u,ft as d,h as f,k as p,kt as m,lt as h,mn as g,ot as _,t as v,w as y,z as b}from"./_plugin-vue_export-helper-C0lsYS1a.js";import{J as x,i as S,r as C}from"./GxPagination-DaT0MOF0.js";import{n as w,t as T}from"./form-B9CYF2OU.js";import{t as E}from"./button-CTBy3KbX.js";import{t as D}from"./dialog-C-zlcBiu.js";import{t as O}from"./directive-2hBfY9mU.js";import{Ia as k}from"./stores-PVUTfPb_.js";import{a as A,n as j,o as M}from"./validate-C3ezFD8l.js";var N={class:`controller-event px-3`},P={class:`mb-1`},F={class:`flex flex-row flex-nowrap`},I={class:`flex flex-row justify-center mt-3`},L={class:`flex flex-row justify-center`},R=v(r({__name:`BusinessRuleListDialog`,props:b({visible:{type:Boolean},zxlPrdId:{},objectObId:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:[`update:visible`],setup(r){let g=r,v=_(r,`visible`),b=a([]),R=a(!1),z=async()=>{let e=g.objectObId;if(!e){b.value=[];return}R.value=!0;try{b.value=await k({url:`/zxl_pm/request/bizRule.svc`,method:`get`,params:{cmd:`getListWithObject`,zxlPrdId:g.zxlPrdId,objectObId:e}})||[]}catch{b.value=[]}R.value=!1};h(v,e=>{z()},{immediate:!0});let B=l({visible:!1,type:`add`,loading:!1,row:null}),V=i(()=>B.type===`add`),H=i(()=>B.type===`edit`),U=i(()=>B.type===`detail`),W=a(),G=l({ruleTitle:``,ruleDesc:``}),K=l({ruleTitle:[j.requireChange,j.nonNullStr]}),q=async()=>{if(!await W.value?.validate())return;let e=g.objectObId;if(!e){A({type:`warning`,message:`请先绑定所属操作！`});return}B.loading=!0;try{let{ruleTitle:t,ruleDesc:n}=G,r={objectObId:e,ruleObId:H.value?B.row?.ruleObId:``,zxlPrdId:g.zxlPrdId,ruleTitle:t,ruleDesc:n};V.value&&delete r.ruleObId,await k({url:`/zxl_pm/request/bizRule.svc`,method:`post`,params:{cmd:`saveOrUpdate`},data:r}),A({type:`success`,message:`${V.value?`新增`:`修改`}业务规则成功`}),B.visible=!1,z()}catch(e){A({type:`error`,message:e||`操作失败！`})}B.loading=!1},J=(e,t)=>{B.visible=!0,B.type=e,B.row=t||null,G.ruleTitle=t?.ruleTitle||``,G.ruleDesc=t?.ruleDesc||``},Y=async e=>{if(await M({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:g.zxlPrdId,ruleObId:e.ruleObId}}),z()}catch(e){A({type:`error`,message:e||`操作失败！`})}};return(r,i)=>{let a=E,l=S,h=C,g=D,_=O;return s(),n(c,null,[e(g,{class:`business-rule-list-dialog`,modelValue:v.value,"onUpdate:modelValue":i[2]||=e=>v.value=e,onClose:e=>null,title:`业务规则`,"append-to-body":!0},{default:u(()=>[d((s(),n(`div`,N,[t(`div`,P,[e(a,{type:`primary`,text:``,onClick:i[0]||=f(e=>J(`add`),[`stop`])},{default:u(()=>[...i[6]||=[p(`新增`,-1)]]),_:1})]),e(h,{data:b.value,stripe:``,"show-header":!0},{default:u(()=>[e(l,{prop:`ruleNo`,label:`业务规则编号`,width:`110`}),e(l,{prop:`ruleTitle`,label:`标题`,"show-overflow-tooltip":``}),e(l,{prop:`ruleDesc`,label:`规则说明`,"show-overflow-tooltip":``,width:`200`}),e(l,{prop:`ruleNote`,label:`操作`,width:`150`},{default:u(({row:n})=>[t(`div`,F,[e(a,{type:`primary`,link:``,onClick:e=>J(`detail`,n)},{default:u(()=>[...i[7]||=[p(`详情`,-1)]]),_:1},8,[`onClick`]),e(a,{type:`primary`,link:``,onClick:e=>J(`edit`,n)},{default:u(()=>[...i[8]||=[p(`修改`,-1)]]),_:1},8,[`onClick`]),e(a,{type:`danger`,link:``,onClick:e=>Y(n)},{default:u(()=>[...i[9]||=[p(`删除`,-1)]]),_:1},8,[`onClick`])])]),_:1})]),_:1},8,[`data`]),t(`div`,I,[e(a,{type:`primary`,onClick:i[1]||=e=>v.value=!1},{default:u(()=>[...i[10]||=[p(`关闭`,-1)]]),_:1})])])),[[_,R.value]])]),_:1},8,[`modelValue`]),e(g,{title:`${V.value?`新建`:H.value?`编辑`:`查看`}业务规则`,modelValue:B.visible,"onUpdate:modelValue":i[5]||=e=>B.visible=e,width:`600px`,"append-to-body":!0},{default:u(()=>[d((s(),y(m(T),{ref_key:`editBusinessRuleFormRef`,ref:W,model:G,rules:K,"label-width":`auto`,"label-position":`right`},{default:u(()=>[e(m(w),{label:`标题`,prop:`ruleTitle`,placeholder:`请输入`},{default:u(()=>[e(m(x),{modelValue:G.ruleTitle,"onUpdate:modelValue":i[3]||=e=>G.ruleTitle=e,disabled:U.value},null,8,[`modelValue`,`disabled`])]),_:1}),e(m(w),{label:`规则说明`,prop:`ruleDesc`},{default:u(()=>[e(m(x),{modelValue:G.ruleDesc,"onUpdate:modelValue":i[4]||=e=>G.ruleDesc=e,type:`textarea`,placeholder:`请输入`,disabled:U.value,autosize:{minRows:2,maxRows:6}},null,8,[`modelValue`,`disabled`])]),_:1}),t(`div`,L,[U.value?o(``,!0):(s(),y(a,{key:0,type:`primary`,onClick:q},{default:u(()=>[...i[11]||=[p(`确定`,-1)]]),_:1}))])]),_:1},8,[`model`,`rules`])),[[_,B.loading]])]),_:1},8,[`title`,`modelValue`])],64)}}}),[[`__scopeId`,`data-v-89a19c41`]]);export{R as t};