|
@@ -2,6 +2,9 @@ export default { |
|
@@ -2,6 +2,9 @@ export default { |
2
|
name: 'resourcePer',
|
2
|
name: 'resourcePer',
|
3
|
template: '',
|
3
|
template: '',
|
4
|
components: {
|
4
|
components: {
|
|
|
5
|
+ 'ChangeUsersList': Vue.defineAsyncComponent(
|
|
|
6
|
+ () => myImport('views/batchChangeLeaders/changeUsersList/index')
|
|
|
7
|
+ ),
|
5
|
},
|
8
|
},
|
6
|
data() {
|
9
|
data() {
|
7
|
},
|
10
|
},
|
|
@@ -13,7 +16,22 @@ export default { |
|
@@ -13,7 +16,22 @@ export default { |
13
|
},
|
16
|
},
|
14
|
setup: function (props, {attrs, slots, emit}) {
|
17
|
setup: function (props, {attrs, slots, emit}) {
|
15
|
const {proxy} = Vue.getCurrentInstance();
|
18
|
const {proxy} = Vue.getCurrentInstance();
|
16
|
-
|
19
|
+ //变更人员弹框
|
|
|
20
|
+ let show=Vue.ref(false);
|
|
|
21
|
+ //变更人员列表是否多选
|
|
|
22
|
+ let isMulti=Vue.ref(false);
|
|
|
23
|
+ //变更人员列表是否是两组
|
|
|
24
|
+ let isTwoGroup=Vue.ref(false);
|
|
|
25
|
+ //配置列表总数
|
|
|
26
|
+ let count = Vue.ref(0);
|
|
|
27
|
+ //列表高度
|
|
|
28
|
+ let height = Vue.ref(window.innerHeight);
|
|
|
29
|
+ //列表分页
|
|
|
30
|
+ let limit = Vue.ref(400);
|
|
|
31
|
+ //加载
|
|
|
32
|
+ let loading = Vue.ref(true);
|
|
|
33
|
+ //选中数据
|
|
|
34
|
+ let pitch = Vue.ref([]);
|
17
|
let showTypeList=Vue.ref([]);
|
35
|
let showTypeList=Vue.ref([]);
|
18
|
let search = Vue.ref({
|
36
|
let search = Vue.ref({
|
19
|
resType: '',
|
37
|
resType: '',
|
|
@@ -22,8 +40,6 @@ export default { |
|
@@ -22,8 +40,6 @@ export default { |
22
|
limit: 20,
|
40
|
limit: 20,
|
23
|
});
|
41
|
});
|
24
|
let resTypeOptions=Vue.ref([])
|
42
|
let resTypeOptions=Vue.ref([])
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
const columns = [
|
43
|
const columns = [
|
28
|
{
|
44
|
{
|
29
|
prop: 'resName',
|
45
|
prop: 'resName',
|
|
@@ -97,48 +113,34 @@ export default { |
|
@@ -97,48 +113,34 @@ export default { |
97
|
}
|
113
|
}
|
98
|
}
|
114
|
}
|
99
|
];
|
115
|
];
|
100
|
- //配置列表总数
|
|
|
101
|
- let count = Vue.ref(0);
|
116
|
+
|
102
|
//列表数据
|
117
|
//列表数据
|
103
|
- let portSenseConfigData = Vue.ref([]);
|
|
|
104
|
- //数据库的数据
|
|
|
105
|
- let portSenseConfigList = Vue.ref([]);
|
118
|
+ let resourceData = Vue.ref([]);
|
|
|
119
|
+
|
106
|
//资源数据
|
120
|
//资源数据
|
107
|
let resIdArr = Vue.ref([]);
|
121
|
let resIdArr = Vue.ref([]);
|
108
|
- //列表高度
|
|
|
109
|
- let height = Vue.ref(window.innerHeight);
|
|
|
110
|
- //列表分页
|
|
|
111
|
- let pageSize = Vue.ref(400);
|
|
|
112
|
- //加载
|
|
|
113
|
- let loading = Vue.ref(true);
|
|
|
114
|
- //选中数据
|
|
|
115
|
- let pitch = Vue.ref([]);
|
|
|
116
|
- //下拉框数据
|
|
|
117
|
- let portSenseSelectData = Vue.ref([]);
|
122
|
+
|
118
|
|
123
|
|
119
|
//获取列表数据
|
124
|
//获取列表数据
|
120
|
- const getListData = ({page, limit}) => {
|
|
|
121
|
- //获取传递过来的参数
|
|
|
122
|
- resIdArr.value = JSON.parse(JSON.stringify(props.parameter));
|
|
|
123
|
- //传递参数赋值给下拉框
|
|
|
124
|
- portSenseSelectData.value = resIdArr.value;
|
125
|
+ const getListData = () => {
|
125
|
|
126
|
|
126
|
let username=proxy.$route.query.username;
|
127
|
let username=proxy.$route.query.username;
|
127
|
let resName=proxy.$route.query.resName;
|
128
|
let resName=proxy.$route.query.resName;
|
128
|
//定义列表参数
|
129
|
//定义列表参数
|
129
|
let getParams = {
|
130
|
let getParams = {
|
130
|
resIds: resIdArr.value.join(','),
|
131
|
resIds: resIdArr.value.join(','),
|
|
|
132
|
+ resType:search.value.resType,
|
|
|
133
|
+ keyword:search.value.keyword,
|
131
|
resName: resName,
|
134
|
resName: resName,
|
132
|
userId: username,
|
135
|
userId: username,
|
133
|
- page: page,
|
|
|
134
|
- limit: limit
|
136
|
+ page: search.value.page,
|
|
|
137
|
+ limit: search.value.limit
|
135
|
};
|
138
|
};
|
136
|
proxy.$http.get("/api-web/manage/resource/getAllResByUser", getParams, function (res) {
|
139
|
proxy.$http.get("/api-web/manage/resource/getAllResByUser", getParams, function (res) {
|
137
|
if (res && res.success) {
|
140
|
if (res && res.success) {
|
138
|
- portSenseConfigData.value = res.data ? res.data : [];
|
141
|
+ resourceData.value = res.data ? res.data : [];
|
139
|
count.value = res.count;
|
142
|
count.value = res.count;
|
140
|
loading.value = false;
|
143
|
loading.value = false;
|
141
|
- portSenseConfigList.value = res.data ? JSON.parse(JSON.stringify(res.data)) : [];
|
|
|
142
|
}
|
144
|
}
|
143
|
})
|
145
|
})
|
144
|
}
|
146
|
}
|
|
@@ -146,222 +148,85 @@ export default { |
|
@@ -146,222 +148,85 @@ export default { |
146
|
//表格全选事件
|
148
|
//表格全选事件
|
147
|
let selectionChange = (val) => {
|
149
|
let selectionChange = (val) => {
|
148
|
pitch.value = val;
|
150
|
pitch.value = val;
|
149
|
- proxy.portSenseConfigData.map((v, i) => {
|
151
|
+ proxy.resourceData.map((v, i) => {
|
150
|
v.checked = false;
|
152
|
v.checked = false;
|
151
|
});
|
153
|
});
|
152
|
let selectData = val;
|
154
|
let selectData = val;
|
153
|
if (selectData.length > 0) {
|
155
|
if (selectData.length > 0) {
|
154
|
selectData.map((item, index) => {
|
156
|
selectData.map((item, index) => {
|
155
|
- proxy.portSenseConfigData.map((v, i) => {
|
157
|
+ proxy.resourceData.map((v, i) => {
|
156
|
if (item.id == v.id) {
|
158
|
if (item.id == v.id) {
|
157
|
v.checked = true;
|
159
|
v.checked = true;
|
158
|
}
|
160
|
}
|
159
|
})
|
161
|
})
|
160
|
})
|
162
|
})
|
161
|
} else {
|
163
|
} else {
|
162
|
- proxy.portSenseConfigData.map((v, i) => {
|
164
|
+ proxy.resourceData.map((v, i) => {
|
163
|
v.checked = false;
|
165
|
v.checked = false;
|
164
|
})
|
166
|
})
|
165
|
}
|
167
|
}
|
166
|
}
|
168
|
}
|
167
|
- //删除单个数据
|
|
|
168
|
- let deleteItem = (row, index) => {
|
|
|
169
|
- proxy.$global.confirm("确认删除吗?", function () {
|
|
|
170
|
- deleteItems(row, index);
|
|
|
171
|
- })
|
|
|
172
|
- }
|
|
|
173
|
- //删除多个或单个
|
|
|
174
|
- let deleteItems = (row, index) => {
|
|
|
175
|
- //新添加未保存的
|
|
|
176
|
- let sign = deleteNotSave(row, index);
|
|
|
177
|
- if (sign) {
|
|
|
178
|
- return false;
|
|
|
179
|
- }
|
|
|
180
|
- proxy.$http.post('/api-web/bResourceExtendParam/deleteConfig', row, function (res) {
|
|
|
181
|
- if (res && res.success) {
|
|
|
182
|
- proxy.$global.showMsg('删除成功');
|
|
|
183
|
- loadTableDataList({page: 1, limit: pageSize.value});
|
|
|
184
|
- }
|
|
|
185
|
- })
|
|
|
186
|
- }
|
|
|
187
|
- //删除新添加但未保存的
|
|
|
188
|
- let deleteNotSave = (row, index) => {
|
|
|
189
|
- let sign = false;
|
|
|
190
|
- let list = portSenseConfigData.value;
|
|
|
191
|
- if(row.id === ""){
|
|
|
192
|
- portSenseConfigData.value = list.filter((item, i, array) => index !== i);
|
|
|
193
|
- }
|
|
|
194
|
- if (list.length > portSenseConfigData.value.length) {
|
|
|
195
|
- proxy.$global.showMsg('删除成功');
|
|
|
196
|
- sign = true;
|
|
|
197
|
- }
|
|
|
198
|
- return sign;
|
|
|
199
|
- }
|
|
|
200
|
- //新增 添加一行数据
|
|
|
201
|
- let save = () => {
|
|
|
202
|
- let data = {
|
|
|
203
|
- id: "",
|
|
|
204
|
- intervalTime: null,
|
|
|
205
|
- paramCode: "",
|
|
|
206
|
- paramDesc: "",
|
|
|
207
|
- paramValue: "",
|
|
|
208
|
- port: "",
|
|
|
209
|
- portDesc: "",
|
|
|
210
|
- protocolType: "",
|
|
|
211
|
- resId: "",
|
|
|
212
|
- resIdList: resIdArr.value,
|
|
|
213
|
- }
|
|
|
214
|
- portSenseConfigData.value.push(data);
|
|
|
215
|
- }
|
|
|
216
|
- //下拉框值改变事件
|
|
|
217
|
- let changePortSense = () => {
|
|
|
218
|
|
169
|
|
219
|
- }
|
|
|
220
|
- //保存
|
|
|
221
|
- let conserve = () => {
|
|
|
222
|
- //数据验证
|
|
|
223
|
- let msg = verifyData();
|
|
|
224
|
- if (msg !== "") {
|
|
|
225
|
- proxy.$global.showMsg(msg, "warning");
|
|
|
226
|
- return false;
|
|
|
227
|
- }
|
|
|
228
|
- //逻辑验证
|
|
|
229
|
- let identifying = isSave();
|
|
|
230
|
- if (identifying !== "") {
|
|
|
231
|
- proxy.$global.showMsg(identifying, "warning");
|
|
|
232
|
- return false;
|
|
|
233
|
- }
|
|
|
234
|
- proxy.$http.post("/api-web/bResourceExtendParam/conserve", portSenseConfigData.value, function (res) {
|
|
|
235
|
- if (res && res.success) {
|
|
|
236
|
- proxy.$global.showMsg("保存成功!");
|
|
|
237
|
- loadTableDataList({page: 1, limit: pageSize.value});
|
|
|
238
|
- }
|
|
|
239
|
- })
|
|
|
240
|
- }
|
|
|
241
|
- //保存表单验证
|
|
|
242
|
- let verifyData = () => {
|
|
|
243
|
- let msg = "";
|
|
|
244
|
- //协议类型不能为空,端口备注不能为空,端口号请输入数字,间隔时长请输入数字,
|
|
|
245
|
- let list = portSenseConfigData.value;
|
|
|
246
|
- let li = columns.filter(item => "paramDesc" !== item.prop);
|
|
|
247
|
- list.forEach(function (item, index, arr) {
|
|
|
248
|
- li.forEach(function (e, i, array) {
|
|
|
249
|
- if (item[e.prop] == null || item[e.prop] === '') {
|
|
|
250
|
- msg = e.label + '不能为空';
|
|
|
251
|
- } else {
|
|
|
252
|
- if (['protocolType', 'portDesc'].indexOf(e.prop) === -1 && !/^\d+$/.test(item[e.prop])) {
|
|
|
253
|
- msg = e.label + '请输入数字';
|
|
|
254
|
- }else{
|
|
|
255
|
- if(['protocolType', 'portDesc'].indexOf(e.prop) === -1 && item[e.prop].length>=8){
|
|
|
256
|
- msg = e.label + '不能超过8位';
|
170
|
+ //批量取消相关资源
|
|
|
171
|
+ let changeCancel = () => {
|
|
|
172
|
+ console.log("123654",pitch.value)
|
|
|
173
|
+ if(pitch.value.length<1){
|
|
|
174
|
+ proxy.$global.showMsg('请至少选择一项','warning');
|
|
|
175
|
+
|
257
|
}else{
|
176
|
}else{
|
258
|
- if(['protocolType', 'portDesc'].indexOf(e.prop) === -1 && item[e.prop]<=0){
|
|
|
259
|
- msg = e.label + '只能大于零';
|
|
|
260
|
- }
|
|
|
261
|
- }
|
|
|
262
|
- }
|
|
|
263
|
- }
|
|
|
264
|
- })
|
|
|
265
|
- })
|
|
|
266
|
- return msg
|
|
|
267
|
- }
|
|
|
268
|
- //是否可以保存
|
|
|
269
|
- let isSave = () => {
|
|
|
270
|
- let msg = "";
|
|
|
271
|
- //零个资源不用判断
|
|
|
272
|
- if (resIdArr.value.length === 0) {
|
|
|
273
|
- return "必须选中资源";
|
|
|
274
|
- }
|
|
|
275
|
- //单个资源不用判断
|
|
|
276
|
- if (resIdArr.value.length === 1) {
|
|
|
277
|
- return msg;
|
|
|
278
|
- }
|
|
|
279
|
- //多个资源时,如果当前已选资源中存在列表新增加的协议类型和端口号对应的数据时,提示不允许进行保存,提示信息中必须包含资源名称+端口类型、端口号,
|
|
|
280
|
- let list = [];
|
|
|
281
|
- let arr = [];
|
|
|
282
|
- portSenseConfigData.value.forEach(item => {
|
|
|
283
|
- item.resIdList.forEach(map => {
|
|
|
284
|
- let obj = Object.assign({}, item);
|
|
|
285
|
- obj["resId"] = map;
|
|
|
286
|
- obj["resIdList"] = [map];
|
|
|
287
|
- list.push(obj);
|
|
|
288
|
- })
|
177
|
+ proxy.$global.confirm("确定取消相关资源?", function () {
|
|
|
178
|
+ proxy.$global.showMsg('取消成功!');
|
|
|
179
|
+
|
|
|
180
|
+ // proxy.$http.get(`/api-web/alarmsubscribe/exclude/delete/${row.id}`, {}, function (res) {
|
|
|
181
|
+ // if (res && res.success) {
|
|
|
182
|
+ // proxy.$global.showMsg('取消成功!');
|
|
|
183
|
+ // getListData()
|
|
|
184
|
+ // }
|
|
|
185
|
+ // })
|
|
|
186
|
+
|
289
|
});
|
187
|
});
|
290
|
- //查看当前页面数据是否重复
|
|
|
291
|
- groupByCount(list, arr);
|
|
|
292
|
- if (arr.length > 0) {
|
|
|
293
|
- return arr.join(',');
|
|
|
294
|
}
|
188
|
}
|
295
|
- //查看当前页面数据跟数据库是否重复
|
|
|
296
|
- let presentArray = [];
|
|
|
297
|
- //过滤不是新增的数据
|
|
|
298
|
- list = list.filter(item => item.id === "");
|
|
|
299
|
- resIdArr.value.forEach(item => {
|
|
|
300
|
- let li = [];
|
|
|
301
|
- let getParams = {
|
|
|
302
|
- resIds: item,
|
|
|
303
|
- page: 1,
|
|
|
304
|
- limit: 9999
|
|
|
305
|
- };
|
|
|
306
|
- proxy.$http.get("/api-web/bResourceExtendParam/portSensePage", getParams, function (res) {
|
|
|
307
|
- if (res && res.success) {
|
|
|
308
|
- li = res.data ? res.data : [];
|
|
|
309
|
- list.forEach(e => {
|
|
|
310
|
- li.forEach(map => {
|
|
|
311
|
- if (map.resId === e.resId && map.paramCode === e.protocolType && map.port === e.port) {
|
|
|
312
|
- let obj = Object.assign({}, e);
|
|
|
313
|
- obj["resName"] = map.resName;
|
|
|
314
|
- presentArray.push(obj);
|
|
|
315
|
}
|
189
|
}
|
316
|
- });
|
|
|
317
|
- });
|
190
|
+
|
|
|
191
|
+ //变更负责人
|
|
|
192
|
+ let changeAdmin = () => {
|
|
|
193
|
+ if(pitch.value.length<1){
|
|
|
194
|
+ proxy.$global.showMsg('请至少选择一项','warning');
|
|
|
195
|
+
|
|
|
196
|
+ }else{
|
|
|
197
|
+ show.value=true;
|
318
|
}
|
198
|
}
|
319
|
- }, null, null, null, false);
|
|
|
320
|
- });
|
|
|
321
|
- presentArray.forEach(item => {
|
|
|
322
|
- let str = item.resName + "的" + item.paramCode.split("-")[0] + "协议" + "侦测的" + item.port + "端口号已侦测";
|
|
|
323
|
- arr.push(str);
|
|
|
324
|
- })
|
|
|
325
|
- msg = arr.join(',');
|
|
|
326
|
- return msg;
|
199
|
+
|
327
|
}
|
200
|
}
|
|
|
201
|
+
|
328
|
//重新加载表格数据
|
202
|
//重新加载表格数据
|
329
|
let loadTableDataList = ({page, limit}) => {
|
203
|
let loadTableDataList = ({page, limit}) => {
|
330
|
- getListData({page, limit});
|
|
|
331
|
- }
|
|
|
332
|
- //修改父组件的值
|
|
|
333
|
- let selectRes = (item) => {
|
|
|
334
|
- portSenseConfigData.value = item;
|
|
|
335
|
- }
|
|
|
336
|
- //数组查找重复数据并统计行数
|
|
|
337
|
- let groupByCount = (arr, array) => {
|
|
|
338
|
- let list = [];
|
|
|
339
|
- arr.sort((a, b) => {
|
|
|
340
|
- if (a.resId !== b.resId) {
|
|
|
341
|
- return a.resId < b.resId ? -1 : 1;
|
|
|
342
|
- } else {
|
|
|
343
|
- return a.name < b.name ? -1 : 1;
|
|
|
344
|
- }
|
|
|
345
|
- });
|
|
|
346
|
- for (let i = 0; i < arr.length;) {
|
|
|
347
|
- let count = 0;
|
|
|
348
|
- for (let j = i; j < arr.length; j++) {
|
|
|
349
|
- if (arr[i].resId === arr[j].resId && arr[i].protocolType === arr[j].protocolType && arr[i].port === arr[j].port) {
|
|
|
350
|
- count++;
|
204
|
+ search.value.page=page;
|
|
|
205
|
+ search.value.limit=limit;
|
|
|
206
|
+ getListData();
|
351
|
}
|
207
|
}
|
352
|
- }
|
|
|
353
|
- list.push({array: arr[i], count: count});
|
|
|
354
|
- i += count;
|
|
|
355
|
- }
|
|
|
356
|
- list.forEach(item => {
|
|
|
357
|
- if (item.count > 1) {
|
|
|
358
|
- let str = item.array.resName + "的" + item.array.paramCode.split("-")[0] + "协议" + "侦测的" + item.array.port + "端口号已侦测";
|
|
|
359
|
- array.push(str);
|
208
|
+
|
|
|
209
|
+ //变更人员的弹框关闭后
|
|
|
210
|
+ let hideDialog =(flag)=>{
|
|
|
211
|
+ show.value=flag;
|
|
|
212
|
+ // getListData();
|
|
|
213
|
+ }
|
|
|
214
|
+ //变更人员的弹框保存后
|
|
|
215
|
+ let savebtn =(obj)=>{
|
|
|
216
|
+ show.value=false;
|
|
|
217
|
+ //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
|
|
|
218
|
+ console.log("&&&",obj)
|
|
|
219
|
+ getListData();
|
|
|
220
|
+ }
|
|
|
221
|
+ //获取资源类型数据
|
|
|
222
|
+ let getResourceTypoe=()=>{
|
|
|
223
|
+ proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) {
|
|
|
224
|
+ if (res && res.data) {
|
|
|
225
|
+ resTypeOptions.value=res.data
|
360
|
}
|
226
|
}
|
361
|
})
|
227
|
})
|
362
|
- }
|
|
|
363
|
-
|
|
|
364
|
|
228
|
|
|
|
229
|
+ }
|
365
|
//获取展示类型的字典数据
|
230
|
//获取展示类型的字典数据
|
366
|
let initShowType=()=>{
|
231
|
let initShowType=()=>{
|
367
|
proxy.$http.get("/api-web/manage/resource/getAllResByUser", {}, function (res) {
|
232
|
proxy.$http.get("/api-web/manage/resource/getAllResByUser", {}, function (res) {
|
|
@@ -379,34 +244,36 @@ export default { |
|
@@ -379,34 +244,36 @@ export default { |
379
|
}
|
244
|
}
|
380
|
})
|
245
|
})
|
381
|
}
|
246
|
}
|
382
|
-
|
|
|
383
|
// 挂载完
|
247
|
// 挂载完
|
384
|
Vue.onMounted(() => {
|
248
|
Vue.onMounted(() => {
|
385
|
- getListData({page: 1, limit: pageSize.value});
|
249
|
+ getResourceTypoe();
|
|
|
250
|
+ getListData();
|
386
|
})
|
251
|
})
|
387
|
return {
|
252
|
return {
|
|
|
253
|
+ isMulti,
|
|
|
254
|
+ isTwoGroup,
|
|
|
255
|
+ show,
|
388
|
initShowType,
|
256
|
initShowType,
|
389
|
showTypeList,
|
257
|
showTypeList,
|
390
|
search,
|
258
|
search,
|
391
|
resTypeOptions,
|
259
|
resTypeOptions,
|
392
|
-
|
260
|
+ changeCancel,
|
393
|
count,
|
261
|
count,
|
394
|
- portSenseConfigData,
|
262
|
+ hideDialog,
|
|
|
263
|
+ savebtn,
|
|
|
264
|
+ changeAdmin,
|
|
|
265
|
+ getResourceTypoe,
|
|
|
266
|
+
|
|
|
267
|
+ resourceData,
|
395
|
columns,
|
268
|
columns,
|
396
|
height,
|
269
|
height,
|
397
|
- pageSize,
|
|
|
398
|
loading,
|
270
|
loading,
|
399
|
|
271
|
|
400
|
selectionChange,
|
272
|
selectionChange,
|
401
|
- deleteItem,
|
|
|
402
|
- save,
|
273
|
+
|
403
|
getListData,
|
274
|
getListData,
|
404
|
loadTableDataList,
|
275
|
loadTableDataList,
|
405
|
- changePortSense,
|
|
|
406
|
- conserve,
|
|
|
407
|
- selectRes,
|
|
|
408
|
|
276
|
|
409
|
- portSenseSelectData
|
|
|
410
|
}
|
277
|
}
|
411
|
}
|
278
|
}
|
412
|
} |
279
|
} |