import{C as K,D as M,w as O,F as Z,T as z,O as G,Q as H,R as J}from"./element-plus.9990c39e.js";import{_ as W}from"./index.vue_vue_type_script_setup_true_lang.3de7c996.js";import{f as X,b as Y}from"./index.9424646f.js";import{u as ee}from"./usePaging.6a6670f9.js";import{u as te}from"./useDictOptions.d0c29343.js";import{b as oe,e as ae,a as le}from"./unit.fff8ff82.js";import{_ as ne}from"./detail.vue_vue_type_script_setup_true_name_brandEdit_lang.46c055fa.js";import{_ as ie}from"./edit.vue_vue_type_script_setup_true_name_unitEdit_lang.6caee507.js";import{d as R,r as b,Z as se,ap as ue,o as i,c as re,U as t,L as a,u as o,R as d,M as _,K as u,a as x,j as me,Q as $,n as y}from"./@vue.18505fe0.js";import"./lodash-es.bdeecbdb.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.ef95d8c0.js";import"./axios.77245e3c.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./lodash.be6e4bb5.js";import"./vue-router.886c5f5a.js";import"./pinia.a969beab.js";import"./css-color-function.6061d63f.js";import"./color.1580a89c.js";import"./clone.4ed29f58.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.b29ee5e2.js";import"./vue-clipboard3.15c43b43.js";import"./clipboard.4a3580c9.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";import"./index.1fdb40b8.js";const de={class:"mt-4"},pe={class:"flex mt-4 justify-end"},ce=R({name:"unitLists"}),Ye=R({...ce,setup(_e){const f=b(null),k=b(null),D=b(!1),w=b(!1),p=se({name:"",py:"",number:"",data:"",more:""}),g=b([]),U=n=>{g.value=n.map(({id:e})=>e)},{dictData:E}=te(""),{pager:F,getLists:v,resetParams:S,resetPage:L}=ee({fetchFun:le,params:p}),P=async()=>{var n;D.value=!0,await y(),(n=f.value)==null||n.open("add")},T=async n=>{var e,s;console.log(f.value),D.value=!0,await y(),(e=f.value)==null||e.open("edit"),(s=f.value)==null||s.setFormData(n)},N=async n=>{var s,c;let e=await oe({id:n});w.value=!0,await y(),(s=k.value)==null||s.open("edit"),(c=k.value)==null||c.setFormData(e)},h=async n=>{await X.confirm("\u786E\u5B9A\u8981\u5220\u9664\uFF1F"),await ae({id:n}),v()};return v(),(n,e)=>{const s=K,c=M,r=O,I=Z,V=z,j=Y,m=G,A=H,Q=W,C=ue("perms"),q=J;return i(),re("div",null,[t(V,{class:"!border-none mb-4",shadow:"never"},{default:a(()=>[t(I,{class:"mb-[-16px]",model:o(p),inline:""},{default:a(()=>[t(c,{label:"\u5355\u4F4D\u540D\u79F0",prop:"name"},{default:a(()=>[t(s,{class:"w-[280px]",modelValue:o(p).name,"onUpdate:modelValue":e[0]||(e[0]=l=>o(p).name=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(c,{label:"\u5355\u4F4D\u7F16\u53F7",prop:"number"},{default:a(()=>[t(s,{class:"w-[280px]",modelValue:o(p).number,"onUpdate:modelValue":e[1]||(e[1]=l=>o(p).number=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u7F16\u53F7"},null,8,["modelValue"])]),_:1}),t(c,null,{default:a(()=>[t(r,{type:"primary",onClick:o(L)},{default:a(()=>[d("\u67E5\u8BE2")]),_:1},8,["onClick"]),t(r,{onClick:o(S)},{default:a(()=>[d("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),_((i(),u(V,{class:"!border-none",shadow:"never"},{default:a(()=>[_((i(),u(r,{type:"primary",onClick:P},{icon:a(()=>[t(j,{name:"el-icon-Plus"})]),default:a(()=>[d(" \u65B0\u589E ")]),_:1})),[[C,["goods.unit/add"]]]),_((i(),u(r,{disabled:!o(g).length,onClick:e[2]||(e[2]=l=>h(o(g)))},{default:a(()=>[d(" \u5220\u9664 ")]),_:1},8,["disabled"])),[[C,["goods.unit/delete"]]]),x("div",de,[t(A,{data:o(F).lists,onSelectionChange:U},{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:"\u5907\u6CE8\u4FE1\u606F",prop:"data","show-overflow-tooltip":""}),t(m,{label:"\u6269\u5C55\u4FE1\u606F",prop:"more","show-overflow-tooltip":""}),t(m,{label:"\u64CD\u4F5C",width:"170",fixed:"right"},{default:a(({row:l})=>[_((i(),u(r,{type:"primary",link:"",onClick:B=>T(l)},{default:a(()=>[d(" \u7F16\u8F91 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/edit"]]]),_((i(),u(r,{type:"danger",link:"",onClick:B=>h(l.id)},{default:a(()=>[d(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/delete"]]]),_((i(),u(r,{link:"",onClick:B=>N(l.id)},{default:a(()=>[d(" \u8BE6\u60C5 ")]),_:2},1032,["onClick"])),[[C,["goods.unit/edit"]]])]),_:1})]),_:1},8,["data"])]),x("div",pe,[t(Q,{modelValue:o(F),"onUpdate:modelValue":e[3]||(e[3]=l=>me(F)?F.value=l:null),onChange:o(v)},null,8,["modelValue","onChange"])])]),_:1})),[[q,o(F).loading]]),o(D)?(i(),u(ie,{key:0,ref_key:"editRef",ref:f,"dict-data":o(E),onSuccess:o(v),onClose:e[4]||(e[4]=l=>D.value=!1)},null,8,["dict-data","onSuccess"])):$("",!0),o(w)?(i(),u(ne,{key:1,ref_key:"detailRef",ref:k,"dict-data":o(E),onSuccess:o(v),onClose:e[5]||(e[5]=l=>w.value=!1)},null,8,["dict-data","onSuccess"])):$("",!0)])}}});export{Ye as default};