|
- import{o as H,d as J,r as N}from"./annualPlanStore-7a8e5db4.js";import{a5 as K,a6 as D,r as s,B as O,b as n,a3 as Q,c as i,L as u,h as o,f as l,i as p,w as W,t as k,d as w,j as S,e as X,T as h,C as Z}from"./index-dd5fae99.js";const ee={key:0},ae={key:0},te=["onClick"],oe=["onClick"],le={class:"text-right w-full mt-8"},ne="关联运维包",de={__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"),C=s(),P=s(),r=s(!1),m=s(!1),f=s(!1);let v;function B(t){v=t}const b=s([]),x=$;async function I(t){if(!t.operationPackageName){h({message:"请输入运维包名称",type:"warning"});return}if(!t.operationPackageYear){h({message:"请选择预算年度",type:"warning"});return}r.value=!0;try{await J(t),r.value=!1,t.edit=!1,j()}catch{r.value=!1}}function M(){b.value.push({operationPackageYear:"",operationPackageName:"",edit:!0}),Z(()=>{C.value.setScrollTop(1e6)})}async function U(){if(!v){h({message:"请先选择关联包",type:"warning"});return}const t={operationPackageId:v.id,projectIds:Y.value.map(a=>a.projectId)};m.value=!0;try{await N(t),m.value=!1,g(),x("relevanceSuccess")}catch{m.value=!1}}async function T(){f.value=!0;const t={projectIds:Y.value.map(a=>a.projectId)};try{await N(t),f.value=!1,g(),x("relevanceSuccess")}catch{f.value=!1}}function g(){y.value=!1,v=void 0,P.value=void 0}O(()=>y.value,async t=>{t&&await j()});async function j(){r.value=!0;const t=await H();b.value=t.data,r.value=!1}return(t,a)=>{const R=n("el-radio"),c=n("el-table-column"),E=n("el-input"),L=n("el-form-item"),A=n("el-date-picker"),q=n("el-table"),_=n("el-button"),z=n("el-form"),F=n("el-dialog"),G=Q("loading");return i(),u(F,{"model-value":y.value,title:ne,width:"700","destroy-on-close":"",onClose:g},{footer:o(()=>[l(_,{onClick:g},{default:o(()=>a[3]||(a[3]=[p(" 关闭 ")])),_:1}),l(_,{type:"danger",disabled:r.value,loading:f.value,onClick:T},{default:o(()=>a[4]||(a[4]=[p(" 取消所有关联 ")])),_:1},8,["disabled","loading"]),l(_,{disabled:r.value,type:"primary",loading:m.value,onClick:U},{default:o(()=>a[5]||(a[5]=[p(" 确认关联 ")])),_:1},8,["disabled","loading"])]),default:o(()=>[W((i(),u(z,null,{default:o(()=>[l(q,{ref_key:"tableRef",ref:C,data:b.value,style:{width:"100%",height:"60vh"}},{default:o(()=>[l(c,{prop:"index",width:"50"},{default:o(e=>[(i(),u(R,{key:e.$index,modelValue:P.value,"onUpdate:modelValue":a[0]||(a[0]=d=>P.value=d),value:e.$index,disabled:e.row.edit,onChange:d=>B(e.row)},null,8,["modelValue","value","disabled","onChange"]))]),_:1}),l(c,{prop:"index",label:"序号",width:"60"},{default:o(e=>[p(k(e.$index+1),1)]),_:1}),l(c,{prop:"operationPackageName",label:"运维包名称",width:"180"},{default:o(e=>[e.row.edit?(i(),u(L,{key:1},{default:o(()=>[l(E,{modelValue:e.row.operationPackageName,"onUpdate:modelValue":d=>e.row.operationPackageName=d,placeholder:"请输入运维包名称"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):(i(),w("div",ee,k(e.row.operationPackageName),1))]),_:1}),l(c,{prop:"operationPackageYear",label:"预算年度",width:"250"},{default:o(e=>[e.row.edit?S("",!0):(i(),w("div",ae,k(e.row.operationPackageYear),1)),e.row.edit?(i(),u(L,{key:1,prop:"operationPackageYear"},{default:o(()=>[l(A,{modelValue:e.row.operationPackageYear,"onUpdate:modelValue":d=>e.row.operationPackageYear=d,type:"year",placeholder:"请选择预算年度",format:"YYYY","value-format":"YYYY"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):S("",!0)]),_:1}),l(c,{prop:"address",label:"操作",width:"120"},{default:o(e=>[e.row.edit?(i(),w("a",{key:1,onClick:d=>I(e.row)},"保存",8,oe)):(i(),w("a",{key:0,onClick:d=>(e.row.edit=!0,e.row.operationPackageYear=e.row.operationPackageYear+"")},"编辑"+k(e.row.data),9,te))]),_:1})]),_:1},8,["data"]),X("p",le,[l(_,{type:"primary",class:"w-full",plain:"",icon:"Plus",onClick:a[1]||(a[1]=()=>M())},{default:o(()=>a[2]||(a[2]=[p("添加 ")])),_:1})])]),_:1})),[[G,r.value]])]),_:1},8,["model-value"])}}};export{de as default};
|