import{d as e,r as a,o as l,j as t,b as s,e as n,k as i,w as d,m as u,F as o,f as r,l as c,t as m,q as f,i as v,c as p}from"./index-z4UiUMlV.js";import{g as _,a as h,p as g,s as b,d as y}from"./index.Wwo-uIrA.js";import{_ as k}from"./_plugin-vue_export-helper.BCo6x5W8.js";const x=k(e({__name:"defect",setup(e){const k=a(!1),x=a([]),w=a({});l((()=>{C()}));const C=()=>{_("/blemish",{page:1,size:100}).then((e=>{200===e.code&&(x.value=e.data.record)}))},j=()=>{history.back()},S=()=>{w.value={},k.value=!0},V=()=>{w.value.id?h("/blemish",w.value).then((e=>{200===e.code&&(C(),k.value=!1,f("提交成功！"))})):g("/blemish",w.value).then((e=>{200===e.code&&(C(),k.value=!1,f("提交成功！"))}))};return(e,a)=>{const l=t("van-nav-bar"),_=v,h=t("van-field"),g=t("van-cell-group"),q=t("van-button"),J=t("van-form"),N=t("van-popup");return s(),n(o,null,[i(_,{class:"flex"},{default:d((()=>[i(l,{title:"色胚质检瑕疵维护","left-text":"返回","left-arrow":"","right-text":"新增",onClickLeft:j,onClickRight:S}),i(_,{class:"content"},{default:d((()=>[i(_,{class:"grid-container"},{default:d((()=>[i(_,{class:"grid-item"},{default:d((()=>[u("编号")])),_:1}),i(_,{class:"grid-item"},{default:d((()=>[u("瑕疵名称")])),_:1}),i(_,{class:"grid-item"},{default:d((()=>[u("操作")])),_:1})])),_:1}),(s(!0),n(o,null,r(x.value,((e,a)=>(s(),p(_,{class:"grid-container",key:a},{default:d((()=>[i(_,{class:"grid-item"},{default:d((()=>[u(m(e.id),1)])),_:2},1024),i(_,{class:"grid-item"},{default:d((()=>[u(m(e.name),1)])),_:2},1024),i(_,{class:"grid-item"},{default:d((()=>[c("span",{style:{color:"#35a5f7"},onClick:a=>(e=>{w.value=JSON.parse(JSON.stringify(e)),k.value=!0})(e)},"编辑",8,["onClick"]),u("    "),c("span",{style:{color:"red"},onClick:a=>(e=>{b({title:"提示",message:"是否确认删除？"}).then((()=>{let a="/blemish/"+e.id;y(a).then((e=>{200===e.code&&(C(),f("删除成功！"))}))})).catch((()=>{}))})(e)},"删除 ",8,["onClick"])])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),i(N,{show:k.value,"onUpdate:show":a[2]||(a[2]=e=>k.value=e),style:{width:"80%"},round:""},{default:d((()=>[i(_,null,{default:d((()=>[c("h3",{style:{"text-align":"center"}},m(w.value.id?"编辑":"新增"),1),i(J,{onSubmit:V},{default:d((()=>[i(g,{inset:""},{default:d((()=>[i(h,{modelValue:w.value.name,"onUpdate:modelValue":a[0]||(a[0]=e=>w.value.name=e),name:"瑕疵名称",label:"瑕疵名称",colon:"","label-width":"5em",rules:[{required:!0,message:"请填写"}]},null,8,["modelValue"])])),_:1}),i(_,{class:"a-c"},{default:d((()=>[i(q,{type:"danger",onClick:a[1]||(a[1]=e=>k.value=!1)},{default:d((()=>[u("取消")])),_:1}),i(q,{type:"primary","native-type":"submit"},{default:d((()=>[u("确认")])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])],64)}}}),[["__scopeId","data-v-a1352a28"]]);export{x as default};
