大屏页面初始化
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 获取指标信息列表
|
||||
*/
|
||||
export function getHomeModuleList(params) {
|
||||
return request({
|
||||
url: '/biz/homeModuleUser/list',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指标信息列表
|
||||
*/
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
<div
|
||||
class="tab-item"
|
||||
v-for="tab in allTabs"
|
||||
:key="tab.key"
|
||||
:class="{ active: activeTab === tab.key }"
|
||||
@click="switchTab(tab.key)"
|
||||
:key="tab.moduleCode"
|
||||
:class="{ active: activeTab === tab.moduleCode }"
|
||||
@click="switchTab(tab.moduleCode)"
|
||||
>
|
||||
<span>{{ tab.name }}</span>
|
||||
<span>{{ tab.moduleName }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="query-group">
|
||||
@@ -35,7 +35,7 @@
|
||||
<div v-else-if="activeTab === 'work'" class="screen-page">
|
||||
<WorkIndex :formParams="FormValues" />
|
||||
</div>
|
||||
<div v-else-if="activeTab === 'erp'" class="screen-page">
|
||||
<div v-else-if="activeTab === 'werp'" class="screen-page">
|
||||
<ErpIndex :formParams="FormValues" />
|
||||
</div>
|
||||
</main>
|
||||
@@ -48,18 +48,16 @@ import HomeIndex from './screen/Home/index.vue';
|
||||
import ErpIndex from './screen/Erp/index.vue';
|
||||
import WorkIndex from './screen/Work/index.vue';
|
||||
|
||||
const screenTitle = ref('数字化可视化看板');
|
||||
import { getHomeModuleList } from '@/api/bizApi'
|
||||
|
||||
const screenTitle = ref('个人数字化可视化看板');
|
||||
const currentYear = new Date().getFullYear().toString();
|
||||
|
||||
const FormValues = ref({
|
||||
reqParam: currentYear
|
||||
});
|
||||
|
||||
const allTabs = [
|
||||
{ key: 'home', name: '首页' },
|
||||
{ key: 'work', name: '工作' },
|
||||
{ key: 'erp', name: '财务' },
|
||||
]
|
||||
const allTabs = ref([])
|
||||
|
||||
const activeTab = ref('home')
|
||||
const queryDate = ref();
|
||||
@@ -72,8 +70,20 @@ const handleQuery = () => {
|
||||
FormValues.value.reqParam = queryDate.value;
|
||||
}
|
||||
|
||||
|
||||
async function getList() {
|
||||
try {
|
||||
const res = await getHomeModuleList()
|
||||
allTabs.value = res || []
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
vList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const initApp = () =>{
|
||||
queryDate.value = currentYear;
|
||||
getList();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mini.mybigscreen.biz.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/biz/homeModule")
|
||||
public class HomeModuleController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mini.mybigscreen.biz.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mini.mybigscreen.Model.Result;
|
||||
import com.mini.mybigscreen.biz.domain.HomeModule;
|
||||
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
||||
import com.mini.mybigscreen.biz.domain.HomeUser;
|
||||
import com.mini.mybigscreen.biz.service.HomeModuleService;
|
||||
import com.mini.mybigscreen.biz.service.HomeModuleUserService;
|
||||
import com.mini.mybigscreen.biz.service.HomeUserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/biz/homeModuleUser")
|
||||
public class HomeModuleUserController {
|
||||
|
||||
|
||||
@Resource
|
||||
private HomeUserService userService;
|
||||
|
||||
@Resource
|
||||
private HomeModuleService moduleService;
|
||||
|
||||
@Resource
|
||||
private HomeModuleUserService moduleUserService;
|
||||
|
||||
|
||||
@GetMapping("list")
|
||||
public Result<List<HomeModule>> getList(HttpServletRequest request) {
|
||||
HttpSession session = request.getSession(false);
|
||||
String userName = (String) session.getAttribute("userName");
|
||||
QueryWrapper<HomeUser> userQuery = new QueryWrapper<>();
|
||||
userQuery.eq("user_name", userName);
|
||||
HomeUser user = userService.getOne(userQuery);
|
||||
QueryWrapper<HomeModuleUser> moduleUserQuery = new QueryWrapper<>();
|
||||
moduleUserQuery.eq("user_id", user.getUserId())
|
||||
.eq("ustatus","1");
|
||||
List<HomeModuleUser> homeModuleUserList = moduleUserService.list(moduleUserQuery);
|
||||
QueryWrapper<HomeModule> moduleQuery = new QueryWrapper<>();
|
||||
moduleQuery.in("module_id", homeModuleUserList.stream()
|
||||
.map(HomeModuleUser::getModuleId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
return Result.success(moduleService.list(moduleQuery));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mini.mybigscreen.biz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("biz_home_module")
|
||||
public class HomeModule implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableId(value = "module_id", type = IdType.AUTO)
|
||||
private String moduleId;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
@TableField("module_name")
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 模块编码
|
||||
*/
|
||||
@TableField("module_code")
|
||||
private String moduleCode;
|
||||
|
||||
/**
|
||||
* 说明描述
|
||||
*/
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mini.mybigscreen.biz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("biz_home_module_user")
|
||||
public class HomeModuleUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private String id;
|
||||
|
||||
@TableField("user_id")
|
||||
private String userId;
|
||||
|
||||
@TableField("module_id")
|
||||
private String moduleId;
|
||||
|
||||
@TableField("ustatus")
|
||||
private Integer ustatus;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.mapper;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModule;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface HomeModuleMapper extends BaseMapper<HomeModule> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.mapper;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface HomeModuleUserMapper extends BaseMapper<HomeModuleUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.service;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModule;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface HomeModuleService extends IService<HomeModule> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mini.mybigscreen.biz.service;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
public interface HomeModuleUserService extends IService<HomeModuleUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mini.mybigscreen.biz.service.impl;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModule;
|
||||
import com.mini.mybigscreen.biz.mapper.HomeModuleMapper;
|
||||
import com.mini.mybigscreen.biz.service.HomeModuleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Service
|
||||
public class HomeModuleServiceImpl extends ServiceImpl<HomeModuleMapper, HomeModule> implements HomeModuleService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mini.mybigscreen.biz.service.impl;
|
||||
|
||||
import com.mini.mybigscreen.biz.domain.HomeModuleUser;
|
||||
import com.mini.mybigscreen.biz.mapper.HomeModuleUserMapper;
|
||||
import com.mini.mybigscreen.biz.service.HomeModuleUserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author gaoxq
|
||||
* @since 2026-02-27
|
||||
*/
|
||||
@Service
|
||||
public class HomeModuleUserServiceImpl extends ServiceImpl<HomeModuleUserMapper, HomeModuleUser> implements HomeModuleUserService {
|
||||
|
||||
}
|
||||
19
src/main/resources/mapper/HomeModuleMapper.xml
Normal file
19
src/main/resources/mapper/HomeModuleMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mini.mybigscreen.biz.mapper.HomeModuleMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.mini.mybigscreen.biz.domain.HomeModule">
|
||||
<id column="module_id" property="moduleId" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="module_name" property="moduleName" />
|
||||
<result column="module_code" property="moduleCode" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, module_id, module_name, module_code, remark
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
19
src/main/resources/mapper/HomeModuleUserMapper.xml
Normal file
19
src/main/resources/mapper/HomeModuleUserMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mini.mybigscreen.biz.mapper.HomeModuleUserMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.mini.mybigscreen.biz.domain.HomeModuleUser">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="module_id" property="moduleId" />
|
||||
<result column="ustatus" property="ustatus" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
create_time, id, user_id, module_id, ustatus
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user