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