Showing
22 changed files
with
748 additions
and
60 deletions
doc/功能优化记录/【李腾飞】采集器接口.md
0 → 100644
1 | +# 代码包路径 | ||
2 | +```` | ||
3 | +【后端】 hg-platform\business-center\view-center-project\view-center-zj\src\main\java\com\honggroup\manageapi\bdialtestconfig | ||
4 | +```` | ||
5 | + | ||
6 | +### 说明 | ||
7 | +```` | ||
8 | +文档管理是一个组件,文档管理和回收站使用传参的方式,来控制读取数据的接口; | ||
9 | +```` | ||
10 | + | ||
11 | +## 配置文件修改 | ||
12 | +**api-gateway**</br> | ||
13 | +配置节点security:oauth2:ignored追加配置文件:**,/api-web/manage/bustype/getAllBusId,/api-web/manage/bdialtest/getTaskIdAndBusId** | ||
14 | +```` | ||
15 | +# 增加配置文件 | ||
16 | +security: | ||
17 | + oauth2: | ||
18 | + ignored: /test163/** , /api-auth/** , /doc.html ,/test111 ,/api-user/users-anon/login, /api-user/users/save,/api-web/datavis/**,/api-web/bigScreen/**, /user-center/users-anon/login,/document.html,**/v2/api-docs,/oauth/** ,/login.html ,/user/login,/**/**.css ,/**/**.js ,/getVersion,/api-web/manage/bustype/getAllBusId,/api-web/manage/bdialtest/getTaskIdAndBusId | ||
19 | + | ||
20 | +```` | ||
21 | + | ||
22 | +## 涉及工程 | ||
23 | +> 1、view-center |
@@ -2,11 +2,15 @@ | @@ -2,11 +2,15 @@ | ||
2 | [https://hgkj.5upm.com/task-view-73.html](任务地址) | 2 | [https://hgkj.5upm.com/task-view-73.html](任务地址) |
3 | 3 | ||
4 | # 代码包路径 | 4 | # 代码包路径 |
5 | -````【前端】【组件】hg-monitor-web\hg-monitor-web-base\src\main\resources\static\vue3\src\components\common\document | 5 | +```` |
6 | +【前端】【组件】hg-monitor-web\hg-monitor-web-base\src\main\resources\static\vue3\src\components\common\document | ||
6 | 【前端】【文档管理】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\index.* | 7 | 【前端】【文档管理】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\index.* |
7 | 【前端】【回收站】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\documentRecycle.* | 8 | 【前端】【回收站】hg-monitor-web\hg-monitor-web-zj\src\main\resources\static\vue3\src\views\documentationManagement\documentRecycle.* |
8 | 【后端】hg-platform\business-center\inspection-report\src\main\java\com\honggroup\report\controller\FileManageMentController.java | 9 | 【后端】hg-platform\business-center\inspection-report\src\main\java\com\honggroup\report\controller\FileManageMentController.java |
10 | +```` | ||
11 | + | ||
9 | ### 说明 | 12 | ### 说明 |
13 | +```` | ||
10 | 文档管理是一个组件,文档管理和回收站使用传参的方式,来控制读取数据的接口; | 14 | 文档管理是一个组件,文档管理和回收站使用传参的方式,来控制读取数据的接口; |
11 | ```` | 15 | ```` |
12 | 16 |
@@ -55,6 +55,30 @@ | @@ -55,6 +55,30 @@ | ||
55 | <ul class="icon_lists dib-box"> | 55 | <ul class="icon_lists dib-box"> |
56 | 56 | ||
57 | <li class="dib"> | 57 | <li class="dib"> |
58 | + <span class="icon iconfont"></span> | ||
59 | + <div class="name">资产</div> | ||
60 | + <div class="code-name">&#xe615;</div> | ||
61 | + </li> | ||
62 | + | ||
63 | + <li class="dib"> | ||
64 | + <span class="icon iconfont"></span> | ||
65 | + <div class="name">收藏</div> | ||
66 | + <div class="code-name">&#xe61f;</div> | ||
67 | + </li> | ||
68 | + | ||
69 | + <li class="dib"> | ||
70 | + <span class="icon iconfont"></span> | ||
71 | + <div class="name">网络拓扑</div> | ||
72 | + <div class="code-name">&#xe835;</div> | ||
73 | + </li> | ||
74 | + | ||
75 | + <li class="dib"> | ||
76 | + <span class="icon iconfont"></span> | ||
77 | + <div class="name">收藏</div> | ||
78 | + <div class="code-name">&#xe622;</div> | ||
79 | + </li> | ||
80 | + | ||
81 | + <li class="dib"> | ||
58 | <span class="icon iconfont"></span> | 82 | <span class="icon iconfont"></span> |
59 | <div class="name">虚拟桌面</div> | 83 | <div class="name">虚拟桌面</div> |
60 | <div class="code-name">&#xe613;</div> | 84 | <div class="code-name">&#xe613;</div> |
@@ -564,9 +588,9 @@ | @@ -564,9 +588,9 @@ | ||
564 | <pre><code class="language-css" | 588 | <pre><code class="language-css" |
565 | >@font-face { | 589 | >@font-face { |
566 | font-family: 'iconfont'; | 590 | font-family: 'iconfont'; |
567 | - src: url('iconfont.woff2?t=1635930253141') format('woff2'), | ||
568 | - url('iconfont.woff?t=1635930253141') format('woff'), | ||
569 | - url('iconfont.ttf?t=1635930253141') format('truetype'); | 591 | + src: url('iconfont.woff2?t=1636448687987') format('woff2'), |
592 | + url('iconfont.woff?t=1636448687987') format('woff'), | ||
593 | + url('iconfont.ttf?t=1636448687987') format('truetype'); | ||
570 | } | 594 | } |
571 | </code></pre> | 595 | </code></pre> |
572 | <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> | 596 | <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> |
@@ -593,6 +617,42 @@ | @@ -593,6 +617,42 @@ | ||
593 | <ul class="icon_lists dib-box"> | 617 | <ul class="icon_lists dib-box"> |
594 | 618 | ||
595 | <li class="dib"> | 619 | <li class="dib"> |
620 | + <span class="icon iconfont icon-assets"></span> | ||
621 | + <div class="name"> | ||
622 | + 资产 | ||
623 | + </div> | ||
624 | + <div class="code-name">.icon-assets | ||
625 | + </div> | ||
626 | + </li> | ||
627 | + | ||
628 | + <li class="dib"> | ||
629 | + <span class="icon iconfont icon-shoucang"></span> | ||
630 | + <div class="name"> | ||
631 | + 收藏 | ||
632 | + </div> | ||
633 | + <div class="code-name">.icon-shoucang | ||
634 | + </div> | ||
635 | + </li> | ||
636 | + | ||
637 | + <li class="dib"> | ||
638 | + <span class="icon iconfont icon-wangluotuopu"></span> | ||
639 | + <div class="name"> | ||
640 | + 网络拓扑 | ||
641 | + </div> | ||
642 | + <div class="code-name">.icon-wangluotuopu | ||
643 | + </div> | ||
644 | + </li> | ||
645 | + | ||
646 | + <li class="dib"> | ||
647 | + <span class="icon iconfont icon-shoucang1"></span> | ||
648 | + <div class="name"> | ||
649 | + 收藏 | ||
650 | + </div> | ||
651 | + <div class="code-name">.icon-shoucang1 | ||
652 | + </div> | ||
653 | + </li> | ||
654 | + | ||
655 | + <li class="dib"> | ||
596 | <span class="icon iconfont icon-xunizhuomian"></span> | 656 | <span class="icon iconfont icon-xunizhuomian"></span> |
597 | <div class="name"> | 657 | <div class="name"> |
598 | 虚拟桌面 | 658 | 虚拟桌面 |
@@ -1359,6 +1419,38 @@ | @@ -1359,6 +1419,38 @@ | ||
1359 | 1419 | ||
1360 | <li class="dib"> | 1420 | <li class="dib"> |
1361 | <svg class="icon svg-icon" aria-hidden="true"> | 1421 | <svg class="icon svg-icon" aria-hidden="true"> |
1422 | + <use xlink:href="#icon-assets"></use> | ||
1423 | + </svg> | ||
1424 | + <div class="name">资产</div> | ||
1425 | + <div class="code-name">#icon-assets</div> | ||
1426 | + </li> | ||
1427 | + | ||
1428 | + <li class="dib"> | ||
1429 | + <svg class="icon svg-icon" aria-hidden="true"> | ||
1430 | + <use xlink:href="#icon-shoucang"></use> | ||
1431 | + </svg> | ||
1432 | + <div class="name">收藏</div> | ||
1433 | + <div class="code-name">#icon-shoucang</div> | ||
1434 | + </li> | ||
1435 | + | ||
1436 | + <li class="dib"> | ||
1437 | + <svg class="icon svg-icon" aria-hidden="true"> | ||
1438 | + <use xlink:href="#icon-wangluotuopu"></use> | ||
1439 | + </svg> | ||
1440 | + <div class="name">网络拓扑</div> | ||
1441 | + <div class="code-name">#icon-wangluotuopu</div> | ||
1442 | + </li> | ||
1443 | + | ||
1444 | + <li class="dib"> | ||
1445 | + <svg class="icon svg-icon" aria-hidden="true"> | ||
1446 | + <use xlink:href="#icon-shoucang1"></use> | ||
1447 | + </svg> | ||
1448 | + <div class="name">收藏</div> | ||
1449 | + <div class="code-name">#icon-shoucang1</div> | ||
1450 | + </li> | ||
1451 | + | ||
1452 | + <li class="dib"> | ||
1453 | + <svg class="icon svg-icon" aria-hidden="true"> | ||
1362 | <use xlink:href="#icon-xunizhuomian"></use> | 1454 | <use xlink:href="#icon-xunizhuomian"></use> |
1363 | </svg> | 1455 | </svg> |
1364 | <div class="name">虚拟桌面</div> | 1456 | <div class="name">虚拟桌面</div> |
1 | @font-face { | 1 | @font-face { |
2 | font-family: "iconfont"; /* Project id 2843738 */ | 2 | font-family: "iconfont"; /* Project id 2843738 */ |
3 | - src: url('iconfont.woff2?t=1635930253141') format('woff2'), | ||
4 | - url('iconfont.woff?t=1635930253141') format('woff'), | ||
5 | - url('iconfont.ttf?t=1635930253141') format('truetype'); | 3 | + src: url('iconfont.woff2?t=1636448687987') format('woff2'), |
4 | + url('iconfont.woff?t=1636448687987') format('woff'), | ||
5 | + url('iconfont.ttf?t=1636448687987') format('truetype'); | ||
6 | } | 6 | } |
7 | 7 | ||
8 | .iconfont { | 8 | .iconfont { |
@@ -13,6 +13,22 @@ | @@ -13,6 +13,22 @@ | ||
13 | -moz-osx-font-smoothing: grayscale; | 13 | -moz-osx-font-smoothing: grayscale; |
14 | } | 14 | } |
15 | 15 | ||
16 | +.icon-assets:before { | ||
17 | + content: "\e615"; | ||
18 | +} | ||
19 | + | ||
20 | +.icon-shoucang:before { | ||
21 | + content: "\e61f"; | ||
22 | +} | ||
23 | + | ||
24 | +.icon-wangluotuopu:before { | ||
25 | + content: "\e835"; | ||
26 | +} | ||
27 | + | ||
28 | +.icon-shoucang1:before { | ||
29 | + content: "\e622"; | ||
30 | +} | ||
31 | + | ||
16 | .icon-xunizhuomian:before { | 32 | .icon-xunizhuomian:before { |
17 | content: "\e613"; | 33 | content: "\e613"; |
18 | } | 34 | } |
This diff could not be displayed because it is too large.
@@ -6,6 +6,34 @@ | @@ -6,6 +6,34 @@ | ||
6 | "description": "", | 6 | "description": "", |
7 | "glyphs": [ | 7 | "glyphs": [ |
8 | { | 8 | { |
9 | + "icon_id": "1369418", | ||
10 | + "name": "资产", | ||
11 | + "font_class": "assets", | ||
12 | + "unicode": "e615", | ||
13 | + "unicode_decimal": 58901 | ||
14 | + }, | ||
15 | + { | ||
16 | + "icon_id": "5318188", | ||
17 | + "name": "收藏", | ||
18 | + "font_class": "shoucang", | ||
19 | + "unicode": "e61f", | ||
20 | + "unicode_decimal": 58911 | ||
21 | + }, | ||
22 | + { | ||
23 | + "icon_id": "6510093", | ||
24 | + "name": "网络拓扑", | ||
25 | + "font_class": "wangluotuopu", | ||
26 | + "unicode": "e835", | ||
27 | + "unicode_decimal": 59445 | ||
28 | + }, | ||
29 | + { | ||
30 | + "icon_id": "7588122", | ||
31 | + "name": "收藏", | ||
32 | + "font_class": "shoucang1", | ||
33 | + "unicode": "e622", | ||
34 | + "unicode_decimal": 58914 | ||
35 | + }, | ||
36 | + { | ||
9 | "icon_id": "4675111", | 37 | "icon_id": "4675111", |
10 | "name": "虚拟桌面", | 38 | "name": "虚拟桌面", |
11 | "font_class": "xunizhuomian", | 39 | "font_class": "xunizhuomian", |
No preview for this file type
No preview for this file type
No preview for this file type
@@ -134,6 +134,28 @@ global.viewer = (path,proxy) =>{ | @@ -134,6 +134,28 @@ global.viewer = (path,proxy) =>{ | ||
134 | } | 134 | } |
135 | 135 | ||
136 | /** | 136 | /** |
137 | + * 拓扑 | ||
138 | + * @param path | ||
139 | + */ | ||
140 | +global.openGraphEditor = (topoId) =>{ | ||
141 | + let url = `${sessionStorage.getItem('graphEditorOrigin')}/jgraph/grapheditor/index.html?access_token=${localStorage.getItem('access_token')}&id=${topoId}`; | ||
142 | + let height = window.innerHeight; | ||
143 | + let width = window.innerWidth; | ||
144 | + window.open(url,"_blank",`toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width=${width}, height=${height}`); | ||
145 | +} | ||
146 | + | ||
147 | +/** | ||
148 | + * 打开资产列表 | ||
149 | + * @param topoId | ||
150 | + */ | ||
151 | +global.openCmdbAssets = (resId) =>{ | ||
152 | + let url = `${sessionStorage.getItem('graphEditorOrigin')}/jgraph/grapheditor/index.html?access_token=${localStorage.getItem('access_token')}&id=${resId}`; | ||
153 | + let height = window.innerHeight; | ||
154 | + let width = window.innerWidth; | ||
155 | + window.open(url,"_blank",`toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width=${width}, height=${height}`); | ||
156 | +} | ||
157 | + | ||
158 | +/** | ||
137 | * 将文件转成base64 | 159 | * 将文件转成base64 |
138 | * @param file | 160 | * @param file |
139 | * @returns {Promise<String>} | 161 | * @returns {Promise<String>} |
@@ -8,7 +8,7 @@ let http = { | @@ -8,7 +8,7 @@ let http = { | ||
8 | }, | 8 | }, |
9 | reqErr: function (xhr) { | 9 | reqErr: function (xhr) { |
10 | try{ | 10 | try{ |
11 | - | 11 | + http.proxy.$global.showMsg("服务异常,请联系管理员!","error"); |
12 | let isUnauthorized = xhr.statusText == 'Unauthorized' | 12 | let isUnauthorized = xhr.statusText == 'Unauthorized' |
13 | if (isUnauthorized || (xhr && xhr.responseJSON && xhr.responseJSON.resp_code && xhr.responseJSON.resp_code == '401')) { | 13 | if (isUnauthorized || (xhr && xhr.responseJSON && xhr.responseJSON.resp_code && xhr.responseJSON.resp_code == '401')) { |
14 | // 登录超时,刷新当前页面===>跳转到登录页面 | 14 | // 登录超时,刷新当前页面===>跳转到登录页面 |
@@ -28,7 +28,14 @@ | @@ -28,7 +28,14 @@ | ||
28 | width: 300px; | 28 | width: 300px; |
29 | } | 29 | } |
30 | 30 | ||
31 | -.yfyw-user .el-input__inner, .el-textarea__inner { | 31 | +.yfyw-user .el-input__inner { |
32 | + border: none; | ||
33 | + border-bottom: solid 1px #DCDFE6; | ||
34 | + border-bottom-left-radius: 0; | ||
35 | + border-bottom-right-radius: 0; | ||
36 | +} | ||
37 | + | ||
38 | +.yfyw-user .el-textarea__inner { | ||
32 | border: none; | 39 | border: none; |
33 | border-bottom: solid 1px #DCDFE6; | 40 | border-bottom: solid 1px #DCDFE6; |
34 | border-bottom-left-radius: 0; | 41 | border-bottom-left-radius: 0; |
hg-monitor-web-zj/src/main/resources/static/vue3/src/components/page/res/rateComponents/index.html
0 → 100644
1 | +<el-progress type="dashboard" :percentage="percentage" :status="status"> | ||
2 | + <template #default="{ percentage }"> | ||
3 | + <span class="percentage-value">{{ percentage }}%</span> | ||
4 | + <span class="percentage-label">{{percentageText}}</span> | ||
5 | + </template> | ||
6 | +</el-progress> | ||
7 | + | ||
8 | +<!-- | ||
9 | +<el-progress | ||
10 | + :text-inside="true" | ||
11 | + :stroke-width="20" | ||
12 | + :percentage="50" | ||
13 | + status="exception" > | ||
14 | + <span>Content</span> | ||
15 | +</el-progress> | ||
16 | +--> |
hg-monitor-web-zj/src/main/resources/static/vue3/src/components/page/res/rateComponents/index.js
0 → 100644
1 | +export default { | ||
2 | + name: 'resConfigIndex', | ||
3 | + template: '', | ||
4 | + components: {}, | ||
5 | + props: { | ||
6 | + // 百分比数字,例如:50%,percentage= 50 | ||
7 | + percentage: { | ||
8 | + type: Number, | ||
9 | + default: 0 | ||
10 | + }, | ||
11 | + // 展示文字 | ||
12 | + percentageText: { | ||
13 | + type: String, | ||
14 | + default: '' | ||
15 | + }, | ||
16 | + // 状态 success/exception/warning | ||
17 | + status: { | ||
18 | + type: String, | ||
19 | + default: 'success' | ||
20 | + }, | ||
21 | + | ||
22 | + }, | ||
23 | + data() { | ||
24 | + return { | ||
25 | + } | ||
26 | + }, | ||
27 | + setup(props, {attrs, slots, emit}) { | ||
28 | + } | ||
29 | +} |
1 | +<div> | ||
2 | + <el-dropdown> | ||
3 | + <span class="el-dropdown-link" @click="openDetail"> | ||
4 | + {{resName}} | ||
5 | + <el-icon class="el-icon--right"> | ||
6 | + <arrow-down/> | ||
7 | + </el-icon> | ||
8 | + </span> | ||
9 | + <template #dropdown> | ||
10 | + <el-dropdown-menu> | ||
11 | + <el-dropdown-item v-if="start" title="收藏" @click="showDialog(true)"> | ||
12 | + <i class="iconfont icon-shoucang" style="color: #FEB61E"/> | ||
13 | + </el-dropdown-item> | ||
14 | + <el-dropdown-item v-if="topo" title="拓扑" @click="openTopoPage"> | ||
15 | + <i class="iconfont icon-wangluotuopu" style="color: #FEB61E"/> | ||
16 | + </el-dropdown-item> | ||
17 | + <el-dropdown-item v-if="assets" title="资产" @click="openCmdbAssets"> | ||
18 | + <i class="iconfont icon-assets" style="color: #FEB61E"/> | ||
19 | + </el-dropdown-item> | ||
20 | + </el-dropdown-menu> | ||
21 | + </template> | ||
22 | + </el-dropdown> | ||
23 | + | ||
24 | + <cm-dialog title="收藏" width="500px" :showDialogVisible="dialogFlg" @hidedialog="showDialog" @okfunc="saveStart"> | ||
25 | + <template v-slot> | ||
26 | + <div style="padding: 10px" style="display: flex"> | ||
27 | + <div v-for="(v,k) in fieldsValueObj[currentRow.id].props" style="width: 50%"> | ||
28 | + <div style="text-align: left;padding-left: 10px;">{{v}}</div> | ||
29 | + <el-select v-model="favIds" multiple placeholder="请选择" style="margin: 3px"> | ||
30 | + <el-option v-for="(item ,index) in favData" | ||
31 | + :key="index" | ||
32 | + :label="item.name" | ||
33 | + :value="item.value" > | ||
34 | + </el-option> | ||
35 | + </el-select> | ||
36 | + </div> | ||
37 | + </div> | ||
38 | + </template> | ||
39 | + </cm-dialog> | ||
40 | + | ||
41 | +</div> |
hg-monitor-web-zj/src/main/resources/static/vue3/src/components/page/res/resNameComponents/index.js
0 → 100644
1 | +export default { | ||
2 | + name: 'resConfigIndex', | ||
3 | + template: '', | ||
4 | + components: {}, | ||
5 | + props: { | ||
6 | + // 资源名称 | ||
7 | + resName: { | ||
8 | + type: String, | ||
9 | + default: 0 | ||
10 | + }, | ||
11 | + // 展示文字 收藏、拓扑、资产 'start,topo,assets' | ||
12 | + start: { | ||
13 | + type: Boolean, | ||
14 | + default: true | ||
15 | + }, | ||
16 | + topo: { | ||
17 | + type: Boolean, | ||
18 | + default: true | ||
19 | + }, | ||
20 | + assets: { | ||
21 | + type: Boolean, | ||
22 | + default: true | ||
23 | + }, | ||
24 | + resId: { | ||
25 | + type: String, | ||
26 | + default: '' | ||
27 | + }, | ||
28 | + | ||
29 | + }, | ||
30 | + data() { | ||
31 | + return {} | ||
32 | + }, | ||
33 | + setup(props, {attrs, slots, emit}) { | ||
34 | + | ||
35 | + const {proxy} = Vue.getCurrentInstance(); | ||
36 | + | ||
37 | + let dialogFlg = Vue.ref(false); | ||
38 | + let favIds = Vue.ref([]); | ||
39 | + let favData = Vue.ref([]); | ||
40 | + | ||
41 | + /** | ||
42 | + * 展示收藏弹框 | ||
43 | + * <p> | ||
44 | + * 作者: Wang | ||
45 | + * 时间:2021/11/9 18:30 | ||
46 | + */ | ||
47 | + let showDialog = (flg) => { | ||
48 | + dialogFlg.value = flg; | ||
49 | + | ||
50 | + if (favData.value.length == 0) { | ||
51 | + // 加载收藏文件列表 | ||
52 | + proxy.$http.get(`/api-web/favorites/treeSelectData`, {}, function (res) { | ||
53 | + if (res && res.data && res.data.length > 0) { | ||
54 | + let arr = []; | ||
55 | + let getChilds = (arr) => { | ||
56 | + arr.forEach(function (v) { | ||
57 | + if (v.children && v.children.length > 0) { | ||
58 | + getChilds(v.children); | ||
59 | + } else { | ||
60 | + arr.push(v); | ||
61 | + } | ||
62 | + }) | ||
63 | + } | ||
64 | + favData.value = arr; | ||
65 | + } | ||
66 | + }); | ||
67 | + | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * 保存收藏 | ||
73 | + * <p> | ||
74 | + * 作者: Wang | ||
75 | + * 时间:2021/11/9 18:29 | ||
76 | + */ | ||
77 | + let saveStart = () => { | ||
78 | + if (props.resId == '') { | ||
79 | + proxy.$global.showMsg("资源Id不存在,确认!") | ||
80 | + return; | ||
81 | + } | ||
82 | + | ||
83 | + let params = { | ||
84 | + favIds: favIds, | ||
85 | + resId: props.resId | ||
86 | + } | ||
87 | + proxy.$http.post(`/api-web/favorites/save/fav`, params, function (res) { | ||
88 | + if (res && res.success) { | ||
89 | + proxy.$global.showMsg("收藏成功!") | ||
90 | + } | ||
91 | + }); | ||
92 | + | ||
93 | + } | ||
94 | + | ||
95 | + | ||
96 | + let openTopoPage = () => { | ||
97 | + if (props.resId == '') { | ||
98 | + proxy.$global.showMsg("资源Id不存在,确认!") | ||
99 | + return; | ||
100 | + } | ||
101 | + | ||
102 | + // 查询topoId | ||
103 | + proxy.$http.get(`/api-web/mxgraph/generateByResId`, {resId: props.resId}, function (res) { | ||
104 | + if (response && response.success) { | ||
105 | + let topoId = response.str; | ||
106 | + proxy.$global.openGraphEditor(topoId) | ||
107 | + } else { | ||
108 | + proxy.$global.showMsg('生成资源拓扑失败!', "error"); | ||
109 | + } | ||
110 | + }); | ||
111 | + } | ||
112 | + | ||
113 | + let openDetail = () => { | ||
114 | + | ||
115 | + } | ||
116 | + | ||
117 | + | ||
118 | + let openCmdbAssets = () => { | ||
119 | + proxy.$global.openCmdbAssets(props.resId); | ||
120 | + } | ||
121 | + | ||
122 | + return { | ||
123 | + dialogFlg, | ||
124 | + showDialog, | ||
125 | + saveStart, | ||
126 | + favIds, | ||
127 | + favData, | ||
128 | + | ||
129 | + openTopoPage, | ||
130 | + openDetail, | ||
131 | + openCmdbAssets | ||
132 | + } | ||
133 | + } | ||
134 | +} |
hg-monitor-web-zj/src/main/resources/static/vue3/src/components/page/res/statusComponents/index.js
0 → 100644
1 | +export default { | ||
2 | + name: 'resConfigIndex', | ||
3 | + template: '', | ||
4 | + components: {}, | ||
5 | + props: { | ||
6 | + | ||
7 | + // 类型 danger success warning | ||
8 | + type: { | ||
9 | + type: String, | ||
10 | + default: 'success' | ||
11 | + }, | ||
12 | + // 文本 | ||
13 | + text: { | ||
14 | + type: String, | ||
15 | + default: '' | ||
16 | + }, | ||
17 | + | ||
18 | + }, | ||
19 | + data() { | ||
20 | + return { | ||
21 | + } | ||
22 | + }, | ||
23 | + setup(props, {attrs, slots, emit}) { | ||
24 | + } | ||
25 | +} |
@@ -5,19 +5,20 @@ | @@ -5,19 +5,20 @@ | ||
5 | <div style="text-align: left;padding-left: 10px;padding-top: 3px;font-weight: bold"> | 5 | <div style="text-align: left;padding-left: 10px;padding-top: 3px;font-weight: bold"> |
6 | <el-link type="info" :underline="false"><i class="iconfont icon-liebiao"></i> 资源类型</el-link> | 6 | <el-link type="info" :underline="false"><i class="iconfont icon-liebiao"></i> 资源类型</el-link> |
7 | </div> | 7 | </div> |
8 | - <el-tree :data="treeData" :props="props" > | 8 | + <el-tree :data="treeData" :props="props" @node-click="handleConfigNodeClick"> |
9 | <template #default="{ node, data }"> | 9 | <template #default="{ node, data }"> |
10 | - <div style="position: relative;flex-direction: row;width: 100%;"> | 10 | + <!--<div style="display: flex;flex-direction: row;width: 100%;"> |
11 | <div style="width: calc(100% - 60px);max-width: calc(100% - 60px);overflow: hidden;text-overflow: ellipsis;text-align: left;" | 11 | <div style="width: calc(100% - 60px);max-width: calc(100% - 60px);overflow: hidden;text-overflow: ellipsis;text-align: left;" |
12 | @click="handleConfigNodeClick(data)" :title="node.label"> | 12 | @click="handleConfigNodeClick(data)" :title="node.label"> |
13 | {{node.label }} | 13 | {{node.label }} |
14 | </div> | 14 | </div> |
15 | - <div style="width: 60px;float: right"> | 15 | + <div style="width: 60px;"> |
16 | <a @click="editType(data)" style="margin-right: 10px;"> | 16 | <a @click="editType(data)" style="margin-right: 10px;"> |
17 | <i class="el-icon-setting"></i> | 17 | <i class="el-icon-setting"></i> |
18 | </a> | 18 | </a> |
19 | </div> | 19 | </div> |
20 | - </div> | 20 | + </div>--> |
21 | + {{node.label }} | ||
21 | </template> | 22 | </template> |
22 | </el-tree> | 23 | </el-tree> |
23 | </div> | 24 | </div> |
@@ -39,6 +40,10 @@ | @@ -39,6 +40,10 @@ | ||
39 | </template> | 40 | </template> |
40 | </el-dropdown> | 41 | </el-dropdown> |
41 | <el-button type="primary" @click="saveConfig" style="margin-left: 10px">保存</el-button> | 42 | <el-button type="primary" @click="saveConfig" style="margin-left: 10px">保存</el-button> |
43 | + | ||
44 | + <el-button type="primary" @click="showTreeNodeDialog(true)" style="margin-left: 10px"> | ||
45 | + <i class="el-icon-setting"></i> | ||
46 | + </el-button> | ||
42 | </div> | 47 | </div> |
43 | 48 | ||
44 | <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true" | 49 | <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true" |
@@ -61,6 +66,21 @@ | @@ -61,6 +66,21 @@ | ||
61 | <el-option label="否" :value="1"></el-option> | 66 | <el-option label="否" :value="1"></el-option> |
62 | </el-select> | 67 | </el-select> |
63 | </div> | 68 | </div> |
69 | + | ||
70 | + <div v-else-if="prop == 'colComponents'"> | ||
71 | + <!-- 展示下拉选项 --> | ||
72 | + <el-select placeholder="请选择" size="small" style="width: 100%" | ||
73 | + @change="changeProperty(row,prop,column)" v-model="row.colComponents" | ||
74 | + :multiple="false" | ||
75 | + collapse-tags clearable filterable placeholder="请选择"> | ||
76 | + <el-option label="无" :value="''"></el-option> | ||
77 | + <el-option label="资源名称" :value="'resNameComponents'"></el-option> | ||
78 | + <el-option label="状态组件" :value="'statusComponents'"></el-option> | ||
79 | + <el-option label="使用率组件" :value="'rateComponents'"></el-option> | ||
80 | + </el-select> | ||
81 | + </div> | ||
82 | + | ||
83 | + | ||
64 | <div v-else-if="['colType'].indexOf(prop) != -1"> | 84 | <div v-else-if="['colType'].indexOf(prop) != -1"> |
65 | <el-select placeholder="选择类型" size="small" style="width: 100%" | 85 | <el-select placeholder="选择类型" size="small" style="width: 100%" |
66 | @change="getColType(row)" v-model="row.colType" :multiple="false" | 86 | @change="getColType(row)" v-model="row.colType" :multiple="false" |
@@ -71,25 +91,27 @@ | @@ -71,25 +91,27 @@ | ||
71 | </el-option> | 91 | </el-option> |
72 | </el-select> | 92 | </el-select> |
73 | </div> | 93 | </div> |
74 | - <div v-else-if="['colTypeQueryFields'].indexOf(prop) != -1"> | ||
75 | - <span v-if="Object.keys(fieldsObj).length == 0 || fieldsObj.propertyType == 'INPUT' || row.colType == 'INPUT'"> - </span> | 94 | + <div v-else-if="['colTypeExtend'].indexOf(prop) != -1"> |
95 | + <span v-if="row.colType == '' || row.colType == null || row.colType == 'INPUT'"> - </span> | ||
76 | 96 | ||
77 | - <el-select v-else-if="fieldsObj.propertyType == 'LIST'" placeholder="请选择扩展属性" | 97 | + <el-select v-else-if="fieldsObj[row.colType] && fieldsObj[row.colType].propertyType == 'LIST'" placeholder="请选择扩展属性" |
78 | size="small" style="width: 100%" | 98 | size="small" style="width: 100%" |
79 | - @change="getColTypeExtVal(row)" v-model="row.colTypeQueryFields" | 99 | + v-model="row.colTypeExtend" |
80 | :multiple="false" | 100 | :multiple="false" |
81 | collapse-tags clearable filterable placeholder="请选择"> | 101 | collapse-tags clearable filterable placeholder="请选择"> |
82 | - <el-option v-for="(value,key) in fieldsObj.object" :key="index" | ||
83 | - :label="value[fieldsObj.text]" | ||
84 | - :value="value[fieldsObj.value]"> | 102 | + <el-option v-for="(value,key) in fieldsObj[row.colType].object" :key="index" |
103 | + :label="value[fieldsObj[row.colType].text]" | ||
104 | + :value="value[fieldsObj[row.colType].value]"> | ||
85 | </el-option> | 105 | </el-option> |
86 | </el-select> | 106 | </el-select> |
87 | </div> | 107 | </div> |
88 | 108 | ||
89 | - <div v-else-if="prop == 'colTypeVal'"> | ||
90 | - <span v-if="fieldsValueObj == undefined || fieldsValueObj[row.id] == undefined || Object.keys(fieldsValueObj) == 0"> - </span> | ||
91 | - <el-button v-else icon="el-icon-setting" @click="showSettingCmDialog(true,row)" size="mini" | ||
92 | - style="margin-left: 10px"></el-button> | 109 | + <div v-else-if="prop == 'colTypeExtendProps'"> |
110 | + | ||
111 | + <span v-if="row.colType == '' || row.colType == null || row.colType == 'INPUT'"> - </span> | ||
112 | + | ||
113 | + <el-button v-else @click="showSettingCmDialog(true,row)" size="mini" | ||
114 | + style="margin-left: 10px"> <i class="el-icon-setting"></i></el-button> | ||
93 | </div> | 115 | </div> |
94 | 116 | ||
95 | <div v-else> | 117 | <div v-else> |
@@ -109,7 +131,7 @@ | @@ -109,7 +131,7 @@ | ||
109 | <template #tools> | 131 | <template #tools> |
110 | <el-table-column fixed="right" label="操作" width="80" align="center"> | 132 | <el-table-column fixed="right" label="操作" width="80" align="center"> |
111 | <template #default="scope"> | 133 | <template #default="scope"> |
112 | - <el-button type="text" size="small" @click.prevent="deleteRow(scope.$index)"> | 134 | + <el-button type="text" size="small" @click.prevent="deleteRow(row,scope.$index)"> |
113 | <i class="el-icon-delete"/> | 135 | <i class="el-icon-delete"/> |
114 | </el-button> | 136 | </el-button> |
115 | </template> | 137 | </template> |
@@ -136,4 +158,31 @@ | @@ -136,4 +158,31 @@ | ||
136 | </div> | 158 | </div> |
137 | </template> | 159 | </template> |
138 | </cm-dialog> | 160 | </cm-dialog> |
161 | + | ||
162 | + <cm-dialog :title="`${currentNode.label}类型属性配置`" width="500px" :showDialogVisible="treeNodeDialogFlg" @hidedialog="showTreeNodeDialog" @okfunc="saveTreeNodeConfig"> | ||
163 | + <template v-slot> | ||
164 | + <el-form | ||
165 | + label-width="120px" | ||
166 | + ref="ruleForm" | ||
167 | + :model="treeNodeForm" | ||
168 | + :rules="treeNodeFormRules" | ||
169 | + label-position="right" | ||
170 | + label-width="120px"> | ||
171 | + | ||
172 | + <el-form-item label="配置信息" prop="name"> | ||
173 | + <el-input :size="$global.elementSize" v-model="treeNodeForm.options" clearable ></el-input> | ||
174 | + </el-form-item> | ||
175 | + | ||
176 | + <el-form-item label="详情页配置函数" prop="type"> | ||
177 | + <el-input :size="$global.elementSize" v-model="treeNodeForm.detailFunc" type="textarea" clearable></el-input> | ||
178 | + </el-form-item> | ||
179 | + | ||
180 | + | ||
181 | + <el-form-item label="查询视图" prop="sort"> | ||
182 | + <el-input :size="$global.elementSize" v-model="treeNodeForm.veiwName" clearable readonly></el-input> | ||
183 | + </el-form-item> | ||
184 | + | ||
185 | + </el-form> | ||
186 | + </template> | ||
187 | + </cm-dialog> | ||
139 | </div> | 188 | </div> |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * 配置页面编辑属性 | 2 | * 配置页面编辑属性 |
3 | * @returns {{editColProps: {}}} | 3 | * @returns {{editColProps: {}}} |
4 | */ | 4 | */ |
5 | -let configPageEdit = () => { | 5 | +let configPageEdit = (columns, currentNode) => { |
6 | const {proxy} = Vue.getCurrentInstance(); | 6 | const {proxy} = Vue.getCurrentInstance(); |
7 | // 编辑属性 | 7 | // 编辑属性 |
8 | let editColProps = Vue.ref({}); | 8 | let editColProps = Vue.ref({}); |
@@ -33,13 +33,24 @@ let configPageEdit = () => { | @@ -33,13 +33,24 @@ let configPageEdit = () => { | ||
33 | * 时间:2021/10/27 14:34 | 33 | * 时间:2021/10/27 14:34 |
34 | */ | 34 | */ |
35 | let getColType = (row) => { | 35 | let getColType = (row) => { |
36 | - | ||
37 | // 获取属性标识的配置 | 36 | // 获取属性标识的配置 |
38 | let code = row.colType; | 37 | let code = row.colType; |
39 | - proxy.$http.get(`/api-web/v32/res/list/detail/col/${code}`, {}, function (res) { | ||
40 | - if (res && res.object) { | ||
41 | - fieldsObj.value = res.object; | ||
42 | - row.colTypeQueryFields = ''; | 38 | + |
39 | + if (fieldsObj.value[code] && Object.keys(fieldsObj.value[code]).length > 0) { | ||
40 | + row.colTypeExtend = ''; | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + let params = { | ||
45 | + resTypeId: currentNode.value.id, | ||
46 | + colType: row.colType, | ||
47 | + colTypeExtendProps: row.colTypeExtendProps, | ||
48 | + colTypeExtend: row.colTypeExtend | ||
49 | + } | ||
50 | + | ||
51 | + proxy.$http.get(`/api-web/v32/res/config/detail/colTypes`, params, function (res) { | ||
52 | + if (res && res.map) { | ||
53 | + fieldsObj.value = res.map; | ||
43 | } | 54 | } |
44 | }); | 55 | }); |
45 | } | 56 | } |
@@ -50,30 +61,55 @@ let configPageEdit = () => { | @@ -50,30 +61,55 @@ let configPageEdit = () => { | ||
50 | * 作者: Wang | 61 | * 作者: Wang |
51 | * 时间:2021/10/27 14:34 | 62 | * 时间:2021/10/27 14:34 |
52 | */ | 63 | */ |
53 | - let getColTypeExtVal = (row) => { | 64 | + let getColTypeExtVal = (flg, row) => { |
65 | + let colTypeExtend = row.colTypeExtend; | ||
66 | + let rowProps = row.colTypeExtendProps; | ||
67 | + if(!colTypeExtend || colTypeExtend == '' || colTypeExtend == null){ | ||
68 | + proxy.$global.showMsg("请选择关联扩展属性!", "warning") | ||
69 | + return; | ||
70 | + } | ||
71 | + | ||
72 | + if(fieldsValueObj.value[row.id] && Object.keys(fieldsValueObj.value[row.id]).length >0){ | ||
73 | + return; | ||
74 | + } | ||
54 | // 获取属性标识的配置 | 75 | // 获取属性标识的配置 |
55 | let params = { | 76 | let params = { |
77 | + resTypeId: currentNode.value.id, | ||
56 | colType: row.colType, | 78 | colType: row.colType, |
57 | - colTypeQueryFields: row.colTypeQueryFields | 79 | + colTypeExtendProps: rowProps, |
80 | + colTypeExtend: colTypeExtend | ||
58 | } | 81 | } |
59 | - proxy.$http.get(`/api-web/v32/res/list/detail/setting`, params, function (res) { | 82 | + proxy.$http.get(`/api-web/v32/res/config/detail/setting`, params, function (res) { |
60 | if (res && res.object) { | 83 | if (res && res.object) { |
61 | fieldsValueObj.value[row.id] = res.object; | 84 | fieldsValueObj.value[row.id] = res.object; |
62 | - settingVal.value[row.id] = {}; | 85 | + |
86 | + let defVal = JSON.parse(rowProps); | ||
87 | + if(defVal){ | ||
88 | + settingVal.value[row.id] = defVal; | ||
89 | + } else { | ||
90 | + settingVal.value[row.id] = {}; | ||
91 | + } | ||
92 | + settingCmDialogFlg.value = flg; | ||
93 | + } else { | ||
94 | + proxy.$global.showMsg("该属性无需配置!", "warning") | ||
63 | } | 95 | } |
64 | }); | 96 | }); |
65 | 97 | ||
66 | } | 98 | } |
67 | 99 | ||
68 | let showSettingCmDialog = (flg, row) => { | 100 | let showSettingCmDialog = (flg, row) => { |
69 | - settingCmDialogFlg.value = flg; | 101 | + |
70 | if (flg == true && row) { | 102 | if (flg == true && row) { |
71 | currentRow.value = row; | 103 | currentRow.value = row; |
72 | - // 记载已配置的属性 | ||
73 | - if(row.setting && row.setting[row.id]){ | 104 | + // 加载已配置的属性 |
105 | + if (row.setting && row.setting[row.id]) { | ||
74 | settingVal.value[row.id] = row.setting[row.id] | 106 | settingVal.value[row.id] = row.setting[row.id] |
107 | + } else { | ||
108 | + getColTypeExtVal(flg, row); | ||
109 | + return; | ||
75 | } | 110 | } |
76 | } | 111 | } |
112 | + settingCmDialogFlg.value = flg; | ||
77 | } | 113 | } |
78 | 114 | ||
79 | let getSettingDetail = () => { | 115 | let getSettingDetail = () => { |
@@ -98,12 +134,76 @@ let configPageEdit = () => { | @@ -98,12 +134,76 @@ let configPageEdit = () => { | ||
98 | } | 134 | } |
99 | } | 135 | } |
100 | 136 | ||
137 | +/** | ||
138 | + * 展示配置属性 | ||
139 | + * <p> | ||
140 | + * 作者: Wang | ||
141 | + * 时间:2021/11/8 16:30 | ||
142 | + */ | ||
143 | +const treeNodeConfig = (currentNode) => { | ||
144 | + | ||
145 | + const {proxy} = Vue.getCurrentInstance(); | ||
146 | + | ||
147 | + let treeNodeDialogFlg = Vue.ref(false); | ||
148 | + let treeNodeForm = Vue.ref({ | ||
149 | + options: '', | ||
150 | + detailFunc: '', | ||
151 | + veiwName: '' | ||
152 | + }); | ||
153 | + | ||
154 | + let treeNodeFormRules = Vue.ref({}); | ||
155 | + | ||
156 | + /** | ||
157 | + * 展示树节点配置 | ||
158 | + * <p> | ||
159 | + * 作者: Wang | ||
160 | + * 时间:2021/11/8 16:33 | ||
161 | + */ | ||
162 | + let showTreeNodeDialog = (flg) => { | ||
163 | + if (flg && flg == true && currentNode.value.map) { | ||
164 | + treeNodeForm.value = { | ||
165 | + id: currentNode.value.id, | ||
166 | + options: currentNode.value.map.options, | ||
167 | + detailFunc: currentNode.value.map.detailFunc, | ||
168 | + veiwName: currentNode.value.map.veiwName | ||
169 | + } | ||
170 | + } | ||
171 | + treeNodeDialogFlg.value = flg; | ||
172 | + } | ||
173 | + | ||
174 | + | ||
175 | + /** | ||
176 | + * 保存树节点配置 | ||
177 | + */ | ||
178 | + let saveTreeNodeConfig = () => { | ||
179 | + proxy.$http.get(`/api-web/v32/res/config/saveTreeConfig`, treeNodeForm.value, function (res) { | ||
180 | + if (res && res.success) { | ||
181 | + proxy.$global.showMsg("保存成功!") | ||
182 | + } | ||
183 | + }); | ||
184 | + } | ||
185 | + | ||
186 | + return { | ||
187 | + treeNodeDialogFlg, | ||
188 | + showTreeNodeDialog, | ||
189 | + saveTreeNodeConfig, | ||
190 | + treeNodeForm, | ||
191 | + treeNodeFormRules | ||
192 | + } | ||
193 | +} | ||
194 | + | ||
101 | export default { | 195 | export default { |
102 | name: 'resConfigIndex', | 196 | name: 'resConfigIndex', |
103 | template: '', | 197 | template: '', |
104 | components: { | 198 | components: { |
105 | - 'property-edit': Vue.defineAsyncComponent( | ||
106 | - () => myImport('components/page/assets/propertyedit/index') | 199 | + 'rateComponents': Vue.defineAsyncComponent( |
200 | + () => myImport('components/page/res/rateComponents/index') | ||
201 | + ), | ||
202 | + 'resNameComponents': Vue.defineAsyncComponent( | ||
203 | + () => myImport('components/page/res/resNameComponents/index') | ||
204 | + ), | ||
205 | + 'statusComponents': Vue.defineAsyncComponent( | ||
206 | + () => myImport('components/page/res/statusComponents/index') | ||
107 | ), | 207 | ), |
108 | }, | 208 | }, |
109 | data() { | 209 | data() { |
@@ -114,7 +214,7 @@ export default { | @@ -114,7 +214,7 @@ export default { | ||
114 | } | 214 | } |
115 | } | 215 | } |
116 | }, | 216 | }, |
117 | - setup() { | 217 | + setup(props, {attrs, slots, emit}) { |
118 | const {proxy} = Vue.getCurrentInstance(); | 218 | const {proxy} = Vue.getCurrentInstance(); |
119 | let height = Vue.ref((window.innerHeight - 10) * 0.8); | 219 | let height = Vue.ref((window.innerHeight - 10) * 0.8); |
120 | let currentNode = Vue.ref({}); | 220 | let currentNode = Vue.ref({}); |
@@ -139,7 +239,16 @@ export default { | @@ -139,7 +239,16 @@ export default { | ||
139 | getSettingDetail, | 239 | getSettingDetail, |
140 | currentRow, | 240 | currentRow, |
141 | settingVal | 241 | settingVal |
142 | - } = configPageEdit() | 242 | + } = configPageEdit(columns, currentNode) |
243 | + | ||
244 | + | ||
245 | + const { | ||
246 | + treeNodeDialogFlg, | ||
247 | + showTreeNodeDialog, | ||
248 | + saveTreeNodeConfig, | ||
249 | + treeNodeForm, | ||
250 | + treeNodeFormRules | ||
251 | + } = treeNodeConfig(currentNode); | ||
143 | 252 | ||
144 | 253 | ||
145 | // 获取左侧树结构 | 254 | // 获取左侧树结构 |
@@ -147,11 +256,11 @@ export default { | @@ -147,11 +256,11 @@ export default { | ||
147 | proxy.$http.get("/api-web/v32/res/list/config/tree", {}, function (res) { | 256 | proxy.$http.get("/api-web/v32/res/list/config/tree", {}, function (res) { |
148 | if (res && res.data) { | 257 | if (res && res.data) { |
149 | let arr = []; | 258 | let arr = []; |
150 | - res.data.forEach(function (v){ | 259 | + res.data.forEach(function (v) { |
151 | arr.push({ | 260 | arr.push({ |
152 | - id:v.id, | ||
153 | - label:v.label, | ||
154 | - children:v.children | 261 | + id: v.id, |
262 | + label: v.label, | ||
263 | + children: v.children | ||
155 | }); | 264 | }); |
156 | }) | 265 | }) |
157 | 266 | ||
@@ -171,7 +280,7 @@ export default { | @@ -171,7 +280,7 @@ export default { | ||
171 | treeNodeId: currentNode.value.id, | 280 | treeNodeId: currentNode.value.id, |
172 | loadDefault: defList.value.length == 0 ? 1 : 0 | 281 | loadDefault: defList.value.length == 0 ? 1 : 0 |
173 | } | 282 | } |
174 | - proxy.$http.get(`/api-web/v32/res/list/config`, params, function (res) { | 283 | + proxy.$http.get(`/api-web/v32/res/config/list`, params, function (res) { |
175 | if (res && res.object) { | 284 | if (res && res.object) { |
176 | columns.value = res.object.columns; | 285 | columns.value = res.object.columns; |
177 | dataList.value = res.object.datas; | 286 | dataList.value = res.object.datas; |
@@ -179,6 +288,10 @@ export default { | @@ -179,6 +288,10 @@ export default { | ||
179 | let arr = res.object.defaultList; | 288 | let arr = res.object.defaultList; |
180 | if (arr && arr.length > 0) { | 289 | if (arr && arr.length > 0) { |
181 | defList.value = arr; | 290 | defList.value = arr; |
291 | + | ||
292 | + // 加载一个数据的类型 | ||
293 | + getColType(arr[0]); | ||
294 | + | ||
182 | } | 295 | } |
183 | } | 296 | } |
184 | }); | 297 | }); |
@@ -191,8 +304,22 @@ export default { | @@ -191,8 +304,22 @@ export default { | ||
191 | * 作者: Wang | 304 | * 作者: Wang |
192 | * 时间:2021/10/28 17:55 | 305 | * 时间:2021/10/28 17:55 |
193 | */ | 306 | */ |
307 | + let clickIndex = 0; | ||
194 | let handleConfigNodeClick = (data) => { | 308 | let handleConfigNodeClick = (data) => { |
195 | if (data) { | 309 | if (data) { |
310 | + | ||
311 | + let isExistArr = dataList.value.filter(function (v) { | ||
312 | + if (v.isAdd && v.isAdd == 1) { | ||
313 | + return v; | ||
314 | + } | ||
315 | + }) | ||
316 | + if (isExistArr.length > 0) { | ||
317 | + proxy.$global.confirm("有已添未保存的配置数据,是否清空?", function () { | ||
318 | + currentNode.value = data; | ||
319 | + getConfigData(); | ||
320 | + }) | ||
321 | + return; | ||
322 | + } | ||
196 | currentNode.value = data; | 323 | currentNode.value = data; |
197 | getConfigData(); | 324 | getConfigData(); |
198 | } | 325 | } |
@@ -218,6 +345,9 @@ export default { | @@ -218,6 +345,9 @@ export default { | ||
218 | data['isQuery'] = 1; | 345 | data['isQuery'] = 1; |
219 | data['colIsTd'] = 1; | 346 | data['colIsTd'] = 1; |
220 | data['status'] = 0; | 347 | data['status'] = 0; |
348 | + data['resListId'] = currentNode.value.id; | ||
349 | + // 排序 | ||
350 | + data['colSort'] = 100; | ||
221 | // 新增状态 | 351 | // 新增状态 |
222 | data['isAdd'] = 1; | 352 | data['isAdd'] = 1; |
223 | 353 | ||
@@ -236,11 +366,56 @@ export default { | @@ -236,11 +366,56 @@ export default { | ||
236 | return; | 366 | return; |
237 | } | 367 | } |
238 | // 添加 | 368 | // 添加 |
239 | - dataList.value.splice(0, 0, item); | 369 | + let newData = {...item}; |
370 | + newData['resListId'] = currentNode.value.id; | ||
371 | + dataList.value.splice(0, 0, newData); | ||
240 | } | 372 | } |
241 | // 保存 | 373 | // 保存 |
242 | let saveConfig = () => { | 374 | let saveConfig = () => { |
243 | - console.log(dataList.value) | 375 | + |
376 | + let arr = dataList.value; | ||
377 | + if (arr.length == 0) { | ||
378 | + proxy.$global.showMsg("请添加配置项!", 'warning'); | ||
379 | + return; | ||
380 | + } | ||
381 | + | ||
382 | + let msg = ""; | ||
383 | + arr.filter(function (v, i) { | ||
384 | + if (v.colAlias == '' || v.colKey == '') { | ||
385 | + msg += `请填写第${(i + 1)}行的属性名称或者标识!` | ||
386 | + } else if (v.colWidth == '' || v.colWidth == null || v.colWidth < 0) { | ||
387 | + msg += `第${(i + 1)}行的列宽不能为空或者小于0!` | ||
388 | + } else if (v.colWidth == '' || v.colSort == null || v.colSort < 0) { | ||
389 | + msg += `请填写第${(i + 1)}行的排序不能为空或者小于0!` | ||
390 | + } | ||
391 | + }) | ||
392 | + | ||
393 | + if (msg != '') { | ||
394 | + proxy.$global.showMsg(msg, 'warning'); | ||
395 | + return; | ||
396 | + } | ||
397 | + | ||
398 | + // 保存时,将v['setting']转换为string | ||
399 | + arr.forEach(function (v) { | ||
400 | + v['setting'] = JSON.stringify(v['setting']); | ||
401 | + }) | ||
402 | + | ||
403 | + /** | ||
404 | + * 保存配置 | ||
405 | + * <p> | ||
406 | + * 作者: Wang | ||
407 | + * 时间:2021/11/9 15:19 | ||
408 | + */ | ||
409 | + proxy.$http.post(`/api-web/v32/res/config/saveResTypeConfig/${currentNode.value.id}`, arr, function (res) { | ||
410 | + if (res && res.success) { | ||
411 | + proxy.$global.showMsg("保存成功!"); | ||
412 | + | ||
413 | + // 刷新当前列表数据 | ||
414 | + getConfigData(); | ||
415 | + } else { | ||
416 | + proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "保存成功!", "error"); | ||
417 | + } | ||
418 | + }); | ||
244 | } | 419 | } |
245 | 420 | ||
246 | /** | 421 | /** |
@@ -249,11 +424,22 @@ export default { | @@ -249,11 +424,22 @@ export default { | ||
249 | * 作者: Wang | 424 | * 作者: Wang |
250 | * 时间:2021/10/26 19:47 | 425 | * 时间:2021/10/26 19:47 |
251 | */ | 426 | */ |
252 | - let deleteRow = (index) => { | ||
253 | - proxy.$global.confirm("确认删除该行配置吗?", function () { | ||
254 | - dataList.value.splice(index, 1); | ||
255 | - | ||
256 | - proxy.$global.showMsg("删除成功!") | 427 | + let deleteRow = (row,index) => { |
428 | + proxy.$global.confirm("确认删除该配置项吗?", function () { | ||
429 | + if(row.isAdd && row.isAdd == 1){ | ||
430 | + proxy.$global.showMsg("删除成功!") | ||
431 | + dataList.value.splice(index, 1); | ||
432 | + } else { | ||
433 | + // 删除配置项 | ||
434 | + proxy.$http.post(`/api-web/v32/res/config/deleteResTypeConfig/${row.id}`, {}, function (res) { | ||
435 | + if (res && res.success) { | ||
436 | + proxy.$global.showMsg("删除成功!"); | ||
437 | + dataList.value.splice(index, 1); | ||
438 | + } else { | ||
439 | + proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "删除失败!", "error"); | ||
440 | + } | ||
441 | + }); | ||
442 | + } | ||
257 | }) | 443 | }) |
258 | } | 444 | } |
259 | 445 | ||
@@ -286,7 +472,14 @@ export default { | @@ -286,7 +472,14 @@ export default { | ||
286 | showSettingCmDialog, | 472 | showSettingCmDialog, |
287 | getSettingDetail, | 473 | getSettingDetail, |
288 | currentRow, | 474 | currentRow, |
289 | - settingVal | 475 | + settingVal, |
476 | + | ||
477 | + // 树节点配置 | ||
478 | + treeNodeDialogFlg, | ||
479 | + showTreeNodeDialog, | ||
480 | + saveTreeNodeConfig, | ||
481 | + treeNodeForm, | ||
482 | + treeNodeFormRules | ||
290 | } | 483 | } |
291 | } | 484 | } |
292 | } | 485 | } |
@@ -32,8 +32,8 @@ | @@ -32,8 +32,8 @@ | ||
32 | :showBorder="true" :currentPage="currentPage" :total="total" :loading="false" | 32 | :showBorder="true" :currentPage="currentPage" :total="total" :loading="false" |
33 | :showPage="true" :height="(height - 95)"> | 33 | :showPage="true" :height="(height - 95)"> |
34 | <template #default="{row,prop,column}"> | 34 | <template #default="{row,prop,column}"> |
35 | - <a href="javascript:void(0)" v-if="prop == 'resPositon' || prop == 'cabinetNo'" style="border-bottom: solid 1px blue;margin-bottom: 3px;height: 30px;font-size: 15px;" @click="cellClick(row,prop,column)">{{row[prop]}}</a> | ||
36 | - <el-link v-else :underline="false" @click="item.click(scope.row)">{{row[prop]}}</el-link> | 35 | + <a href="javascript:void(0)" v-if="prop == 'resPositon' || prop == 'cabinetNo'" style="border-bottom: solid 1px blue;margin-bottom: 3px;height: 30px;font-size: 15px;" @click="cellClick(row,prop,column)">{{row[prop].value}}</a> |
36 | + <el-link v-else :underline="false" @click="item.click(scope.row)">{{row[prop].value}}</el-link> | ||
37 | </template> | 37 | </template> |
38 | </cm-table-page> | 38 | </cm-table-page> |
39 | </div> | 39 | </div> |
@@ -11,8 +11,6 @@ const configPage = () => { | @@ -11,8 +11,6 @@ const configPage = () => { | ||
11 | dialogFlg.value = flg; | 11 | dialogFlg.value = flg; |
12 | } | 12 | } |
13 | 13 | ||
14 | - | ||
15 | - | ||
16 | return { | 14 | return { |
17 | showConfig: dialogFlg, | 15 | showConfig: dialogFlg, |
18 | configObj:configPage, | 16 | configObj:configPage, |
@@ -20,7 +18,6 @@ const configPage = () => { | @@ -20,7 +18,6 @@ const configPage = () => { | ||
20 | } | 18 | } |
21 | } | 19 | } |
22 | 20 | ||
23 | - | ||
24 | export default { | 21 | export default { |
25 | name: 'resIndex', | 22 | name: 'resIndex', |
26 | template: '', | 23 | template: '', |
@@ -28,6 +25,15 @@ export default { | @@ -28,6 +25,15 @@ export default { | ||
28 | 'res-config': Vue.defineAsyncComponent( | 25 | 'res-config': Vue.defineAsyncComponent( |
29 | () => myImport('components/page/res/treeconfig/index') | 26 | () => myImport('components/page/res/treeconfig/index') |
30 | ), | 27 | ), |
28 | + 'rateComponents': Vue.defineAsyncComponent( | ||
29 | + () => myImport('components/page/res/rateComponents/index') | ||
30 | + ), | ||
31 | + 'resNameComponents': Vue.defineAsyncComponent( | ||
32 | + () => myImport('components/page/res/resNameComponents/index') | ||
33 | + ), | ||
34 | + 'statusComponents': Vue.defineAsyncComponent( | ||
35 | + () => myImport('components/page/res/statusComponents/index') | ||
36 | + ), | ||
31 | }, | 37 | }, |
32 | data() { | 38 | data() { |
33 | return { | 39 | return { |
-
Please register or login to post a comment