2 lines
4.1 KiB
JavaScript
2 lines
4.1 KiB
JavaScript
import{d as H,p as K,r as W,W as j,B as z,D as J,H as X,a as i,$ as Y,N as Z,j as l,b as s,g as C,v as d,f as n,e as u,G as ee,F as x,h as P,c,x as S,t as V,k as te,C as k,Q as p,E as oe,V as h}from"./index.507bae88.js";import{_ as le,l as ae,s as re}from"./editDialog.2cc4be6d.js";import{p as se}from"./index.fe8ce043.js";/* empty css */import{g as w}from"./filter.0d40c637.js";import{p as ue}from"./plus.c97dcbd2.js";import{e as ne}from"./edit.0a544f0d.js";import"./plugin-vue_export-helper.41ffa612.js";const ie={class:"app-container"},de={name:"role"},Ee=H({...de,setup(ce){const{my:m}=K(),I=W(j),t=z({loading:!0,dialog:{id:0,visible:!1,title:"",project_id:""},dataList:[],roleEdit:!1,roleStatus:!1,roleList:!1,publicProjectTitles:!1,sortListData:[],selectProjectId:""}),{loading:T,dialog:D,dataList:A,roleStatus:N,roleEdit:y,roleList:pe,publicProjectTitles:fe,sortListData:R,selectProjectId:b}=J(t);function E(){t.loading=!0,ae(t.selectProjectId).then(e=>{if(t.loading=!1,e.code===k.ok.code)t.dataList=e.data;else return m.reminder(e.message)})}function $(){if(!t.publicProjectTitles){m.reminder("\u6CA1\u6709\u9879\u76EE\u4E0B\u62C9\u7684\u6743\u9650");return}se().then(e=>{if(e.code===k.ok.code)t.sortListData=e.data,t.selectProjectId=t.sortListData[0].id,E();else return m.reminder(e.message)})}function G(e,a,r){a==p.statusForbidden?oe.prompt("\u786E\u8BA4\u7981\u7528\u8BE5\u6570\u636E\u9879?","\u8B66\u544A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(_=>{F(r,e,a,_.value)}).catch(()=>{r.row.status=a==p.one?p.two:p.one}):F(r,e,a,"")}function F(e,a,r,_){re(a,r,_).then(g=>g.code===k.ok.code?(e.row.status=r,t.row=r,m.ok("\u4FEE\u6539\u6210\u529F")):(e.row.status=r==p.one?p.two:p.one,m.reminder(g.message)))}function B(e){t.dialog={id:e,project_id:t.selectProjectId,title:e>0?"\u7F16\u8F91":"\u6DFB\u52A0",visible:!0}}const M=e=>{t.dialog.visible=e};return X(()=>{t.roleEdit=w(h.roleEdidId)!="",t.roleStatus=w(h.roleStatusId)!="",t.roleList=w(h.roleListId)!="",t.publicProjectTitles=w(h.publicProjectTitlesId)!="",$()}),(e,a)=>{const r=i("el-option"),_=i("el-select"),g=i("el-form-item"),L=i("el-button"),v=i("el-table-column"),O=i("el-tag"),U=i("el-switch"),q=i("el-table"),Q=Y("loading");return Z((s(),C("div",ie,[d(" \u641C\u7D22\u8868\u5355 "),n(l(j),{ref_key:"queryFormRef",ref:I,inline:!0},{default:u(()=>[n(g,{label:"\u9879\u76EE",prop:"parent_id"},{default:u(()=>[n(_,{modelValue:l(b),"onUpdate:modelValue":a[0]||(a[0]=o=>ee(b)?b.value=o:null),placeholder:"Select",onChange:E},{default:u(()=>[(s(!0),C(x,null,P(l(R),o=>(s(),c(r,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(g,null,{default:u(()=>[l(y)&&l(b)!=""?(s(),c(L,{key:0,type:"success",icon:l(ue),onClick:a[1]||(a[1]=o=>B(0))},{default:u(()=>[S(V(e.$t("navbar.add")),1)]),_:1},8,["icon"])):d("v-if",!0)]),_:1})]),_:1},512),d(" \u6570\u636E\u8868\u683C "),n(q,{ref:"dataTableRef",data:l(A),"row-key":"id","tree-props":{children:"children"},"highlight-current-row":"",border:""},{default:u(()=>[n(v,{label:"\u5E8F\u53F7",type:"index",width:"100"}),n(v,{label:"\u89D2\u8272\u540D",prop:"name",width:"180"}),n(v,{label:"\u6743\u9650",prop:"auths"},{default:u(o=>[(s(!0),C(x,null,P(o.row.rule_items,f=>(s(),c(O,{class:"role-tag"},{default:u(()=>[S(V(f),1)]),_:2},1024))),256))]),_:1}),l(N)?(s(),c(v,{key:0,label:"\u72B6\u6001",prop:"status",align:"center",width:"70"},{default:u(o=>[n(U,{onChange:f=>G(o.row.id,f,o),modelValue:o.row.status,"onUpdate:modelValue":f=>o.row.status=f,"inline-prompt":"","active-value":1,"inactive-value":2,"active-text":"\u5F00","inactive-text":"\u5173"},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1})):d("v-if",!0),l(y)?(s(),c(v,{key:1,label:"\u64CD\u4F5C",align:"center",width:"120"},{default:u(o=>[l(y)?(s(),c(L,{key:0,type:"primary",icon:l(ne),circle:"",plain:"",onClick:te(f=>B(o.row.id),["stop"])},null,8,["icon","onClick"])):d("v-if",!0)]),_:1})):d("v-if",!0)]),_:1},8,["data"]),l(D).visible?(s(),c(le,{key:0,dialog:l(D),onCloseDialog:a[2]||(a[2]=o=>M(o)),onGetDataList:E},null,8,["dialog"])):d("v-if",!0)])),[[Q,l(T)]])}}});export{Ee as default};
|