cxyStudy 3 gadi atpakaļ
vecāks
revīzija
8ddd42fbee

+ 2 - 2
2022/aiot-evaluate/src/components/button-group/index.vue

@ -1,6 +1,6 @@
1 1
<template>
2 2
    <el-button
3
      :class="{line: btn.isLine}"
3
      :class="{line: btn.attrs.isLine}"
4 4
      v-for="btn in btns"
5 5
      :key="btn.name"
6 6
      v-bind="btn.attrs"
@ -14,7 +14,7 @@
14 14
</template>
15 15

16 16
<script setup>
17
import { defineProps } from 'vue';
17
import { defineProps, provide } from 'vue';
18 18
defineProps({
19 19
  btns: {
20 20
    type: Array,

+ 88 - 67
2022/aiot-evaluate/src/components/panel/index.vue

@ -1,67 +1,88 @@
1
<template>
2
  <div class="ipu-panel">
3
    <el-main>
4
      <div class="ipu-panel-header">
5
        <div class="ipu-panel-title">
6
          {{ title }}
7
        </div>
8
        <div class="ipu-panel-slot-left">
9
          <slot name="slot-left"><div></div></slot>
10
        </div>
11
        <div class="ipu-panel-slot-right">
12
          <slot name="slot-right"><div></div></slot>
13
        </div>
14
      </div>
15
      <slot></slot>
16
    </el-main>
17
  </div>
18
</template>
19

20
<script setup>
21
import { defineProps } from 'vue';
22
defineProps({
23
  title: {
24
    type: String,
25
    default: () => ''
26
  }
27
});
28
</script>
29

30
<style scoped lang="scss">
31
.ipu-panel-main {
32
  width: 100%;
33
  height: 100%;
34
  background-color: #eee;
35
  padding: 15px;
36
 }
37
.ipu-panel-header {
38
  width: 100%;
39
  height: 52px;
40
  background-color: #fff;
41
  padding: 10px 17px;
42
  display: flex;
43
  align-items: center;
44
  .ipu-panel-title {
45
    width: 20%;
46
    font-size: 14px;
47
    font-weight: 500;
48
    opacity: 85%;
49
    line-height: 22px;
50
    color: rgba(0, 0, 0, 1);
51
  }
52
  .ipu-panel-slot-left,
53
  .ipu-panel-slot-right {
54
    display: flex;
55

56
    align-items: center;
57
  }
58
  .ipu-panel-slot-left {
59
    justify-content: flex-start;
60
    width: 40%;
61
  }
62
  .ipu-panel-slot-right {
63
    width: 40%;
64
    justify-content: flex-end;
65
  }
66
}
67
</style>
1
<template>
2
  <div :class="[isCollapse ? 'ipu-panel-collapse' : 'ipu-panel']">
3
    <el-main>
4
      <div class="ipu-panel-header">
5
        <div class="ipu-panel-title">
6
          {{title}}
7
        </div>
8
        <div class="ipu-panel-slot-left">
9
          <slot name="slot-left"><div></div></slot>
10
        </div>
11
        <div class="ipu-panel-slot-right">
12
            <slot name="slot-right"><div></div></slot>
13
        </div>
14
      </div>
15
      <slot></slot>
16
    </el-main>
17
  </div>
18
</template>
19
20
<script setup>
21
import { defineProps, ref, onMounted } from 'vue';
22
defineProps({
23
  title: {
24
    type: String,
25
    default: () => ''
26
  }
27
});
28
const isCollapse = ref(false);
29
window.addEventListener('setItemEvent', (e) => {
30
  if (e.key === 'isCollapse') {
31
    if (e.newValue === true) {
32
      isCollapse.value = true;
33
    } else {
34
      isCollapse.value = false;
35
    }
36
   }
37
  console.log(isCollapse.value, '@@@');
38
});
39
onMounted(() => {
40
});
41
</script>
42
43
<style lang="scss" scoped>
44
  @import "@/assets/styles/index.scss";
45
  .ipu-panel {
46
    width: calc(100vw - $slidebar-width);
47
    height: calc(100vh - $header-height - $tag-height);
48
    background-color: #eee;
49
    padding: 10px;
50
    border-radius: 6px;
51
    overflow: hidden;
52
  }
53
  .ipu-panel-collapse {
54
    width: calc(100vw - $siderbar-collapse-width);
55
    height: calc(100vh - $header-height - $tag-height);
56
    background-color: #eee;
57
    padding: 10px;
58
    border-radius: 6px;
59
    overflow: hidden;
60
  }
61
  .ipu-panel-header{
62
    width: 100%;
63
    height: 52px;
64
    background-color: #fff;
65
    padding: 10px 17px;
66
    display: flex;
67
    align-items: center;
68
    .ipu-panel-title{
69
      width: 20%;
70
      font-size: 14px;
71
      font-weight: 500;
72
      opacity: 85%;
73
      line-height: 22px;
74
      color: rgba(0,0,0,1);
75
    }
76
    .ipu-panel-slot-left,.ipu-panel-slot-right{
77
      display: flex;
78
      justify-content: space-around;
79
      align-items: center;
80
    }
81
    .ipu-panel-slot-left{
82
      width: 40%;
83
    }
84
    .ipu-panel-slot-right{
85
      width: 40%;
86
    }
87
  }
88
</style>

+ 6 - 0
2022/aiot-evaluate/src/main.js

@ -14,6 +14,9 @@ import { setGlobalApiProperties } from './api/index.js';
14 14
15 15
import { setupGlobalComponents } from './components';
16 16
17
// 引入监视localStorage的方法
18
import tool from './utils/tool';
19
17 20
const app = createApp(App);
18 21
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
19 22
  app.component(key, component);
@ -26,6 +29,9 @@ setGlobalProperties(app);
26 29
// 全局api
27 30
setGlobalApiProperties(app);
28 31
32
// 注册全局插件
33
app.use(tool);
34
29 35
app.use(ElementPlus, {
30 36
  locale: zhCn
31 37
});

+ 9 - 0
2022/aiot-evaluate/src/utils/tool.js

@ -0,0 +1,9 @@
1
function dispatchEventStorage() {
2
  localStorage.setItem = function(key, val) {
3
    const setEvent = new Event('setItemEvent');
4
    setEvent.key = key;
5
    setEvent.newValue = val;
6
    window.dispatchEvent(setEvent);
7
  };
8
}
9
export default dispatchEventStorage;

+ 36 - 31
2022/aiot-evaluate/src/views/settings/ApiResourceManagement.vue

@ -1,20 +1,16 @@
1 1
<template>
2 2
  <!-- 表格 -->
3
  <ipu-table-module
4
    @search="search"
5
    @clearSearch="clearSearch"
6
    @handleSizeChange="handleSizeChange"
7
    @handleCurrentChange="handleCurrentChange"
8
    :pageData="pageData"
9
  ></ipu-table-module>
3
  <ipu-table-module @search="search"
4
                    @clearSearch="clearSearch"
5
                    @handleSizeChange="handleSizeChange"
6
                    @handleCurrentChange="handleCurrentChange"
7
                    :pageData="pageData"></ipu-table-module>
10 8
11 9
  <!-- 弹窗 -->
12
  <ipu-dialog
13
    :dialogData="dialogData"
14
    @changeEvent="changeEvent"
15
    @blurEvent="blurEvent"
16
    :before-close="cancelDialog"
17
  ></ipu-dialog>
10
  <ipu-dialog :dialogData="dialogData"
11
              @changeEvent="changeEvent"
12
              @blurEvent="blurEvent"
13
              :before-close="cancelDialog"></ipu-dialog>
18 14
</template>
19 15
20 16
<script setup>
@ -235,7 +231,16 @@ const dialogData = ref({
235 231
236 232
// 搜索
237 233
const search = (data) => {
238
  queryByType({ type: 1 });
234
  const params = {
235
    ...data,
236
    clientId: pageData.value.tableData[0].clientId
237
  };
238
  console.log(data);
239
  console.log(params);
240
  // console.log(pageData.value.tableData[0].clientId);
241
  // console.log(pageData.value.page.size);
242
  getPermissionData(params);
243
  // queryByType({ type: 1 });
239 244
  console.log('开始搜索');
240 245
};
241 246
// 清除搜索
@ -278,7 +283,7 @@ const createPermission = async (params) => {
278 283
};
279 284
280 285
// 更新API资源
281
const changePermission = async(params) => {
286
const changePermission = async (params) => {
282 287
  await proxy
283 288
    .$reqPost(proxy.$api.managementPermissionApi.updatePermission, params)
284 289
    .then((res) => {
@ -294,7 +299,7 @@ const changePermission = async(params) => {
294 299
};
295 300
296 301
// 删除API资源
297
const deletePermission = async(code) => {
302
const deletePermission = async (code) => {
298 303
  await proxy
299 304
    .$reqPost(`${proxy.$api.managementPermissionApi.deletePermission}?code=${code}`)
300 305
    .then((res) => {
@ -322,7 +327,7 @@ const queryByType = async (param) => {
322 327
};
323 328
324 329
// 新建按钮
325
function addApi() {
330
function addApi () {
326 331
  dialogData.value.drawerData.isOpen = true;
327 332
  dialogData.value.drawerData.title = '新建API资源';
328 333
  dialogData.value.forms.map((item) => {
@ -331,7 +336,7 @@ function addApi() {
331 336
}
332 337
333 338
// 编辑按钮
334
function editRow(row) {
339
function editRow (row) {
335 340
  dialogData.value.drawerData.title = '编辑API资源';
336 341
  dialogData.value.drawerData.isOpen = true;
337 342
  console.log(row);
@ -359,7 +364,7 @@ function editRow(row) {
359 364
}
360 365
361 366
// 删除按钮;
362
function deleteRow(row) {
367
function deleteRow (row) {
363 368
  console.log(row);
364 369
365 370
  ElMessageBox.confirm(
@ -370,24 +375,24 @@ function deleteRow(row) {
370 375
      cancelButtonText: '取消',
371 376
      type: 'warning'
372 377
    }).then(() => {
373
    ElMessage({
374
      type: 'success',
375
      message: 'Delete completed'
378
      ElMessage({
379
        type: 'success',
380
        message: 'Delete completed'
381
      });
382
      deletePermission(row.roleCode);
383
    }).catch(() => {
384
      ElMessage({
385
        type: 'info',
386
        message: 'Delete canceled'
387
      });
376 388
    });
377
    deletePermission(row.roleCode);
378
  }).catch(() => {
379
    ElMessage({
380
      type: 'info',
381
      message: 'Delete canceled'
382
    });
383
  });
384 389
}
385 390
386
function cancelDialog() {
391
function cancelDialog () {
387 392
  dialogData.value.drawerData.isOpen = false;
388 393
}
389 394
390
function confirmDialog(value) {
395
function confirmDialog (value) {
391 396
  if (dialogData.value.drawerData.title === '新建API资源') {
392 397
    createPermission(value);
393 398
  } else if (dialogData.value.drawerData.title === '编辑API资源') {

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

@ -1,20 +1,16 @@
1 1
<template>
2 2
  <!-- 表格 -->
3
  <ipu-table-module
4
    @search="search"
5
    @clearSearch="clearSearch"
6
    @handleSizeChange="handleSizeChange"
7
    @handleCurrentChange="handleCurrentChange"
8
    :pageData="pageData"
9
  ></ipu-table-module>
3
  <ipu-table-module @search="search"
4
                    @clearSearch="clearSearch"
5
                    @handleSizeChange="handleSizeChange"
6
                    @handleCurrentChange="handleCurrentChange"
7
                    :pageData="pageData"></ipu-table-module>
10 8
11 9
  <!-- 弹窗 -->
12
  <ipu-dialog
13
    :dialogData="dialogData"
14
    @changeEvent="changeEvent"
15
    @blurEvent="blurEvent"
16
    :before-close="cancelDialog"
17
  ></ipu-dialog>
10
  <ipu-dialog :dialogData="dialogData"
11
              @changeEvent="changeEvent"
12
              @blurEvent="blurEvent"
13
              :before-close="cancelDialog"></ipu-dialog>
18 14
</template>
19 15
20 16
<script setup>
@ -48,7 +44,7 @@ const pageData = ref({
48 44
      clearable: true
49 45
    },
50 46
    rules: [{
51
    // required: true,
47
      // required: true,
52 48
      message: 'Please input client name',
53 49
      trigger: 'blur'
54 50
    },
@ -212,7 +208,12 @@ const dialogData = ref({
212 208
// -----查询应用-------
213 209
// 搜索
214 210
const search = (data) => {
215
  listClientPage(data);
211
  const params = {
212
    ...data,
213
    page: pageData.value.page.num,
214
    size: pageData.value.page.size
215
  };
216
  listClientPage(params);
216 217
  console.log(data);
217 218
  console.log('开始搜索');
218 219
};
@ -279,7 +280,7 @@ const createClient = async (params) => {
279 280
};
280 281
281 282
// 更新应用
282
const changeClient = async(params) => {
283
const changeClient = async (params) => {
283 284
  await proxy
284 285
    .$reqPost(proxy.$api.managementApi.updateByClientId, params)
285 286
    .then((res) => {
@ -295,7 +296,7 @@ const changeClient = async(params) => {
295 296
};
296 297
297 298
// 删除应用
298
const deleteClient = async(clientId) => {
299
const deleteClient = async (clientId) => {
299 300
  await proxy
300 301
    .$reqPost(`${proxy.$api.managementApi.deleteByClientId}?clientId=${clientId}`)
301 302
    .then((res) => {
@ -314,8 +315,8 @@ const listClientPage = async (params) => {
314 315
  await proxy
315 316
    .$reqGetParam(proxy.$api.managementApi.listPage, params)
316 317
    .then((res) => {
317
      console.log('应用数据:', res.data.data);
318
      pageData.value.tableData = res.data.data;
318
      console.log(res);
319
      pageData.value.tableData = res.data.data.records;
319 320
    })
320 321
    .catch((err) => {
321 322
      console.log(err);
@ -323,7 +324,7 @@ const listClientPage = async (params) => {
323 324
};
324 325
325 326
// 新建按钮
326
function addClient() {
327
function addClient () {
327 328
  dialogData.value.drawerData.isOpen = true;
328 329
  dialogData.value.drawerData.title = '新建应用';
329 330
  dialogData.value.forms.map((item) => {
@ -332,7 +333,7 @@ function addClient() {
332 333
}
333 334
334 335
// 编辑按钮
335
function editRow(row) {
336
function editRow (row) {
336 337
  dialogData.value.drawerData.title = '编辑应用';
337 338
  dialogData.value.drawerData.isOpen = true;
338 339
  // console.log(row);
@ -353,7 +354,7 @@ function editRow(row) {
353 354
}
354 355
355 356
// 删除按钮
356
function deleteRow(row) {
357
function deleteRow (row) {
357 358
  console.log(row);
358 359
  ElMessageBox.confirm(
359 360
    `确定要删除${row.clientName}吗`,
@ -363,25 +364,25 @@ function deleteRow(row) {
363 364
      cancelButtonText: '取消',
364 365
      type: 'warning'
365 366
    }).then(() => {
366
    ElMessage({
367
      type: 'success',
368
      message: 'Delete completed'
369
    });
370
    deleteClient(row.clientId);
371
  }).catch(() => {
372
    ElMessage({
373
      type: 'info',
374
      message: 'Delete canceled'
367
      ElMessage({
368
        type: 'success',
369
        message: 'Delete completed'
370
      });
371
      deleteClient(row.clientId);
372
    }).catch(() => {
373
      ElMessage({
374
        type: 'info',
375
        message: 'Delete canceled'
376
      });
375 377
    });
376
  });
377 378
}
378 379
379 380
// 弹出框取消
380
function cancelDialog() {
381
function cancelDialog () {
381 382
  dialogData.value.drawerData.isOpen = false;
382 383
}
383 384
// 弹出框确认
384
function confirmDialog(value) {
385
function confirmDialog (value) {
385 386
  if (dialogData.value.drawerData.title === '新建应用') {
386 387
    createClient(value);
387 388
  } else {

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

@ -1,26 +1,21 @@
1 1
<template>
2 2
  <!-- 表格 -->
3
  <ipu-table-module
4
    @search="search"
5
    @clearSearch="clearSearch"
6
    @handleSizeChange="handleSizeChange"
7
    @handleCurrentChange="handleCurrentChange"
8
    :pageData="pageData"
9
  ></ipu-table-module>
3
  <ipu-table-module @search="search"
4
                    @clearSearch="clearSearch"
5
                    @handleSizeChange="handleSizeChange"
6
                    @handleCurrentChange="handleCurrentChange"
7
                    :pageData="pageData"></ipu-table-module>
10 8
11 9
  <!-- 弹窗 -->
12
  <ipu-dialog
13
    :dialogData="dialogData"
14
    @changeEvent="changeEvent"
15
    @blurEvent="blurEvent"
16
    :before-close="cancelDialog"
17
  ></ipu-dialog>
10
  <ipu-dialog :dialogData="dialogData"
11
              @changeEvent="changeEvent"
12
              @blurEvent="blurEvent"
13
              :before-close="cancelDialog"></ipu-dialog>
18 14
</template>
19 15
20 16
<script setup>
21 17
import { ref, getCurrentInstance } from 'vue';
22 18
import { ElMessage, ElMessageBox } from 'element-plus';
23
24 19
// --------页面表单数据----------
25 20
const pageData = ref({
26 21
  title: '角色管理',
@ -342,9 +337,9 @@ const listRolePage = async (params) => {
342 337
  await proxy
343 338
    .$reqGetParam(proxy.$api.managementRoleApi.listPage, params)
344 339
    .then((res) => {
345
      console.log(res.data.data);
346
      pageData.value.tableData = res.data.data;
347
      pageData.value.page.total = res.data.total;
340
      console.log(res.data.data.records);
341
      pageData.value.tableData = res.data.data.records;
342
      pageData.value.page.total = res.data.total.records;
348 343
    })
349 344
    .catch((err) => {
350 345
      console.log(err);
@ -352,7 +347,7 @@ const listRolePage = async (params) => {
352 347
};
353 348
// search();
354 349
// 新建按钮
355
function addRole() {
350
function addRole () {
356 351
  dialogData.value.drawerData.isOpen = true;
357 352
  dialogData.value.drawerData.title = '新建角色';
358 353
  dialogData.value.forms.map((item) => {
@ -364,7 +359,7 @@ function addRole() {
364 359
}
365 360
366 361
// 编辑按钮
367
function editRow(row) {
362
function editRow (row) {
368 363
  dialogData.value.drawerData.isOpen = true;
369 364
  dialogData.value.drawerData.title = '编辑角色';
370 365
  // console.log(row);
@ -387,7 +382,7 @@ function editRow(row) {
387 382
}
388 383
389 384
// 删除按钮
390
function deleteRow(row) {
385
function deleteRow (row) {
391 386
  console.log(row);
392 387
393 388
  ElMessageBox.confirm(`确定要删除${row.roleName}吗`, '删除后将无法还原!', {
@ -411,12 +406,12 @@ function deleteRow(row) {
411 406
}
412 407
413 408
// 取消
414
function cancelDialog() {
409
function cancelDialog () {
415 410
  dialogData.value.drawerData.isOpen = false;
416 411
}
417 412
418 413
// 确认
419
function confirmDialog(value) {
414
function confirmDialog (value) {
420 415
  if (dialogData.value.drawerData.title === '新建角色') {
421 416
    createRole(value);
422 417
  } else {
@ -436,5 +431,5 @@ const blurEvent = (form) => {
436 431
</script>
437 432
438 433
<style lang="scss" scoped>
439
@import '@/assets/styles/index.scss';
434
@import "@/assets/styles/index.scss";
440 435
</style>