import{e as E}from"./index.5b85d91e.js";import{d as G,G as L,D as q,r as u,b as z,c as l,e as J,f as $,h as e,i as a,j as f,g as A,F as H,N as K}from"./index.5bb861d3.js";const M={class:"flex"},Q=G({name:"coreBusiness"}),Z=Object.assign(Q,{props:{basicInfoData:{type:Object}},setup(D,{expose:R}){const p=D,C=L(q.userStore).userInfo||{},n=u({}),N=u(),I={coreBusiness:[{required:!0,message:"\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u6838\u5FC3\u4E1A\u52A1"}]},S=s=>{N.value.validate(o=>{s(o)})},T=()=>{i.value=!0,B({pageNumber:1,pageSize:10},!0)},V=[{type:"index",label:"\u5E8F\u53F7",width:60},{label:"\u4E1A\u52A1\u540D\u79F0",key:"matterName",prop:"matterName"},{label:"\u6240\u5C5E\u5355\u4F4D",key:"orgName",prop:"orgName"}],_=u(),v=u([]),k=u(0),F=[{type:"selection"},{label:"\u4E1A\u52A1\u540D\u79F0",prop:"matterName",key:"matterName"},{label:"\u6240\u5C5E\u5355\u4F4D",prop:"orgName",key:"orgName"}],i=u(!1),B=async(s=(r=>(r=_.value)==null?void 0:r.pageParams)(),o)=>{var g,m;var t=[];(g=p==null?void 0:p.basicInfoData)!=null&&g.superOrgCode&&t.push(p.basicInfoData.superOrgCode),(m=C.value)!=null&&m.empPosUnitCode&&t.push(C.value.empPosUnitCode);const c=await E({...s,businessName:b.businessName,orgCode:t.join(",")});v.value=c.data.data,k.value=c.data.total,await K(),o&&v.value&&v.value.forEach(d=>{(n.value.coreBusiness&&n.value.coreBusiness.map(y=>y.id)||[]).includes(d.id)?_.value.toggleRowSelect(d,!0):_.value.toggleRowSelect(d,!1)})},O=()=>{B()},h=u(),j=s=>{h.value=s},b=z({businessName:void 0}),P=()=>{b.businessName=""},U=()=>{n.value.coreBusiness=h.value,i.value=!1};return R({validForm:S,formData:n,setFormData:s=>{n.value={coreBusiness:s.coreBusiness?JSON.parse(s.coreBusiness):[]}}}),(s,o)=>{const r=l("el-button"),t=l("el-col"),c=l("table-list"),g=l("el-form-item"),m=l("el-row"),d=l("el-form"),x=l("el-input"),y=l("el-dialog");return J(),$(H,null,[e(d,{ref_key:"formRef",ref:N,model:n.value,rules:I,"label-position":"right","label-width":"0","label-suffix":":","scroll-to-error":""},{default:a(()=>[e(m,{gutter:40},{default:a(()=>[e(t,{span:24,class:"mb-16"},{default:a(()=>[e(r,{type:"primary",class:"float-right",onClick:T},{default:a(()=>[f(" \u9009\u62E9\u6838\u5FC3\u4E1A\u52A1 ")]),_:1})]),_:1}),e(t,{span:24},{default:a(()=>[e(g,{prop:"coreBusiness"},{default:a(()=>[e(c,{pagination:!1,style:{width:"100%"},column:V,data:n.value.coreBusiness,"empty-temp":!1},null,8,["data"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),e(y,{title:"\u9009\u62E9\u6838\u5FC3\u4E1A\u52A1","close-on-click-modal":!1,"before-close":()=>i.value=!1,"model-value":i.value,width:"700px"},{footer:a(()=>[e(r,{type:"primary",onClick:U},{default:a(()=>[f(" \u63D0\u4EA4 ")]),_:1}),e(r,{onClick:o[1]||(o[1]=w=>i.value=!1)},{default:a(()=>[f(" \u5173\u95ED ")]),_:1})]),default:a(()=>[e(m,{style:{"margin-bottom":"16px"},gutter:20},{default:a(()=>[e(t,{span:12},{default:a(()=>[e(x,{modelValue:b.businessName,"onUpdate:modelValue":o[0]||(o[0]=w=>b.businessName=w),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),e(t,{span:12},{default:a(()=>[A("div",M,[e(r,{type:"primary",onClick:O},{default:a(()=>[f("\u67E5\u8BE2")]),_:1}),e(r,{onClick:P},{default:a(()=>[f("\u91CD\u7F6E")]),_:1})])]),_:1})]),_:1}),e(c,{ref_key:"tableListRef",ref:_,column:F,data:v.value,total:k.value,onSelectionChange:j,onGetTableData:B},null,8,["data","total"])]),_:1},8,["before-close","model-value"])],64)}}});export{Z as default};
