update 文档对比

This commit is contained in:
赵霄
2023-09-20 11:26:34 +08:00
parent fbe03c0564
commit 4601acb8b2
6 changed files with 72 additions and 67 deletions
@@ -1,306 +0,0 @@
<template>
<div>
<a-drawer
:title="$t('comment')"
:maskClosable="false"
:width="482"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible">
<div class="button-box">
<a-input-search class="box-input box-input-search" allowClear
@search="allowClearChange"
:placeholder="$t('pleaseEnter')+$t('docTool.comparison.comment')"
v-model="commentContent"></a-input-search>
<a-button @click="submitQuery" style="margin-right: 8px;" type="primary">{{$t('query')}}</a-button>
<a-button @click="handleSubmit" :title="$t('docTool.comparison.publishComment')" type="primary">
{{$t('docTool.comparison.publishComment')}}
</a-button>
</div>
<div class="comment-box" v-if="dataList && dataList.length > 0">
<div class="comment-box-top-box" v-for="(item,index) in dataList" :key="index">
<!-- <div class="title-text">{{$t('record')+(index + 1)}}</div>-->
<div class="box-content">
<div class="img-box">
<img src="../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="box-text">
<span class="box-text-name">{{item.name}}</span>
<span class="box-text-time">{{item.createTime}}</span>
</div>
<div class="box-text-text">
{{item.content}}
</div>
<div class="box-icon" @click="messageClick(item)">
<a-icon type="message"/>
</div>
</div>
<div class="inside-box" v-if="item.resComVoList && item.resComVoList.length > 0">
<div class="box-content-inside" v-for="(val,indexOne) in item.resComVoList" :key="indexOne">
<div class="img-box">
<img src="../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="box-text">
<span class="box-text-name">{{val.name}}</span>
<span class="box-text-time">{{val.createTime}}</span>
</div>
<div class="box-text-text">
{{val.content}}
</div>
<div class="box-icon" @click="messageClick(item)">
<a-icon type="message"/>
</div>
</div>
</div>
</div>
</div>
<div class="comment-box-text" v-else>{{$t('docTool.comparison.noComment')}}</div>
</a-drawer>
<comparison-add-reply-comment ref="comparisonAddReplyComment"></comparison-add-reply-comment>
</div>
</template>
<script>
import { getAction } from '@/api/manage'
// 添加评论和回复评论弹框
import ComparisonAddReplyComment from './ComparisonAddReplyComment'
export default {
name: 'CommentList',
components: { ComparisonAddReplyComment },
data () {
return {
visible: false,
dataList: [],
commentContent: '',
loading: false,
url: {
list: '/compare/sarFileCompareResComment/queryListByInfoId',
add: '/compare/sarFileCompareResComment/add',
edit: '/compare/sarFileCompareResComment/edit'
}
}
},
methods: {
handleCancel () {
this.visible = false
},
getData () {
this.visible = true
this.commentContent = ''
this.getList()
},
handleSubmit () {
this.$refs.comparisonAddReplyComment.title = this.$t('docTool.comparison.publishComment')
this.$refs.comparisonAddReplyComment.open({})
},
allowClearChange () {
this.getList()
},
submitQuery () {
this.getList()
},
getList () {
this.loading = true
getAction(this.url.list, {
id: this.$route.query.id,
str: this.commentContent
}).then((res) => {
if (res.success) {
this.dataList = res.result || []
} else {
this.dataList = []
}
}).finally(() => {
this.loading = false
})
},
messageClick (row) {
const obj = {}
obj.projectCommentId = row.id
this.$refs.comparisonAddReplyComment.title = this.$t('docTool.comparison.replyToComments')
this.$refs.comparisonAddReplyComment.open(obj)
}
}
}
</script>
<style scoped lang="less">
.comment-box {
position: absolute;
left: 0;
height: calc(100% - 140px);
width: 100%;
overflow: auto;
padding: 0 24px 24px 24px;
box-sizing: border-box;
}
.comment-box-top-box {
padding: 30px 24px 24px 24px;
box-sizing: border-box;
border: 1px solid #F1F2F4;
border-radius: 4px;
margin-bottom: 24px;
}
.img-box {
width: 32px;
height: 32px;
border-radius: 50%;
display: inline-block;
margin-right: 8px;
position: absolute;
.img {
width: 100%;
height: 100%;
}
}
.box-text {
display: inline-block;
position: absolute;
margin-left: 40px;
.box-text-name {
font-size: 14px;
font-weight: bold;
color: #040B29;
margin-right: 8px;
}
.box-text-time {
font-size: 14px;
font-weight: 400;
color: #6F7385;
}
}
.box-text-text {
font-size: 14px;
font-weight: 400;
color: #040B29;
display: inline-block;
margin-top: 22px;
margin-left: 40px;
word-break: break-word;
}
.title-text {
font-size: 16px;
font-weight: 400;
color: #040B29;
margin-bottom: 18px;
}
.box-content {
position: relative;
}
.box-content-inside {
position: relative;
margin-bottom: 15px;
}
.box-icon {
position: absolute;
right: 0;
top: 0;
cursor: pointer;
}
.inside-box {
background: #F6F7FA;
border-radius: 4px;
margin-left: 40px;
width: calc(100% - 40px);
padding: 18px;
box-sizing: border-box;
margin-top: 15px;
}
.button-box {
text-align: right;
margin-bottom: 24px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 74px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 48px;
}
.item-model {
width: calc(100% - 64px);
display: inline-block;
margin-top: 2px;
}
.required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.comment-box-text {
text-align: center;
margin-top: 40px;
}
.box-input {
width: calc(100% - 183px);
margin-right: 8px;
}
.button-text {
width: 88px;
overflow: hidden;
padding: 0 8px;
float: right;
}
/deep/ .button-text span {
width: 64px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-top: 4px;
}
.box-input-search {
/deep/ .ant-input-search-icon {
display: none;
}
}
</style>
@@ -1,122 +0,0 @@
<template>
<a-modal
:title="title"
:width="500"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOkComment"
@cancel="handleCancelComment"
>
<a-form-model :model="formInline" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="title">{{title}}</span>
</div>
<a-form-model-item v-if="title === $t('docTool.comparison.replyToComments')" class="item-model" :prop="'replyContent'">
<a-textarea
:placeholder="$t('pleaseEnter')+title"
:disabled="false"
:maxLength="500"
v-model.trim="formInline.replyContent"
:autoSize="{ minRows: 2, maxRows: 6 }" />
</a-form-model-item>
<a-form-model-item v-else-if="title === $t('docTool.comparison.publishComment')" class="item-model" :prop="'commentContent'">
<a-textarea
:placeholder="$t('pleaseEnter')+title"
:disabled="false"
:maxLength="500"
v-model.trim="formInline.commentContent"
:autoSize="{ minRows: 2, maxRows: 6 }"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
</template>
<script>
import { postAction } from '@/api/manage'
export default {
name: 'ComparisonAddReplyComment',
data () {
return {
title: this.$t('docTool.comparison.comment'),
visible: false,
confirmLoading: false,
formInline: {},
rules: {
commentContent: [
{
required: true,
message: this.$t('docTool.comparison.publishComment') + this.$t('cannotEmpty'),
trigger: 'blur'
}
],
replyContent: [
{
required: true,
message: this.$t('docTool.comparison.replyToComments') + this.$t('cannotEmpty'),
trigger: 'blur'
}
]
}
}
},
methods: {
open (formInLine) {
this.visible = true
this.formInline = Object.assign({}, formInLine)
},
handleOkComment () {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let query = {}
let Action
if (this.title === this.$t('docTool.comparison.publishComment')) {
url = this.url.add
Action = postAction
query = {
comment: this.formInline.commentContent,
infoId: this.$route.query.id
}
} else if (this.title === this.$t('docTool.comparison.replyToComments')) {
Action = postAction
url = this.url.add
query = {
comment: this.formInline.replyContent,
parentId: this.formInline.projectCommentId,
infoId: this.$route.query.id
}
}
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.getList()
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancelComment () {
this.visible = false
}
}
}
</script>
<style scoped lang="less">
@import'~@assets/less/common.less';
</style>