Files
laws_weilai/jero-web/src/views/documentTools/documentComparison/components/initiateComparison.vue
T
2022-10-09 20:49:04 +08:00

614 lines
20 KiB
Java

<template>
<div class="doc-detail">
<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="Fallback">
<a-icon type="arrow-left" style="margin-right: 6px;"/>
</span>
<span> {{$t('initiateComparison')}}</span>
</div>
</div>
<div style="padding-top: 68px;background: #fff">
<div class="detail-content">
<div style="width: 100%;height: auto;overflow: hidden">
<div class="detail-content-left">
<a-form layout="inline" @keyup.enter.native="searchQueryLeft">
<a-row :gutter="24">
<a-col :md="8" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParamLeft.serialNumber"></a-input>
</div>
</a-col>
<a-col :md="8" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParamLeft.title"></a-input>
</div>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button class="box-button" type="primary" @click="searchQueryLeft">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px"
@click="searchResetLeft">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<a-table
ref="table"
size="middle"
:loading="loadingLeft"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceLeft"
:row-selection="{ selectedRowKeys: selectedRowKeysLeft, onChange: onSelectChangeLeft,columnTitle:' ' }"
:columns="columns"
>
</a-table>
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSizeLeft"
:total="totalLeft"
:current="pageNoLeft"
@change="pageOnChangeLeft"
@showSizeChange="SizeChangeLeft"
/>
</div>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('selectedStandard')">
{{$t('selectedStandard')}}
</span>
<span class="box-button-standard-right"
@click="selecLeftClick(selectedRowKeysLeftRecord[0])"
:title="selectedRowKeysLeftRecord[0]?selectedRowKeysLeftRecord[0].serialNumber+' '+selectedRowKeysLeftRecord[0].fileName:$t('noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowKeysLeftRecord[0]}">
{{selectedRowKeysLeftRecord[0]?selectedRowKeysLeftRecord[0].serialNumber+' '+selectedRowKeysLeftRecord[0].fileName:$t('noComparisonDocumentSelected')}}
</span>
</div>
</div>
<div class="detail-content-right">
<a-form layout="inline" @keyup.enter.native="searchQueryRight">
<a-row :gutter="24">
<a-col :md="8" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParamRight.serialNumber"></a-input>
</div>
</a-col>
<a-col :md="8" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParamRight.title"></a-input>
</div>
</a-col>
<span style="text-align:right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="8" :sm="24">
<a-button class="box-button" type="primary" @click="searchQueryRight">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px"
@click="searchResetRight">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
<a-table
ref="table"
size="middle"
:loading="loadingRight"
:pagination="false"
:scroll="{x: '100%',y:340}"
rowKey="id"
:data-source="dataSourceRight"
:row-selection="{ selectedRowKeys: selectedRowKeysRight, onChange: onSelectChangeRight,columnTitle:' ' }"
:columns="columns"
>
</a-table>
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSizeRight"
:total="totalRight"
:current="pageNoRight"
@change="pageOnChangeRight"
@showSizeChange="SizeChangeRight"
/>
</div>
<div class="box-button-standard">
<span class="box-button-standard-left" :title="$t('selectedStandard')">
{{$t('selectedStandard')}}
</span>
<span class="box-button-standard-right"
@click="selecLeftClick(selectedRowKeysRightRecord[0])"
:title="selectedRowKeysRightRecord[0]?selectedRowKeysRightRecord[0].serialNumber+' '+selectedRowKeysRightRecord[0].fileName:$t('noComparisonDocumentSelected')"
:class="{'box-button-standard-right-color':selectedRowKeysRightRecord[0]}">
{{selectedRowKeysRightRecord[0]?selectedRowKeysRightRecord[0].serialNumber+' '+selectedRowKeysRightRecord[0].fileName:$t('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('RemarkInfo')">
<span>{{$t('RemarkInfo')}}</span>
</div>
<a-form-model-item class="itemModel" prop="remark">
<a-textarea :placeholder="$t('pleaseEnter')+$t('RemarkInfo')"
v-model="formInline.remark"
:rows="4"/>
</a-form-model-item>
</div>
</a-form-model>
</div>
<div class="submit-button">
<a-button class="box-button" type="primary" @click="submit">{{$t('initiateDocumentComparison')}}</a-button>
</div>
</div>
</div>
<JLoading :loading="loading">{{$t('pleaseWaitWhileRunning')}}</JLoading>
</div>
</div>
</template>
<script>
import { getAction, postAction, deleteAction ,downloadFile} from '@/api/manage'
import { Base64 } from 'js-base64'
import { mapGetters } from 'vuex'
export default {
name: 'initiateDocumentComparison',
data() {
return {
loading: false,
loadingLeft: false,
loadingRight: false,
queryParamLeft: {},
queryParamRight: {},
pageSizeLeft: 10,
totalLeft: 0,
pageNoLeft: 1,
pageSizeRight: 10,
selectedRowKeysRight: [],
dataSourceRight: [],
selectedRowKeysLeftRecord: [],
selectedRowKeysRightRecord: [],
totalRight: 0,
pageNoRight: 1,
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'),
align: 'center',
width: 70,
customRender: function(t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('standard'),
align: 'center',
ellipsis: true,
dataIndex: 'serialNumber'
},
{
title: this.$t('title'),
align: 'center',
ellipsis: true,
dataIndex: 'title'
},
{
title: this.$t('TextStatus'),
align: 'center',
ellipsis: true,
dataIndex: 'fileType'
},
{
title: this.$t('fileName'),
align: 'center',
ellipsis: true,
dataIndex: 'fileName'
}
],
dataSourceLeft: [],
selectedRowKeysLeft: [],
url: {
list: '/split/sarFileSplitInfo/page',
add: '/compare/sarFileCompareInfo/fullTextComparison'
}
}
},
mounted() {
this.getListLeft()
this.getListRight()
document.title = this.$t('DocumentComparison') + ' - ' + this.$t('initiateComparison')
},
methods: {
...mapGetters(['userInfo']),
Fallback() {
this.$router.push({
path: '/documentComparison'
})
},
searchQueryLeft() {
this.pageNoLeft = 1
this.getListLeft()
},
searchResetLeft() {
this.queryParamLeft = {}
this.pageNoLeft = 1
this.getListLeft()
},
onSelectChangeLeft(value, record) {
this.selectedRowKeysLeft = value
this.selectedRowKeysLeftRecord = []
if (this.selectedRowKeysLeft.length > 1) {
this.selectedRowKeysLeft.shift()
}
let content = record.filter(res => {
return res.id == this.selectedRowKeysLeft[0]
})
this.selectedRowKeysLeftRecord = content
},
pageOnChangeLeft(page) {
this.pageNoLeft = page
this.getListLeft()
},
SizeChangeLeft(page, pageSize) {
this.pageNoLeft = 1
this.pageSizeLeft = pageSize
this.getListLeft()
},
searchQueryRight() {
this.pageNoRight = 1
this.getListRight()
},
searchResetRight() {
this.queryParamRight = {}
this.pageNoRight = 1
this.getListRight()
},
onSelectChangeRight(value, record) {
this.selectedRowKeysRight = value
this.selectedRowKeysRightRecord = []
if (this.selectedRowKeysRight.length > 1) {
this.selectedRowKeysRight.shift()
}
let content = record.filter(res => {
return res.id == this.selectedRowKeysRight[0]
})
this.selectedRowKeysRightRecord = content
},
pageOnChangeRight(page) {
this.pageNoRight = page
this.getListRight()
},
SizeChangeRight(page, pageSize) {
this.pageNoRight = 1
this.pageSizeRight = pageSize
this.getListRight()
},
submit() {
if (!this.selectedRowKeysRightRecord[0] || !this.selectedRowKeysLeftRecord[0]) {
this.$message.warning(this.$t('pleaseSelectTheDataCompared'))
return
}
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.loading = true
let query = {
leftStandard: this.selectedRowKeysLeftRecord[0].id,
rightStandard: this.selectedRowKeysRightRecord[0].id,
remark: this.formInline.remark
}
postAction(this.url.add, query).then((res) => {
if (res.success) {
this.loading = false
this.$message.success(this.$t('OperationSuccessful'))
this.$router.push({
path: '/documentDataComparison',
query: {
id: res.result
}
})
} else {
this.loading = false
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
getListLeft() {
let queryParam = JSON.parse(JSON.stringify(this.queryParamLeft))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let query = {
pageNo: this.pageNoLeft,
pageSize: this.pageSizeLeft,
fileId: '1',
...queryParam
}
this.loadingLeft = true
getAction(this.url.list, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNoLeft = 1
this.getListLeft()
return
}
this.dataSourceLeft = res.result.records || []
this.totalLeft = res.result.total
this.loadingLeft = false
} else {
this.loadingLeft = false
}
})
},
selecLeftClick(fileQuery){
if (fileQuery){
let fileName = fileQuery.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let 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))
} else if (fileSuffix == '.docx' || fileSuffix == '.doc') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
let 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'){
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + fileQuery.fileId + fileSuffix)
window.open(url, '_blank')
} else {
downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.fileId })
}
}
},
getListRight() {
let queryParam = JSON.parse(JSON.stringify(this.queryParamRight))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let query = {
pageNo: this.pageNoRight,
pageSize: this.pageSizeRight,
fileId: '1',
...queryParam
}
this.loadingRight = true
getAction(this.url.list, 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.totalRight = res.result.total
this.loadingRight = false
} else {
this.loadingRight = false
}
})
}
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.doc-detail {
background: #fff;
height: 100%;
.doc-detail-wrap {
padding-bottom: 20px;
position: relative;
.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;
}
}
}
}
.detail-content-left {
width: 50%;
float: left;
border-right: 2px #EFF1F3 solid;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 610px;
}
.detail-content-right {
width: 50%;
float: left;
padding: 24px 32px;
box-sizing: border-box;
border-bottom: 2px #EFF1F3 solid;
height: 610px;
}
.page {
text-align: right;
margin-top: 20px;
}
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.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;
}
.title-text {
width: 60px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: calc(100% - 60px);
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
.text-operation {
margin-right: 8px;
}
.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;
}
.itemModel {
width: calc(100% - 232px);
}
.submit-button {
width: 100%;
margin-top: 20px;
text-align: right;
padding: 0 32px;
box-sizing: border-box;
}
.box-button-standard-right-color {
color: #040B29;
cursor: pointer;
}
</style>