|
@@ -0,0 +1,259 @@
|
|
|
+<script lang="ts" setup>
|
|
|
+import moment from 'moment'
|
|
|
+import request from '@/config/axios'
|
|
|
+import { getUserInfo } from '@/utils/tool'
|
|
|
+interface IProp {
|
|
|
+ detail: any
|
|
|
+}
|
|
|
+const { detail } = defineProps<IProp>()
|
|
|
+
|
|
|
+const emojiList = ['赞!👍', '写的太棒了!👏', '学习了🌹', '感谢你的分享🙏', '加油💪', '早点休息😴']
|
|
|
+
|
|
|
+const message = useMessage()
|
|
|
+const userInfo = getUserInfo()
|
|
|
+// 评论字段
|
|
|
+interface IComment {
|
|
|
+ reportId: string // 报告id
|
|
|
+ commentUserId: string // 评论人用户id
|
|
|
+ commentContent: string // 评论内容
|
|
|
+ commentDate?: string // 评论时间
|
|
|
+ replyToUserid?: string // 被回复人用户ID
|
|
|
+}
|
|
|
+// 提交评论
|
|
|
+const submitComment = async (content?) => {
|
|
|
+ if (!content && commentInput.value == '') {
|
|
|
+ message.info('评论内容不能为空!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const data = {
|
|
|
+ reportId: detail.id,
|
|
|
+ commentUserId: userInfo.id ?? '',
|
|
|
+ commentContent: content ?? commentInput.value
|
|
|
+ }
|
|
|
+ const result: any = await request.postOriginal({ url: '/adm/reportComment/send', data })
|
|
|
+ if (result.msg == 'success') {
|
|
|
+ getCommentList()
|
|
|
+ message.success('评论成功!')
|
|
|
+ // 清空输入框
|
|
|
+ if (!content) {
|
|
|
+ commentInput.value = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ message.error('评论失败,请稍后再试')
|
|
|
+ }
|
|
|
+}
|
|
|
+const commentList = ref<any[]>(detail?.comments ?? [])
|
|
|
+// 获取报告被评论列表
|
|
|
+const getCommentList = async () => {
|
|
|
+ const result = await request.get({
|
|
|
+ url: '/adm/reportComment/getList',
|
|
|
+ params: { reportId: detail?.id, uId: detail?.userId }
|
|
|
+ })
|
|
|
+ commentList.value = result
|
|
|
+}
|
|
|
+const commentInput = ref('')
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getCommentList()
|
|
|
+})
|
|
|
+</script>
|
|
|
+<template>
|
|
|
+ <div class="detail-box">
|
|
|
+ <div class="form-box">
|
|
|
+ <el-form ref="form" label-width="100px">
|
|
|
+ <el-row :gutter="24">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item class="label-item" label="日志日期">
|
|
|
+ <div class="write-date">
|
|
|
+ {{ moment(detail.reportStartDate).format('YYYY-MM-DD') }}
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item class="label-item" label="接收人">
|
|
|
+ <div class="tag-list">
|
|
|
+ <el-tag
|
|
|
+ type="info"
|
|
|
+ effect="light"
|
|
|
+ v-for="(item, index) in detail.receiveNames"
|
|
|
+ :key="index"
|
|
|
+ >{{ item }}</el-tag
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" style="height: 100%">
|
|
|
+ <el-form-item class="label-item" label="今日工作">
|
|
|
+ <div
|
|
|
+ class="text-area"
|
|
|
+ v-html="detail?.reportContent?.replace(/(\r\n|\n|\r)/gm, '<br />')"
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" style="height: 100%">
|
|
|
+ <el-form-item class="label-item" label="工作量分配">
|
|
|
+ <div class="text-area area2">
|
|
|
+ <div v-for="(item, index) in detail.workload" :key="index">
|
|
|
+ <span class="work-time">{{ `(${item.workTime}小时)` }}</span>
|
|
|
+ <span>{{ item.projectName }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="comment-box">
|
|
|
+ <div class="comment-list">
|
|
|
+ <div v-if="commentList.length === 0" class="not-comment">
|
|
|
+ <el-empty description="暂无评论" image-size="35" />
|
|
|
+ </div>
|
|
|
+ <div v-else v-for="(item, index) in commentList" :key="index" class="item">
|
|
|
+ <div class="left">
|
|
|
+ <span>{{ item.commentUserName.substr(-2) }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <div class="title">
|
|
|
+ {{
|
|
|
+ `${item.commentUserName} ${moment(item.commentDate).format('YYYY-MM-DD HH:mm:ss')}`
|
|
|
+ }}
|
|
|
+ <span>删除</span>
|
|
|
+ </div>
|
|
|
+ <div>{{ item.commentContent }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="comment-emoji">
|
|
|
+ <span v-for="(item, index) in emojiList" :key="index" @click="submitComment(item)">{{
|
|
|
+ item
|
|
|
+ }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="comment-input">
|
|
|
+ <el-input v-model="commentInput" placeholder="请输入评论内容" />
|
|
|
+ <el-button class="submit" type="primary" @click="submitComment()">发表评价</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<style scoped lang="scss">
|
|
|
+.detail-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ .form-box {
|
|
|
+ width: 100%;
|
|
|
+ .label-item {
|
|
|
+ .el-form-item__label {
|
|
|
+ font-weight: 400 !important;
|
|
|
+ font-size: 16px !important;
|
|
|
+ }
|
|
|
+ .write-date {
|
|
|
+ width: 100px;
|
|
|
+ border: 1px solid #dee0e3;
|
|
|
+ border-radius: 4px;
|
|
|
+ text-align: center;
|
|
|
+ background: #f9f9f9;
|
|
|
+ }
|
|
|
+ .text-area {
|
|
|
+ width: 100%;
|
|
|
+ height: 132px;
|
|
|
+ overflow-y: scroll;
|
|
|
+ background: #f9f9f9;
|
|
|
+ border-radius: 4px 4px 4px 4px;
|
|
|
+ border: 1px solid #c7ceda;
|
|
|
+ padding: 5px 10px;
|
|
|
+ }
|
|
|
+ .area2 {
|
|
|
+ height: 90px;
|
|
|
+ .work-time {
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #1b80eb;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tag-list {
|
|
|
+ width: 100%;
|
|
|
+ max-height: 65px;
|
|
|
+ overflow-y: scroll;
|
|
|
+ .el-tag {
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .comment-box {
|
|
|
+ width: 100%;
|
|
|
+ padding-left: 100px;
|
|
|
+ .comment-list {
|
|
|
+ height: 180px;
|
|
|
+ overflow-y: scroll;
|
|
|
+ background: #f7f8fa;
|
|
|
+ border-radius: 4px 4px 4px 4px;
|
|
|
+ border: 1px solid #eef2f9;
|
|
|
+ padding: 10px;
|
|
|
+ .item {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ border-bottom: 1px solid #e3eaf5;
|
|
|
+ height: 85px;
|
|
|
+ .left {
|
|
|
+ width: 80px;
|
|
|
+ text-align: center;
|
|
|
+ span {
|
|
|
+ display: inline-block;
|
|
|
+ width: 44px;
|
|
|
+ height: 44px;
|
|
|
+ line-height: 44px;
|
|
|
+ color: #ffffff;
|
|
|
+ background-color: #5a99e3;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #121518;
|
|
|
+ line-height: 16px;
|
|
|
+ .title {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #8a94a4;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ span {
|
|
|
+ color: #1b80eb;
|
|
|
+ margin-left: 15px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .comment-emoji {
|
|
|
+ height: 50px;
|
|
|
+ line-height: 50px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #626b70;
|
|
|
+ span {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .comment-input {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .submit {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|