Просмотр исходного кода

Merge branch 'master' of http://10.1.235.20:3000/asiainfo/static

# Conflicts:
#	2022/aiot-evaluate/src/components/form/IpuForm.vue
chenxy41 лет назад: 3
Родитель
Сommit
67a95f4030

+ 38 - 9
2022/aiot-evaluate/src/views/settings/ApiResourceManagement.vue

@ -195,6 +195,7 @@ const dialogData = ref({
195 195
      label: '资源类型',
196 196
      value: 1,
197 197
      attrs: {
198
        disabled: false,
198 199
        col: 2,
199 200
        radios: [{
200 201
          text: '目录',
@ -269,7 +270,7 @@ const dialogData = ref({
269 270
      label: '排序',
270 271
      value: '',
271 272
      attrs: {
272
        col: 2,
273
        col: 1,
273 274
        min: 1,
274 275
        clearable: true
275 276
      },
@ -330,16 +331,27 @@ function parseData (data) {
330 331
  }
331 332
  return data;
332 333
};
334
function childrenWithNameToChildren (result) {
335
  result.forEach((item) => {
336
    if (item.childrenWithName.length !== 0) {
337
      item.children = item.childrenWithName;
338
      childrenWithNameToChildren(item.childrenWithName);
339
    }
340
  });
341
  return result;
342
}
333 343
334 344
// 获取api表单数据
335 345
async function getPermissionData (params) {
336 346
  await proxy
337 347
    .$reqGetParam(proxy.$api.managementPermissionApi.listAll, params)
338 348
    .then((res) => {
339
      pageData.value.table.tableData = parseData(res.data.data);
349
      // 1. 将res中childrenWithName的值赋给children进行展示
350
      // 2. 资源类型的映射
351
      const result = JSON.parse(JSON.stringify(res.data.data));
352
      pageData.value.table.tableData = parseData(childrenWithNameToChildren(result));
340 353
    })
341 354
    .catch((e) => {
342
      console.log(e);
343 355
      ElMessage.error('获取资源数据失败');
344 356
    });
345 357
};
@ -366,8 +378,12 @@ async function createPermission (params) {
366 378
  await proxy
367 379
    .$reqPost(proxy.$api.managementPermissionApi.addPermission, params)
368 380
    .then((res) => {
369
      getPermissionData();
370
      cancelDialog();
381
      if (res.data.code === 200) {
382
        getPermissionData();
383
        cancelDialog();
384
      } else {
385
        ElMessage.error(res.data.message);
386
      }
371 387
    })
372 388
    .catch((e) => {
373 389
      ElMessage.error('新建API资源失败');
@ -380,8 +396,12 @@ async function changePermission (params) {
380 396
  await proxy
381 397
    .$reqPost(proxy.$api.managementPermissionApi.updatePermission, params)
382 398
    .then((res) => {
383
      getPermissionData();
384
      cancelDialog();
399
      if (res.data.code === 200) {
400
        getPermissionData();
401
        cancelDialog();
402
      } else {
403
        ElMessage.error('更新API资源失败');
404
      }
385 405
    })
386 406
    .catch((e) => {
387 407
      ElMessage.error('更新API资源失败');
@ -446,12 +466,17 @@ function addApi() {
446 466
      item.attrs.options.length = 0;
447 467
      item.attrs.disabled = false;
448 468
    }
469
    if (item.name === 'type') {
470
      item.attrs.disabled = false;
471
    }
472
    if (item.name === 'clientId') {
473
      item.attrs.disabled = false;
474
    }
449 475
  });
450 476
}
451 477
452 478
// 编辑按钮
453 479
function editRow(row) {
454
  console.log(row);
455 480
  dialogData.value.drawerData = {
456 481
    title: '编辑API资源',
457 482
    type: 'edit',
@ -475,11 +500,12 @@ function editRow(row) {
475 500
          type: 1
476 501
        };
477 502
        queryByType(params);
478
        item.attrs.disabled = false;
503
        item.attrs.disabled = true;
479 504
      }
480 505
    }
481 506
    // 资源路径是否显示
482 507
    if (item.name === 'type') {
508
      item.attrs.disabled = true;
483 509
      if (row.type === 1) {
484 510
        dialogData.value.forms.map((x) => {
485 511
          if (x.name === 'uri') {
@ -496,6 +522,9 @@ function editRow(row) {
496 522
        });
497 523
      }
498 524
    }
525
    if (item.name === 'clientId') {
526
      item.attrs.disabled = true;
527
    }
499 528
  });
500 529
}
501 530

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

@ -283,7 +283,7 @@ async function createClient (params) {
283 283
        search(param);
284 284
        cancelDialog();
285 285
      } else {
286
        ElMessage.error('新建应用失败');
286
        ElMessage.error(res.data.message);
287 287
      }
288 288
    })
289 289
    .catch((e) => {
@ -305,7 +305,7 @@ async function changeClient (params) {
305 305
        search(param);
306 306
        cancelDialog();
307 307
      } else {
308
        ElMessage.error('更新应用失败');
308
        ElMessage.error(res.data.message);
309 309
      }
310 310
    })
311 311
    .catch((e) => {
@ -326,7 +326,7 @@ async function deleteClient (clientId) {
326 326
        };
327 327
        search(param);
328 328
      } else {
329
        ElMessage.error('删除应用失败');
329
        ElMessage.error(res.data.message);
330 330
      }
331 331
    })
332 332
    .catch((e) => {

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

@ -98,7 +98,7 @@ const pageData = ref({
98 98
      },
99 99
      {
100 100
        label: '所属应用',
101
        name: 'clientId',
101
        name: 'clientName',
102 102
        'min-width': '200'
103 103
      },
104 104
      {
@ -230,6 +230,7 @@ const dialogData = ref({
230 230
    label: '角色描述',
231 231
    value: '',
232 232
    attrs: {
233
      col: 1,
233 234
      style: {
234 235
        width: '745px'
235 236
      },
@ -237,8 +238,7 @@ const dialogData = ref({
237 238
      maxlength: 100,
238 239
      clearable: true,
239 240
      placeholder: '请输入角色描述,最多可输入100字',
240
      type: 'textarea',
241
      col: 2
241
      type: 'textarea'
242 242
    }
243 243
  }],
244 244
  // form按钮
@ -377,9 +377,9 @@ async function getClientData() {
377 377
      // 动态添加至搜索框中
378 378
      const clientId = 'clientId';
379 379
      const clientName = 'clientName';
380
      addToSelect(pageData, res, clientId, clientName, clientName);
380
      addToSelect(pageData, res, clientId, clientName, clientId);
381 381
      // 动态添加至弹窗中
382
      addToSelect(dialogData, res, clientId, clientName, clientName);
382
      addToSelect(dialogData, res, clientId, clientName, clientId);
383 383
    })
384 384
    .catch((e) => {
385 385
      ElMessage.error('获取应用数据失败');
@ -399,7 +399,7 @@ async function createRole(params) {
399 399
        search(param);
400 400
        cancelDialog();
401 401
      } else {
402
        ElMessage.error(res.data.data.message);
402
        ElMessage.error(res.data.message);
403 403
      }
404 404
    })
405 405
    .catch((e) => {