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