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