import{_ as He,z as Je,a as Ge,r as s,A as We,M as Xe,d as r,K as ce,o as m,c as F,C as y,D as X,f as o,e as t,w as a,j as fe,L as Z,N as ee,k as _,B as S,m as i,g as w,l as O,x as ve,s as Ze,J as Y}from"./index.ae0c781d.js";import{l as el,e as ll,f as tl,g as ye,h as ol,i as al,j as nl,k as ul}from"./role.c30f99bf.js";import{r as dl,t as rl}from"./menu.7f864e54.js";const sl={class:"app-container"},il={class:"dialog-footer"},pl={class:"dialog-footer"},ml=Je({name:"Role"}),cl=Object.assign(ml,{setup(fl){const _e=Ge(),{proxy:v}=Ze(),{sys_normal_disable:le}=v.useDict("sys_normal_disable"),te=s([]),h=s(!1),j=s(!0),$=s(!0),Q=s([]),oe=s(!0),ae=s(!0),H=s(0),N=s(""),R=s([]),I=s([]),A=s(!1),M=s(!1),q=s(!0),E=s(!1),P=s([]),x=s(!1),g=s(null),k=s(null),he=s([{value:"1",label:"\u5168\u90E8\u6570\u636E\u6743\u9650"},{value:"2",label:"\u81EA\u5B9A\u6570\u636E\u6743\u9650"},{value:"3",label:"\u672C\u90E8\u95E8\u6570\u636E\u6743\u9650"},{value:"4",label:"\u672C\u90E8\u95E8\u53CA\u4EE5\u4E0B\u6570\u636E\u6743\u9650"},{value:"5",label:"\u4EC5\u672C\u4EBA\u6570\u636E\u6743\u9650"}]),ge=We({form:{},queryParams:{pageNum:1,pageSize:10,roleName:void 0,roleKey:void 0,status:void 0},rules:{roleName:[{required:!0,message:"\u89D2\u8272\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],roleKey:[{required:!0,message:"\u6743\u9650\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],roleSort:[{required:!0,message:"\u89D2\u8272\u987A\u5E8F\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}}),{queryParams:c,form:u,rules:ke}=Xe(ge);function b(){j.value=!0,el(v.addDateRange(c.value,R.value)).then(n=>{te.value=n.rows,H.value=n.total,j.value=!1})}function L(){c.value.pageNum=1,b()}function be(){R.value=[],v.resetForm("queryRef"),L()}function ne(n){const e=n.roleId||Q.value;v.$modal.confirm('\u662F\u5426\u786E\u8BA4\u5220\u9664\u89D2\u8272\u7F16\u53F7\u4E3A"'+e+'"\u7684\u6570\u636E\u9879?').then(function(){return ll(e)}).then(()=>{b(),v.$modal.msgSuccess("\u5220\u9664\u6210\u529F")}).catch(()=>{})}function Ve(){v.download("system/role/export",{...c.value},`role_${new Date().getTime()}.xlsx`)}function Ce(n){Q.value=n.map(e=>e.roleId),oe.value=n.length!=1,ae.value=!n.length}function Se(n){let e=n.status==="0"?"\u542F\u7528":"\u505C\u7528";v.$modal.confirm('\u786E\u8BA4\u8981"'+e+'""'+n.roleName+'"\u89D2\u8272\u5417?').then(function(){return tl(n.roleId,n.status)}).then(()=>{v.$modal.msgSuccess(e+"\u6210\u529F")}).catch(function(){n.status=n.status==="0"?"1":"0"})}function we(n){_e.push("/system/role-auth/user/"+n.roleId)}function xe(){rl().then(n=>{I.value=n.data})}function Ke(){let n=k.value.getCheckedKeys(),e=k.value.getHalfCheckedKeys();return n.unshift.apply(n,e),n}function D(){g.value!=null&&g.value.setCheckedKeys([]),A.value=!1,M.value=!1,q.value=!0,E.value=!1,u.value={roleId:void 0,roleName:void 0,roleKey:void 0,roleSort:0,status:"0",menuIds:[],deptIds:[],menuCheckStrictly:!0,deptCheckStrictly:!0,remark:void 0},v.resetForm("roleRef")}function Ue(){D(),xe(),h.value=!0,N.value="\u6DFB\u52A0\u89D2\u8272"}function ue(n){D();const e=n.roleId||Q.value,p=Ne(e);ye(e).then(d=>{u.value=d.data,u.value.roleSort=Number(u.value.roleSort),h.value=!0,Y(()=>{p.then(z=>{z.checkedKeys.forEach(G=>{Y(()=>{g.value.setChecked(G,!0,!1)})})})}),N.value="\u4FEE\u6539\u89D2\u8272"})}function Ne(n){return dl(n).then(e=>(I.value=e.menus,e))}function Re(n){return ul(n).then(e=>(P.value=e.depts,e))}function de(n,e){if(e=="menu"){let p=I.value;for(let d=0;d{n&&(u.value.roleId!=null?(u.value.menuIds=ie(),ol(u.value).then(e=>{v.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),h.value=!1,b()})):(u.value.menuIds=ie(),al(u.value).then(e=>{v.$modal.msgSuccess("\u65B0\u589E\u6210\u529F"),h.value=!1,b()})))})}function De(){h.value=!1,D()}function Te(n){n!=="2"&&k.value.setCheckedKeys([])}function $e(n){D();const e=Re(n.roleId);ye(n.roleId).then(p=>{u.value=p.data,x.value=!0,Y(()=>{e.then(d=>{Y(()=>{k.value&&k.value.setCheckedKeys(d.checkedKeys)})})}),N.value="\u5206\u914D\u6570\u636E\u6743\u9650"})}function Ae(){u.value.roleId!=null&&(u.value.deptIds=Ke(),nl(u.value).then(n=>{v.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),x.value=!1,b()}))}function Me(){x.value=!1,D()}return b(),(n,e)=>{const p=r("el-input"),d=r("el-form-item"),z=r("el-option"),J=r("el-select"),G=r("el-date-picker"),f=r("el-button"),W=r("el-form"),B=r("el-col"),qe=r("right-toolbar"),Ee=r("el-row"),V=r("el-table-column"),Pe=r("el-switch"),T=r("el-tooltip"),Le=r("el-table"),ze=r("pagination"),Be=r("question-filled"),Fe=r("el-icon"),Oe=r("el-input-number"),Ye=r("el-radio"),je=r("el-radio-group"),K=r("el-checkbox"),pe=r("el-tree"),me=r("el-dialog"),C=ce("hasPermi"),Qe=ce("loading");return m(),F("div",sl,[y(t(W,{model:o(c),ref:"queryRef",inline:!0,"label-width":"68px"},{default:a(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0",prop:"roleName"},{default:a(()=>[t(p,{modelValue:o(c).roleName,"onUpdate:modelValue":e[0]||(e[0]=l=>o(c).roleName=l),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0",style:{width:"240px"},onKeyup:fe(L,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(d,{label:"\u6743\u9650\u5B57\u7B26",prop:"roleKey"},{default:a(()=>[t(p,{modelValue:o(c).roleKey,"onUpdate:modelValue":e[1]||(e[1]=l=>o(c).roleKey=l),placeholder:"\u8BF7\u8F93\u5165\u6743\u9650\u5B57\u7B26",style:{width:"240px"},onKeyup:fe(L,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(d,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[t(J,{modelValue:o(c).status,"onUpdate:modelValue":e[2]||(e[2]=l=>o(c).status=l),placeholder:"\u89D2\u8272\u72B6\u6001",style:{width:"240px"}},{default:a(()=>[(m(!0),F(Z,null,ee(o(le),l=>(m(),_(z,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(d,{label:"\u521B\u5EFA\u65F6\u95F4",style:{width:"308px"}},{default:a(()=>[t(G,{modelValue:o(R),"onUpdate:modelValue":e[3]||(e[3]=l=>S(R)?R.value=l:null),"value-format":"YYYY-MM-DD",type:"daterange","range-separator":"-","start-placeholder":"\u5F00\u59CB\u65E5\u671F","end-placeholder":"\u7ED3\u675F\u65E5\u671F"},null,8,["modelValue"])]),_:1}),t(d,null,{default:a(()=>[t(f,{type:"primary",icon:"Search",onClick:L},{default:a(()=>[i("\u641C\u7D22")]),_:1}),t(f,{icon:"Refresh",onClick:be},{default:a(()=>[i("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1},8,["model"]),[[X,o($)]]),t(Ee,{gutter:10,class:"mb8"},{default:a(()=>[t(B,{span:1.5},{default:a(()=>[y((m(),_(f,{type:"primary",plain:"",icon:"Plus",onClick:Ue},{default:a(()=>[i("\u65B0\u589E")]),_:1})),[[C,["system:role:add"]]])]),_:1},8,["span"]),t(B,{span:1.5},{default:a(()=>[y((m(),_(f,{type:"success",plain:"",icon:"Edit",disabled:o(oe),onClick:ue},{default:a(()=>[i("\u4FEE\u6539")]),_:1},8,["disabled"])),[[C,["system:role:edit"]]])]),_:1},8,["span"]),t(B,{span:1.5},{default:a(()=>[y((m(),_(f,{type:"danger",plain:"",icon:"Delete",disabled:o(ae),onClick:ne},{default:a(()=>[i("\u5220\u9664")]),_:1},8,["disabled"])),[[C,["system:role:remove"]]])]),_:1},8,["span"]),t(B,{span:1.5},{default:a(()=>[y((m(),_(f,{type:"warning",plain:"",icon:"Download",onClick:Ve},{default:a(()=>[i("\u5BFC\u51FA")]),_:1})),[[C,["system:role:export"]]])]),_:1},8,["span"]),t(qe,{showSearch:o($),"onUpdate:showSearch":e[4]||(e[4]=l=>S($)?$.value=l:null),onQueryTable:b},null,8,["showSearch"])]),_:1}),w(" \u8868\u683C\u6570\u636E "),y((m(),_(Le,{data:o(te),onSelectionChange:Ce},{default:a(()=>[t(V,{type:"selection",width:"55",align:"center"}),t(V,{label:"\u89D2\u8272\u7F16\u53F7",prop:"roleId",width:"120"}),t(V,{label:"\u89D2\u8272\u540D\u79F0",prop:"roleName","show-overflow-tooltip":!0,width:"150"}),t(V,{label:"\u6743\u9650\u5B57\u7B26",prop:"roleKey","show-overflow-tooltip":!0,width:"150"}),t(V,{label:"\u663E\u793A\u987A\u5E8F",prop:"roleSort",width:"100"}),t(V,{label:"\u72B6\u6001",align:"center",width:"100"},{default:a(l=>[t(Pe,{modelValue:l.row.status,"onUpdate:modelValue":U=>l.row.status=U,"active-value":"0","inactive-value":"1",onChange:U=>Se(l.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),t(V,{label:"\u521B\u5EFA\u65F6\u95F4",align:"center",prop:"createTime"},{default:a(l=>[O("span",null,ve(n.parseTime(l.row.createTime)),1)]),_:1}),t(V,{label:"\u64CD\u4F5C",align:"center","class-name":"small-padding fixed-width"},{default:a(l=>[l.row.roleId!==1?(m(),_(T,{key:0,content:"\u4FEE\u6539",placement:"top"},{default:a(()=>[y(t(f,{link:"",type:"primary",icon:"Edit",onClick:U=>ue(l.row)},null,8,["onClick"]),[[C,["system:role:edit"]]])]),_:2},1024)):w("v-if",!0),l.row.roleId!==1?(m(),_(T,{key:1,content:"\u5220\u9664",placement:"top"},{default:a(()=>[y(t(f,{link:"",type:"primary",icon:"Delete",onClick:U=>ne(l.row)},null,8,["onClick"]),[[C,["system:role:remove"]]])]),_:2},1024)):w("v-if",!0),l.row.roleId!==1?(m(),_(T,{key:2,content:"\u6570\u636E\u6743\u9650",placement:"top"},{default:a(()=>[y(t(f,{link:"",type:"primary",icon:"CircleCheck",onClick:U=>$e(l.row)},null,8,["onClick"]),[[C,["system:role:edit"]]])]),_:2},1024)):w("v-if",!0),l.row.roleId!==1?(m(),_(T,{key:3,content:"\u5206\u914D\u7528\u6237",placement:"top"},{default:a(()=>[y(t(f,{link:"",type:"primary",icon:"User",onClick:U=>we(l.row)},null,8,["onClick"]),[[C,["system:role:edit"]]])]),_:2},1024)):w("v-if",!0)]),_:1})]),_:1},8,["data"])),[[Qe,o(j)]]),y(t(ze,{total:o(H),page:o(c).pageNum,"onUpdate:page":e[5]||(e[5]=l=>o(c).pageNum=l),limit:o(c).pageSize,"onUpdate:limit":e[6]||(e[6]=l=>o(c).pageSize=l),onPagination:b},null,8,["total","page","limit"]),[[X,o(H)>0]]),w(" \u6DFB\u52A0\u6216\u4FEE\u6539\u89D2\u8272\u914D\u7F6E\u5BF9\u8BDD\u6846 "),t(me,{title:o(N),modelValue:o(h),"onUpdate:modelValue":e[18]||(e[18]=l=>S(h)?h.value=l:null),width:"500px","append-to-body":""},{footer:a(()=>[O("div",il,[t(f,{type:"primary",onClick:Ie},{default:a(()=>[i("\u786E \u5B9A")]),_:1}),t(f,{onClick:De},{default:a(()=>[i("\u53D6 \u6D88")]),_:1})])]),default:a(()=>[t(W,{ref:"roleRef",model:o(u),rules:o(ke),"label-width":"100px"},{default:a(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0",prop:"roleName"},{default:a(()=>[t(p,{modelValue:o(u).roleName,"onUpdate:modelValue":e[7]||(e[7]=l=>o(u).roleName=l),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(d,{prop:"roleKey"},{label:a(()=>[O("span",null,[t(T,{content:"\u63A7\u5236\u5668\u4E2D\u5B9A\u4E49\u7684\u6743\u9650\u5B57\u7B26\uFF0C\u5982\uFF1A@PreAuthorize(`@ss.hasRole('admin')`)",placement:"top"},{default:a(()=>[t(Fe,null,{default:a(()=>[t(Be)]),_:1})]),_:1}),i(" \u6743\u9650\u5B57\u7B26 ")])]),default:a(()=>[t(p,{modelValue:o(u).roleKey,"onUpdate:modelValue":e[8]||(e[8]=l=>o(u).roleKey=l),placeholder:"\u8BF7\u8F93\u5165\u6743\u9650\u5B57\u7B26"},null,8,["modelValue"])]),_:1}),t(d,{label:"\u89D2\u8272\u987A\u5E8F",prop:"roleSort"},{default:a(()=>[t(Oe,{modelValue:o(u).roleSort,"onUpdate:modelValue":e[9]||(e[9]=l=>o(u).roleSort=l),"controls-position":"right",min:0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u72B6\u6001"},{default:a(()=>[t(je,{modelValue:o(u).status,"onUpdate:modelValue":e[10]||(e[10]=l=>o(u).status=l)},{default:a(()=>[(m(!0),F(Z,null,ee(o(le),l=>(m(),_(Ye,{key:l.value,label:l.value},{default:a(()=>[i(ve(l.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(d,{label:"\u83DC\u5355\u6743\u9650"},{default:a(()=>[t(K,{modelValue:o(A),"onUpdate:modelValue":e[11]||(e[11]=l=>S(A)?A.value=l:null),onChange:e[12]||(e[12]=l=>de(l,"menu"))},{default:a(()=>[i("\u5C55\u5F00/\u6298\u53E0")]),_:1},8,["modelValue"]),t(K,{modelValue:o(M),"onUpdate:modelValue":e[13]||(e[13]=l=>S(M)?M.value=l:null),onChange:e[14]||(e[14]=l=>re(l,"menu"))},{default:a(()=>[i("\u5168\u9009/\u5168\u4E0D\u9009")]),_:1},8,["modelValue"]),t(K,{modelValue:o(u).menuCheckStrictly,"onUpdate:modelValue":e[15]||(e[15]=l=>o(u).menuCheckStrictly=l),onChange:e[16]||(e[16]=l=>se(l,"menu"))},{default:a(()=>[i("\u7236\u5B50\u8054\u52A8")]),_:1},8,["modelValue"]),t(pe,{class:"tree-border",data:o(I),"show-checkbox":"",ref_key:"menuRef",ref:g,"node-key":"id","check-strictly":!o(u).menuCheckStrictly,"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019",props:{label:"label",children:"children"}},null,8,["data","check-strictly"])]),_:1}),t(d,{label:"\u5907\u6CE8"},{default:a(()=>[t(p,{modelValue:o(u).remark,"onUpdate:modelValue":e[17]||(e[17]=l=>o(u).remark=l),type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),w(" \u5206\u914D\u89D2\u8272\u6570\u636E\u6743\u9650\u5BF9\u8BDD\u6846 "),t(me,{title:o(N),modelValue:o(x),"onUpdate:modelValue":e[28]||(e[28]=l=>S(x)?x.value=l:null),width:"500px","append-to-body":""},{footer:a(()=>[O("div",pl,[t(f,{type:"primary",onClick:Ae},{default:a(()=>[i("\u786E \u5B9A")]),_:1}),t(f,{onClick:Me},{default:a(()=>[i("\u53D6 \u6D88")]),_:1})])]),default:a(()=>[t(W,{model:o(u),"label-width":"80px"},{default:a(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0"},{default:a(()=>[t(p,{modelValue:o(u).roleName,"onUpdate:modelValue":e[19]||(e[19]=l=>o(u).roleName=l),disabled:!0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u6743\u9650\u5B57\u7B26"},{default:a(()=>[t(p,{modelValue:o(u).roleKey,"onUpdate:modelValue":e[20]||(e[20]=l=>o(u).roleKey=l),disabled:!0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u6743\u9650\u8303\u56F4"},{default:a(()=>[t(J,{modelValue:o(u).dataScope,"onUpdate:modelValue":e[21]||(e[21]=l=>o(u).dataScope=l),onChange:Te},{default:a(()=>[(m(!0),F(Z,null,ee(o(he),l=>(m(),_(z,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),y(t(d,{label:"\u6570\u636E\u6743\u9650"},{default:a(()=>[t(K,{modelValue:o(q),"onUpdate:modelValue":e[22]||(e[22]=l=>S(q)?q.value=l:null),onChange:e[23]||(e[23]=l=>de(l,"dept"))},{default:a(()=>[i("\u5C55\u5F00/\u6298\u53E0")]),_:1},8,["modelValue"]),t(K,{modelValue:o(E),"onUpdate:modelValue":e[24]||(e[24]=l=>S(E)?E.value=l:null),onChange:e[25]||(e[25]=l=>re(l,"dept"))},{default:a(()=>[i("\u5168\u9009/\u5168\u4E0D\u9009")]),_:1},8,["modelValue"]),t(K,{modelValue:o(u).deptCheckStrictly,"onUpdate:modelValue":e[26]||(e[26]=l=>o(u).deptCheckStrictly=l),onChange:e[27]||(e[27]=l=>se(l,"dept"))},{default:a(()=>[i("\u7236\u5B50\u8054\u52A8")]),_:1},8,["modelValue"]),t(pe,{class:"tree-border",data:o(P),"show-checkbox":"","default-expand-all":"",ref_key:"deptRef",ref:k,"node-key":"id","check-strictly":!o(u).deptCheckStrictly,"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019",props:{label:"label",children:"children"}},null,8,["data","check-strictly"])]),_:1},512),[[X,o(u).dataScope==2]])]),_:1},8,["model"])]),_:1},8,["title","modelValue"])])}}}),hl=He(cl,[["__file","/Users/luce/Desktop/\u6570\u5B57\u4E09\u519C/Agriculture-front-end/src/views/system/role/index.vue"]]);export{hl as default};