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