import{p as A}from"./evaluationPlan.8c9baa5d.js";import{d as B,D as R,z,b as q,r as b,L as E,c as d,e as J,I as U,i as o,g as h,h as l,j as g,a0 as C}from"./index.5bb861d3.js";const Y={class:"search mb-16"},$={class:"dialog-footer"},F=B({name:"planProjectDialog"}),H=Object.assign(F,{props:{visible:{type:Boolean,default:!1,required:!0},data:{type:Array,default:void 0},params:{type:Object,default:()=>({})},templateTypeListData:{type:Array,default:void 0}},emits:["close","getProjectData"],setup(y,{emit:O}){const{projectTypeOptions:k}=R.dictStore.globalDicts||{},T=z(),f=y,v=O,n=q({projectName:void 0,buildOrgName:void 0}),i=b(),w=[{type:"selection",reserveSelection:!0,width:"55"},{label:"\u9879\u76EE\u540D\u79F0",key:"projectName",prop:"projectName",minWidth:"200",showOverflowTooltip:!0},{label:"\u9884\u7B97\u5E74\u5EA6",key:"projectYear",prop:"projectYear",width:80},{label:"\u9879\u76EE\u91D1\u989D",key:"declareAmount",prop:"declareAmount"},{label:"\u7533\u62A5\u5355\u4F4D",key:"buildOrgName",prop:"buildOrgName"},{label:"\u9879\u76EE\u7C7B\u578B",key:"projectType",prop:"projectType",render:r=>C("span",k[r.projectType]||"-"),width:80},{label:"\u6A21\u677F\u7C7B\u578B",key:"templateType",prop:"templateType",render:r=>{var e,a;return C("span",((a=(e=f.templateTypeListData)==null?void 0:e.find(t=>t.id===r.templateType))==null?void 0:a.name)||"-")}}],p=b([]),N=b(0),_=async(r=(e=>(e=i.value)==null?void 0:e.pageParams)())=>{const a=await A({...r,...n,appraisalId:T.query.appraisalId});p.value=a.data.records,N.value=a.data.total,n.projectName&&(p.value=p.value.filter(s=>s.projectName.indexOf(n.projectName)!==-1)),n.buildOrgName&&(p.value=p.value.filter(s=>s.buildOrgName.indexOf(n.buildOrgName)!==-1));const t=JSON.parse(JSON.stringify(u.value))||[];t!=null&&t.length&&p.value&&p.value.forEach(s=>{t.map(j=>j.projectCode).includes(s.projectCode)&&i.value.toggleRowSelect(s,!0)})},D=()=>{i.value.pageParams.pageNumber=1,_()},V=()=>{n.projectName=void 0,n.buildOrgName=void 0,i.value.pageParams.pageNumber=1,i.value.pageParams.pageSize=10,_()},u=b([]),P=r=>{const e=r.map(a=>a.projectCode);p.value.forEach(a=>{e.includes(a.projectCode)?u.value.push(a):u.value=u.value.filter(t=>t.projectCode!==a.projectCode)})},S=()=>{const r={},e=u.value.reduce((a,t)=>(r[t.projectCode]||(r[t.projectCode]=a.push(t)),a),[]);v("getProjectData",e)};return E(()=>f.visible,async r=>{var e;r&&((e=f.data)!=null&&e.length&&(u.value=f.data.map(a=>a),console.log(u.value)),_())}),(r,e)=>{const a=d("el-input"),t=d("el-form-item"),s=d("el-col"),c=d("el-button"),j=d("el-row"),L=d("el-form"),x=d("table-list"),I=d("el-dialog");return J(),U(I,{"model-value":y.visible,title:"\u6DFB\u52A0\u9879\u76EE",width:"70%","destroy-on-close":"",onClose:e[3]||(e[3]=m=>v("close"))},{footer:o(()=>[h("span",$,[l(c,{onClick:e[2]||(e[2]=m=>v("close"))},{default:o(()=>[g("\u5173\u95ED")]),_:1}),l(c,{type:"primary",onClick:S},{default:o(()=>[g(" \u786E\u5B9A ")]),_:1})])]),default:o(()=>[h("div",Y,[l(L,{"label-suffix":":",model:n,size:"small"},{default:o(()=>[l(j,{gutter:16},{default:o(()=>[l(s,{span:8},{default:o(()=>[l(t,{label:"\u9879\u76EE\u540D\u79F0"},{default:o(()=>[l(a,{modelValue:n.projectName,"onUpdate:modelValue":e[0]||(e[0]=m=>n.projectName=m),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:8},{default:o(()=>[l(t,{label:"\u7533\u62A5\u5355\u4F4D"},{default:o(()=>[l(a,{modelValue:n.buildOrgName,"onUpdate:modelValue":e[1]||(e[1]=m=>n.buildOrgName=m),placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:8},{default:o(()=>[l(t,{class:"btn"},{default:o(()=>[l(c,{type:"primary",onClick:D},{default:o(()=>[g("\u67E5\u8BE2")]),_:1}),l(c,{onClick:V},{default:o(()=>[g("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),l(x,{ref_key:"tableListRef",ref:i,column:w,data:p.value,"row-key":"projectCode",total:N.value,onSelectionChange:P,onGetTableData:_},null,8,["data","total"])]),_:1},8,["model-value"])}}});export{H as default};
