import{C as K,D as O,w as Q,F as Z,L as z,M as G,N as H,O as J}from"./element-plus.1e96d4ee.js";import{_ as W}from"./index.vue_vue_type_script_setup_true_lang.272adef5.js";import{f as X,b as Y}from"./index.b0f5afd3.js";import{u as ee}from"./usePaging.6a6670f9.js";import{u as te}from"./useDictOptions.39c54f9f.js";import{b as oe,e as ae,a as le}from"./store_product_unit.a637ff0a.js";import{_ as ne}from"./detail.vue_vue_type_script_setup_true_name_brandEdit_lang.731923c3.js";import{_ as ie}from"./edit.vue_vue_type_script_setup_true_name_unitEdit_lang.3d2a5b16.js";import{d as x,r as F,Z as se,ap as ue,o as i,c as re,U as t,L as a,u as o,R as s,M as p,K as u,a as V,S as de,j as me,Q as $,n as y}from"./@vue.18505fe0.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"./lodash.60201f64.js";import"./vue-router.101084e3.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";import"./index.daae848a.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";const pe={class:"mt-4"},ce={class:"flex mt-4 justify-end"},_e=x({name:"unitLists"}),tt=x({..._e,setup(fe){const c=F(null),D=F(null),b=F(!1),g=F(!1),k=se({name:"",py:"",number:"",data:"",more:""}),w=F([]),P=n=>{w.value=n.map(({id:e})=>e)},{dictData:h}=te(""),{pager:_,getLists:f,resetParams:L,resetPage:R}=ee({fetchFun:le,params:k}),U=async()=>{var n;b.value=!0,await y(),(n=c.value)==null||n.open("add")},N=async n=>{var e,r;console.log(c.value),b.value=!0,await y(),(e=c.value)==null||e.open("edit"),(r=c.value)==null||r.setFormData(n)},T=async n=>{var r,v;let e=await oe({id:n});g.value=!0,await y(),(r=D.value)==null||r.open("edit"),(v=D.value)==null||v.setFormData(e)},E=async n=>{await X.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await ae({id:n}),f()};return f(),(n,e)=>{const r=K,v=O,d=Q,I=Z,S=z,j=Y,m=G,A=H,M=W,C=ue("perms"),q=J;return i(),re("div",null,[t(S,{class:"!border-none mb-4",shadow:"never"},{default:a(()=>[t(I,{class:"mb-[-16px]",model:o(k),inline:""},{default:a(()=>[t(v,{label:"\u5355\u4F4D\u540D\u79F0",prop:"name"},{default:a(()=>[t(r,{class:"w-[280px]",modelValue:o(k).name,"onUpdate:modelValue":e[0]||(e[0]=l=>o(k).name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(v,null,{default:a(()=>[t(d,{type:"primary",onClick:o(R)},{default:a(()=>[s("\u67E5\u8BE2")]),_:1},8,["onClick"]),t(d,{onClick:o(L)},{default:a(()=>[s("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),p((i(),u(S,{class:"!border-none",shadow:"never"},{default:a(()=>[p((i(),u(d,{type:"primary",onClick:U},{icon:a(()=>[t(j,{name:"el-icon-Plus"})]),default:a(()=>[s(" \u65B0\u589E ")]),_:1})),[[C,["goods.unit/add"]]]),p((i(),u(d,{disabled:!o(w).length,onClick:e[1]||(e[1]=l=>E(o(w)))},{default:a(()=>[s(" \u5220\u9664 ")]),_:1},8,["disabled"])),[[C,["goods.unit/delete"]]]),V("div",pe,[t(A,{data:o(_).lists,onSelectionChange:P},{default:a(()=>[t(m,{type:"selection",width:"55"}),t(m,{label:"ID",prop:"id",width:"55"}),t(m,{label:"\u5355\u4F4D\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),t(m,{label:"\u5355\u4F4D\u7F16\u53F7",prop:"number","show-overflow-tooltip":""}),t(m,{label:"\u662F\u5426\u6563\u88C5",prop:"is_bulk","show-overflow-tooltip":""},{default:a(({row:l})=>[s(de(l.is_bulk?"\u662F":"\u5426"),1)]),_:1}),t(m,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"data","show-overflow-tooltip":""}),t(m,{label:"\u64CD\u4F5C",width:"170",fixed:"right"},{default:a(({row:l})=>[p((i(),u(d,{type:"primary",link:"",onClick:B=>N(l)},{default:a(()=>[s(" \u7F16\u8F91 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/edit"]]]),p((i(),u(d,{type:"danger",link:"",onClick:B=>E(l.id)},{default:a(()=>[s(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/delete"]]]),p((i(),u(d,{link:"",onClick:B=>T(l.id)},{default:a(()=>[s(" \u8BE6\u60C5 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/edit"]]])]),_:1})]),_:1},8,["data"])]),V("div",ce,[t(M,{modelValue:o(_),"onUpdate:modelValue":e[2]||(e[2]=l=>me(_)?_.value=l:null),onChange:o(f)},null,8,["modelValue","onChange"])])]),_:1})),[[q,o(_).loading]]),o(b)?(i(),u(ie,{key:0,ref_key:"editRef",ref:c,"dict-data":o(h),onSuccess:o(f),onClose:e[3]||(e[3]=l=>b.value=!1)},null,8,["dict-data","onSuccess"])):$("",!0),o(g)?(i(),u(ne,{key:1,ref_key:"detailRef",ref:D,"dict-data":o(h),onSuccess:o(f),onClose:e[4]||(e[4]=l=>g.value=!1)},null,8,["dict-data","onSuccess"])):$("",!0)])}}});export{tt as default};