Initial commit

This commit is contained in:
danshihao
2024-06-11 15:39:01 +08:00
commit 00acf31aa3
1589 changed files with 520803 additions and 0 deletions
@@ -0,0 +1,569 @@
<template>
<internal-detail-page :loading="loading" :title="$t('docTool.comparison.comparisonResults')" :content-padding="0">
<template #titleRightCustom>
<!--查看差异项-->
<a-button type="primary"
ghost
class="header-btn"
icon="eye"
@click="viewVarianceAssessmentClick"
v-has="'docComparison:result:viewVarianceAssessment'">
{{ $t('docTool.comparison.viewVarianceAssessment') }}
</a-button>
<!--查看一致项-->
<a-button type="primary"
ghost
class="header-btn"
icon="eye"
@click="viewConsistentAssessmentClick"
v-has="'docComparison:result:viewConsistentAssessment'">
{{ $t('docTool.comparison.viewConsistentAssessment') }}
</a-button>
<!--查看全部-->
<a-button type="primary" ghost class="header-btn" icon="eye" @click="viewAllClick" v-has="'docComparison:result:viewAll'">
{{ $t('docTool.comparison.viewAll') }}
</a-button>
<!--导出对比报告-->
<a-button type="primary"
ghost
class="header-btn"
icon="export"
@click="exportComparisonReportClick"
v-has="'docComparison:result:exportComparisonReport'">
{{ $t('docTool.comparison.exportComparisonReport') }}
</a-button>
<!--评论-->
<a-button type="primary" ghost class="header-btn" icon="message" @click="commentClick" v-has="'docComparison:result:comment'">
{{ $t('docTool.comparison.comment') }}
</a-button>
</template>
<div class="result-content">
<div class="result-content-header" :class="{'result-content-header-has-scroll': hasScrollBar}">
<a-checkbox @change="onChange" :indeterminate="indeterminate" :checked="checkAll"></a-checkbox>
<div class="result-content-header-content">
<div class="result-content-header-content-item result-content-header-content-item-standard"
:title="resultData.serialNumberLeft + resultData.fileNameLeft"
:class="{'result-content-header-content-item-no-operation': isDisplay}">
{{ $t('docTool.comparison.selectedStandard') }}{{ resultData.serialNumberLeft }}
<!--点击文件名可以预览-->
<span style="cursor: pointer"
@click="fileClick(resultData.fileNameLeft,resultData.fileIdLeft)">{{ resultData.fileNameLeft }}</span>
</div>
<div class="result-content-header-content-item result-content-header-content-item-standard"
:title="resultData.serialNumberRight + resultData.fileNameRight"
:class="{'result-content-header-content-item-no-operation':isDisplay}">
{{ $t('docTool.comparison.selectedStandard') }}{{ resultData.serialNumberRight }}
<span style="cursor: pointer"
@click="fileClick(resultData.fileNameRight,resultData.fileIdRight)">{{ resultData.fileNameRight }}</span>
</div>
<div class="result-content-header-content-item result-content-header-content-item-comment"
:title="$t('docTool.comparison.comparisonDifferenceComment')">
{{ $t('docTool.comparison.comparisonDifferenceComment') }}
</div>
<div class="result-content-header-content-item result-content-header-content-item-operation" v-if="!isDisplay">
{{ $t('operation') }}
</div>
</div>
</div>
<!--条款对比内容-->
<div class="scroll-content">
<a-checkbox-group @change="checkboxChange" v-model="checkboxList">
<div class="clause-item" v-for="(item,index) in resultData.resList" :key="index">
<a-checkbox :value="item.id" class="clause-item-checkbox"></a-checkbox>
<div class="clause-item-content" :class="{'clause-item-content-selected':checkboxList.join(',').includes(item.id)}">
<!--内容isDisplay===true时不显示操作列内容部分宽度设为100%-->
<!--第一个标准的内容-->
<div class="clause-item-content-standard" :class="{'clause-item-content-standard-no-operation': isDisplay}">
<div class="clause-item-content-standard-title">
<span>{{ item.itemsNumLeft }}</span>
<span style="margin-left: 10px">{{ item.itemsNameLeft }}</span>
</div>
<div class="clause-item-content-text" v-html="item.itemsTextLeft"></div>
</div>
<!--第二个标准的内容-->
<div class="clause-item-content-standard" :class="{'clause-item-content-standard-no-operation': isDisplay}">
<div class="clause-item-content-standard-title">
<span>{{ item.itemsNumRight }}</span>
<span style="margin-left: 10px">{{ item.itemsNameRight }}</span>
</div>
<div class="clause-item-content-text" v-html="item.itemsTextRight"></div>
</div>
<!--对比差异评论-->
<div class="clause-item-content-comment">
<div class="clause-item-content-text">
{{ item.comment }}
</div>
</div>
<!--操作-->
<div class="clause-item-content-operation" v-if="!isDisplay">
<!--编辑-->
<a class="text-button" @click="comparaEdit(item)" v-has="'docComparison:result:edit'">{{ $t('edit') }}</a>
<!--删除-->
<a class="text-button" @click="comparaDelete(item)" v-has="'docComparison:result:delete'">{{ $t('delete') }}</a>
</div>
</div>
</div>
</a-checkbox-group>
</div>
<!--全文评论部分-->
<div class="clause-item full-text-review">
<a-checkbox @change="fullCheckboxChange" v-model="fullCheckbox" class="clause-item-checkbox"></a-checkbox>
<div class="full-text-review-content" :class="{'clause-item-content-selected':fullCheckbox}">
<div class="full-text-review-text" :class="{'full-text-review-text-no-operation':isDisplay}">
<a-tooltip>
<template #title>{{ $t('docTool.comparison.fullTextComments') }}{{ resultData.comments }}</template>
<span>{{ $t('docTool.comparison.fullTextComments') }}{{ resultData.comments }}</span>
</a-tooltip>
</div>
<div class="full-text-review-operation" v-if="!isDisplay">
<!--全文评论-编辑-->
<a class="text-button" @click="fullTextEdit" v-has="'docComparison:result:editFullTextComments'">{{ $t('edit') }}</a>
<!-- <a class="text-button">{{$t('delete')}}</a>-->
</div>
</div>
</div>
</div>
<!--评论-->
<comment-list ref="commentListRef" />
<!--编辑对比评论-->
<comparison-result-edit-modal ref="comparisonResultEditModal" @ok="getData" />
<div id="images">
<div class="image" v-viewer="{movable: false}">
<img v-show="image" :src="imageUrl">
</div>
</div>
</internal-detail-page>
</template>
<script>
import { getAction, downloadFile, getFileAccessHttpUrl } from '../../../api/manage.js'
import { previewPdf } from '../../../utils/previewPdf.js'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
import CommentList from './modules/CommentList.vue'
import ComparisonResultEditModal from './modules/ComparisonResultEditModal.vue'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { deleteComparisonResult, getComparisonResultDetail } from '../../../api/documentToolApi.js'
export default {
name: 'ComparisonResults',
components: { CommentList, ComparisonResultEditModal, InternalDetailPage },
data () {
return {
loading: false,
checkboxList: [],
isVarianceOne: false,
isVarianceTwo: false,
isVarianceThe: false,
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
indeterminate: false,
checkAll: false,
isDisplay: false,
fullCheckbox: false,
resultData: {},
comment: '',
language: '',
url: {
exportData: '/compare/sarFileCompareItemComment/exportResXls'
},
image: false,
imageUrl: '',
hasScrollBar: false // 页面中间部分是否有滚动条
}
},
mounted () {
if (this.$route.query.isDisplay === '2') {
this.isDisplay = false
} else {
this.isDisplay = true
}
this.language = localStorage.getItem('language') || ''
this.getData()
},
methods: {
...mapGetters(['userInfo']),
goBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
// 评论按钮点击
commentClick () {
this.$refs.commentListRef.getData()
},
// 导出对比报告按钮点击
exportComparisonReportClick () {
const checkboxList = JSON.parse(JSON.stringify(this.checkboxList))
const fullCheckbox = this.fullCheckbox
const query = {
selectIds: checkboxList.join(','),
includeComments: fullCheckbox,
infoId: this.$route.query.id,
comment: this.comment
}
downloadFile(this.url.exportData, this.resultData.serialNumberLeft + ' - ' + this.resultData.serialNumberRight + this.$t('docTool.comparison.comparisonResults') + '.xls', query, this.deselect)
},
deselect () {
this.checkboxList = []
this.fullCheckbox = false
this.indeterminate = false
this.checkAll = false
},
// 查看一致性按钮点击
viewConsistentAssessmentClick () {
this.comment = '一致'
this.isVarianceTwo = true
this.isVarianceOne = false
this.isVarianceThe = false
this.getData()
},
// 查看差异项按钮点击
viewVarianceAssessmentClick () {
this.isVarianceOne = true
this.isVarianceTwo = false
this.isVarianceThe = false
this.comment = '差异'
this.getData()
},
// 查看全部按钮点击
viewAllClick () {
this.comment = ''
this.isVarianceThe = true
this.isVarianceOne = false
this.isVarianceTwo = false
this.getData()
},
// 点击文件名
fileClick (name, id) {
const fileName = name
const index1 = fileName.lastIndexOf('.')
const index2 = fileName.length
const fileSuffix = fileName.substring(index1, index2)
if (fileSuffix === '.pdf') {
// window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + id + '&userName=' + this.userInfo().username))
const url = previewPdf(id)
window.open(url)
} else if (fileSuffix === '.docx' || fileSuffix === '.doc') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + id + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.png' || fileSuffix === '.jpeg' || fileSuffix === '.gif' || fileSuffix === '.jpg') {
// const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + id + fileSuffix)
// window.open(url, '_blank')
this.image = true
this.imageUrl = getFileAccessHttpUrl(id)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
} else {
downloadFile('/sys/common/downLoadFile', name, { id: id })
}
},
// 获取对比结果详情
getData () {
const query = {
id: this.$route.query.id,
infoId: this.$route.query.id,
comment: this.comment
}
this.loading = true
getComparisonResultDetail(query).then((res) => {
if (res.success) {
this.resultData = res.result || {}
// 处理页面中部滚动导致表格对不齐的问题
this.$nextTick(() => {
const scrollBoxDom = document.getElementsByClassName('scroll-content')[0]
if (scrollBoxDom && scrollBoxDom.scrollHeight > scrollBoxDom.clientHeight) {
this.hasScrollBar = true
} else {
this.hasScrollBar = false
}
})
} else {
this.resultData = {}
}
}).finally(() => {
this.loading = false
})
},
// 复选框组改变
checkboxChange (checkedList) {
this.indeterminate = (!!checkedList.length && checkedList.length < this.resultData.resList.length) || (this.fullCheckbox && this.checkboxList.length < this.resultData.resList.length) || (!this.fullCheckbox && !!checkedList.length)
this.checkAll = checkedList.length === this.resultData.resList.length && this.fullCheckbox
},
// 全文评论复选框改变
fullCheckboxChange (event) {
this.indeterminate = (!!this.checkboxList.length && this.checkboxList.length < this.resultData.resList.length) || (event.target.checked && this.checkboxList.length < this.resultData.resList.length) || (!this.fullCheckbox && !!this.checkboxList.length)
this.checkAll = this.checkboxList.length === this.resultData.resList.length && event.target.checked
},
// 全选复选框改变
onChange (event) {
this.checkAll = event.target.checked
if (event.target.checked) {
this.resultData.resList.forEach(res => {
this.checkboxList.push(res.id)
})
this.fullCheckbox = true
this.indeterminate = false
} else {
this.checkboxList = []
this.fullCheckbox = false
}
if (this.checkboxList.length === 0 && !this.fullCheckbox) {
this.checkAll = false
this.indeterminate = false
}
},
// 全文评论编辑点击
fullTextEdit (item) {
this.$refs.comparisonResultEditModal.title = this.$t('docTool.comparison.fullTextComments')
this.$refs.comparisonResultEditModal.open({ comment: this.resultData.comments || '' })
},
// 对比结果编辑按钮点击
comparaEdit (item) {
this.$refs.comparisonResultEditModal.title = this.$t('docTool.comparison.comparativeComments')
this.$refs.comparisonResultEditModal.open(item)
},
// 对比结果删除按钮点击
comparaDelete (val) {
this.$confirm({
content: this.$t('confirmDeletion'),
onOk: () => {
deleteComparisonResult({ id: val.id }).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.getData()
} else {
this.$message.warning(res.message)
}
})
}
})
}
}
}
</script>
<style scoped lang="less">
.result-content {
padding: 24px 32px 0 32px;
box-sizing: border-box;
background: #fff;
height: 100%;
&-header {
width: 100%;
height: 56px;
line-height: 56px;
margin-bottom: 20px;
display: flex;
align-items: center;
}
&-header > .ant-checkbox-wrapper {
margin-left: 20px;
}
}
.result-content-header-content {
width: calc(100% - 56px);
margin-left: 20px;
display: inline-block;
height: 56px;
font-size: 14px;
font-family: Blue Sky Noto, sans-serif;
font-weight: bold;
color: #040B29;
background: rgba(4, 11, 41, 0.0300);
border-radius: 4px;
&-item {
height: 56px;
display: inline-block;
border-right: 1px #EFF1F3 solid;
padding: 0 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&-item:last-child {
border-right: none;
}
&-item-standard {
width: calc((100% - 128px - 260px) / 2);
span {
cursor: pointer;
}
}
&-item-no-operation {
width: calc((100% - 260px) / 2);
}
&-item-comment {
width: 260px;
}
&-item-operation {
width: 128px;
}
}
.result-content-header-has-scroll {
padding-right: 8px;
}
.scroll-content {
height: calc(100% - 76px - 71px - 58px);
overflow: auto;
}
.ant-checkbox-group {
width: 100%;
}
.clause-item {
width: 100%;
height: auto;
display: flex;
align-items: center;
&-checkbox {
margin-left: 20px;
}
}
.clause-item-content {
width: calc(100% - 56px);
margin-left: 20px;
border: 1px solid #EFF1F3;
border-radius: 4px;
overflow: hidden;
display: flex;
align-items: stretch;
&-selected {
border: 1px solid #00B3BE;
background: rgba(0, 179, 190, 0.0300);
}
&-standard {
width: calc((100% - 128px - 260px) / 2);
padding: 24px;
border-right: 1px #EFF1F3 solid;
&-title {
font-size: 16px;
font-family: Blue Sky Noto, sans-serif;
font-weight: 400;
color: #040B29;
}
}
&-standard-no-operation {
width: calc((100% - 260px) / 2);
}
&-text {
font-size: 14px;
font-weight: 400;
color: #040B29;
margin-top: 10px;
/deep/ table {
width: 100%;
}
}
&-comment {
width: 260px;
padding: 24px;
border-right: 1px #EFF1F3 solid;
}
&-operation {
width: 128px;
display: flex;
align-items: center;
justify-content: center;
.text-button {
margin-left: 10px;
}
.text-button:first-child {
margin-left: 0;
}
}
}
.full-text-review {
height: 109px;
margin: 10px 0;
&-content {
margin-left: 20px;
height: 100%;
flex: 1;
width: 0;
display: flex;
align-items: stretch;
border: 1px #EFF1F3 solid;
border-radius: 4px;
}
&-text {
width: calc(100% - 128px);
padding: 24px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
/*! autoprefixer: on;*/
word-break: break-word;
span {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
/*! autoprefixer: on;*/
word-break: break-word;
}
}
&-text-no-operation {
width: 100%;
}
&-operation {
width: 128px;
display: flex;
justify-content: center;
align-items: center;
}
}
.header-btn {
margin-left: 12px;
}
.header-btn:first-child {
margin-left: 0;
}
</style>
@@ -0,0 +1,396 @@
<template>
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<!--文本号-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.textNumber')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.comparison.textNumber')"
v-model="queryParam.serialNumber"></a-input>
</a-form-item>
</a-col>
<!--文本名称-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.textName')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<a-input :placeholder="$t('pleaseEnter') + $t('docTool.comparison.textName')"
v-model="queryParam.title"></a-input>
</a-form-item>
</a-col>
<!--发布情况-->
<a-col :md="6" :sm="8">
<a-form-item :label="$t('docTool.comparison.releaseSituation')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
<j-dict-select-tag v-model="queryParam.releaseState"
:placeholder="$t('pleaseSelect')+$t('docTool.comparison.releaseSituation')"
type="select"
:triggerChange="false" dictCode="release_state" />
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search" v-has="'documentComparison:search'">{{
$t('query')
}}
</a-button>
<a-button style="margin-left: 8px" icon="reload" @click="searchReset">{{ $t('reset') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator">
<!--发起对比-->
<a-button icon="block" type="primary" @click="initiatingProcessClick" v-has="'documentComparison:initiateComparison'">
{{ $t('docTool.comparison.initiateComparison') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDelete" v-has="'documentComparison:deleteBatch'">
{{ $t('batchDelete') }}
</a-button>
</div>
<div>
<j-table
ref="table"
size="middle"
:columns="columns"
:data-source="dataSource"
rowKey="id"
:can-drag="true"
:loading="loading"
:pagination="ipagination"
:scroll="{x: '100%', y: yScrollHeight}"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
<!--旧文本跳转标准详情-->
<template v-slot:oldTextDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage('old', record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!--新文本跳转标准详情-->
<template v-slot:newTextDetail="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage('new', record)">{{
text
}}
</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
</j-table>
</div>
</a-card>
</template>
<script>
import '../../../assets/less/common.less'
import { postAction } from '../../../api/manage.js'
import { mapGetters } from 'vuex'
import JDictSelectTag from '../../../components/dict/JDictSelectTag.vue'
import JTable from '../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
import { StandardSource } from '../../../enums/commonEnums.js'
import { withdrawPublication } from '../../../api/documentToolApi.js'
export default {
name: 'DocumentComparison',
components: { JDictSelectTag, JTable },
mixins: [JeroListMixin],
data () {
return {
// url传参严格按照当前命名
url: {
list: '/compare/sarFileCompareInfo/page',
delete: '/compare/sarFileCompareInfo/delete',
deleteBatch: '/compare/sarFileCompareInfo/deleteBatch'
},
loading: false,
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
userInfoQuery: {},
columns: [
// 旧文档文本号
{
title: this.$t('docTool.comparison.oldDocumentTextNumber'),
dataIndex: 'serialNumberLeft',
width: 170,
ellipsis: true,
scopedSlots: { customRender: 'oldTextDetail' }
},
// 旧文档文本名称
{
title: this.$t('docTool.comparison.oldDocumentTextName'),
dataIndex: 'titleLeft',
width: 170,
scopedSlots: { customRender: 'oldTextDetail' }
},
// 旧文本状态
{
title: this.$t('docTool.comparison.oldTextState'),
width: 150,
dataIndex: 'fileTypeLeft_dictText'
},
// 新文档文本号
{
title: this.$t('docTool.comparison.newDocumentTextNumber'),
dataIndex: 'serialNumberRight',
width: 170,
scopedSlots: { customRender: 'newTextDetail' }
},
// 新文档文本名称
{
title: this.$t('docTool.comparison.newDocumentTextName'),
dataIndex: 'titleRight',
width: 170,
scopedSlots: { customRender: 'newTextDetail' }
},
// 新文本状态
{
title: this.$t('docTool.comparison.newTextState'),
width: 150,
dataIndex: 'fileTypeRight_dictText'
},
// 发布情况
{
title: this.$t('docTool.comparison.releaseSituation'),
width: 150,
dataIndex: 'releaseState_dictText'
},
// 创建人
{
title: this.$t('creator'),
width: 180,
dataIndex: 'createNameNo'
},
// 备注
{
title: this.$t('remarks'),
width: 270,
dataIndex: 'remark'
},
// 操作
{
title: this.$t('operation'),
fixed: 'right',
width: 250,
scopedSlots: { customRender: 'action' }
}
],
operationList: [
// 对比结果
{
text: this.$t('docTool.comparison.comparisonResults'),
clickEvent: 'comparisonResultsClick',
has: 'documentComparison:comparisonResults'
},
// 发布
{
text: this.$t('release'),
clickEvent: 'subscribe',
has: 'documentComparison:publishWithdraw',
show: (record) => {
return record.createBy === this.userInfo.username && (!record.releaseState || record.releaseState === 'draft')
}
},
// 撤回
{
text: this.$t('withdraw'),
clickEvent: 'subscribe',
has: 'documentComparison:publishWithdraw',
show: (record) => {
return record.createBy === this.userInfo.username && !(!record.releaseState || record.releaseState === 'draft')
}
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'edit',
has: 'documentComparison:edit',
show: (record) => {
return (record.createBy === this.userInfo.username || this.administrators) && (!record.releaseState || record.releaseState === 'draft')
}
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: 'documentComparison:delete',
show: (record) => {
return (record.createBy === this.userInfo.username || this.administrators) && (!record.releaseState || record.releaseState === 'draft')
}
}
]
}
},
computed: {
...mapGetters(['userInfo']),
administrators () {
const adminRoleList = window._CONFIG.adminRoleCode.split(',')
const userRoleList = this.userInfo.roleCode.split(',')
return userRoleList.some(tt => adminRoleList.includes(tt))
}
},
created () {
if (this.$route.query.serialNumber) {
this.queryParam.serialNumber = this.$route.query.serialNumber
this.queryParam = { ...this.queryParam }
}
this.loadData(1)
},
methods: {
batchDelete () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
this.$confirm({
content: this.$t('confirmBatchDeletion'),
onOk: () => {
const idList = []
const selectionRows = JSON.parse(JSON.stringify(this.selectionRows))
for (let i = 0; i < selectionRows.length; i++) {
if (selectionRows[i].createBy === this.userInfo.username &&
selectionRows[i].releaseState === 'draft') {
idList.push(selectionRows[i].id)
}
}
if (idList.length > 0) {
postAction(this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.selectedRowKeys = []
this.loadData(1)
} else {
this.$message.warning(res.message)
}
})
} else {
this.$message.warning(this.$t('doNotHavePermissionDeleteData'))
}
}
})
},
// 对比结果按钮点击
comparisonResultsClick (item) {
if (item.createBy === this.userInfo.username && item.releaseState === 'draft') {
item.isDisplay = 2
} else {
item.isDisplay = 1
}
this.$router.push({
path: '/docTool/ComparisonResults',
query: {
id: item.id,
isDisplay: item.isDisplay
}
})
},
// 撤回按钮点击
subscribe (record) {
this.$confirm({
content: record.releaseState === 'draft' ? this.$t('confirmRelease') : this.$t('confirmWithdraw'),
onOk: () => {
let releaseState = ''
if (record.releaseState === 'draft') {
releaseState = 'draft'
} else {
releaseState = 'published'
}
const query = {
releaseState: releaseState,
id: record.id
}
withdrawPublication(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData(1)
} else {
this.$message.warning(res.message)
}
})
}
})
},
/**
* 编辑
* @param row
*/
edit (row) {
this.$router.push({
path: '/docTool/DocDataComparison',
query: {
id: row.id
}
})
},
/**
* 发起比对
*/
initiatingProcessClick () {
this.$router.push({
path: '/docTool/InitiateComparison'
})
},
/**
* 跳转标准详情
* @param type
* @param record
*/
toDetailPage (type, record) {
let standardId, standardSource, path
// 判断是新旧那个标准点击的,取字段
if (type === 'old') {
standardId = record.standardIdLeft
standardSource = record.standardSourceLeft
}
if (type === 'new') {
standardId = record.standardIdRight
standardSource = record.standardSourceRight
}
// 根据来源跳转不同的详情页
switch (standardSource) {
// 国内
case StandardSource.DOMESTIC.value:
path = '/standardRegulationLibrary/DomesticStandardDetail'
break
// 海外
case StandardSource.OVERSEAS.value:
path = '/standardRegulationLibrary/OverseasStandardDetail'
break
// 企标
case StandardSource.ENTERPRISE.value:
path = '/enterpriseStandardLibrary/enterpriseStandardDetail'
break
default:
break
}
if (!path) {
return
}
const query = {
id: standardId
}
this.$openPageNewSheet({
path, query
})
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item > .ant-form-item-label {
min-width: 80px;
}
</style>
@@ -0,0 +1,778 @@
<template>
<internal-detail-page :title="$t('docTool.comparison.documentComparison')"
:content-padding="0"
:loading="loading"
need-custom-back-func
@back="handleBack">
<template v-slot:titleRightCustom>
<!--查看比对结果-->
<a-button class="header-btn"
type="primary"
icon="eye"
ghost
@click="viewTheComparisonResultsClick"
v-has="'docComparison:dataComparison:viewTheComparisonResults'">
{{ $t('docTool.comparison.viewTheComparisonResults') }}
</a-button>
<!--添加全文评论-->
<a-button class="header-btn"
type="primary"
icon="message"
ghost
@click="addFullTextCommentClick"
v-has="'docComparison:dataComparison:addFullTextComment'">
{{ $t('docTool.comparison.addFullTextComment') }}
</a-button>
<!--关闭/打开自动匹配-->
<a-button class="header-btn"
type="primary"
:icon="isMatching?'close-circle':'check-circle'"
ghost
@click="turnOffAutomaticMatchingClick"
v-has="'docComparison:dataComparison:turnOffAutomaticMatching'">
{{ isMatching ? $t('docTool.comparison.turnOffAutomaticMatching') : $t('docTool.comparison.turnOnAutoMatch') }}
</a-button>
</template>
<div class="can-scroll-content">
<div class="detail-content">
<!--左边的文档-->
<div class="detail-content-left">
<!--左边的目录-->
<div class="standard-catalogue part-common" :class="{'hide-catalogue': !leftCatalogueShow}">
<div class="catalogue-show" @click="changeLeftCatalogueShow">
<a-icon :type="leftCatalogueShow ? 'left' : 'right'" />
</div>
<div class="part-title" v-show="leftCatalogueShow">{{ $t('standardRegulationLibrary.standardCatalogue') }}</div>
<div class="has-title-part-content" v-show="leftCatalogueShow">
<a-tree
class="draggable-tree"
:selected-keys="leftTreeSelectedKeys"
:replace-fields="{key: 'menuId'}"
@select="onSelectLeft"
:tree-data="resultData.menuLeft">
<a-icon slot="switcherIcon" type="down" :style="{ fontSize: '12px', color: '#103770' }" />
<template slot="title" slot-scope="{title}">
<!-- 目录前三个和有子集的标题加粗 -->
<span :style="title.indexOf('.')===-1?'font-weight: 600;':''" :title="title">{{ title }}</span>
</template>
</a-tree>
</div>
</div>
<!--左侧标准信息-->
<div class="detail-content-left-container">
<!--标准名称-->
<div class="standard-name">
<a-tooltip placement="topLeft">
<template #title>
{{ resultData.serialNumberLeft }} {{ resultData.fileNameLeft }}
</template>
<span>{{ resultData.serialNumberLeft }} {{ resultData.fileNameLeft }}</span>
</a-tooltip>
</div>
<div class="detail-content-left-scroll">
<div class="detail-content-left-item" @click="detailLeft(index,item)"
v-for="(item,index) in resultData.textLeft" :key="index"
:class="{'detail-content-item-selected': leftHighlightMenuId === item.menuId && leftHighlightId === item.id,'detail-content-item-saved':item.reviewed + '' === '1'}">
<div class="detail-content-item-text" style="margin-bottom: 10px;">
<span>{{ item.itemsNum }}</span> <span v-html="item.itemsName"></span>
</div>
<div class="detail-content-item-text" v-html="item.itemsText"></div>
</div>
</div>
</div>
</div>
<!--右侧文档-->
<div class="detail-content-right">
<!--右侧目录-->
<div class="standard-catalogue part-common" :class="{'hide-catalogue': !rightCatalogueShow}">
<div class="catalogue-show" @click="changeRightCatalogueShow">
<a-icon :type="rightCatalogueShow ? 'left' : 'right'" />
</div>
<div class="part-title" v-show="rightCatalogueShow">{{ $t('standardRegulationLibrary.standardCatalogue') }}</div>
<div class="has-title-part-content" v-show="rightCatalogueShow">
<a-tree
class="draggable-tree"
:selected-keys="rightTreeSelectedKeys"
:replace-fields="{key: 'menuId'}"
@select="onSelectRight"
:tree-data="resultData.menuRight">
<a-icon slot="switcherIcon" type="down" :style="{ fontSize: '12px', color: '#103770' }" />
<template slot="title" slot-scope="{title}">
<!-- 目录前三个和有子集的标题加粗 -->
<span :style="title.indexOf('.')===-1?'font-weight: 600;':''" :title="title">{{ title }}</span>
</template>
</a-tree>
</div>
</div>
<!--右侧标准信息-->
<div class="detail-content-right-container">
<!--标准名称-->
<div class="standard-name">
<a-tooltip placement="topLeft">
<template #title>
{{ resultData.serialNumberRight }} {{ resultData.fileNameRight }}
</template>
<span>{{ resultData.serialNumberRight }} {{ resultData.fileNameRight }}</span>
</a-tooltip>
</div>
<div class="detail-content-right-scroll">
<div class="detail-content-right-item" @click="detailRight(index,item)"
v-for="(item,index) in resultData.textRight" :key="index"
:class="{'detail-content-item-selected': item.menuId === rightHighlightMenuId && rightHighlightId === item.id, 'detail-content-item-saved':item.reviewed + '' === '1'}">
<div class="detail-content-item-text" style="margin-bottom: 10px;">
<span>{{ item.itemsNum }}</span> <span v-html="item.itemsName"></span>
</div>
<div class="detail-content-item-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>
<div class="submit-button">
<!--一致-->
<a-button style="margin-right: 10px"
type="primary"
@click="consistentAssessmentClick"
v-has="'docComparison:dataComparison:consistentAssessment'">
{{ $t('docTool.comparison.consistentAssessment') }}
</a-button>
<!--保存-->
<a-button type="primary" @click="submit" v-has="'docComparison:dataComparison:save'">{{ $t('preservation') }}</a-button>
</div>
<!--全文评论-->
<comparison-add-full-comment ref="comparisonAddFullComment" />
</internal-detail-page>
</template>
<script>
// 添加全文评论弹框
import ComparisonAddFullComment from './modules/ComparisonAddFullComment.vue'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { docComparsionConsistentAndSave, getComparisonDetail, clauseComparison } from '../../../api/documentToolApi.js'
export default {
name: 'DocumentDataComparison',
components: { ComparisonAddFullComment, InternalDetailPage },
data () {
return {
formInline: {},
loadingText: false,
rules: {},
loading: false,
resultData: {},
isMatching: true, // 自动匹配是否开启
dataLeft: {},
dataRight: {},
pageFrom: null,
leftCatalogueShow: true, // 左侧的标准目录是否展示
rightCatalogueShow: true, // 右侧的标准目录是否展示
leftTreeSelectedKeys: [], // 左侧被选中树节点
rightTreeSelectedKeys: [], // 右侧被选中树节点
leftHighlightMenuId: null, // 左侧高亮数据的menuId
rightHighlightMenuId: null, // 右侧高亮数据的menuId
leftHighlightId: null, // 左侧高亮数据的id
rightHighlightId: null // 右侧高亮数据的id
}
},
mounted () {
this.getData()
},
methods: {
// 文档对比的一致按钮点击
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
docComparsionConsistentAndSave(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.formInline = {}
// 保存之后会有一个淡蓝色的边框
if (this.leftHighlightMenuId === this.dataLeft.menuId) {
this.leftHighlightMenuId = null
}
if (this.rightHighlightMenuId === this.dataRight.menuId) {
this.rightHighlightMenuId = null
}
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 }
this.dataLeft = {}
this.dataRight = {}
} else {
this.$message.warning(res.message)
}
}).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
docComparsionConsistentAndSave(query).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.formInline = {}
// 保存之后会有一个淡蓝色的边框
if (this.leftHighlightMenuId === this.dataLeft.menuId) {
this.leftHighlightMenuId = null
}
if (this.rightHighlightMenuId === this.dataRight.menuId) {
this.rightHighlightMenuId = null
}
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 }
this.dataLeft = {}
this.dataRight = {}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 查看对比结果按钮点击
viewTheComparisonResultsClick () {
this.$router.push({
path: '/docTool/ComparisonResults',
query: {
id: this.$route.query.id,
isDisplay: 2
}
})
},
// 添加全文评论按钮点击
addFullTextCommentClick () {
const query = {
id: this.$route.query.id
}
getComparisonDetail(query).then((res) => {
if (res.success) {
this.$refs.comparisonAddFullComment.open(res.result.comments || '')
}
})
},
// 关闭自动匹配、开启自动匹配
turnOffAutomaticMatchingClick () {
this.isMatching = !this.isMatching
this.$message.success(this.$t('operationSuccessful'))
},
// 获取文件对比详情
getData () {
const query = {
id: this.$route.query.id
}
this.loading = true
getComparisonDetail(query).then((res) => {
if (res.success) {
this.resultData = res.result || {}
} else {
this.resultData = {}
}
}).finally(() => {
this.loading = false
})
},
// 点击左侧文档内容
detailLeft (num, item) {
this.leftTreeSelectedKeys = [item.menuId]
if (item.id === this.dataLeft.id && !this.isMatching) {
this.dataLeft = {}
this.leftHighlightMenuId = null
this.leftHighlightId = null
return
}
this.leftHighlightMenuId = item.menuId
this.leftHighlightId = item.id
this.dataLeft = item
this.dataLeft.numIndex = num
// 自动匹配,右侧数据需要跳转
if (this.isMatching) {
const index = this.dataLeft.targetStand
if (index > -1) {
this.dataRight = this.resultData.textRight[index]
this.dataRight.numIndex = index
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(index)
this.clauseComparison()
}
}
},
// 点击右侧文档内容
detailRight (num, item) {
this.rightTreeSelectedKeys = [item.menuId]
if (item.id === this.dataRight.id && !this.isMatching) {
this.dataRight = {}
this.rightHighlightMenuId = null
this.rightHighlightId = null
return
}
this.dataRight = item
this.dataRight.numIndex = num
this.rightHighlightMenuId = item.menuId
this.rightHighlightId = item.id
if (this.isMatching) {
const index = this.dataRight.targetStand
if (index > -1) {
this.dataLeft = this.resultData.textLeft[index]
this.dataLeft.numIndex = index
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(index)
this.clauseComparison()
}
}
},
// 自动匹配
clauseComparison () {
const query = {
leftId: this.dataLeft.id,
rightId: this.dataRight.id
}
this.loadingText = true
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]
this.resultData.textLeft[this.dataLeft.numIndex].itemsName = res.result[2]
this.resultData.textRight[this.dataRight.numIndex].itemsName = res.result[3]
} else {
this.loadingText = false
}
})
},
// 左侧树选择
onSelectLeft (selectedKeys, exports) {
const node = exports.node.$vnode.data.props.dataRef
const index = this.resultData.textLeft.findIndex(tt => tt.menuId === node.menuId)
this.dataLeft = this.resultData.textLeft[index]
console.log(this.dataLeft)
this.dataLeft.numIndex = index
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(index)
// 处理选中右侧树
if (this.isMatching) {
const indexRight = this.dataLeft.targetStand
if (indexRight > -1) {
this.dataRight = this.resultData.textRight[indexRight]
this.dataRight.numIndex = indexRight
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(indexRight)
this.clauseComparison()
}
}
},
// 右侧树选中
onSelectRight (selectedKeys, exports) {
const node = exports.node.$vnode.data.props.dataRef
const index = this.resultData.textRight.findIndex(tt => tt.menuId === node.menuId)
this.dataRight = this.resultData.textRight[index]
this.dataRight.numIndex = index
this.rightHighlightMenuId = this.dataRight.menuId
this.rightHighlightId = this.dataRight.id
this.rightTreeSelectedKeys = [this.dataRight.menuId]
this.handleJumpRightData(index)
// 处理选中左侧树
if (this.isMatching) {
const indexLeft = this.dataRight.targetStand
if (indexLeft > -1) {
this.dataLeft = this.resultData.textLeft[indexLeft]
this.dataLeft.numIndex = indexLeft
this.leftHighlightMenuId = this.dataLeft.menuId
this.leftHighlightId = this.dataLeft.Id
this.leftTreeSelectedKeys = [this.dataLeft.menuId]
this.handleJumpLeftData(indexLeft)
this.clauseComparison()
}
}
},
/**
* 左侧数据跳转
*/
handleJumpLeftData (index) {
if (index > -1) {
const scrollContent = document.getElementsByClassName('detail-content-left-scroll')
const clauseItemDom = document.getElementsByClassName('detail-content-left-item')
scrollContent[0].scrollTop = clauseItemDom[index].offsetTop - 150
}
},
/**
* 右侧数据跳转
*/
handleJumpRightData (index) {
if (index > -1) {
const detailContent = document.getElementsByClassName('detail-content-right-scroll')
const detailRight = document.getElementsByClassName('detail-content-right-item')
detailContent[0].scrollTop = detailRight[index].offsetTop - 150
}
},
handleBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
changeLeftCatalogueShow () {
this.leftCatalogueShow = !this.leftCatalogueShow
},
changeRightCatalogueShow () {
this.rightCatalogueShow = !this.rightCatalogueShow
}
}
}
</script>
<style scoped lang="less">
.header-btn {
margin-left: 12px;
}
.header-btn:first-child {
margin-left: 0;
}
.can-scroll-content {
height: calc(100% - 52px);
overflow: auto;
}
.detail-content {
height: calc(100% - 131px);
background-color: #eff1f4;
}
.detail-content-left {
width: 50%;
float: left;
height: 100%;
border-right: 2px #EFF1F3 solid;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
display: flex;
}
.detail-content-right {
width: 50%;
height: 100%;
float: left;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
display: flex;
}
.detail-content-left-header {
width: 100%;
font-size: 16px;
font-family: Blue Sky Noto;
font-weight: 400;
color: #040B29;
margin-bottom: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-title-text-remarks {
line-height: 1.4;
display: flex;
/*align-items: center;*/
margin-bottom: 10px;
}
.item-model {
width: calc(100% - 232px);
}
.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;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.remarks {
margin-top: 20px;
width: 50%;
display: inline-block;
padding: 0 32px;
box-sizing: border-box;
}
.itemModel {
width: calc(100% - 232px);
}
.submit-button {
height: 52px;
text-align: right;
padding: 10px 24px;
}
.detail-content-left-container {
height: 100%;
overflow-y: auto;
transition: all 1s;
scroll-behavior: smooth;
flex: 1;
}
.detail-content-right-container {
height: 100%;
overflow-y: auto;
transition: all 1s;
scroll-behavior: smooth;
flex: 1;
.standard-name {
margin-right: 0;
}
}
.detail-content-left-scroll {
height: calc(100% - 25px - 40px);
width: calc(100% - 20px);
display: inline-block;
margin: 0 10px 0 10px;
overflow: auto;
background-color: white;
}
.detail-content-right-scroll {
height: calc(100% - 25px - 40px);
width: calc(100% - 10px);
display: inline-block;
margin-left: 10px;
overflow: auto;
background-color: white;
}
.detail-content-left-item {
padding: 16px 20px;
box-sizing: border-box;
border: 1px solid #EFF1F3;
cursor: pointer;
background-color: white;
}
.detail-content-right-item {
padding: 16px 20px;
box-sizing: border-box;
border: 1px solid #EFF1F3;
cursor: pointer;
background-color: white;
}
.detail-content-left-item:last-child {
margin-bottom: 0;
}
.detail-content-item-text {
font-size: 16px;
font-weight: 400;
color: #040B29;
word-break: break-word;
/deep/ table {
width: 100%;
}
/deep/ img {
max-width: 100%;
}
}
.detail-content-item-selected {
border: 2px red solid !important;
}
.detail-content-item-saved {
border: 2px #21c9cc solid;
}
::v-deep .delClass {
color: #ff7168;
}
::v-deep .insertClass {
color: green;
}
/deep/ .ant-tree li span.ant-tree-switcher {
float: right;
}
::-webkit-scrollbar {
width: 3px;
}
.part-common {
border-radius: 8px;
background: #FFFFFF;
}
.standard-catalogue {
height: calc(100% - 20px);
width: 200px;
margin: 10px 10px 10px 0;
position: relative;
transition: width .2s linear;
/deep/ .ant-tree li .ant-tree-node-content-wrapper{
max-width: calc(100% - 24px);
&:hover {
max-width: 100%;
}
}
/deep/ .ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected {
background-color: transparent !important;
color: @primary-color;
}
.catalogue-show {
position: absolute;
width: 12px;
height: 24px;
left: 100%;
top: 50%;
transform: translateY(-50%);
background-color: @primary-color;
border-radius: 0 12px 12px 0;
cursor: pointer;
color: white;
.anticon {
left: -2px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
}
}
.hide-catalogue {
width: 0;
min-width: 0;
}
.part-title {
height: 40px;
background: rgba(213, 44, 38, 0.12);
border-radius: 8px 8px 0 0;
line-height: 40px;
padding: 0 24px;
font-size: 16px;
font-family: PingFang SC-Semibold, PingFang SC, sans-serif;
font-weight: 600;
color: #1D2129;
white-space: nowrap;
overflow: hidden;
}
.has-title-part-content {
height: calc(100% - 40px);
overflow: auto;
padding: 0 20px;
}
.standard-name {
margin: 10px 10px 5px 10px;
height: 40px;
background: #FFFFFF;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
}
.standard-name > span {
font-size: 16px;
font-family: PingFang SC-Semibold, PingFang SC, sans-serif;
font-weight: 600;
color: #1D2129;
flex: 1;
width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
</style>
@@ -0,0 +1,581 @@
<template>
<internal-detail-page :title="$t('docTool.comparison.initiateComparison')" :content-padding="0" :loading="loading">
<div class="can-scroll-content">
<div class="detail-content-box">
<div class="detail-content-left">
<a-form layout="inline" @keyup.enter.native="searchQueryLeft">
<a-row>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('number')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('number')"
v-model="queryParamLeft.serialNumber"></a-input>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('title')"
v-model="queryParamLeft.title"></a-input>
</a-form-item>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button type="primary" @click="searchQueryLeft" v-has="'docComparsion:initiate:search'">
{{ $t('query') }}
</a-button>
<a-button style="margin-left: 8px" @click="searchResetLeft">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<j-table
ref="table"
size="middle"
:can-drag="true"
:loading="loadingLeft"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceLeft"
:row-selection="{ selectedRowKeys: selectedRowKeysLeft, onChange: onSelectChangeLeft, columnTitle:' ', type: 'radio'}"
:columns="columns"
@change="tableChangeLeft"
>
</j-table>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('docTool.comparison.selectedStandard')">
{{ $t('docTool.comparison.selectedStandard') }}
</span>
<span class="box-button-standard-right"
@click="selectLeftClick(selectedRowsLeft[0])"
:title="selectedRowsLeft[0]?selectedRowsLeft[0].serialNumber+' '+selectedRowsLeft[0].fileName:$t('docTool.comparison.noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowsLeft[0]}">
{{
selectedRowsLeft[0] ? selectedRowsLeft[0].serialNumber + ' ' + selectedRowsLeft[0].fileName : $t('docTool.comparison.noComparisonDocumentSelected')
}}
</span>
</div>
</div>
<div class="detail-content-right">
<a-form layout="inline" @keyup.enter.native="searchQueryRight">
<a-row>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('number')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('number')"
v-model="queryParamRight.serialNumber"></a-input>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item :label="$t('title')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('title')"
v-model="queryParamRight.title"></a-input>
</a-form-item>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button type="primary" @click="searchQueryRight" v-has="'docComparsion:initiate:search'">
{{ $t('query') }}
</a-button>
<a-button style="margin-left: 8px" @click="searchResetRight">{{ $t('reset') }}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<j-table
ref="table"
size="middle"
:can-drag="true"
:loading="loadingRight"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceRight"
:row-selection="{ selectedRowKeys: selectedRowKeysRight, onChange: onSelectChangeRight, columnTitle:' ', type: 'radio'}"
:columns="tableColumns"
@change="tableChangeRight"
>
</j-table>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('docTool.comparison.selectedStandard')">
{{ $t('docTool.comparison.selectedStandard') }}
</span>
<span class="box-button-standard-right"
@click="selectLeftClick(selectedRowsRight[0])"
:title="selectedRowsRight[0]?selectedRowsRight[0].serialNumber+' '+selectedRowsRight[0].fileName:$t('docTool.comparison.noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowsRight[0]}">
{{
selectedRowsRight[0] ? selectedRowsRight[0].serialNumber + ' ' + selectedRowsRight[0].fileName : $t('docTool.comparison.noComparisonDocumentSelected')
}}
</span>
</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.remarkInfo')">
<span>{{ $t('docTool.comparison.remarkInfo') }}</span>
</div>
<a-form-model-item class="item-model" prop="remark">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.remarkInfo')"
:maxLength="500"
v-model="formInline.remark"
:rows="4" />
</a-form-model-item>
</div>
</a-form-model>
</div>
</div>
<div class="box-button">
<!--发起文档对比-->
<a-button type="primary" @click="submit" v-has="'docComparsion:initiate:initiateComparison'">
{{ $t('docTool.comparison.initiateDocumentComparison') }}
</a-button>
</div>
<div id="images">
<div class="image" v-viewer="{movable: false}">
<img v-show="image" :src="imageUrl">
</div>
</div>
</internal-detail-page>
</template>
<script>
import JTable from '../../../components/jero/JTable.vue'
import { downloadFile, getFileAccessHttpUrl } from '../../../api/manage.js'
import { previewPdf } from '../../../utils/previewPdf.js'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
import InternalDetailPage from '../../../components/InternalDetailPage.vue'
import { getInitComparsionPageData, submitInitComparsion } from '../../../api/documentToolApi.js'
export default {
name: 'InitiateComparison',
components: { JTable, InternalDetailPage },
data () {
return {
loading: false,
labelCol: {
span: 6
},
wrapperCol: {
span: 18
},
loadingLeft: false,
queryParamLeft: {},
ipaginationLeft: {
current: 1,
pageSize: 50,
pageSizeOptions: ['10', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedRowKeysLeft: [],
selectedRowsLeft: [],
dataSourceLeft: [],
loadingRight: false,
queryParamRight: {},
ipaginationRight: {
current: 1,
pageSize: 50,
pageSizeOptions: ['10', '50', '100', '150', '200'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedRowKeysRight: [],
dataSourceRight: [],
selectedRowsRight: [],
formInline: {},
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
rules: {
// remark: [
// {
// max: 300,
// message: this.$t('RemarkInfo') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
// trigger: 'blur'
// }
// ]
},
columns: [
{
title: this.$t('number'),
width: 60,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('number'),
ellipsis: true,
dataIndex: 'serialNumber',
width: 100
},
{
title: this.$t('title'),
ellipsis: true,
dataIndex: 'title',
width: 100
},
{
title: this.$t('docTool.comparison.textStatus'),
ellipsis: true,
dataIndex: 'fileType_dictText',
width: 100
},
{
title: this.$t('fileName'),
ellipsis: true,
dataIndex: 'fileName',
width: 100
}
],
tableColumns: [
{
title: this.$t('number'),
width: 60,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('number'),
ellipsis: true,
dataIndex: 'serialNumber',
width: 100
},
{
title: this.$t('title'),
ellipsis: true,
dataIndex: 'title',
width: 100
},
{
title: this.$t('docTool.comparison.textStatus'),
ellipsis: true,
dataIndex: 'fileType_dictText',
width: 100
},
{
title: this.$t('fileName'),
ellipsis: true,
dataIndex: 'fileName',
width: 100
}
],
image: false,
imageUrl: ''
}
},
mounted () {
this.getListLeft()
this.getListRight()
},
methods: {
...mapGetters(['userInfo']),
goBack () {
this.$router.push({
path: '/docTool/docComparison'
})
},
searchQueryLeft () {
this.ipaginationLeft.current = 1
this.getListLeft()
},
searchResetLeft () {
this.queryParamLeft = {}
this.ipaginationLeft.current = 1
this.getListLeft()
},
onSelectChangeLeft (value, record) {
this.selectedRowKeysLeft = value
// this.selectedRowsLeft = []
// if (this.selectedRowKeysLeft.length > 1) {
// this.selectedRowKeysLeft.shift()
// }
// const content = record.filter(res => {
// return res.id === this.selectedRowKeysLeft[0]
// })
this.selectedRowsLeft = record
},
tableChangeLeft (pagination) {
this.ipaginationLeft = pagination
this.getListLeft()
},
searchQueryRight () {
this.ipaginationRight.current = 1
this.getListRight()
},
searchResetRight () {
this.queryParamRight = {}
this.ipaginationRight.current = 1
this.getListRight()
},
onSelectChangeRight (value, record) {
this.selectedRowKeysRight = value
// this.selectedRowsRight = []
// if (this.selectedRowKeysRight.length > 1) {
// this.selectedRowKeysRight.shift()
// }
// const content = record.filter(res => {
// return res.id === this.selectedRowKeysRight[0]
// })
this.selectedRowsRight = record
},
tableChangeRight (pagination) {
this.ipaginationRight = pagination
this.getListRight()
},
submit () {
if (!this.selectedRowsRight[0] || !this.selectedRowsLeft[0]) {
this.$message.warning(this.$t('docTool.comparison.pleaseSelectTheDataCompared'))
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.loading = true
const query = {
leftStandard: this.selectedRowsLeft[0].id,
rightStandard: this.selectedRowsRight[0].id,
remark: this.formInline.remark
}
submitInitComparsion(query).then((res) => {
if (res.success) {
console.log(res)
this.loading = false
this.$message.success(this.$t('operationSuccessful'))
this.$router.push({
path: '/docTool/DocDataComparison',
query: {
id: res.result
}
})
} else {
this.loading = false
this.$message.warning(res.message)
}
})
}
})
},
getListLeft () {
const queryParam = JSON.parse(JSON.stringify(this.queryParamLeft))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
const query = {
pageNo: this.ipaginationLeft.current,
pageSize: this.ipaginationLeft.pageSize,
fileId: '1',
splitStatus: '2',
...queryParam
}
this.loadingLeft = true
getInitComparsionPageData(query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length === 0) {
this.ipaginationLeft.current = 1
this.getListLeft()
return
}
this.dataSourceLeft = res.result.records || []
this.ipaginationLeft.total = res.result.total
}
}).finally(() => {
this.loadingLeft = false
})
},
selectLeftClick (fileQuery) {
if (fileQuery) {
const fileName = fileQuery.fileName
const index1 = fileName.lastIndexOf('.')
const index2 = fileName.length
const fileSuffix = fileName.substring(index1, index2)
if (fileSuffix === '.pdf') {
// window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.fileId + '&userName=' + this.userInfo().username))
const url = previewPdf(fileQuery.fileId)
window.open(url)
} else if (fileSuffix === '.docx' || fileSuffix === '.doc') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.xlsx' || fileSuffix === '.xls') {
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix === '.png' || fileSuffix === '.jpeg' || fileSuffix === '.gif' || fileSuffix === '.jpg') {
// const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + fileQuery.fileId + fileSuffix)
// window.open(url, '_blank')
this.image = true
this.imageUrl = getFileAccessHttpUrl(fileQuery.fileId)
// 获取viewer实例
const viewer = this.$el.querySelector('.image').$viewer
// 调用show方法进行显示预览图
viewer.show()
} else {
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.fileId })
}
}
},
getListRight () {
const queryParam = JSON.parse(JSON.stringify(this.queryParamRight))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
const query = {
pageNo: this.ipaginationRight.current,
pageSize: this.ipaginationRight.pageSize,
fileId: '1',
splitStatus: '2',
...queryParam
}
this.loadingRight = true
getInitComparsionPageData(query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length === 0) {
this.pageNoRight = 1
this.getListRight()
return
}
this.dataSourceRight = res.result.records || []
this.ipaginationRight.total = res.result.total
}
}).finally(() => {
this.loadingRight = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../assets/less/common.less';
.can-scroll-content {
height: calc(100% - 52px);
overflow: auto;
}
.detail-content-box {
display: flex;
height: calc(100% - 152px);
min-height: calc(340px + 46px + 40px + 72px + 48px);
}
.detail-content-left {
width: 50%;
border-right: 2px #EFF1F3 solid;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 100%;
}
.detail-content-right {
width: 50%;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 100%;
}
.box-title-text-remarks {
line-height: 1.4;
display: flex;
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;
}
.box-button {
padding: 10px 24px;
text-align: right;
}
.box-button-standard {
width: 100%;
margin-top: 20px;
}
.box-button-standard-left {
width: 111px;
height: 46px;
padding: 0 6px;
box-sizing: border-box;
display: inline-block;
border: 1px solid #CED0D8;
border-right: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
line-height: 46px;
color: #040B29;
}
.box-button-standard-right {
width: calc(100% - 111px);
height: 46px;
padding: 0 4px;
box-sizing: border-box;
display: inline-block;
border: 1px solid #CED0D8;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
line-height: 46px;
color: #9B9DA9;
}
.remarks {
margin-top: 20px;
width: 50%;
padding: 0 32px;
box-sizing: border-box;
}
.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;
}
.box-button-standard-right-color {
color: #040B29;
cursor: pointer;
}
</style>
@@ -0,0 +1,254 @@
<template>
<div>
<a-drawer
:title="$t('docTool.comparison.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="comment-item">
<div class="comment-item-img">
<img src="../../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="comment-item-content">
<div class="comment-item-title">
<a-tooltip>
<template #title>{{ item.name }}</template>
<div class="comment-item-title-name">{{ item.name }}</div>
</a-tooltip>
<div class="comment-item-title-time">{{ item.createTime }}</div>
<div class="comment-item-title-icon" @click="messageClick(item)"><a-icon type="message" /></div>
</div>
<div class="comment-item-content-text">{{ item.content }}</div>
</div>
</div>
<div class="inside-box" v-if="item.resComVoList && item.resComVoList.length > 0">
<div class="comment-item inside-comment-item" v-for="(val,indexOne) in item.resComVoList" :key="indexOne">
<div class="comment-item-img">
<img src="../../../../assets/image/daiban.png" class="img" alt="">
</div>
<div class="comment-item-content">
<div class="comment-item-title">
<a-tooltip>
<template #title>{{ val.name }}</template>
<div class="comment-item-title-name">{{ val.name }}</div>
</a-tooltip>
<div class="comment-item-title-time">{{ val.createTime }}</div>
<div class="comment-item-title-icon" @click="messageClick(item)"><a-icon type="message" /></div>
</div>
<div class="comment-item-content-text">{{ val.content }}</div>
</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" @ok="getList" />
</div>
</template>
<script>
import { getCommentList } from '../../../../api/documentToolApi.js'
// 添加评论和回复评论弹框
import ComparisonAddReplyComment from './ComparisonAddReplyComment.vue'
export default {
name: 'CommentList',
components: { ComparisonAddReplyComment },
data () {
return {
visible: false,
dataList: [],
commentContent: '',
loading: false
}
},
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
getCommentList({
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%;
}
}
.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;
}
.comment-box-text {
text-align: center;
margin-top: 40px;
}
.box-input {
width: calc(100% - 183px);
margin-right: 8px;
}
.box-input-search {
/deep/ .ant-input-search-icon {
display: none;
}
}
.comment-item {
display: flex;
&-img {
width: 32px;
height: 32px;
border-radius: 50%;
margin-right: 8px;
.img {
width: 100%;
height: 100%;
}
}
&-content {
flex: 1;
width: 0;
&-text {
font-size: 14px;
font-weight: 400;
color: #040B29;
word-break: break-word;
}
}
&-title {
width: 100%;
display: flex;
&-name {
font-size: 14px;
font-weight: bold;
color: #040B29;
margin-right: 8px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
&-time {
flex-shrink: 0;
font-size: 14px;
font-weight: 400;
color: #6F7385;
margin-right: 8px;
}
&-icon {
flex-shrink: 0;
margin-left: auto;
}
}
}
.inside-comment-item {
margin-bottom: 15px;
}
</style>
@@ -0,0 +1,82 @@
<template>
<j-modal
:title="$t('docTool.comparison.fullTextComments')"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
switchFullscreen
@cancel="visible = false">
<template slot="footer">
<a-button type="primary" :loading="confirmLoading" @click="fullTextCommentsSubmit">
{{ $t('submit') }}
</a-button>
</template>
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
<a-form-model-item prop="comment"
:labelCol="labelCol" :wrapperCol="wrapperCol"
:label="$t('docTool.comparison.fullTextComments')">
<a-textarea :placeholder="$t('pleaseEnter')+' '+$t('docTool.comparison.fullTextComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
</a-form-model>
</j-modal>
</template>
<script>
import { addFullTextComment } from '../../../../api/documentToolApi.js'
export default {
name: 'ComparisonAddFullComment',
data () {
return {
visible: false, // 全文评论弹框是否显示
confirmLoading: false,
formInlineText: {},
rulesText: {},
labelCol: {
span: 5
},
wrapperCol: {
span: 18
}
}
},
methods: {
open (comments) {
this.formInlineText.comment = comments
this.visible = true
},
// 添加全文评论弹框的提交按钮
fullTextCommentsSubmit () {
this.$refs.ruleFormText.validate(valid => {
if (valid) {
const formInlineText = Object.assign({}, this.formInlineText)
this.confirmLoading = true
const query = {
id: this.$route.query.id,
comments: formInlineText.comment
}
addFullTextComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
})
}
}
}
</script>
<style scoped>
</style>
@@ -0,0 +1,117 @@
<template>
<j-modal
:title="title"
:width="500"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOkComment"
switchFullscreen
@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="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="formInline.commentContent"
:autoSize="{ minRows: 2, maxRows: 6 }" />
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</j-modal>
</template>
<script>
import { addComment } from '../../../../api/documentToolApi.js'
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 query = {}
if (this.title === this.$t('docTool.comparison.publishComment')) {
query = {
comment: this.formInline.commentContent,
infoId: this.$route.query.id
}
} else if (this.title === this.$t('docTool.comparison.replyToComments')) {
query = {
comment: this.formInline.replyContent,
parentId: this.formInline.projectCommentId,
infoId: this.$route.query.id
}
}
this.confirmLoading = true
addComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} 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>
@@ -0,0 +1,135 @@
<template>
<j-modal
:title="title"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
switchFullscreen
@cancel="visible = false"
>
<template slot="footer">
<a-button key="back" @click="visible = false">
{{ $t('cancel') }}
</a-button>
<a-button type="primary" :loading="confirmLoading" @click="fullTextCommentsSubmit">
{{ $t('submit') }}
</a-button>
</template>
<a-form-model :model="formInlineText" class="formAdd" :rules="rulesText" ref="ruleFormText">
<a-form-model-item class="item-model"
prop="comment"
v-if="title === $t('docTool.comparison.fullTextComments')"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('docTool.comparison.fullTextComments')">
<a-textarea :placeholder="$t('pleaseEnter') + $t('docTool.comparison.fullTextComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
<a-form-model-item class="item-model"
prop="comment"
v-if="title === $t('docTool.comparison.comparativeComments')"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="$t('docTool.comparison.comparativeComments')">
<a-textarea :placeholder="$t('pleaseEnter')+$t('docTool.comparison.comparativeComments')"
v-model="formInlineText.comment"
:maxLength="500"
:rows="4" />
</a-form-model-item>
</a-form-model>
</j-modal>
</template>
<script>
import { putAction } from '../../../../api/manage.js'
import { addFullTextComment, editComparisonComment } from '../../../../api/documentToolApi.js'
export default {
name: 'ComparisonResultEditModal',
data () {
return {
title: '',
visible: false,
confirmLoading: false,
formInlineText: {},
rulesText: {},
labelCol: {
span: 5
},
wrapperCol: {
span: 18
}
}
},
methods: {
open (form) {
this.initData()
this.visible = true
this.formInlineText = Object.assign({}, form)
},
initData () {
this.$nextTick(() => {
this.$refs.ruleFormText.clearValidate()
})
},
// 发表评论弹框的提交按钮点击
fullTextCommentsSubmit () {
this.$refs.ruleFormText.validate(valid => {
if (valid) {
if (this.title === this.$t('docTool.comparison.fullTextComments')) {
this.fullTextComments()
} else {
this.comparaComments()
}
}
})
},
// 全文评论提交
fullTextComments () {
this.confirmLoading = true
const query = {
id: this.$route.query.id,
comments: this.formInlineText.comment
}
addFullTextComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
},
// 发表评论提交
comparaComments () {
this.confirmLoading = true
const query = {
infoId: this.$route.query.id,
id: this.formInlineText.id,
comment: this.formInlineText.comment
}
editComparisonComment(query).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.visible = false
this.$emit('ok')
} else {
this.$message.warning(this.$t('operationFailed'))
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
</script>
<style scoped lang="less">
@import '~../../../../assets/less/common.less';
</style>