客户档案加上打卡记录以及体重趋势图
This commit is contained in:
parent
fe7834e640
commit
78399c52e7
@ -6,6 +6,7 @@ import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.common.enums.BusinessType;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
@ -107,7 +108,7 @@ public class SysWxUserLogController extends BaseController {
|
||||
if( sysWxUserLog != null && StringUtils.isNotEmpty(sysWxUserLog.getOpenid())){
|
||||
SysWxUserLog dateLog = sysWxUserLogService.selectSysWxUserLogByDateAndOpenId(sysWxUserLog);
|
||||
if(dateLog != null && dateLog.getId().intValue() != sysWxUserLog.getId().intValue()){
|
||||
return AjaxResult.error("今日该用户已打卡,无法重复打卡");
|
||||
return AjaxResult.error("该用户在"+ DateUtils.dateTime(sysWxUserLog.getLogTime())+"已打卡,无法重复打卡");
|
||||
}
|
||||
return toAjax(sysWxUserLogService.updateSysWxUserLog(sysWxUserLog));
|
||||
}else{
|
||||
@ -189,4 +190,14 @@ public class SysWxUserLogController extends BaseController {
|
||||
sysWxUserLog.setImagesUrl(downUrlList);
|
||||
return AjaxResult.success(sysWxUserLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户ID查询对应打卡体重数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:wxUserLog:list')")
|
||||
@GetMapping("/getAllPunchLogByCustomerId")
|
||||
public AjaxResult getAllPunchLogByCustomerId(SysWxUserLog sysWxUserLog) {
|
||||
List<SysWxUserLog> list = sysWxUserLogService.getWxUserLogListByCustomerId(sysWxUserLog);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
@ -73,6 +73,9 @@ public class SysWxUserLog extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date logTime;
|
||||
|
||||
//客户ID
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 非持久化字段,客户姓名
|
||||
*/
|
||||
|
@ -78,4 +78,11 @@ public interface SysWxUserLogMapper
|
||||
*/
|
||||
SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 根据客户ID查询对应打卡体重数据
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
}
|
@ -80,4 +80,11 @@ public interface ISysWxUserLogService
|
||||
*/
|
||||
SysWxUserLog selectSysWxUserLogByDateAndOpenId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
/**
|
||||
* 根据客户ID查询对应打卡体重数据
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog);
|
||||
|
||||
}
|
@ -124,4 +124,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
|
||||
return sysWxUserLogMapper.selectSysWxUserLogByDateAndOpenId(sysWxUserLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户ID查询对应打卡体重数据
|
||||
* @param sysWxUserLog
|
||||
* @return
|
||||
*/
|
||||
public List<SysWxUserLog> getWxUserLogListByCustomerId(SysWxUserLog sysWxUserLog){
|
||||
return sysWxUserLogMapper.getWxUserLogListByCustomerId(sysWxUserLog);
|
||||
}
|
||||
|
||||
}
|
@ -84,6 +84,9 @@
|
||||
<if test="id != null">
|
||||
and wxlog.id = #{id}
|
||||
</if>
|
||||
<if test="customerId != null">
|
||||
and sc.id = #{customerId}
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">and (sc.name like concat('%',#{phone},'%') or wxinfo.phone like concat('%',#{phone},'%') )</if>
|
||||
<if test="appid != null">
|
||||
and wxinfo.appid = #{appid}
|
||||
@ -94,7 +97,9 @@
|
||||
<if test="afterNutritionistId != null">
|
||||
and su_atferSale.user_id = #{afterNutritionistId}
|
||||
</if>
|
||||
order by wxlog.create_time desc
|
||||
<if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if>
|
||||
<if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if>
|
||||
order by wxlog.log_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectWxLogInfoList" parameterType="SysWxUserLog" resultMap="WxLogInfo">
|
||||
@ -251,4 +256,15 @@
|
||||
) sss GROUP BY yearMonth,day_cha LIMIT 2
|
||||
</select>
|
||||
|
||||
<!-- 后台根据用户ID查询该用户的打卡体重 -->
|
||||
<select id="getWxUserLogListByCustomerId" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
|
||||
SELECT wxlog.id,wxlog.log_time,wxlog.weight FROM sys_wx_user_log wxlog
|
||||
left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
|
||||
left join sys_customer sc on sc.phone = wxinfo.phone and sc.del_flag = 0
|
||||
where wxinfo.phone is not null and sc.id = #{customerId}
|
||||
<if test="beginTime != null and beginTime != ''">and date_format(wxlog.log_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')</if>
|
||||
<if test="endTime != null and endTime != ''">and date_format(wxlog.log_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')</if>
|
||||
order by wxlog.log_time asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -50,6 +50,8 @@
|
||||
"element-ui": "2.13.2",
|
||||
"file-saver": "^2.0.5",
|
||||
"fuse.js": "3.4.4",
|
||||
"highcharts": "^9.0.1",
|
||||
"highcharts-vue": "^1.3.5",
|
||||
"html2canvas": "^1.0.0-rc.7",
|
||||
"immer": "^8.0.1",
|
||||
"js-beautify": "1.10.2",
|
||||
|
@ -60,3 +60,14 @@ export function getPunchLogDetail(id) {
|
||||
params: {}
|
||||
})
|
||||
}
|
||||
|
||||
// 根据用户ID查询打卡日志详情
|
||||
export function getAllPunchLogByCustomerId(query) {
|
||||
return request({
|
||||
url: '/custom/wxUserLog/getAllPunchLogByCustomerId',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
114
stdiet-ui/src/components/Highcharts/LineCharts/index.vue
Normal file
114
stdiet-ui/src/components/Highcharts/LineCharts/index.vue
Normal file
@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
<highcharts :options="chartOptions" ></highcharts>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
//highcharts折线图
|
||||
export default {
|
||||
name: "PunchLogChart",
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chartOptions:{
|
||||
chart: {
|
||||
type: 'line'
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
subtitle: {
|
||||
text: ''
|
||||
},
|
||||
xAxis: {
|
||||
categories: this.chartOption.xAxisData
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: this.chartOption.yAxisTitle
|
||||
}
|
||||
},
|
||||
plotOptions: {
|
||||
line: {
|
||||
dataLabels: {
|
||||
// 开启数据标签
|
||||
enabled: true
|
||||
},
|
||||
// 关闭鼠标跟踪,对应的提示框、点击事件会失效
|
||||
enableMouseTracking: false
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: this.chartOption.seriesName,
|
||||
data: this.chartOption.seriesData
|
||||
}],
|
||||
credits: {
|
||||
enabled: false //不显示LOGO
|
||||
},
|
||||
exporting: {
|
||||
buttons:{ //配置按钮选项
|
||||
contextButton:{
|
||||
menuItems: [{
|
||||
text: '下载图片',
|
||||
onclick: function () {
|
||||
this.exportChart({
|
||||
width: 1000
|
||||
});
|
||||
}
|
||||
}]
|
||||
},
|
||||
/*exportButton:{ //配置导出按钮
|
||||
width:50,
|
||||
symbolSize:20,
|
||||
borderWidth:2,
|
||||
borderRadius:0,
|
||||
hoverBorderColor:'red',
|
||||
height:30,
|
||||
symbolX:25,
|
||||
symbolY:15,
|
||||
x:-150,
|
||||
y:20
|
||||
},*/
|
||||
},
|
||||
filename: this.chartOption.imageFileName,//导出的文件名
|
||||
type:'image/png',//导出的文件类型
|
||||
width:1000 //导出的文件宽度
|
||||
},
|
||||
navigation: {
|
||||
buttonOptions: {
|
||||
enabled: true
|
||||
},
|
||||
menuStyle: {
|
||||
background: '#E0E0E0'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
props:{
|
||||
chartOption: {
|
||||
type: Object,
|
||||
default: function(){
|
||||
return {
|
||||
imageFileName: "体重趋势变化折线图",
|
||||
yAxisTitle: "",
|
||||
seriesName: "",
|
||||
xAxisData: [],
|
||||
seriesData: []
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
190
stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.vue
Normal file
190
stdiet-ui/src/components/PunchLog/CustomerPunchLog/index.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>
|
89
stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue
Normal file
89
stdiet-ui/src/components/PunchLog/PunchLogChart/index.vue
Normal file
@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="title"
|
||||
append-to-body
|
||||
@closed="onClosed"
|
||||
width="1000px"
|
||||
>
|
||||
<div id="container">
|
||||
<LineCharts v-if="visible" :chartOption="punchLogChartOption"></LineCharts>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getAllPunchLogByCustomerId
|
||||
} from "@/api/custom/wxUserLog";
|
||||
import LineCharts from "@/components/Highcharts/LineCharts";
|
||||
|
||||
export default {
|
||||
name: "PunchLogChart",
|
||||
components: {
|
||||
LineCharts
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
title: "",
|
||||
data: null,
|
||||
punchLogChartOption:{
|
||||
imageFileName: "体重趋势图",
|
||||
yAxisTitle: "体重(斤)",
|
||||
seriesName: "体重趋势(斤)",
|
||||
xAxisData: [],
|
||||
seriesData: []
|
||||
},
|
||||
punchLogList:[],
|
||||
queryParams:{
|
||||
customerId: null
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
showDialog(data) {
|
||||
this.data = data;
|
||||
this.title = `「${data.name}」体重趋势图`;
|
||||
this.queryParams.customerId = data.id;
|
||||
this.punchLogChartOption.imageFileName = data.name + "体重趋势图"
|
||||
this.getAllPunchLogByCustomerId();
|
||||
|
||||
},
|
||||
getAllPunchLogByCustomerId() {
|
||||
getAllPunchLogByCustomerId(this.queryParams).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.punchLogList = res.data;
|
||||
this.dealPunchLogList(res.data);
|
||||
this.visible = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
dealPunchLogList(data){
|
||||
let xAxisData = [];
|
||||
let seriesData = [];
|
||||
if(data && data.length > 0){
|
||||
data.forEach((element,index) => {
|
||||
xAxisData.push(element.logTime);
|
||||
seriesData.push(element.weight);
|
||||
if(index == data.length-1){
|
||||
this.punchLogChartOption.xAxisData = xAxisData;
|
||||
this.punchLogChartOption.seriesData = seriesData;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.punchLogChartOption.xAxisData = xAxisData;
|
||||
this.punchLogChartOption.seriesData = seriesData;
|
||||
}
|
||||
},
|
||||
onClosed() {
|
||||
this.data = null;
|
||||
this.punchLog = null;
|
||||
this.punchLogList = [];
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -27,7 +27,7 @@
|
||||
<TableDetailMessage :data="punchLogDetail"></TableDetailMessage>
|
||||
<h3>二、图片信息</h3>
|
||||
<div style="height: 400px; overflow: auto">
|
||||
<div>
|
||||
<div v-if="punchLog != null && punchLog.imagesUrl.breakfastImages.length > 0">
|
||||
<h4>早餐</h4>
|
||||
<div>
|
||||
<el-image v-for="(item, index) in punchLog.imagesUrl.breakfastImages" title="点击大图预览" :key="index"
|
||||
@ -37,7 +37,7 @@
|
||||
</el-image>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="punchLog != null && punchLog.imagesUrl.lunchImages.length > 0">
|
||||
<h4>午餐</h4>
|
||||
<div>
|
||||
<el-image v-for="(item, index) in punchLog.imagesUrl.lunchImages" title="点击大图预览" :key="index"
|
||||
@ -47,7 +47,7 @@
|
||||
</el-image>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="punchLog != null && punchLog.imagesUrl.dinnerImages.length > 0">
|
||||
<h4>晚餐</h4>
|
||||
<div>
|
||||
<el-image v-for="(item, index) in punchLog.imagesUrl.dinnerImages" title="点击大图预览" :key="index"
|
||||
@ -57,7 +57,7 @@
|
||||
</el-image>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="punchLog != null && punchLog.imagesUrl.extraMealImages.length > 0">
|
||||
<h4>加餐</h4>
|
||||
<div>
|
||||
<el-image v-for="(item, index) in punchLog.imagesUrl.extraMealImages" title="点击大图预览" :key="index"
|
||||
@ -67,7 +67,7 @@
|
||||
</el-image>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="punchLog != null && punchLog.imagesUrl.bodyImages.length > 0">
|
||||
<h4>体型对比照</h4>
|
||||
<div>
|
||||
<el-image v-for="(item, index) in punchLog.imagesUrl.bodyImages" title="点击大图预览" :key="index"
|
||||
@ -105,7 +105,7 @@ export default {
|
||||
punchTitleData: [
|
||||
["姓名", "体重(斤)","饮水量(ml)"],
|
||||
["睡觉时间", "起床时间","运动锻炼"],
|
||||
["情绪","按食谱进食","食谱外食物"],
|
||||
["情绪","按食谱进食","其他食物"],
|
||||
["熬夜失眠", "起床排便","是否便秘"]
|
||||
],
|
||||
//打卡详情的属性名称,与标题对应,按竖显示
|
||||
@ -175,6 +175,7 @@ export default {
|
||||
onClosed() {
|
||||
this.data = null;
|
||||
this.punchLog = null,
|
||||
this.imageUrl = [],
|
||||
this.punchLogDetail = []
|
||||
}
|
||||
},
|
||||
|
271
stdiet-ui/src/components/PunchLog/PunchLogEdit/index.vue
Normal file
271
stdiet-ui/src/components/PunchLog/PunchLogEdit/index.vue
Normal file
@ -0,0 +1,271 @@
|
||||
<template>
|
||||
<!-- 修改打卡记录基础信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="visible" width="600px" append-to-body>
|
||||
<el-row :gutter="15">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="体重" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入体重" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="打卡日期" prop="logTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 192px;"
|
||||
v-model="form.logTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择打卡时间"
|
||||
:picker-options="logTimePickerOptions"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="睡觉时间" prop="sleepTime">
|
||||
<el-time-select
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 192px"
|
||||
v-model="form.sleepTime"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:15',
|
||||
end: '23:45',
|
||||
}"
|
||||
placeholder="选择睡觉时间"
|
||||
>
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="起床时间" prop="wakeupTime">
|
||||
<el-time-select
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 192px"
|
||||
v-model="form.wakeupTime"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:15',
|
||||
end: '23:45',
|
||||
}"
|
||||
placeholder="选择睡觉时间"
|
||||
>
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运动锻炼" prop="sport">
|
||||
<el-select v-model="form.sport" placeholder="请选择运动情况">
|
||||
<el-option
|
||||
v-for="dict in yesNoOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="按食谱" prop="diet">
|
||||
<el-select v-model="form.diet" placeholder="请选择饮食情况">
|
||||
<el-option
|
||||
v-for="dict in yesNoOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="熬夜失眠" prop="insomnia">
|
||||
<el-select v-model="form.insomnia" placeholder="请选择熬夜失眠">
|
||||
<el-option
|
||||
v-for="dict in yesNoOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="起床排便" prop="defecation">
|
||||
<el-select v-model="form.defecation" placeholder="请选择排便情况">
|
||||
<el-option
|
||||
v-for="dict in yesNoOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="便秘" prop="constipation">
|
||||
<el-select v-model="form.constipation" placeholder="请选择便秘情况">
|
||||
<el-option
|
||||
v-for="dict in yesNoOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="饮水量" prop="water">
|
||||
<el-input v-model="form.water" style="width: 192px" placeholder="请输入饮水量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form-item label="情绪" prop="emotion">
|
||||
<el-input
|
||||
v-model="form.emotion"
|
||||
type="textarea"
|
||||
placeholder="请输入情绪"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<el-form-item label="其他食物" prop="slyEatFood">
|
||||
<el-input
|
||||
v-model="form.slyEatFood"
|
||||
type="textarea"
|
||||
placeholder="请输入其他食物"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getWxUserLog,updateWxUserLog
|
||||
} from "@/api/custom/wxUserLog";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
name: "PunchLogEdit",
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
title: "",
|
||||
punchLog: null,
|
||||
form: {},
|
||||
rules:{
|
||||
weight: [
|
||||
{ required: true, message: "体重不能为空", trigger: "blur" },
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
pattern: /^(([^0][0-9]+|0)\.([0-9]{1,2})$)|^([^0][0-9]+|0)$/,
|
||||
message: "体重格式不正确",
|
||||
},
|
||||
],
|
||||
water: [
|
||||
{ required: true, message: "饮水量不能为空", trigger: "blur" },
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
pattern: /^([^0][0-9]+|0)$/,
|
||||
message: "饮水量格式不正确",
|
||||
}
|
||||
],
|
||||
logTime: [
|
||||
{ required: true, message: "打卡时间不能为空", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
logTimePickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() > dayjs()
|
||||
},
|
||||
},
|
||||
yesNoOptions: [],
|
||||
callback: null
|
||||
};
|
||||
},
|
||||
created(){
|
||||
this.getDicts("sys_yes_no").then((response) => {
|
||||
this.yesNoOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
showDialog(data, callback) {
|
||||
this.punchLog = data;
|
||||
this.callback = callback;
|
||||
this.title = `修改「${data.customerName}`+" "+`${data.logTime}」打卡记录`;
|
||||
this.getWxUserLog();
|
||||
},
|
||||
getWxUserLog() {
|
||||
this.reset();
|
||||
getWxUserLog(this.punchLog.id).then((response) => {
|
||||
if (response.code == 200) {
|
||||
this.form = response.data;
|
||||
this.visible = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
reset(){
|
||||
this.form = {
|
||||
id: null,
|
||||
weight: null,
|
||||
sleepTime: null,
|
||||
wakeupTime: null,
|
||||
sport: null,
|
||||
diet: null,
|
||||
insomnia: null,
|
||||
defecation: null,
|
||||
water: null,
|
||||
logTime: null,
|
||||
constipation: null,
|
||||
emotion: null,
|
||||
slyEatFood: null
|
||||
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateWxUserLog(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.visible = false;
|
||||
this.callback && this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
onClosed() {
|
||||
this.form = null;
|
||||
this.punchLog = null
|
||||
},
|
||||
cancel(){
|
||||
this.visible = false
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
@ -19,6 +19,11 @@ import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import VueScrollTo from "vue-scrollto";
|
||||
import VueResource from "vue-resource"
|
||||
import HighchartsVue from 'highcharts-vue'
|
||||
import Highcharts from 'highcharts'
|
||||
//图片导出模块
|
||||
import exportingInit from 'highcharts/modules/exporting'
|
||||
exportingInit(Highcharts)
|
||||
|
||||
import {
|
||||
addDateRange,
|
||||
@ -69,6 +74,7 @@ Vue.component("Pagination", Pagination);
|
||||
Vue.component("RightToolbar", RightToolbar);
|
||||
|
||||
Vue.use(permission);
|
||||
Vue.use(HighchartsVue);
|
||||
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
|
@ -235,10 +235,27 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="打卡记录"
|
||||
align="center"
|
||||
v-hasPermi="['custom:wxUserLog:list']"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="handleClickCustomerPunchLog(scope.row)"
|
||||
>详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
@ -375,6 +392,8 @@
|
||||
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
|
||||
<!-- 食谱计划抽屉 -->
|
||||
<RecipesPlanDrawer ref="recipesPlanDrawerRef" />
|
||||
<!-- 客户打卡记录 -->
|
||||
<CustomerPunchLogDrawer ref="customerPunchLogDrawerRef"></CustomerPunchLogDrawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -394,6 +413,7 @@ import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
|
||||
import ContractDrawer from "@/components/ContractDrawer";
|
||||
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
|
||||
import RecipesPlanDrawer from "@/components/RecipesPlanDrawer";
|
||||
import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
@ -404,6 +424,7 @@ export default {
|
||||
"contract-drawer": ContractDrawer,
|
||||
heatStatisticsDrawer: HeatStatisticsDrawer,
|
||||
RecipesPlanDrawer,
|
||||
CustomerPunchLogDrawer
|
||||
},
|
||||
data() {
|
||||
const userId = store.getters && store.getters.userId;
|
||||
@ -552,6 +573,10 @@ export default {
|
||||
handleClickHeatStatistics(row) {
|
||||
this.$refs["heatStatisticsRef"].showDrawer(row);
|
||||
},
|
||||
handleClickCustomerPunchLog(row) {
|
||||
this.$refs["customerPunchLogDrawerRef"].showDrawer(row);
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
|
@ -52,6 +52,20 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="打卡日期" prop="logTimeScope" style="margin-left:15px">
|
||||
<el-date-picker
|
||||
v-model="logTimeScope"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="打卡开始日期"
|
||||
end-placeholder="打卡结束日期"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:picker-options="logTimePickerOptions"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -233,6 +247,7 @@
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
width="140"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -242,14 +257,14 @@
|
||||
v-hasPermi="['custom:wxUserLog:query']"
|
||||
>详情
|
||||
</el-button>
|
||||
<!--<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>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@ -270,136 +285,9 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改微信用户记录对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-row :gutter="15">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="体重" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入体重" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="打卡日期" prop="logTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
v-model="form.logTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
:picker-options="logTimePickerOptions"
|
||||
placeholder="选择睡觉时间"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="睡觉时间" prop="sleepTime">
|
||||
<el-time-select
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
v-model="form.sleepTime"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:15',
|
||||
end: '23:45',
|
||||
}"
|
||||
placeholder="选择睡觉时间"
|
||||
>
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="起床时间" prop="wakeupTime">
|
||||
<el-time-select
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
v-model="form.wakeupTime"
|
||||
:picker-options="{
|
||||
start: '00:00',
|
||||
step: '00:15',
|
||||
end: '23:45',
|
||||
}"
|
||||
placeholder="选择睡觉时间"
|
||||
>
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运动锻炼" prop="sport">
|
||||
<el-select v-model="form.sport" placeholder="请选择运动情况">
|
||||
<el-option
|
||||
v-for="dict in sportOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="按食谱" prop="diet">
|
||||
<el-select v-model="form.diet" placeholder="请选择饮食情况">
|
||||
<el-option
|
||||
v-for="dict in dietOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="熬夜失眠" prop="insomnia">
|
||||
<el-select v-model="form.insomnia" placeholder="请选择熬夜失眠">
|
||||
<el-option
|
||||
v-for="dict in insomniaOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="起床排便" prop="defecation">
|
||||
<el-select v-model="form.defecation" placeholder="请选择排便情况">
|
||||
<el-option
|
||||
v-for="dict in defecationOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<el-form-item label="饮水量" prop="water">
|
||||
<el-input v-model="form.water" placeholder="请输入饮水量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<PunchLogEdit ref="punchLogEditRef"></PunchLogEdit>
|
||||
<!-- 详情 -->
|
||||
<PunchLogDetail ref="punchLogDetailRef"></PunchLogDetail>
|
||||
</div>
|
||||
</template>
|
||||
@ -415,7 +303,9 @@ import {
|
||||
} from "@/api/custom/wxUserLog";
|
||||
import { mapGetters } from "vuex";
|
||||
import PunchLogDetail from "@/components/PunchLog/PunchLogDetail";
|
||||
import PunchLogEdit from "@/components/PunchLog/PunchLogEdit";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
import dayjs from "dayjs";
|
||||
export default {
|
||||
name: "WxUserLog",
|
||||
data() {
|
||||
@ -463,13 +353,14 @@ export default {
|
||||
rules: {},
|
||||
logTimePickerOptions: {
|
||||
disabledDate(time) {
|
||||
return time.getTime() > Date.now();
|
||||
return time.getTime() > dayjs()
|
||||
},
|
||||
},
|
||||
logTimeScope: null
|
||||
};
|
||||
},
|
||||
components:{
|
||||
PunchLogDetail,AutoHideMessage
|
||||
PunchLogDetail,AutoHideMessage,PunchLogEdit
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
@ -500,7 +391,9 @@ export default {
|
||||
methods: {
|
||||
/** 查询微信用户记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.loading = true;
|
||||
this.queryParams.beginTime = 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) => {
|
||||
this.wxUserLogList = response.rows;
|
||||
this.total = response.total;
|
||||
@ -573,6 +466,7 @@ export default {
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.logTimeScope = null;
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
@ -589,12 +483,8 @@ export default {
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids;
|
||||
getWxUserLog(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改微信用户记录";
|
||||
this.$refs.punchLogEditRef.showDialog(row, () => {
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@ -626,7 +516,7 @@ export default {
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm(
|
||||
'是否确认删除微信用户记录编号为"' + ids + '"的数据项?',
|
||||
'是否确认删除该用户的打卡记录?',
|
||||
"警告",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
|
Loading…
x
Reference in New Issue
Block a user