[add] 文档拆分模块

This commit is contained in:
lideqin
2023-08-15 18:20:08 +08:00
parent ff0570abd2
commit 74ac8c07d0
11 changed files with 929 additions and 132 deletions
+5 -1
View File
@@ -100,6 +100,9 @@ export const transitRESTful = {
// 标签管理- 展示区域查询接口
const getShowAreaData = (params) => getAction('/tag/onlCgformArea/queryShowArea', params)
// 通过文件的id获取文件的相应信息
const getFileInfo = (params) => getAction('/sys/oss/file/queryById', params)
export {
addRole,
editRole,
@@ -156,5 +159,6 @@ export {
getUserNoticeInfo,
getDictItemsFromCache,
getShowAreaData
getShowAreaData,
getFileInfo
}
+4
View File
@@ -0,0 +1,4 @@
import Vue from 'vue'
const bus = new Vue()
Vue.prototype.$eventBus = bus
export default bus
+23
View File
@@ -88,6 +88,8 @@ module.exports = {
operationFailed: '操作失败',
nodeQuickLookup: '节点快速查找',
pleaseEnterOrSelect: '请输入或选择',
view: '查看',
selectOne: '请选择一条数据',
// 页面头部
header: {
userMenuSearchMenu: '搜索菜单',
@@ -313,6 +315,27 @@ module.exports = {
implementationDateTwo: '实施日期',
typeofImplementation: '实施类型'
},
// 文档工具
docTool: {
// 文档拆分
split: {
splitText: '拆分已入库文本',
importResults: '导入拆分结果',
backDocument: '回传至文档库',
selectFileType: '请选择文件类型',
onlyWord: '只能导入word文件',
fileType: '文件类型',
kmvssTable: 'KMVSS Table',
kmvssArticle: 'KMVSS Article',
cfr: 'CFR',
unece: 'UNECE',
jpnAttachment: 'JPN Attachment',
jpnArticle: 'JPN Article',
gb: 'GB',
gbt: 'GB/T',
gso: 'GSO',
}
},
// 标准选择器
standardSelect: {
standardSelection: '标准选择'
+69 -63
View File
@@ -1,8 +1,8 @@
<template>
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8" v-for="(item,index) in searchList" :key="index" style="line-height: 48px">
<template v-if="index < 3">
<a-col :md="(24 / (minLength + 1))" :sm="(24 / minLength)" v-for="(item,index) in searchList" :key="index" style="line-height: 48px">
<template v-if="index < minLength">
<!-- 树形选择器 -->
<div class="box-title-text" v-if="item.field_show_type === FieldType.TREE.value">
<div class="title-text" :title="item.db_field_txt">
@@ -87,7 +87,7 @@
<!-- </div>-->
</template>
<template v-if="index >= 3 && toggleSearchStatus">
<template v-if="index >= minLength && toggleSearchStatus">
<div class="box-title-text" v-if="item.field_show_type === FieldType.TREE.value">
<div class="title-text" :title="item.db_field_txt">
<span>{{item.db_field_txt}}</span>
@@ -165,14 +165,14 @@
</a-col>
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-col :md="6" :sm="24">
<a @click="handleToggleSearch" v-if="searchList.length > 3">
{{ !toggleSearchStatus ? $t('open') : $t('putAway') }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</a-col>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
@@ -183,6 +183,7 @@ import { getAction } from '@/api/manage'
import JDictSelectTag from '../dict/JDictSelectTag'
import JMultiSelectTag from '../dict/JMultiSelectTag'
import { FieldType } from '../../enums/commonEnums'
import eventBus from '@/common/event'
export default {
name: 'Search',
@@ -198,12 +199,16 @@ export default {
type: String,
default: ''
},
searchQueryList: {
type: Array,
default: () => {
return []
}
minLength: {
type: Number,
default: 3
}
// searchQueryList: {
// type: Array,
// default: () => {
// return []
// }
// }
},
data () {
return {
@@ -230,20 +235,20 @@ export default {
field_show_type: '1',
tree: []
},
{
db_field_name: 'state',
db_field_txt: '状态',
dict_field: 'state',
field_show_type: '3',
tree: []
},
{
db_field_name: 'region',
db_field_txt: '适用地区',
dict_field: 'region',
field_show_type: '4',
tree: []
},
// {
// db_field_name: 'state',
// db_field_txt: '状态',
// dict_field: 'state',
// field_show_type: '3',
// tree: []
// },
// {
// db_field_name: 'region',
// db_field_txt: '适用地区',
// dict_field: 'region',
// field_show_type: '4',
// tree: []
// },
// {
// db_field_name: 'technology_territory',
// db_field_txt: '技术领域',
@@ -251,36 +256,36 @@ export default {
// field_show_type: '0',
// tree: []
// },
{
db_field_name: 'issue_time',
db_field_txt: '发布日期',
dict_field: '',
field_show_type: '5',
tree: []
},
{
db_field_name: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
db_field_txt: '新车型实施日期',
dict_field: '',
field_show_type: '5',
tree: []
},
{
db_field_name: 'implement_time',
db_field_txt: '在产车实施日期',
dict_field: '',
field_show_type: '5',
tree: []
}
// {
// db_field_name: 'issue_time',
// db_field_txt: '发布日期',
// dict_field: '',
// field_show_type: '5',
// tree: []
// },
// {
// db_field_name: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
// db_field_txt: '新车型实施日期',
// dict_field: '',
// field_show_type: '5',
// tree: []
// },
// {
// db_field_name: 'implement_time',
// db_field_txt: '在产车实施日期',
// dict_field: '',
// field_show_type: '5',
// tree: []
// }
]
},
methods: {
searchQuery () {
this.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
eventBus.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
},
searchReset () {
this.queryParam = {}
this.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
eventBus.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
},
// 获取查询条件列表
getSearch () {
@@ -290,20 +295,21 @@ export default {
getAction(this.url.getSearchList, params).then((res) => {
if (res.success) {
this.searchList = res.result
if (this.searchQueryList && this.searchQueryList.length > 0) {
for (let i = 0; i < this.searchList.length; i++) {
if (this.searchList[i].db_field_name === 'issue_time') {
this.searchList.splice(i, 1)
i--
}
// db_field_name 说明可以被代替位置??
if (this.searchList[i].db_field_name === 'title') {
const data = this.searchList[i + 1]
this.searchList[i + 1] = this.searchQueryList[0]
this.searchList.push(data)
}
}
}
// if (this.searchQueryList && this.searchQueryList.length > 0) {
// for (let i = 0; i < this.searchList.length; i++) {
// // 是要去掉这个字段的搜索??
// if (this.searchList[i].db_field_name === 'issue_time') {
// this.searchList.splice(i, 1)
// i--
// }
// // db_field_name 说明可以被代替位置??
// if (this.searchList[i].db_field_name === 'title') {
// const data = this.searchList[i + 1]
// this.searchList[i + 1] = this.searchQueryList[0]
// this.searchList.push(data)
// }
// }
// }
}
})
},
+56 -42
View File
@@ -1,19 +1,18 @@
<template>
<div style="height: 100%">
<div class="box" v-if="isTrue">
<a-table
class="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%'}"
:components="drag(columns,'columns')"
:data-source="dataSource"
:loading="loading"
:rowClassName="rowClassName"
:columns="columns"
@change="tableOnChange"
>
<div class="box" v-if="isTrue">
<a-table
class="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: selectionType }"
:pagination="ipagination"
:scroll="{x: '100%'}"
:components="drag(columns,'columns')"
:data-source="dataSource"
:loading="loading"
:rowClassName="rowClassName"
:columns="columns"
@change="tableOnChange"
>
<span slot="operation" slot-scope="text, record">
<a v-for="(ol, index) in operationList" :key="index" @click="operationClick(ol,record)">
<span v-if="ol.text === $t('cancelCollection')" v-has="ol.has" class="text">
@@ -27,29 +26,34 @@
</span>
</a>
</span>
<span slot="detailClick" slot-scope="text,record">
<span slot="detailClick" slot-scope="text, record">
<a class="textName" :title="text" @click="detailClick(record)">
{{text}}
</a>
</span>
<!-- <span slot="urlClick" slot-scope="text,record">-->
<!-- <a class="text" :title="text" @click="urlClick(text)">-->
<!-- {{text}}-->
<!-- </a>-->
<!-- </span>-->
<!-- <span slot="detailText" slot-scope="text,record">-->
<!-- <span class="text" :title="text">-->
<!-- {{text}}-->
<!-- </span>-->
<!-- </span>-->
</a-table>
</div>
<span slot="detail" slot-scope="text">
<span class="textName" :title="text">
{{text}}
</span>
</span>
<!-- <span slot="urlClick" slot-scope="text,record">-->
<!-- <a class="text" :title="text" @click="urlClick(text)">-->
<!-- {{text}}-->
<!-- </a>-->
<!-- </span>-->
<!-- <span slot="detailText" slot-scope="text,record">-->
<!-- <span class="text" :title="text">-->
<!-- {{text}}-->
<!-- </span>-->
<!-- </span>-->
</a-table>
</div>
</template>
<script>
import { ResizeColumnProvide, ResizeHeader } from '@/mixins/header'
import { getAction, postAction } from '@/api/manage'
import eventBus from '@/common/event'
export default {
name: 'TableData',
@@ -73,10 +77,19 @@ export default {
type: String,
default: ''
},
// 表格选择是单选还是多选
selectionType: {
type: String,
default: 'checkbox'
},
// 是否显示操作;默认不显示
showAction: {
type: Boolean,
default: false
},
type: {
type: String,
default: ''
}
},
data () {
@@ -104,7 +117,7 @@ export default {
}
},
mounted () {
this.$on('searchQuery', search => {
eventBus.$on('searchQuery', search => {
Object.keys(search).forEach(res => {
if (search[res] instanceof Array) {
search[res] = search[res].join(',')
@@ -114,7 +127,7 @@ export default {
this.getData()
this.getTableList()
})
this.$on('searchReset', target => {
eventBus.$on('searchReset', target => {
this.searchParams = {}
this.selectedRowKeys = []
this.getData()
@@ -179,13 +192,13 @@ export default {
ellipsis: true,
width: 215
},
{
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: 200,
scopedSlots: { customRender: 'operation' }
}
// {
// title: this.$t('operation'),
// align: 'center',
// fixed: 'right',
// width: 200,
// scopedSlots: { customRender: 'operation' }
// }
]
this.dataSource = [
{
@@ -204,8 +217,8 @@ export default {
this.isTrue = true
},
beforeDestroy () {
this.$off('searchQuery')
this.$off('searchReset')
eventBus.$off('searchQuery')
eventBus.$off('searchReset')
this.$off('searchGetData')
},
methods: {
@@ -287,6 +300,7 @@ export default {
...this.searchParams,
orderBy: this.orderBy,
orderByField: this.orderByField,
type: this.type,
pageNo: pageNo,
pageSize: pageSize
}
@@ -306,9 +320,9 @@ export default {
}
})
},
onSelectChange (value) {
this.selectedRowKeys = value
this.$emit('onSelectChange', value)
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.$emit('onSelectChange', selectedRowKeys, selectedRows)
},
operationClick (ol, item) {
this.$emit(ol.clickEvent, item)
+150
View File
@@ -0,0 +1,150 @@
<template>
<div class="split-import-upload">
<a-upload
accept=".zip"
:disabled="disabled"
class="ant-upload-list"
name="file"
:list-type="listType"
:file-list="myFileList"
:multiple="false"
:action="uploadAction"
:headers="headers"
:before-upload="beforeUpload"
:remove='remove'
@change="handleChange">
<div class="operator-text">
<a-icon type="export" :rotate="-90"/>
拆分文件
</div>
</a-upload>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'SplitUpload',
props: ['disabled', 'listType'],
data () {
return {
visible: false,
uploadAction: window._CONFIG.domianURL + '/sys/common/upload',
myFileList: [],
fileList: [],
fileTypeStatus: false,
headers: {}
}
},
created () {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
},
methods: {
beforeUpload (file, fileList) {
console.log('file', this.accept, file, fileList, this.myFileList)
this.fileTypeSatus = false
if (this.myFileList && this.myFileList.length >= 1) {
this.$message.warning(this.$t('onlyOnefileUploaded'))
return false
} else {
const suffix = file.name.split('.')
const acceptSuffix = suffix[suffix.length - 1]
if (acceptSuffix.toLowerCase() === 'zip') {
this.fileTypeSatus = true
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
// }
}
}
},
remove () {
this.fileTypeSatus = true
},
handleChange (info) {
const { file } = info
const status = info.file.status
info.fileList.forEach((val, index) => {
if (val.response && !val.response.result) {
this.$message.error(val.response.message)
info.fileList.splice(index, 1)
}
})
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
} else {
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(`${info.file.name}` + this.$t('fileUploadFailed'))
} else if (status === 'removed') {
this.myFileList = info.fileList
this.fileList = []
this.myFileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name}` + this.$t('deletedSuccessfully'))
} else if (status === 'done') {
this.fileList = []
this.myFileList = info.fileList
this.myFileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
} else {
this.fileList.push(res)
}
})
if (this.myFileList.length > 0) {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.success(`${info.file.name}` + this.$t('uploadSuccessful'))
}
} else if (status === 'uploading') {
this.myFileList = info.fileList
this.$emit('uploadSuccess')
}
}
} else if (!this.fileTypeSatus && this.myFileList.length < 1) {
this.$message.warning(this.$t('typeCannotUploaded'))
}
}
}
}
</script>
<style scoped lang="less">
.split-import-upload {
/deep/ .ant-upload-list-item {
position: relative;
height: 22px;
margin-top: -22px;
font-size: 14px;
margin-right: 100px;
}
/deep/ .ant-upload-list-item-info {
span {
display: flex;
justify-content: start;
text-align: right;
.ant-upload-list-item-name {
margin-right: 20px;
max-width: 800px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
}
}
}
</style>
+35 -13
View File
@@ -4,15 +4,36 @@
<search ref="searchRef" :flag="'1'" :url="url"/>
</div>
<div class="table-operator">
<a-button @click="handleBatchDel" type="primary" icon="delete">{{ $t('batchDelete') }}</a-button>
<a-button @click="handleExportXls" type="primary" icon="export">{{ $t('dataExport') }}</a-button>
<a-button @click="handleFileExport" type="primary" icon="mail">{{ $t('exportWithFile') }}</a-button>
<a-button @click="handleCompare" type="primary" icon="share-alt">{{ $t('share') }}</a-button>
<a-button @click="downTemplate" type="primary" icon="download">{{ $t('templateDownload') }}</a-button>
<div class="operator-text" @click="handleBatchDel">
<a-icon type="delete"/>
{{ $t('batchDelete') }}
</div>
<div class="operator-text" @click="handleExportXls">
<a-icon type="export"/>
{{ $t('dataExport') }}
</div>
<div class="operator-text" @click="handleFileExport">
<a-icon type="mail"/>
{{ $t('exportWithFile') }}
</div>
<div class="operator-text" @click="handleCompare">
<a-icon type="share-alt"/>
{{ $t('share') }}
</div>
<div class="operator-text" @click="downTemplate">
<a-icon type="download"/>
{{ $t('templateDownload') }}
</div>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImport">
<a-button type="primary" icon="import">{{ $t('import') }}</a-button>
<div class="operator-text">
<a-icon type="import"/>
{{ $t('import') }}
</div>
</a-upload>
<a-button @click="handleAdd" type="primary" icon="plus">{{ $t('newlyAdded') }}</a-button>
<div class="operator-text" @click="handleAdd">
<a-icon type="plus"/>
{{ $t('newlyAdded') }}
</div>
</div>
<div>
<!--
@@ -22,7 +43,7 @@
editTable再传操作按钮的同时把事件定义名称也传过去
-->
<table-data
ref="tableDataRef"
ref="tableData"
:flag="'1'"
:operationList="operationList"
@editTable="editTable"
@@ -62,6 +83,7 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
import { downFile, downloadFile, getAction } from '@/api/manage'
import Modal from 'ant-design-vue'
import store from '@/store'
import eventBus from '@/common/event'
export default {
name: 'DocumentLibrary',
@@ -136,7 +158,7 @@ export default {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.idList = []
this.$emit('searchGetData')
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
@@ -181,7 +203,7 @@ export default {
getAction(this.url.deleteBatch, { ids: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.$emit('searchGetData')
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
@@ -204,7 +226,7 @@ export default {
getAction(url, { id: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.$emit('searchGetData')
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
@@ -226,7 +248,7 @@ export default {
getAction(url, { id: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.$emit('searchGetData')
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
@@ -369,7 +391,7 @@ export default {
)
})
} else {
this.$emit('searchGetData')
this.$refs.tableData.$emit('searchGetData')
this.$message.success(this.$t('operationSuccessful'))
}
this.spinning = false
+189
View File
@@ -0,0 +1,189 @@
<template>
<div class="splitting">
<a-card :bordered="false">
<div class="table-page-search-wrapper">
<search flag="3" :url="url"/>
</div>
<div class="table-operator">
<!-- v-has="'split:sarFileSplitInfo:splitFile'"-->
<div class="operator-text" @click="handleModule">
<a-icon type="plus"/>
{{ $t('docTool.split.splitText') }}
</div>
<!-- v-has="'split:sarFileSplitInfo:splitResult'"-->
<div class="operator-text" @click="handleExport">
<a-icon type="import" :rotate="-90"/>
{{ $t('docTool.split.importResults') }}
</div>
<!-- v-has="'split:sarFileSplitInfo:deleteBatch'"-->
<div class="operator-text" @click="handleDel">
<a-icon type="delete"/>
{{ $t('batchDelete') }}
</div>
</div>
<div class="splitting-table">
<table-data
:url="url"
:flag="'3'"
:operationList="operationList"
showAction
ref="tableData"
@onSelectChange="onSelectChange"
@backDocument="backDocument"
@deleteDetail="deleteDetail"
@detailClick="detailClick"
></table-data>
</div>
<split-text ref="splitText" @visible="splitTextVisible"></split-text>
<import-result ref="importResult" @visible="importResultVisible"></import-result>
</a-card>
</div>
</template>
<script>
import Search from '@/components/customField/Search'
import TableData from '@/components/customField/TableData'
// 拆分已入库文本弹框
import SplitText from './modules/SplitText'
// 导入拆分结果弹框
import ImportResult from './modules/ImportResult'
import { httpAction, getAction } from '../../api/manage'
export default {
name: 'DocumentSplit',
components: { Search, TableData, SplitText, ImportResult },
data () {
return {
selectedRowKeys: [],
operationList: [
// 回传至文档库
{
text: this.$t('docTool.split.backDocument'),
clickEvent: 'backDocument'
},
// 查看
{
text: this.$t('view'),
ClickEvent: 'detailClick'
},
// 删除
{
text: this.$t('delete'),
ClickEvent: 'deleteDetail'
}
],
url: {
tableHeader: 'split/sarFileSplitInfo/getHeader', // 表格头部字段
searchList: 'split/sarFileSplitInfo/queryCondition', // 搜索字段
tableList: 'split/sarFileSplitInfo/page', // 表格数据
deleteBatch: '', // 批量删除
deleteUrl: '',
backDocument: '' // 回传至文档库
}
}
},
methods: {
// 拆分已入库文本按钮点击
handleModule () {
this.$refs.splitText.open()
},
// 导入拆分结果
handleExport () {
this.$refs.importResult.open()
},
// 批量删除
handleDel () {
const params = {
ids: this.selectedRowKeys.join(',')
}
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: '',
onOk: () => {
httpAction(this.url.deleteBatch, params, 'post').then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.selectedRowKeys = []
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
// 表格操作列的删除
deleteDetail (val) {
this.$confirm({
content: this.$t('confirmDeletion'),
onOk:
async () => {
getAction(this.url.deleteUrl, { id: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
// 表格选中的回调
onSelectChange (selKeys) {
this.selectedRowKeys = selKeys
},
// 表格操作列-回传至文档库
backDocument (val) {
this.$confirm({
content: this.$t('backDocument'),
onOk: () => {
const params = {
id: val.id,
fileName: val.fileName,
connectId: val.connectId
}
getAction(this.url.backDocument, params).then(res => {
if (res.data.success) {
this.$message.success(this.$t('operationSuccessful'))
this.$refs.tableData.$emit('searchGetData')
} else {
this.$message.warning(res.data.message)
}
})
}
})
},
// 表格操作列的查看
detailClick (val) {
this.$router.push({
path: '/docManage/splitting/splitDetail',
query: {
infoId: val.id,
infoNumber: val.serialNumber,
createBy: val.createBy
}
})
},
splitTextVisible (val, num) {
if (num === 1) {
this.$refs.tableData.$emit('searchGetData')
}
},
importResultVisible (val, num) {
if (num === 1) {
this.$refs.tableData.$emit('searchGetData')
}
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
-13
View File
@@ -1,13 +0,0 @@
<template>
</template>
<script>
export default {
name: 'DocumentSplite'
}
</script>
<style scoped>
</style>
@@ -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>