datas.4hXVc6D7.js 2.7 KB

1234
  1. /*!
  2. Build based on gin-vue-admin
  3. Time : 1757946830000 */
  4. import{s as a}from"./authority.DxsNNS-Z.js";import{_ as t}from"./warningBar.DQ1jV9hi.js";import{a as e,g as l,c as o,o as u,f as r,b as i,w as s,h as n,F as d,I as h,i as c,C as y,E as f}from"./index.DlqNVRUO.js";const p={class:"sticky top-0.5 z-10 my-4"},v={class:"clear-both pt-4"},m=Object.assign({name:"Datas"},{__name:"datas",props:{row:{default:function(){return{}},type:Object},authority:{default:function(){return[]},type:Array}},emits:["changeRow"],setup(m,{expose:I,emit:g}){const w=m,b=e([]),_=e(!1),k=a=>{a&&a.forEach(a=>{const t={};t.authorityId=a.authorityId,t.authorityName=a.authorityName,b.value.push(t),a.children&&a.children.length&&k(a.children)})},A=e([]);k(w.authority),w.row.dataAuthorityId&&w.row.dataAuthorityId.forEach(a=>{const t=b.value&&b.value.filter(t=>t.authorityId===a.authorityId)&&b.value.filter(t=>t.authorityId===a.authorityId)[0];A.value.push(t)});const x=g,C=()=>{A.value=[...b.value],x("changeRow","dataAuthorityId",A.value),_.value=!0},j=()=>{A.value=b.value.filter(a=>a.authorityId===w.row.authorityId),x("changeRow","dataAuthorityId",A.value),_.value=!0},R=()=>{const a=[];E(w.row,a),A.value=b.value.filter(t=>a.indexOf(t.authorityId)>-1),x("changeRow","dataAuthorityId",A.value),_.value=!0},E=(a,t)=>{t.push(a.authorityId),a.children&&a.children.forEach(a=>{E(a,t)})},N=async()=>{0===(await a(w.row)).code&&f({type:"success",message:"资源设置成功"})},O=()=>{A.value=A.value.filter(a=>a),x("changeRow","dataAuthorityId",A.value),_.value=!0};return I({enterAndNext:()=>{N()},needConfirm:_}),(a,e)=>{const f=l("el-button"),m=l("el-checkbox"),I=l("el-checkbox-group");return u(),o("div",null,[r(t,{title:"此功能仅用于创建角色和角色的many2many关系表,具体使用还须自己结合表实现业务,详情参考示例代码(客户示例)。此功能不建议使用,建议使用插件市场【组织管理功能(点击前往)】来管理资源权限。",href:"https://plugin.gin-vue-admin.com/#/layout/newPluginInfo?id=36"}),i("div",p,[r(f,{class:"float-left",type:"primary",onClick:C},{default:s(()=>[...e[1]||(e[1]=[n("全选",-1)])]),_:1}),r(f,{class:"float-left",type:"primary",onClick:j},{default:s(()=>[...e[2]||(e[2]=[n("本角色",-1)])]),_:1}),r(f,{class:"float-left",type:"primary",onClick:R},{default:s(()=>[...e[3]||(e[3]=[n("本角色及子角色",-1)])]),_:1}),r(f,{class:"float-right",type:"primary",onClick:N},{default:s(()=>[...e[4]||(e[4]=[n("确 定",-1)])]),_:1})]),i("div",v,[r(I,{modelValue:A.value,"onUpdate:modelValue":e[0]||(e[0]=a=>A.value=a),onChange:O},{default:s(()=>[(u(!0),o(d,null,h(b.value,(a,t)=>(u(),c(m,{key:t,label:a},{default:s(()=>[n(y(a.authorityName),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])])}}});export{m as default};