9999 </el-select >
100100 </el-form-item >
101101 <!-- 分配角色的菜单权限对话框 -->
102- <el-form-item
103- label =" 权限范围"
104- v-if ="
105- actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
106- "
107- >
108- <el-card shadow =" never" >
109- <template #header >
110- 父子联动(选中父节点,自动选择子节点):
111- <el-switch v-model =" checkStrictly" inline-prompt active-text =" 是" inactive-text =" 否" />
112- 全选/全不选:
113- <el-switch
114- v-model =" treeNodeAll"
115- inline-prompt
116- active-text =" 是"
117- inactive-text =" 否"
118- @change =" handleCheckedTreeNodeAll()"
119- />
120- </template >
121- <el-tree
122- ref =" treeRef"
123- node-key =" id"
124- show-checkbox
125- :check-strictly =" !checkStrictly"
126- :props =" defaultProps"
127- :data =" treeOptions"
128- empty-text =" 加载中,请稍后"
129- />
130- </el-card >
131- </el-form-item >
102+ <el-row >
103+ <el-col :span =" 24" >
104+ <el-form-item
105+ label =" 权限范围"
106+ v-if ="
107+ actionScopeType === 'menu' ||
108+ dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
109+ "
110+ style =" display : flex "
111+ >
112+ <el-card class =" card" shadow =" never" >
113+ <template #header >
114+ <!-- 父子联动(选中父节点,自动选择子节点):-->
115+ <!-- <el-switch v-model="checkStrictly" inline-prompt active-text="是" inactive-text="否" />-->
116+ <!-- 全选/全不选:-->
117+ <!-- <el-switch-->
118+ <!-- v-model="treeNodeAll"-->
119+ <!-- inline-prompt-->
120+ <!-- active-text="是"-->
121+ <!-- inactive-text="否"-->
122+ <!-- @change="handleCheckedTreeNodeAll()"-->
123+ <!-- />-->
124+ </template >
125+ <el-tree
126+ ref =" treeRef"
127+ node-key =" id"
128+ show-checkbox
129+ :check-strictly =" !checkStrictly"
130+ :props =" defaultProps"
131+ :data =" treeOptions"
132+ empty-text =" 加载中,请稍后"
133+ />
134+ </el-card >
135+ </el-form-item > </el-col
136+ ></el-row >
132137 </el-form >
133138 <!-- 操作按钮 -->
134139 <template #footer >
@@ -245,18 +250,17 @@ const dialogScopeTitle = ref('数据权限')
245250const actionScopeType = ref (' ' )
246251const dataScopeDictDatas = ref ()
247252// 选项
248- const checkStrictly = ref (true )
249- const treeNodeAll = ref (false )
253+ const checkStrictly = ref (false )
254+ // const treeNodeAll = ref(false)
250255// 全选/全不选
251- const handleCheckedTreeNodeAll = () => {
252- treeRef .value ! .setCheckedNodes (treeNodeAll .value ? treeOptions .value : [])
253- }
256+ // const handleCheckedTreeNodeAll = () => {
257+ // treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
258+ // }
254259// 权限操作
255260const handleScope = async (type : string , row : RoleApi .RoleVO ) => {
256261 dataScopeForm .id = row .id
257262 dataScopeForm .name = row .name
258263 dataScopeForm .code = row .code
259-
260264 actionScopeType .value = type
261265 dialogScopeVisible .value = true
262266 if (type === ' menu' ) {
@@ -265,7 +269,7 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
265269 const role = await PermissionApi .listRoleMenusApi (row .id )
266270 if (role ) {
267271 role ?.forEach ((item : any ) => {
268- unref (treeRef )?.setChecked (item , true ,false );
272+ unref (treeRef )?.setChecked (item , true , false )
269273 })
270274 }
271275 } else if (type === ' data' ) {
@@ -275,11 +279,10 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
275279 dataScopeForm .dataScope = role .dataScope
276280 if (role .dataScopeDeptIds ) {
277281 role .dataScopeDeptIds ?.forEach ((item : any ) => {
278- unref (treeRef )?.setChecked (item , true ,false );
282+ unref (treeRef )?.setChecked (item , true , false )
279283 })
280284 }
281285 }
282-
283286}
284287// 保存权限
285288const submitScope = async () => {
@@ -314,3 +317,10 @@ onMounted(() => {
314317 init ()
315318})
316319 </script >
320+ <style scoped>
321+ .card {
322+ width : 100% ;
323+ max-height : 400px ;
324+ overflow-y : scroll ;
325+ }
326+ </style >
0 commit comments