2 lines
7.3 KiB
JavaScript
2 lines
7.3 KiB
JavaScript
|
import{G as Z,H as z,k as h,w as J,M as W,b as X,N as Y,D as ee,v as oe,F as te,I as ue,L as le}from"./element-plus.4a7d92a3.js";import{_ as ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.2f5acd23.js";import{_ as se}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.ad88061a.js";import{w as re}from"./index.61122cf1.js";import{d as ie}from"./store_product.5b7083db.js";import{d as U,s as ne,r,Z as pe,ap as de,o as v,K as b,L as u,a as m,U as e,u as d,R as i,S as me,M as R,Q as ce,j as D}from"./@vue.18505fe0.js";import"./lodash.9dc701ad.js";import{u as _e,a as fe}from"./vue-router.101084e3.js";import{a as Ee}from"./store_product_unit.e18e246f.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.7347fedc.js";import"./axios.4607972f.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.5d4e738c.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.44e45292.js";import"./warehouse_product_storege.193cf6dc.js";import"./system_store.e4bc79d0.js";import"./pinia.a969beab.js";import"./css-color-function.bb8c34b2.js";import"./color.fbd63fe8.js";import"./clone.31a3aa2c.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.0d2736b7.js";import"./vue-clipboard3.7d5a7a5d.js";import"./clipboard.860a1cea.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const we=m("div",{class:"mb-4 text-lg font-bold"},"\u5BFC\u5165\u5546\u54C1\u5230\u95E8\u5E97",-1),he={class:"flex-1 w-full"},ve={class:"mb-2"},be={class:"flex-1 w-full"},Be={class:"mb-2"},ke=m("span",{class:"text-info text-xs ml-6"},"\u9ED8\u8BA4\u4E3A\u5206\u914D\u552E\u5356\u5E93\u5B58, \u5982\u9700\u5206\u914D\u5151\u6362\u5E93\u5B58\u8BF7\u9009\u62E9\u5206\u914D\u5151\u6362\u5E93\u5B58",-1),Ce=U({name:"storeProductEdit"}),_o=U({...Ce,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(De,{emit:ge}){const g=_e(),I=ne(),{removeTab:y}=re();r("add");const f=r("");r(0);const L=pe({store_id:""});g.query.warehouse_id&&(f.value=parseInt(g.query.warehouse_id));const c=r(!1),n=r([]),N=s=>{n.value=n.value.filter(t=>t.id!==s)},P=s=>{s.forEach(t=>{n.value.find(o=>o.id==t.id)||n.value.push(t)}),k(),c.value=!1},_=r(!1),p=r([]),T=s=>{p.value=p.value.filter(t=>t.id!==s)},$=s=>{s.forEach(t=>{p.value.find(o=>o.id==t.id)||p.value.push(t)}),_.value=!1},M=r([]);(()=>{Ee({}).then(s=>{M.value=s.lists})})();const E=r(1),B=r(!0),k=()=>{const s=p.value.map(o=>({id:o.product_id,stock:o.new_stock||0,stocks:o.stock||0})),t=n.value.length;if(t>0&&s.length>0)try{s.forEach(o=>{if(o.stock*t>o.stocks)throw B.value=!1,new Error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E")})}catch{h.error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E");return}B.value=!0};fe();const O=async()=>{if(f.value==""){h.error("\u8BF7\u9009\u62E9\u4ED3\u5E93");return}if(k(),B.value==!1)return;const s=p.value.map(o=>({id:o.product_id,stock:o.new_stock||0,batch:o.batch||0})),t=n.value.map(o=>o.id);ie({product_arr:s,store_arr:t,stock_type:E.value,warehouse_id:f.value}).then(o=>{y(),o.code==1?(h.success(o.msg),setTimeout(()=>{y()},2e3)):h.error(o.msg)})};return(s,t)=>{const o=J,a=W,F=X,x=Y,w=ee,j=oe,V=Z,q=z,G=te,H=se,A=ue,K=ae,Q=le,S=de("perms");return v(),b(Q,null,{default:u(()=>[we,m("div",null,[e(G,{ref_key:"formRef",ref:I,model:d(L),"label-width":"90px"},{default:u(()=>[e(w,{label:"\u95E8\u5E97",prop:"store_id"},{default:u(()=>[m("div",he,[m("div",ve,[e(o,{type:"primary",onClick:t[0]||(t[0]=l=>c.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(x,{data:d(n)},{default:u(()=>[e(a,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97\u540D\u
|