Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

safetyInput-8c03127a.js 3.0KB

1
  1. import{r as _,b as o,c as p,L as q,h as s,d as i,F as U,H as $,f as a,N,j as T,i as F,k as x,s as A}from"./index-dd5fae99.js";const B=["onClick"],j=x({name:"safetyInput"}),R=Object.assign(j,{setup(L,{expose:c}){const{proxy:y}=A(),e=_({safetyInput:[{}]}),d=_(),I=(u,l,r)=>{l||r(),/^\d+(\.\d{1,6})?$/.test(l)?l*1>=1e8?r("请输入正确格式,小于100000000"):r():r("请输入正确格式,最多保留六位小数")},g={safetyInputTitle:[{required:!0,message:"请输入投入项",trigger:"blur"}],safetyInputDescribe:[{required:!0,message:"请输入内容描述",trigger:"blur"}],safetyInputAmount:[{required:!0,message:"请输入金额",trigger:"blur"},{validator:I,trigger:"blur"}]},b=u=>{d.value.validate(l=>{u(l)})},v=u=>{e.value={safetyInput:u.safetyInputDescribe?JSON.parse(u.safetyInputDescribe):[{}]}},V=()=>{if(e.value.safetyInput.length>=10){y.$message.warning("最多添加10项");return}e.value.safetyInput.push({})},h=u=>{e.value.safetyInput.splice(u,1)};return c({validForm:b,formData:e,setFormData:v}),(u,l)=>{const r=o("el-input"),f=o("el-form-item"),m=o("el-col"),w=o("el-input-number"),D=o("el-row"),k=o("el-button"),C=o("el-form");return p(),q(C,{ref_key:"formRef",ref:d,model:e.value,rules:g,"label-position":"right","label-width":"180px","label-suffix":":","scroll-to-error":""},{default:s(()=>[(p(!0),i(U,null,$(e.value.safetyInput,(M,t)=>(p(),i("div",{key:t,style:{background:"#f5f8fa"},class:"p-8 mb-16 relative"},[a(D,{gutter:40},{default:s(()=>[a(m,{span:12},{default:s(()=>[a(f,{label:"投入项",prop:`safetyInput[${t}].safetyInputTitle`,rules:{required:!0,message:"请输入"}},{default:s(()=>[a(r,{modelValue:e.value.safetyInput[t].safetyInputTitle,"onUpdate:modelValue":n=>e.value.safetyInput[t].safetyInputTitle=n,placeholder:"请输入",maxlength:50},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),a(m,{span:24},{default:s(()=>[a(f,{label:"内容描述",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"请输入"}},{default:s(()=>[a(r,{modelValue:e.value.safetyInput[t].safetyInputDescribe,"onUpdate:modelValue":n=>e.value.safetyInput[t].safetyInputDescribe=n,rows:4,maxlength:"2000",type:"textarea","show-word-limit":"",placeholder:"请输入"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),a(m,{span:12},{default:s(()=>[a(f,{label:"金额(万元)",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"请输入"}},{default:s(()=>[a(w,{modelValue:e.value.safetyInput[t].safetyInputAmount,"onUpdate:modelValue":n=>e.value.safetyInput[t].safetyInputAmount=n,placeholder:"请填写",min:0,controls:!1,onMousewheel:l[0]||(l[0]=N(()=>{},["prevent"]))},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024),e.value.safetyInput.length>1?(p(),i("span",{key:0,class:"text-danger absolute right-8 top-8 cursor-pointer",onClick:n=>h(t)},"删除",8,B)):T("",!0)]))),128)),a(k,{type:"primary",icon:"Plus",plain:"",onClick:V},{default:s(()=>l[1]||(l[1]=[F("添加投入项")])),_:1})]),_:1},8,["model"])}}});export{R as default};