371 lines
12 KiB
Vue
371 lines
12 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>
|
|
<div style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
|
<a-button type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
|
<a-button style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
|
</div>
|
|
</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>
|
|
<j-table
|
|
ref="table"
|
|
size="middle"
|
|
:columns="columns"
|
|
:data-source="dataSource"
|
|
rowKey="id"
|
|
:can-drag="true"
|
|
:loading="loading"
|
|
:pagination="ipagination"
|
|
:scroll="{x: '100%', y:'calc(100vh - 280px)'}"
|
|
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
@change="handleTableChange"
|
|
>
|
|
<template v-slot:operation="{text,record}">
|
|
<a class="text-operation" @click="comparisonResultsClick(record)">{{$t('docTool.comparison.comparisonResults')}}</a>
|
|
|
|
<a-divider type="vertical" v-if="record.createBy === userInfoQuery.username || administrators" />
|
|
|
|
<a-dropdown v-if="record.createBy === userInfoQuery.username || administrators">
|
|
<a class="ant-dropdown-link">
|
|
{{ $t('more') }} <a-icon type="down"/>
|
|
</a>
|
|
<a-menu slot="overlay">
|
|
<a-menu-item>
|
|
<a v-if="record.createBy === userInfoQuery.username || administrators" @click="subscribe(record)">
|
|
{{!record.releaseState || record.releaseState === 'draft' ? $t('release') :$t('withdraw')}}
|
|
</a>
|
|
</a-menu-item>
|
|
<a-menu-item>
|
|
<a v-if="(record.createBy === userInfoQuery.username || administrators) && record.releaseState === 'draft'"
|
|
@click="edit(record)">{{$t('edit')}}</a>
|
|
</a-menu-item>
|
|
<a-menu-item>
|
|
<a v-if="(record.createBy === userInfoQuery.username || administrators) && record.releaseState === 'draft'"
|
|
@click="deleteData(record)">{{$t('delete')}}</a>
|
|
</a-menu-item>
|
|
</a-menu>
|
|
</a-dropdown>
|
|
</template>
|
|
<template v-slot:serialNumberRight="{text,record}">
|
|
<a @click="serialNumberRightClick(record)" :title="text">{{text}}</a>
|
|
</template>
|
|
<template v-slot:serialNumberLeft="{text,record}">
|
|
<a @click="serialNumberLeftClick(record)" :title="text">{{text}}</a>
|
|
</template>
|
|
</j-table>
|
|
</div>
|
|
</a-card>
|
|
</template>
|
|
|
|
<script>
|
|
import { postAction, deleteAction } from '@/api/manage'
|
|
import { mapGetters } from 'vuex'
|
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
|
import JTable from '@/components/jero/JTable'
|
|
import { JeroListMixin } from '../../mixins/JeroListMixin'
|
|
|
|
export default {
|
|
name: 'DocumentComparison',
|
|
components: { JDictSelectTag, JTable },
|
|
mixins: [JeroListMixin],
|
|
data () {
|
|
return {
|
|
// url传参严格按照当前命名
|
|
url: {
|
|
list: '/compare/sarFileCompareInfo/page',
|
|
deleteBatch: '/compare/sarFileCompareInfo/deleteBatch'
|
|
},
|
|
loading: false,
|
|
dataSource: [
|
|
{id: 1}
|
|
],
|
|
selectedRowKeys: [],
|
|
selectionRows: [],
|
|
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: 'center',
|
|
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.loadData(1)
|
|
},
|
|
methods: {
|
|
...mapGetters(['userInfo']),
|
|
getList () {
|
|
this.dataSource = [{ id: 1, serialNumberLeft: '11' }]
|
|
},
|
|
batchDelete () {
|
|
if (this.selectedRowKeys.length > 0) {
|
|
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.userInfoQuery.username &&
|
|
selectionRows[i].releaseState === 'draft') {
|
|
idList.push(selectionRows[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'))
|
|
}
|
|
},
|
|
// 对比结果按钮点击
|
|
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>
|