You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

implementPlanDialog-0b14c2a8.js 3.3KB

1
  1. import{o as I,p as j}from"./purchaseResults-13fe4d1d.js";import{p as x}from"./projectStore-30136ff6.js";import{r as f,B as C,C as O,b as i,c as H,L as k,h as r,e as B,f as l,i as v,k as S,s as $}from"./index-dd5fae99.js";const q={class:"dialog-footer"},E=S({name:"implementPlanDialog"}),R=Object.assign(E,{props:{visible:{type:Boolean,default:!1},data:{type:Object,default:()=>{}}},emits:["close"],setup(D,{expose:Y,emit:g}){const{proxy:w}=$(),s=D,p=g,a=f({}),u=f(),T=(n,e,t)=>new Date(e).getTime()>=new Date(a.value.finalInspectionDate).getTime()?t(new Error("项目开工时间必须在项目终验时间之前")):new Date(e).getTime()>=new Date(a.value.startTrialOperationDate).getTime()?t(new Error("项目开工时间必须在项目试运行开始时间之前")):t(),_=(n,e,t)=>new Date(e).getTime()<=new Date(a.value.projectStartDate).getTime()?t(new Error("项目试运行开始时间必须在项目开工时间之后")):new Date(e).getTime()>=new Date(a.value.finalInspectionDate).getTime()?t(new Error("项目初验时间必须在项目终验时间之前")):t(),y={projectStartDate:[{required:!0,message:"请输入"},{validator:T}],startTrialOperationDate:[{required:!0,message:"请选择"},{validator:_}],finalInspectionDate:[{required:!0,message:"请选择"}]},m=f(!1),V=async n=>{n&&await n.validate(async e=>{if(e){m.value=!0;try{const t={...a.value,projectId:s.data.id};await j(t),w.$message.success("提交成功!"),m.value=!1,p("close",!0)}catch{m.value=!1}}})};return C(()=>s.visible,async n=>{if(n){await O(),u.value.clearValidate();const e=await x(s.data.id),t=await I(s.data.id);a.value=t!=null&&t.data?{...t.data,finalInspectionDate:e.data.planAcceptanceTime}:{finalInspectionDate:e.data.planAcceptanceTime}}}),Y({formRef:u}),(n,e)=>{const t=i("el-date-picker"),d=i("el-form-item"),M=i("el-form"),c=i("el-button"),b=i("el-dialog");return H(),k(b,{"model-value":D.visible,title:"填写实施计划",onClose:e[5]||(e[5]=o=>p("close"))},{footer:r(()=>[B("span",q,[l(c,{type:"primary",loading:m.value,onClick:e[3]||(e[3]=o=>V(u.value))},{default:r(()=>e[6]||(e[6]=[v("提交")])),_:1},8,["loading"]),l(c,{onClick:e[4]||(e[4]=o=>p("close"))},{default:r(()=>e[7]||(e[7]=[v("关闭")])),_:1})])]),default:r(()=>[l(M,{ref_key:"formRef",ref:u,model:a.value,rules:y,"label-suffix":":","label-width":"140"},{default:r(()=>[l(d,{label:"项目开工时间",prop:"projectStartDate"},{default:r(()=>[l(t,{modelValue:a.value.projectStartDate,"onUpdate:modelValue":e[0]||(e[0]=o=>a.value.projectStartDate=o),type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"请选择"},null,8,["modelValue"])]),_:1}),l(d,{label:"试运行开始时间",prop:"startTrialOperationDate"},{default:r(()=>[l(t,{modelValue:a.value.startTrialOperationDate,"onUpdate:modelValue":e[1]||(e[1]=o=>a.value.startTrialOperationDate=o),type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"请选择"},null,8,["modelValue"])]),_:1}),l(d,{label:"项目终验时间",prop:"finalInspectionDate"},{default:r(()=>[l(t,{modelValue:a.value.finalInspectionDate,"onUpdate:modelValue":e[2]||(e[2]=o=>a.value.finalInspectionDate=o),type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"请选择"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{R as default};