moreShopAdmin/build/admin/assets/import.de91fcb1.js

2 lines
7.2 KiB
JavaScript
Raw Normal View History

2024-08-10 20:55:05 +08:00
import{G as Z,H as z,k as A,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.a63a26dd.js";import{_ as ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.38c1be0d.js";import{_ as se}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.02f6833c.js";import{k as re}from"./index.001143d7.js";import{e as ie}from"./store_product.9ff6eca7.js";import{d as R,s as ne,r,Z as pe,ap as de,o as h,K as v,L as u,a as m,U as e,u as d,R as i,S as me,M as S,Q as ce,j as C}from"./@vue.18505fe0.js";import"./lodash.2473fc51.js";import{u as _e,a as fe}from"./vue-router.101084e3.js";import{a as Ee}from"./store_product_unit.e6dc65e3.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.4884cfc2.js";import"./axios.932d3f8a.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.ecb80feb.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.b7746e6d.js";import"./warehouse_product_storege.098b4f23.js";import"./system_store.750438da.js";import"./pinia.a969beab.js";import"./css-color-function.9f6a56f3.js";import"./color.d1bc3784.js";import"./clone.83700f2e.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.fcc9be76.js";import"./vue-clipboard3.9e751565.js";import"./clipboard.dda64e67.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=R({name:"storeProductEdit"}),_o=R({...Ce,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(De,{emit:ye}){const D=_e(),U=ne(),{removeTab:I}=re();r("add");const f=r("");r(0);const L=pe({store_id:""});D.query.warehouse_id&&(f.value=parseInt(D.query.warehouse_id));const c=r(!1),n=r([]),N=s=>{n.value=n.value.filter(o=>o.id!==s)},P=s=>{s.forEach(o=>{n.value.find(t=>t.id==o.id)||n.value.push(o)}),B(),c.value=!1},_=r(!1),p=r([]),T=s=>{p.value=p.value.filter(o=>o.id!==s)},$=s=>{s.forEach(o=>{p.value.find(t=>t.id==o.id)||p.value.push(o)}),_.value=!1},M=r([]);(()=>{Ee({}).then(s=>{M.value=s.lists})})();const E=r(1),b=r(!0),B=()=>{const s=p.value.map(t=>({id:t.product_id,stock:t.new_stock||0,stocks:t.stock||0})),o=n.value.length;if(o>0&&s.length>0)try{s.forEach(t=>{if(t.stock*o>t.stocks)throw b.value=!1,new Error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E")})}catch{A.error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E");return}b.value=!0};fe();const O=async()=>{if(f.value==""){A.error("\u8BF7\u9009\u62E9\u4ED3\u5E93");return}if(B(),b.value==!1)return;const s=p.value.map(t=>({id:t.product_id,stock:t.new_stock||0,batch:t.batch||0})),o=n.value.map(t=>t.id);ie({product_arr:s,store_arr:o,stock_type:E.value,warehouse_id:f.value}).then(t=>{setTimeout(()=>{I()},2e3)})};return(s,o)=>{const t=J,a=W,y=X,g=Y,w=ee,j=oe,F=Z,q=z,G=te,H=se,x=ue,K=ae,Q=le,V=de("perms");return h(),v(Q,null,{default:u(()=>[we,m("div",null,[e(G,{ref_key:"formRef",ref:U,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(t,{type:"primary",onClick:o[0]||(o[0]=l=>c.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(g,{data:d(n)},{default:u(()=>[e(a,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),e