613 lines
22 KiB
Vue
613 lines
22 KiB
Vue
<template>
|
|
<a-spin :spinning="loading">
|
|
<div class="doc-detail-wrap">
|
|
<div class="doc-detail-header" style="position: fixed;top: 0">
|
|
<div class="doc-detail-title">
|
|
<span style="line-height: 66px;display: inline-block;float: left" @click="goBack">
|
|
<a-icon type="arrow-left" style="margin-right: 6px;"/>
|
|
</span>
|
|
<span> {{$t('docTool.comparison.documentComparison')}}</span>
|
|
</div>
|
|
<div class="doc-detail-right">
|
|
<div @click="viewTheComparisonResultsClick" class="operator-text-text"
|
|
:title="$t('docTool.comparison.viewTheComparisonResults')">
|
|
<a-icon type="eye"/>
|
|
{{$t('docTool.comparison.viewTheComparisonResults')}}
|
|
</div>
|
|
<div @click="addFullTextCommentClick" class="operator-text-text"
|
|
:title="$t('docTool.comparison.addFullTextComment')">
|
|
<a-icon type="message"/>
|
|
{{$t('docTool.comparison.addFullTextComment')}}
|
|
</div>
|
|
<div @click="turnOffAutomaticMatchingClick" class="operator-text-text"
|
|
:title="isMatching ? $t('docTool.comparison.turnOffAutomaticMatching'):$t('docTool.comparison.turnOnAutoMatch')">
|
|
<a-icon :type="isMatching?'close-circle':'check-circle'"/>
|
|
{{isMatching ? $t('docTool.comparison.turnOffAutomaticMatching'):$t('docTool.comparison.turnOnAutoMatch')}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="detail-content">
|
|
<div class="detail-content-cont">
|
|
<div class="detail-content-left">
|
|
<div class="detail-content-left-header"
|
|
:title="resultData.serialNumberLeft + resultData.fileNameLeft">
|
|
{{this.resultData.serialNumberLeft}}
|
|
{{this.resultData.fileNameLeft}}
|
|
</div>
|
|
<div class="detail-content-content-left">
|
|
<a-tree
|
|
class="draggable-tree"
|
|
@select="onSelectLeft"
|
|
:tree-data="resultData.menuLeft"
|
|
/>
|
|
</div>
|
|
<div class="detail-content-content-right-top">
|
|
<div class="detail-content-content-right">
|
|
<div class="detail-content-content-right-data" @click="detailLeft(index,item)"
|
|
v-for="(item,index) in resultData.textLeft" :key="index"
|
|
:class="{'detail-content-content-right-data-blue':item.reviewed === '1'}">
|
|
<div class="detail-content-content-right-data-text" style="margin-bottom: 10px;color: #040B29">
|
|
{{item.itemsNum + ' ' + item.itemsName}}
|
|
</div>
|
|
<div class="detail-content-content-right-data-text" v-html="item.itemsText"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="detail-content-right">
|
|
<div class="detail-content-left-header">
|
|
<span class="detail-content-left-header-text"
|
|
:title="resultData.serialNumberRight + resultData.fileNameRight">
|
|
{{this.resultData.serialNumberRight}}
|
|
{{this.resultData.fileNameRight}}
|
|
</span>
|
|
<!-- <span class="detail-content-left-header-text-right">-->
|
|
<!-- <span style="color: #9B9DA9">相似度:</span>-->
|
|
<!-- <span style="color: #E83030">98%</span>-->
|
|
<!-- </span>-->
|
|
</div>
|
|
<div class="detail-content-content-left">
|
|
<a-tree
|
|
class="draggable-tree"
|
|
@select="onSelectRight"
|
|
:tree-data="resultData.menuRight"
|
|
/>
|
|
</div>
|
|
<div class="detail-content-content-right-right-top">
|
|
<div class="detail-content-content-right-right">
|
|
<div class="detail-content-content-right-data-right" @click="detailRight(index,item)"
|
|
v-for="(item,index) in resultData.textRight" :key="index"
|
|
:class="{'detail-content-content-right-data-blue-right':item.reviewed === '1'}">
|
|
<div class="detail-content-content-right-data-text" style="margin-bottom: 10px;color: #040B29">
|
|
{{item.itemsNum + ' ' + item.itemsName}}
|
|
</div>
|
|
<div class="detail-content-content-right-data-text" v-html="item.itemsText">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="remarks">
|
|
<a-form-model :model="formInline"
|
|
class="formAdd" :rules="rules"
|
|
ref="ruleForm">
|
|
<div class="box-title-text-remarks">
|
|
<div class="title-text-remarks" :title="$t('docTool.comparison.comparisonOfArticles')" style="width: 84px">
|
|
<span>{{$t('docTool.comparison.comparisonOfArticles')}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" prop="comment">
|
|
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.comparisonOfArticles')"
|
|
v-model="formInline.comment"
|
|
:maxLength="500"
|
|
:rows="3"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-form-model>
|
|
</div>
|
|
<div class="submit-button">
|
|
<a-button style="margin-right: 10px"
|
|
type="primary" @click="consistentAssessmentClick()">{{$t('docTool.comparison.consistentAssessment')}}
|
|
</a-button>
|
|
<a-button type="primary" @click="submit()">{{$t('preservation')}}</a-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<a-modal
|
|
:title="$t('docTool.comparison.fullTextComments')"
|
|
:width="600"
|
|
:visible="visible"
|
|
:confirm-loading="textDataLoading"
|
|
:maskClosable="false"
|
|
@cancel="visible = false"
|
|
>
|
|
<template slot="footer">
|
|
<a-button type="primary" :loading="textDataLoading" @click="fullTextCommentsSubmit">
|
|
{{$t('submit')}}
|
|
</a-button>
|
|
</template>
|
|
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
|
|
<div class="box-title-text-remarks">
|
|
<div class="title-text-remarks" :title="$t('docTool.comparison.fullTextComments')">
|
|
<span>{{$t('docTool.comparison.fullTextComments')}}</span>
|
|
</div>
|
|
<a-form-model-item class="item-model" style="width: calc(100% - 113px)" prop="comment">
|
|
<a-textarea :placeholder="$t('pleaseEnter')+' '+$t('docTool.comparison.fullTextComments')"
|
|
v-model.trim="formInlineText.comment"
|
|
:maxLength="500"
|
|
:rows="4"/>
|
|
</a-form-model-item>
|
|
</div>
|
|
</a-form-model>
|
|
</a-modal>
|
|
</a-spin>
|
|
</template>
|
|
|
|
<script>
|
|
import { postAction, putAction, getAction } from '@/api/manage'
|
|
|
|
export default {
|
|
name: 'DocumentDataComparison',
|
|
data () {
|
|
return {
|
|
formInline: {},
|
|
formInlineText: {},
|
|
loadingText: false,
|
|
rules: {},
|
|
rulesText: {},
|
|
loading: false,
|
|
textDataLoading: false,
|
|
visible: false, // 全文评论弹框是否显示
|
|
resultData: {},
|
|
isMatching: true, // 自动匹配是否开启
|
|
dataLeft: {},
|
|
dataRight: {}
|
|
}
|
|
},
|
|
mounted () {
|
|
this.getData()
|
|
document.title = this.$t('docTool.comparison.documentComparison') + ' - ' + this.$t('edit')
|
|
},
|
|
methods: {
|
|
goBack () {
|
|
this.$router.push({
|
|
path: '/documentTool/documentComparison'
|
|
})
|
|
},
|
|
// 文档对比的一致按钮点击
|
|
consistentAssessmentClick () {
|
|
if (!this.dataLeft.id && !this.dataRight.id) {
|
|
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
|
|
return
|
|
}
|
|
const query = {
|
|
itemsIdLeft: this.dataLeft.id,
|
|
itemsIdRight: this.dataRight.id,
|
|
infoId: this.$route.query.id,
|
|
comment: '一致'
|
|
}
|
|
this.loading = true
|
|
postAction('/compare/sarFileCompareItemComment/add', query).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.formInline = {}
|
|
this.resultData.textRight.forEach(val => {
|
|
if (val.id === this.dataRight.id) {
|
|
val.reviewed = 1
|
|
}
|
|
})
|
|
this.resultData.textLeft.forEach(val => {
|
|
if (val.id === this.dataLeft.id) {
|
|
val.reviewed = 1
|
|
}
|
|
})
|
|
this.resultData = { ...this.resultData }
|
|
const detailLeftColor = document.getElementsByClassName('detail-content-content-right-data-color')
|
|
if (detailLeftColor && detailLeftColor.length > 0) {
|
|
detailLeftColor[0].classList.remove('detail-content-content-right-data-color')
|
|
}
|
|
const detailRightColor = document.getElementsByClassName('detail-content-content-right-data-color-right')
|
|
if (detailRightColor && detailRightColor.length > 0) {
|
|
detailRightColor[0].classList.remove('detail-content-content-right-data-color-right')
|
|
}
|
|
this.dataLeft = {}
|
|
this.dataRight = {}
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
// 文档对比的保存按钮点击
|
|
submit () {
|
|
if (!this.dataLeft.id && !this.dataRight.id) {
|
|
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
|
|
return
|
|
}
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
const query = {
|
|
itemsIdLeft: this.dataLeft.id,
|
|
itemsIdRight: this.dataRight.id,
|
|
infoId: this.$route.query.id,
|
|
comment: this.formInline.comment
|
|
}
|
|
this.loading = true
|
|
postAction('/compare/sarFileCompareItemComment/add', query).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.formInline = {}
|
|
this.resultData.textRight.forEach(val => {
|
|
if (val.id === this.dataRight.id) {
|
|
val.reviewed = 1
|
|
}
|
|
})
|
|
this.resultData.textLeft.forEach(val => {
|
|
if (val.id === this.dataLeft.id) {
|
|
val.reviewed = 1
|
|
}
|
|
})
|
|
this.resultData = { ...this.resultData }
|
|
const detailLeftColor = document.getElementsByClassName('detail-content-content-right-data-color')
|
|
if (detailLeftColor && detailLeftColor.length > 0) {
|
|
detailLeftColor[0].classList.remove('detail-content-content-right-data-color')
|
|
}
|
|
const detailRightColor = document.getElementsByClassName('detail-content-content-right-data-color-right')
|
|
if (detailRightColor && detailRightColor.length > 0) {
|
|
detailRightColor[0].classList.remove('detail-content-content-right-data-color-right')
|
|
}
|
|
this.dataLeft = {}
|
|
this.dataRight = {}
|
|
// this.$router.push({
|
|
// path: '/documentComparison'
|
|
// })
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 查看对比结果按钮点击
|
|
viewTheComparisonResultsClick () {
|
|
const newUrl = this.$router.resolve({
|
|
path: '/comparisonResults',
|
|
query: {
|
|
id: this.$route.query.id,
|
|
isDisplay: 2
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
// 添加全文评论按钮点击
|
|
addFullTextCommentClick () {
|
|
this.visible = true
|
|
const query = {
|
|
id: this.$route.query.id
|
|
}
|
|
this.textDataLoading = true
|
|
postAction('/compare/sarFileCompareInfo/getComparisonDetail', query).then((res) => {
|
|
if (res.success) {
|
|
this.formInlineText.comment = res.result.comments || ''
|
|
this.formInlineText = { ...this.formInlineText }
|
|
}
|
|
}).finally(() => {
|
|
this.textDataLoading = false
|
|
})
|
|
},
|
|
// 关闭自动匹配、开启自动匹配
|
|
turnOffAutomaticMatchingClick () {
|
|
this.isMatching = !this.isMatching
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
},
|
|
// 添加全文评论弹框的提交按钮
|
|
fullTextCommentsSubmit () {
|
|
this.$refs.ruleFormText.validate(valid => {
|
|
if (valid) {
|
|
const formInlineText = JSON.parse(JSON.stringify(this.formInlineText))
|
|
this.textDataLoading = true
|
|
const query = {
|
|
id: this.$route.query.id,
|
|
comments: formInlineText.comment
|
|
}
|
|
putAction('/compare/sarFileCompareInfo/editComments', query).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.visible = false
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
}).finally(() => {
|
|
this.textDataLoading = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 获取文件对比详情
|
|
getData () {
|
|
const query = {
|
|
id: this.$route.query.id
|
|
}
|
|
// this.loading = true
|
|
postAction('/compare/sarFileCompareInfo/getComparisonDetail', query).then((res) => {
|
|
if (res.success) {
|
|
this.resultData = res.result || {}
|
|
this.formInlineText.comment = res.result.comments || ''
|
|
this.formInlineText = { ...this.formInlineText }
|
|
} else {
|
|
this.resultData = {}
|
|
}
|
|
}).finally(() => {
|
|
// this.loading = false
|
|
})
|
|
},
|
|
// 点击左侧文档内容
|
|
detailLeft (num, item) {
|
|
const detailLeftColor = document.getElementsByClassName('detail-content-content-right-data-color')
|
|
if (detailLeftColor && detailLeftColor.length > 0) {
|
|
detailLeftColor[0].classList.remove('detail-content-content-right-data-color')
|
|
}
|
|
if (item.id === this.dataLeft.id && !this.isMatching) {
|
|
this.dataLeft = {}
|
|
return
|
|
}
|
|
const detailLeft = document.getElementsByClassName('detail-content-content-right-data')
|
|
if (detailLeft && detailLeft.length > 0) {
|
|
detailLeft[num].classList.add('detail-content-content-right-data-color')
|
|
}
|
|
this.dataLeft = item
|
|
this.dataLeft.numIndex = num
|
|
if (this.isMatching) {
|
|
const detailRightColor = document.getElementsByClassName('detail-content-content-right-data-color-right')
|
|
if (detailRightColor && detailRightColor.length > 0) {
|
|
detailRightColor[0].classList.remove('detail-content-content-right-data-color-right')
|
|
}
|
|
if (item.targetStand > -1) {
|
|
const detailContent = document.getElementsByClassName('detail-content-content-right-right-top')
|
|
const detailRight = document.getElementsByClassName('detail-content-content-right-data-right')
|
|
this.dataRight = this.resultData.textRight[item.targetStand]
|
|
if (detailRight && detailRight.length > 0) {
|
|
detailRight[item.targetStand].classList.add('detail-content-content-right-data-color-right')
|
|
detailContent[0].scrollTop = detailRight[item.targetStand].offsetTop - 150
|
|
}
|
|
this.dataRight.numIndex = item.targetStand
|
|
this.clauseComparison()
|
|
}
|
|
}
|
|
},
|
|
// 点击右侧文档内容
|
|
detailRight (num, item) {
|
|
const detailRightColor = document.getElementsByClassName('detail-content-content-right-data-color-right')
|
|
if (detailRightColor && detailRightColor.length > 0) {
|
|
detailRightColor[0].classList.remove('detail-content-content-right-data-color-right')
|
|
}
|
|
if (item.id === this.dataRight.id && !this.isMatching) {
|
|
this.dataRight = {}
|
|
return
|
|
}
|
|
const detailRight = document.getElementsByClassName('detail-content-content-right-data-right')
|
|
if (detailRight && detailRight.length > 0) {
|
|
detailRight[num].classList.add('detail-content-content-right-data-color-right')
|
|
}
|
|
this.dataRight = item
|
|
this.dataRight.numIndex = num
|
|
if (this.isMatching) {
|
|
const detailLeftColor = document.getElementsByClassName('detail-content-content-right-data-color')
|
|
if (detailLeftColor && detailLeftColor.length > 0) {
|
|
detailLeftColor[0].classList.remove('detail-content-content-right-data-color')
|
|
}
|
|
if (item.targetStand > -1) {
|
|
this.dataLeft = this.resultData.textLeft[item.targetStand]
|
|
this.dataLeft.numIndex = item.targetStand
|
|
const detailContent = document.getElementsByClassName('detail-content-content-right-top')
|
|
const detailLeft = document.getElementsByClassName('detail-content-content-right-data')
|
|
if (detailLeft && detailLeft.length > 0 && item.targetStand >= 0) {
|
|
detailLeft[item.targetStand].classList.add('detail-content-content-right-data-color')
|
|
detailContent[0].scrollTop = detailLeft[item.targetStand].offsetTop - 150
|
|
}
|
|
this.clauseComparison()
|
|
}
|
|
}
|
|
},
|
|
// 自动匹配
|
|
clauseComparison () {
|
|
const query = {
|
|
leftId: this.dataLeft.id,
|
|
rightId: this.dataRight.id
|
|
}
|
|
this.loadingText = true
|
|
getAction('/compare/sarFileCompareItem/clauseComparison', query).then((res) => {
|
|
if (res.success) {
|
|
this.loadingText = false
|
|
this.resultData.textLeft[this.dataLeft.numIndex].itemsText = res.result[0]
|
|
this.resultData.textRight[this.dataRight.numIndex].itemsText = res.result[1]
|
|
} else {
|
|
this.loadingText = false
|
|
}
|
|
})
|
|
},
|
|
// 左侧树选择
|
|
onSelectLeft (selectedKeys, exports) {
|
|
const node = exports.node.$vnode.data.props.dataRef
|
|
const detailLeft = document.getElementsByClassName('detail-content-content-right-data')
|
|
const detailContent = document.getElementsByClassName('detail-content-content-right-top')
|
|
if (!node.parentId) {
|
|
detailContent[0].scrollTop = 0
|
|
return
|
|
}
|
|
for (let i = 0; i < this.resultData.textLeft.length; i++) {
|
|
if (node.parentId && node.menuId === this.resultData.textLeft[i].menuId) {
|
|
detailContent[0].scrollTop = detailLeft[i].offsetTop - 150
|
|
return
|
|
}
|
|
}
|
|
},
|
|
// 右侧树选中
|
|
onSelectRight (selectedKeys, exports) {
|
|
const node = exports.node.$vnode.data.props.dataRef
|
|
const detailRight = document.getElementsByClassName('detail-content-content-right-data-right')
|
|
const detailContent = document.getElementsByClassName('detail-content-content-right-right-top')
|
|
if (!node.parentId) {
|
|
detailContent[0].scrollTop = 0
|
|
return
|
|
}
|
|
for (let i = 0; i < this.resultData.textRight.length; i++) {
|
|
if (node.parentId && node.menuId === this.resultData.textRight[i].menuId) {
|
|
detailContent[0].scrollTop = detailRight[i].offsetTop - 150
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
.doc-detail-wrap {
|
|
.doc-detail-header {
|
|
width: 100%;
|
|
z-index: 1000;
|
|
height: 68px;
|
|
line-height: 68px;
|
|
padding: 0 0 0 32px;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
border-bottom: 2px #eff1f3 solid;
|
|
background: #fff;
|
|
|
|
.doc-detail-title {
|
|
display: inline-block;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
font-size: 20px;
|
|
font-weight: 400;
|
|
color: #040B29;
|
|
line-height: 68px;
|
|
}
|
|
}
|
|
.doc-detail-right {
|
|
width: 600px;
|
|
line-height: 68px;
|
|
display: flex;
|
|
|
|
.operator-text-text {
|
|
cursor: pointer;
|
|
margin-right: 53px;
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: #040B29;
|
|
display: inline-block;
|
|
width: 33.3%;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-align: right;
|
|
}
|
|
}
|
|
}
|
|
|
|
.detail-content {
|
|
padding-top: 68px;
|
|
background: #fff;
|
|
padding-bottom: 20px;
|
|
&-cont {
|
|
width: 100%;
|
|
overflow: hidden;
|
|
display: flex;
|
|
}
|
|
&-left {
|
|
width: 50%;
|
|
height: calc(100vh - 210px);
|
|
border-right: 2px #EFF1F3 solid;
|
|
padding: 24px 32px;
|
|
box-sizing: border-box;
|
|
border-bottom: 2px #EFF1F3 solid;
|
|
}
|
|
&-right {
|
|
width: 50%;
|
|
height: calc(100vh - 210px);
|
|
padding: 24px 32px;
|
|
box-sizing: border-box;
|
|
border-bottom: 2px #EFF1F3 solid;
|
|
}
|
|
&-left-header {
|
|
margin-bottom: 24px;
|
|
}
|
|
&-left-header-text {
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
display: inline-block;
|
|
font-size: 16px;
|
|
font-family: Blue Sky Noto;
|
|
font-weight: 400;
|
|
color: #040B29;
|
|
}
|
|
}
|
|
|
|
.detail-content-content-left {
|
|
width: 180px;
|
|
height: 520px;
|
|
float: left;
|
|
overflow: auto;
|
|
/deep/ .ant-tree-node-content-wrapper {
|
|
display: inline-block !important;
|
|
color: #040B29 !important;
|
|
width: 130px;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
.remarks {
|
|
margin-top: 20px;
|
|
width: 50%;
|
|
display: inline-block;
|
|
padding: 0 32px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.box-title-text-remarks {
|
|
line-height: 1.4;
|
|
display: flex;
|
|
/*align-items: center;*/
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.title-text-remarks {
|
|
width: 68px;
|
|
color: #000F16;
|
|
display: inline-block;
|
|
font-weight: 500;
|
|
font-size: 14px;
|
|
margin-right: 16px;
|
|
margin-top: 6px;
|
|
text-align: right;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.item-model {
|
|
width: calc(100% - 232px);
|
|
}
|
|
|
|
.submit-button {
|
|
width: 100%;
|
|
height: 60px;
|
|
text-align: right;
|
|
padding: 14px 32px 0;
|
|
box-sizing: border-box;
|
|
border-top: 2px #eff1f3 solid;
|
|
background: #ffffff;
|
|
position: fixed;
|
|
bottom: 0;
|
|
}
|
|
</style>
|