Merge branch 'master' of http://113.200.75.45:82/monitor_v3/hg-monitor-web into master-v32-xwx
Showing
11 changed files
with
445 additions
and
36 deletions
@@ -136,11 +136,13 @@ layui.define(['laytpl', 'layer'], function(exports){ | @@ -136,11 +136,13 @@ layui.define(['laytpl', 'layer'], function(exports){ | ||
136 | return; | 136 | return; |
137 | } | 137 | } |
138 | if(e.status == '401'){ | 138 | if(e.status == '401'){ |
139 | - layer.msg("登录凭证失效,请重新登录验证!", { | ||
140 | - icon: 7, time: 3000 | ||
141 | - },function () { | ||
142 | - view.exit(); | ||
143 | - }); | 139 | + if(localStorage.getItem('access_token')) { |
140 | + layer.msg("登录凭证失效,请重新登录验证!", { | ||
141 | + icon: 7, time: 3000 | ||
142 | + }, function () { | ||
143 | + view.exit(); | ||
144 | + }); | ||
145 | + } | ||
144 | }else if(e.status == '500'){ | 146 | }else if(e.status == '500'){ |
145 | layer.msg("服务异常,请联系管理员!</br>错误信息:"+e.responseJSON["resp_msg"], { | 147 | layer.msg("服务异常,请联系管理员!</br>错误信息:"+e.responseJSON["resp_msg"], { |
146 | icon: 7, time: 5000 | 148 | icon: 7, time: 5000 |
@@ -254,7 +256,15 @@ layui.define(['laytpl', 'layer'], function(exports){ | @@ -254,7 +256,15 @@ layui.define(['laytpl', 'layer'], function(exports){ | ||
254 | } | 256 | } |
255 | 257 | ||
256 | if(e.status === 404){ | 258 | if(e.status === 404){ |
257 | - that.render('template/tips/404'); | 259 | + if(!localStorage.getItem('access_token')) { |
260 | + layer.msg("登录凭证失效,请重新登录验证!", { | ||
261 | + icon: 7, time: 3000 | ||
262 | + }, function () { | ||
263 | + view.exit() | ||
264 | + }); | ||
265 | + } else { | ||
266 | + that.render('template/tips/404'); | ||
267 | + } | ||
258 | } else { | 268 | } else { |
259 | that.render('template/tips/error'); | 269 | that.render('template/tips/error'); |
260 | } | 270 | } |
@@ -64,3 +64,11 @@ | @@ -64,3 +64,11 @@ | ||
64 | .userright .roles{ | 64 | .userright .roles{ |
65 | border: solid 1px rgb(251, 196, 196); | 65 | border: solid 1px rgb(251, 196, 196); |
66 | } | 66 | } |
67 | +/*时间范围组件*/ | ||
68 | +.drop-active{ | ||
69 | + background-color: #ecf5ff; | ||
70 | + color: #66b1ff; | ||
71 | +} | ||
72 | +.select-div{ | ||
73 | + margin-left: 10px; | ||
74 | +} |
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/dateRange/index.html
0 → 100644
1 | +<el-row class="dataRange-container"> | ||
2 | + <el-col :span="24"> | ||
3 | + <div class="tabs-div date-flex-div-around"> | ||
4 | + <el-col :span="17"> | ||
5 | + <el-date-picker | ||
6 | + class="picker-div" | ||
7 | + v-model="dateValue" | ||
8 | + type="datetimerange" | ||
9 | + range-separator="--" | ||
10 | + start-placeholder="开始时间" | ||
11 | + end-placeholder="结束时间" | ||
12 | + format="YYYY-MM-DD hh:mm:ss" | ||
13 | + value-format="YYYY-MM-DD hh:mm:ss" | ||
14 | + :shortcuts="shortcuts" | ||
15 | + @change="changeDate" | ||
16 | + > | ||
17 | + </el-date-picker> | ||
18 | + </el-col> | ||
19 | + <el-col :span="7" class="select-div"> | ||
20 | + <!-- <el-select v-model="checkedId" class="m-2" placeholder="聚合频率" size="large"> | ||
21 | + <el-option | ||
22 | + v-for="item in frequencyData" | ||
23 | + :key="item.ddicDesc" | ||
24 | + :label="item.ddicName" | ||
25 | + :value="item.ddicDesc" | ||
26 | + @change="changeItem" | ||
27 | + > | ||
28 | + </el-option> | ||
29 | + </el-select>--> | ||
30 | + | ||
31 | + <el-dropdown split-button size="large" type="primary"> | ||
32 | + 聚合频率 | ||
33 | + <template #dropdown> | ||
34 | + <el-dropdown-menu> | ||
35 | + <el-dropdown-item :class="{'drop-active':checkedId==item.ddicDesc}" v-for="item in frequencyData" @click="changeItem(item.ddicDesc,item.ddicName)" | ||
36 | + :key="item.ddicId" | ||
37 | + :command="item.ddicDesc"> | ||
38 | + {{item.ddicName}} | ||
39 | + </el-radio> | ||
40 | + </el-dropdown-item> | ||
41 | + </el-dropdown-menu> | ||
42 | + </template> | ||
43 | + </el-dropdown> | ||
44 | + </el-col> | ||
45 | + </div> | ||
46 | + </el-col> | ||
47 | +</el-row> |
hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/dateRange/index.js
0 → 100644
1 | +export default { | ||
2 | + name: 'dateRange', | ||
3 | + template: '', | ||
4 | + components: {}, | ||
5 | + props: { | ||
6 | + keys:{ | ||
7 | + type:String, | ||
8 | + default: 'C620C1D453B79095A64314C8215335D5:KPI7054BC34:cpu' | ||
9 | + }, | ||
10 | + dateValueData:{ | ||
11 | + type:Array, | ||
12 | + default:[] | ||
13 | + }, | ||
14 | + intervalGroup:{ | ||
15 | + type:String, | ||
16 | + default:'' | ||
17 | + } | ||
18 | + }, | ||
19 | + data () { | ||
20 | + return { | ||
21 | + | ||
22 | + } | ||
23 | + }, | ||
24 | + setup(props, {attrs, slots, emit}){ | ||
25 | + const {proxy} = Vue.getCurrentInstance(); | ||
26 | + //接口参数-开始结束时间 | ||
27 | + let timeScope=Vue.ref(); | ||
28 | + //接口参数-聚合频率 | ||
29 | + // let intervalGroup=Vue.ref(60); | ||
30 | + //接口参数-资源id:指标id:flag,资源id:指标id:flag | ||
31 | + let keysVal=props.keys; | ||
32 | + //聚合频率数据 | ||
33 | + let frequencyData=Vue.ref([ | ||
34 | + { | ||
35 | + name:'5分钟聚合', | ||
36 | + val:5, | ||
37 | + id:'001' | ||
38 | + },{ | ||
39 | + name:'15分钟聚合', | ||
40 | + val:15, | ||
41 | + id:'002' | ||
42 | + },{ | ||
43 | + name:'1小时聚合', | ||
44 | + val:60, | ||
45 | + id:'003' | ||
46 | + },{ | ||
47 | + name:'12小时聚合', | ||
48 | + val:720, | ||
49 | + id:'004' | ||
50 | + },{ | ||
51 | + name:'1天聚合', | ||
52 | + val:1440, | ||
53 | + id:'005' | ||
54 | + },{ | ||
55 | + name:'不聚合', | ||
56 | + val:0, | ||
57 | + id:'006' | ||
58 | + } | ||
59 | + ]) | ||
60 | + | ||
61 | + //自定义选择时间 | ||
62 | + let dateValue=Vue.ref(); | ||
63 | + //选中的聚合频率 | ||
64 | + let checkedId=Vue.ref(); | ||
65 | + let commandVal=Vue.ref('聚合频率') | ||
66 | + //聚合频率选择 | ||
67 | + const changeItem=(val,name)=>{ | ||
68 | + checkedId.value=val; | ||
69 | + commandVal.value=name; | ||
70 | + loadPerformance(); | ||
71 | + } | ||
72 | + //时间控件左侧 | ||
73 | + let shortcuts=Vue.ref([ | ||
74 | + { | ||
75 | + text: '最近30分钟', | ||
76 | + value: () => { | ||
77 | + const end = new Date(); | ||
78 | + const start = formatDate(30,'m'); | ||
79 | + return [start, end] | ||
80 | + }, | ||
81 | + }, | ||
82 | + { | ||
83 | + text: '最近1小时', | ||
84 | + value: () => { | ||
85 | + const end = new Date(); | ||
86 | + const start = formatDate(1,'h'); | ||
87 | + return [start, end] | ||
88 | + }, | ||
89 | + }, | ||
90 | + { | ||
91 | + text: '最近1天', | ||
92 | + value: () => { | ||
93 | + const end = new Date(); | ||
94 | + const start = formatDate(1,'d'); | ||
95 | + return [start, end] | ||
96 | + }, | ||
97 | + }, | ||
98 | + { | ||
99 | + text: '最近3天', | ||
100 | + value: () => { | ||
101 | + const end = new Date(); | ||
102 | + const start = formatDate(3,'d'); | ||
103 | + return [start, end] | ||
104 | + }, | ||
105 | + }, | ||
106 | + { | ||
107 | + text: '最近7天', | ||
108 | + value: () => { | ||
109 | + const end = new Date(); | ||
110 | + const start = formatDate(7,'d'); | ||
111 | + return [start, end] | ||
112 | + }, | ||
113 | + }, | ||
114 | + { | ||
115 | + text: '最近15天', | ||
116 | + value: () => { | ||
117 | + const end = new Date(); | ||
118 | + const start = formatDate(15,'d'); | ||
119 | + return [start, end] | ||
120 | + }, | ||
121 | + }, | ||
122 | + { | ||
123 | + text: '最近1个月', | ||
124 | + value: () => { | ||
125 | + const end = new Date(); | ||
126 | + const start = formatDate(1,'M'); | ||
127 | + return [start, end] | ||
128 | + }, | ||
129 | + }, | ||
130 | + { | ||
131 | + text: '最近2个月', | ||
132 | + value: () => { | ||
133 | + const end = new Date(); | ||
134 | + const start = formatDate(2,'M'); | ||
135 | + return [start, end] | ||
136 | + }, | ||
137 | + }, | ||
138 | + { | ||
139 | + text: '最近3个月', | ||
140 | + value: () => { | ||
141 | + const end = new Date(); | ||
142 | + const start = formatDate(3,'M'); | ||
143 | + return [start, end] | ||
144 | + }, | ||
145 | + }, | ||
146 | + { | ||
147 | + text: '半年内', | ||
148 | + value: () => { | ||
149 | + const end = new Date(); | ||
150 | + const start = formatDate(6,'M'); | ||
151 | + return [start, end] | ||
152 | + }, | ||
153 | + }, | ||
154 | + { | ||
155 | + text: '1年内', | ||
156 | + value: () => { | ||
157 | + const end = new Date(); | ||
158 | + const start = formatDate(12,'M'); | ||
159 | + return [start, end] | ||
160 | + }, | ||
161 | + }, | ||
162 | + { | ||
163 | + text: '全部', | ||
164 | + value: () => { | ||
165 | + const end = new Date(); | ||
166 | + const start = '' | ||
167 | + return [start, end] | ||
168 | + }, | ||
169 | + }, | ||
170 | + ]) | ||
171 | + //开始时间 | ||
172 | + let startTime=Vue.ref(); | ||
173 | + //结束时间 | ||
174 | + let endTime=Vue.ref(); | ||
175 | + //相差天数 | ||
176 | + let calcDayNum=Vue.ref(0); | ||
177 | + //时间范围改变选中 | ||
178 | + const changeDate=(val)=>{ | ||
179 | + calcDayNum.value=calcDay(val[0],val[1]); | ||
180 | + getRate(calcCode(calcDayNum.value)) | ||
181 | + | ||
182 | + } | ||
183 | + //计算两个日期相差天数 | ||
184 | + const calcDay=(start,end)=>{ | ||
185 | + let endTime = new Date(end).getTime() / 1000 - parseInt(new Date(start).getTime() / 1000); | ||
186 | + let timeDay = parseInt(endTime / 60 / 60 / 24); //相差天数 | ||
187 | + return timeDay; | ||
188 | + } | ||
189 | + //计算需要传参的code值 | ||
190 | + const calcCode=(val)=>{ | ||
191 | + let code=''; | ||
192 | + if(val>0 && val<7){ | ||
193 | + code='time_scope_DAY'; | ||
194 | + }else if(val>=7 && val<30){ | ||
195 | + code='time_scope_WEEK'; | ||
196 | + }else if(val>=30 && val<90){ | ||
197 | + code='time_scope_MONTH'; | ||
198 | + }else if(val>=90 && val<180){ | ||
199 | + code='time_scope_QUARTER'; | ||
200 | + }else if(val>=180 && val<365){ | ||
201 | + code='time_scope_SEMESTER'; | ||
202 | + }else if(val>=365){ | ||
203 | + code='time_scope_YEAR'; | ||
204 | + } | ||
205 | + return code; | ||
206 | + } | ||
207 | + | ||
208 | + //确定 | ||
209 | + const sureBtn=()=>{ | ||
210 | + let dateValueArr=dateValue.value; | ||
211 | + if(dateValueArr && dateValueArr.length>0){ | ||
212 | + timeScope.value=dateValueArr.join(','); | ||
213 | + }else{ | ||
214 | + timeScope.value=''; | ||
215 | + } | ||
216 | + | ||
217 | + loadPerformance(); | ||
218 | + | ||
219 | + } | ||
220 | + //查询性能数据-自定义视图 | ||
221 | + const loadPerformance=()=>{ | ||
222 | + let params={ | ||
223 | + timeScope:timeScope.value, | ||
224 | + intervalGroup:checkedId.value, | ||
225 | + keys:keysVal | ||
226 | + } | ||
227 | + proxy.$http.get(`/api-web/cm-data-range/loadPerformanceCustom`, params, function (res) { | ||
228 | + if(res && res.data){ | ||
229 | + emit('callbacksure',res.data) | ||
230 | + }else{ | ||
231 | + emit('callbacksure','') | ||
232 | + } | ||
233 | + | ||
234 | + }) | ||
235 | + } | ||
236 | + //转换个位数为 00 | ||
237 | + let timeFormat =(number)=> { | ||
238 | + return number.length == 1 ? ('0' + number) : number | ||
239 | + } | ||
240 | + //获取时间点 转年月日的方法 | ||
241 | + const getDateTime=(newDate)=>{ | ||
242 | + let dateTime=''; | ||
243 | + let year=newDate.getFullYear();//获取当前年 | ||
244 | + let month=timeFormat(newDate.getMonth()+1);//获取当前月 | ||
245 | + let day=timeFormat(newDate.getDate());//获取当前日 | ||
246 | + let hours=timeFormat(newDate.getHours()+'');//获取当前时 | ||
247 | + let minutes=timeFormat(newDate.getMinutes()+'');//获取当前分 | ||
248 | + let seconds=timeFormat(newDate.getSeconds()+'');//获取当前秒 | ||
249 | + dateTime= year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds; | ||
250 | + return dateTime; | ||
251 | + } | ||
252 | + //获取前n段时间的时间点 | ||
253 | + const formatDate=(num,code)=>{ | ||
254 | + let m=num; | ||
255 | + let myDate=new Date(); | ||
256 | + let lowData='';//当前年月日往前推m个月后获取到的年月日 | ||
257 | + if(code=='m'){ | ||
258 | + //当前时间前n分钟 | ||
259 | + myDate.setMinutes(myDate.getMinutes()-m); | ||
260 | + lowData =getDateTime(myDate); //用了上面转年月日的方法 | ||
261 | + | ||
262 | + }else if(code=='h'){ | ||
263 | + //当前时间前n小时 | ||
264 | + myDate.setHours(myDate.getHours()-m) | ||
265 | + lowData =getDateTime(myDate); //用了上面转年月日的方法 | ||
266 | + }else if(code=='d'){ | ||
267 | + //当前时间前n天 | ||
268 | + myDate.setDate(myDate.getDate() - m); | ||
269 | + lowData =getDateTime(myDate); //用了上面转年月日的方法 | ||
270 | + }else if(code=='M'){ | ||
271 | + //当前时间前n月 | ||
272 | + myDate.setMonth(myDate.getMonth()-m); | ||
273 | + lowData =getDateTime(myDate); //用了上面转年月日的方法 | ||
274 | + | ||
275 | + }else{ | ||
276 | + | ||
277 | + } | ||
278 | + return lowData; | ||
279 | + | ||
280 | + } | ||
281 | + //判断是否传值进来 | ||
282 | + const isDetail=()=>{ | ||
283 | + if(props.dateValueData && props.dateValueData.length>0){ | ||
284 | + dateValue.value=props.dateValueData | ||
285 | + changeDate(dateValue.value); | ||
286 | + } | ||
287 | + checkedId.value=props.intervalGroup; | ||
288 | + } | ||
289 | + | ||
290 | + //获取聚合频率数据 | ||
291 | + const getRate=(defCode)=>{ | ||
292 | + let param = { | ||
293 | + ddicName: defCode | ||
294 | + } | ||
295 | + proxy.$http.get(`/api-web/ContrastAnalysis/selectTogetherRate`, param, function (res) { | ||
296 | + if (res && res.data) { | ||
297 | + frequencyData.value = res.data; | ||
298 | + | ||
299 | + } | ||
300 | + sureBtn(); | ||
301 | + }); | ||
302 | + } | ||
303 | + | ||
304 | + // 挂载完 | ||
305 | + Vue.onMounted(() => { | ||
306 | + isDetail(); | ||
307 | + | ||
308 | + }) | ||
309 | + return { | ||
310 | + commandVal, | ||
311 | + calcDayNum, | ||
312 | + calcDay, | ||
313 | + shortcuts, | ||
314 | + timeScope, | ||
315 | + keysVal, | ||
316 | + startTime, | ||
317 | + endTime, | ||
318 | + frequencyData, | ||
319 | + dateValue, | ||
320 | + changeItem, | ||
321 | + checkedId, | ||
322 | + changeDate, | ||
323 | + sureBtn, | ||
324 | + timeFormat, | ||
325 | + formatDate, | ||
326 | + getDateTime, | ||
327 | + loadPerformance | ||
328 | + } | ||
329 | + | ||
330 | + } | ||
331 | + | ||
332 | +} |
@@ -40,7 +40,9 @@ Promise.all([ | @@ -40,7 +40,9 @@ Promise.all([ | ||
40 | //指标类型数 | 40 | //指标类型数 |
41 | .component('cm-kpi-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputkpitree/index'))) | 41 | .component('cm-kpi-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputkpitree/index'))) |
42 | //所属系统 | 42 | //所属系统 |
43 | - .component('cm-biz-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputbiztypetree/index'))); | 43 | + .component('cm-biz-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputbiztypetree/index'))) |
44 | + //时间范围组件 | ||
45 | + .component('cm-date-range', Vue.defineAsyncComponent(() => myImport('components/common/dateRange/index'))); | ||
44 | 46 | ||
45 | 47 | ||
46 | // // 自定义指令 | 48 | // // 自定义指令 |
@@ -2,26 +2,26 @@ | @@ -2,26 +2,26 @@ | ||
2 | <el-row> | 2 | <el-row> |
3 | <el-col :span="24"> | 3 | <el-col :span="24"> |
4 | <div class="set-add-div"> | 4 | <div class="set-add-div"> |
5 | - <el-row> | 5 | + <el-row style="margin-bottom: 5px;margin-top: 5px"> |
6 | <el-col :span="24"> | 6 | <el-col :span="24"> |
7 | <div class="flex-div-start margin-top-bottom-10"> | 7 | <div class="flex-div-start margin-top-bottom-10"> |
8 | - <el-input style="width:160px;" class="margin-right-10" v-model="keyWords" | 8 | + <el-input style="width:160px;margin-left: 10px;float: left;" class="margin-right-10" v-model="keyWords" |
9 | placeholder="输入关键字"/> | 9 | placeholder="输入关键字"/> |
10 | - <el-dropdown style="margin-top: -15px;"> | 10 | + <el-dropdown style="margin-top: -15px;margin-left: 10px;float: left;"> |
11 | <el-icon class="el-icon--right"> | 11 | <el-icon class="el-icon--right"> |
12 | <arrow-down/> | 12 | <arrow-down/> |
13 | </el-icon> | 13 | </el-icon> |
14 | <cm-biz-type-tree-input multiple clearable collapseTags @callback="getBizType"/> | 14 | <cm-biz-type-tree-input multiple clearable collapseTags @callback="getBizType"/> |
15 | </el-dropdown> | 15 | </el-dropdown> |
16 | 16 | ||
17 | - <el-dropdown style="margin-top: -15px;margin-left: 10px;"> | 17 | + <el-dropdown style="margin-top: -15px;margin-left: 10px;float: left;"> |
18 | <el-icon class="el-icon--right"> | 18 | <el-icon class="el-icon--right"> |
19 | <arrow-down/> | 19 | <arrow-down/> |
20 | </el-icon> | 20 | </el-icon> |
21 | <cm-res-type-tree-input multiple clearable collapseTags @callback="getResType"/> | 21 | <cm-res-type-tree-input multiple clearable collapseTags @callback="getResType"/> |
22 | </el-dropdown> | 22 | </el-dropdown> |
23 | 23 | ||
24 | - <div class="flex-div-start"> | 24 | + <div class="flex-div-start" style="float: left;"> |
25 | <!-- <el-button type="primary" @click="onReset()">重置</el-button>--> | 25 | <!-- <el-button type="primary" @click="onReset()">重置</el-button>--> |
26 | <el-button type="primary" @click="onBtnSearch()" style="margin-left: 10px">查询</el-button> | 26 | <el-button type="primary" @click="onBtnSearch()" style="margin-left: 10px">查询</el-button> |
27 | </div> | 27 | </div> |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <el-row> | 5 | <el-row> |
6 | <div class="flex-div-start"> | 6 | <div class="flex-div-start"> |
7 | <el-button type="primary" @click="save()" style="margin-left: 10px">新增</el-button> | 7 | <el-button type="primary" @click="save()" style="margin-left: 10px">新增</el-button> |
8 | - <el-button type="primary" @click="deleteOther()" style="margin-left: 10px">删除</el-button> | 8 | +<!-- <el-button type="primary" @click="deleteOther()" style="margin-left: 10px">删除</el-button>--> |
9 | <el-button type="primary" @click="conserve()" style="margin-left: 10px">保存</el-button> | 9 | <el-button type="primary" @click="conserve()" style="margin-left: 10px">保存</el-button> |
10 | </div> | 10 | </div> |
11 | </el-row> | 11 | </el-row> |
@@ -48,6 +48,8 @@ export default { | @@ -48,6 +48,8 @@ export default { | ||
48 | let count = Vue.ref(0); | 48 | let count = Vue.ref(0); |
49 | //列表数据 | 49 | //列表数据 |
50 | let portSenseConfigData = Vue.ref([]); | 50 | let portSenseConfigData = Vue.ref([]); |
51 | + //数据库的数据 | ||
52 | + let portSenseConfigList = Vue.ref([]); | ||
51 | //资源数据 | 53 | //资源数据 |
52 | let resIdArr = Vue.ref([]); | 54 | let resIdArr = Vue.ref([]); |
53 | //列表高度 | 55 | //列表高度 |
@@ -80,6 +82,7 @@ export default { | @@ -80,6 +82,7 @@ export default { | ||
80 | portSenseConfigData.value = res.data ? res.data : []; | 82 | portSenseConfigData.value = res.data ? res.data : []; |
81 | count.value = res.count; | 83 | count.value = res.count; |
82 | loading.value = false; | 84 | loading.value = false; |
85 | + portSenseConfigList.value = res.data ? JSON.parse(JSON.stringify(res.data)) : []; | ||
83 | } | 86 | } |
84 | }) | 87 | }) |
85 | } | 88 | } |
@@ -108,19 +111,17 @@ export default { | @@ -108,19 +111,17 @@ export default { | ||
108 | //删除单个数据 | 111 | //删除单个数据 |
109 | let deleteItem = (row, index) => { | 112 | let deleteItem = (row, index) => { |
110 | proxy.$global.confirm("确认删除吗?", function () { | 113 | proxy.$global.confirm("确认删除吗?", function () { |
111 | - deleteItems([row]); | 114 | + deleteItems(row, index); |
112 | }) | 115 | }) |
113 | } | 116 | } |
114 | //删除多个或单个 | 117 | //删除多个或单个 |
115 | - let deleteItems = (list) => { | 118 | + let deleteItems = (row, index) => { |
116 | //新添加未保存的 | 119 | //新添加未保存的 |
117 | - let filter = list.filter(item => item.id === ""); | ||
118 | - deleteNotSave(filter); | ||
119 | - if (filter.size === list.size) { | 120 | + let sign = deleteNotSave(row, index); |
121 | + if (sign) { | ||
120 | return false; | 122 | return false; |
121 | } | 123 | } |
122 | - list = list.filter(item => item.id !== ""); | ||
123 | - proxy.$http.post('/api-web/bResourceExtendParam/deleteConfig', list, function (res) { | 124 | + proxy.$http.post('/api-web/bResourceExtendParam/deleteConfig', row, function (res) { |
124 | if (res && res.success) { | 125 | if (res && res.success) { |
125 | proxy.$global.showMsg('删除成功'); | 126 | proxy.$global.showMsg('删除成功'); |
126 | loadTableDataList({page: 1, limit: pageSize.value}); | 127 | loadTableDataList({page: 1, limit: pageSize.value}); |
@@ -128,16 +129,18 @@ export default { | @@ -128,16 +129,18 @@ export default { | ||
128 | }) | 129 | }) |
129 | } | 130 | } |
130 | //删除新添加但未保存的 | 131 | //删除新添加但未保存的 |
131 | - let deleteNotSave = (list) => { | ||
132 | - | 132 | + let deleteNotSave = (row, index) => { |
133 | + let sign = false; | ||
134 | + let list = portSenseConfigData.value; | ||
135 | + if(row.id === ""){ | ||
136 | + portSenseConfigData.value = list.filter((item, i, array) => index !== i); | ||
137 | + } | ||
138 | + if (list.length > portSenseConfigData.value.length) { | ||
139 | + proxy.$global.showMsg('删除成功'); | ||
140 | + sign = true; | ||
141 | + } | ||
142 | + return sign; | ||
133 | } | 143 | } |
134 | - //删除 | ||
135 | - let deleteOther = () => { | ||
136 | - let list = pitch.value.map(item => { | ||
137 | - return item.resId; | ||
138 | - }) | ||
139 | - deleteItems(list); | ||
140 | - }; | ||
141 | //新增 添加一行数据 | 144 | //新增 添加一行数据 |
142 | let save = () => { | 145 | let save = () => { |
143 | let data = { | 146 | let data = { |
@@ -207,7 +210,6 @@ export default { | @@ -207,7 +210,6 @@ export default { | ||
207 | selectionChange, | 210 | selectionChange, |
208 | deleteItem, | 211 | deleteItem, |
209 | save, | 212 | save, |
210 | - deleteOther, | ||
211 | getListData, | 213 | getListData, |
212 | loadTableDataList, | 214 | loadTableDataList, |
213 | changePortSense, | 215 | changePortSense, |
@@ -29,7 +29,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | @@ -29,7 +29,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | ||
29 | var oldBusTypeCode = data && data.busTypeCode ? data.busTypeCode : ''; | 29 | var oldBusTypeCode = data && data.busTypeCode ? data.busTypeCode : ''; |
30 | 30 | ||
31 | var busType; | 31 | var busType; |
32 | - | 32 | + |
33 | // 父业务下拉框 | 33 | // 父业务下拉框 |
34 | admin.req({ | 34 | admin.req({ |
35 | url: domainName + '/api-web/manage/bustype/page', | 35 | url: domainName + '/api-web/manage/bustype/page', |
@@ -71,10 +71,16 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | @@ -71,10 +71,16 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | ||
71 | busType = response.data[0]; | 71 | busType = response.data[0]; |
72 | form.val('form-bustype-edit', busType); | 72 | form.val('form-bustype-edit', busType); |
73 | $('form[lay-filter="form-bustype-edit"] input[name="busTypeCode"]').attr('readonly', true); | 73 | $('form[lay-filter="form-bustype-edit"] input[name="busTypeCode"]').attr('readonly', true); |
74 | - userSelect.setValue([busType.admin]); | 74 | + setTimeout(function (){ |
75 | + userSelect.setValue([busType.admin]); | ||
76 | + },2000) | ||
77 | + | ||
75 | let principal = busType.principal; | 78 | let principal = busType.principal; |
76 | let principalLi = principal ? principal.split(",") : []; | 79 | let principalLi = principal ? principal.split(",") : []; |
77 | - opsSelect.setValue(principalLi); | 80 | + setTimeout(function (){ |
81 | + opsSelect.setValue(principalLi); | ||
82 | + },2000) | ||
83 | + | ||
78 | 84 | ||
79 | //是否启用 1启用 0不启用 | 85 | //是否启用 1启用 0不启用 |
80 | let isUse = busType.isUse || busType.isUse == 0 ? busType.isUse : 1; | 86 | let isUse = busType.isUse || busType.isUse == 0 ? busType.isUse : 1; |
@@ -209,6 +215,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | @@ -209,6 +215,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | ||
209 | function initUserSelect() { | 215 | function initUserSelect() { |
210 | $.ajax({ | 216 | $.ajax({ |
211 | url: domainName + '/api-user/users/getAll?access_token=' + accessToken, | 217 | url: domainName + '/api-user/users/getAll?access_token=' + accessToken, |
218 | + sync: false, | ||
212 | success: function (res) { | 219 | success: function (res) { |
213 | userSelect = xmSelect.render({ | 220 | userSelect = xmSelect.render({ |
214 | el: '.adminUser', | 221 | el: '.adminUser', |
@@ -231,6 +238,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | @@ -231,6 +238,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | ||
231 | function initUserSelectOps() { | 238 | function initUserSelectOps() { |
232 | $.ajax({ | 239 | $.ajax({ |
233 | url: domainName + '/api-user/users/getAll?access_token=' + accessToken, | 240 | url: domainName + '/api-user/users/getAll?access_token=' + accessToken, |
241 | + sync: false, | ||
234 | success: function (res) { | 242 | success: function (res) { |
235 | opsSelect = xmSelect.render({ | 243 | opsSelect = xmSelect.render({ |
236 | el: '#opsProject-username-select', | 244 | el: '#opsProject-username-select', |
@@ -254,4 +262,4 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | @@ -254,4 +262,4 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se | ||
254 | }); | 262 | }); |
255 | 263 | ||
256 | }); | 264 | }); |
257 | -}); | ||
265 | +}); |
@@ -106,7 +106,6 @@ body{ | @@ -106,7 +106,6 @@ body{ | ||
106 | align-items: center; | 106 | align-items: center; |
107 | width: 20px; | 107 | width: 20px; |
108 | height: 20px; | 108 | height: 20px; |
109 | - background:rgb(30,159,255); | ||
110 | border-radius: 2px; | 109 | border-radius: 2px; |
111 | cursor: pointer; | 110 | cursor: pointer; |
112 | } | 111 | } |
@@ -176,4 +175,5 @@ body{ | @@ -176,4 +175,5 @@ body{ | ||
176 | .list-handle{ | 175 | .list-handle{ |
177 | display: flex; | 176 | display: flex; |
178 | justify-content: space-around; | 177 | justify-content: space-around; |
178 | + color:rgb(30,159,255); | ||
179 | } | 179 | } |
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | <template #default="scope"> | 46 | <template #default="scope"> |
47 | <div class="list-handle"> | 47 | <div class="list-handle"> |
48 | <span class="icon-bg"> | 48 | <span class="icon-bg"> |
49 | - <i class="icon-list icon-list-delete" title="删除" @click="handleDelete(scope.row)"></i> | 49 | + <i class="el-icon-delete" title="删除" @click="handleDelete(scope.row)"></i> |
50 | </span> | 50 | </span> |
51 | <span class="icon-bg"> | 51 | <span class="icon-bg"> |
52 | <i class="el-icon-edit-outline" title="修改" @click="handleUpdate(scope.row)"></i> | 52 | <i class="el-icon-edit-outline" title="修改" @click="handleUpdate(scope.row)"></i> |
-
Please register or login to post a comment