import{_ as j,d as F,w as G,bq as _,a0 as P,x as q,r as i,o as c,G as v,C as p,c as h,F as C,D as k,l as b,h as E,L as g,j as u,M as x,a as M}from"./index.js";import{a as U,b as z}from"./index.21ab3104.js";const O={key:0,flex:"","gap-10":""},T={fixed:"","right-5":"","bottom-5":""},H=F({__name:"process-list",props:{currentRole:{type:Object,required:!0}},emits:["saveBtnClick"],setup(y,{emit:B}){const D=y,s=G([]),{run:V}=_({initalData:[],success:e=>s.value=e.action_data}),{data:a,run:w}=_({success:()=>a.value=a.value.filter(({child:e})=>e&&e.length>0)});P(()=>{const{currentRole:e}=D;!e||V(U({roleid:e.id}))});function A(){B("saveBtnClick",b(s))}function L(e,l){const n=a.value[l].child;if(e)return n.forEach(t=>{!s.value.includes(t.id)&&s.value.push(t.id)});n.forEach(t=>{const o=s.value.findIndex(m=>m===t.id);o>=0&&s.value.splice(o,1)})}function I(e){const l=a.value[e].child,n=l.length,t=l.filter(o=>s.value.includes(o.id));return t.length>0&&t.length!==n}function N(e){const l=a.value[e].child,n=l.length;return l.filter(o=>s.value.includes(o.id)).length===n}return q(()=>w(z())),(e,l)=>{const n=i("ElDivider"),t=i("ElCheckbox"),o=i("ElCheckboxGroup"),m=i("ElButton"),R=i("ElScrollbar");return c(),v(R,null,{default:p(()=>[(c(!0),h(C,null,k(b(a),(d,f)=>(c(),h("div",{key:d.id,"w-full":""},[E("p",null,g(d.process_name),1),u(n,{"border-style":"dashed","m-0":""}),d.child?(c(),h("div",O,[u(t,{label:"\u5168\u9009","model-value":N(f),indeterminate:I(f),onChange:r=>L(r,f)},null,8,["model-value","indeterminate","onChange"]),u(o,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r)},{default:p(()=>[(c(!0),h(C,null,k(d.child,(r,S)=>(c(),v(t,{key:S,label:r.id},{default:p(()=>[x(g(r.status_name),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue"])])):M("v-if",!0),u(n)]))),128)),E("div",T,[u(m,{onClick:A,type:"primary",size:"small"},{default:p(()=>[x("\u4FDD\u5B58")]),_:1})])]),_:1})}}});var Q=j(H,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/supplierInterest/supplierProcessPermission/components/process-list.vue"]]);export{Q as default};
