import{k as w,C as T,D as U,w as j,F as R,M as $,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 F,Z as W,r as v,o as p,c as C,U as e,L as u,u as l,aa as Z,R as h,M as z,K as d,Q as b,a as G,j as H}from"./@vue.18505fe0.js";import{u as J}from"./usePaging.6a6670f9.js";import{u as X}from"./useDictOptions.b027b472.js";import{a as Y}from"./store_product.f1012f05.js";import{a as ee}from"./store_branch_product.bc62eb8c.js";import{a as oe}from"./warehouse_product_storege.40e85fa3.js";import"./lodash.9dc701ad.js";import"./index.9fc4c153.js";const te={class:"mt-4"},se={class:"flex mt-4 justify-end"},ae=F({name:"systemStoreLists"}),we=F({...ae,props:{is_warehouse:{},is_branch:{},store_id:{},code:{},warehouse_id:{}},emits:["onBindStore"],setup(g,{emit:B}){const t=g,a=W({store_name:"",warehouse_id:"",store_id:"",product_type:""}),f=v([]),m=v(),y=i=>{f.value=i.map(({id:s})=>s)};X(""),t.is_warehouse==1?t.warehouse_id==""||t.warehouse_id==null?w.error("\u8BF7\u5148\u9009\u62E9\u4ED3\u5E93"):(a.warehouse_id=t.warehouse_id,m.value={fetchFun:oe,params:a}):t.is_branch==1?(t.store_id==""||t.store_id==null?w.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97"):a.store_id=t.store_id,m.value={fetchFun:ee,params:a}):(a.product_type="0",m.value={fetchFun:Y,params:a});const D=()=>{c()},{pager:r,getLists:c,resetParams:k,resetPage:V}=J(m.value);c();const S=B,x=()=>{const i=r.lists.filter(s=>f.value.includes(s.id));if(!i.length)return w.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97");S("onBindStore",i)};return(i,s)=>{const L=T,E=U,_=j,P=R,o=$,I=q,N=A,K=Q,M=O;return p(),C("div",null,[e(P,{class:"mb-[-16px]",model:l(a),inline:""},{default:u(()=>[e(E,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:u(()=>[e(L,{class:"w-[200px]",modelValue:l(a).store_name,"onUpdate:modelValue":s[0]||(s[0]=n=>l(a).store_name=n),onKeydown:s[1]||(s[1]=Z(n=>D(),["enter"])),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e(E,null,{default:u(()=>[e(_,{type:"primary",onClick:l(V)},{default:u(()=>[h("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(_,{onClick:l(k)},{default:u(()=>[h("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),z((p(),C("div",te,[e(N,{data:l(r).lists,onSelectionChange:y,height:300},{default:u(()=>[e(o,{type:"selection",width:"55"}),i.is_warehouse==0?(p(),d(o,{key:0,label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""})):(p(),d(o,{key:1,label:"\u5546\u54C1ID",prop:"product_id","show-overflow-tooltip":""})),e(o,{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(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?(p(),d(o,{key:2,label:"\u5151\u6362\u5E93\u5B58",prop:"swap","min-width":"100","show-overflow-tooltip":""})):b("",!0),t.is_warehouse!=1?(p(),d(o,{key:3,label:"\u9500\u91CF",prop:"sales","min-width":"100","show-overflow-tooltip":""})):b("",!0)]),_:1},8,["data"])])),[[M,l(r).loading]]),G("div",se,[e(K,{modelValue:l(r),"onUpdate:modelValue":s[2]||(s[2]=n=>H(r)?r.value=n:null),onChange:l(c)},null,8,["modelValue","onChange"])]),e(_,{class:"w-full mt-4",type:"primary",onClick:x},{default:u(()=>[h("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}});export{we as _};
