diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java index 506e32cc6..541a98f77 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/controller/DocTranslationEOController.java @@ -4,6 +4,8 @@ import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.alibaba.fastjson.JSONObject; import com.jero.common.api.vo.Result; import com.jero.modules.docTranslation.entity.DocTranslationEO; import com.jero.modules.docTranslation.service.IDocTranslationEOService; @@ -162,4 +164,27 @@ public class DocTranslationEOController extends JeroController updateRleaseConditionBatch(@RequestBody JSONObject json) { + return this.docTranslationEOService.updateRleaseConditionBatch(json); + } + + /** + * 批量更新文档翻译表状态 + * @return + */ + @AutoLog(value = "文档翻译表-查询文本状态下拉选项") + @ApiOperation(value="文档翻译表-查询文本状态下拉选项", notes="文档翻译表-查询文本状态下拉选项") + @GetMapping(value = "/queryTextStatusVal") + public Result queryTextStatusVal() { + return this.docTranslationEOService.queryTextStatusVal(); + } + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java index 442d9d205..dd63d984e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/entity/DocTranslationEO.java @@ -2,6 +2,7 @@ package com.jero.modules.docTranslation.entity; import java.io.Serializable; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -73,10 +74,12 @@ public class DocTranslationEO implements Serializable { private String title; /**文本状态*/ - @Dict(dicCode = "state") + //@Dict(dicCode = "state") @Excel(name = "文本状态", width = 15) @ApiModelProperty(value = "文本状态") private java.lang.String textStatus; + @TableField(exist = false) + private String textStatus_dictText; /**文件名称*/ @Excel(name = "文件名称", width = 15) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java index 1ff232e8c..1e24dd388 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/IDocTranslationEOService.java @@ -1,6 +1,8 @@ package com.jero.modules.docTranslation.service; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.jero.common.api.vo.Result; import com.jero.modules.docTranslation.entity.DocTranslationEO; import com.baomidou.mybatisplus.extension.service.IService; @@ -72,4 +74,17 @@ public interface IDocTranslationEOService extends IService { * @return */ IPage queryPageList(DocTranslationEO docTranslationEO, Integer pageNo, Integer pageSize, String cut, HttpServletRequest req); + + /** + * 批量更新发布情况 + * @param json + * @return + */ + Result updateRleaseConditionBatch(JSONObject json); + + /** + * 查询文本状态下拉选项(文档库中,文件类型字段) + * @return + */ + Result queryTextStatusVal(); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java index fa9549e06..704dd7c20 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/docTranslation/service/impl/DocTranslationEOServiceImpl.java @@ -1,22 +1,33 @@ package com.jero.modules.docTranslation.service.impl; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.jero.common.api.vo.Result; +import com.jero.common.constant.enums.CutEnum; +import com.jero.common.constant.enums.ModuleEnum; import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.vo.LoginUser; +import com.jero.generater.modules.online.cgform.entity.OnlCgformField; +import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; import com.jero.modules.docTranslation.entity.DocTranslationEO; import com.jero.modules.docTranslation.enums.ReleaseConditionEnum; import com.jero.modules.docTranslation.enums.TranslationResultEnum; import com.jero.modules.docTranslation.mapper.DocTranslationEOMapper; import com.jero.modules.docTranslation.service.IDocTranslationEOService; import com.jero.modules.docTranslation.utils.TranslationDocumentUtils; +import com.jero.modules.document.enums.FieldTypeEnum; import com.jero.modules.oss.entity.OSSFile; +import me.zhyd.oauth.utils.StringUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.shiro.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Propagation; @@ -34,6 +45,8 @@ import javax.servlet.http.HttpServletRequest; @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public class DocTranslationEOServiceImpl extends ServiceImpl implements IDocTranslationEOService { + @Autowired + private OnlCgformFieldServiceImpl onlCgformFieldService; /** * 保存 * @@ -130,6 +143,62 @@ public class DocTranslationEOServiceImpl extends ServiceImpl result = this.page(page, queryWrapper); + disposeData(result.getRecords(),cut); return result; } + + /** + * 处理数据 + * @param datas + * @param cut + */ + public void disposeData(List datas,String cut){ + if(CollectionUtils.isNotEmpty(datas)){ + for (DocTranslationEO data : datas) { + String textStatus_dictText = ""; + OnlCgformField fileTypeField = this.onlCgformFieldService.queryById(data.getTextStatus()); + if (ObjectUtil.isNotEmpty(fileTypeField)) { + if (CutEnum.CN.getValue().equals(cut)) { + textStatus_dictText = fileTypeField.getDbFieldTxt(); + } else { + textStatus_dictText = fileTypeField.getDbFieldEnName(); + } + } + data.setTextStatus_dictText(textStatus_dictText); + } + } + } + + @Override + public Result updateRleaseConditionBatch(JSONObject json) { + String ids = json.getString("ids"); + // 值对应枚举类 ReleaseConditionEnum 发布published 或撤回draft + String releaseCondition = json.getString("releaseCondition"); + if (StringUtils.isNotEmpty(ids)) { + List docTranslationEOList = new ArrayList<>(); + + List idList = Arrays.asList(ids.split(",")); + idList.forEach(id -> { + DocTranslationEO docTranslationEO = new DocTranslationEO(); + docTranslationEO.setId(id); + docTranslationEO.setReleaseCondition(releaseCondition); + docTranslationEOList.add(docTranslationEO); + }); + this.updateBatchById(docTranslationEOList); + } + return new Result<>().success("操作成功!"); + } + + @Override + public Result queryTextStatusVal() { + List fieldList = this.onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); + List result = fieldList.stream().filter(field -> { + boolean flag = false; + if(org.apache.commons.lang3.StringUtils.equals(field.getFieldShowType(), FieldTypeEnum.FILE.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + return Result.OK(result); + } } diff --git a/jero-web/src/common/lang/en-us.js b/jero-web/src/common/lang/en-us.js index e6b40b606..937d655fd 100644 --- a/jero-web/src/common/lang/en-us.js +++ b/jero-web/src/common/lang/en-us.js @@ -1186,6 +1186,7 @@ module.exports = { translatedText:'Translated Text', Administrativeprivileges:'Administrativ Pprivileges', Checkthepermissions:'Check The Permissions', + onlyFilesUploaded:'Only.Docx,.Doc files can be uploaded', selectDirectorylocation: 'Please select the directory location to add the folder', Fileuploaded:'File uploaded, please wait', uploadedbyyourself:'You can only delete files and data uploaded by yourself', diff --git a/jero-web/src/common/lang/zh-cn.js b/jero-web/src/common/lang/zh-cn.js index 3969259df..d03b7b2da 100644 --- a/jero-web/src/common/lang/zh-cn.js +++ b/jero-web/src/common/lang/zh-cn.js @@ -917,7 +917,6 @@ module.exports = { startMonth: '开始日期', endMonth: '结束日期', Importing: '导入中...', - Fileuploaded:'文件上传中,请稍后', projectDeliveryDescription: '工程交付说明', cancelConfirm: '取消确认', currentInformation: '当前信息', @@ -1192,5 +1191,6 @@ module.exports = { translatedText:'译文', Administrativeprivileges:'管理权限', Checkthepermissions:'查看权限', + onlyFilesUploaded:'只能上传.docx、.doc文件', uploadedbyyourself:'只能删除自己上传的文件数据', } \ No newline at end of file diff --git a/jero-web/src/components/uploadFile/file.vue b/jero-web/src/components/uploadFile/file.vue index fab54f96b..b27182372 100644 --- a/jero-web/src/components/uploadFile/file.vue +++ b/jero-web/src/components/uploadFile/file.vue @@ -2,7 +2,7 @@
1) { - this.$message.warning('只能上传一个文件') + this.$message.warning(this.$t('onlyOnefileUploaded')) + return false + } + } + if (this.restrictUploads) { + let fileName = file.name + let index1 = fileName.lastIndexOf('.') + let index2 = fileName.length + let fileSuffix = fileName.substring(index1, index2) + if (fileSuffix == '.docx' || fileSuffix == '.doc') { + + } else { + this.$message.warning(this.$t('onlyFilesUploaded')) return false } } diff --git a/jero-web/src/views/documentTools/documentTranslation/components/RetrieveFilesList.vue b/jero-web/src/views/documentTools/documentTranslation/components/RetrieveFilesList.vue index fe311363b..985d82608 100644 --- a/jero-web/src/views/documentTools/documentTranslation/components/RetrieveFilesList.vue +++ b/jero-web/src/views/documentTools/documentTranslation/components/RetrieveFilesList.vue @@ -42,10 +42,10 @@ @@ -69,37 +69,21 @@ {{$t('translationLanguage')}}
- - - - {{ item.name }} - - - + - - - - {{ item.name }} - - - + @@ -166,19 +150,19 @@ }, { title: this.$t('TextStatus'), - dataIndex: 'TextStatus', + dataIndex: 'state', align: 'center', ellipsis: true }, { title: this.$t('fileName'), - dataIndex: 'fileName', + dataIndex: 'file_name', align: 'center', ellipsis: true }, { title: this.$t('textInformation'), - dataIndex: 'textInformation', + dataIndex: 'text_info', align: 'center', ellipsis: true } @@ -189,19 +173,24 @@ pageNo: 1, pageSize: 10, total: 0, - fieldList: [], - queryConditionVOList: [] + selectedRowKeysRecord: [] } }, mounted() { }, methods: { + handleInput(value) { + this.$nextTick(() => { + this.formInline = { ...this.formInline } + this.$refs.ruleForm.validateField([value]) + }) + }, addModel() { this.visible = true this.queryParam = {} this.selectedRowKeys = [] - // this.replacePage() + this.replacePage() }, searchQuery() { this.pageNo = 1 @@ -222,13 +211,16 @@ this.replacePage() }, replacePage() { + let pageNo = JSON.parse(JSON.stringify(this.pageNo)) + let pageSize = JSON.parse(JSON.stringify(this.pageSize)) let query = { - pageNo: this.pageNo, - pageSize: this.pageSize, + pageNo: pageNo + '', + pageSize: pageSize + '', + type: 'pdf', ...this.queryParam } this.loading = true - postAction('', query).then((res) => { + postAction('document/bussDocumentLibraryEO/ocrPageInfo', query).then((res) => { if (res.success) { this.dataList = res.result.records || [] this.total = res.result.total @@ -240,8 +232,15 @@ } }) }, - onSelectChange(value) { + onSelectChange(value, record) { this.selectedRowKeys = value + if (this.selectedRowKeys.length > 1) { + this.selectedRowKeys.shift() + } + this.selectedRowKeysRecord = record.filter(res => { + return res.id == this.selectedRowKeys[0] + }) + this.selectedRowKeysRecord = [...this.selectedRowKeysRecord] }, handleCancel() { this.visible = false diff --git a/jero-web/src/views/documentTools/documentTranslation/components/addModel.vue b/jero-web/src/views/documentTools/documentTranslation/components/addModel.vue index a96e3a73b..c13dbc0ca 100644 --- a/jero-web/src/views/documentTools/documentTranslation/components/addModel.vue +++ b/jero-web/src/views/documentTools/documentTranslation/components/addModel.vue @@ -34,7 +34,7 @@ * {{$t('standard')}} - + * {{$t('TextStatus')}} - + - - {{ item.name }} + :value="item.id"> + + {{ item.dbFieldTxt }} @@ -72,45 +72,29 @@ * {{$t('translationLanguage')}} - - - - - {{ item.name }} - - - + + - - - - - {{ item.name }} - - - + + - + @@ -140,28 +124,28 @@ trigger: 'change' } ], - standard: [ + serialNumber: [ { required: true, message: this.$t('standard') + this.$t('cannotEmpty'), trigger: 'change' } ], - translationResults: [ + textStatus: [ { required: true, message: this.$t('TextStatus') + this.$t('cannotEmpty'), trigger: 'change' } ], - translationLanguage: [ + sourceLanguage: [ { required: true, message: this.$t('translationLanguage') + this.$t('cannotEmpty'), trigger: 'change' } ], - translationLanguageOne: [ + targetLanguage: [ { required: true, message: this.$t('translationLanguage') + this.$t('cannotEmpty'), @@ -175,8 +159,18 @@ } }, mounted() { + this.getTextStatus() }, methods: { + getTextStatus() { + getAction('/docTranslation/docTranslationEO/queryTextStatusVal', {}).then((res) => { + if (res.success) { + this.translationResultsList = res.result || [] + } else { + this.translationResultsList = [] + } + }) + }, add() { this.visible = true this.formInline = {} @@ -193,18 +187,16 @@ handleOk() { this.$refs.ruleForm.validate(valid => { if (valid) { - let ids = JSON.parse(JSON.stringify(this.ids)) let query = { - ids: ids.join(','), ...this.formInline } this.confirmLoading = true - postAction(this.url.setBatch, query).then((res) => { + postAction('/docTranslation/docTranslationEO/add', query).then((res) => { if (res.success) { this.$message.success(this.$t('OperationSuccessful')) this.visible = false this.confirmLoading = false - this.$emit('batSettingList') + this.$emit('addModelForm') } else { this.$message.warning(this.$t('operationFailed')) this.confirmLoading = false @@ -232,20 +224,36 @@ /** 上传文件的回调 */ uploadSuccess(data) { let attIdList = [] + let fileName = [] if (data && data.length > 0) { data.map(item => { attIdList.push(item.id || data.name) + fileName.push(item.fileName) }) } /** 赋值给当前对应的表单文件 */ this.formInline[this.uploadName] = attIdList.join(',') + this.formInline.fileName = fileName.join(',') this.formInline = { ...this.formInline } + this.$nextTick(() => { + if (this.formInline[this.uploadName]) { + this.$refs.ruleForm.validateField([this.uploadName]) + } + }) }, standardClick() { this.$refs.standardDataRef.addModel() }, - standardDataForm() { - + standardDataForm(row) { + this.formInline.serialNumber = row.serial_number + this.formInline.title = row.title + this.formInline.bussDocumentLibraryId = row.id + this.formInline = { ...this.formInline } + this.$nextTick(() => { + if (this.formInline.serialNumber) { + this.$refs.ruleForm.validateField(['serialNumber']) + } + }) } } } diff --git a/jero-web/src/views/documentTools/documentTranslation/components/standardData.vue b/jero-web/src/views/documentTools/documentTranslation/components/standardData.vue index 9ba6c282c..4ea4ffa48 100644 --- a/jero-web/src/views/documentTools/documentTranslation/components/standardData.vue +++ b/jero-web/src/views/documentTools/documentTranslation/components/standardData.vue @@ -157,7 +157,7 @@ total: 0, fieldList: [], queryConditionVOList: [], - selectedRowKeysRecord:[], + selectedRowKeysRecord: [] } }, mounted() { @@ -214,12 +214,12 @@ } }) }, - onSelectChange(value) { + onSelectChange(value,record) { this.selectedRowKeys = value if (this.selectedRowKeys.length > 1) { this.selectedRowKeys.shift() } - this.selectedRowKeysRecord = record.filter(res=>{ + this.selectedRowKeysRecord = record.filter(res => { return res.id == this.selectedRowKeys[0] }) this.selectedRowKeysRecord = [...this.selectedRowKeysRecord] @@ -229,8 +229,7 @@ }, handleSubmit() { if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { - this.confirmLoading = true - let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys)) + this.$emit('standardDataForm', this.selectedRowKeysRecord[0]) this.visible = false } else { this.$message.warning(this.$t('selectLeastOne')) diff --git a/jero-web/src/views/documentTools/documentTranslation/index.vue b/jero-web/src/views/documentTools/documentTranslation/index.vue index 0f01630f4..2c3b82588 100644 --- a/jero-web/src/views/documentTools/documentTranslation/index.vue +++ b/jero-web/src/views/documentTools/documentTranslation/index.vue @@ -26,19 +26,10 @@
{{$t('translationResults')}}
- - - - {{ item.name }} - - - + @@ -106,12 +88,17 @@ {{$t('view')}} - - {{!record.state || record.state == 0 ? $t('release') :$t('withdraw')}} + + {{!record.releaseCondition || record.releaseCondition == 'draft' ? $t('release') :$t('withdraw')}} - {{$t('download')}} - {{$t('delete')}} + {{$t('download')}} + {{$t('delete')}}
@@ -133,9 +120,11 @@