后台管理添加体温上报
This commit is contained in:
parent
bad6ecb111
commit
fb10c7e666
@ -4,7 +4,8 @@ public enum FieldType {
|
||||
HIDDEN("null"),
|
||||
TEXT("plaintext"),
|
||||
LONG_TEXT("longtext"),
|
||||
IMAGE("image");
|
||||
IMAGE("image"),
|
||||
DATETIME("time");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
@ -3,7 +3,8 @@ package com.cxyxiaomo.epp.PageTable.enums;
|
||||
public enum SearchType {
|
||||
CAN_NOT_SEARCH("null"),
|
||||
INPUT("input"),
|
||||
SELECT("select");
|
||||
SELECT("select"),
|
||||
DATETIME_INTERVAL("time-interval");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
@ -7,6 +7,8 @@ import com.cxyxiaomo.epp.PageTable.enums.EditType;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.FieldType;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.SearchType;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class FieldBuilder {
|
||||
|
||||
public final static String SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME = "<SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME>";
|
||||
@ -70,7 +72,8 @@ public class FieldBuilder {
|
||||
jsonObject.put("editType", editType.getValue());
|
||||
jsonObject.put("editPlaceholder", EDIT_PLACEHOLDER_SAME_AS_ADD_PLACEHOLDER.equals(editPlaceholder) ? addPlaceholder : editPlaceholder);
|
||||
// 新增/修改时的前端表单验证
|
||||
jsonObject.put("validateRules", fieldRuleListBuilder.build());
|
||||
jsonObject.put("validateRules", Objects.nonNull(fieldRuleListBuilder)
|
||||
? fieldRuleListBuilder.build() : new JSONArray());
|
||||
// 新增弹窗 字段默认值
|
||||
jsonObject.put("default", defaultValue);
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.cxyxiaomo.epp.common.query;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
// 数据库关系映射
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true) // 链式写法
|
||||
// 微服务必须要实现Serializable
|
||||
public class ReportQuery implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String address;
|
||||
|
||||
private Long startTime, endTime;
|
||||
|
||||
private Integer temperature;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.cxyxiaomo.epp.common.vo;
|
||||
|
||||
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// 数据库关系映射
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true) // 链式写法
|
||||
// 微服务必须要实现Serializable
|
||||
public class ReportVO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String address;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
private Integer temperature;
|
||||
|
||||
public static ReportVO convertFrom(Report report) {
|
||||
if (report == null) {
|
||||
return null;
|
||||
}
|
||||
ReportVO reportVO = new ReportVO();
|
||||
BeanUtils.copyProperties(report, reportVO);
|
||||
Date time = report.getTime();
|
||||
reportVO.setTimestamp(time.getTime());
|
||||
return reportVO;
|
||||
}
|
||||
|
||||
public static List<ReportVO> convertFrom(List<Report> reportList) {
|
||||
if (reportList == null) {
|
||||
return null;
|
||||
}
|
||||
List<ReportVO> reportVOList = reportList.stream()
|
||||
.map(ReportVO::convertFrom).collect(Collectors.toList());
|
||||
return reportVOList;
|
||||
}
|
||||
|
||||
public static Report convertTo(ReportVO reportVO) {
|
||||
if (reportVO == null) {
|
||||
return null;
|
||||
}
|
||||
Report report = new Report();
|
||||
BeanUtils.copyProperties(reportVO, report);
|
||||
Long timestamp = reportVO.getTimestamp();
|
||||
if (timestamp != null) {
|
||||
Date date = new Date(timestamp);
|
||||
report.setTime(date);
|
||||
}
|
||||
return report;
|
||||
}
|
||||
}
|
@ -1,18 +1,31 @@
|
||||
package com.cxyxiaomo.epp.access.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.AddType;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.EditType;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.FieldType;
|
||||
import com.cxyxiaomo.epp.PageTable.enums.SearchType;
|
||||
import com.cxyxiaomo.epp.PageTable.query.PageQuery;
|
||||
import com.cxyxiaomo.epp.PageTable.utils.FieldBuilder;
|
||||
import com.cxyxiaomo.epp.PageTable.utils.FieldMapperBuilder;
|
||||
import com.cxyxiaomo.epp.access.rpc.UserServiceFeign;
|
||||
import com.cxyxiaomo.epp.access.service.ReportServiceImpl;
|
||||
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||
import com.cxyxiaomo.epp.common.pojo.User;
|
||||
import com.cxyxiaomo.epp.common.query.ReportQuery;
|
||||
import com.cxyxiaomo.epp.common.response.Res;
|
||||
import com.cxyxiaomo.epp.common.vo.ReportVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@ -78,6 +91,7 @@ public class ReportController {
|
||||
List<Report> records = reportService.getRecordListByUserId(user.getId());
|
||||
return Res.success(records);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最近一次用户填报信息
|
||||
*
|
||||
@ -94,4 +108,104 @@ public class ReportController {
|
||||
Report records = reportService.getLatestRecordByUserId(user.getId());
|
||||
return Res.success(records);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取体温数据列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/manage/getReportList")
|
||||
@ResponseBody
|
||||
public Res getReportList(PageQuery pageQuery, ReportQuery reportQuery) {
|
||||
// 查询分页数据
|
||||
PageHelper.startPage(pageQuery.getPageIndex(), pageQuery.getPageSize());
|
||||
List<Report> reportList = reportService.getReportList(reportQuery);
|
||||
PageInfo<Report> reportPageInfo = new PageInfo<>(reportList);
|
||||
List<Report> list = reportPageInfo.getList();
|
||||
List<ReportVO> voList = ReportVO.convertFrom(list);
|
||||
|
||||
// id列 字段名(区分大小写;以VO中的变量名为准)
|
||||
// 新增、修改弹窗时,使用该列作为主键列进行操作
|
||||
String idFieldName = "id";
|
||||
|
||||
// 当前管理页面
|
||||
String pageName = "体温上报管理";
|
||||
|
||||
// 指定前端表格显示列
|
||||
JSONArray columns = FieldBuilder.create()
|
||||
.add("timestamp", "timestamp", "打卡时间", "",
|
||||
FieldType.DATETIME, SearchType.DATETIME_INTERVAL, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT,
|
||||
FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME,
|
||||
null, null, null, null
|
||||
)
|
||||
.add("userId", "userId", "用户id", "",
|
||||
FieldType.TEXT, SearchType.INPUT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT,
|
||||
FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME,
|
||||
null, null, null, null
|
||||
)
|
||||
.add("name", "name", "用户姓名", "",
|
||||
FieldType.TEXT, SearchType.INPUT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT,
|
||||
FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME,
|
||||
null, null, null, null
|
||||
)
|
||||
.add("temperature", "displayTemperature", "状态", "",
|
||||
FieldType.TEXT, SearchType.SELECT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT,
|
||||
FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME,
|
||||
null, null, null, null
|
||||
)
|
||||
.add("address", "address", "地址", "",
|
||||
FieldType.LONG_TEXT, SearchType.INPUT, AddType.CAN_NOT_ADD, EditType.CAN_NOT_EDIT,
|
||||
FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME,
|
||||
null, null, null, null
|
||||
)
|
||||
.build();
|
||||
|
||||
// 指定需要翻译的字段
|
||||
HashMap<Object, Object> stateMap = new HashMap<>(2);
|
||||
stateMap.put("0", "正常");
|
||||
stateMap.put("1", "异常(≥37.3℃)");
|
||||
// build
|
||||
JSONArray fieldMapper = FieldMapperBuilder.create()
|
||||
.add("temperature", "displayTemperature", stateMap)
|
||||
.build();
|
||||
|
||||
// 拼装返回结果
|
||||
JSONObject map = new JSONObject(6);
|
||||
map.put("total", reportPageInfo.getTotal());
|
||||
map.put("list", voList);
|
||||
map.put("columns", columns);
|
||||
map.put("fieldMapper", fieldMapper);
|
||||
map.put("idFieldName", idFieldName);
|
||||
map.put("pageName", pageName);
|
||||
|
||||
map.put("pawQuery", pageName);
|
||||
|
||||
// 返回结果
|
||||
return Res.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/manage/exportReportList")
|
||||
@ResponseBody
|
||||
public Res exportReportList(ReportQuery reportQuery) {
|
||||
List<Report> reportList = reportService.getReportList(reportQuery);
|
||||
List<ReportVO> reportVOList = ReportVO.convertFrom(reportList);
|
||||
|
||||
// 当前时间
|
||||
Date now = Calendar.getInstance().getTime();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||
String dateTime = format.format(now);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("list", reportVOList);
|
||||
map.put("sheetName", "体温数据表-" + System.currentTimeMillis());
|
||||
map.put("fileName", "体温数据表_导出时间_" + dateTime);
|
||||
|
||||
return Res.success(map);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.cxyxiaomo.epp.access.dao;
|
||||
|
||||
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||
import com.cxyxiaomo.epp.common.query.ReportQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -14,4 +15,6 @@ public interface ReportDao {
|
||||
List<Report> getReportListByUserId(Integer userId);
|
||||
|
||||
Report getLatestReportByUserId(Integer userId);
|
||||
|
||||
public List<Report> getReportList(ReportQuery reportQuery);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.cxyxiaomo.epp.access.service;
|
||||
|
||||
import com.cxyxiaomo.epp.access.dao.ReportDao;
|
||||
import com.cxyxiaomo.epp.common.pojo.Report;
|
||||
import com.cxyxiaomo.epp.common.query.ReportQuery;
|
||||
import com.cxyxiaomo.epp.common.vo.ReportVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -18,11 +20,19 @@ public class ReportServiceImpl implements ReportService {
|
||||
reportDao.insert(report);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Report> getRecordListByUserId(Integer userId) {
|
||||
return reportDao.getReportListByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Report getLatestRecordByUserId(Integer userId) {
|
||||
return reportDao.getLatestReportByUserId(userId);
|
||||
}
|
||||
|
||||
|
||||
public List<Report> getReportList(ReportQuery reportQuery) {
|
||||
List<Report> reportList = reportDao.getReportList(reportQuery);
|
||||
return reportList;
|
||||
}
|
||||
}
|
||||
|
@ -21,3 +21,8 @@ spring:
|
||||
url: jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
|
||||
logging:
|
||||
level:
|
||||
org.mybatis.spring.SqlSessionFactoryBean: DEBUG
|
||||
# org.mybatis.spring.SqlSessionFactoryBean: TRACE
|
||||
|
@ -18,4 +18,33 @@
|
||||
order by time desc
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getReportList" resultType="com.cxyxiaomo.epp.common.pojo.Report">
|
||||
select *
|
||||
from report
|
||||
where 1 = 1
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
AND user_id = #{userId}
|
||||
</if>
|
||||
<if test="name != null && name != ''">
|
||||
AND name LIKE concat('%',#{name,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<!--<if test="timestamp != null">-->
|
||||
<!-- AND DATE_FORMAT(time, '%Y-%m-%d %H:%i:%s') = #{time, jdbcType=TIMESTAMP}-->
|
||||
<!--</if>-->
|
||||
<if test="startTime != null && endTime != null">
|
||||
AND time BETWEEN from_unixtime(#{startTime}/1000) AND from_unixtime(#{endTime}/1000)
|
||||
</if>
|
||||
<if test="temperature != null">
|
||||
AND temperature = #{temperature}
|
||||
</if>
|
||||
<if test="address != null && address != ''">
|
||||
AND address LIKE concat('%',#{address,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
ORDER BY time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -9,5 +9,9 @@
|
||||
|
||||
<!--下划线转小驼峰-->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
|
||||
<!-- 打印 SQL 日志 -->
|
||||
<!-- 设置logImpl为STDOUT_LOGGING,表示使用标准输出打印SQL日志 -->
|
||||
<setting name="logImpl" value="STDOUT_LOGGING"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
@ -96,6 +96,10 @@ public class GoodService {
|
||||
return goodDao.deleteGoodById(goodId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean addGoodCategory(GoodCategory goodCategory) {
|
||||
goodCategory.setId(null);
|
||||
return goodCategoryDao.addCategory(goodCategory);
|
||||
@ -110,6 +114,9 @@ public class GoodService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public GoodCategory getGoodCategoryById(Long id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
|
@ -11,7 +11,7 @@
|
||||
Target Server Version : 80012
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 29/03/2023 17:21:45
|
||||
Date: 14/04/2023 00:51:48
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@ -57,7 +57,7 @@ CREATE TABLE `community_gate1` (
|
||||
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '大门显示名称',
|
||||
`open` tinyint(1) NOT NULL DEFAULT 1 COMMENT '大门是否开放 1为开放 2为关闭',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社区大门' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社区大门' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of community_gate1
|
||||
@ -335,7 +335,7 @@ CREATE TABLE `report` (
|
||||
`temperature` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '体温是否正常',
|
||||
`address` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 62 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 71 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of report
|
||||
@ -347,6 +347,8 @@ INSERT INTO `report` VALUES (58, 3, '用户 密码user', '2022-12-29 18:20:00',
|
||||
INSERT INTO `report` VALUES (59, 3, '用户 密码user', '2023-03-17 00:27:21', '0', '湖北省武汉市洪山区雄楚大道珞狮南路南湖雅园F-4-106');
|
||||
INSERT INTO `report` VALUES (60, 3, '用户 密码user', '2023-03-20 00:47:22', '0', '湖北省武汉市武昌区武车路');
|
||||
INSERT INTO `report` VALUES (61, 3, '用户 密码user', '2023-03-23 22:24:14', '0', '湖北省武汉市武昌区修远路');
|
||||
INSERT INTO `report` VALUES (62, 3, '用户 密码user', '2023-03-13 22:54:12', '0', '湖北省武汉市洪山区文治街102-4号');
|
||||
INSERT INTO `report` VALUES (70, 3, '用户 密码user', '2023-04-14 00:36:55', '0', '湖北省武汉市洪山区文治街102-4号');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for role
|
||||
@ -356,7 +358,7 @@ CREATE TABLE `role` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'role_id',
|
||||
`role_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'roleName',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of role
|
||||
@ -402,7 +404,7 @@ CREATE TABLE `user` (
|
||||
`permission_time` datetime NULL DEFAULT NULL COMMENT '进出权限失效时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `username`(`username`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
|
1
frontend/components.d.ts
vendored
1
frontend/components.d.ts
vendored
@ -15,6 +15,7 @@ declare module '@vue/runtime-core' {
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||
|
41
frontend/src/api/report.js
Normal file
41
frontend/src/api/report.js
Normal file
@ -0,0 +1,41 @@
|
||||
import send_request from '../utils/send_request';
|
||||
|
||||
/**
|
||||
* 获取体温列表
|
||||
* @returns
|
||||
*/
|
||||
export function getReportList(params) {
|
||||
// 深拷贝一份,避免 删除 timestamp 时页面上的输入框也清空了
|
||||
// 但是 Date 类型的对象无法拷贝,所以还是获取深拷贝之间的
|
||||
let paramsCopy = JSON.parse(JSON.stringify(params))
|
||||
delete paramsCopy.timestamp
|
||||
if (Array.isArray(params.timestamp) && params.timestamp.length == 2) {
|
||||
paramsCopy.startTime = params.timestamp[0]?.getTime()
|
||||
paramsCopy.endTime = params.timestamp[1]?.getTime()
|
||||
}
|
||||
return send_request({
|
||||
url: '/access/report/manage/getReportList',
|
||||
method: 'GET',
|
||||
params: paramsCopy,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 导出体温列表
|
||||
* @returns
|
||||
*/
|
||||
export function exportReportList(params) {
|
||||
// 深拷贝一份,避免 删除 timestamp 时页面上的输入框也清空了
|
||||
// 但是 Date 类型的对象无法拷贝,所以还是获取深拷贝之间的
|
||||
let paramsCopy = JSON.parse(JSON.stringify(params))
|
||||
delete paramsCopy.timestamp
|
||||
if (Array.isArray(params.timestamp) && params.timestamp.length == 2) {
|
||||
paramsCopy.startTime = params.timestamp[0]?.getTime()
|
||||
paramsCopy.endTime = params.timestamp[1]?.getTime()
|
||||
}
|
||||
return send_request({
|
||||
url: '/access/report/manage/exportReportList',
|
||||
method: 'GET',
|
||||
params: paramsCopy,
|
||||
});
|
||||
};
|
@ -18,12 +18,17 @@
|
||||
<el-option v-for="optKey in Object.keys(field.options)" :key="optKey" :label="field.options[optKey]"
|
||||
:value="optKey"></el-option>
|
||||
</el-select>
|
||||
<el-date-picker v-else-if="field.searchType == 'time-interval'" v-model="query[field.field]"
|
||||
type="datetimerange" :shortcuts="dateTimePickerRangeShotcut" range-separator="至"
|
||||
:start-placeholder="field.placeholder + ' 起始时间'" :end-placeholder="field.placeholder + '结束时间'"
|
||||
:prefix-icon="Filter" style="width: 350px; margin-right: 10px;" />
|
||||
<template v-else>{{ field }}</template>
|
||||
</template>
|
||||
<el-button type="primary" :icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button type="primary" :icon="Plus" @click="handleNew" v-permiss="props.editPermiss">新增记录</el-button>
|
||||
<el-button type="primary" :icon="Download" @click="exportFormVisible = true"
|
||||
v-permiss="props.editPermiss">导出到文件</el-button>
|
||||
<el-button type="primary" :icon="Plus" @click="handleNew" v-permiss="props.editPermiss"
|
||||
v-if="props.addFunc">新增记录</el-button>
|
||||
<el-button type="primary" :icon="Download" @click="exportFormVisible = true" v-permiss="props.editPermiss"
|
||||
v-if="props.exportFunc">导出到文件</el-button>
|
||||
</div>
|
||||
<!-- 表格 -->
|
||||
<el-table :data="tableData" border class="table" ref="multipleTable" header-cell-class-name="table-header">
|
||||
@ -31,29 +36,34 @@
|
||||
<el-table-column v-for="(field, index) in tableFields" :prop="field.prop" :label="field.label" :key="index"
|
||||
align="center">
|
||||
<template #default="scope" v-if="field.type == 'image'">
|
||||
<el-image style="width: 100%; height: 100%;" :src="scope.row.picUrl" fit="cover" />
|
||||
<el-image style="width: 100%; height: 100%;" :src="scope.row[field.prop]" fit="cover" />
|
||||
</template>
|
||||
<template #default="scope" v-else-if="field.type == 'time'">
|
||||
{{
|
||||
new Date(scope.row[field.prop] + 8 * 3600 * 1000).toISOString().replace('T', ' ').substring(0,19)
|
||||
}}
|
||||
</template>
|
||||
<template #default="scope" v-else-if="field.type == 'longtext'">
|
||||
<el-tooltip placement="top">
|
||||
<template #content>
|
||||
<p v-for="line in scope.row.detail.split(/[\r\n]/g)" style="max-width: 300px;">
|
||||
<p v-for="line in scope.row[field.prop].split(/[\r\n]/g)" style="max-width: 300px;">
|
||||
{{ line }}
|
||||
</p>
|
||||
</template>
|
||||
<div class="oneLine">
|
||||
{{scope.row.detail}}
|
||||
{{ scope.row[field.prop] }}
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="220" align="center">
|
||||
<el-table-column label="操作" width="220" align="center" v-if="props.editFunc || props.deleteFunc">
|
||||
<template #default="scope">
|
||||
<el-button text :icon="Edit" @click="handleEdit(scope.$index, scope.row)"
|
||||
v-permiss="props.editPermiss">
|
||||
v-permiss="props.editPermiss" v-if="props.editFunc">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button text :icon="Delete" class="red" @click="handleDelete(scope.$index, scope.row)"
|
||||
v-permiss="props.editPermiss">
|
||||
v-permiss="props.editPermiss" v-if="props.deleteFunc">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@ -144,17 +154,17 @@ const props = defineProps({
|
||||
// 新增 接口函数
|
||||
'addFunc': {
|
||||
type: Function,
|
||||
required: true,
|
||||
required: false,
|
||||
},
|
||||
// 修改 接口函数
|
||||
'editFunc': {
|
||||
type: Function,
|
||||
required: true,
|
||||
required: false,
|
||||
},
|
||||
// 修改 接口函数
|
||||
// 删除 接口函数
|
||||
'deleteFunc': {
|
||||
type: Function,
|
||||
required: true,
|
||||
required: false,
|
||||
},
|
||||
// 导出 接口函数
|
||||
'exportFunc': {
|
||||
@ -330,6 +340,7 @@ const getData = async () => {
|
||||
|
||||
// 测试数据
|
||||
mockData = data.columns
|
||||
.filter((field: any) => field.mockRegex)
|
||||
.map((field: any) => {
|
||||
let spaceIndex = field.mockRegex.indexOf(' ')
|
||||
if (spaceIndex == -1) return
|
||||
@ -577,6 +588,73 @@ const doMockData = (isEdit: boolean) => {
|
||||
onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 附加内容
|
||||
const dateTimePickerRangeShotcut = [
|
||||
{
|
||||
text: '今天',
|
||||
value: () => {
|
||||
const start = new Date()
|
||||
start.setHours(0)
|
||||
start.setMinutes(0)
|
||||
start.setSeconds(0)
|
||||
start.setMilliseconds(0)
|
||||
const end = new Date(start.getTime() + 24 * 3600 * 1000)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '昨天',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
end.setHours(0)
|
||||
end.setMinutes(0)
|
||||
end.setSeconds(0)
|
||||
end.setMilliseconds(0)
|
||||
const start = new Date(end.getTime() - 24 * 3600 * 1000)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '过去24小时',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '过去7天',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '过去30天',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '过去90天',
|
||||
value: () => {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||
return [start, end]
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="sidebar">
|
||||
<el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="sidebar.collapse" background-color="#324157"
|
||||
text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router>
|
||||
<el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="sidebar.collapse"
|
||||
:default-openeds="activeItemList" background-color="#324157" text-color="#bfcbd9" active-text-color="#20a0ff"
|
||||
router>
|
||||
<template v-for="item in items">
|
||||
<template v-if="item.subs">
|
||||
<el-sub-menu :index="item.index" :key="item.index" v-permiss="item.permiss">
|
||||
@ -11,18 +12,9 @@
|
||||
</el-icon>
|
||||
<span>{{ item.title }}</span>
|
||||
</template>
|
||||
<template v-for="subItem in item.subs">
|
||||
<el-sub-menu v-if="subItem.subs" :index="subItem.index" :key="subItem.index"
|
||||
v-permiss="item.permiss">
|
||||
<template #title>{{ subItem.title }}</template>
|
||||
<el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">
|
||||
{{ threeItem.title }}
|
||||
</el-menu-item>
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-else :index="subItem.index" v-permiss="item.permiss">
|
||||
<el-menu-item v-for="subItem in item.subs" :index="subItem.index" v-permiss="item.permiss">
|
||||
{{ subItem.title }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-sub-menu>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -39,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useSidebarStore } from '../store/sidebar';
|
||||
import { useRoute } from 'vue-router';
|
||||
import settings from '../utils/settings';
|
||||
@ -53,20 +45,15 @@ const items = [
|
||||
permiss: 'dashboard',
|
||||
},
|
||||
{
|
||||
icon: 'BellFilled',
|
||||
index: '/warning',
|
||||
title: '预警信息',
|
||||
permiss: 'warning',
|
||||
icon: 'OfficeBuilding',
|
||||
index: '/report',
|
||||
title: '体温上报',
|
||||
permiss: 'report',
|
||||
subs: [
|
||||
{
|
||||
index: '/warning-view',
|
||||
title: '总览',
|
||||
permiss: 'warning-view',
|
||||
},
|
||||
{
|
||||
index: '/warning-setting',
|
||||
title: '预警设置',
|
||||
permiss: 'warning-setting',
|
||||
index: '/report-setting',
|
||||
title: '体温管理',
|
||||
permiss: 'report-setting',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -109,6 +96,9 @@ const onRoutes = computed(() => {
|
||||
});
|
||||
|
||||
const sidebar = useSidebarStore();
|
||||
|
||||
// 默认全部展开
|
||||
const activeItemList = items.map((i) => i.index)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -31,6 +31,15 @@ const routes: RouteRecordRaw[] = [
|
||||
},
|
||||
component: () => import('../views/shop-good-setting.vue'),
|
||||
},
|
||||
{
|
||||
path: '/report-setting',
|
||||
name: 'report-setting',
|
||||
meta: {
|
||||
title: '体温管理',
|
||||
permiss: 'report-setting',
|
||||
},
|
||||
component: () => import('../views/report-setting.vue'),
|
||||
},
|
||||
{
|
||||
path: '/shop-cate-setting',
|
||||
name: 'shop-cate-setting',
|
||||
|
@ -15,6 +15,9 @@ export const usePermissStore = defineStore('permiss', {
|
||||
|
||||
"dashboard",
|
||||
|
||||
"report",
|
||||
"report-setting",
|
||||
|
||||
"shop",
|
||||
"shop-good-setting",
|
||||
"shop-cate-setting",
|
||||
@ -29,6 +32,9 @@ export const usePermissStore = defineStore('permiss', {
|
||||
|
||||
"dashboard",
|
||||
|
||||
"report",
|
||||
"report-setting",
|
||||
|
||||
"shop",
|
||||
"shop-good-setting",
|
||||
"shop-cate-setting",
|
||||
@ -38,9 +44,4 @@ export const usePermissStore = defineStore('permiss', {
|
||||
]
|
||||
};
|
||||
},
|
||||
// actions: {
|
||||
// handleSet(val: string[]) {
|
||||
// this.key = val;
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
11
frontend/src/views/report-setting.vue
Normal file
11
frontend/src/views/report-setting.vue
Normal file
@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<manageList :list-func="reportApi.getReportList" :export-func="reportApi.exportReportList"
|
||||
edit-permiss="privilege-user-setting" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import manageList from '../components/manage-list.vue';
|
||||
import * as reportApi from '../api/report';
|
||||
</script>
|
@ -23,6 +23,9 @@ Page({
|
||||
// 是否填报过
|
||||
isFilled: true,
|
||||
filledMsg: "",
|
||||
|
||||
// 是否正在提交中,用于隐藏提交按钮,避免出现多次提交
|
||||
isSubmitting: false,
|
||||
},
|
||||
|
||||
/**
|
||||
@ -240,6 +243,9 @@ Page({
|
||||
title: '加载中'
|
||||
})
|
||||
var that = this;
|
||||
that.setData({
|
||||
isSubmitting: true,
|
||||
})
|
||||
wx.request({
|
||||
url: `${app.globalData.baseUrl}/access/report/submit`,
|
||||
method: "POST",
|
||||
@ -286,6 +292,9 @@ Page({
|
||||
console.log("end fail")
|
||||
},
|
||||
complete: function () {
|
||||
that.setData({
|
||||
isSubmitting: false,
|
||||
})
|
||||
console.log("begin complete")
|
||||
if (typeof (callback) === "function")
|
||||
callback();
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
<view style="text-align: center;">
|
||||
<button class="controlBtn" size="mini" type="none" bindtap="myreport">历史填报</button>
|
||||
<button class="controlBtn" size="mini" type="primary" bindtap="report">提交</button>
|
||||
<button class="controlBtn" size="mini" type="primary" bindtap="report" disabled="{{isSubmitting}}">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else style="text-align: center;">
|
||||
|
Loading…
Reference in New Issue
Block a user