popupForm-fbA1Yi6d.js 7.1 KB

1
  1. import{d as H,a as S,az as P,a2 as O,o as J,r as Q,K as u,aq as g,e as i,y as b,L as s,u as e,t as p,m as c,f as F,am as V,n as I,j as t,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 re,_ as le}from"./index-EwE51S_X.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";function ae(){return oe({url:"admin/borrow.BorrowRecord/getAssetGroup",method:"get"})}const te={class:"title"},se=H({__name:"popupForm",setup(ne){const U=re(),y=S(),o=P("baTable"),{t:l}=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=n=>{o.form.items.asset.splice(n,1)},v=S([]),q=(n,r)=>{const d=n?v.value.filter(L(n)):v.value;r(d)},L=n=>r=>r.value.toLowerCase().indexOf(n.toLowerCase())===0,N=async()=>{var r;const n=await ae();return((r=n==null?void 0:n.data)==null?void 0:r.row)||[]};J(()=>{N().then(n=>{v.value=n})});const $=(n,r)=>{o.form.items.asset[r].group_id=n.group_id,o.form.items.asset[r].configuration_standard_id=n.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(n,r)=>{const d=u("el-col"),h=u("el-row"),K=u("el-autocomplete"),k=u("el-input"),w=u("el-button"),M=u("el-form"),R=u("el-scrollbar"),T=u("el-dialog"),W=g("drag"),j=g("zoom"),A=g("blur"),E=g("loading");return i(),b(T,{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:s(()=>[V((i(),F("div",te,[c(p(e(o).form.operate?e(l)(e(o).form.operate):""),1)])),[[W,[".ba-operate-dialog",".el-dialog__header"]],[j,".ba-operate-dialog"]])]),footer:s(()=>[C("div",{style:I("width: calc(100% - "+e(o).form.labelWidth/1.8+"px)")},[t(w,{onClick:r[8]||(r[8]=a=>e(o).toggleForm(""))},{default:s(()=>[c(p(e(l)("Cancel")),1)]),_:1}),V((i(),b(w,{loading:e(o).form.submitLoading,onClick:r[9]||(r[9]=a=>e(o).onSubmit(y.value)),type:"primary"},{default:s(()=>[c(p(e(o).form.operateIds&&e(o).form.operateIds.length>1?e(l)("Save and edit next item"):e(l)("Save")),1)]),_:1},8,["loading"])),[[A]])],4)]),default:s(()=>[V((i(),b(R,{class:"ba-table-form-scrollbar"},{default:s(()=>[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:y,onKeyup:r[7]||(r[7]=Y(a=>e(o).onSubmit(y.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:s(()=>[e(o).form.operate!=="Add"?(i(),b(_,{key:0,label:e(l)("borrow.borrowrecord.encoding"),modelValue:e(o).form.items.encoding,"onUpdate:modelValue":r[0]||(r[0]=a=>e(o).form.items.encoding=a),type:"string",prop:"encoding",placeholder:e(l)("borrow.borrowrecord.encoding")},null,8,["label","modelValue","placeholder"])):z("",!0),t(_,{label:e(l)("borrow.borrowrecord.username"),modelValue:e(o).form.items.username,"onUpdate:modelValue":r[1]||(r[1]=a=>e(o).form.items.username=a),type:"string",prop:"username",placeholder:e(l)("borrow.borrowrecord.username")},null,8,["label","modelValue","placeholder"]),t(_,{label:e(l)("borrow.borrowrecord.mobile"),modelValue:e(o).form.items.mobile,"onUpdate:modelValue":r[2]||(r[2]=a=>e(o).form.items.mobile=a),type:"string",prop:"mobile",placeholder:e(l)("borrow.borrowrecord.mobile")},null,8,["label","modelValue","placeholder"]),t(_,{label:e(l)("borrow.borrowrecord.purpose"),modelValue:e(o).form.items.purpose,"onUpdate:modelValue":r[3]||(r[3]=a=>e(o).form.items.purpose=a),type:"radio",data:{content:{0:e(l)("borrow.borrowrecord.purpose 0"),1:e(l)("borrow.borrowrecord.purpose 1")},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"]),t(_,{label:e(l)("borrow.borrowrecord.expected end time"),prop:"expected_end_time",modelValue:e(o).form.items.expected_end_time,"onUpdate:modelValue":r[4]||(r[4]=a=>e(o).form.items.expected_end_time=a),type:"datetime",placeholder:e(l)("borrow.borrowrecord.expected end time"),"value-format":"yyyy-MM-dd HH"},null,8,["label","modelValue","placeholder"]),t(_,{label:e(l)("borrow.borrowrecord.borrow reason"),prop:"borrow_reason",type:"textarea",modelValue:e(o).form.items.borrow_reason,"onUpdate:modelValue":r[5]||(r[5]=a=>e(o).form.items.borrow_reason=a),"input-attr":{maxlength:10,clearable:!0,"show-password":!0}},null,8,["label","modelValue"]),t(_,{label:e(l)("borrow.borrowrecord.reamrk"),prop:"remarks",type:"textarea",modelValue:e(o).form.items.remarks,"onUpdate:modelValue":r[6]||(r[6]=a=>e(o).form.items.remarks=a),"input-attr":{maxlength:10,clearable:!0,"show-password":!0}},null,8,["label","modelValue"]),C("div",null,[t(h,{gutter:10},{default:s(()=>[t(d,{span:5,offset:1,class:"ba-array-key"},{default:s(()=>[c(p(e(l)("borrow.borrowrecord.asset name")),1)]),_:1}),t(d,{span:5,class:"ba-array-value"},{default:s(()=>[c(p(e(l)("borrow.borrowrecord.asset_id")),1)]),_:1}),t(d,{span:5,class:"ba-array-value"},{default:s(()=>[c(p(e(l)("仪器分类号")),1)]),_:1}),t(d,{span:5,class:"ba-array-key"},{default:s(()=>[c(p(e(l)("State")),1)]),_:1})]),_:1}),(i(!0),F(Z,null,ee(e(o).form.items.asset,(a,x)=>(i(),b(h,{class:"ba-array-item",gutter:10,key:x},{default:s(()=>[t(d,{span:4,offset:2},{default:s(()=>[t(K,{modelValue:a.model,"onUpdate:modelValue":m=>a.model=m,"fetch-suggestions":q,placeholder:e(l)("borrow.borrowrecord.asset name"),onSelect:m=>{$(m,x)}},null,8,["modelValue","onUpdate:modelValue","placeholder","onSelect"])]),_:2},1024),t(d,{span:4},{default:s(()=>[t(k,{modelValue:a.asset_id,"onUpdate:modelValue":m=>a.asset_id=m,class:"el-input",placeholder:e(l)("borrow.borrowrecord.asset_id")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),t(d,{span:5},{default:s(()=>[t(k,{modelValue:a.group_id,"onUpdate:modelValue":m=>a.group_id=m,class:"el-input",placeholder:"仪器分类号",readonly:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),t(d,{span:5},{default:s(()=>[t(k,{modelValue:a.status,"onUpdate:modelValue":m=>a.status=m,class:"el-input",placeholder:e(l)("State"),readonly:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),t(d,{span:4},{default:s(()=>[t(w,{onClick:m=>D(x),size:"small",icon:"el-icon-Delete",circle:""},null,8,["onClick"])]),_:2},1024)]),_:2},1024))),128)),t(h,{gutter:10},{default:s(()=>[t(d,{span:10,offset:12},{default:s(()=>[V((i(),b(w,{class:"ba-add-array-item",onClick:B,icon:"el-icon-Plus"},{default:s(()=>[c(p(e(l)("Add")),1)]),_:1})),[[A]])]),_:1})]),_:1})])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})),[[E,e(o).form.loading]])]),_:1},8,["model-value","onClose"])}}}),_e=le(se,[["__scopeId","data-v-142a964d"]]);export{_e as default};