!204 打卡优化

Merge pull request !204 from 德仔/xzj
This commit is contained in:
德仔
2021-04-15 12:01:47 +08:00
committed by Gitee
21 changed files with 1382 additions and 50 deletions

View File

@ -70,4 +70,16 @@ export function getAllPunchLogByCustomerId(query) {
})
}
// 点评打卡
export function commentPunchContent(data) {
return request({
url: '/custom/wxUserLog/commentPunchContent',
method: 'post',
data: data
})
}

View File

@ -8,15 +8,16 @@
>
<div style="margin-top: -20px;">
<div
style="float: right; "
style="float: right; margin-bottom:10px"
>
<!--<el-button
<el-button
v-hasPermi="['custom:wxUserLog:query']"
type="primary"
plain
>评分</el-button
>-->
@click="clickComment()"
>打卡点评</el-button
>
</div>
@ -26,12 +27,12 @@
<h3>基础信息</h3>
<TableDetailMessage :data="punchLogDetail"></TableDetailMessage>
<h3>图片信息</h3>
<div style="height: 400px; overflow: auto">
<div style="height: 370px; overflow: auto">
<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"
style="width: 300px; height: 380px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -41,7 +42,7 @@
<h4>午餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.lunchImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -51,7 +52,7 @@
<h4>晚餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.dinnerImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -61,7 +62,7 @@
<h4>加餐</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.extraMealImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -71,7 +72,7 @@
<h4>体型对比照</h4>
<div>
<el-image v-for="(item, index) in punchLog.imagesUrl.bodyImages" title="点击大图预览" :key="index"
style="width: 300px; height: 400px"
style="width: 300px; height: 300px"
:src="item"
:preview-src-list="imageUrl">
</el-image>
@ -79,12 +80,44 @@
</div>
</div>
</div>
</div>
</div>
<el-dialog :visible.sync="commentVisible" :title="commentTitle" width="500px" append-to-body @closed="commentClosed">
<el-form ref="form" :model="commentForm" :rules="commentRules" label-position="top" label-width="100px">
<el-form-item label="打卡评分" prop="executionScore" >
<el-rate
v-model="commentForm.executionScore"
show-score
allow-half
text-color="#ff9900"
>
</el-rate>
</el-form-item>
<el-form-item label="点评内容" prop="comment" >
<el-input
type="textarea"
:rows="4"
maxlength="200"
show-word-limit
placeholder="请输入点评内容"
v-model="commentForm.comment">
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" >
<el-button type="primary" @click="commentSubmit()"> </el-button>
<el-button @click="commentClosed()"> </el-button>
</div>
</el-dialog>
</el-dialog>
</template>
<script>
import {
getPunchLogDetail
getPunchLogDetail,commentPunchContent
} from "@/api/custom/wxUserLog";
import TableDetailMessage from "@/components/TableDetailMessage";
@ -98,6 +131,7 @@ export default {
visible: false,
title: "",
data: null,
callback: null,
punchLog: null,
imageUrl: [],
punchLogDetail: [],
@ -106,15 +140,26 @@ export default {
["姓名", "体重(斤)","饮水量(ml)"],
["睡觉时间", "起床时间","运动锻炼"],
["情绪","按食谱进食","其他食物"],
["熬夜失眠", "起床排便","是否便秘"]
["熬夜失眠", "起床排便","是否便秘"],
["服务建议", "评分","点评内容"]
],
//打卡详情的属性名称,与标题对应,按竖显示
punchValueData: [
["customerName","weight","water"],
["sleepTime", "wakeupTime","sport"],
["emotion", "diet","slyEatFood"],
["insomnia","defecation", "constipation"]
["insomnia","defecation", "constipation"],
["remark","executionScore","comment"],
],
commentVisible: false,
commentTitle: "",
commentForm:{
},
commentRules:{},
scoreArray:[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5],
commentFlag: false, //是否更新了点评
};
},
methods: {
@ -137,8 +182,10 @@ export default {
return "background:#ffffff;";
}
},
showDialog(data) {
showDialog(data, callback) {
this.data = data;
this.callback = callback;
this.commentFlag = false;
this.title = `${data.customerName}`+" "+`${data.logTime}」打卡记录`;
this.getPunchLogById();
},
@ -152,6 +199,8 @@ export default {
res.data.insomnia = res.data.insomnia === "Y" ? "是" : "否";
res.data.defecation = res.data.defecation === "Y" ? "是" : "否";
res.data.constipation = res.data.constipation === "Y" ? "是" : "否";
res.data.isScore = res.data.executionScore == null ? "否" : "是";
this.punchLogDetail = [];
for (let i = 0; i < this.punchTitleData.length; i++) {
this.punchLogDetail.push({
attr_name_one: this.punchTitleData[i][0],
@ -174,9 +223,42 @@ export default {
},
onClosed() {
this.data = null;
this.punchLog = null,
this.imageUrl = [],
this.punchLogDetail = []
this.callback = null;
this.punchLog = null;
this.imageUrl = [];
this.punchLogDetail = [];
},
clickComment(){
//console.log(this.punchLog.executionScore);
this.commentForm = {
id: this.punchLog.id,
comment: this.punchLog.comment,
executionScore: this.punchLog.executionScore == null ? 0 : this.punchLog.executionScore,
}
this.commentTitle = "点评「"+this.punchLog.customerName+" "+ this.punchLog.logTime +"」打卡";
this.commentVisible = true;
},
commentClosed(){
this.commentVisible = false;
},
commentSubmit(){
/*if(this.commentForm.executionScore == null || this.commentForm.executionScore == 0){
this.msgError("评分不能为0");
return;
}*/
commentPunchContent(this.commentForm).then((res) => {
if(res.code == 200){
this.msgSuccess("点评成功");
this.commentVisible = false;
this.getPunchLogById();
this.commentFlag = true;
this.callback && this.callback();
}else{
this.msgSuccess("点评失败");
}
});
}
},
};

View File

@ -197,7 +197,7 @@
label="情绪"
align="center"
prop="emotion"
width="160"
width="120"
>
<template slot-scope="scope">
<AutoHideMessage :maxLength="4" :data="scope.row.emotion"></AutoHideMessage>
@ -214,7 +214,7 @@
label="其他食物"
align="center"
prop="slyEatFood"
width="160"
width="120"
>
<template slot-scope="scope">
<AutoHideMessage :maxLength="4" :data="scope.row.slyEatFood"></AutoHideMessage>
@ -243,6 +243,15 @@
<span>{{ `${scope.row.water} ml` }}</span>
</template>
</el-table-column>
<el-table-column label="是否点评" align="center" prop="executionScore">
<template slot-scope="scope">
<el-tag
:type="scope.row.executionScore == null ? 'danger' : 'success'"
>
{{ scope.row.executionScore == null ? "未点评" : "已点评" }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
@ -534,7 +543,9 @@ export default {
.catch(function () {});
},
showPunchLogDetail(data){
this.$refs.punchLogDetailRef.showDialog(data);
this.$refs.punchLogDetailRef.showDialog(data,() => {
this.getList();
});
},
/** 导出按钮操作 */
handleExport() {