对接评论

This commit is contained in:
qq787203167
2022-04-29 16:21:59 +08:00
parent d339f4abfe
commit 7163c5af5f
@@ -12,36 +12,36 @@
<a-button @click="handleSubmit" type="primary">{{$t('publishComment')}}</a-button> <a-button @click="handleSubmit" type="primary">{{$t('publishComment')}}</a-button>
</div> </div>
<div class="comment-box"> <div class="comment-box">
<div class="comment-box-top-box" v-for="(item,index) in 3"> <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="title-text">{{$t('record')+(index + 1)}}</div>
<div class="box-content"> <div class="box-content">
<div class="img-box"> <div class="img-box">
<img src="../../../assets/daiban.png" class="img" alt=""> <img src="../../../assets/daiban.png" class="img" alt="">
</div> </div>
<div class="box-text"> <div class="box-text">
<span class="box-text-name">张三</span> <span class="box-text-name">{{item.name}}</span>
<span calss="box-text-time">2012-45-45 12:00:00</span> <span calss="box-text-time">{{item.createTime}}</span>
</div> </div>
<div class="box-text-text"> <div class="box-text-text">
法规清单缺少标准’’GB 7258“,注意补充 {{item.content}}
</div> </div>
<div class="box-icon" @click="messageClick()"> <div class="box-icon" @click="messageClick(item)">
<a-icon type="message"/> <a-icon type="message"/>
</div> </div>
</div> </div>
<div class="inside-box"> <div class="inside-box" v-if="item.ProjectCommentVOList && item.ProjectCommentVOList.length > 0">
<div class="box-content-inside" v-for="item in 2"> <div class="box-content-inside" v-for="(val,indexOne) in item.ProjectCommentVOList" :key="indexOne">
<div class="img-box"> <div class="img-box">
<img src="../../../assets/daiban.png" class="img" alt=""> <img src="../../../assets/daiban.png" class="img" alt="">
</div> </div>
<div class="box-text"> <div class="box-text">
<span class="box-text-name">张三</span> <span class="box-text-name">{{val.name}}</span>
<span calss="box-text-time">2012-45-45 12:00:00</span> <span calss="box-text-time">{{val.createTime}}</span>
</div> </div>
<div class="box-text-text"> <div class="box-text-text">
法规清单缺少标准’’GB 7258“,注意补充 {{val.content}}
</div> </div>
<div class="box-icon" @click="messageClick()"> <div class="box-icon" @click="messageClick(val)">
<a-icon type="message"/> <a-icon type="message"/>
</div> </div>
</div> </div>
@@ -65,11 +65,17 @@
<div class="title-text"> <div class="title-text">
<span class="title-text-text" :title="title">{{title}}</span> <span class="title-text-text" :title="title">{{title}}</span>
</div> </div>
<a-form-model-item class="itemModel" :prop="'publishComment'"> <a-form-model-item v-if="title == $t('replyToComments')" class="itemModel" :prop="'replyContent'">
<a-textarea <a-textarea
:placeholder="$t('PleaseEnter')+title" :placeholder="$t('PleaseEnter')+title"
:disabled="false" :disabled="false"
v-model="formInline.publishComment" :rows="4"/> v-model="formInline.replyContent" :rows="4"/>
</a-form-model-item>
<a-form-model-item v-else-if="title == $t('publishComment')" class="itemModel" :prop="'commentContent'">
<a-textarea
:placeholder="$t('PleaseEnter')+title"
:disabled="false"
v-model="formInline.commentContent" :rows="4"/>
</a-form-model-item> </a-form-model-item>
</div> </div>
</a-col> </a-col>
@@ -81,22 +87,37 @@
</template> </template>
<script> <script>
import { getAction, postAction } from '@/api/manage'
export default { export default {
name: 'commentList', name: 'commentList',
data() { data() {
return { return {
visible: false, visible: false,
dataList: [],
formInline: {}, formInline: {},
title: this.$t('comment'), title: this.$t('comment'),
confirmLoading: false, confirmLoading: false,
visibleComment: false, visibleComment: false,
url: {
list: '/project/projectCommentEO/list',
add: '/project/projectCommentEO/add',
edit: '/project/projectReplyEO/add'
},
rules: { rules: {
publishComment: [ commentContent: [
{ {
required: true, required: true,
message: this.$t('publishComment') + this.$t('cannotEmpty'), message: this.$t('publishComment') + this.$t('cannotEmpty'),
trigger: 'blur' trigger: 'blur'
} }
],
replyContent: [
{
required: true,
message: this.$t('replyToComments') + this.$t('cannotEmpty'),
trigger: 'blur'
}
] ]
} }
} }
@@ -112,12 +133,43 @@
}, },
handleSubmit() { handleSubmit() {
this.title = this.$t('publishComment') this.title = this.$t('publishComment')
this.formInline = {}
this.visibleComment = true this.visibleComment = true
}, },
getList() {
getAction(this.url.list, {}).then((res) => {
if (res.success) {
this.dataList = res.result || []
} else {
this.dataList = []
}
})
},
handleOkComment() { handleOkComment() {
this.$refs.ruleForm.validate(valid => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
let url = ''
let query = {}
if (this.title == this.$t('publishComment')) {
url = this.url.add
query = {
commentContent: this.formInline.commentContent,
projectLibraryId: this.$route.query.id
}
} else if (this.title == this.$t('replyToComments')) {
url = this.url.edit
query = {
replyContent: this.formInline.replyContent,
projectCommentId: this.formInline.id
}
}
postAction(url, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.success(this.$t('operationFailed'))
}
})
} }
}) })
this.visibleComment = false this.visibleComment = false
@@ -125,7 +177,9 @@
handleCancelComment() { handleCancelComment() {
this.visibleComment = false this.visibleComment = false
}, },
messageClick() { messageClick(row) {
this.formInline = {}
this.formInline.projectCommentId = row.id
this.title = this.$t('replyToComments') this.title = this.$t('replyToComments')
this.visibleComment = true this.visibleComment = true
} }