2 lines
9.0 KiB
JavaScript
2 lines
9.0 KiB
JavaScript
import{a0 as W,G as X,H as Y,D as ee,C as ue,w as le,M as oe,b as te,N as ae,F as re,I as se,L as ie}from"./element-plus.1e96d4ee.js";import{a as de,b as pe,c as ne,_ as me}from"./store_product.5974de33.js";import{_ as _e}from"./picker.71241094.js";import{q as ce}from"./index.b0f5afd3.js";import{d as L,s as fe,r as F,Z as S,i as Fe,ap as be,o as b,K as E,L as r,a as w,S as A,u as o,U as u,R as c,Q as D,M as Ee,j as ge}from"./@vue.18505fe0.js";import"./lodash.60201f64.js";import{a as Ce,u as Be}from"./vue-router.101084e3.js";import{a as Ve}from"./store_category.318ca73c.js";import{a as ve}from"./store_product_unit.a637ff0a.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.8ae0c638.js";import"./axios.2b8d80bd.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.272adef5.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.39c54f9f.js";import"./system_store.fa2b087c.js";import"./index.daae848a.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.66b5e065.js";import"./index.b9d3ac56.js";import"./vuedraggable.d1fd737a.js";import"./vue.feef8fd6.js";import"./sortablejs.c8f4cbb7.js";import"./pinia.a969beab.js";import"./css-color-function.b82a2ce7.js";import"./color.b905eb26.js";import"./clone.e1fb2883.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.495afef3.js";import"./vue-clipboard3.cb649e18.js";import"./clipboard.4592e390.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const ye={class:"mb-4 text-lg font-bold"},De=w("div",{class:"w-full",style:{color:"#64748b"}},"\u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528",-1),we={class:"mb-2"},he=L({name:"storeProductEdit"}),yu=L({...he,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(ke,{emit:Ue}){const h=fe(),{removeTab:R}=ce(),n=F("add"),l=S({id:"",image:"",store_name:"",bar_code:"",cate_arr:[],cate_id:"",price:"",unit:"",stock:"",cost:"",purchase:"",rose:"0",is_store_all:1}),f=F(!1),m=F([]),x=a=>{m.value=m.value.filter(e=>e.id!==a)},P=a=>{a.forEach(e=>{m.value.find(d=>d.id==e.id)||m.value.push(e)}),f.value=!1};let g,C,B=F(!1),V;Fe(()=>{});const N=a=>(V=a,B.value=!0,k.lazyLoad(C,g),!1),k={value:"id",label:"name",emitPath:!1,lazy:!0,checkStrictly:!0,lazyLoad(a,e){g||(g=e),C||(C=a);let d=a.value||0,s={};B.value?(s={name:V},V||(s={pid:d,page_size:1e4})):s={pid:d,page_size:1e4},Ve({...s}).then(i=>{e(i.lists.map(_=>(_.leaf=_.is_children==0,B.value=!1,_)))})}},U=F([]);(()=>{ve({}).then(a=>{U.value=a.lists})})();const z=S({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],bar_code:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",trigger:["blur"]}],cate_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],price:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u4EF7\u683C",trigger:["blur"]}],unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5355\u4F4D",trigger:["blur","change"]}],stock:[{required:!0,message:"\u8BF7\u8F93\u5165\u5E93\u5B58",trigger:["blur"]}],cost:[{required:!0,message:"\u8BF7\u8F93\u5165\u6210\u672C\u4EF7",trigger:["blur"]}],purchase:[{required:!0,message:"\u8BF7\u8F93\u5165\u91C7\u8D2D\u4EF7",trigger:["blur"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),I=async a=>{for(const e in l)a[e]!=null&&a[e]!=null&&(l[e]=a[e]);l.cate_arr[0]&&(l.cate_arr=l.cate_arr.map(e=>Number(e)))},T=async a=>{const e=await de({id:a.id});I(e)},M=Ce(),v=Be(),$=async()=>{var e;await((e=h.value)==null?void 0:e.validate());let a={...l};l.is_store_all==0&&n.value=="add"?a.store_arr=m.value.map(d=>d.id):n.value=="edit"&&(a.is_store_all=0),a.cate_id=a.cate_arr,delete a.cate_arr,n.value=="edit"?await pe(a):await ne(a),R(),M.push({path:"/store/store_product"})};return v.query.id&&v.query.mode=="edit"&&(n.value="edit",T({id:v.query.id})),(a,e)=>{const d=_e,s=ee,i=ue,_=W,q=X,j=Y,y=le,p=oe,G=te,O=ae,H=re,K=me,Q=se,Z=ie,J=be("perms");return b(),E(Z,null,{default:r(()=>[w("div",ye,A(o(n)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),u(H,{ref_key:"formRef",ref:h,model:o(l),"label-width":"90px",rules:o(z)},{default:r(()=>[u(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:r(()=>[u(d,{modelValue:o(l).image,"onUpdate:modelValue":e[0]||(e[0]=t=>o(l).image=t),limit:1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:r(()=>[u(i,{modelValue:o(l).store_name,"onUpdate:modelValue":e[1]||(e[1]=t=>o(l).store_name=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code"},{default:r(()=>[u(i,{modelValue:o(l).bar_code,"onUpdate:modelValue":e[2]||(e[2]=t=>o(l).bar_code=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:r(()=>[u(_,{style:{width:"100%"},modelValue:o(l).cate_arr,"onUpdate:modelValue":e[3]||(e[3]=t=>o(l).cate_arr=t),class:"caser",filterable:"","before-filter":N,props:k,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price"},{default:r(()=>[u(i,{modelValue:o(l).price,"onUpdate:modelValue":e[4]||(e[4]=t=>o(l).price=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u4EF7\u683C",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:r(()=>[u(_,{style:{width:"100%"},modelValue:o(l).unit,"onUpdate:modelValue":e[5]||(e[5]=t=>o(l).unit=t),options:o(U),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(s,{label:"\u5E93\u5B58",prop:"stock"},{default:r(()=>[u(i,{modelValue:o(l).stock,"onUpdate:modelValue":e[6]||(e[6]=t=>o(l).stock=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5E93\u5B58",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u6210\u672C\u4EF7",prop:"cost"},{default:r(()=>[u(i,{modelValue:o(l).cost,"onUpdate:modelValue":e[7]||(e[7]=t=>o(l).cost=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6210\u672C\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u91C7\u8D2D\u4EF7",prop:"purchase"},{default:r(()=>[u(i,{modelValue:o(l).purchase,"onUpdate:modelValue":e[8]||(e[8]=t=>o(l).purchase=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u91C7\u8D2D\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u4E0A\u6D6E\u6BD4\u4F8B",prop:"rose"},{default:r(()=>[u(i,{modelValue:o(l).rose,"onUpdate:modelValue":e[9]||(e[9]=t=>o(l).rose=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4E0A\u6D6E\u6BD4\u4F8B",readonly:!1},null,8,["modelValue"])]),_:1}),o(n)=="add"?(b(),E(s,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:r(()=>[u(j,{modelValue:o(l).is_store_all,"onUpdate:modelValue":e[10]||(e[10]=t=>o(l).is_store_all=t)},{default:r(()=>[u(q,{label:1},{default:r(()=>[c("\u5168\u90E8\u95E8\u5E97")]),_:1}),u(q,{label:0},{default:r(()=>[c("\u90E8\u5206\u95E8\u5E97")]),_:1})]),_:1},8,["modelValue"]),De,w("div",we,[o(l).is_store_all==0?(b(),E(y,{key:0,type:"primary",onClick:e[11]||(e[11]=t=>f.value=!0)},{default:r(()=>[c("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):D("",!0)]),o(l).is_store_all==0?(b(),E(O,{key:0,data:o(m)},{default:r(()=>[u(p,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(p,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(p,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(p,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(p,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:r(({row:t})=>[u(G,{src:t.image,class:"w-[50px] h-[50px]"},null,8,["src"])]),_:1}),u(p,{label:"\u662F\u5426\u663E\u793A",prop:"is_show","show-overflow-tooltip":""},{default:r(({row:t})=>[c(A(t.is_show?"\u663E\u793A":"\u9690\u85CF"),1)]),_:1}),u(p,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:r(({row:t})=>[Ee((b(),E(y,{type:"danger",link:"",onClick:Se=>x(t.id)},{default:r(()=>[c(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[J,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):D("",!0)]),_:1})):D("",!0),u(s,{label:""},{default:r(()=>[u(y,{onClick:$,type:"primary",class:"w-40"},{default:r(()=>[c("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model","rules"]),u(Q,{modelValue:o(f),"onUpdate:modelValue":e[12]||(e[12]=t=>ge(f)?f.value=t:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:r(()=>[u(K,{onOnBindStore:P})]),_:1},8,["modelValue"])]),_:1})}}});export{yu as default};
|