import{aT as l,ac as D,al as P,a$ as B,_ as E,d as x,w as f,r as m,o as y,G as w,C as S,j as h,l as g,aN as F}from"./index.js";import $ from"./modal.70be52.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}=D(),p=R+"/admin/",U=e=>l.request("post",`${p}unitlist`,{data:e}),q=e=>l.request("post",`${p}unitedit`,{data:e}),I=e=>l.request("post",`${p}unitcreate`,{data:e}),N=e=>l.request("post",`${p}unitstatus`,{data:e}),O=e=>l.request("post",`${p}unitdelete`,{data:e}),v=[{value:"0",label:"\u7981\u7528",type:"warning"},{value:"1",label:"\u542F\u7528",type:"success"}],T=[{prop:"id",label:"ID"},{prop:"unit",label:"\u5355\u4F4D\u540D\u79F0"},{prop:"status",label:"\u72B6\u6001",width:"80px",cellRenderer:({row:e})=>{var c;return P(B,{type:((c=v.find(({value:u})=>u===String(e.status)))==null?void 0:c.type)||"info"},{default:()=>{var u;return((u=v.find(({value:n})=>n===String(e.status)))==null?void 0:u.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}},_={formItems:[{field:"create_timer",type:"date_picker",otherOptions:{endProp:"end",startProp:"start",type:"daterange",startPlaceholder:"\u5F00\u59CB\u65F6\u95F4",endPlaceholder:"\u7ED3\u675F\u65F6\u95F4"}},{options:v,placeholder:"\u72B6\u6001",field:"status",type:"select"},{field:"unit",placeholder:"\u5355\u4F4D\u540D\u79F0",type:"input"}]},M=x({__name:"index",setup(e){const c="unit",u=f(null),n=f(!1),o=f(!1),i=f({}),b={pageSearchHook:()=>k(void 0,void 0,_)},C={content:{create:()=>{n.value=!1,o.value=!0},preview:s=>{const{id:t,unit:a}=s;i.value={id:t,unit:a},n.value=!0,o.value=!0},update:s=>{const{id:t,unit:a}=s;i.value={id:t,unit:a},n.value=!1,o.value=!0}}};async function A(){const{id:s,unit:t}=i.value,a=s===void 0||!s,d={id:s,unit:t};a&&delete d.id,(await(a?I:q)(d)).code===0?(o.value=!1,F.success(`${a?"\u6DFB\u52A0":"\u66F4\u65B0"}\u6210\u529F`),u.value.onSearch()):F.warning(`${a?"\u6DFB\u52A0":"\u66F4\u65B0"}\u5931\u8D25`)}return(s,t)=>{const a=m("PageContainer"),d=m("PageAuth");return y(),w(d,{pageName:c},{default:S(()=>[h(a,{hooks:b,events:C,contentConfig:g(L),"search-config":g(_),"get-content-ref":r=>u.value=r},null,8,["contentConfig","search-config","get-content-ref"]),h($,{visible:o.value,"onUpdate:visible":t[0]||(t[0]=r=>o.value=r),data:i.value,"onUpdate:data":t[1]||(t[1]=r=>i.value=r),disabled:n.value,onSubmit:A},null,8,["visible","data","disabled"])]),_:1})}}});var z=E(M,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/unit/index.vue"]]);export{z as default};
