Authored by 王涛

增加故障诊断书路由

  1 +<title>故障诊断书</title>
  2 +<iframe src="/vue3/index.html#/fault/index" class="layadmin-iframe" style="height: 99.5%!important;"/>
@@ -119,6 +119,11 @@ const routes = [{ @@ -119,6 +119,11 @@ const routes = [{
119 path: '/analysis/view', 119 path: '/analysis/view',
120 name: 'view', 120 name: 'view',
121 component: () => myImport('views/analysis/view/index') 121 component: () => myImport('views/analysis/view/index')
  122 + },
  123 + {
  124 + path: '/fault/index',
  125 + name: 'view',
  126 + component: () => myImport('views/faultDiagnosis/index')
122 } 127 }
123 ]; 128 ];
124 129
1 -<div class="analysis-add-container">  
2 - <el-row>  
3 - <div class="add-top">  
4 - <el-row>  
5 - <el-col :span="16" class="add-top-title">  
6 - <el-input v-model="input" placeholder="请输入场景名称" />  
7 - </el-col>  
8 - <el-col :span="8" class="add-top-select">  
9 - <el-dropdown>  
10 - <el-button type="primary">  
11 - 时间范围  
12 - <el-icon class="el-icon--right">  
13 - <arrow-down/>  
14 - </el-icon>  
15 - </el-button>  
16 - <template #dropdown>  
17 - <el-dropdown-menu slot = "dropdown">  
18 - <el-date-picker v-model="displayTime" type="datetime" format="yyyy-MM-dd HH:mm:ss"  
19 - placeholder="请选择时间"/>  
20 - </el-dropdown-menu>  
21 - </template>  
22 - </el-dropdown>  
23 - <el-dropdown @command="handleCommand">  
24 - <el-button type="primary">  
25 - 契合频率  
26 - <el-icon class="el-icon--right">  
27 - <arrow-down/>  
28 - </el-icon>  
29 - </el-button>  
30 - <template #dropdown>  
31 - <el-dropdown-menu >  
32 - <el-dropdown-item v-for="item in frequencyArr"  
33 - :key = "item.ddicId"  
34 - :command="{value:item.ddicId,label:item.ddicName,flag:1}">{{item.ddicName}}</el-dropdown-item>  
35 - </el-dropdown-menu>  
36 - </template>  
37 - </el-dropdown>  
38 - <el-button type="primary">保存</el-button>  
39 - </el-col>  
40 - </el-row>  
41 - <el-row>  
42 - <el-col :span="24">  
43 - <div class="classLine" id="responsemonitor_ref">  
44 - <LineChart :optionData="optionData" v-if="optionData" ref="responseLine"></LineChart>  
45 - </div>  
46 - </el-col>  
47 - </el-row>  
48 - </div>  
49 - </el-row>  
50 - <el-row>  
51 - <div class="add-bottom">  
52 - <el-row>  
53 - <el-col :span="6" class="bottom-condition">  
54 - <el-row class="condition-row">  
55 - <el-col :span="24">  
56 - <i class="icon-condition"></i>  
57 - <span class="condition-title">查询条件</span>  
58 - </el-col>  
59 - </el-row>  
60 - <el-row>  
61 - <el-col :span="24">  
62 - <el-dropdown>  
63 - <el-icon class="el-icon--right">  
64 - <arrow-down/>  
65 - </el-icon>  
66 - <cm-biz-type-tree-input multiple clearable collapseTags @callback="getBizType"/>  
67 - </el-dropdown>  
68 - </el-col>  
69 - </el-row>  
70 - <el-row>  
71 - <el-col :span="24">  
72 - <el-dropdown>  
73 - <el-icon class="el-icon--right">  
74 - <arrow-down/>  
75 - </el-icon>  
76 - <cm-res-type-tree-input multiple clearable collapseTags @callback="getResType"/>  
77 - </el-dropdown>  
78 - </el-col>  
79 - </el-row>  
80 - <el-row>  
81 - <el-col :span="24">  
82 - <el-dropdown>  
83 -  
84 - <el-icon class="el-icon--right">  
85 - <arrow-down/>  
86 - </el-icon>  
87 - <cm-kpi-type-tree-input multiple clearable collapseTags @callback="getKpiType"/>  
88 - </el-dropdown>  
89 - </el-col>  
90 - </el-row>  
91 - <el-row>  
92 - <el-col :span="24">  
93 - <el-input v-model="keyWords" placeholder="输入关键字" style="margin-top: 15px;width: 225px;"/>  
94 - </el-col>  
95 - </el-row>  
96 - <el-row>  
97 - <el-col span="6" class="analysis-bottom-button">  
98 - <el-button type="primary" @click="onReset()">重置</el-button>  
99 -  
100 - </el-col>  
101 - <el-col span="6" class ="analysis-bottom-button">  
102 - <el-button type="primary" @click="onBtnSearch()">查询</el-button>  
103 - </el-col>  
104 - </el-row>  
105 -  
106 - </el-col>  
107 - <el-col :span="18">  
108 - <el-tabs type="border-card">  
109 - <el-tab-pane label="已添加">  
110 - <cm-table-page :columns="columns" :dataList="addedObj" @loaddata="getPage"  
111 - :showIndex="true"  
112 - :showBorder="true" :currentPage="currentPage" :total="addedTotal" :loading="false"  
113 - :showPage="true" :height="(height - 95)" :maxWidth="max">  
114 - <template #tools>  
115 - <el-table-column label="操作" align="center">  
116 - <template #default="scope">  
117 - <el-button type="text" size="mini" @click.prevent="deleteRow(row,scope.$index)">  
118 - <i class="el-icon-delete"/>  
119 - </el-button>  
120 - </template>  
121 - </el-table-column>  
122 - </template>  
123 - </cm-table-page>  
124 - </el-tab-pane>  
125 - <el-tab-pane label="未添加">  
126 - <cm-table-page :columns="columns" :dataList="noaddObj" @loaddata="getPage"  
127 - :showIndex="true"  
128 - :showBorder="true" :currentPage="currentPage" :total="noaddTotal" :loading="false"  
129 - :showPage="true" :height="(height - 95)" :maxWidth="max">  
130 - <template #tools>  
131 - <el-table-column label="操作" align="center">  
132 - <template #default="scope">  
133 - <el-button type="text" size="mini" @click.prevent="handleUpdate(row,scope.$index)">  
134 - <i class="el-icon-folder-add"/>  
135 - </el-button>  
136 - </template>  
137 - </el-table-column>  
138 - </template>  
139 - </cm-table-page>  
140 - </el-tab-pane>  
141 - </el-tabs>  
142 - </el-col>  
143 - </el-row>  
144 - </div>  
145 - </el-row>  
146 - <el-dialog :title="选择追加分类" :visible.sync="dialogFormVisible">  
147 - <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="70px" style="width: 400px; margin-left:50px;">  
148 - <el-form-item label="flag" prop="flag">  
149 - <div style="display:inline-block;">  
150 - <el-radio-group v-model="autoWidth">  
151 - <el-radio :label="true" border>  
152 - 追加场景分类  
153 - </el-radio>  
154 - <el-radio :label="false" border>  
155 - 新增场景分类  
156 - </el-radio>  
157 - </el-radio-group>  
158 - </div>  
159 - </el-form-item>  
160 - <el-form-item label="Status">  
161 - <el-select v-model="temp.status" class="filter-item" placeholder="Please select">  
162 - <el-option v-for="item in statusOptions" :key="item" :label="item" :value="item" />  
163 - </el-select>  
164 - </el-form-item>  
165 - </el-form>  
166 - <div slot="footer" class="dialog-footer">  
167 - <el-button @click="dialogFormVisible = false">  
168 - 取消  
169 - </el-button>  
170 - <el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">  
171 - 确认  
172 - </el-button>  
173 - </div>  
174 - </el-dialog>  
175 -</div>  
1 -export default {  
2 - name: 'addIndex',  
3 - template: '',  
4 - components: {  
5 - 'LineChart': Vue.defineAsyncComponent(  
6 - () => myImport('views/zjdaping/components/lineChart/index')  
7 - )  
8 - },  
9 - data() {  
10 - return {  
11 - commandVal:'max',  
12 - domainName:sessionStorage.getItem('domainName'),  
13 - apiUrl:'/api-web/ContrastAnalysis/getLineData',  
14 - optionData:'',  
15 - titleFontSize:'30',  
16 - allData: '',  
17 - newCommandVal:this.commandVal,  
18 - startValue: 0, // 区域缩放的起点值  
19 - endValue: 6, // 区域缩放的终点值  
20 - timerId: null,// 定时器的标识  
21 - props: {  
22 - label: 'label',  
23 - children: 'children'  
24 - }  
25 - }  
26 - },  
27 - created() {  
28 - this.loadResList();  
29 - this.loadFrequency();  
30 - this.getData()  
31 - },  
32 - props: {  
33 - dialogFormVisible:false,  
34 - height: {  
35 - type: Number,  
36 - default: 0  
37 - },  
38 - pageSize: {  
39 - type: Number,  
40 - default: 10  
41 - },  
42 - },  
43 - setup(props, {attrs, slots, emit}) {  
44 - const {proxy} = Vue.getCurrentInstance();  
45 - // 分页信息  
46 - const pageInfo = Vue.reactive({  
47 - total: 0,  
48 - limit: 50,  
49 - page: 1,  
50 - keyWords: ''  
51 -  
52 - })  
53 - let temp ={  
54 - }  
55 - let dialogFormVisible= false  
56 - let dialogStatus= ''  
57 - let textMap ={  
58 - update: '追加场景',  
59 - create: 'Create'  
60 - }  
61 - let columns = Vue.ref([  
62 - {  
63 - prop: 'busId',  
64 - label: '业务系统',  
65 - sortable: true,  
66 - align: 'right',  
67 - },  
68 - {  
69 - prop: 'resTypeName',  
70 - label: '资源类型',  
71 - sortable: true,  
72 - align: 'right',  
73 - },  
74 - {  
75 - prop: 'resName',  
76 - label: '资源名称',  
77 - sortable: true,  
78 - align: 'right',  
79 - },  
80 - {  
81 - prop: 'ip',  
82 - label: 'ip地址',  
83 - sortable: true,  
84 - align: 'right',  
85 - },  
86 - {  
87 - prop: 'kpiId',  
88 - label: '指标类型',  
89 - sortable: true,  
90 - align: 'right',  
91 - }  
92 -  
93 - ]);  
94 - const allData=Vue.ref({});  
95 - let currentPage = Vue.ref(1);  
96 - let frequencyArr= Vue.ref([]);  
97 - // 表格数据对象  
98 - const addedObj = Vue.ref([]);  
99 - let resTypeArr = Vue.ref([]);  
100 - let busTypeArr = Vue.ref([]);  
101 - let kpiTypeArr = Vue.ref([]);  
102 - // 搜索框内容  
103 - let addedTotal = Vue.ref(0);  
104 - // 表格数据对象  
105 - const noaddObj = Vue.ref([]);  
106 -  
107 - let noaddTotal = Vue.ref(0);  
108 - // 计算减去左侧树的宽度  
109 - let max = (function () {  
110 - let right = window.innerWidth;  
111 - let treeWidth = (right / 24) * 4;  
112 - return right - treeWidth;  
113 - })();  
114 - let loadFrequency = ()=> {  
115 - let param = {  
116 - ddicName:'Day'  
117 - }  
118 - proxy.$http.get(`/api-web/ContrastAnalysis/selectTogetherRate`, param, function (res) {  
119 - if (res && res.data) {  
120 - frequencyArr = res.data;  
121 - console.log(frequencyArr);  
122 - }  
123 - });  
124 - }  
125 - let loadResList = () => {  
126 - // 查询参数  
127 - let params = {  
128 - page: pageInfo.page,  
129 - limit: pageInfo.limit,  
130 - // keyWords: this.form.keyWords.value,  
131 - resType: resTypeArr.value.join(','),  
132 - kpiType: kpiTypeArr.value.join(','),  
133 - bizType: busTypeArr.value.join(','),  
134 - configId: 64,  
135 - }  
136 - proxy.$http.get(`/api-web/ContrastAnalysis/added`, params, function (res) {  
137 - if (res && res.data) {  
138 - addedObj.value = res.data;  
139 - addedTotal.value = res.count;  
140 - }  
141 - });  
142 - proxy.$http.get(`/api-web/ContrastAnalysis/notAdded`, params, function (res) {  
143 - if (res && res.data) {  
144 - noaddObj.value = res.data;  
145 - noaddTotal.value = res.count;  
146 - }  
147 - });  
148 - }  
149 - let deleteRow = (row,index) => {  
150 - proxy.$global.confirm("确认删除该项吗?", function () {  
151 - if(row.isAdd && row.isAdd == 1){  
152 - proxy.$global.showMsg("删除成功!")  
153 - dataList.value.splice(index, 1);  
154 - } else {  
155 - // 删除配置项  
156 - proxy.$http.post(`/api-web/ContrastAnalysis/delete/${row.id}`, {}, function (res) {  
157 - if (res && res.success) {  
158 - proxy.$global.showMsg("删除成功!");  
159 - dataList.value.splice(index, 1);  
160 - } else {  
161 - proxy.$global.showMsg(res.msg && res.msg != '' ? res.msg : "删除失败!", "error");  
162 - }  
163 - });  
164 - }  
165 - })  
166 - }  
167 - let handleUpdate =(row,index) =>{  
168 - console.log(row);  
169 - console.log(index);  
170 - // this.temp = Object.assign({}, row) // copy obj  
171 - // this.temp.timestamp = new Date(this.temp.timestamp)  
172 - // this.dialogStatus = 'update'  
173 - dialogFormVisible = true  
174 - // this.nextTick(() => {  
175 - // this.$refs['dataForm'].clearValidate()  
176 - // })  
177 - }  
178 - // 点击按钮搜索  
179 - let onBtnSearch = () => {  
180 - pageInfo.page = 1;  
181 - loadResList();  
182 - }  
183 -  
184 - let onReset = () => {  
185 -  
186 - }  
187 - let getResType = (arr) => {  
188 - console.log(arr);  
189 - var types = arr.map(function (v) {  
190 - return v.id;  
191 - });  
192 - resTypeArr.value = types;  
193 - loadResList();  
194 - }  
195 - let getKpiType = (arr) => {  
196 - console.log(arr);  
197 - var types = arr.map(function (v) {e  
198 - return v.kpiId;  
199 - });  
200 - kpiTypeArr.value = types;  
201 - loadResList();  
202 - }  
203 - let getBizType = (arr) => {  
204 - console.log(arr);  
205 - var types = arr.map(function (v) {  
206 - return v.busId;  
207 - });  
208 - busTypeArr.value = types;  
209 - loadResList();  
210 - }  
211 - return {  
212 - allData,  
213 - temp,  
214 - dialogFormVisible,  
215 - dialogStatus,  
216 - textMap,  
217 - loadFrequency,  
218 - frequencyArr,  
219 - loadResList,  
220 - getResType,  
221 - getKpiType,  
222 - onBtnSearch,  
223 - handleUpdate,  
224 - deleteRow,  
225 - currentPage,  
226 - columns,  
227 - addedObj,  
228 - addedTotal,  
229 - noaddObj,  
230 - noaddTotal,  
231 - max  
232 - }  
233 -  
234 - },  
235 - mounted () {  
236 - this.getData()  
237 - window.addEventListener('resize', this.screenAdapter)  
238 - this.screenAdapter()  
239 - },  
240 - unmounted () {  
241 - window.removeEventListener('resize', this.screenAdapter)  
242 - },  
243 - watch:{  
244 - commandVal(newValue, oldValue) {  
245 - this.newCommandVal=newValue  
246 - this.getData()  
247 - }  
248 -  
249 - },  
250 - methods: {  
251 - getData () {  
252 - let that=this;  
253 - console.log(this.domainName)  
254 - console.log(this.apiUrl)  
255 -  
256 - // 查询参数  
257 - let params = {  
258 - access_token: localStorage.getItem('access_token'),  
259 - timeScope: 'Day',  
260 - frequency: 5,  
261 - resource :{  
262 - resId :'i-k5e0597zznlzz1iaa8cc',  
263 - kpiId : 'KPI05227E45',  
264 - kpiFlg : 'base'  
265 - }  
266 -  
267 - }  
268 - that.$http.post(this.domainName +this.apiUrl, params, function (ret) {  
269 - if(ret){  
270 - let dataArr=[];  
271 - let xAxisData='';  
272 - if(ret.map){  
273 - dataArr=ret.map.y  
274 - xAxisData=ret.map.x  
275 - }else{  
276 - for(let i=0;i<12;i++){  
277 - dataArr.push('0')  
278 - }  
279 -  
280 - }  
281 -  
282 - that.allData= {  
283 - polyline: {  
284 - title: '',  
285 - legend : ret.map.legend,  
286 - unit: ret.map.units,  
287 - data: {  
288 - data: dataArr  
289 - }  
290 - },  
291 - xAxis: xAxisData  
292 -  
293 - }  
294 - that.updateChart()  
295 - }  
296 - })  
297 -  
298 - },  
299 - updateChart () {  
300 - console.log("ddd",this.allData)  
301 - // 半透明的颜色值  
302 - const colorArr1 = [  
303 - 'rgba(11, 168, 44, 0.5)',  
304 - 'rgba(44, 110, 255, 0.5)',  
305 - 'rgba(22, 242, 217, 0.5)',  
306 - 'rgba(35, 255, 255, 0.5)',  
307 - 'rgba(254, 33, 30, 0.5)',  
308 - 'rgba(250, 105, 0, 0.5)'  
309 - ]  
310 - // 全透明的颜色值  
311 - const colorArr2 = [  
312 - 'rgba(11, 168, 44, 0)',  
313 - 'rgba(44, 110, 255, 0)',  
314 - 'rgba(22, 242, 217, 0)',  
315 - 'rgba(35, 255, 255, 0)',  
316 - 'rgba(254, 33, 30, 0)',  
317 - 'rgba(250, 105, 0, 0)'  
318 - ]  
319 - const timeArr = this.allData.xAxis  
320 - const seriesData = this.allData.polyline.data  
321 - // 图例的数据  
322 - // const legendArr = this.allData.polyline.data.map(item => {  
323 - // return item.name  
324 - // })  
325 - const legendArr=[];  
326 - legendArr.push(this.allData.polyline.legend);  
327 - const title = this.allData.polyline.title  
328 -  
329 -  
330 - this.optionData = {  
331 - title: {  
332 - text: title,  
333 - left: '10%',  
334 - textStyle: {  
335 - fontSize: this.titleFontSize*0.6,  
336 - color:'#ffffff'  
337 - }  
338 - },  
339 - tooltip: {  
340 - trigger: 'axis',  
341 - backgroundColor:'rgba(50,50,50,0.7)',  
342 - borderColor:"#333",  
343 - textStyle:{  
344 - color:"#fff",  
345 - align:'left'  
346 - }  
347 -  
348 - },  
349 - legend: {  
350 - data: legendArr,  
351 - itemHeight:0,//图例圆圈大小设置  
352 - top:'10%',  
353 - right:'20%',  
354 - textStyle: {  
355 - color: '#ffffff',  
356 - fontsize:"12px"  
357 - }  
358 -  
359 - },  
360 - grid: {  
361 - left: '3%',  
362 - right: '4%',  
363 - bottom: '3%',  
364 - containLabel: true,  
365 - },  
366 - xAxis: {  
367 - type: 'category',  
368 - boundaryGap: false,  
369 - data: timeArr,  
370 -  
371 - axisLine:{  
372 - show:false,//是否显示坐标线  
373 - },  
374 - axisTick: {  
375 - show: false //是否显示坐标刻度  
376 - },  
377 - axisLabel:{  
378 - color:'#ffffff',  
379 - },  
380 -  
381 - },  
382 - yAxis: {  
383 - axisLabel: {  
384 - color:'#ffffff',  
385 - },  
386 - splitLine:{  
387 - lineStyle: {  
388 - color:'#0a1b31'  
389 - }  
390 - },  
391 -  
392 - },  
393 - series: {  
394 - type: 'line',  
395 - data: seriesData,  
396 - smooth: true,  
397 - showSymbol:false,  
398 - color:colorArr1[1],  
399 - areaStyle: {  
400 - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [  
401 - {  
402 - offset: 0,  
403 - color: colorArr1[1]  
404 - }, // %0的颜色值  
405 - {  
406 - offset: 1,  
407 - color: colorArr2[1]  
408 - } // 100%的颜色值  
409 - ])  
410 - }  
411 - },  
412 - itemStyle:{  
413 - showSymbol:false  
414 - }  
415 - };  
416 -  
417 - },  
418 -  
419 - screenAdapter () {  
420 - this.titleFontSize = document.getElementById('responsemonitor_ref').offsetWidth / 100 * 3.6  
421 - const adapterOption = {  
422 - title: {  
423 - textStyle: {  
424 - fontSize: this.titleFontSize / 1.5  
425 - }  
426 - },  
427 - legend: {  
428 - itemWidth: this.titleFontSize,  
429 - itemHeight: this.titleFontSize,  
430 - itemGap: this.titleFontSize,  
431 - textStyle: {  
432 - fontSize: this.titleFontSize / 2  
433 - }  
434 - }  
435 - }  
436 -  
437 - },  
438 -  
439 - }  
440 -}