import{C as e,O as t,R as n,S as r,St as i,T as a,Y as o,at as s,bt as c,ct as l,dt as u,ft as d,g as f,j as p,k as m,kt as h,m as g,w as _,x as v}from"./vue.runtime.esm-bundler-DpGzKKN4.js";import"./GxPagination-DOexUzbO.js";import{m as y}from"./vnode-DU8g6Rf7.js";import{n as b,t as x}from"./table-C_Bpc8FZ.js";import{n as S,t as C}from"./form-Bb1_iOEA.js";import{t as w}from"./button-CHjzS7b0.js";import{t as T}from"./dialog-BLJqz3g4.js";import{t as E}from"./directive-9SA1IQHd.js";import{t as D}from"./_plugin-vue_export-helper-CnS4QQza.js";import"./css-DxP8XCTD.js";import{Zo as O}from"./stores-BWYw2E2w.js";import"./css-CW_FwBqc2.js";import{a as k,n as A,o as j}from"./validate-CTyV86Nm.js";import"./css-DunA3L7q.js";import"./css-ropEN6qH.js";import"./css-BrGVMe3H.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=D(p({__name:`BusinessRuleListDialog`,props:n({visible:{type:Boolean},zxlPrdId:{},objectObId:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:[`update:visible`],setup(n){let p=n,D=s(n,`visible`),L=i([]),R=i(!1),z=async()=>{let e=p.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:p.zxlPrdId,objectObId:e}})||[]}catch{L.value=[]}R.value=!1};l(D,e=>{z()},{immediate:!0});let B=c({visible:!1,type:`add`,loading:!1,row:null}),V=v(()=>B.type===`add`),H=v(()=>B.type===`edit`),U=v(()=>B.type===`detail`),W=i(),G=c({ruleTitle:``,ruleDesc:``}),K=c({ruleTitle:[A.requireChange,A.nonNullStr]}),q=async()=>{if(!await W.value?.validate())return;let e=p.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:p.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:p.zxlPrdId,ruleObId:e.ruleObId}}),z()}catch(e){k({type:`error`,message:e||`操作失败！`})}};return(n,i)=>{let s=w,c=b,l=x,p=T,v=E;return o(),a(f,null,[m(p,{class:`business-rule-list-dialog`,modelValue:D.value,"onUpdate:modelValue":i[2]||=e=>D.value=e,onClose:e=>null,title:`业务规则`,"append-to-body":!0},{default:u(()=>[d((o(),a(`div`,M,[r(`div`,N,[m(s,{type:`primary`,text:``,onClick:i[0]||=g(e=>J(`add`),[`stop`])},{default:u(()=>[...i[6]||=[t(`新增`,-1)]]),_:1})]),m(l,{data:L.value,stripe:``,"show-header":!0},{default:u(()=>[m(c,{prop:`ruleNo`,label:`业务规则编号`,width:`110`}),m(c,{prop:`ruleTitle`,label:`标题`,"show-overflow-tooltip":``}),m(c,{prop:`ruleDesc`,label:`规则说明`,"show-overflow-tooltip":``,width:`200`}),m(c,{prop:`ruleNote`,label:`操作`,width:`150`},{default:u(({row:e})=>[r(`div`,P,[m(s,{type:`primary`,link:``,onClick:t=>J(`detail`,e)},{default:u(()=>[...i[7]||=[t(`详情`,-1)]]),_:1},8,[`onClick`]),m(s,{type:`primary`,link:``,onClick:t=>J(`edit`,e)},{default:u(()=>[...i[8]||=[t(`修改`,-1)]]),_:1},8,[`onClick`]),m(s,{type:`danger`,link:``,onClick:t=>Y(e)},{default:u(()=>[...i[9]||=[t(`删除`,-1)]]),_:1},8,[`onClick`])])]),_:1})]),_:1},8,[`data`]),r(`div`,F,[m(s,{type:`primary`,onClick:i[1]||=e=>D.value=!1},{default:u(()=>[...i[10]||=[t(`关闭`,-1)]]),_:1})])])),[[v,R.value]])]),_:1},8,[`modelValue`]),m(p,{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((o(),e(h(C),{ref_key:`editBusinessRuleFormRef`,ref:W,model:G,rules:K,"label-width":`auto`,"label-position":`right`},{default:u(()=>[m(h(S),{label:`标题`,prop:`ruleTitle`,placeholder:`请输入`},{default:u(()=>[m(h(y),{modelValue:G.ruleTitle,"onUpdate:modelValue":i[3]||=e=>G.ruleTitle=e,disabled:U.value},null,8,[`modelValue`,`disabled`])]),_:1}),m(h(S),{label:`规则说明`,prop:`ruleDesc`},{default:u(()=>[m(h(y),{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}),r(`div`,I,[U.value?_(``,!0):(o(),e(s,{key:0,type:`primary`,onClick:q},{default:u(()=>[...i[11]||=[t(`确定`,-1)]]),_:1}))])]),_:1},8,[`model`,`rules`])),[[v,B.loading]])]),_:1},8,[`title`,`modelValue`])],64)}}}),[[`__scopeId`,`data-v-89a19c41`]]);export{L as t};