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