2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
import{_ as He,K as Ge,a as Je,r as s,z as We,T as Xe,d as r,S as ce,o as m,c as B,M as y,N as X,f as a,e as t,w as o,j as fe,F as Z,D as ee,k as _,L as S,m as i,g as w,l as O,x as ve,s as Ze,R as Y}from"./index.0bad53d2.js";import{l as el,e as ll,f as tl,g as ye,h as al,i as ol,j as nl,k as ul}from"./role.8dce1f2c.js";import{r as dl,t as rl}from"./menu.326e0f84.js";const sl={class:"app-container"},il={class:"dialog-footer"},pl={class:"dialog-footer"},ml=Ge({name:"Role"}),cl=Object.assign(ml,{setup(fl){const _e=Je(),{proxy:v}=Ze(),{sys_normal_disable:le}=v.useDict("sys_normal_disable"),te=s([]),h=s(!1),j=s(!0),$=s(!0),Q=s([]),ae=s(!0),oe=s(!0),H=s(0),N=s(""),R=s([]),I=s([]),M=s(!1),q=s(!1),A=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),ae.value=n.length!=1,oe.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([]),M.value=!1,q.value=!1,A.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(J=>{Y(()=>{g.value.setChecked(J,!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<p.length;d++)g.value.store.nodesMap[p[d].id].expanded=n}else if(e=="dept"){let p=P.value;for(let d=0;d<p.length;d++)k.value.store.nodesMap[p[d].id].expanded=n}}function re(n,e){e=="menu"?g.value.setCheckedNodes(n?I.value:[]):e=="dept"&&k.value.setCheckedNodes(n?P.value:[])}function se(n,e){e=="menu"?u.value.menuCheckStrictly=!!n:e=="dept"&&(u.value.deptCheckStrictly=!!n)}function ie(){let n=g.value.getCheckedKeys(),e=g.value.getHalfCheckedKeys();return n.unshift.apply(n,e),n}function Ie(){v.$refs.roleRef.validate(n=>{n&&(u.value.roleId!=null?(u.value.menuIds=ie(),al(u.value).then(e=>{v.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),h.value=!1,b()})):(u.value.menuIds=ie(),ol(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 Me(){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 qe(){x.value=!1,D()}return b(),(n,e)=>{const p=r("el-input"),d=r("el-form-item"),z=r("el-option"),G=r("el-select"),J=r("el-date-picker"),f=r("el-button"),W=r("el-form"),F=r("el-col"),Ae=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"),Fe=r("question-filled"),Be=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(),B("div",sl,[y(t(W,{model:a(c),ref:"queryRef",inline:!0,"label-width":"68px"},{default:o(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0",prop:"roleName"},{default:o(()=>[t(p,{modelValue:a(c).roleName,"onUpdate:modelValue":e[0]||(e[0]=l=>a(c).roleName=l),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0",clearable:"",style:{width:"240px"},onKeyup:fe(L,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(d,{label:"\u6743\u9650\u5B57\u7B26",prop:"roleKey"},{default:o(()=>[t(p,{modelValue:a(c).roleKey,"onUpdate:modelValue":e[1]||(e[1]=l=>a(c).roleKey=l),placeholder:"\u8BF7\u8F93\u5165\u6743\u9650\u5B57\u7B26",clearable:"",style:{width:"240px"},onKeyup:fe(L,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),t(d,{label:"\u72B6\u6001",prop:"status"},{default:o(()=>[t(G,{modelValue:a(c).status,"onUpdate:modelValue":e[2]||(e[2]=l=>a(c).status=l),placeholder:"\u89D2\u8272\u72B6\u6001",clearable:"",style:{width:"240px"}},{default:o(()=>[(m(!0),B(Z,null,ee(a(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:o(()=>[t(J,{modelValue:a(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:o(()=>[t(f,{type:"primary",icon:"Search",onClick:L},{default:o(()=>[i("\u641C\u7D22")]),_:1}),t(f,{icon:"Refresh",onClick:be},{default:o(()=>[i("\u91CD\u7F6E")]),_:1})]),_:1})]),_:1},8,["model"]),[[X,a($)]]),t(Ee,{gutter:10,class:"mb8"},{default:o(()=>[t(F,{span:1.5},{default:o(()=>[y((m(),_(f,{type:"primary",plain:"",icon:"Plus",onClick:Ue},{default:o(()=>[i("\u65B0\u589E")]),_:1})),[[C,["system:role:add"]]])]),_:1},8,["span"]),t(F,{span:1.5},{default:o(()=>[y((m(),_(f,{type:"success",plain:"",icon:"Edit",disabled:a(ae),onClick:ue},{default:o(()=>[i("\u4FEE\u6539")]),_:1},8,["disabled"])),[[C,["system:role:edit"]]])]),_:1},8,["span"]),t(F,{span:1.5},{default:o(()=>[y((m(),_(f,{type:"danger",plain:"",icon:"Delete",disabled:a(oe),onClick:ne},{default:o(()=>[i("\u5220\u9664")]),_:1},8,["disabled"])),[[C,["system:role:remove"]]])]),_:1},8,["span"]),t(F,{span:1.5},{default:o(()=>[y((m(),_(f,{type:"warning",plain:"",icon:"Download",onClick:Ve},{default:o(()=>[i("\u5BFC\u51FA")]),_:1})),[[C,["system:role:export"]]])]),_:1},8,["span"]),t(Ae,{showSearch:a($),"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:a(te),onSelectionChange:Ce},{default:o(()=>[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:o(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:o(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:o(l=>[l.row.roleId!==1?(m(),_(T,{key:0,content:"\u4FEE\u6539",placement:"top"},{default:o(()=>[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:o(()=>[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:o(()=>[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:o(()=>[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,a(j)]]),y(t(ze,{total:a(H),page:a(c).pageNum,"onUpdate:page":e[5]||(e[5]=l=>a(c).pageNum=l),limit:a(c).pageSize,"onUpdate:limit":e[6]||(e[6]=l=>a(c).pageSize=l),onPagination:b},null,8,["total","page","limit"]),[[X,a(H)>0]]),w(" \u6DFB\u52A0\u6216\u4FEE\u6539\u89D2\u8272\u914D\u7F6E\u5BF9\u8BDD\u6846 "),t(me,{title:a(N),modelValue:a(h),"onUpdate:modelValue":e[18]||(e[18]=l=>S(h)?h.value=l:null),width:"500px","append-to-body":""},{footer:o(()=>[O("div",il,[t(f,{type:"primary",onClick:Ie},{default:o(()=>[i("\u786E \u5B9A")]),_:1}),t(f,{onClick:De},{default:o(()=>[i("\u53D6 \u6D88")]),_:1})])]),default:o(()=>[t(W,{ref:"roleRef",model:a(u),rules:a(ke),"label-width":"100px"},{default:o(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0",prop:"roleName"},{default:o(()=>[t(p,{modelValue:a(u).roleName,"onUpdate:modelValue":e[7]||(e[7]=l=>a(u).roleName=l),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(d,{prop:"roleKey"},{label:o(()=>[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:o(()=>[t(Be,null,{default:o(()=>[t(Fe)]),_:1})]),_:1}),i(" \u6743\u9650\u5B57\u7B26 ")])]),default:o(()=>[t(p,{modelValue:a(u).roleKey,"onUpdate:modelValue":e[8]||(e[8]=l=>a(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:o(()=>[t(Oe,{modelValue:a(u).roleSort,"onUpdate:modelValue":e[9]||(e[9]=l=>a(u).roleSort=l),"controls-position":"right",min:0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u72B6\u6001"},{default:o(()=>[t(je,{modelValue:a(u).status,"onUpdate:modelValue":e[10]||(e[10]=l=>a(u).status=l)},{default:o(()=>[(m(!0),B(Z,null,ee(a(le),l=>(m(),_(Ye,{key:l.value,label:l.value},{default:o(()=>[i(ve(l.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(d,{label:"\u83DC\u5355\u6743\u9650"},{default:o(()=>[t(K,{modelValue:a(M),"onUpdate:modelValue":e[11]||(e[11]=l=>S(M)?M.value=l:null),onChange:e[12]||(e[12]=l=>de(l,"menu"))},{default:o(()=>[i("\u5C55\u5F00/\u6298\u53E0")]),_:1},8,["modelValue"]),t(K,{modelValue:a(q),"onUpdate:modelValue":e[13]||(e[13]=l=>S(q)?q.value=l:null),onChange:e[14]||(e[14]=l=>re(l,"menu"))},{default:o(()=>[i("\u5168\u9009/\u5168\u4E0D\u9009")]),_:1},8,["modelValue"]),t(K,{modelValue:a(u).menuCheckStrictly,"onUpdate:modelValue":e[15]||(e[15]=l=>a(u).menuCheckStrictly=l),onChange:e[16]||(e[16]=l=>se(l,"menu"))},{default:o(()=>[i("\u7236\u5B50\u8054\u52A8")]),_:1},8,["modelValue"]),t(pe,{class:"tree-border",data:a(I),"show-checkbox":"",ref_key:"menuRef",ref:g,"node-key":"id","check-strictly":!a(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:o(()=>[t(p,{modelValue:a(u).remark,"onUpdate:modelValue":e[17]||(e[17]=l=>a(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:a(N),modelValue:a(x),"onUpdate:modelValue":e[28]||(e[28]=l=>S(x)?x.value=l:null),width:"500px","append-to-body":""},{footer:o(()=>[O("div",pl,[t(f,{type:"primary",onClick:Me},{default:o(()=>[i("\u786E \u5B9A")]),_:1}),t(f,{onClick:qe},{default:o(()=>[i("\u53D6 \u6D88")]),_:1})])]),default:o(()=>[t(W,{model:a(u),"label-width":"80px"},{default:o(()=>[t(d,{label:"\u89D2\u8272\u540D\u79F0"},{default:o(()=>[t(p,{modelValue:a(u).roleName,"onUpdate:modelValue":e[19]||(e[19]=l=>a(u).roleName=l),disabled:!0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u6743\u9650\u5B57\u7B26"},{default:o(()=>[t(p,{modelValue:a(u).roleKey,"onUpdate:modelValue":e[20]||(e[20]=l=>a(u).roleKey=l),disabled:!0},null,8,["modelValue"])]),_:1}),t(d,{label:"\u6743\u9650\u8303\u56F4"},{default:o(()=>[t(G,{modelValue:a(u).dataScope,"onUpdate:modelValue":e[21]||(e[21]=l=>a(u).dataScope=l),onChange:Te},{default:o(()=>[(m(!0),B(Z,null,ee(a(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:o(()=>[t(K,{modelValue:a(A),"onUpdate:modelValue":e[22]||(e[22]=l=>S(A)?A.value=l:null),onChange:e[23]||(e[23]=l=>de(l,"dept"))},{default:o(()=>[i("\u5C55\u5F00/\u6298\u53E0")]),_:1},8,["modelValue"]),t(K,{modelValue:a(E),"onUpdate:modelValue":e[24]||(e[24]=l=>S(E)?E.value=l:null),onChange:e[25]||(e[25]=l=>re(l,"dept"))},{default:o(()=>[i("\u5168\u9009/\u5168\u4E0D\u9009")]),_:1},8,["modelValue"]),t(K,{modelValue:a(u).deptCheckStrictly,"onUpdate:modelValue":e[26]||(e[26]=l=>a(u).deptCheckStrictly=l),onChange:e[27]||(e[27]=l=>se(l,"dept"))},{default:o(()=>[i("\u7236\u5B50\u8054\u52A8")]),_:1},8,["modelValue"]),t(pe,{class:"tree-border",data:a(P),"show-checkbox":"","default-expand-all":"",ref_key:"deptRef",ref:k,"node-key":"id","check-strictly":!a(u).deptCheckStrictly,"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019",props:{label:"label",children:"children"}},null,8,["data","check-strictly"])]),_:1},512),[[X,a(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};
|