import{a0 as D,ax as J,M as I}from"./index.17037962789732.js";import"./index.1703796278973300.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import"./index.170379627897336.js";import{_ as L}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import{q as M,d as V}from"./category.1703796278973.js";import{_ as N}from"./index.vue_vue_type_script_setup_true_name_modifyModal_lang.1703796278973.js";import{d as b,k as o,v as w,V as x,a3 as $,r as m,o as h,c as R,a as s,b as r,u as e,M as j,t as U,x as z,F as G,h as H}from"./vue.1703796278973.js";import{_ as Q}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./permission.1703796278973.js";import"./system.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";import"./index.170379627897337.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897325.js";const W=b({name:"Category"}),X=b({...W,setup(Y){const i=o([]),u=o({}),a=o();o([]);const l=o({}),c=o(""),p=o(0),d=o(0),T=o(!1),P=w({columns:[{title:"名称",dataIndex:"name",key:"name",search:{type:"string"}},{title:"排序",dataIndex:"sortIndex",key:"sortIndex",search:{type:"number"},scopedSlots:!0},{title:"描述",key:"description",dataIndex:"description",search:{type:"string"}},{title:"操作",key:"action",fixed:"right",width:250,scopedSlots:!0}]});let k=o();const A=t=>{k.value=t,i.value=[]},S=(t,_)=>t?[{key:"update",text:"编辑",tooltip:{title:"编辑"},icon:"EditOutlined",onClick:async()=>{c.value="编辑分类",p.value=2,l.value=t,x(()=>{a.value.show(t)})}},{key:"add",text:"添加子分类",tooltip:{title:"添加子分类"},icon:"PlusCircleOutlined",onClick:()=>{c.value="新增子分类",p.value=0,l.value={},t.children&&t.children.length>0?d.value=1:d.value=2,x(()=>{a.value.show(t)})}},{key:"delete",text:"删除",tooltip:{title:"删除"},popConfirm:{title:"确认删除?",okText:" 确定",cancelText:"取消",onConfirm:async()=>{(await V(t.id)).status===200?(I.success("操作成功！"),u.value.reload()):I.error("操作失败！")}},icon:"DeleteOutlined"}]:[],v=w({columns:[{title:"名称",dataIndex:"name",key:"name",ellipsis:!0,width:500},{title:"排序",dataIndex:"sortIndex",key:"sortIndex",scopedSlots:!0,width:100},{title:"说明",dataIndex:"description",key:"description",ellipsis:!0},{title:"操作",key:"action",fixed:"right",ellipsis:!0,scopedSlots:!0,width:120}],add:async()=>{c.value="新增分类",p.value=0,d.value=3,x(()=>{a.value.show(l.value)})},refresh:()=>{u.value.reload()}}),{add:q,columns:Z,refresh:B}=$(v);return(t,_)=>{const g=m("pro-search"),f=m("AIcon"),C=L,E=D,F=J,K=m("FullPage"),O=m("page-container");return h(),R(O,null,{default:s(()=>[r(g,{columns:e(P).columns,target:"category",onSearch:A},null,8,["columns"]),r(K,null,{default:s(()=>[r(F,{ref_key:"tableRef",ref:u,columns:e(v).columns,request:e(M),model:"TABLE",type:"TREE",expandedRowKeys:e(i),"onUpdate:expandedRowKeys":_[0]||(_[0]=y=>j(i)?i.value=y:null),scroll:{y:550},defaultParams:{paging:!1,sorts:[{name:"sortIndex",order:"asc"},{name:"createTime",order:"desc"}]},params:e(k),loading:e(T)},{headerTitle:s(()=>[r(C,{type:"primary",onClick:e(q),hasPermission:"device/Category:add"},{icon:s(()=>[r(f,{type:"PlusOutlined"})]),default:s(()=>[U(" 新增 ")]),_:1},8,["onClick"])]),action:s(y=>[r(E,null,{default:s(()=>[(h(!0),z(G,null,H(S(y,"table"),n=>(h(),R(C,{key:n.key,disabled:n.disabled,popConfirm:n.popConfirm,hasPermission:"device/Category:"+n.key,tooltip:{...n.tooltip},onClick:n.onClick,type:"link",style:{padding:"0px"},danger:n.key==="delete"},{icon:s(()=>[r(f,{type:n.icon},null,8,["type"])]),_:2},1032,["disabled","popConfirm","hasPermission","tooltip","onClick","danger"]))),128))]),_:2},1024)]),_:1},8,["columns","request","expandedRowKeys","params","loading"])]),_:1}),r(N,{ref_key:"modifyRef",ref:a,formData:e(l),title:e(c),isAdd:e(p),isChild:e(d),onRefresh:e(B)},null,8,["formData","title","isAdd","isChild","onRefresh"])]),_:1})}}});const Me=Q(X,[["__scopeId","data-v-e6c80e40"]]);export{Me as default};
