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