[add] 文档拆分模块
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="$t('importResults')"
|
||||
placement="right"
|
||||
:visible="visible"
|
||||
@close="onClose"
|
||||
width="1100"
|
||||
>
|
||||
<div class="table-page-search-wrapper">
|
||||
<search :url="url" :flag="'condition'"></search>
|
||||
</div>
|
||||
<div class="table-operator">
|
||||
<div class="operator-text">
|
||||
<!-- 拆分文件 -->
|
||||
<split-upload ref="uploadFile" :disabled="disabled" @uploadSuccess="uploadSuccess"></split-upload>
|
||||
</div>
|
||||
<div class="operator-text" @click="downLoadTemplate">
|
||||
<a-icon type="download"/>
|
||||
{{$t('templateDownload')}}
|
||||
</div>
|
||||
</div>
|
||||
<tableData
|
||||
:flag="'header'"
|
||||
:url="url"
|
||||
:type="type"
|
||||
selectionType="radio"
|
||||
:showAction="false"
|
||||
:operationList="operationList"
|
||||
@onSelectChange="onSelectChange"
|
||||
/>
|
||||
|
||||
<div class="drawer-bootom-button">
|
||||
<a-button style="margin-right: 15px" @click="cancelImports">{{$t('cancel')}}</a-button>
|
||||
<a-button type="primary" @click="handleSubmit" :loading="loading">{{$t('submit')}}</a-button>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
:title="titleItem"
|
||||
class="split-error"
|
||||
:visible="preErrVisible"
|
||||
@cancel="handleErrCancel"
|
||||
:footer="false"
|
||||
>
|
||||
<div class="err-value" v-html="errValue"></div>
|
||||
</a-modal>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { downloadFile, httpAction } from '@/api/manage'
|
||||
import Search from '@/components/customField/Search'
|
||||
import TableData from '@/components/customField/TableData'
|
||||
import SplitUpload from '@/components/splitUpload/SplitUpload'
|
||||
|
||||
export default {
|
||||
name: 'ImportResult',
|
||||
components: { Search, TableData, SplitUpload },
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
visible: false,
|
||||
disabled: false,
|
||||
selectedRowKeys: [],
|
||||
selectedRows: [],
|
||||
type: 'pdfdoc',
|
||||
form: {},
|
||||
url: {
|
||||
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', // 表格头部字段
|
||||
searchList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', // 搜索字段
|
||||
tableList: 'split/sarFileSplitInfo/splitResultPageInfo', // 表格数据
|
||||
downloadTemplate: '',
|
||||
submit: ''
|
||||
},
|
||||
operationList: [],
|
||||
accept: 'application/x-zip-compressed,application/zip',
|
||||
preErrVisible: false,
|
||||
errValue: '',
|
||||
titleItem: '' // 错误标题
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open () {
|
||||
this.visible = true
|
||||
},
|
||||
onClose () {
|
||||
this.visible = false
|
||||
this.$emit('visible', false)
|
||||
},
|
||||
onSelectChange (keys, rows) {
|
||||
this.selectedRowKeys = keys
|
||||
this.selectedRows = rows
|
||||
},
|
||||
cancelImports () {
|
||||
this.$emit('visible', false)
|
||||
},
|
||||
// 上传文件
|
||||
uploadSuccess (data) {
|
||||
const attIdList = []
|
||||
if (data && data.length > 0) {
|
||||
data.map(item => {
|
||||
attIdList.push(item.id || data.name)
|
||||
})
|
||||
}
|
||||
// 赋值给当前对应的表单文件
|
||||
this.form.file = attIdList.join(',')
|
||||
},
|
||||
// 模板下载
|
||||
downLoadTemplate () {
|
||||
const name = this.$t('documentSplitTemplate') + '.xlsx'
|
||||
downloadFile(this.url.downloadTemplate, name, {})
|
||||
},
|
||||
// 保存
|
||||
handleSubmit () {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
if (this.selectedRowKeys.length === 0) {
|
||||
this.$message.warning(this.$t('pleaseSelectOne'))
|
||||
} else if (!this.form.file) {
|
||||
this.$message.warning(this.$t('pleaseUploadSplitFile'))
|
||||
} else if (this.selectedRowKeys && this.selectedRowKeys.length === 1) {
|
||||
const row = this.selectedRows[0]
|
||||
const params = {
|
||||
connectId: row.connect_id,
|
||||
splitFileId: this.form.file,
|
||||
fileName: row.file_name,
|
||||
serialNumber: row.serial_number,
|
||||
title: row.title,
|
||||
titleEn: row.title_en,
|
||||
fileType: row.text_info_id
|
||||
}
|
||||
if (this.form.file) {
|
||||
this.loading = true
|
||||
httpAction(this.url.submit, params, 'post').then(res => {
|
||||
if (res.data.success) {
|
||||
this.$message.success(this.$t('OperationSuccessful'))
|
||||
this.visible = false
|
||||
this.$emit('visible', false, 1)
|
||||
} else {
|
||||
if (res.data.code === 1) {
|
||||
this.$message.error(res.data.message)
|
||||
} else {
|
||||
this.titleItem = '失败'
|
||||
this.preErrVisible = true
|
||||
this.errValue = res.data.message
|
||||
}
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
handleErrCancel () {
|
||||
this.preErrVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
.table-operator {
|
||||
margin-bottom: 29px;
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,231 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="$t('docTool.split.splitText')"
|
||||
placement="right"
|
||||
:visible="visible"
|
||||
@close="onClose"
|
||||
width="1100"
|
||||
>
|
||||
<div class="table-page-search-wrapper">
|
||||
<search :url="url" flag="condition" :minLength="2"></search>
|
||||
</div>
|
||||
<div class="operator-select">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="8">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text" :title="$t('docTool.split.fileType')">
|
||||
<span><i class="required">*</i>{{ $t('docTool.split.fileType') }}</span>
|
||||
</div>
|
||||
<a-select v-model="fileGroup" :placeholder="$t('pleaseSelect') + $t('docTool.split.fileType')"
|
||||
class="box-input">
|
||||
<a-select-option value="GSO" key="GSO" :title="$t('docTool.split.gso')">
|
||||
{{$t('docTool.split.gso')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="KMVSS_Table" key="KMVSS_Table" :title="$t('docTool.split.kmvssTable')">
|
||||
{{$t('docTool.split.kmvssTable')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="KMVSS_Article" key="KMVSS_Article" :title="$t('docTool.split.kmvssArticle')">
|
||||
{{$t('docTool.split.kmvssArticle')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="CFR" key="CFR" :title="$t('docTool.split.cfr')">
|
||||
{{$t('docTool.split.cfr')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="UNECE" key="UNECE" :title="$t('docTool.split.unece')">
|
||||
{{$t('docTool.split.unece')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="JPN_Attachment" key="JPN_Attachment" :title="$t('docTool.split.jpnAttachment')">
|
||||
{{$t('docTool.split.jpnAttachment')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="JPN_Article" key="JPN_Article" :title="$t('docTool.split.jpnArticle')">
|
||||
{{$t('docTool.split.jpnArticle')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="GB" key="GB" :title="$t('docTool.split.gb')">
|
||||
{{$t('docTool.split.gb')}}
|
||||
</a-select-option>
|
||||
<a-select-option value="GBT" key="GBT" :title="$t('docTool.split.gbt')">
|
||||
{{$t('docTool.split.gbt')}}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<table-data
|
||||
flag="header"
|
||||
selectionType="radio"
|
||||
:url="url"
|
||||
:type="type"
|
||||
:operationList="operationList"
|
||||
@onSelectChange="onSelectChange"
|
||||
/>
|
||||
<div class="drawer-bootom-button">
|
||||
<a-button @click="cancelSplit" style='margin-right: 15px'>{{$t('cancel')}}</a-button>
|
||||
<a-button type="primary" :loading="loading" @click="submitSplit">{{$t('submit')}}</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Search from '@/components/customField/Search'
|
||||
import TableData from '@/components/customField/TableData'
|
||||
import { httpAction } from '@/api/manage'
|
||||
|
||||
export default {
|
||||
name: 'SplitText',
|
||||
components: { Search, TableData },
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
fileGroup: '',
|
||||
selectedRowKeys: [],
|
||||
selectedRows: [],
|
||||
url: {
|
||||
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', // 表格头部字段
|
||||
searchList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', // 搜索字段
|
||||
tableList: 'split/sarFileSplitInfo/splitFilePageInfo', // 表格数据
|
||||
addSplit: ''
|
||||
},
|
||||
type: 'pdfdoc',
|
||||
operationList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open () {
|
||||
this.visible = true
|
||||
},
|
||||
// 抽屉关闭
|
||||
onClose () {
|
||||
this.visible = false
|
||||
this.$emit('visible', false)
|
||||
},
|
||||
// 表格选中改变
|
||||
onSelectChange (keys, rows) {
|
||||
this.selectedRowKeys = keys
|
||||
this.selectedRows = rows
|
||||
},
|
||||
// 取消
|
||||
cancelSplit () {
|
||||
this.visible = false
|
||||
this.$emit('visible', false)
|
||||
},
|
||||
// 拆分
|
||||
submitSplit () {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
if (!this.fileGroup) {
|
||||
this.$message.warning(this.$t('docTool.split.selectFileType'))
|
||||
} else if (this.selectedRowKeys === undefined || this.selectedRowKeys.length === 0) {
|
||||
this.$message.warning(this.$t('selectOne'))
|
||||
} else if (this.selectedRowKeys && this.selectedRowKeys.length === 1) {
|
||||
const file = this.selectedRows[0]
|
||||
if (file.file_name) {
|
||||
const name = file.file_name.split('.')
|
||||
const nameSuffix = name[name.length - 1]
|
||||
if (this.fileGroup === 'GSO') {
|
||||
if (nameSuffix.toLowerCase() === 'doc' || nameSuffix.toLowerCase() === 'docx' || nameSuffix.toLowerCase() === 'pdf') {
|
||||
const params = {
|
||||
attId: file.id,
|
||||
title: file.title,
|
||||
titleEn: file.title_en,
|
||||
fileName: file.file_name,
|
||||
serialNumber: file.serial_number,
|
||||
connectId: file.connect_id,
|
||||
fileGroup: this.fileGroup,
|
||||
fileType: file.text_info_id
|
||||
}
|
||||
this.loading = true
|
||||
httpAction(this.url.addSplit, params, 'post').then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.visible = false
|
||||
this.$emit('visible', false, 1)
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(this.$t('docTool.split.onlyWord'))
|
||||
}
|
||||
} else {
|
||||
const params = {
|
||||
attId: file.id,
|
||||
title: file.title,
|
||||
fileName: file.file_name,
|
||||
titleEn: file.title_en,
|
||||
serialNumber: file.serial_number,
|
||||
connectId: file.connect_id,
|
||||
fileGroup: this.fileGroup,
|
||||
fileType: file.text_info_id
|
||||
}
|
||||
this.loading = true
|
||||
httpAction(this.url.addSplit, params, 'post').then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.visible = false
|
||||
this.$emit('visible', false, 1)
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
.operator-select {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.box-title-text {
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.title-text {
|
||||
width: 110px;
|
||||
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;
|
||||
}
|
||||
.required {
|
||||
color: red;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.box-input {
|
||||
/*min-width: 200px;*/
|
||||
display: inline-block;
|
||||
width: calc(100% - 116px);
|
||||
height: 38px;
|
||||
margin-top: 2px;
|
||||
|
||||
/deep/ .ant-select-selection--single {
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
/deep/ .ant-select-selection__rendered {
|
||||
line-height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user