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.

2 line
3.3KB

  1. import{d as q,r as _,c as o,e as p,I as U,i as l,f as i,F as $,J as T,h as a,V as x,k as F,j as N,x as A}from"./index.7e23eab2.js";const B=["onClick"],j=q({name:"safetyInput"}),R=Object.assign(j,{setup(J,{expose:c}){const{proxy:y}=A(),e=_({safetyInput:[{}]}),d=_(),I=(s,u,r)=>{u||r(),/^\d+(\.\d{1,6})?$/.test(u)?u*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=s=>{d.value.validate(u=>{s(u)})},v=s=>{e.value={safetyInput:s.safetyInputDescribe?JSON.parse(s.safetyInputDescribe):[{}]}},V=()=>{if(e.value.safetyInput.length>=10){y.$message.warning("\u6700\u591A\u6DFB\u52A010\u9879");return}e.value.safetyInput.push({})},h=s=>{e.value.safetyInput.splice(s,1)};return c({validForm:b,formData:e,setFormData:v}),(s,u)=>{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(),U(C,{ref_key:"formRef",ref:d,model:e.value,rules:g,"label-position":"right","label-width":"180px","label-suffix":":","scroll-to-error":""},{default:l(()=>[(p(!0),i($,null,T(e.value.safetyInput,(M,t)=>(p(),i("div",{key:t,style:{background:"#f5f8fa"},class:"p-8 mb-16 relative"},[a(D,{gutter:40},{default:l(()=>[a(m,{span:12},{default:l(()=>[a(f,{label:"\u6295\u5165\u9879",prop:`safetyInput[${t}].safetyInputTitle`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{default:l(()=>[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:l(()=>[a(f,{label:"\u5185\u5BB9\u63CF\u8FF0",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{default:l(()=>[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:l(()=>[a(f,{label:"\u91D1\u989D(\u4E07\u5143)",prop:`safetyInput[${t}].safetyInputDescribe`,rules:{required:!0,message:"\u8BF7\u8F93\u5165"}},{default:l(()=>[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:u[0]||(u[0]=x(()=>{},["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)):F("",!0)]))),128)),a(k,{type:"primary",icon:"Plus",plain:"",onClick:V},{default:l(()=>[N("\u6DFB\u52A0\u6295\u5165\u9879")]),_:1})]),_:1},8,["model"])}}});export{R as default};