import{d as e,r as a,o as l,j as t,b as s,e as u,k as d,w as i,m as n,F as o,f as c,l as r,t as m,q as v,i as p,c as f}from"./index-BmnJ93Po.js";import{g as _,a as g,p as h,d as b}from"./index.BXTZ2GXu.js";import{_ as k}from"./_plugin-vue_export-helper.BCo6x5W8.js";const w=k(e({__name:"w-suppliers",setup(e){const k=a(!1),w=a([]),y=a({active:!1}),V=a("");l((()=>{x()}));const x=()=>{_("/suppliers",{page:1,size:100}).then((e=>{200===e.code&&(w.value=e.data.record)}))},C=()=>{history.back()},j=()=>{k.value=!0,y.value={active:!1}},U=()=>{y.value.id?g("/suppliers",{id:y.value.id,name:y.value.name,active:y.value.active}).then((e=>{200===e.code&&(k.value=!1,v("提交成功！"),x())})):h("/suppliers",{name:y.value.name,active:y.value.active}).then((e=>{200===e.code&&(k.value=!1,v("提交成功！"),x())}))};return(e,a)=>{const l=t("van-nav-bar"),_=t("van-field"),g=t("van-cell-group"),h=p,q=t("van-radio"),z=t("van-radio-group"),D=t("van-button"),E=t("van-popup");return s(),u(o,null,[d(h,{class:"flex"},{default:i((()=>[d(l,{title:"供应商维护","left-text":"返回","left-arrow":"","right-text":"新增",onClickLeft:C,onClickRight:j}),d(h,null,{default:i((()=>[d(g,{inset:""},{default:i((()=>[d(_,{modelValue:V.value,"onUpdate:modelValue":a[0]||(a[0]=e=>V.value=e),name:"供应商名称",label:"供应商名称",colon:"",class:"bot","label-width":"6em"},null,8,["modelValue"])])),_:1})])),_:1}),d(h,{class:"content"},{default:i((()=>[d(h,{class:"grid-container"},{default:i((()=>[d(h,{class:"grid-item"},{default:i((()=>[n("编号")])),_:1}),d(h,{class:"grid-item"},{default:i((()=>[n("供应商名称")])),_:1}),d(h,{class:"grid-item"},{default:i((()=>[n("分数")])),_:1}),d(h,{class:"grid-item"},{default:i((()=>[n("操作")])),_:1})])),_:1}),(s(!0),u(o,null,c(w.value,((e,a)=>(s(),f(h,{class:"grid-container",key:a},{default:i((()=>[d(h,{class:"grid-item"},{default:i((()=>[n(m(e.id),1)])),_:2},1024),d(h,{class:"grid-item"},{default:i((()=>[n(m(e.name),1)])),_:2},1024),d(h,{class:"grid-item"},{default:i((()=>[n(m(e.id),1)])),_:2},1024),d(h,{class:"grid-item"},{default:i((()=>[r("span",{style:{color:"#35a5f7"},onClick:a=>(e=>{y.value=e,k.value=!0})(e)},"编辑",8,["onClick"]),n("    "),r("span",{style:{color:"red"},onClick:a=>(e=>{let a="/suppliers/"+e.id;b(a).then((e=>{200===e.code&&(v("删除成功！"),x())}))})(e)},"删除 ",8,["onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),d(E,{show:k.value,"onUpdate:show":a[4]||(a[4]=e=>k.value=e),style:{width:"80%"},round:""},{default:i((()=>[d(h,null,{default:i((()=>[r("h3",{style:{"text-align":"center"}},m(y.value.id?"编辑":"新增"),1),d(g,{inset:""},{default:i((()=>[d(_,{modelValue:y.value.name,"onUpdate:modelValue":a[1]||(a[1]=e=>y.value.name=e),name:"供应商名称",label:"供应商名称",colon:"",class:"bot","label-width":"6em",rules:[{required:!0,message:"请填写"}]},null,8,["modelValue"]),d(_,{name:"状态",label:"状态",colon:"","label-width":"6em"},{input:i((()=>[d(z,{modelValue:y.value.active,"onUpdate:modelValue":a[2]||(a[2]=e=>y.value.active=e),direction:"horizontal"},{default:i((()=>[d(q,{name:!0},{default:i((()=>[n("启用")])),_:1}),d(q,{name:!1},{default:i((()=>[n("禁用")])),_:1})])),_:1},8,["modelValue"])])),_:1})])),_:1}),d(h,{class:"a-c"},{default:i((()=>[d(D,{type:"danger",onClick:a[3]||(a[3]=e=>k.value=!1)},{default:i((()=>[n("取消")])),_:1}),d(D,{type:"primary",onClick:U},{default:i((()=>[n("确认")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])],64)}}}),[["__scopeId","data-v-702e5e1a"]]);export{w as default};
