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,ot as g,t as _,w as v,z as y}from"./_plugin-vue_export-helper-9JxOV_6y.js";import{J as b,i as x,r as S}from"./GxPagination-1gJXbpdv.js";import{n as C,t as w}from"./form-CR2ksibI.js";import{t as T}from"./button-CENWFHkZ.js";import{t as E}from"./dialog-CTuQSeYb.js";import{t as D}from"./directive-CkUp73VW.js";import{Ua as O}from"./stores-CQxCz3yU.js";import{a as k,n as A,o as j}from"./validate-D8FPRL2x.js";var M={class:`controller-event px-3`},N={class:`mb-1`},P={class:`flex flex-row flex-nowrap`},F={class:`flex flex-row justify-center mt-3`},I={class:`flex flex-row justify-center`},L=_(r({__name:`BusinessRuleListDialog`,props:y({visible:{type:Boolean},zxlPrdId:{},objectObId:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:[`update:visible`],setup(r){let _=r,y=g(r,`visible`),L=a([]),R=a(!1),z=async()=>{let e=_.objectObId;if(!e){L.value=[];return}R.value=!0;try{L.value=await O({url:`/zxl_pm/request/bizRule.svc`,method:`get`,params:{cmd:`getListWithObject`,zxlPrdId:_.zxlPrdId,objectObId:e}})||[]}catch{L.value=[]}R.value=!1};h(y,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:[A.requireChange,A.nonNullStr]}),q=async()=>{if(!await W.value?.validate())return;let e=_.objectObId;if(!e){k({type:`warning`,message:`请先绑定所属操作！`});return}B.loading=!0;try{let{ruleTitle:t,ruleDesc:n}=G,r={objectObId:e,ruleObId:H.value?B.row?.ruleObId:``,zxlPrdId:_.zxlPrdId,ruleTitle:t,ruleDesc:n};V.value&&delete r.ruleObId,await O({url:`/zxl_pm/request/bizRule.svc`,method:`post`,params:{cmd:`saveOrUpdate`},data:r}),k({type:`success`,message:`${V.value?`新增`:`修改`}业务规则成功`}),B.visible=!1,z()}catch(e){k({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 j({message:`确认要删除当前业务规则？`,title:`提示`,confirmButtonText:`确定`,showCancelButton:!0,cancelButtonText:`取消`,confirmButtonClass:`message-box-confim`,cancelButtonClass:`message-box-cancel el-button--primary`}).then(()=>!0))try{await O({url:`/zxl_pm/request/bizRule.svc`,method:`post`,params:{cmd:`delete`},data:{zxlPrdId:_.zxlPrdId,ruleObId:e.ruleObId}}),z()}catch(e){k({type:`error`,message:e||`操作失败！`})}};return(r,i)=>{let a=T,l=x,h=S,g=E,_=D;return s(),n(c,null,[e(g,{class:`business-rule-list-dialog`,modelValue:y.value,"onUpdate:modelValue":i[2]||=e=>y.value=e,onClose:e=>null,title:`业务规则`,"append-to-body":!0},{default:u(()=>[d((s(),n(`div`,M,[t(`div`,N,[e(a,{type:`primary`,text:``,onClick:i[0]||=f(e=>J(`add`),[`stop`])},{default:u(()=>[...i[6]||=[p(`新增`,-1)]]),_:1})]),e(h,{data:L.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`,P,[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`,F,[e(a,{type:`primary`,onClick:i[1]||=e=>y.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(),v(m(w),{ref_key:`editBusinessRuleFormRef`,ref:W,model:G,rules:K,"label-width":`auto`,"label-position":`right`},{default:u(()=>[e(m(C),{label:`标题`,prop:`ruleTitle`,placeholder:`请输入`},{default:u(()=>[e(m(b),{modelValue:G.ruleTitle,"onUpdate:modelValue":i[3]||=e=>G.ruleTitle=e,disabled:U.value},null,8,[`modelValue`,`disabled`])]),_:1}),e(m(C),{label:`规则说明`,prop:`ruleDesc`},{default:u(()=>[e(m(b),{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`,I,[U.value?o(``,!0):(s(),v(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{L as t};