import{aT as p,ac as P,al as B,a$ as D,_ as E,d as x,w as f,r as m,o as y,G as w,C as S,j as _,l as h,aN as g}from"./index.js";import $ from"./modal.4f83e1.js";import{u as k}from"./use-page-search.f7bc460e.js";import"./index.da6d65fd.js";const{VITE_PROXY_DOMAIN_REAL:H,VITE_PROXY_USER_REAL:R}=P(),c=R+"/admin/",U=e=>p.request("post",`${c}specslist`,{data:e}),q=e=>p.request("post",`${c}specsedit`,{data:e}),I=e=>p.request("post",`${c}specscreate`,{data:e}),N=e=>p.request("post",`${c}specsstatus`,{data:e}),O=e=>p.request("post",`${c}specsdelete`,{data:e}),v=[{value:"0",label:"\u7981\u7528",type:"warning"},{value:"1",label:"\u542F\u7528",type:"success"}],T=[{prop:"id",label:"ID"},{prop:"spec_name",label:"\u89C4\u683C\u540D\u79F0"},{prop:"status",label:"\u72B6\u6001",width:"80px",cellRenderer:({row:e})=>{var i;return B(D,{type:((i=v.find(({value:n})=>n===String(e.status)))==null?void 0:i.type)||"info"},{default:()=>{var n;return((n=v.find(({value:u})=>u===String(e.status)))==null?void 0:n.label)||"--"}})}},{prop:"addtime",label:"\u521B\u5EFA\u65F6\u95F4"},{prop:"",label:"\u64CD\u4F5C",fixed:"right",slot:"operation",width:"150px"}],L={title:"\u539F\u56E0\u7BA1\u7406",columns:T,apis:{httpList:U,httpAdd:!0,httpStatus:N,httpUpdate:!0,httpDelete:O}},F={formItems:[{field:"create_timer",type:"date_picker",otherOptions:{type:"daterange",startProp:"start",endProp:"end",startPlaceholder:"\u5F00\u59CB\u65F6\u95F4",endPlaceholder:"\u7ED3\u675F\u65F6\u95F4"}},{options:v,type:"select",field:"status",placeholder:"\u72B6\u6001"},{type:"input",field:"spec_name",placeholder:"\u89C4\u683C\u540D\u79F0"}]},M=x({__name:"index",setup(e){const i="specs",n=f(null),u=f(!1),o=f(!1),l=f({}),C={pageSearchHook:()=>k(void 0,void 0,F)},b={content:{create:()=>{u.value=!1,o.value=!0},preview:a=>{const{id:t,spec_name:s}=a;l.value={id:t,spec_name:s},u.value=!0,o.value=!0},update:a=>{const{id:t,spec_name:s}=a;l.value={id:t,spec_name:s},u.value=!1,o.value=!0}}};async function A(){const{id:a,spec_name:t}=l.value,s=a===void 0||!a,d={id:a,spec_name:t};s&&delete d.id,(await(s?I:q)(d)).code===0?(o.value=!1,g.success(`${s?"\u6DFB\u52A0":"\u66F4\u65B0"}\u6210\u529F`),n.value.onSearch()):g.warning(`${s?"\u6DFB\u52A0":"\u66F4\u65B0"}\u5931\u8D25`)}return(a,t)=>{const s=m("PageContainer"),d=m("PageAuth");return y(),w(d,{pageName:i},{default:S(()=>[_(s,{hooks:C,events:b,contentConfig:h(L),"search-config":h(F),"get-content-ref":r=>n.value=r},null,8,["contentConfig","search-config","get-content-ref"]),_($,{visible:o.value,"onUpdate:visible":t[0]||(t[0]=r=>o.value=r),data:l.value,"onUpdate:data":t[1]||(t[1]=r=>l.value=r),disabled:u.value,onSubmit:A},null,8,["visible","data","disabled"])]),_:1})}}});var z=E(M,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/specs/index.vue"]]);export{z as default};
