mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-18 09:38:09 +00:00
2 lines
6.5 KiB
JavaScript
2 lines
6.5 KiB
JavaScript
/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{a as X,E as Y}from"./el-form-item-1b16c9fc.js";/* empty css *//* empty css *//* empty css *//* empty css */import{t as r}from"./index-0ca94763.js";import{L as ee,M as ae,J as te,H as oe,I as le}from"./index-7eafba5f.js";import{e as se}from"./common-c3be41fd.js";import{u as re,a as ne}from"./vue-router-48fdc1e3.js";import{_ as de}from"./addon-role.vue_vue_type_script_setup_true_lang-8da0524e.js";import{a as L}from"./index-d469ae66.js";import{E as ie}from"./index-e27c3bb0.js";import{E as me,a as ue}from"./index-a7e8e96f.js";import{E as pe,b as ce}from"./index-ba04db70.js";import{E as _e}from"./index-95b00894.js";import{E as fe}from"./index-1a62403f.js";import{a as he,E as ve}from"./index-24fb848e.js";import{E as ge}from"./index-c5914bde.js";import{v as ye}from"./directive-64fb15dc.js";import{d as be,O as ke,r as R,Z as Ee,o as xe,E as Ve,aj as B,w as we,M as Ce,u as e,e as c,f as y,g as u,B as f,v as U,x as n,y as s,A as E,H as x,i as A,F as Re,z as Ne,aA as De,aB as Ie}from"./plugin-vue_export-helper-85a4d40b.js";import{_ as je}from"./_plugin-vue_export-helper-c27b6911.js";import"./index-cf9a2dd7.js";import"./event-f85d77b0.js";import"./index-bcd7a424.js";import"./_baseClone-3dbf39d6.js";import"./index-e513479b.js";import"./el-main-86eb724f.js";import"./index-b9e5f5cb.js";import"./el-overlay-08181e74.js";import"./index-313cd2ce.js";import"./focus-trap-64c402c5.js";import"./index-1ad115d7.js";import"./index-de1d3b53.js";/* empty css */import"./index-4d8f36c6.js";import"./index-ebc73046.js";import"./isEqual-0b9509fd.js";import"./flatten-749195f8.js";import"./index-79f2037e.js";import"./strings-53351eda.js";const O=b=>(De("data-v-0197eda7"),b=b(),Ie(),b),Le={class:"main-container"},Be={class:"detail-head"},Ue=O(()=>u("span",{class:"iconfont iconxiangzuojiantou !text-xs"},null,-1)),Ae={class:"ml-[1px]"},Oe=O(()=>u("span",{class:"adorn"},"|",-1)),Pe={class:"right"},Se={key:1,class:"px-[15px]"},Te={class:"flex items-center justify-between"},Fe={key:2,class:"fixed-footer-wrap"},Me={class:"fixed-footer"},$e=be({__name:"role_edit",setup(b){const V=re(),w=ne(),P=V.meta.title,h=ke({loading:!1,activeName:"system",checkAll:!1,formData:{role_name:"",status:1,addon:{},system:[]},menusData:[],addonList:[]});let N=R(null),S=R({role_name:[{required:!0,message:r("roleNamePlaceholder"),trigger:"blur"}],rules:[{validator:(d,a,o)=>{a.length?o():o(new Error(r("rulesPlaceholder")))},trigger:"blur"}]}),{loading:m,formData:t,activeName:k,checkAll:_,menusData:C,addonList:T}=Ee(h);xe(async()=>{m.value=!0;let d=await ee();d.data&&(h.menusData=d.data);let a=await ae();a.data&&(h.addonList=a.data.map(o=>(o.menu_name=o.title,o.menu_key=o.key,o))),V.query.role_id?F(V.query.role_id):m.value=!1});const F=d=>{te(d).then(a=>{h.formData=Object.assign(t.value,a.data),t.value.addon=Object.assign(t.value.addon,t.value.rules.addon),t.value.system=Object.assign(t.value.system,t.value.rules.system),m.value=!1,Ve(()=>{var o=[];t.value.system.forEach(i=>D(i,B(C.value),o)),v.value.setCheckedKeys(o)})}).catch(()=>{m.value=!1})},D=(d,a,o)=>{a.forEach(i=>{d==i.menu_key?(!i.children||i.children.length==0)&&o.push(d):i.children&&i.children.length>0&&D(d,i.children,o)})};let v=R(null);we(_,()=>{_.value?v.value.setCheckedNodes(B(C.value)):v.value.setCheckedNodes([])});const M=se(d=>{h.formData.system=v.value.getCheckedNodes(!1,!0).map(a=>a.menu_key)}),$=async d=>{const a=t.value.role_id?oe:le;await d.validate(async o=>{if(o){if(!t.value.system.length)return L({message:`${r("systemErr")}`}),!1;var i=Object.values(t.value.addon).filter(g=>{if(g.length)return!0});if(!i.length)return L({message:`${r("applicationErr")}`}),!1;const p=Object.assign({},t.value);p.rules={system:p.system,addon:p.addon},a(p).then(g=>{w.push({path:"/setting/auth/role"})}).catch(()=>{m.value=!1})}})};return(d,a)=>{const o=ie,i=X,p=me,g=pe,q=ce,z=ue,H=Y,G=_e,J=fe,I=he,K=ve,j=ge,Z=ye;return Ce((c(),y("div",Le,[u("div",Be,[u("div",{class:"left",onClick:a[0]||(a[0]=l=>e(w).push({path:"/setting/auth/role"}))},[Ue,u("span",Ae,f(e(r)("returnToPreviousPage")),1)]),Oe,u("span",Pe,f(e(P)),1)]),e(m)?x("",!0):(c(),U(H,{key:0,model:e(t),"label-width":"90px",ref_key:"formRef",ref:N,rules:e(S),class:"page-form mt-[30px]"},{default:n(()=>[s(z,null,{default:n(()=>[s(p,{span:24},{default:n(()=>[s(i,{label:e(r)("roleName"),prop:"role_name"},{default:n(()=>[s(o,{modelValue:e(t).role_name,"onUpdate:modelValue":a[1]||(a[1]=l=>e(t).role_name=l),placeholder:e(r)("roleNamePlaceholder"),clearable:"",disabled:e(t).uid,class:"input-width",maxlength:"10","show-word-limit":!0},null,8,["modelValue","placeholder","disabled"])]),_:1},8,["label"])]),_:1}),s(p,{span:24},{default:n(()=>[s(i,{label:e(r)("status")},{default:n(()=>[s(q,{modelValue:e(t).status,"onUpdate:modelValue":a[2]||(a[2]=l=>e(t).status=l)},{default:n(()=>[s(g,{label:1},{default:n(()=>[E(f(e(r)("startUsing")),1)]),_:1}),s(g,{label:0},{default:n(()=>[E(f(e(r)("statusDeactivate")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["model","rules"])),e(m)?x("",!0):(c(),y("div",Se,[s(K,{modelValue:e(k),"onUpdate:modelValue":a[4]||(a[4]=l=>A(k)?k.value=l:k=l),class:"demo-tabs"},{default:n(()=>[s(I,{label:e(r)("system"),name:"system"},{default:n(()=>[u("div",Te,[u("div",null,[s(G,{modelValue:e(_),"onUpdate:modelValue":a[3]||(a[3]=l=>A(_)?_.value=l:_=l),label:e(r)("selectAll")},null,8,["modelValue","label"])])]),s(J,{data:e(C),props:{label:"menu_name"},"show-checkbox":"",onCheckChange:e(M),"expand-on-click-node":!1,"node-key":"menu_key",ref_key:"treeRef",ref:v},null,8,["data","onCheckChange"])]),_:1},8,["label"]),s(I,{label:e(r)("application"),name:"application"},{default:n(()=>[(c(!0),y(Re,null,Ne(e(T),(l,Q)=>(c(),y("div",{key:Q,class:"p-[15px] border-[1px] border-solid border-[#e4e7ed] mt-[15px]"},[l.children?(c(),U(de,{key:0,modelValue:e(t).addon[l.key],"onUpdate:modelValue":W=>e(t).addon[l.key]=W,data:l},null,8,["modelValue","onUpdate:modelValue","data"])):x("",!0)]))),128))]),_:1},8,["label"])]),_:1},8,["modelValue"])])),e(m)?x("",!0):(c(),y("div",Fe,[u("div",Me,[s(j,{type:"primary",onClick:a[5]||(a[5]=l=>$(e(N)))},{default:n(()=>[E(f(e(r)("save")),1)]),_:1}),s(j,{onClick:a[6]||(a[6]=l=>e(w).push({path:"/setting/auth/role"}))},{default:n(()=>[E(f(e(r)("cancel")),1)]),_:1})])]))])),[[Z,e(m)]])}}});const Aa=je($e,[["__scopeId","data-v-0197eda7"]]);export{Aa as default};
|