var k=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var w=(a,p)=>{var i={};for(var o in a)K.call(a,o)&&p.indexOf(o)<0&&(i[o]=a[o]);if(a!=null&&k)for(var o of k(a))p.indexOf(o)<0&&z.call(a,o)&&(i[o]=a[o]);return i};import{j as G,k as L,m as W,l as Z}from"./index.js";import{u as q,B as J}from"./useTable-f8594a7b.js";import{T as Q}from"./useForm-322569b9.js";import{j as Y,N as X,P as ee}from"./antd-fb8ca017.js";import{s as te,c as oe,b as A,r as se,e as ne}from"./userAuthorityApi-f6f292fa.js";import{u as ae}from"./index-922f0b14.js";import{_ as re}from"./drawer.vue_vue_type_script_setup_true_lang-ce206964.js";import{d as ie,f as le,a6 as ce,n as de,Z as m,_ as y,k as _,a5 as c,u as n,F as me,$ as C,a0 as ue,G as U,a4 as v,a8 as H,m as fe}from"./vue-08ef39cb.js";import"./index-9a268806.js";import"./useWindowSizeFn-40274562.js";import"./onMountedOrActivated-4630d53b.js";import"./sortable.esm-15c0a34e.js";import"./copyTextToClipboard-bf4926ca.js";const pe={key:1},Ae=ie({name:"AUTH_SYSTEM_USER_AUTHORITY",__name:"index",setup(a){const{createMessage:p}=Z(),{hasPermission:i}=G(),o=L(),u=le([]),x=e=>{u.value=e.filter(t=>typeof t!="undefined")},[M,{openDrawer:E}]=ae(),[I,{reload:S,setSelectedRowKeys:g}]=q({title:"用户权限对应表",api:e=>te(B(e)),columns:oe,formConfig:{labelWidth:120,schemas:A,showAdvancedButton:!1},rowSelection:{type:"checkbox",onChange:x},useSearchForm:!0,showTableSetting:!1,bordered:!0,showIndexColumn:!1,canResize:!1,rowKey:e=>e.id,actionColumn:{width:170,title:"操作",dataIndex:"action",fixed:"right"}}),B=e=>{const R=e,{pageNum:t,pageSize:h,field:b="id",order:T="descend"}=R,f=w(R,["pageNum","pageSize","field","order"]),r={pageNum:t,pageSize:h,orderByClause:`${b} ${T==="descend"?"desc":"asc"}`};return Object.keys(f).forEach(D=>{const d=A.find(V=>V.field===D),s=e[D],l=D;d?s!==void 0&&s!==""&&(d.component==="Input"?r[l]=`%${s.trim()}%`:["Select","ApiSelect","ApiTreeSelect"].includes(d.component)?r[l]=W(s)?s.value:s:d.component==="RangePicker"?(r[`${l}From`]=Y(s[0]).startOf("d").format("YYYY-MM-DD HH:mm:ss"),r[`${l}To`]=Y(s[1]).endOf("d").format("YYYY-MM-DD HH:mm:ss")):d.component==="DatePicker"?r[l]=Y(s).format(d.componentProps.format||"YYYY-MM-DD"):r[l]=s):r[l]=s}),r},O=()=>{E(!0,{isUpdate:!1})},P=e=>{E(!0,{record:e,isUpdate:!0})},$=e=>{se(e.id).then(t=>{S(),g([])})},N=()=>{if(u.value.length===0){p.error("当前未选中任何项目！");return}ne(u.value).then(e=>{S(),g([])})},j=()=>{S()},F=e=>{o("/system/user-authority/detail/"+e.id)};return(e,t)=>{const h=ce("a-button"),b=de("auth");return m(),y("div",null,[_(n(J),{onRegister:n(I)},{headerTop:c(()=>[_(n(X),{type:"info","show-icon":""},{message:c(()=>[u.value.length>0?(m(),y(me,{key:0},[C("span",null,"已选中"+ue(u.value.length)+"条记录",1),_(h,{type:"link",onClick:t[0]||(t[0]=T=>n(g)([])),size:"small"},{default:c(()=>t[1]||(t[1]=[U("清空")])),_:1}),n(i)("AUTH_SYSTEM_USER_AUTHORITY:DELETE")?(m(),v(n(ee),{key:0,class:"ml-4",title:"确定要全部删除吗？","ok-text":"是","cancel-text":"否",onConfirm:N},{default:c(()=>t[2]||(t[2]=[C("a",{href:"#",class:"text-red-500"},"删除",-1)])),_:1})):H("",!0)],64)):(m(),y("span",pe,"未选中任何项目"))]),_:1})]),toolbar:c(()=>[fe((m(),v(h,{type:"primary",onClick:O},{default:c(()=>t[3]||(t[3]=[U(" 新增")])),_:1})),[[b,"AUTH_SYSTEM_USER_AUTHORITY:ADD"]])]),bodyCell:c(({column:T,record:f})=>[T.dataIndex==="action"?(m(),v(n(Q),{key:0,actions:[{label:"编辑",icon:"clarity:note-edit-line",onClick:P.bind(null,f),ifShow:n(i)("AUTH_SYSTEM_USER_AUTHORITY:EDIT"),divider:!0},{label:"详情",icon:"ant-design:eye-outlined",onClick:F.bind(null,f),divider:!0}],dropDownActions:[{label:"删除",icon:"ant-design:delete-outlined",color:"error",popConfirm:{title:"是否确认删除",confirm:$.bind(null,f),placement:"topRight"},ifShow:n(i)("AUTH_SYSTEM_USER_AUTHORITY:DELETE")}]},null,8,["actions","dropDownActions"])):H("",!0)]),_:1},8,["onRegister"]),_(re,{onRegister:n(M),onSuccess:j},null,8,["onRegister"])])}}});export{Ae as default};
