代码更新

This commit is contained in:
2022-12-08 14:41:24 +08:00
parent 7902ae10f6
commit 7e30b906d1
4 changed files with 11 additions and 21 deletions

View File

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
* @Description: 日志监控 * @Description: 日志监控
* @Date: 2022-08-15 * @Date: 2022-08-15
*/ */
//@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@Api(tags = "日志监控") @Api(tags = "日志监控")
@RequestMapping("/api/loki") @RequestMapping("/api/loki")

View File

@@ -1,6 +1,7 @@
package org.nl.modules.loki.service.impl; package org.nl.modules.loki.service.impl;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@@ -14,7 +15,7 @@ import org.springframework.stereotype.Service;
* @Description: 实现类 * @Description: 实现类
* @Date: 2022-08-15 * @Date: 2022-08-15
*/ */
//@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class LokiServiceImpl implements LokiService { public class LokiServiceImpl implements LokiService {
@@ -72,21 +73,12 @@ public class LokiServiceImpl implements LokiService {
*/ */
@Override @Override
public JSONArray getLabelsValues() { public JSONArray getLabelsValues() {
/**
* [{
* label:
* value:
* children:[{
* label
* value
* }]
* }]
*/
JSONArray result = new JSONArray(); JSONArray result = new JSONArray();
// 获取所有标签 // 获取所有标签
String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8); String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8);
JSONObject parse = (JSONObject) JSONObject.parse(labelString); JSONObject parse = (JSONObject) JSONObject.parse(labelString);
JSONArray labels = parse.getJSONArray("data"); JSONArray labels = parse.getJSONArray("data");
if (ObjectUtil.isEmpty(labels)) return null;
for (int i=0; i<labels.size(); i++) { for (int i=0; i<labels.size(); i++) {
// 获取标签下的所有值 // 获取标签下的所有值
String valueString = HttpUtil.get(lokiUrl + "/label/" + labels.getString(i) + "/values", CharsetUtil.CHARSET_UTF_8); String valueString = HttpUtil.get(lokiUrl + "/label/" + labels.getString(i) + "/values", CharsetUtil.CHARSET_UTF_8);

View File

@@ -52,7 +52,7 @@ public class UserRelateServiceImpl implements UserRelateService {
if (!CollectionUtils.isEmpty(userIds)){ if (!CollectionUtils.isEmpty(userIds)){
String collect = userIds.stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','")); String collect = userIds.stream().map(a -> String.valueOf(a)).collect(Collectors.joining("','"));
String sql="user_id in ('"+collect+"')"; String sql="user_id in ('"+collect+"')";
WQLObject.getWQLObject("sys_users_roles").delete(sql); WQLObject.getWQLObject("sys_user_dept").delete(sql);
} }
} }

View File

@@ -539,6 +539,7 @@ export default {
crudDept.getDeptTree().then(res => { crudDept.getDeptTree().then(res => {
this.deptsDatas = res.content this.deptsDatas = res.content
}) })
console.log(row)
this.nodeKey = 'dept_id' this.nodeKey = 'dept_id'
this.openDrawer() this.openDrawer()
this.drawerTitle = '分配部门权限' this.drawerTitle = '分配部门权限'
@@ -552,8 +553,8 @@ export default {
getAll().then(res => { getAll().then(res => {
this.rolesDatas = res this.rolesDatas = res
// 回显默认选中 // 回显默认选中
console.log(res) // console.log(res)
console.log(row.roles) // console.log(row)
this.$nextTick(function() { this.$nextTick(function() {
for (let i = 0; i < this.rolesDatas.length; i++) { for (let i = 0; i < this.rolesDatas.length; i++) {
for (let j = 0; j < row.roles.length; j++) { for (let j = 0; j < row.roles.length; j++) {
@@ -578,7 +579,7 @@ export default {
this.depCheckedId = row.user_id this.depCheckedId = row.user_id
}, },
clearCheck() { clearCheck() {
this.$refs.deptUser.setCheckedKeys([]) if (this.flag) this.$refs.deptUser.setCheckedKeys([])
}, },
handleClose(done) { handleClose(done) {
this.$confirm('确认关闭?') this.$confirm('确认关闭?')
@@ -600,9 +601,6 @@ export default {
} else { } else {
user.roles = this.crud.selections.map(item => (item.role_id)) user.roles = this.crud.selections.map(item => (item.role_id))
} }
console.log('user', user)
console.log(this.flag)
console.log(this.crud.selections)
crudUser.edit(user).then(res => { crudUser.edit(user).then(res => {
this.cancelForm() this.cancelForm()
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
@@ -611,7 +609,7 @@ export default {
}, },
// 覆盖原有勾选功能,父与子关联,子与父不关联 // 覆盖原有勾选功能,父与子关联,子与父不关联
handCheck(data, node) { handCheck(data, node) {
this.hanleCheck(data, node, 'tree') this.hanleCheck(data, node, 'deptUser')
}, },
hanleCheck(data, node, treeName) { hanleCheck(data, node, treeName) {
const _this = this const _this = this
@@ -637,7 +635,7 @@ export default {
const _this = this const _this = this
// console.log(data, checked, indeterminate); // console.log(data, checked, indeterminate);
// 选中全部子节点,父节点也默认选中,但是子节点再次取消勾选或者全部子节点取消勾选也不会影响父节点勾选状态 // 选中全部子节点,父节点也默认选中,但是子节点再次取消勾选或者全部子节点取消勾选也不会影响父节点勾选状态
const checkNode = _this.$refs.tree.getNode(data)// 获取当前节点 const checkNode = _this.$refs.deptUser.getNode(data)// 获取当前节点
// 勾选部分子节点,父节点变为半选状态 // 勾选部分子节点,父节点变为半选状态
if (checkNode.parent && checkNode.parent.childNodes.some(ele => ele.checked)) { if (checkNode.parent && checkNode.parent.childNodes.some(ele => ele.checked)) {
checkNode.parent.indeterminate = true checkNode.parent.indeterminate = true