Browse Source

代码优化

zhaozy25 3 years ago
parent
commit
135723ec48

+ 0 - 10
2022/aiot-evaluate/src/views/settings/ApiResourceManagement.vue

@ -56,16 +56,6 @@ const pageData = ref({
56 56
      }
57 57
    },
58 58
    {
59
      label: '资源编码',
60
      name: 'code',
61
      'min-width': '193'
62
    },
63
    {
64
      label: '资源类型',
65
      name: 'type',
66
      'min-width': '137'
67
    },
68
    {
69 59
      label: '所属应用',
70 60
      name: 'clientId',
71 61
      type: 'select',

+ 0 - 12
2022/aiot-evaluate/src/views/settings/ApplicationManagement.vue

@ -236,18 +236,6 @@ function clearSearch (data) {
236 236
};
237 237
238 238
// 调用接口
239
// 获取应用表格数据
240
async function getClientData () {
241
  await proxy
242
    .$reqGet(proxy.$api.managementApi.listAll)
243
    .then((res) => {
244
      pageData.value.table.tableData = res.data.data;
245
    })
246
    .catch((e) => {
247
      ElMessage.error('获取应用数据失败');
248
    });
249
};
250
251 239
// 获取角色表格数据并将数据渲染至弹出框的角色选择栏中
252 240
async function getRoleData () {
253 241
  await proxy

+ 11 - 18
2022/aiot-evaluate/src/views/settings/RoleManagement.vue

@ -305,10 +305,11 @@ function confirmDrawerDialog(data) {
305 305
function cancelDrawerDialog() {
306 306
  ipuDrawerData.value.drawerData.isOpen = false;
307 307
}
308
308 309
// 根据角色查所有资源
309
const listAllNotBelongRole = async (roleCode) => {
310
async function listAllNotBelongRole (roleCode) {
310 311
  await proxy
311
    .$reqGet(`${proxy.$api.managementPermissionApi.listAllNotBelongRole}?roleCode=${roleCode}`)
312
    .$reqGetParam(proxy.$api.managementPermissionApi.listAllNotBelongRole, roleCode)
312 313
    .then((res) => {
313 314
      ipuDrawerData.value.treeData.data = res.data.data;
314 315
    })
@ -316,10 +317,11 @@ const listAllNotBelongRole = async (roleCode) => {
316 317
      ElMessage.error('查询所有资源失败');
317 318
    });
318 319
};
320
319 321
// 角色授权查询
320
const queryRoleGrant = async (roleCode) => {
322
async function queryRoleGrant(roleCode) {
321 323
  await proxy
322
    .$reqGet(`${proxy.$api.managementRoleApi.queryRoleGrant}?roleCode=${roleCode}`)
324
    .$reqGetParam(proxy.$api.managementRoleApi.queryRoleGrant, roleCode)
323 325
    .then((res) => {
324 326
      const nums = [];
325 327
      res.data.data.map((item) => {
@ -348,17 +350,6 @@ function clearSearch (data) {
348 350
};
349 351
350 352
// 调用接口
351
// 获取角色表格数据
352
async function getRoleData () {
353
  await proxy
354
    .$reqGet(proxy.$api.managementRoleApi.listAll)
355
    .then((res) => {
356
      pageData.value.table.tableData = res.data.data;
357
    })
358
    .catch((e) => {
359
      ElMessage.error('获取角色数据失败');
360
    });
361
};
362 353
// 获取应用表格数据,并将数据动态渲染至弹窗和搜索的选择栏中
363 354
async function getClientData () {
364 355
  await proxy
@ -422,7 +413,6 @@ async function updateRole (params) {
422 413
async function deleteRole (roleCode) {
423 414
  await proxy
424 415
    .$reqPost(`${proxy.$api.managementRoleApi.deleteRole}?roleCode=${roleCode}`)
425
    // .$reqPostParam(proxy.$api.managementRoleApi.deleteRole, roleCode)
426 416
    .then((res) => {})
427 417
    .catch((e) => {
428 418
      ElMessage.error('删除角色失败');
@ -523,8 +513,11 @@ function deleteRow(row) {
523 513
524 514
// 授权按钮
525 515
function roleGrant(row) {
526
  listAllNotBelongRole(row.roleCode);
527
  queryRoleGrant(row.roleCode);
516
  const param = {
517
    roleCode: row.roleCode
518
  };
519
  listAllNotBelongRole(param);
520
  queryRoleGrant(param);
528 521
  ipuDrawerData.value.drawerData.isOpen = true;
529 522
  ipuDrawerData.value.rowroleCode = row.roleCode;
530 523
}