popupForm-kvouH6ST.js 7.1 KB

1
  1. import{d as P,a as F,az as R,a2 as O,o as J,r as Q,K as u,aq as w,e as i,y as b,L as n,u as e,t as p,m as c,f as S,am as y,n as I,j as a,i as C,G as X,ac as Y,C as z,F as Z,B as ee}from"./vue-A59npLRR.js";import{b as f}from"./validate-_EUdkMt3.js";import{F as _}from"./index-r6iTpmP6.js";import{c as oe,v as le,_ as ae}from"./index-EwE51S_X.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";function re(){return oe({url:"admin/borrow.BorrowUseing/getAssetGroup",method:"get"})}const te={class:"title"},ne=P({__name:"popupForm",setup(se){const U=le(),V=F(),o=R("baTable"),{t}=O(),B=()=>{o.form.items.asset==null?o.form.items.asset=[{configuration_standard_id:"",model:"",num:""}]:o.form.items.asset.push({configuration_standard_id:"",model:"",num:""})},D=s=>{o.form.items.asset.splice(s,1)},v=F([]),q=(s,l)=>{const d=s?v.value.filter(L(s)):v.value;l(d)},L=s=>l=>l.value.toLowerCase().indexOf(s.toLowerCase())===0,N=async()=>{var l;const s=await re();return((l=s==null?void 0:s.data)==null?void 0:l.row)||[]};J(()=>{N().then(s=>{v.value=s})});const $=(s,l)=>{o.form.items.asset[l].group_id=s.group_id,o.form.items.asset[l].configuration_standard_id=s.configuration_standard_id},G=Q({username:[f({name:"required",message:"请输入使用人"})],purpose:[f({name:"required",message:"请选择申请类型"})],email:[f({name:"email"})],mobile:[f({name:"mobile"})],expected_end_time:[f({name:"required"})],borrow_reason:[f({name:"mobile",message:"借取用途不能为空"})],asset:[f({name:"required",message:"仪器类型不能为空"})]});return(s,l)=>{const d=u("el-col"),h=u("el-row"),K=u("el-autocomplete"),k=u("el-input"),g=u("el-button"),M=u("el-form"),T=u("el-scrollbar"),W=u("el-dialog"),j=w("drag"),E=w("zoom"),A=w("blur"),H=w("loading");return i(),b(W,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(o).form.operate),onClose:e(o).toggleForm,"destroy-on-close":!0},{header:n(()=>[y((i(),S("div",te,[c(p(e(o).form.operate?e(t)(e(o).form.operate):""),1)])),[[j,[".ba-operate-dialog",".el-dialog__header"]],[E,".ba-operate-dialog"]])]),footer:n(()=>[C("div",{style:I("width: calc(100% - "+e(o).form.labelWidth/1.8+"px)")},[a(g,{onClick:l[8]||(l[8]=r=>e(o).toggleForm(""))},{default:n(()=>[c(p(e(t)("Cancel")),1)]),_:1}),y((i(),b(g,{loading:e(o).form.submitLoading,onClick:l[9]||(l[9]=r=>e(o).onSubmit(V.value)),type:"primary"},{default:n(()=>[c(p(e(o).form.operateIds&&e(o).form.operateIds.length>1?e(t)("Save and edit next item"):e(t)("Save")),1)]),_:1},8,["loading"])),[[A]])],4)]),default:n(()=>[y((i(),b(T,{class:"ba-table-form-scrollbar"},{default:n(()=>[C("div",{class:X(["ba-operate-form","ba-"+e(o).form.operate+"-form"]),style:I(e(U).layout.shrink?"":"width: calc(100% - "+e(o).form.labelWidth/2+"px)")},[e(o).form.loading?z("",!0):(i(),b(M,{key:0,ref_key:"formRef",ref:V,onKeyup:l[7]||(l[7]=Y(r=>e(o).onSubmit(V.value),["enter"])),model:e(o).form.items,"label-position":e(U).layout.shrink?"top":"right","label-width":e(o).form.labelWidth+"px",rules:G},{default:n(()=>[e(o).form.operate!=="Add"?(i(),b(_,{key:0,label:e(t)("borrow.borrowuseing.encoding"),modelValue:e(o).form.items.encoding,"onUpdate:modelValue":l[0]||(l[0]=r=>e(o).form.items.encoding=r),type:"string",prop:"encoding",placeholder:e(t)("borrow.borrowuseing.encoding")},null,8,["label","modelValue","placeholder"])):z("",!0),a(_,{label:e(t)("borrow.borrowuseing.username"),modelValue:e(o).form.items.username,"onUpdate:modelValue":l[1]||(l[1]=r=>e(o).form.items.username=r),type:"string",prop:"username",placeholder:e(t)("borrow.borrowuseing.username")},null,8,["label","modelValue","placeholder"]),a(_,{label:e(t)("borrow.borrowuseing.mobile"),modelValue:e(o).form.items.mobile,"onUpdate:modelValue":l[2]||(l[2]=r=>e(o).form.items.mobile=r),type:"string",prop:"mobile",placeholder:e(t)("borrow.borrowuseing.mobile")},null,8,["label","modelValue","placeholder"]),a(_,{label:e(t)("borrow.borrowuseing.purpose"),modelValue:e(o).form.items.purpose,"onUpdate:modelValue":l[3]||(l[3]=r=>e(o).form.items.purpose=r),type:"radio",data:{content:{0:e(t)("borrow.borrowuseing.purpose 0"),1:e(t)("borrow.borrowuseing.purpose 1")},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"]),a(_,{label:e(t)("borrow.borrowuseing.expected end time"),prop:"expected_end_time",modelValue:e(o).form.items.expected_end_time,"onUpdate:modelValue":l[4]||(l[4]=r=>e(o).form.items.expected_end_time=r),type:"datetime",placeholder:e(t)("borrow.borrowuseing.expected end time"),"value-format":"yyyy-MM-dd HH"},null,8,["label","modelValue","placeholder"]),a(_,{label:e(t)("borrow.borrowuseing.borrow reason"),prop:"borrow_reason",type:"textarea",modelValue:e(o).form.items.borrow_reason,"onUpdate:modelValue":l[5]||(l[5]=r=>e(o).form.items.borrow_reason=r),"input-attr":{maxlength:10,clearable:!0,"show-password":!0}},null,8,["label","modelValue"]),a(_,{label:e(t)("borrow.borrowuseing.reamrk"),prop:"remarks",type:"textarea",modelValue:e(o).form.items.remarks,"onUpdate:modelValue":l[6]||(l[6]=r=>e(o).form.items.remarks=r),"input-attr":{maxlength:10,clearable:!0,"show-password":!0}},null,8,["label","modelValue"]),C("div",null,[a(h,{gutter:10},{default:n(()=>[a(d,{span:2}),a(d,{span:5,class:"ba-array-key"},{default:n(()=>[c(p(e(t)("borrow.borrowuseing.choose")),1)]),_:1}),a(d,{span:5,class:"ba-array-value"},{default:n(()=>[c(p(e(t)("borrow.borrowuseing.assetnumber")),1)]),_:1}),a(d,{span:5,class:"ba-array-value"},{default:n(()=>[c(p(e(t)("仪器分类号")),1)]),_:1}),a(d,{span:5,class:"ba-array-key"},{default:n(()=>[c(p(e(t)("borrow.borrowuseing.configuration standard id")),1)]),_:1})]),_:1}),(i(!0),S(Z,null,ee(e(o).form.items.asset,(r,x)=>(i(),b(h,{class:"ba-array-item",gutter:10,key:x},{default:n(()=>[a(d,{span:2}),a(d,{span:5},{default:n(()=>[a(K,{modelValue:r.model,"onUpdate:modelValue":m=>r.model=m,"fetch-suggestions":q,placeholder:"请输入仪器类型",style:{width:"100%"},onSelect:m=>{$(m,x)}},null,8,["modelValue","onUpdate:modelValue","onSelect"])]),_:2},1024),a(d,{span:5},{default:n(()=>[a(k,{modelValue:r.num,"onUpdate:modelValue":m=>r.num=m,class:"el-input",placeholder:"请填写数量"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),a(d,{span:5},{default:n(()=>[a(k,{modelValue:r.group_id,"onUpdate:modelValue":m=>r.group_id=m,class:"el-input",placeholder:"仪器分类号",readonly:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),a(d,{span:5},{default:n(()=>[a(k,{modelValue:r.configuration_standard_id,"onUpdate:modelValue":m=>r.configuration_standard_id=m,class:"el-input",placeholder:"配置编号(非必填)",readonly:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),a(d,{span:2},{default:n(()=>[a(g,{onClick:m=>D(x),size:"small",icon:"el-icon-Delete",circle:""},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),a(h,{gutter:10},{default:n(()=>[a(d,{span:10,offset:12},{default:n(()=>[y((i(),b(g,{class:"ba-add-array-item",onClick:B,icon:"el-icon-Plus"},{default:n(()=>[c(p(e(t)("Add")),1)]),_:1})),[[A]])]),_:1})]),_:1})])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})),[[H,e(o).form.loading]])]),_:1},8,["model-value","onClose"])}}}),_e=ae(ne,[["__scopeId","data-v-1da4b1dd"]]);export{_e as default};