import{k as c,C as M,D as T,w as U,F as j,M as R,b as q,N as A,O}from"./element-plus.4a7d92a3.js";import{_ as Q}from"./index.vue_vue_type_script_setup_true_lang.5d4e738c.js";import{d as g,Z as W,r as C,o as m,c as v,U as e,L as u,u as a,aa as Z,R as _,M as $,K as b,Q as F,a as z,j as G}from"./@vue.18505fe0.js";import{u as H}from"./usePaging.6a6670f9.js";import{u as J}from"./useDictOptions.e7c04ca5.js";import{a as X}from"./store_product.8483cd7b.js";import{a as Y}from"./store_branch_product.8ff199a3.js";import{a as ee}from"./warehouse_product_storege.e6706ce9.js";import"./lodash.9dc701ad.js";import"./index.8127cda8.js";const oe={class:"mt-4"},te={class:"flex mt-4 justify-end"},ae=g({name:"systemStoreLists"}),_e=g({...ae,props:{is_warehouse:{},is_branch:{},store_id:{},code:{},warehouse_id:{}},emits:["onBindStore"],setup(B,{emit:y}){const t=B,s=W({store_name:"",warehouse_id:"",store_id:""}),h=C([]),p=C(),D=i=>{h.value=i.map(({id:l})=>l)};J(""),t.is_warehouse==1?t.warehouse_id==""||t.warehouse_id==null?c.error("\u8BF7\u5148\u9009\u62E9\u4ED3\u5E93"):(s.warehouse_id=t.warehouse_id,p.value={fetchFun:ee,params:s}):t.is_branch==1?(t.store_id==""||t.store_id==null?c.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97"):s.store_id=t.store_id,p.value={fetchFun:Y,params:s}):p.value={fetchFun:X,params:s};const{pager:r,getLists:w,resetParams:k,resetPage:f}=H(p.value);w();const V=y,x=()=>{const i=r.lists.filter(l=>h.value.includes(l.id));if(!i.length)return c.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97");V("onBindStore",i)};return(i,l)=>{const S=M,E=T,d=U,L=j,o=R,P=q,N=A,I=Q,K=O;return m(),v("div",null,[e(L,{class:"mb-[-16px]",model:a(s),inline:""},{default:u(()=>[e(E,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:u(()=>[e(S,{class:"w-[200px]",modelValue:a(s).store_name,"onUpdate:modelValue":l[0]||(l[0]=n=>a(s).store_name=n),onKeydown:Z(a(f),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue","onKeydown"])]),_:1}),e(E,null,{default:u(()=>[e(d,{type:"primary",onClick:a(f)},{default:u(()=>[_("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(d,{onClick:a(k)},{default:u(()=>[_("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),$((m(),v("div",oe,[e(N,{data:a(r).lists,onSelectionChange:D,height:300},{default:u(()=>[e(o,{type:"selection",width:"55"}),e(o,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(o,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:u(({row:n})=>[e(P,{style:{width:"50px",height:"50px"},src:n.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(o,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(o,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(o,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(o,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(o,{label:"\u6210\u672C\u4EF7",prop:"cost","min-width":"100","show-overflow-tooltip":""}),e(o,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase","min-width":"100","show-overflow-tooltip":""}),e(o,{label:"\u552E\u5356\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),t.is_warehouse!=1?(m(),b(o,{key:0,label:"\u5151\u6362\u5E93\u5B58",prop:"swap","min-width":"100","show-overflow-tooltip":""})):F("",!0),t.is_warehouse!=1?(m(),b(o,{key:1,label:"\u9500\u91CF",prop:"sales","min-width":"100","show-overflow-tooltip":""})):F("",!0)]),_:1},8,["data"])])),[[K,a(r).loading]]),z("div",te,[e(I,{modelValue:a(r),"onUpdate:modelValue":l[1]||(l[1]=n=>G(r)?r.value=n:null),onChange:a(w)},null,8,["modelValue","onChange"])]),e(d,{class:"w-full mt-4",type:"primary",onClick:x},{default:u(()=>[_("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}});export{_e as _};
