Merge branch 'master' of https://gitee.com/darlk/ShengTangManage into xzj
This commit is contained in:
		| @@ -472,11 +472,15 @@ public class WechatAppletController extends BaseController { | |||||||
|                 curWxUserInfo.setSex(customerPhysicalSigns.getSex().toString()); |                 curWxUserInfo.setSex(customerPhysicalSigns.getSex().toString()); | ||||||
|                 curWxUserInfo.setHeight(customerPhysicalSigns.getTall()); |                 curWxUserInfo.setHeight(customerPhysicalSigns.getTall()); | ||||||
|                 curWxUserInfo.setAge(customerPhysicalSigns.getAge()); |                 curWxUserInfo.setAge(customerPhysicalSigns.getAge()); | ||||||
|  |                 curWxUserInfo.setStartDate(customerPhysicalSigns.getCreateTime()); | ||||||
|  |                 curWxUserInfo.setWeight(customerPhysicalSigns.getWeight()); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             curWxUserInfo.setSex(customerHealthy.getSex().toString()); |             curWxUserInfo.setSex(customerHealthy.getSex().toString()); | ||||||
|             curWxUserInfo.setHeight(customerHealthy.getTall()); |             curWxUserInfo.setHeight(customerHealthy.getTall()); | ||||||
|             curWxUserInfo.setAge(Math.toIntExact(customerHealthy.getAge())); |             curWxUserInfo.setAge(Math.toIntExact(customerHealthy.getAge())); | ||||||
|  |             curWxUserInfo.setStartDate(customerHealthy.getCreateTime()); | ||||||
|  |             curWxUserInfo.setWeight(customerHealthy.getWeight()); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); |         curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| package com.stdiet.common.utils.oss; | package com.stdiet.common.utils.oss; | ||||||
|  |  | ||||||
|  | import com.aliyun.oss.OSS; | ||||||
|  | import com.aliyun.oss.OSSClientBuilder; | ||||||
| import com.aliyun.oss.model.GetObjectRequest; | import com.aliyun.oss.model.GetObjectRequest; | ||||||
| import com.aliyun.oss.model.OSSObject; | import com.aliyun.oss.model.OSSObject; | ||||||
| import com.stdiet.common.config.AliyunOSSConfig; | import com.stdiet.common.config.AliyunOSSConfig; | ||||||
| @@ -7,9 +9,6 @@ import com.stdiet.common.utils.StringUtils; | |||||||
| import com.stdiet.common.utils.file.FileUtils; | import com.stdiet.common.utils.file.FileUtils; | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
| import com.aliyun.oss.OSS; |  | ||||||
| import com.aliyun.oss.OSSClientBuilder; |  | ||||||
|  |  | ||||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||||
| import java.io.File; | import java.io.File; | ||||||
| @@ -25,6 +24,7 @@ public class AliyunOSSUtils { | |||||||
|  |  | ||||||
|     //默认文件路径前缀 |     //默认文件路径前缀 | ||||||
|     private static final String default_prefix = "https://stdiet.oss-cn-shenzhen.aliyuncs.com"; |     private static final String default_prefix = "https://stdiet.oss-cn-shenzhen.aliyuncs.com"; | ||||||
|  |     private static final String default_prefix2 = "https://v.stdiet.top"; | ||||||
|  |  | ||||||
|     public static OSS getOssClient() { |     public static OSS getOssClient() { | ||||||
|         return new OSSClientBuilder().build(AliyunOSSConfig.EndPoint, AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret); |         return new OSSClientBuilder().build(AliyunOSSConfig.EndPoint, AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret); | ||||||
| @@ -83,6 +83,7 @@ public class AliyunOSSUtils { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * MultipartFile2File |      * MultipartFile2File | ||||||
|  |      * | ||||||
|      * @param multipartFile |      * @param multipartFile | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
| @@ -95,11 +96,11 @@ public class AliyunOSSUtils { | |||||||
|             //获取最后一个"."的位置 |             //获取最后一个"."的位置 | ||||||
|             int cutPoint = originalFilename.lastIndexOf("."); |             int cutPoint = originalFilename.lastIndexOf("."); | ||||||
|             //获取文件名 |             //获取文件名 | ||||||
|             String prefix = originalFilename.substring(0,cutPoint); |             String prefix = originalFilename.substring(0, cutPoint); | ||||||
|             //获取后缀名 |             //获取后缀名 | ||||||
|             String suffix = originalFilename.substring(cutPoint + 1); |             String suffix = originalFilename.substring(cutPoint + 1); | ||||||
|             //创建临时文件,prefix最少三位 |             //创建临时文件,prefix最少三位 | ||||||
|             file = File.createTempFile((prefix != null && prefix.length() >= 3 ? prefix : prefix+"ab"), suffix); |             file = File.createTempFile((prefix != null && prefix.length() >= 3 ? prefix : prefix + "ab"), suffix); | ||||||
|             //multipartFile2file |             //multipartFile2file | ||||||
|             multipartFile.transferTo(file); |             multipartFile.transferTo(file); | ||||||
|             //删除临时文件 |             //删除临时文件 | ||||||
| @@ -122,7 +123,8 @@ public class AliyunOSSUtils { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 上传文件流 |      * 上传文件流 | ||||||
|      * @param prefix 路径的前缀路径目录 |      * | ||||||
|  |      * @param prefix       路径的前缀路径目录 | ||||||
|      * @param oranFileName 上传到服务器上的文件路径和名称 |      * @param oranFileName 上传到服务器上的文件路径和名称 | ||||||
|      * @param file         来自本地的文件或者文件流 |      * @param file         来自本地的文件或者文件流 | ||||||
|      */ |      */ | ||||||
| @@ -152,7 +154,8 @@ public class AliyunOSSUtils { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 上传文件流 |      * 上传文件流 | ||||||
|      * @param prefix 路径的前缀路径目录 |      * | ||||||
|  |      * @param prefix       路径的前缀路径目录 | ||||||
|      * @param oranFileName 上传到服务器上的文件路径和名称 |      * @param oranFileName 上传到服务器上的文件路径和名称 | ||||||
|      * @param file         来自本地的文件或者文件流 |      * @param file         来自本地的文件或者文件流 | ||||||
|      */ |      */ | ||||||
| @@ -204,7 +207,7 @@ public class AliyunOSSUtils { | |||||||
|     /** |     /** | ||||||
|      * 从OSS中下载一个文件流 |      * 从OSS中下载一个文件流 | ||||||
|      * |      * | ||||||
|      * @param fileURL       文件的url |      * @param fileURL 文件的url | ||||||
|      */ |      */ | ||||||
|     public static void downloadFile(String fileURL, String fileName, HttpServletRequest request, HttpServletResponse response) throws IOException { |     public static void downloadFile(String fileURL, String fileName, HttpServletRequest request, HttpServletResponse response) throws IOException { | ||||||
|  |  | ||||||
| @@ -223,19 +226,18 @@ public class AliyunOSSUtils { | |||||||
|         response.setContentType("multipart/form-data"); |         response.setContentType("multipart/form-data"); | ||||||
|         response.setHeader("Content-Disposition", |         response.setHeader("Content-Disposition", | ||||||
|                 "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, fileName)); |                 "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, fileName)); | ||||||
|         FileUtils.writeBytes(streamData , response.getOutputStream()); |         FileUtils.writeBytes(streamData, response.getOutputStream()); | ||||||
|  |  | ||||||
|         // 关闭OSSClient。 |         // 关闭OSSClient。 | ||||||
|         ossClient.shutdown(); |         ossClient.shutdown(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * |  | ||||||
|      * @param fileUrl |      * @param fileUrl | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public static String generatePresignedUrl(String fileUrl){ |     public static String generatePresignedUrl(String fileUrl) { | ||||||
|         if(!isAliyunUrl(fileUrl)) { |         if (!isAliyunUrl(fileUrl)) { | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         // 创建OSSClient实例。 |         // 创建OSSClient实例。 | ||||||
| @@ -252,11 +254,10 @@ public class AliyunOSSUtils { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * |  | ||||||
|      * @param fileUrlList |      * @param fileUrlList | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public static List<String> generatePresignedUrl(List<String> fileUrlList){ |     public static List<String> generatePresignedUrl(List<String> fileUrlList) { | ||||||
|         List<String> downUrlList = new ArrayList<>(); |         List<String> downUrlList = new ArrayList<>(); | ||||||
|  |  | ||||||
|         // 创建OSSClient实例。 |         // 创建OSSClient实例。 | ||||||
| @@ -265,7 +266,7 @@ public class AliyunOSSUtils { | |||||||
|         Date expiration = new Date(System.currentTimeMillis() + expire); |         Date expiration = new Date(System.currentTimeMillis() + expire); | ||||||
|  |  | ||||||
|         for (String fileUrl : fileUrlList) { |         for (String fileUrl : fileUrlList) { | ||||||
|             if(isAliyunUrl(fileUrl)){ |             if (isAliyunUrl(fileUrl)) { | ||||||
|                 String url = ossClient.generatePresignedUrl(AliyunOSSConfig.Buckets, getObjectName(fileUrl), expiration).toString(); |                 String url = ossClient.generatePresignedUrl(AliyunOSSConfig.Buckets, getObjectName(fileUrl), expiration).toString(); | ||||||
|                 downUrlList.add(url); |                 downUrlList.add(url); | ||||||
|             } |             } | ||||||
| @@ -279,19 +280,19 @@ public class AliyunOSSUtils { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 判断是否为阿里云OSS路径格式 |      * 判断是否为阿里云OSS路径格式 | ||||||
|  |      * | ||||||
|      * @param fileUrl |      * @param fileUrl | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public static boolean isAliyunUrl(String fileUrl){ |     public static boolean isAliyunUrl(String fileUrl) { | ||||||
|         return StringUtils.isNotEmpty(fileUrl) && fileUrl.startsWith(default_prefix); |         return StringUtils.isNotEmpty(fileUrl) && (fileUrl.startsWith(default_prefix) || fileUrl.startsWith(default_prefix2)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * |  | ||||||
|      * @param fileUrlList |      * @param fileUrlList | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     public static Map<String, List<String>> generatePresignedUrl(Map<String, List<String>> fileUrlList){ |     public static Map<String, List<String>> generatePresignedUrl(Map<String, List<String>> fileUrlList) { | ||||||
|         Map<String, List<String>> downUrlMap = new HashMap<>(); |         Map<String, List<String>> downUrlMap = new HashMap<>(); | ||||||
|  |  | ||||||
|         // 创建OSSClient实例。 |         // 创建OSSClient实例。 | ||||||
| @@ -303,7 +304,7 @@ public class AliyunOSSUtils { | |||||||
|             List<String> urlList = fileUrlList.get(key); |             List<String> urlList = fileUrlList.get(key); | ||||||
|             List<String> downList = new ArrayList<>(); |             List<String> downList = new ArrayList<>(); | ||||||
|             for (String fileUrl : urlList) { |             for (String fileUrl : urlList) { | ||||||
|                 if(isAliyunUrl(fileUrl)){ |                 if (isAliyunUrl(fileUrl)) { | ||||||
|                     downList.add(ossClient.generatePresignedUrl(AliyunOSSConfig.Buckets, getObjectName(fileUrl), expiration).toString()); |                     downList.add(ossClient.generatePresignedUrl(AliyunOSSConfig.Buckets, getObjectName(fileUrl), expiration).toString()); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; | |||||||
| import com.stdiet.common.annotation.Excel; | import com.stdiet.common.annotation.Excel; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.math.BigDecimal; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| @@ -62,7 +63,7 @@ public class SysCustomerPhysicalSigns { | |||||||
|      * 客户体重(斤) |      * 客户体重(斤) | ||||||
|      */ |      */ | ||||||
|     @Excel(name = "客户体重", readConverterExp = "斤=") |     @Excel(name = "客户体重", readConverterExp = "斤=") | ||||||
|     private Integer weight; |     private BigDecimal weight; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 客户病史体征id |      * 客户病史体征id | ||||||
|   | |||||||
| @@ -1,9 +1,11 @@ | |||||||
| package com.stdiet.custom.domain; | package com.stdiet.custom.domain; | ||||||
|  |  | ||||||
|  | import com.fasterxml.jackson.annotation.JsonFormat; | ||||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | import com.fasterxml.jackson.annotation.JsonIgnore; | ||||||
| import com.stdiet.common.annotation.Excel; | import com.stdiet.common.annotation.Excel; | ||||||
| import lombok.Data; | import lombok.Data; | ||||||
|  |  | ||||||
|  | import java.math.BigDecimal; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -28,6 +30,11 @@ public class SysWxUserInfo { | |||||||
|  |  | ||||||
|     private Integer age; |     private Integer age; | ||||||
|  |  | ||||||
|  |     @JsonFormat(pattern = "yyyy-MM-dd") | ||||||
|  |     private Date startDate; | ||||||
|  |  | ||||||
|  |     private BigDecimal weight; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 昵称 |      * 昵称 | ||||||
|      */ |      */ | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ import lombok.Data; | |||||||
|  |  | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
|  |  | ||||||
|  | @Data | ||||||
| public class VideoResponse implements Serializable { | public class VideoResponse implements Serializable { | ||||||
|  |  | ||||||
|     private static final long serialVersionUID = 1L; |     private static final long serialVersionUID = 1L; | ||||||
| @@ -26,47 +27,11 @@ public class VideoResponse implements Serializable { | |||||||
|     // 播放等级 |     // 播放等级 | ||||||
|     private Integer playLevel; |     private Integer playLevel; | ||||||
|  |  | ||||||
|     public void setPlayLevel(Integer playLevel) { |     public void setCoverUrl(String coverUrl) { | ||||||
|         this.playLevel = playLevel; |         if (StringUtils.isNotEmpty(coverUrl)) { | ||||||
|     } |             this.coverUrl = AliyunOSSUtils.generatePresignedUrl(coverUrl); | ||||||
|  |  | ||||||
|     public Integer getPlayLevel() { |  | ||||||
|         return playLevel; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getVideoId() { |  | ||||||
|         return videoId; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setVideoId(String videoId) { |  | ||||||
|         this.videoId = videoId; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getTitle() { |  | ||||||
|         return title; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setTitle(String title) { |  | ||||||
|         this.title = title; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public String getCoverUrl() { |  | ||||||
|         if (StringUtils.isNotEmpty(this.coverUrl)) { |  | ||||||
|             return AliyunOSSUtils.generatePresignedUrl(this.coverUrl); |  | ||||||
|         } else { |         } else { | ||||||
|             return AliyunVideoUtils.getVideoCoverUrl(this.videoId); |             this.coverUrl = AliyunVideoUtils.getVideoCoverUrl(this.videoId); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setCoverUrl(String coverUrl) { |  | ||||||
|         this.coverUrl = coverUrl; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public Integer getPlayNum() { |  | ||||||
|         return playNum; |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public void setPlayNum(Integer playNum) { |  | ||||||
|         this.playNum = playNum; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -208,7 +208,7 @@ public class SysCustomerHeatStatisticsServiceImpl implements ISysCustomerHeatSta | |||||||
|             sysCustomerHealthy.setName(sysCustomerPhysicalSigns.getName()); |             sysCustomerHealthy.setName(sysCustomerPhysicalSigns.getName()); | ||||||
|             sysCustomerHealthy.setTall(sysCustomerPhysicalSigns.getTall()); |             sysCustomerHealthy.setTall(sysCustomerPhysicalSigns.getTall()); | ||||||
|             sysCustomerHealthy.setAge(sysCustomerPhysicalSigns.getAge().longValue()); |             sysCustomerHealthy.setAge(sysCustomerPhysicalSigns.getAge().longValue()); | ||||||
|             sysCustomerHealthy.setWeight(BigDecimal.valueOf(sysCustomerPhysicalSigns.getWeight())); |             sysCustomerHealthy.setWeight(sysCustomerPhysicalSigns.getWeight()); | ||||||
|         } |         } | ||||||
|         return sysCustomerHealthy; |         return sysCustomerHealthy; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ | |||||||
|     "clipboard": "^2.0.6", |     "clipboard": "^2.0.6", | ||||||
|     "core-js": "3.6.5", |     "core-js": "3.6.5", | ||||||
|     "dayjs": "^1.9.1", |     "dayjs": "^1.9.1", | ||||||
|     "echarts": "4.7.0", |     "echarts": "4.9.0", | ||||||
|     "element-ui": "2.13.2", |     "element-ui": "2.13.2", | ||||||
|     "file-saver": "^2.0.5", |     "file-saver": "^2.0.5", | ||||||
|     "fuse.js": "3.4.4", |     "fuse.js": "3.4.4", | ||||||
|   | |||||||
							
								
								
									
										126
									
								
								stdiet-ui/src/components/PunchLog/CursorChartView/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								stdiet-ui/src/components/PunchLog/CursorChartView/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | |||||||
|  | <template> | ||||||
|  |   <div | ||||||
|  |     class="chart_style_wrapper" | ||||||
|  |     ref="echart" | ||||||
|  |     :style="{ height: height, width: width }" | ||||||
|  |   /> | ||||||
|  | </template> | ||||||
|  | <script> | ||||||
|  | import echarts from "echarts"; | ||||||
|  | import _ from "lodash"; | ||||||
|  | require("@/utils/echarts/myShine"); | ||||||
|  | import resize from "@/views/dashboard/mixins/resize"; | ||||||
|  | export default { | ||||||
|  |   mixins: [resize], | ||||||
|  |   name: "CursorChartView", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       chart: undefined, | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     data: { | ||||||
|  |       type: Array, | ||||||
|  |       default: [], | ||||||
|  |     }, | ||||||
|  |     width: { | ||||||
|  |       type: String, | ||||||
|  |       default: "100%", | ||||||
|  |     }, | ||||||
|  |     height: { | ||||||
|  |       type: String, | ||||||
|  |       default: "30px", | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.$nextTick(() => { | ||||||
|  |       this.initChart(); | ||||||
|  |     }); | ||||||
|  |   }, | ||||||
|  |   unmounted() {}, | ||||||
|  |   methods: { | ||||||
|  |     initChart() { | ||||||
|  |       this.chart = echarts.init(this.$refs.echart, "myShine"); | ||||||
|  |       this.chart.on("datazoom", _.debounce(this.handleOnChartDatazoom, 200)); | ||||||
|  |       if (this.data.length > 0) { | ||||||
|  |         this.updateChart(this.data); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     updateChart(source) { | ||||||
|  |       const option = { | ||||||
|  |         yAxis: { show: false }, | ||||||
|  |         grid: { | ||||||
|  |           top: 0, | ||||||
|  |           left: 10, | ||||||
|  |           right: 10, | ||||||
|  |           bottom: 7, | ||||||
|  |           containLabel: true, | ||||||
|  |         }, | ||||||
|  |         xAxis: { | ||||||
|  |           type: "category", | ||||||
|  |           inverse: true, | ||||||
|  |           nameTextStyle: { | ||||||
|  |             color: "#fff", | ||||||
|  |           }, | ||||||
|  |           axisLine: { | ||||||
|  |             show: false, | ||||||
|  |           }, | ||||||
|  |           axisTick: { | ||||||
|  |             show: false, | ||||||
|  |           }, | ||||||
|  |           axisLabel: { | ||||||
|  |             textStyle: { | ||||||
|  |               color: "#fff", | ||||||
|  |             }, | ||||||
|  |             formatter: (val) => val.substr(5).replace("-", "/"), | ||||||
|  |           }, | ||||||
|  |           data: source.map((obj) => obj.name), | ||||||
|  |         }, | ||||||
|  |         dataZoom: { | ||||||
|  |           type: "slider", | ||||||
|  |           show: true, | ||||||
|  |           zoomLock: true, | ||||||
|  |           startValue: 0, | ||||||
|  |           endValue: 6, | ||||||
|  |           height: 16, | ||||||
|  |           bottom: 6, | ||||||
|  |           textStyle: { | ||||||
|  |             color: "#fff", | ||||||
|  |           }, | ||||||
|  |           handleStyle: { | ||||||
|  |             borderColor: "#fff", | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|  |       // console.log({ option }); | ||||||
|  |       this.chart.clear(); | ||||||
|  |  | ||||||
|  |       this.chart.setOption(option); | ||||||
|  |     }, | ||||||
|  |     handleOnChartDatazoom(params) { | ||||||
|  |       window.postMessage({ | ||||||
|  |         type: "PUNCH_LINE_CHART_MESSAGE_DATAZOOM", | ||||||
|  |         end: params.end, | ||||||
|  |         keyVal: "cursor", | ||||||
|  |         start: params.start, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     data(newVal, oldVal) { | ||||||
|  |       if (newVal) { | ||||||
|  |         this.$nextTick(() => { | ||||||
|  |           this.updateChart(newVal); | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .chart_style_wrapper { | ||||||
|  |   background: #4b8aff; | ||||||
|  |   position: absolute; | ||||||
|  |   top: 48px; | ||||||
|  | } | ||||||
|  | </style> | ||||||
| @@ -6,169 +6,152 @@ | |||||||
|     @closed="handleOnClosed" |     @closed="handleOnClosed" | ||||||
|     size="45%" |     size="45%" | ||||||
|   > |   > | ||||||
|     <div class="app-container punchLog_drawer_wrapper"> |     <div class="punchLog_drawer_wrapper" v-loading="loading"> | ||||||
|       <div class="header"> |       <div v-if="data.length"> | ||||||
|         <section> |         <CursorChartView :data="getChartData('weight')" /> | ||||||
|           <el-button icon="el-icon-view" size="mini" @click="showPunchLogChart()" |  | ||||||
|             >体重趋势图 |  | ||||||
|           </el-button> |  | ||||||
|         </section> |  | ||||||
|         <section> |  | ||||||
|           <el-button |  | ||||||
|             icon="el-icon-refresh" |  | ||||||
|             size="mini" |  | ||||||
|             @click="getList" |  | ||||||
|             circle |  | ||||||
|           /> |  | ||||||
|         </section> |  | ||||||
|       </div> |  | ||||||
|  |  | ||||||
|       <el-table :data="punchLogList" v-loading="planLoading" height="80%"> |         <el-button | ||||||
|         <el-table-column label="打卡日期" align="center"  prop="logTime"/> |           icon="el-icon-view" | ||||||
|         <el-table-column label="体重(斤)" align="center"  prop="weight"/> |           size="mini" | ||||||
|         <el-table-column label="饮水量(ml)" align="center"  prop="water"/> |           class="weigth_trend_button" | ||||||
|         <el-table-column label="营养师" align="center" prop="nutritionist" /> |           :style="`left: ${getTextWidth(title) + 30}px`" | ||||||
|         <el-table-column label="售后" align="center" prop="afterNutritionist" /> |           @click="showPunchLogChart()" | ||||||
|         <el-table-column label="操作" align="center" width="160"> |           >体重趋势图</el-button | ||||||
|           <template slot-scope="scope"> |         > | ||||||
|             <el-button |  | ||||||
|             size="mini" |         <div | ||||||
|             type="text" |           class="chart_zone_style" | ||||||
|             @click="showPunchLogDetail(scope.row)" |           v-for="chart in chartList" | ||||||
|             v-hasPermi="['custom:wxUserLog:query']" |           :key="chart.keyVal" | ||||||
|             >详情 |         > | ||||||
|           </el-button> |           <LineChartView | ||||||
|           <el-button |             v-if="chart.keyVal" | ||||||
|             size="mini" |             v-bind="chart" | ||||||
|             type="text" |             :data="getChartData(chart.keyVal)" | ||||||
|             icon="el-icon-edit" |             @onClick="handleOnChartClick" | ||||||
|             @click="handleUpdate(scope.row)" |           /> | ||||||
|             v-hasPermi="['custom:wxUserLog:edit']" |         </div> | ||||||
|             >修改 |       </div> | ||||||
|           </el-button> |       <div v-else class="empty_style">暂无打卡记录</div> | ||||||
|             <el-button |  | ||||||
|               type="text" |  | ||||||
|               icon="el-icon-delete" |  | ||||||
|               v-hasPermi="['custom:wxUserLog:remove']" |  | ||||||
|               @click="handleOnDelete(scope.row)" |  | ||||||
|               >删除</el-button |  | ||||||
|             > |  | ||||||
|           </template> |  | ||||||
|         </el-table-column> |  | ||||||
|       </el-table> |  | ||||||
|       <pagination |  | ||||||
|       v-show="total > 0" |  | ||||||
|       :total="total" |  | ||||||
|       :page.sync="queryParams.pageNum" |  | ||||||
|       :limit.sync="queryParams.pageSize" |  | ||||||
|       @pagination="getList" |  | ||||||
|     /> |  | ||||||
|     </div> |     </div> | ||||||
|     <!-- 详情 --> |     <!-- 详情 --> | ||||||
|     <PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail> |     <PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail> | ||||||
|     <!-- 编辑 --> |  | ||||||
|     <PunchLogEdit ref="punchLogEditRef"></PunchLogEdit> |  | ||||||
|     <!-- 体重趋势图 --> |     <!-- 体重趋势图 --> | ||||||
|     <PunchLogChart ref="punchLogChartRef"></PunchLogChart> |     <PunchLogChart ref="punchLogChartRef"></PunchLogChart> | ||||||
|   </el-drawer> |   </el-drawer> | ||||||
| </template> | </template> | ||||||
| <script> | <script> | ||||||
| import { | import { listWxUserLog } from "@/api/custom/wxUserLog"; | ||||||
|   addWxUserLog, | import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer"; | ||||||
|   delWxUserLog, | import LineChartView from "../LineChartView"; | ||||||
|   exportWxUserLog, | import CursorChartView from "../CursorChartView"; | ||||||
|   getWxUserLog, |  | ||||||
|   listWxUserLog, |  | ||||||
|   updateWxUserLog, |  | ||||||
| } from "@/api/custom/wxUserLog"; |  | ||||||
| import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; | import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; | ||||||
| import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; |  | ||||||
| import PunchLogChart from "@/components/PunchLog/PunchLogChart"; | import PunchLogChart from "@/components/PunchLog/PunchLogChart"; | ||||||
| import dayjs from "dayjs"; |  | ||||||
| export default { | export default { | ||||||
|   name: "CustomerPunchLog", |   name: "punchLog", | ||||||
|   components: { |   components: { | ||||||
|     PunchLogDetail,PunchLogEdit,PunchLogChart |     LineChartView, | ||||||
|  |     CursorChartView, | ||||||
|  |     PunchLogDetail, | ||||||
|  |     PunchLogChart, | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       open: false, |  | ||||||
|       visible: false, |       visible: false, | ||||||
|       title: "", |       title: "", | ||||||
|       planLoading: false, |       loading: false, | ||||||
|       data: null, |       userObj: null, | ||||||
|       punchLogList: [], |       sex: 0, | ||||||
|       total: 0, |       data: [], | ||||||
|       // 查询参数 |       // prettier-ignore | ||||||
|       queryParams: { |       chartList: [ | ||||||
|         pageNum: 1, |         {}, | ||||||
|         pageSize: 10, |         { label: "体重", keyVal: "weight", unit: "斤", extra: undefined }, | ||||||
|         customerId: null |         { label: "饮水量", keyVal: "water", unit: "毫升", extra: undefined }, | ||||||
|       }, |         { label: "入睡时间", keyVal: "sleepTime", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "起床时间", keyVal: "wakeupTime", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "熬夜失眠", keyVal: "insomnia", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "运动锻炼", keyVal: "sport", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "情绪状况", keyVal: "emotion", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "排便情况", keyVal: "defecation", unit: undefined, extra: undefined }, | ||||||
|  |         { label: "按营养餐吃", keyVal: "diet", unit: undefined, extra: undefined }, | ||||||
|  |       ], | ||||||
|     }; |     }; | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     showDrawer(data) { |     showDrawer(data) { | ||||||
|       // console.log(data); |       if (!data) { | ||||||
|       this.data = data; |         return; | ||||||
|       if (this.data == undefined || this.data == null) { |  | ||||||
|         return;      |  | ||||||
|       } |       } | ||||||
|       this.punchLogList = []; |  | ||||||
|       this.total = 0; |  | ||||||
|       this.visible = true; |       this.visible = true; | ||||||
|       this.title = `「${this.data.name}」打卡记录`; |       this.userObj = data; | ||||||
|       this.getList(); |       this.title = `「${this.userObj.name}」打卡情况`; | ||||||
|  |  | ||||||
|  |       this.fetchLogDatas(); | ||||||
|     }, |     }, | ||||||
|     getList() { |     handleOnClosed() { | ||||||
|       this.planLoading = true; |       this.userObj = undefined; | ||||||
|       this.queryParams.customerId = this.data.id; |     }, | ||||||
|       listWxUserLog(this.queryParams).then((response) => { |     showPunchLogChart() { | ||||||
|         if(response.code == 200){ |       this.$refs.punchLogChartRef.showDialog(this.userObj); | ||||||
|           this.punchLogList = response.rows; |     }, | ||||||
|           this.total = response.total; |     getTextWidth(text) { | ||||||
|  |       const canvas = document.createElement("canvas"); | ||||||
|  |       document.body.appendChild(canvas); | ||||||
|  |       const ctx = canvas.getContext("2d"); | ||||||
|  |       ctx.font = "16px Arial"; | ||||||
|  |       const { width } = ctx.measureText(text); | ||||||
|  |       document.body.removeChild(canvas); | ||||||
|  |       return Math.ceil(width); | ||||||
|  |     }, | ||||||
|  |     fetchLogDatas() { | ||||||
|  |       this.loading = true; | ||||||
|  |       getCustomerPhysicalSignsByCusId(this.userObj.id).then((res) => { | ||||||
|  |         if (res.data.customerHealthy) { | ||||||
|  |           this.sex = res.data.customerHealthy.sex; | ||||||
|  |           this.chartList[0] = this.sex | ||||||
|  |             ? { | ||||||
|  |                 label: "生理期", | ||||||
|  |                 keyVal: "menstrualPeriod", | ||||||
|  |                 unit: undefined, | ||||||
|  |                 extra: undefined, | ||||||
|  |               } | ||||||
|  |             : {}; | ||||||
|  |           this.chartList[1].extra = `初始体重:${res.data.customerHealthy.weight}斤`; | ||||||
|         } |         } | ||||||
|         this.planLoading = false; |         listWxUserLog({ | ||||||
|  |           customerId: this.userObj.id, | ||||||
|  |         }).then((res) => { | ||||||
|  |           if (res.code === 200) { | ||||||
|  |             this.data = res.rows; | ||||||
|  |           } | ||||||
|  |           this.loading = false; | ||||||
|  |         }); | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     reset() { |     getChartData(key) { | ||||||
|        |       return this.data.map((obj) => { | ||||||
|  |         let value = obj[key]; | ||||||
|  |         value === "Y" && (value = "是"); | ||||||
|  |         value === "N" && (value = "否"); | ||||||
|  |         return { | ||||||
|  |           id: obj.id, | ||||||
|  |           name: obj.logTime, | ||||||
|  |           value, | ||||||
|  |         }; | ||||||
|  |       }); | ||||||
|     }, |     }, | ||||||
|     handleOnClosed(){ |     handleOnChartClick(id) { | ||||||
|       this.data = null |       // console.log(id); | ||||||
|     }, |       const tarData = this.data.find((obj) => obj.id === id); | ||||||
|     showPunchLogDetail(data){ |       tarData && | ||||||
|         this.$refs.punchLogDetailRef.showDialog(data); |         this.$refs.punchLogDetailRef.showDialog({ | ||||||
|     }, |           sex: this.sex, | ||||||
|     showPunchLogChart(){ |           ...tarData, | ||||||
|         this.$refs.punchLogChartRef.showDialog(this.data); |  | ||||||
|     }, |  | ||||||
|     handleUpdate(data){ |  | ||||||
|         this.$refs.punchLogEditRef.showDialog(data, () => { |  | ||||||
|           this.getList(); |  | ||||||
|         }); |         }); | ||||||
|     }, |     }, | ||||||
|     /** 删除按钮操作 */ |  | ||||||
|     handleOnDelete(row) { |  | ||||||
|       const ids = row.id; |  | ||||||
|       this.$confirm( |  | ||||||
|         '是否确定删除该用户' + row.logTime + '的打卡记录?', |  | ||||||
|         "警告", |  | ||||||
|         { |  | ||||||
|           confirmButtonText: "确定", |  | ||||||
|           cancelButtonText: "取消", |  | ||||||
|           type: "warning", |  | ||||||
|         } |  | ||||||
|       ) |  | ||||||
|         .then(function () { |  | ||||||
|           return delWxUserLog(ids); |  | ||||||
|         }) |  | ||||||
|         .then(() => { |  | ||||||
|           this.getList(); |  | ||||||
|           this.msgSuccess("删除成功"); |  | ||||||
|         }) |  | ||||||
|         .catch(function () {}); |  | ||||||
|     }, |  | ||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
| </script> | </script> | ||||||
| @@ -178,13 +161,22 @@ export default { | |||||||
| } | } | ||||||
|  |  | ||||||
| .punchLog_drawer_wrapper { | .punchLog_drawer_wrapper { | ||||||
|  |   overflow: auto; | ||||||
|   height: calc(100vh - 77px); |   height: calc(100vh - 77px); | ||||||
|  |  | ||||||
|   .header { |   .chart_zone_style { | ||||||
|     margin-bottom: 8px; |     margin: 16px; | ||||||
|     display: flex; |     border-radius: 8px; | ||||||
|     align-items: center; |     overflow: hidden; | ||||||
|     justify-content: space-between; |   } | ||||||
|  |  | ||||||
|  |   .empty_style { | ||||||
|  |     text-align: center; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   .weigth_trend_button { | ||||||
|  |     position: absolute; | ||||||
|  |     top: 16px; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| </style> | </style> | ||||||
|   | |||||||
							
								
								
									
										190
									
								
								stdiet-ui/src/components/PunchLog/CustomerPunchLog/index1.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										190
									
								
								stdiet-ui/src/components/PunchLog/CustomerPunchLog/index1.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,190 @@ | |||||||
|  | <template> | ||||||
|  |   <el-drawer | ||||||
|  |     :title="title" | ||||||
|  |     :close-on-press-escape="false" | ||||||
|  |     :visible.sync="visible" | ||||||
|  |     @closed="handleOnClosed" | ||||||
|  |     size="45%" | ||||||
|  |   > | ||||||
|  |     <div class="app-container punchLog_drawer_wrapper"> | ||||||
|  |       <div class="header"> | ||||||
|  |         <section> | ||||||
|  |           <el-button icon="el-icon-view" size="mini" @click="showPunchLogChart()" | ||||||
|  |             >体重趋势图 | ||||||
|  |           </el-button> | ||||||
|  |         </section> | ||||||
|  |         <section> | ||||||
|  |           <el-button | ||||||
|  |             icon="el-icon-refresh" | ||||||
|  |             size="mini" | ||||||
|  |             @click="getList" | ||||||
|  |             circle | ||||||
|  |           /> | ||||||
|  |         </section> | ||||||
|  |       </div> | ||||||
|  |  | ||||||
|  |       <el-table :data="punchLogList" v-loading="planLoading" height="80%"> | ||||||
|  |         <el-table-column label="打卡日期" align="center"  prop="logTime"/> | ||||||
|  |         <el-table-column label="体重(斤)" align="center"  prop="weight"/> | ||||||
|  |         <el-table-column label="饮水量(ml)" align="center"  prop="water"/> | ||||||
|  |         <el-table-column label="营养师" align="center" prop="nutritionist" /> | ||||||
|  |         <el-table-column label="售后" align="center" prop="afterNutritionist" /> | ||||||
|  |         <el-table-column label="操作" align="center" width="160"> | ||||||
|  |           <template slot-scope="scope"> | ||||||
|  |             <el-button | ||||||
|  |             size="mini" | ||||||
|  |             type="text" | ||||||
|  |             @click="showPunchLogDetail(scope.row)" | ||||||
|  |             v-hasPermi="['custom:wxUserLog:query']" | ||||||
|  |             >详情 | ||||||
|  |           </el-button> | ||||||
|  |           <el-button | ||||||
|  |             size="mini" | ||||||
|  |             type="text" | ||||||
|  |             icon="el-icon-edit" | ||||||
|  |             @click="handleUpdate(scope.row)" | ||||||
|  |             v-hasPermi="['custom:wxUserLog:edit']" | ||||||
|  |             >修改 | ||||||
|  |           </el-button> | ||||||
|  |             <el-button | ||||||
|  |               type="text" | ||||||
|  |               icon="el-icon-delete" | ||||||
|  |               v-hasPermi="['custom:wxUserLog:remove']" | ||||||
|  |               @click="handleOnDelete(scope.row)" | ||||||
|  |               >删除</el-button | ||||||
|  |             > | ||||||
|  |           </template> | ||||||
|  |         </el-table-column> | ||||||
|  |       </el-table> | ||||||
|  |       <pagination | ||||||
|  |       v-show="total > 0" | ||||||
|  |       :total="total" | ||||||
|  |       :page.sync="queryParams.pageNum" | ||||||
|  |       :limit.sync="queryParams.pageSize" | ||||||
|  |       @pagination="getList" | ||||||
|  |     /> | ||||||
|  |     </div> | ||||||
|  |     <!-- 详情 --> | ||||||
|  |     <PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail> | ||||||
|  |     <!-- 编辑 --> | ||||||
|  |     <PunchLogEdit ref="punchLogEditRef"></PunchLogEdit> | ||||||
|  |     <!-- 体重趋势图 --> | ||||||
|  |     <PunchLogChart ref="punchLogChartRef"></PunchLogChart> | ||||||
|  |   </el-drawer> | ||||||
|  | </template> | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   addWxUserLog, | ||||||
|  |   delWxUserLog, | ||||||
|  |   exportWxUserLog, | ||||||
|  |   getWxUserLog, | ||||||
|  |   listWxUserLog, | ||||||
|  |   updateWxUserLog, | ||||||
|  | } from "@/api/custom/wxUserLog"; | ||||||
|  | import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; | ||||||
|  | import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; | ||||||
|  | import PunchLogChart from "@/components/PunchLog/PunchLogChart"; | ||||||
|  | import dayjs from "dayjs"; | ||||||
|  | export default { | ||||||
|  |   name: "CustomerPunchLog", | ||||||
|  |   components: { | ||||||
|  |     PunchLogDetail,PunchLogEdit,PunchLogChart | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       open: false, | ||||||
|  |       visible: false, | ||||||
|  |       title: "", | ||||||
|  |       planLoading: false, | ||||||
|  |       data: null, | ||||||
|  |       punchLogList: [], | ||||||
|  |       total: 0, | ||||||
|  |       // 查询参数 | ||||||
|  |       queryParams: { | ||||||
|  |         pageNum: 1, | ||||||
|  |         pageSize: 10, | ||||||
|  |         customerId: null | ||||||
|  |       }, | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     showDrawer(data) { | ||||||
|  |       // console.log(data); | ||||||
|  |       this.data = data; | ||||||
|  |       if (this.data == undefined || this.data == null) { | ||||||
|  |         return;      | ||||||
|  |       } | ||||||
|  |       this.punchLogList = []; | ||||||
|  |       this.total = 0; | ||||||
|  |       this.visible = true; | ||||||
|  |       this.title = `「${this.data.name}」打卡记录`; | ||||||
|  |       this.getList(); | ||||||
|  |     }, | ||||||
|  |     getList() { | ||||||
|  |       this.planLoading = true; | ||||||
|  |       this.queryParams.customerId = this.data.id; | ||||||
|  |       listWxUserLog(this.queryParams).then((response) => { | ||||||
|  |         if(response.code == 200){ | ||||||
|  |           this.punchLogList = response.rows; | ||||||
|  |           this.total = response.total; | ||||||
|  |         } | ||||||
|  |         this.planLoading = false; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     reset() { | ||||||
|  |        | ||||||
|  |     }, | ||||||
|  |     handleOnClosed(){ | ||||||
|  |       this.data = null | ||||||
|  |     }, | ||||||
|  |     showPunchLogDetail(data){ | ||||||
|  |         this.$refs.punchLogDetailRef.showDialog(data); | ||||||
|  |     }, | ||||||
|  |     showPunchLogChart(){ | ||||||
|  |         this.$refs.punchLogChartRef.showDialog(this.data); | ||||||
|  |     }, | ||||||
|  |     handleUpdate(data){ | ||||||
|  |         this.$refs.punchLogEditRef.showDialog(data, () => { | ||||||
|  |           this.getList(); | ||||||
|  |         }); | ||||||
|  |     }, | ||||||
|  |     /** 删除按钮操作 */ | ||||||
|  |     handleOnDelete(row) { | ||||||
|  |       const ids = row.id; | ||||||
|  |       this.$confirm( | ||||||
|  |         '是否确定删除该用户' + row.logTime + '的打卡记录?', | ||||||
|  |         "警告", | ||||||
|  |         { | ||||||
|  |           confirmButtonText: "确定", | ||||||
|  |           cancelButtonText: "取消", | ||||||
|  |           type: "warning", | ||||||
|  |         } | ||||||
|  |       ) | ||||||
|  |         .then(function () { | ||||||
|  |           return delWxUserLog(ids); | ||||||
|  |         }) | ||||||
|  |         .then(() => { | ||||||
|  |           this.getList(); | ||||||
|  |           this.msgSuccess("删除成功"); | ||||||
|  |         }) | ||||||
|  |         .catch(function () {}); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | /deep/ :focus { | ||||||
|  |   outline: 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .punchLog_drawer_wrapper { | ||||||
|  |   height: calc(100vh - 77px); | ||||||
|  |  | ||||||
|  |   .header { | ||||||
|  |     margin-bottom: 8px; | ||||||
|  |     display: flex; | ||||||
|  |     align-items: center; | ||||||
|  |     justify-content: space-between; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | </style> | ||||||
							
								
								
									
										189
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/chartUtils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/chartUtils.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,189 @@ | |||||||
|  | import { iconDict } from "./utils"; | ||||||
|  |  | ||||||
|  | function getComOption(title, data) { | ||||||
|  |   return { | ||||||
|  |     title: { | ||||||
|  |       text: title, | ||||||
|  |       left: 5, | ||||||
|  |       top: 8, | ||||||
|  |       textStyle: { | ||||||
|  |         // color: "#fff" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     textStyle: { | ||||||
|  |       // fontFamily: "monospace" | ||||||
|  |     }, | ||||||
|  |     tooltip: { | ||||||
|  |       show: true, | ||||||
|  |       trigger: "axis", | ||||||
|  |       axisPointer: { | ||||||
|  |         lineStyle: { | ||||||
|  |           type: "dashed" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     grid: { | ||||||
|  |       top: 40, | ||||||
|  |       left: 10, | ||||||
|  |       right: 20, | ||||||
|  |       bottom: 10, | ||||||
|  |       containLabel: true | ||||||
|  |     }, | ||||||
|  |     dataZoom: { | ||||||
|  |       type: "slider", | ||||||
|  |       show: false, | ||||||
|  |       zoomLock: true, | ||||||
|  |       startValue: 0, | ||||||
|  |       endValue: 6, | ||||||
|  |       height: 16, | ||||||
|  |       bottom: 8, | ||||||
|  |       textStyle: { | ||||||
|  |         color: "#fff" | ||||||
|  |       }, | ||||||
|  |       handleStyle: { | ||||||
|  |         // borderColor: "#fff" | ||||||
|  |       } | ||||||
|  |       // filterMode: 'none', | ||||||
|  |     }, | ||||||
|  |     graphic: [], | ||||||
|  |     xAxis: { | ||||||
|  |       type: "category", | ||||||
|  |       inverse: true, | ||||||
|  |       nameTextStyle: { | ||||||
|  |         // color: "#fff" | ||||||
|  |       }, | ||||||
|  |       axisLine: { | ||||||
|  |         show: false | ||||||
|  |       }, | ||||||
|  |       axisTick: { | ||||||
|  |         show: false | ||||||
|  |       }, | ||||||
|  |       axisLabel: { | ||||||
|  |         textStyle: { | ||||||
|  |           // color: "#fff" | ||||||
|  |         }, | ||||||
|  |         formatter: val => val.substr(5).replace("-", "/") | ||||||
|  |       }, | ||||||
|  |       data: data.map(obj => obj.name) | ||||||
|  |     }, | ||||||
|  |     yAxis: { | ||||||
|  |       type: "value", | ||||||
|  |       axisLine: { | ||||||
|  |         show: false | ||||||
|  |       }, | ||||||
|  |       axisLabel: { | ||||||
|  |         textStyle: { | ||||||
|  |           // color: "#fff" | ||||||
|  |         } | ||||||
|  |       }, | ||||||
|  |       axisTick: { | ||||||
|  |         show: false | ||||||
|  |       }, | ||||||
|  |       splitLine: { | ||||||
|  |         show: false | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     series: [ | ||||||
|  |       { | ||||||
|  |         type: "line", | ||||||
|  |         lineStyle: { | ||||||
|  |           color: "#FF6E67" | ||||||
|  |         }, | ||||||
|  |         itemStyle: { | ||||||
|  |           color: "#333" | ||||||
|  |         } | ||||||
|  |         // data, | ||||||
|  |       } | ||||||
|  |     ] | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function getOption(type, data, title, unit, extra) { | ||||||
|  |   const option = getComOption(title, data); | ||||||
|  |   option.tooltip.formatter = params => { | ||||||
|  |     const [param] = params; | ||||||
|  |     let value = param.data.oriValue; | ||||||
|  |     // console.log({ type, value }); | ||||||
|  |     unit && (value += unit); | ||||||
|  |     return [`日期:${param.data.name}`, `${title}:${value}`].join("</br>"); | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  |   if (unit) { | ||||||
|  |     option.graphic.push({ | ||||||
|  |       type: "text", | ||||||
|  |       right: 30, | ||||||
|  |       top: 16, | ||||||
|  |       style: { | ||||||
|  |         text: `单位:${unit}`, | ||||||
|  |         // fill: "#fff" | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |   if (extra) { | ||||||
|  |     option.graphic.push({ | ||||||
|  |       type: "text", | ||||||
|  |       right: 30, | ||||||
|  |       top: 36, | ||||||
|  |       style: { | ||||||
|  |         text: extra, | ||||||
|  |         // fill: "#fff" | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |   if (type === "water" || type === "weight") { | ||||||
|  |     option.yAxis.max = value => Math.floor(value.max * 1.5); | ||||||
|  |     option.yAxis.min = value => Math.floor(value.min * 0.5); | ||||||
|  |     option.yAxis.splitNumber = 1; | ||||||
|  |     option.series[0].data = data.map(obj => ({ | ||||||
|  |       ...obj, | ||||||
|  |       label: { show: true }, | ||||||
|  |       oriValue: obj.value, | ||||||
|  |       formatter: ({ value }) => (type === "water" ? `${value / 1000}升` : value) | ||||||
|  |     })); | ||||||
|  |   } else if (type === "sleepTime" || type === "wakeupTime") { | ||||||
|  |     option.yAxis.max = 24; | ||||||
|  |     option.yAxis.min = 0; | ||||||
|  |     option.yAxis.minInterval = 6; | ||||||
|  |     option.series[0].data = data.map(obj => { | ||||||
|  |       const [hour, minute] = obj.value.split(":"); | ||||||
|  |       return { | ||||||
|  |         ...obj, | ||||||
|  |         oriValue: obj.value, | ||||||
|  |         value: parseInt(hour) + parseFloat(minute) / 60 | ||||||
|  |       }; | ||||||
|  |     }); | ||||||
|  |   } else if ( | ||||||
|  |     type === "emotion" || | ||||||
|  |     type === "insomnia" || | ||||||
|  |     type === "sport" || | ||||||
|  |     type === "diet" || | ||||||
|  |     type === "defecation" || | ||||||
|  |     type === "menstrualPeriod" | ||||||
|  |   ) { | ||||||
|  |     const tarObj = iconDict[type]; | ||||||
|  |     const range = Object.keys(tarObj); | ||||||
|  |     option.grid.left = -20; | ||||||
|  |  | ||||||
|  |     // if (type !== 'emotion' && type !== 'defecation') { | ||||||
|  |     option.yAxis.axisLabel.formatter = value => { | ||||||
|  |       return range[value]; | ||||||
|  |     }; | ||||||
|  |     // } else { | ||||||
|  |     // option.yAxis.axisLabel.show = false; | ||||||
|  |     // } | ||||||
|  |  | ||||||
|  |     option.yAxis.max = range.length - 0.5; | ||||||
|  |     option.yAxis.min = -0.5; | ||||||
|  |     option.series[0].data = data.map(obj => ({ | ||||||
|  |       ...obj, | ||||||
|  |       value: range.indexOf(obj.value), | ||||||
|  |       oriValue: obj.value, | ||||||
|  |       symbol: tarObj[obj.value] ? tarObj[obj.value].imgData : "", | ||||||
|  |       symbolSize: 20 | ||||||
|  |     })); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return option; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | export { getOption }; | ||||||
							
								
								
									
										149
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,149 @@ | |||||||
|  | <template> | ||||||
|  |   <div | ||||||
|  |     class="chart_style_wrapper" | ||||||
|  |     ref="echart" | ||||||
|  |     :style="{ height: height, width: width }" | ||||||
|  |   /> | ||||||
|  | </template> | ||||||
|  | <script> | ||||||
|  | import echarts from "echarts"; | ||||||
|  | import _ from "lodash"; | ||||||
|  | require("@/utils/echarts/myShine"); | ||||||
|  | import resize from "@/views/dashboard/mixins/resize"; | ||||||
|  | import { getOption } from "./chartUtils"; | ||||||
|  | export default { | ||||||
|  |   mixins: [resize], | ||||||
|  |   name: "LineChartView", | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       chart: undefined, | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     data: { | ||||||
|  |       type: Array, | ||||||
|  |       default: [], | ||||||
|  |     }, | ||||||
|  |     width: { | ||||||
|  |       type: String, | ||||||
|  |       default: "100%", | ||||||
|  |     }, | ||||||
|  |     height: { | ||||||
|  |       type: String, | ||||||
|  |       default: "200px", | ||||||
|  |     }, | ||||||
|  |     label: { | ||||||
|  |       type: String, | ||||||
|  |       default: "", | ||||||
|  |     }, | ||||||
|  |     keyVal: { | ||||||
|  |       type: String, | ||||||
|  |       default: "", | ||||||
|  |     }, | ||||||
|  |     unit: { | ||||||
|  |       type: String, | ||||||
|  |       default: "", | ||||||
|  |     }, | ||||||
|  |     extra: { | ||||||
|  |       type: String, | ||||||
|  |       default: "", | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.$nextTick(() => { | ||||||
|  |       this.initChart(); | ||||||
|  |     }); | ||||||
|  |     window.addEventListener("message", this.handleOnMessage); | ||||||
|  |   }, | ||||||
|  |   unmounted() { | ||||||
|  |     window.removeEventListener("message", this.handleOnMessage); | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     initChart() { | ||||||
|  |       this.chart = echarts.init(this.$refs.echart, "myShine"); | ||||||
|  |       this.chart.on("mouseover", this.handleOnChartMouseover); | ||||||
|  |       this.chart.on("mouseout", this.handleOnChartMouseout); | ||||||
|  |       this.chart.on("click", this.handleOnChartClick); | ||||||
|  |       if (this.data.length > 0) { | ||||||
|  |         this.updateChart(this.data); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     updateChart(source) { | ||||||
|  |       const option = getOption( | ||||||
|  |         this.keyVal, | ||||||
|  |         source, | ||||||
|  |         this.label, | ||||||
|  |         this.unit, | ||||||
|  |         this.extra | ||||||
|  |       ); | ||||||
|  |       // console.log({ option }); | ||||||
|  |       this.chart.clear(); | ||||||
|  |       this.chart.setOption(option); | ||||||
|  |     }, | ||||||
|  |     handleOnChartClick(params) { | ||||||
|  |       // console.log({ params }); | ||||||
|  |       this.$emit("onClick", params.data.id); | ||||||
|  |     }, | ||||||
|  |     handleOnChartMouseover(params) { | ||||||
|  |       window.postMessage({ | ||||||
|  |         type: "PUNCH_LINE_CHART_MESSAGE_MOUSEOVER", | ||||||
|  |         keyVal: this.keyVal, | ||||||
|  |         seriesIndex: params.seriesIndex, | ||||||
|  |         dataIndex: params.dataIndex, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     handleOnChartMouseout(params) { | ||||||
|  |       window.postMessage({ | ||||||
|  |         type: "PUNCH_LINE_CHART_MESSAGE_MOUSEOUT", | ||||||
|  |         keyVal: this.keyVal, | ||||||
|  |         seriesIndex: params.seriesIndex, | ||||||
|  |         dataIndex: params.dataIndex, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     handleOnMessage({ data = {} }) { | ||||||
|  |       if (data.keyVal === this.keyVal) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       if ( | ||||||
|  |         data.type && | ||||||
|  |         (data.type === "PUNCH_LINE_CHART_MESSAGE_MOUSEOVER" || | ||||||
|  |           data.type === "PUNCH_LINE_CHART_MESSAGE_MOUSEOUT") | ||||||
|  |       ) { | ||||||
|  |         this.chart && | ||||||
|  |           this.chart.dispatchAction({ | ||||||
|  |             type: | ||||||
|  |               data.type === "PUNCH_LINE_CHART_MESSAGE_MOUSEOVER" | ||||||
|  |                 ? "showTip" | ||||||
|  |                 : "hideTip", | ||||||
|  |             seriesIndex: data.seriesIndex, | ||||||
|  |             dataIndex: data.dataIndex, | ||||||
|  |           }); | ||||||
|  |       } else if ( | ||||||
|  |         data.type && | ||||||
|  |         data.type === "PUNCH_LINE_CHART_MESSAGE_DATAZOOM" | ||||||
|  |       ) { | ||||||
|  |         this.chart && | ||||||
|  |           this.chart.dispatchAction({ | ||||||
|  |             type: "dataZoom", | ||||||
|  |             end: data.end, | ||||||
|  |             start: data.start, | ||||||
|  |           }); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     data(newVal, oldVal) { | ||||||
|  |       if (newVal) { | ||||||
|  |         this.$nextTick(() => { | ||||||
|  |           this.updateChart(newVal); | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .chart_style_wrapper { | ||||||
|  |   background: #FFECEC; | ||||||
|  | } | ||||||
|  | </style> | ||||||
							
								
								
									
										147
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/utils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								stdiet-ui/src/components/PunchLog/LineChartView/utils.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -22,7 +22,7 @@ | |||||||
|             > |             > | ||||||
|           </div> |           </div> | ||||||
|           <h3>一、基础信息</h3> |           <h3>一、基础信息</h3> | ||||||
|           <TableDetailMessage :data="punchLogDetail"></TableDetailMessage> |           <TableDetailMessage :data="punchLogDetail" :maxLength="10" /> | ||||||
|           <h3>二、食物以及对比照信息</h3> |           <h3>二、食物以及对比照信息</h3> | ||||||
|           <div style="height: 370px; overflow: auto"> |           <div style="height: 370px; overflow: auto"> | ||||||
|             <div v-if="punchLog != null && punchLog.ingredientDesc"> |             <div v-if="punchLog != null && punchLog.ingredientDesc"> | ||||||
| @@ -40,6 +40,7 @@ | |||||||
|                     title="点击大图预览" |                     title="点击大图预览" | ||||||
|                     :key="'breakfast' + index" |                     :key="'breakfast' + index" | ||||||
|                     class="food_image_first" |                     class="food_image_first" | ||||||
|  |                     fit="cover" | ||||||
|                     :src="item" |                     :src="item" | ||||||
|                     :preview-src-list="imageUrl" |                     :preview-src-list="imageUrl" | ||||||
|                   > |                   > | ||||||
| @@ -54,6 +55,7 @@ | |||||||
|                     title="点击大图预览" |                     title="点击大图预览" | ||||||
|                     :key="'lunch' + index" |                     :key="'lunch' + index" | ||||||
|                     class="food_image" |                     class="food_image" | ||||||
|  |                     fit="cover" | ||||||
|                     :src="item" |                     :src="item" | ||||||
|                     :preview-src-list="imageUrl" |                     :preview-src-list="imageUrl" | ||||||
|                   > |                   > | ||||||
| @@ -68,6 +70,7 @@ | |||||||
|                     title="点击大图预览" |                     title="点击大图预览" | ||||||
|                     :key="'dinner' + index" |                     :key="'dinner' + index" | ||||||
|                     class="food_image" |                     class="food_image" | ||||||
|  |                     fit="cover" | ||||||
|                     :src="item" |                     :src="item" | ||||||
|                     :preview-src-list="imageUrl" |                     :preview-src-list="imageUrl" | ||||||
|                   > |                   > | ||||||
| @@ -82,12 +85,19 @@ | |||||||
|                     title="点击大图预览" |                     title="点击大图预览" | ||||||
|                     :key="'extraMeal' + index" |                     :key="'extraMeal' + index" | ||||||
|                     class="food_image" |                     class="food_image" | ||||||
|  |                     fit="cover" | ||||||
|                     :src="item" |                     :src="item" | ||||||
|                     :preview-src-list="imageUrl" |                     :preview-src-list="imageUrl" | ||||||
|                   > |                   > | ||||||
|                   </el-image> |                   </el-image> | ||||||
|                 </div> |                 </div> | ||||||
|               </div> |               </div> | ||||||
|  |               <div v-if="punchLog != null && punchLog.bodyDesc"> | ||||||
|  |                 <h4>对比照描述</h4> | ||||||
|  |                 <div> | ||||||
|  |                   {{ punchLog.bodyDesc }} | ||||||
|  |                 </div> | ||||||
|  |               </div> | ||||||
|               <div v-if="punchLog.imagesUrl.bodyImages.length > 0"> |               <div v-if="punchLog.imagesUrl.bodyImages.length > 0"> | ||||||
|                 <h4>体型对比照</h4> |                 <h4>体型对比照</h4> | ||||||
|                 <div> |                 <div> | ||||||
| @@ -96,6 +106,7 @@ | |||||||
|                     title="点击大图预览" |                     title="点击大图预览" | ||||||
|                     :key="index" |                     :key="index" | ||||||
|                     style="width: 300px; height: 300px" |                     style="width: 300px; height: 300px" | ||||||
|  |                     fit="cover" | ||||||
|                     :src="item" |                     :src="item" | ||||||
|                     :preview-src-list="imageUrl" |                     :preview-src-list="imageUrl" | ||||||
|                   > |                   > | ||||||
| @@ -167,19 +178,21 @@ export default { | |||||||
|       punchLogDetail: [], |       punchLogDetail: [], | ||||||
|       //打卡详情的标题,按竖显示 |       //打卡详情的标题,按竖显示 | ||||||
|       punchTitleData: [ |       punchTitleData: [ | ||||||
|         ["姓名", "体重(斤)", "饮水量(ml)"], |         [], | ||||||
|         ["睡觉时间", "起床时间", "运动锻炼"], |         ["睡觉时间", "情绪状况", "运动锻炼"], | ||||||
|         ["情绪", "按食谱进食", "其他食物"], |         ["起床时间", "情绪描述", "运动描述"], | ||||||
|         ["熬夜失眠", "起床排便", "是否便秘"], |         ["排便情况", "按营养餐吃", "食谱外食物"], | ||||||
|         ["服务建议", "评分", "点评内容"], |         ["排便描述", "营养餐感受", "熬夜失眠"], | ||||||
|  |         ["评分", "点评内容"], | ||||||
|       ], |       ], | ||||||
|       //打卡详情的属性名称,与标题对应,按竖显示 |       //打卡详情的属性名称,与标题对应,按竖显示 | ||||||
|       punchValueData: [ |       punchValueData: [ | ||||||
|         ["customerName", "weight", "water"], |         [], | ||||||
|         ["sleepTime", "wakeupTime", "sport"], |         ["sleepTime", "emotion", "sport"], | ||||||
|         ["emotion", "diet", "slyEatFood"], |         ["wakeupTime", "emotionDesc", "sportDesc"], | ||||||
|         ["insomnia", "defecation", "constipation"], |         ["defecation", "diet", "slyEatFood"], | ||||||
|         ["remark", "executionScore", "comment"], |         ["defecationDesc", "dietDesc", "insomnia"], | ||||||
|  |         ["executionScore", "comment"], | ||||||
|       ], |       ], | ||||||
|  |  | ||||||
|       commentVisible: false, |       commentVisible: false, | ||||||
| @@ -212,6 +225,13 @@ export default { | |||||||
|     }, |     }, | ||||||
|     showDialog(data, callback) { |     showDialog(data, callback) { | ||||||
|       this.data = data; |       this.data = data; | ||||||
|  |       if (data.sex) { | ||||||
|  |         this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)", "生理期"]; | ||||||
|  |         this.punchValueData[0] = ["weight", "water", "menstrualPeriod"]; | ||||||
|  |       } else { | ||||||
|  |         this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)"]; | ||||||
|  |         this.punchValueData[0] = ["weight", "water"]; | ||||||
|  |       } | ||||||
|       this.callback = callback; |       this.callback = callback; | ||||||
|       this.commentFlag = false; |       this.commentFlag = false; | ||||||
|       this.title = `「${data.customerName}` + " " + `${data.logTime}」打卡记录`; |       this.title = `「${data.customerName}` + " " + `${data.logTime}」打卡记录`; | ||||||
| @@ -228,6 +248,9 @@ export default { | |||||||
|           res.data.defecation = res.data.defecation === "Y" ? "是" : "否"; |           res.data.defecation = res.data.defecation === "Y" ? "是" : "否"; | ||||||
|           res.data.constipation = res.data.constipation === "Y" ? "是" : "否"; |           res.data.constipation = res.data.constipation === "Y" ? "是" : "否"; | ||||||
|           res.data.isScore = res.data.executionScore == null ? "否" : "是"; |           res.data.isScore = res.data.executionScore == null ? "否" : "是"; | ||||||
|  |           res.data.menstrualPeriod = | ||||||
|  |             res.data.menstrualPeriod == "N" ? "否" : "是"; | ||||||
|  |  | ||||||
|           this.punchLogDetail = []; |           this.punchLogDetail = []; | ||||||
|           for (let i = 0; i < this.punchTitleData.length; i++) { |           for (let i = 0; i < this.punchTitleData.length; i++) { | ||||||
|             this.punchLogDetail.push({ |             this.punchLogDetail.push({ | ||||||
| @@ -300,13 +323,17 @@ export default { | |||||||
|  |  | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
| .food_image_first { | .food_image_first { | ||||||
|   width: 280px; |   width: 160px; | ||||||
|   height: 300px; |   height: 160px; | ||||||
|  |   border-radius: 16px; | ||||||
|  |   margin: 8px; | ||||||
| } | } | ||||||
|  |  | ||||||
| .food_image { | .food_image { | ||||||
|   width: 280px; |   width: 160px; | ||||||
|   height: 300px; |   height: 160px; | ||||||
|   //margin-left:10px |   //margin-left:10px | ||||||
|  |   margin: 8px; | ||||||
|  |   border-radius: 16px; | ||||||
| } | } | ||||||
| </style> | </style> | ||||||
|   | |||||||
| @@ -1,58 +1,79 @@ | |||||||
| <template> | <template> | ||||||
|   <el-table :show-header="false" :data="data" border :cell-style="columnStyle" style="width: 100%;"> |   <el-table | ||||||
|     <el-table-column width="140" prop="attr_name_one"> |     :show-header="false" | ||||||
|     </el-table-column> |     :data="data" | ||||||
|  |     border | ||||||
|  |     :cell-style="columnStyle" | ||||||
|  |     style="width: 100%" | ||||||
|  |   > | ||||||
|  |     <el-table-column width="100" prop="attr_name_one"> </el-table-column> | ||||||
|     <el-table-column prop="value_one"> |     <el-table-column prop="value_one"> | ||||||
|       <template slot-scope="scope"> |       <template slot-scope="scope"> | ||||||
|         <AutoHideMessage :data="scope.row.value_one == null ? '' : (scope.row.value_one+'')" :maxLength="20"/> |         <AutoHideMessage | ||||||
|  |           :data="scope.row.value_one == null ? '' : scope.row.value_one + ''" | ||||||
|  |           :maxLength="10" | ||||||
|  |         /> | ||||||
|       </template> |       </template> | ||||||
|     </el-table-column> |     </el-table-column> | ||||||
|     <el-table-column width="140" prop="attr_name_two"></el-table-column> |     <el-table-column width="100" prop="attr_name_two"></el-table-column> | ||||||
|     <el-table-column prop="value_two"> |     <el-table-column prop="value_two"> | ||||||
|       <template slot-scope="scope"> |       <template slot-scope="scope"> | ||||||
|         <AutoHideMessage :data="scope.row.value_two == null ? '' : (scope.row.value_two+'')" :maxLength="20"/> |         <AutoHideMessage | ||||||
|  |           :data="scope.row.value_two == null ? '' : scope.row.value_two + ''" | ||||||
|  |           :maxLength="10" | ||||||
|  |         /> | ||||||
|       </template> |       </template> | ||||||
|     </el-table-column> |     </el-table-column> | ||||||
|     <el-table-column width="140" prop="attr_name_three"></el-table-column> |     <el-table-column width="100" prop="attr_name_three"></el-table-column> | ||||||
|     <el-table-column prop="value_three"> |     <el-table-column prop="value_three"> | ||||||
|       <template slot-scope="scope"> |       <template slot-scope="scope"> | ||||||
|         <AutoHideMessage :data="scope.row.value_three == null ? '' : (scope.row.value_three+'')" :maxLength="20"/> |         <AutoHideMessage | ||||||
|  |           :data=" | ||||||
|  |             scope.row.value_three == null ? '' : scope.row.value_three + '' | ||||||
|  |           " | ||||||
|  |           :maxLength="10" | ||||||
|  |         /> | ||||||
|       </template> |       </template> | ||||||
|     </el-table-column> |     </el-table-column> | ||||||
|   </el-table> |   </el-table> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|   import AutoHideMessage from "@/components/AutoHideMessage"; | import AutoHideMessage from "@/components/AutoHideMessage"; | ||||||
|   export default { | export default { | ||||||
|     name: "TableDetailMessage", |   name: "TableDetailMessage", | ||||||
|     data() { |   data() { | ||||||
|       return { |     return {}; | ||||||
|       }; |   }, | ||||||
|  |   props: { | ||||||
|  |     data: {}, | ||||||
|  |     maxLength: { | ||||||
|  |       type: Number, | ||||||
|  |       default: 20, | ||||||
|     }, |     }, | ||||||
|     props: { |   }, | ||||||
|       data: {} |   computed: {}, | ||||||
|     }, |   components: { | ||||||
|     computed: { |     AutoHideMessage, | ||||||
|  |   }, | ||||||
|     }, |   methods: { | ||||||
|     components: { |     // 自定义列背景色 | ||||||
|       AutoHideMessage |     columnStyle({ row, column, rowIndex, columnIndex }) { | ||||||
|     }, |       if ( | ||||||
|     methods: { |         columnIndex == 0 || | ||||||
|       // 自定义列背景色 |         columnIndex == 2 || | ||||||
|       columnStyle({ row, column, rowIndex, columnIndex }) { |         columnIndex == 4 || | ||||||
|         if (columnIndex == 0 || columnIndex == 2 || columnIndex == 4 || columnIndex == 6) { |         columnIndex == 6 | ||||||
|           //第三第四列的背景色就改变了2和3都是列数的下标 |       ) { | ||||||
|           return "background:#f3f6fc;font-weight:bold"; |         //第三第四列的背景色就改变了2和3都是列数的下标 | ||||||
|         }else{ |         return "background:#f3f6fc;font-weight:bold"; | ||||||
|           return "background:#ffffff;"; |       } else { | ||||||
|         } |         return "background:#ffffff;"; | ||||||
|       } |       } | ||||||
|     } |     }, | ||||||
|   }; |   }, | ||||||
|  | }; | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <style> | <style> | ||||||
|  |  | ||||||
| </style> | </style> | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ function connect() { | |||||||
|       intervalRef && clearInterval(intervalRef); |       intervalRef && clearInterval(intervalRef); | ||||||
|  |  | ||||||
|       setInterval(() => { |       setInterval(() => { | ||||||
|         ws.send("ping"); |         ws && ws.send("ping"); | ||||||
|       }, 30000); |       }, 30000); | ||||||
|  |  | ||||||
|       window.addEventListener("message", handleOnMessageReceive); |       window.addEventListener("message", handleOnMessageReceive); | ||||||
| @@ -39,7 +39,7 @@ function connect() { | |||||||
|  |  | ||||||
|     ws.onerror = event => { |     ws.onerror = event => { | ||||||
|       // console.log({ event }); |       // console.log({ event }); | ||||||
|       ws.close(); |       ws && ws.close(); | ||||||
|       ws = undefined; |       ws = undefined; | ||||||
|       window.removeEventListener("message", handleOnMessageReceive); |       window.removeEventListener("message", handleOnMessageReceive); | ||||||
|  |  | ||||||
| @@ -51,7 +51,7 @@ function connect() { | |||||||
|       ws = undefined; |       ws = undefined; | ||||||
|       window.removeEventListener("message", handleOnMessageReceive); |       window.removeEventListener("message", handleOnMessageReceive); | ||||||
|       // if (event.reason !== "unmount") { |       // if (event.reason !== "unmount") { | ||||||
|         // websocketInit(); |       // websocketInit(); | ||||||
|       // } |       // } | ||||||
|     }; |     }; | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|   | |||||||
| @@ -653,6 +653,12 @@ export default { | |||||||
|       this.physicalSignsList = response.rows; |       this.physicalSignsList = response.rows; | ||||||
|     }); |     }); | ||||||
|   }, |   }, | ||||||
|  |   activated() { | ||||||
|  |     if (this.$route.query.cusName) { | ||||||
|  |       this.queryParams.name = this.$route.query.cusName; | ||||||
|  |       this.handleQuery(); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|   computed: { |   computed: { | ||||||
|     isPartner() { |     isPartner() { | ||||||
|       return this.roles && this.roles.includes("partner"); |       return this.roles && this.roles.includes("partner"); | ||||||
|   | |||||||
| @@ -32,37 +32,51 @@ | |||||||
|         /> |         /> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|       <el-form-item label="营养师" prop="nutritionistId"> |       <el-form-item label="营养师" prop="nutritionistId"> | ||||||
|         <el-select v-model="queryParams.nutritionistId" clearable filterable placeholder="请选择"> |         <el-select | ||||||
|  |           v-model="queryParams.nutritionistId" | ||||||
|  |           clearable | ||||||
|  |           filterable | ||||||
|  |           placeholder="请选择" | ||||||
|  |         > | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in nutritionistIdOptions.slice(1)" |             v-for="dict in nutritionistIdOptions.slice(1)" | ||||||
|             :key="dict.dictValue" |             :key="dict.dictValue" | ||||||
|             :label="dict.dictLabel" |             :label="dict.dictLabel" | ||||||
|             :value="parseInt(dict.dictValue)"  |             :value="parseInt(dict.dictValue)" | ||||||
|           /> |           /> | ||||||
|         </el-select> |         </el-select> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|       <el-form-item label="售后" prop="afterNutritionistId"> |       <el-form-item label="售后" prop="afterNutritionistId"> | ||||||
|         <el-select v-model="queryParams.afterNutritionistId" clearable filterable placeholder="请选择"> |         <el-select | ||||||
|  |           v-model="queryParams.afterNutritionistId" | ||||||
|  |           clearable | ||||||
|  |           filterable | ||||||
|  |           placeholder="请选择" | ||||||
|  |         > | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in afterSaleIdOptions.slice(1)" |             v-for="dict in afterSaleIdOptions.slice(1)" | ||||||
|             :key="dict.dictValue" |             :key="dict.dictValue" | ||||||
|             :label="dict.dictLabel" |             :label="dict.dictLabel" | ||||||
|             :value="parseInt(dict.dictValue)"  |             :value="parseInt(dict.dictValue)" | ||||||
|           /> |           /> | ||||||
|         </el-select> |         </el-select> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|        |  | ||||||
|       <el-form-item label="打卡日期" prop="logTimeScope" style="margin-left:15px"> |       <el-form-item | ||||||
|  |         label="打卡日期" | ||||||
|  |         prop="logTimeScope" | ||||||
|  |         style="margin-left: 15px" | ||||||
|  |       > | ||||||
|         <el-date-picker |         <el-date-picker | ||||||
|                 v-model="logTimeScope" |           v-model="logTimeScope" | ||||||
|                 type="daterange" |           type="daterange" | ||||||
|                 range-separator="至" |           range-separator="至" | ||||||
|                 start-placeholder="打卡开始日期" |           start-placeholder="打卡开始日期" | ||||||
|                 end-placeholder="打卡结束日期" |           end-placeholder="打卡结束日期" | ||||||
|                 format="yyyy-MM-dd" |           format="yyyy-MM-dd" | ||||||
|                 value-format="yyyy-MM-dd" |           value-format="yyyy-MM-dd" | ||||||
|                 :picker-options="logTimePickerOptions" |           :picker-options="logTimePickerOptions" | ||||||
|               > |         > | ||||||
|         </el-date-picker> |         </el-date-picker> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|  |  | ||||||
| @@ -87,7 +101,7 @@ | |||||||
|           icon="el-icon-s-flag" |           icon="el-icon-s-flag" | ||||||
|           size="mini" |           size="mini" | ||||||
|           @click="showNotLunch()" |           @click="showNotLunch()" | ||||||
|         >未打卡客户列表 |           >未打卡客户列表 | ||||||
|         </el-button> |         </el-button> | ||||||
|       </el-col> |       </el-col> | ||||||
|       <!--      <el-col :span="1.5">--> |       <!--      <el-col :span="1.5">--> | ||||||
| @@ -153,7 +167,16 @@ | |||||||
|           <span>{{ parseTime(scope.row.logTime, "{y}-{m}-{d}") }}</span> |           <span>{{ parseTime(scope.row.logTime, "{y}-{m}-{d}") }}</span> | ||||||
|         </template> |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column label="姓名" align="center" prop="customerName" /> |       <el-table-column label="姓名" align="center" prop="customerName"> | ||||||
|  |         <template slot-scope="scope"> | ||||||
|  |           <div | ||||||
|  |             @click="handleOnNameClick(scope.row.customerName)" | ||||||
|  |             class="user_name_style" | ||||||
|  |           > | ||||||
|  |             {{ scope.row.customerName }} | ||||||
|  |           </div> | ||||||
|  |         </template> | ||||||
|  |       </el-table-column> | ||||||
|       <el-table-column label="当天体重" align="center" prop="weight"> |       <el-table-column label="当天体重" align="center" prop="weight"> | ||||||
|         <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
|           <span>{{ `${scope.row.weight} 斤` }}</span> |           <span>{{ `${scope.row.weight} 斤` }}</span> | ||||||
| @@ -166,12 +189,11 @@ | |||||||
|         width="120" |         width="120" | ||||||
|         :formatter="appidFormat" |         :formatter="appidFormat" | ||||||
|       />--> |       />--> | ||||||
|        |  | ||||||
|       <!--<el-table-column label="手机号" align="center" prop="phone" width="180" />--> |       <!--<el-table-column label="手机号" align="center" prop="phone" width="180" />--> | ||||||
|       <el-table-column label="营养师" align="center" prop="nutritionist" /> |       <el-table-column label="营养师" align="center" prop="nutritionist" /> | ||||||
|       <el-table-column label="售后" align="center" prop="afterNutritionist" /> |       <el-table-column label="售后" align="center" prop="afterNutritionist" /> | ||||||
|        |  | ||||||
|        |  | ||||||
|       <el-table-column |       <el-table-column | ||||||
|         label="睡觉时间" |         label="睡觉时间" | ||||||
|         align="center" |         align="center" | ||||||
| @@ -192,15 +214,13 @@ | |||||||
|         prop="sport" |         prop="sport" | ||||||
|         :formatter="sportFormat" |         :formatter="sportFormat" | ||||||
|       /> |       /> | ||||||
|       <el-table-column |       <el-table-column label="情绪" align="center" prop="emotion" width="120"> | ||||||
|         label="情绪" |         <template slot-scope="scope"> | ||||||
|         align="center" |           <AutoHideMessage | ||||||
|         prop="emotion" |             :maxLength="4" | ||||||
|         width="120" |             :data="scope.row.emotion" | ||||||
|       > |           ></AutoHideMessage> | ||||||
|       <template slot-scope="scope"> |         </template> | ||||||
|           <AutoHideMessage :maxLength="4" :data="scope.row.emotion"></AutoHideMessage> |  | ||||||
|       </template> |  | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|  |  | ||||||
|       <el-table-column |       <el-table-column | ||||||
| @@ -213,11 +233,14 @@ | |||||||
|         label="其他食物" |         label="其他食物" | ||||||
|         align="center" |         align="center" | ||||||
|         prop="slyEatFood" |         prop="slyEatFood" | ||||||
|          width="120" |         width="120" | ||||||
|       > |       > | ||||||
|       <template slot-scope="scope"> |         <template slot-scope="scope"> | ||||||
|           <AutoHideMessage :maxLength="4" :data="scope.row.slyEatFood"></AutoHideMessage> |           <AutoHideMessage | ||||||
|       </template> |             :maxLength="4" | ||||||
|  |             :data="scope.row.slyEatFood" | ||||||
|  |           ></AutoHideMessage> | ||||||
|  |         </template> | ||||||
|       </el-table-column> |       </el-table-column> | ||||||
|       <el-table-column |       <el-table-column | ||||||
|         label="熬夜失眠" |         label="熬夜失眠" | ||||||
| @@ -315,7 +338,7 @@ import { mapGetters } from "vuex"; | |||||||
| import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; | import PunchLogDetail from "@/components/PunchLog/PunchLogDetail"; | ||||||
| import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; | import PunchLogEdit from "@/components/PunchLog/PunchLogEdit"; | ||||||
| import AutoHideMessage from "@/components/AutoHideMessage"; | import AutoHideMessage from "@/components/AutoHideMessage"; | ||||||
| import NotPunchCustomer from "@/components/PunchLog/NotPunchCustomer" | import NotPunchCustomer from "@/components/PunchLog/NotPunchCustomer"; | ||||||
| import dayjs from "dayjs"; | import dayjs from "dayjs"; | ||||||
| export default { | export default { | ||||||
|   name: "WxUserLog", |   name: "WxUserLog", | ||||||
| @@ -356,7 +379,7 @@ export default { | |||||||
|         appid: null, |         appid: null, | ||||||
|         phone: null, |         phone: null, | ||||||
|         nutritionistId: null, |         nutritionistId: null, | ||||||
|         afterNutritionistId: null |         afterNutritionistId: null, | ||||||
|       }, |       }, | ||||||
|       // 表单参数 |       // 表单参数 | ||||||
|       form: {}, |       form: {}, | ||||||
| @@ -364,14 +387,17 @@ export default { | |||||||
|       rules: {}, |       rules: {}, | ||||||
|       logTimePickerOptions: { |       logTimePickerOptions: { | ||||||
|         disabledDate(time) { |         disabledDate(time) { | ||||||
|           return time.getTime() > dayjs() |           return time.getTime() > dayjs(); | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|       logTimeScope: null |       logTimeScope: null, | ||||||
|     }; |     }; | ||||||
|   }, |   }, | ||||||
|   components:{ |   components: { | ||||||
|     PunchLogDetail,AutoHideMessage,PunchLogEdit,NotPunchCustomer |     PunchLogDetail, | ||||||
|  |     AutoHideMessage, | ||||||
|  |     PunchLogEdit, | ||||||
|  |     NotPunchCustomer, | ||||||
|   }, |   }, | ||||||
|   created() { |   created() { | ||||||
|     this.getList(); |     this.getList(); | ||||||
| @@ -396,15 +422,21 @@ export default { | |||||||
|       // 售后字典 |       // 售后字典 | ||||||
|       "afterSaleIdOptions", |       "afterSaleIdOptions", | ||||||
|       // 主营养师字典 |       // 主营养师字典 | ||||||
|       "nutritionistIdOptions" |       "nutritionistIdOptions", | ||||||
|     ]), |     ]), | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     /** 查询微信用户记录列表 */ |     /** 查询微信用户记录列表 */ | ||||||
|     getList() { |     getList() { | ||||||
|       this.loading = true;  |       this.loading = true; | ||||||
|       this.queryParams.beginTime = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[0] : null; |       this.queryParams.beginTime = | ||||||
|       this.queryParams.endTime = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[1] : null; |         this.logTimeScope && this.logTimeScope.length > 0 | ||||||
|  |           ? this.logTimeScope[0] | ||||||
|  |           : null; | ||||||
|  |       this.queryParams.endTime = | ||||||
|  |         this.logTimeScope && this.logTimeScope.length > 0 | ||||||
|  |           ? this.logTimeScope[1] | ||||||
|  |           : null; | ||||||
|       listWxUserLog(this.queryParams).then((response) => { |       listWxUserLog(this.queryParams).then((response) => { | ||||||
|         this.wxUserLogList = response.rows; |         this.wxUserLogList = response.rows; | ||||||
|         this.total = response.total; |         this.total = response.total; | ||||||
| @@ -495,7 +527,7 @@ export default { | |||||||
|     /** 修改按钮操作 */ |     /** 修改按钮操作 */ | ||||||
|     handleUpdate(row) { |     handleUpdate(row) { | ||||||
|       this.$refs.punchLogEditRef.showDialog(row, () => { |       this.$refs.punchLogEditRef.showDialog(row, () => { | ||||||
|           this.getList(); |         this.getList(); | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     /** 提交按钮 */ |     /** 提交按钮 */ | ||||||
| @@ -526,15 +558,11 @@ export default { | |||||||
|     /** 删除按钮操作 */ |     /** 删除按钮操作 */ | ||||||
|     handleDelete(row) { |     handleDelete(row) { | ||||||
|       const ids = row.id || this.ids; |       const ids = row.id || this.ids; | ||||||
|       this.$confirm( |       this.$confirm("是否确认删除该用户的打卡记录?", "警告", { | ||||||
|         '是否确认删除该用户的打卡记录?', |         confirmButtonText: "确定", | ||||||
|         "警告", |         cancelButtonText: "取消", | ||||||
|         { |         type: "warning", | ||||||
|           confirmButtonText: "确定", |       }) | ||||||
|           cancelButtonText: "取消", |  | ||||||
|           type: "warning", |  | ||||||
|         } |  | ||||||
|       ) |  | ||||||
|         .then(function () { |         .then(function () { | ||||||
|           return delWxUserLog(ids); |           return delWxUserLog(ids); | ||||||
|         }) |         }) | ||||||
| @@ -544,9 +572,9 @@ export default { | |||||||
|         }) |         }) | ||||||
|         .catch(function () {}); |         .catch(function () {}); | ||||||
|     }, |     }, | ||||||
|     showPunchLogDetail(data){ |     showPunchLogDetail(data) { | ||||||
|         this.$refs.punchLogDetailRef.showDialog(data,() => { |       this.$refs.punchLogDetailRef.showDialog(data, () => { | ||||||
|           this.getList(); |         this.getList(); | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     /** 导出按钮操作 */ |     /** 导出按钮操作 */ | ||||||
| @@ -565,10 +593,28 @@ export default { | |||||||
|         }) |         }) | ||||||
|         .catch(function () {}); |         .catch(function () {}); | ||||||
|     }, |     }, | ||||||
|     showNotLunch(){ |     handleOnNameClick(name) { | ||||||
|       this.queryParams.startDate = this.logTimeScope && this.logTimeScope.length > 0 ? this.logTimeScope[0] : null; |       // console.log({ name }); | ||||||
|       this.$refs.notPunchCustomerRef.showDialog(this.queryParams, this.nutritionistIdOptions,this.afterSaleIdOptions); |       this.$router.push(`/customer?cusName=${name}`); | ||||||
|     } |     }, | ||||||
|  |     showNotLunch() { | ||||||
|  |       this.queryParams.startDate = | ||||||
|  |         this.logTimeScope && this.logTimeScope.length > 0 | ||||||
|  |           ? this.logTimeScope[0] | ||||||
|  |           : null; | ||||||
|  |       this.$refs.notPunchCustomerRef.showDialog( | ||||||
|  |         this.queryParams, | ||||||
|  |         this.nutritionistIdOptions, | ||||||
|  |         this.afterSaleIdOptions | ||||||
|  |       ); | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
| </script> | </script> | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .app-container { | ||||||
|  |   .user_name_style { | ||||||
|  |     cursor: pointer; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | </style> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user