Merge branch '标准拆分译文变更'

This commit is contained in:
danshihao
2024-08-15 10:46:50 +08:00
8 changed files with 177 additions and 63 deletions
+1
View File
@@ -500,6 +500,7 @@ module.exports = {
// 文档拆分
split: {
textSearch: 'Text Search',
translation: 'Translation',
splitText: 'Split Library File',
importResults: 'Import Split Results',
splitState: 'Split Status',
+1
View File
@@ -500,6 +500,7 @@ module.exports = {
// 文档拆分
split: {
textSearch: '文本搜索',
translation: '译文',
splitText: '拆分已入库文本',
importResults: '导入拆分结果',
splitState: '拆分状态',
@@ -6,7 +6,7 @@
class="split-upload-list"
name="file"
:file-list="myFileList"
:multiple="true"
:multiple="multiple"
:action='uploadAction'
:headers="headers"
:list-type="listType"
@@ -28,12 +28,28 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'SplitAddClauseUploadImage',
props: [
'disabled',
'accept',
'title',
'listType'
],
props: {
disabled: {
type: Boolean,
default: false
},
accept: {
type: String,
default: ''
},
title: {
type: String,
default: ''
},
listType: {
type: String,
default: ''
},
multiple: {
type: Boolean,
default: true
}
},
data () {
return {
uploadVisible: false,
@@ -55,6 +71,7 @@ export default {
methods: {
open () {
this.uploadVisible = true
this.resetFileList()
},
perentHandleFunc (data) {
this.myFileList = data
@@ -156,7 +156,15 @@
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('item_content', text,record)">
<div style="cursor: pointer;" class="table-text" v-if="text || text === 0" @click="showContent('item_content', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
</template>
<!--译文-->
<template slot="translation" slot-scope="{text, record}">
<div style="cursor: pointer;" class="table-text" v-if="text || text === 0" @click="showContent('translation', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
@@ -164,7 +172,7 @@
<!--条文解读-->
<template slot="interpretation_articles" slot-scope="{text, record}">
<div class="table-text" v-if="text || text === 0" @click="showContent('interpretation_articles', text,record)">
<div style="cursor: pointer;" class="table-text" v-if="text || text === 0" @click="showContent('interpretation_articles', text,record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
@@ -293,7 +301,7 @@ export default {
downTemplateUrl: '/laws/DocumentTool/documentSplit/downloadImportTemplate' // 模板下载
},
disabledMixinsCreate: true,
tableSlotField: ['item_content', 'interpretation_articles'],
tableSlotField: ['item_content', 'translation', 'interpretation_articles'],
uploadData: {},
isBackTitle: true,
expandedKeys: []
@@ -182,34 +182,60 @@
<!--条款内容部分-->
<div class="header-text">
{{ $t('docTool.split.clauseContent') }}
{{ $t('docTool.split.clauseContent') }} / {{ $t('docTool.split.translation') }}
<!--新增条款项-->
<a-button type="primary" icon="plus" ghost @click="handleAddClauseContent(-1)">{{ $t('newlyAdded') }}</a-button>
</div>
<template v-if="contentList && contentList.length > 0">
<div class="clause-item" v-for="(clause, index) in contentList" :key="clause.uuid || (index + 'clause')">
<div class="clause-item-content">
<div class="clause-item-operate">
<a-button @click="handleAddClauseContent(index)">{{ $t('newlyAdded') }}</a-button>
<a-button v-if="clause.type === TypeOfClauseItem.TABLE.value" @click="splitEdit(index,clause)">
{{ $t('edit') }}
</a-button>
<!--编辑译文表格-->
<a-button v-if="clause.type === TypeOfClauseItem.TABLE.value"
@click="splitEditTranslation(index,clause)">
{{ $t('edit') + $t('docTool.split.translation') }}
</a-button>
<!--没有图片时,新增译文图片-->
<a-button v-if="clause.type === TypeOfClauseItem.IMG.value && !clause.translation"
@click="splitEditTranslation(index,clause)">
{{ $t('newlyAdded') + $t('docTool.split.translation') + $t('docTool.split.picture') }}
</a-button>
<a-button @click="handleDeleteClauseContent(index, clause)">{{ $t('delete') }}</a-button>
</div>
<div class="clause-item-box">
<div class="clause-item-content">
<!--文本-->
<a-input type="textarea"
:maxLength="500"
v-model="clause.itemContent"
v-if="clause.type === TypeOfClauseItem.TEXT.value" />
<!--图片-->
<viewer>
<img v-if="clause.type === TypeOfClauseItem.IMG.value"
:src="clause[operateField.content.tempUrlField] ? clause[operateField.content.tempUrlField] : clause.itemContent"
alt="">
</viewer>
<!--表格-->
<div v-if="clause.type === TypeOfClauseItem.TABLE.value" v-html="clause.itemContent"></div>
</div>
<div class="clause-item-content" style="margin-left: 20px;">
<!--文本-->
<a-input type="textarea"
:maxLength="500"
v-model="clause.itemContent"
v-model="clause.translation"
v-if="clause.type === TypeOfClauseItem.TEXT.value" />
<!--图片-->
<viewer>
<img v-if="clause.type === TypeOfClauseItem.IMG.value"
:src="clause.thumbUrl?clause.thumbUrl:clause.itemContent"
:src="clause[operateField.translation.tempUrlField] ? clause[operateField.translation.tempUrlField] : clause.translation"
alt="">
</viewer>
<!--表格-->
<div v-if="clause.type === TypeOfClauseItem.TABLE.value" v-html="clause.itemContent"></div>
<div v-if="clause.type === TypeOfClauseItem.TABLE.value" v-html="clause.translation"></div>
</div>
<div class="clause-item-operate">
<a-button @click="handleAddClauseContent(index)">{{ $t('newlyAdded') }}</a-button>
<a-button v-if="clause.type === TypeOfClauseItem.TABLE.value" @click="splitEdit(index,clause)">{{
$t('edit')
}}
</a-button>
<a-button @click="handleDeleteClauseContent(index, clause)">{{ $t('delete') }}</a-button>
</div>
</div>
</template>
@@ -220,6 +246,16 @@
<a-button type="primary" class="footer-btn-save" @click="handleSave">{{ $t('preservation') }}</a-button>
</div>
<!-- 上传图片弹框 -->
<split-add-clause-upload-image
ref="uploadImg"
:disabled="disabled"
:title="$t('uploadPictures')"
listType="picture"
:multiple="false"
accept=".png,.jpeg,.jpg,.gif"
@uploadSuccess="uploadSuccess">
</split-add-clause-upload-image>
<!-- 类型选择弹框 -->
<split-detail-add-type-check ref="splitDetailAddTypeCheck" @ok="handleAddOk" />
<!-- 编辑表格弹框 -->
@@ -249,10 +285,12 @@ import STreeSelect from '../../../../components/STreeSelect'
import TreeSelection from '../../../../components/selection/TreeSelection'
import { randomUUID } from '@/utils/util'
import TreeDataSelection from '@comp/selection/TreeDataSelection'
import SplitAddClauseUploadImage from '@comp/splitUpload/SplitAddClauseUploadImage'
export default {
name: 'SplitAddForm',
components: {
SplitAddClauseUploadImage,
TreeDataSelection,
TreeSelection,
JMultipleDatePicker,
@@ -266,7 +304,7 @@ export default {
return {
FieldType,
TypeOfClauseItem,
hiddenFieldList: ['item_content'], // 隐藏的字段
hiddenFieldList: ['item_content', 'translation'], // 隐藏的字段
radioDictSelect: [], // 使用radio样式的数据字典单选
disabledFieldList: [], // 禁用的字段
// 需要英文状态下翻译下拉的字段
@@ -281,6 +319,13 @@ export default {
contentList: [], // 条款内容数据
visible: false,
addIndex: 0, // 新增条款的index
// 操作的字段
operateField: {
content: { field: 'itemContent', tempUrlField: 'itemContentThumbUrl' },
translation: { field: 'translation', tempUrlField: 'translationThumbUrl' }
},
// 当前操作的字段,保存上面对象,方便扩展(用于回调使用)
currentFieldObj: {},
disabled: false,
formInline: {},
isFormInline: false,
@@ -493,7 +538,11 @@ export default {
this.contentList = [...res.result]
this.contentList.forEach(item => {
const imgData = item.itemContent.split('fileName=')[1]
item.thumbUrl = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgData
const imgDataTranslation = item.itemContent.split('fileName=')[1]
if (item.type === TypeOfClauseItem.IMG.value) {
item[this.operateField.content.tempUrlField] = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgData
item[this.operateField.translation.tempUrlField] = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgDataTranslation
}
})
}
}).finally(() => {
@@ -505,6 +554,7 @@ export default {
* @param index
*/
handleAddClauseContent (index) {
this.currentFieldObj = this.operateField.content
if (index === -1) {
this.addIndex = this.contentList.length - 1
} else {
@@ -522,7 +572,8 @@ export default {
id: '',
uuid: randomUUID(),
type: TypeOfClauseItem.TEXT.value,
itemContent: ''
itemContent: '',
translation: ''
})
}
break
@@ -534,8 +585,8 @@ export default {
id: '',
uuid: randomUUID(),
type: TypeOfClauseItem.IMG.value,
itemContent: file.response.result.url,
thumbUrl: window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + file.response.result.fileName
[this.currentFieldObj.field]: file.response.result.url,
[this.currentFieldObj.tempUrlField]: window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + file.response.result.fileName
})
})
}
@@ -545,7 +596,7 @@ export default {
id: '',
uuid: randomUUID(),
type: 'TABLE',
itemContent: content[0]
[this.currentFieldObj.field]: content[0]
}
}
if (this.addIndex !== -1) {
@@ -554,12 +605,38 @@ export default {
this.contentList.push(...insertArr)
}
},
/**
* 译文编辑
* @param index
* @param item
*/
splitEditTranslation (index, item) {
this.currentFieldObj = this.operateField.translation
this.addIndex = index
// 图片
if (item.type === TypeOfClauseItem.IMG.value) {
this.$refs.uploadImg.open()
} else if (item.type === TypeOfClauseItem.TABLE.value) {
this.$refs.splitDetailAddTable.open(item.translation)
this.$refs.splitDetailAddTable.isTableEdit = true
}
},
// 译文上传图片
uploadSuccess (file, data, imgs) {
Object.assign(this.contentList[this.addIndex], {
type: TypeOfClauseItem.IMG.value,
[this.currentFieldObj.field]: file.response.result.url,
[this.currentFieldObj.tempUrlField]: window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + file.response.result.fileName
})
this.$forceUpdate()
},
/**
* 表格编辑
* @param index
* @param item
*/
splitEdit (index, item) {
this.currentFieldObj = this.operateField.content
this.addIndex = index
this.$refs.splitDetailAddTable.open(item.itemContent)
this.$refs.splitDetailAddTable.isTableEdit = true
@@ -569,10 +646,15 @@ export default {
* @param ueContent
*/
editTableOk (ueContent) {
this.contentList[this.addIndex] = {
id: '',
type: 'TABLE',
itemContent: ueContent[0]
// 如果内容和译文有一个有内容,就不进行覆盖
if (this.contentList[this.addIndex][this.operateField.content.field] || this.contentList[this.addIndex][this.operateField.translation.field]) {
this.contentList[this.addIndex][this.currentFieldObj.field] = ueContent[0]
} else {
this.contentList[this.addIndex] = {
id: '',
type: 'TABLE',
[this.currentFieldObj.field]: ueContent[0]
}
}
this.contentList = JSON.parse(JSON.stringify(this.contentList))
},
@@ -657,7 +739,8 @@ export default {
const contentList = JSON.parse(JSON.stringify(this.contentList))
contentList.forEach((item, index) => {
if (item.type === 'IMG') {
delete item.thumbUrl
delete item[this.operateField.content.tempUrlField]
delete item[this.operateField.translation.tempUrlField]
}
})
formData.itemValEOList = contentList
@@ -914,30 +997,33 @@ export default {
}
.clause-item {
display: flex;
justify-content: space-between;
margin: 0 0 20px 20px;
&-content {
width: 0;
flex: 1;
&-box {
display: flex;
justify-content: space-between;
/deep/ table {
width: 100%;
border: 1px solid;
td {
.clause-item-content {
width: 0;
flex: 1;
/deep/ table {
width: 100%;
border: 1px solid;
td {
border: 1px solid;
}
}
/deep/ img {
max-width: 100%;
max-height: 500px;
}
}
/deep/ img {
max-width: 100%;
max-height: 500px;
}
}
&-operate {
.ant-btn {
margin-bottom: 15px;
.ant-btn:not(:first-child) {
margin-left: 15px
}
}
@@ -132,7 +132,9 @@ export default {
// 表格确认按钮
handleOkTable () {
let ueContent = []
ueContent = this.ueContent.match(/<table.{0,}?.+?>{0,}?<\/table>/g) || []
if (this.ueContent) {
ueContent = this.ueContent.match(/<table.{0,}?.+?>{0,}?<\/table>/g) || []
}
if (ueContent && ueContent.length > 1) {
this.$message.warning(this.$t('oneTableAdded'))
} else if (!ueContent || ueContent.length < 1) {
@@ -36,9 +36,9 @@
:pagination="ipagination"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="handleTableChange">
<!--条文内容-->
<template slot="item_content" slot-scope="{text, record}">
<div class="table-text" style="cursor: pointer" v-if="text || text === 0" @click="showContent('item_content', text,record)">
<!--条文内容译文-->
<template slot="htmlContent" slot-scope="{text, record}">
<div class="table-text" style="cursor: pointer" v-if="text || text === 0" @click="showContent(text, record)">
{{ text && text !== 'null' ? text.replace(/<.*?>/ig, ' ') : '' }}
</div>
<div class="table-text" v-else>{{ global.emptyLine }}</div>
@@ -160,7 +160,7 @@ export default {
align: 'center',
width: 180,
dataIndex: 'itemContent',
scopedSlots: { customRender: 'item_content' }
scopedSlots: { customRender: 'htmlContent' }
}
],
// 操作列
@@ -193,7 +193,7 @@ export default {
align: 'center',
width: 180,
dataIndex: 'translation',
scopedSlots: { customRender: 'text' }
scopedSlots: { customRender: 'htmlContent' }
},
{ // 是否与上一版相同
title: this.$t('workCenter.standardInterpretationProcess.sameAsPreviousVersion'),
@@ -855,10 +855,9 @@ export default {
},
/**
* 显示条款内容、条文解读弹框
* @param fieldName
* @param val
*/
showContent (fieldName, val) {
showContent (val) {
this.$refs.splitClauseDetail.open(val)
},
/**
@@ -14,13 +14,13 @@
<a-spin :spinning="confirmLoading">
<a-form :form="form" :label-col="labelCol" :wrapper-col="wrapperCol">
<!--译文-->
<a-form-item :label="$t('workCenter.standardInterpretationProcess.translation')" :colon="false">
<a-textarea :placeholder="$t('pleaseEnter') + $t('workCenter.standardInterpretationProcess.translation')"
:maxLength="500"
:rows="4"
:disabled="disabled"
v-decorator="['translation']" />
</a-form-item>
<!--<a-form-item :label="$t('workCenter.standardInterpretationProcess.translation')" :colon="false">-->
<!-- <a-textarea :placeholder="$t('pleaseEnter') + $t('workCenter.standardInterpretationProcess.translation')"-->
<!-- :maxLength="500"-->
<!-- :rows="4"-->
<!-- :disabled="disabled"-->
<!-- v-decorator="['translation']" />-->
<!--</a-form-item>-->
<!--是否与上一版相同-->
<a-form-item :label="$t('workCenter.standardInterpretationProcess.sameAsPreviousVersion')" :colon="false">
<j-dict-select-tag dict-code="yn"