|
- import{l as L}from"./projectStore-30136ff6.js";import{a as R,r as m,B as O,C as T,b as r,c as I,L as z,h as l,e as C,f as a,i as b,k as E}from"./index-dd5fae99.js";const J={class:"flex"},U={class:"flex justify-center"},$=E({name:"relatedProjectDialog"}),F=Object.assign($,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object,column:{type:Array,default:()=>[{type:"selection",reserveSelection:!0,width:"55",fixed:"left"},{label:"项目名称",prop:"projectName",key:"projectName"},{label:"预算年度",prop:"projectYear",key:"projectYear",width:80}]}},emits:["close","getProjectList"],setup(j,{emit:w}){const g=j,n=R({projectName:void 0,projectYear:void 0}),d=m(),k=m(0),u=m([]),y=async(s=d.value.pageParams)=>{var t;const e=await L({...s,...n});u.value=e.data.records,k.value=e.data.total,N.value=JSON.parse(JSON.stringify(i.value)),(t=N.value)!=null&&t.length&&u.value&&u.value.forEach(o=>{N.value.map(c=>c.id).includes(o.id)&&!d.value.getSelectRows().map(c=>c.id).includes(o.id)&&d.value.toggleRowSelect(o,!0)})},P=()=>{d.value.pageParams.pageNumber=1,y()},Y=()=>{n.projectName=void 0,n.projectYear=void 0,d.value.pageParams.pageNumber=1,d.value.pageParams.pageSize=10,y()},i=m([]),N=m([]),S=s=>{const e=s.map(t=>t.id);u.value.forEach(t=>{e.includes(t.id)?i.value.push(t):i.value=i.value.filter(o=>o.id!==t.id)})},V=async()=>{const s={},e=i.value.reduce((t,o)=>(s[o.id]||(s[o.id]=t.push(o)),t),[]);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&&(i.value=g.data.map(t=>({id:t.baseProjId,projectName:t.baseProjName,projectYear:t.baseProjSetYear}))),Y()):d.value.tableRef.clearSelection()}),(s,e)=>{const t=r("el-input"),o=r("el-form-item"),v=r("el-col"),c=r("el-date-picker"),_=r("el-button"),x=r("el-row"),h=r("el-form"),D=r("table-list"),B=r("el-dialog");return I(),z(B,{"model-value":j.visible,title:"选择项目",width:840,onClose:e[3]||(e[3]=p=>f("close"))},{footer:l(()=>[C("div",U,[a(_,{type:"primary",onClick:V},{default:l(()=>e[6]||(e[6]=[b("确定")])),_:1}),a(_,{onClick:e[2]||(e[2]=p=>f("close"))},{default:l(()=>e[7]||(e[7]=[b("取消")])),_:1})])]),default:l(()=>[a(h,{model:n,"label-suffix":":",size:"small"},{default:l(()=>[a(x,{gutter:16},{default:l(()=>[a(v,{span:8},{default:l(()=>[a(o,{label:"项目名称"},{default:l(()=>[a(t,{modelValue:n.projectName,"onUpdate:modelValue":e[0]||(e[0]=p=>n.projectName=p),placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1}),a(v,{span:8},{default:l(()=>[a(o,{label:"项目预算年度",prop:"projectYear"},{default:l(()=>[a(c,{modelValue:n.projectYear,"onUpdate:modelValue":e[1]||(e[1]=p=>n.projectYear=p),type:"year","value-format":"YYYY",placeholder:"请选择",style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1}),a(v,{span:8},{default:l(()=>[a(o,{class:"btn"},{default:l(()=>[C("div",J,[a(_,{type:"primary",onClick:P},{default:l(()=>e[4]||(e[4]=[b("搜索")])),_:1}),a(_,{onClick:Y},{default:l(()=>e[5]||(e[5]=[b("重置")])),_:1})])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),a(D,{ref_key:"tableListRef",ref:d,column:j.column,data:u.value,total:k.value,"row-key":"id",onSelectionChange:S,onGetTableData:y},null,8,["column","data","total"])]),_:1},8,["model-value"])}}});export{F as default};
|