399 lines
13 KiB
Vue
399 lines
13 KiB
Vue
<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('number')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
|
|
<a-input :placeholder="$t('pleaseEnter') + $t('number')"
|
|
v-model="queryParam.serialNumber"></a-input>
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :md="6" :sm="8">
|
|
<a-form-item :label="$t('title')" :labelCol="{span: 6}" :wrapperCol="{span: 14}">
|
|
<a-input :placeholder="$t('pleaseEnter') + $t('title')"
|
|
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_condition"/>
|
|
</a-form-item>
|
|
</a-col>
|
|
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
|
<a-col :md="6" :sm="24">
|
|
<a-button style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
|
<a-button style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
|
</a-col>
|
|
</span>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<div class="table-operator">
|
|
<!-- v-has="'documentComparison:Initiate'"-->
|
|
<div @click="initiatingProcessClick" class="operator-text">
|
|
<a-icon type="block"/>
|
|
{{$t('docTool.comparison.initiateComparison')}}
|
|
</div>
|
|
<!-- v-has="'documentComparison:batchDelete'"-->
|
|
<div @click="batchDelete" class="operator-text">
|
|
<a-icon type="delete"/>
|
|
{{$t('batchDelete')}}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<a-table
|
|
ref="table"
|
|
size="middle"
|
|
:components="drag(columns,'columns')"
|
|
:loading="loading"
|
|
:pagination="ipagination"
|
|
:scroll="{x: '100%',y:'calc(100vh - 280px)'}"
|
|
rowKey="id"
|
|
:data-source="dataSource"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
:columns="columns"
|
|
@change="tableOnChange"
|
|
>
|
|
<span slot="operation" slot-scope="text,record">
|
|
<a class="text-operation" @click="comparisonResultsClick(record)">{{$t('docTool.comparison.comparisonResults')}}</a>
|
|
<a class="text-operation"
|
|
v-if="record.createBy === userInfoQuery.username || administrators"
|
|
@click="subscribe(record)">
|
|
{{!record.releaseState || record.releaseState === 'draft' ? $t('release') :$t('withdraw')}}
|
|
</a>
|
|
<a class="text-operation"
|
|
v-if="(record.createBy === userInfoQuery.username || administrators) && record.releaseState === 'draft'"
|
|
@click="edit(record)">{{$t('edit')}}</a>
|
|
<a class="text-operation"
|
|
v-if="(record.createBy === userInfoQuery.username || administrators) && record.releaseState === 'draft'"
|
|
@click="deleteData(record)">{{$t('delete')}}</a>
|
|
</span>
|
|
<span slot="serialNumberRight" :title="text" slot-scope="text,record">
|
|
<a @click="serialNumberRightClick(record)">{{text}}</a>
|
|
</span>
|
|
<span slot="serialNumberLeft" :title="text" slot-scope="text,record">
|
|
<a @click="serialNumberLeftClick(record)">{{text}}</a>
|
|
</span>
|
|
</a-table>
|
|
</div>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction, deleteAction } from '@/api/manage'
|
|
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
|
|
import { mapGetters } from 'vuex'
|
|
import JDictSelectTag from '../../components/dict/JDictSelectTag'
|
|
|
|
export default {
|
|
name: 'DocumentComparison',
|
|
mixins: [ResizeHeader, ResizeColumnProvide],
|
|
components: { JDictSelectTag },
|
|
data () {
|
|
return {
|
|
// url传参严格按照当前命名
|
|
url: {
|
|
list: '/compare/sarFileCompareInfo/page',
|
|
deleteBatch: '/compare/sarFileCompareInfo/deleteBatch'
|
|
},
|
|
loading: false,
|
|
dataSource: [],
|
|
selectedRowKeys: [],
|
|
selectedRows: [],
|
|
downLoadFileUrl: window._CONFIG.domianPreviewURL + '/sys/common/download',
|
|
downLoadImgUrl: window._CONFIG.domianWebImgURL + '/sys/common/download',
|
|
/* 分页参数 */
|
|
ipagination: {
|
|
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
|
|
},
|
|
queryParam: {},
|
|
userInfoQuery: {},
|
|
administrators: false,
|
|
columns: [
|
|
{
|
|
title: this.$t('number') + ' 1',
|
|
align: 'left',
|
|
dataIndex: 'serialNumberLeft',
|
|
width: 170,
|
|
ellipsis: true,
|
|
scopedSlots: { customRender: 'serialNumberLeft' }
|
|
},
|
|
{
|
|
title: this.$t('title') + ' 1',
|
|
align: 'left',
|
|
dataIndex: 'titleLeft',
|
|
width: 170,
|
|
ellipsis: true,
|
|
scopedSlots: { customRender: 'serialNumberLeft' }
|
|
},
|
|
{
|
|
title: this.$t('docTool.comparison.textStatus') + ' 1',
|
|
align: 'left',
|
|
width: 200,
|
|
ellipsis: true,
|
|
dataIndex: 'fileTypeLeft'
|
|
},
|
|
{
|
|
title: this.$t('number') + ' 2',
|
|
align: 'left',
|
|
dataIndex: 'serialNumberRight',
|
|
ellipsis: true,
|
|
scopedSlots: { customRender: 'serialNumberRight' },
|
|
width: 170
|
|
},
|
|
{
|
|
title: this.$t('title') + ' 2',
|
|
align: 'left',
|
|
dataIndex: 'titleRight',
|
|
scopedSlots: { customRender: 'serialNumberRight' },
|
|
ellipsis: true,
|
|
width: 170
|
|
},
|
|
{
|
|
title: this.$t('docTool.comparison.textStatus') + ' 2',
|
|
align: 'left',
|
|
width: 200,
|
|
ellipsis: true,
|
|
dataIndex: 'fileTypeRight'
|
|
},
|
|
{
|
|
title: this.$t('docTool.comparison.releaseSituation'),
|
|
align: 'left',
|
|
width: 170,
|
|
ellipsis: true,
|
|
dataIndex: 'releaseStateTitle'
|
|
},
|
|
{
|
|
title: this.$t('creator'),
|
|
align: 'left',
|
|
width: 170,
|
|
ellipsis: true,
|
|
dataIndex: 'createBy'
|
|
},
|
|
{
|
|
title: this.$t('remarks'),
|
|
align: 'left',
|
|
ellipsis: true,
|
|
width: 270,
|
|
dataIndex: 'remark'
|
|
},
|
|
{
|
|
title: this.$t('operation'),
|
|
align: 'left',
|
|
fixed: 'right',
|
|
width: 310,
|
|
scopedSlots: { customRender: 'operation' }
|
|
}
|
|
]
|
|
}
|
|
},
|
|
mounted () {
|
|
if (this.$route.query.serialNumber) {
|
|
this.queryParam.serialNumber = this.$route.query.serialNumber
|
|
this.queryParam = { ...this.queryParam }
|
|
}
|
|
this.userInfoQuery = this.userInfo()
|
|
this.administrators = false
|
|
if (this.userInfoQuery.userRoleList && this.userInfoQuery.userRoleList.length > 0) {
|
|
this.userInfoQuery.userRoleList.forEach(res => {
|
|
if (res.roleCode === 'admin') {
|
|
this.administrators = true
|
|
}
|
|
})
|
|
}
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
...mapGetters(['userInfo']),
|
|
searchQuery () {
|
|
this.ipagination.current = 1
|
|
this.getList()
|
|
},
|
|
searchReset () {
|
|
this.queryParam = {}
|
|
this.ipagination.current = 1
|
|
this.getList()
|
|
},
|
|
tableOnChange (pagination) {
|
|
this.ipagination = pagination
|
|
this.getList()
|
|
},
|
|
getList () {
|
|
const queryParam = JSON.parse(JSON.stringify(this.queryParam))
|
|
Object.keys(queryParam).forEach(val => {
|
|
if (queryParam[val] instanceof Array) {
|
|
queryParam[val] = queryParam[val].join(',')
|
|
}
|
|
})
|
|
const query = {
|
|
pageNo: this.ipagination.current,
|
|
pageSize: this.ipagination.pageSize,
|
|
...queryParam
|
|
}
|
|
this.loading = true
|
|
getAction(this.url.list, query).then((res) => {
|
|
if (res.success) {
|
|
if (res.result.current > 1 && res.result.records.length === 0) {
|
|
this.ipagination.current = 1
|
|
this.getList()
|
|
return
|
|
}
|
|
this.dataSource = res.result.records || []
|
|
this.ipagination.total = res.result.total
|
|
}
|
|
}).finally(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
batchDelete () {
|
|
if (this.selectedRowKeys.length > 0) {
|
|
this.$confirm({
|
|
content: this.$t('confirmBatchDeletion'),
|
|
onOk: () => {
|
|
const idList = []
|
|
const selectedRowKeysRecord = JSON.parse(JSON.stringify(this.selectedRowKeysRecord))
|
|
for (let i = 0; i < selectedRowKeysRecord.length; i++) {
|
|
if (selectedRowKeysRecord[i].createBy === this.userInfoQuery.username &&
|
|
selectedRowKeysRecord[i].releaseState === 'draft') {
|
|
idList.push(selectedRowKeysRecord[i].id)
|
|
}
|
|
}
|
|
if (idList.length > 0) {
|
|
deleteAction(this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.selectedRowKeys = []
|
|
this.getList()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning(this.$t('doNotHavePermissionDeleteData'))
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
}
|
|
},
|
|
onSelectChange (value, record) {
|
|
this.selectedRowKeys = value
|
|
this.selectedRows = record
|
|
},
|
|
// 对比结果按钮点击
|
|
comparisonResultsClick (item) {
|
|
if (item.createBy === this.userInfoQuery.username && item.releaseState === 'draft') {
|
|
item.isDisplay = 2
|
|
} else {
|
|
item.isDisplay = 1
|
|
}
|
|
const newUrl = this.$router.resolve({
|
|
path: '/comparisonResults',
|
|
query: {
|
|
id: item.id,
|
|
isDisplay: item.isDisplay
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
// 撤回按钮点击
|
|
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
|
|
}
|
|
postAction('/compare/sarFileCompareInfo/changeState', query).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.getList()
|
|
} else {
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
edit (row) {
|
|
const newUrl = this.$router.resolve({
|
|
path: '/documentDataComparison',
|
|
query: {
|
|
id: row.id
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
// 发起对比按钮点击
|
|
initiatingProcessClick () {
|
|
this.$router.push({
|
|
path: '/initiateDocumentComparison'
|
|
})
|
|
// let newUrl = this.$router.resolve({
|
|
// path: '/initiateDocumentComparison'
|
|
// })
|
|
// window.open(newUrl.href, '_blank')
|
|
},
|
|
deleteData (val) {
|
|
this.$confirm({
|
|
content: this.$t('confirmDeletion'),
|
|
onOk: () => {
|
|
deleteAction(this.url.deleteBatch, { ids: val.id }).then((res) => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('operationSuccessful'))
|
|
this.getList()
|
|
} else {
|
|
this.$message.warning(res.message)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
// 编号2和标题2列的点击事件
|
|
serialNumberRightClick (row) {
|
|
const newUrl = this.$router.resolve({
|
|
path: '/documentManage/library/detail',
|
|
query: {
|
|
id: row.fileKeyRight
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
},
|
|
// 编号1列和标题1列的点击事件
|
|
serialNumberLeftClick (row) {
|
|
const newUrl = this.$router.resolve({
|
|
path: '/documentManage/library/detail',
|
|
query: {
|
|
id: row.fileKeyLeft
|
|
}
|
|
})
|
|
window.open(newUrl.href, '_blank')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
</style>
|