import{l as R}from"./renewalProjectCapitalDeclare.0d58a50c.js";import{d as B,b as I,r as m,L as O,N as T,c as r,e as z,I as A,i as l,g as Y,h as t,j as b}from"./index.5bb861d3.js";const E={class:"flex"},J={class:"flex justify-center"},U=B({name:"relatedProjectDialog"}),F=Object.assign(U,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object,column:{type:Array,default:()=>[{type:"selection",reserveSelection:!0,width:"55",fixed:"left"},{label:"\u9879\u76EE\u540D\u79F0",prop:"projectName",key:"projectName"},{label:"\u9884\u7B97\u5E74\u5EA6",prop:"projectYear",key:"projectYear",width:80}]}},emits:["close","getProjectList"],setup(j,{emit:w}){const g=j,n=I({projectName:void 0,projectYear:void 0}),d=m(),h=m(0),i=m([]),y=async(s=d.value.pageParams)=>{var a;const e=await R({...s,...n});i.value=e.data.records,h.value=e.data.total,N.value=JSON.parse(JSON.stringify(c.value)),(a=N.value)!=null&&a.length&&i.value&&i.value.forEach(o=>{N.value.map(u=>u.id).includes(o.id)&&!d.value.getSelectRows().map(u=>u.id).includes(o.id)&&d.value.toggleRowSelect(o,!0)})},C=()=>{d.value.pageParams.pageNumber=1,y()},k=()=>{n.projectName=void 0,n.projectYear=void 0,d.value.pageParams.pageNumber=1,d.value.pageParams.pageSize=10,y()},c=m([]),N=m([]),P=s=>{const e=s.map(a=>a.id);i.value.forEach(a=>{e.includes(a.id)?c.value.push(a):c.value=c.value.filter(o=>o.id!==a.id)})},S=async()=>{const s={},e=c.value.reduce((a,o)=>(s[o.id]||(s[o.id]=a.push(o)),a),[]);f("getProjectList",e),f("close",!0)},f=w;return O(()=>g.visible,async s=>{var e;s?(await T(),(e=g.data)!=null&&e.length&&(c.value=g.data.map(a=>({id:a.baseProjId,projectName:a.baseProjName,projectYear:a.baseProjSetYear}))),k()):d.value.tableRef.clearSelection()}),(s,e)=>{const a=r("el-input"),o=r("el-form-item"),_=r("el-col"),u=r("el-date-picker"),v=r("el-button"),V=r("el-row"),x=r("el-form"),D=r("table-list"),L=r("el-dialog");return z(),A(L,{"model-value":j.visible,title:"\u9009\u62E9\u9879\u76EE",width:840,onClose:e[3]||(e[3]=p=>f("close"))},{footer:l(()=>[Y("div",J,[t(v,{type:"primary",onClick:S},{default:l(()=>[b("\u786E\u5B9A")]),_:1}),t(v,{onClick:e[2]||(e[2]=p=>f("close"))},{default:l(()=>[b("\u53D6\u6D88")]),_:1})])]),default:l(()=>[t(x,{model:n,"label-suffix":":",size:"small"},{default:l(()=>[t(V,{gutter:16},{default:l(()=>[t(_,{span:8},{default:l(()=>[t(o,{label:"\u9879\u76EE\u540D\u79F0"},{default:l(()=>[t(a,{modelValue:n.projectName,"onUpdate:modelValue":e[0]||(e[0]=p=>n.projectName=p),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),t(_,{span:8},{default:l(()=>[t(o,{label:"\u9879\u76EE\u9884\u7B97\u5E74\u5EA6",prop:"projectYear"},{default:l(()=>[t(u,{modelValue:n.projectYear,"onUpdate:modelValue":e[1]||(e[1]=p=>n.projectYear=p),type:"year","value-format":"YYYY",placeholder:"\u8BF7\u9009\u62E9",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),t(_,{span:8},{default:l(()=>[t(o,{class:"btn"},{default:l(()=>[Y("div",E,[t(v,{type:"primary",onClick:C},{default:l(()=>[b("\u641C\u7D22")]),_:1}),t(v,{onClick:k},{default:l(()=>[b("\u91CD\u7F6E")]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),t(D,{ref_key:"tableListRef",ref:d,column:j.column,data:i.value,total:h.value,"row-key":"id",onSelectionChange:P,onGetTableData:y},null,8,["column","data","total"])]),_:1},8,["model-value"])}}});export{F as default};
