import{o as F,d as H,r as N}from"./annualPlanStore.5d9e4993.js";import{ah as K,ai as D,r as s,J as O,c as n,a2 as Q,e as i,G as c,i as o,h as l,j as p,w as W,t as k,f as w,k as L,g as X,E as h}from"./index.2dada31c.js";const Z={key:0},ee={key:0},ae=["onClick"],te=["onClick"],oe={class:"text-right w-full mt-8"},le="\u5173\u8054\u8FD0\u7EF4\u5305",re={__name:"operationDialog",props:{modelValue:{},modelModifiers:{},selectProjectList:{type:Array,defult:[]},selectProjectListModifiers:{}},emits:K(["relevanceSuccess"],["update:modelValue","update:selectProjectList"]),setup(V,{emit:$}){const y=D(V,"modelValue"),Y=D(V,"selectProjectList"),I=s(),P=s(),d=s(!1),m=s(!1),f=s(!1);let g;function M(t){g=t}const b=s([]),C=$;async function S(t){if(!t.operationPackageName){h({message:"\u8FD0\u7EF4\u5305\u540D\u79F0",type:"warning"});return}if(!t.operationPackageYear){h({message:"\u8BF7\u9009\u62E9\u9884\u7B97\u5E74\u5EA6",type:"warning"});return}d.value=!0,await H(t),d.value=!1,t.edit=!1,j()}function U(){b.value.push({operationPackageYear:"",operationPackageName:"",edit:!0})}async function B(){if(!g){h({message:"\u8BF7\u5148\u9009\u62E9\u5173\u8054\u5305",type:"warning"});return}const t={operationPackageId:g.id,projectIds:Y.value.map(a=>a.projectId)};m.value=!0;try{await N(t),m.value=!1,v(),C("relevanceSuccess")}catch{m.value=!1}}async function E(){f.value=!0;const t={projectIds:Y.value.map(a=>a.projectId)};try{await N(t),f.value=!1,v(),C("relevanceSuccess")}catch{f.value=!1}}function v(){y.value=!1,g=void 0,P.value=void 0}O(()=>y.value,async t=>{t&&await j()});async function j(){d.value=!0;const t=await F();b.value=t.data,d.value=!1}return(t,a)=>{const R=n("el-radio"),u=n("el-table-column"),A=n("el-input"),x=n("el-form-item"),G=n("el-date-picker"),J=n("el-table"),_=n("el-button"),T=n("el-form"),q=n("el-dialog"),z=Q("loading");return i(),c(q,{"model-value":y.value,title:le,width:"700","destroy-on-close":"",onClose:v},{footer:o(()=>[l(_,{onClick:v},{default:o(()=>a[3]||(a[3]=[p(" \u5173\u95ED ")])),_:1}),l(_,{type:"danger",disabled:d.value,loading:f.value,onClick:E},{default:o(()=>a[4]||(a[4]=[p(" \u53D6\u6D88\u6240\u6709\u5173\u8054 ")])),_:1},8,["disabled","loading"]),l(_,{disabled:d.value,type:"primary",loading:m.value,onClick:B},{default:o(()=>a[5]||(a[5]=[p(" \u786E\u8BA4\u5173\u8054 ")])),_:1},8,["disabled","loading"])]),default:o(()=>[W((i(),c(T,null,{default:o(()=>[l(J,{ref_key:"tableRef",ref:I,data:b.value,style:{width:"100%",height:"60vh"}},{default:o(()=>[l(u,{prop:"index",width:"50"},{default:o(e=>[(i(),c(R,{key:e.$index,modelValue:P.value,"onUpdate:modelValue":a[0]||(a[0]=r=>P.value=r),value:e.$index,disabled:e.row.edit,onChange:r=>M(e.row)},null,8,["modelValue","value","disabled","onChange"]))]),_:1}),l(u,{prop:"index",label:"\u5E8F\u53F7",width:"60"},{default:o(e=>[p(k(e.$index+1),1)]),_:1}),l(u,{prop:"operationPackageName",label:"\u8FD0\u7EF4\u5305\u540D\u79F0",width:"180"},{default:o(e=>[e.row.edit?(i(),c(x,{key:1},{default:o(()=>[l(A,{modelValue:e.row.operationPackageName,"onUpdate:modelValue":r=>e.row.operationPackageName=r,placeholder:"\u8BF7\u8F93\u5165\u8FD0\u7EF4\u5305\u540D\u79F0"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):(i(),w("div",Z,k(e.row.operationPackageName),1))]),_:1}),l(u,{prop:"operationPackageYear",label:"\u9884\u7B97\u5E74\u5EA6",width:"250"},{default:o(e=>[e.row.edit?L("",!0):(i(),w("div",ee,k(e.row.operationPackageYear),1)),e.row.edit?(i(),c(x,{key:1,prop:"operationPackageYear"},{default:o(()=>[l(G,{modelValue:e.row.operationPackageYear,"onUpdate:modelValue":r=>e.row.operationPackageYear=r,type:"year",placeholder:"\u8BF7\u9009\u62E9\u9884\u7B97\u5E74\u5EA6",format:"YYYY","value-format":"YYYY"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):L("",!0)]),_:1}),l(u,{prop:"address",label:"\u64CD\u4F5C",width:"120"},{default:o(e=>[e.row.edit?(i(),w("a",{key:1,onClick:r=>S(e.row)},"\u4FDD\u5B58",8,te)):(i(),w("a",{key:0,onClick:r=>(e.row.edit=!0,e.row.operationPackageYear=e.row.operationPackageYear+"")},"\u7F16\u8F91"+k(e.row.data),9,ae))]),_:1})]),_:1},8,["data"]),X("p",oe,[l(_,{type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:a[1]||(a[1]=()=>U())},{default:o(()=>a[2]||(a[2]=[p("\u6DFB\u52A0 ")])),_:1})])]),_:1})),[[z,d.value]])]),_:1},8,["model-value"])}}};export{re as default};