|
- import{d as q,r as _,c as o,e as p,G as T,i as s,f as i,F as U,H as $,h as a,T as F,k as N,j as x,q as A}from"./index.a2494fc2.js";const B=["onClick"],j=q({name:"safetyInput"}),E=Object.assign(j,{setup(M,{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("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u5C0F\u4E8E100000000"):r():r("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u6700\u591A\u4FDD\u7559\u516D\u4F4D\u5C0F\u6570")},g={safetyInputTitle:[{required:!0,message:"\u8BF7\u8F93\u5165\u6295\u5165\u9879",trigger:"blur"}],safetyInputDescribe:[{required:!0,message:"\u8BF7\u8F93\u5165\u5185\u5BB9\u63CF\u8FF0",trigger:"blur"}],safetyInputAmount:[{required:!0,message:"\u8BF7\u8F93\u5165\u91D1\u989D",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("\u6700\u591A\u6DFB\u52A010\u9879");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(),T(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,(O,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:"\u6295\u5165\u9879",prop:`safetyInput[${t}].safetyInputTitle`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{default:s(()=>[a(r,{modelValue:e.value.safetyInput[t].safetyInputTitle,"onUpdate:modelValue":n=>e.value.safetyInput[t].safetyInputTitle=n,placeholder:"\u8BF7\u8F93\u5165",maxlength:50},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),a(m,{span:24},{default:s(()=>[a(f,{label:"\u5185\u5BB9\u63CF\u8FF0",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{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:"\u8BF7\u8F93\u5165"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),a(m,{span:12},{default:s(()=>[a(f,{label:"\u91D1\u989D(\u4E07\u5143)",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{default:s(()=>[a(w,{modelValue:e.value.safetyInput[t].safetyInputAmount,"onUpdate:modelValue":n=>e.value.safetyInput[t].safetyInputAmount=n,placeholder:"\u8BF7\u586B\u5199",min:0,controls:!1,onMousewheel:l[0]||(l[0]=F(()=>{},["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)},"\u5220\u9664",8,B)):N("",!0)]))),128)),a(k,{type:"primary",icon:"Plus",plain:"",onClick:V},{default:s(()=>l[1]||(l[1]=[x("\u6DFB\u52A0\u6295\u5165\u9879")])),_:1})]),_:1},8,["model"])}}});export{E as default};
|