对接文档翻译

This commit is contained in:
qq787203167
2022-07-26 11:24:16 +08:00
parent 663316d75e
commit 34af7e002f
7 changed files with 193 additions and 159 deletions
@@ -34,7 +34,7 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('standard')">{{$t('standard')}}</span>
</div>
<a-form-model-item class="itemModel" prop="standard">
<a-form-model-item class="itemModel" prop="serialNumber">
<a-input class="box-input"
readonly
v-model="formInline.serialNumber"
@@ -49,7 +49,7 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('TextStatus')">{{$t('TextStatus')}}</span>
</div>
<a-form-model-item class="itemModel" prop="translationResults">
<a-form-model-item class="itemModel" prop="textStatus">
<a-select :placeholder="$t('PleaseSelect')+$t('TextStatus')"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
@@ -57,9 +57,9 @@
v-model="formInline.textStatus">
<a-select-option v-for="(item, key) in translationResultsList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.name">
{{ item.name }}
:value="item.id">
<span style="display: inline-block;width: 100%" :title=" item.dbFieldTxt">
{{ item.dbFieldTxt }}
</span>
</a-select-option>
</a-select>
@@ -72,45 +72,29 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('translationLanguage')">{{$t('translationLanguage')}}</span>
</div>
<a-form-model-item class="itemModel" style="width: calc(50% - 20px)" prop="translationLanguage">
<a-select :placeholder="$t('PleaseSelect')+$t('translationLanguage')"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
v-model="formInline.sourceLanguage">
<a-select-option v-for="(item, key) in LanguageList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.name">
{{ item.name }}
</span>
</a-select-option>
</a-select>
<a-form-model-item class="itemModel" style="width: calc(50% - 20px)" prop="sourceLanguage">
<j-dict-select-tag class="box-input" v-model="formInline.sourceLanguage"
@input="handleInput('sourceLanguage')"
:placeholder="$t('PleaseSelect')+$t('translationLanguage')"
:type="'select'"
:triggerChange="false" dictCode="source_language"/>
</a-form-model-item>
<span class="text-icon">
<a-icon type="arrow-right" style="font-size: 20px"/>
</span>
<a-form-model-item class="itemModel" style="width: calc(50% - 20px)" prop="translationLanguageOne">
<a-select :placeholder="$t('PleaseSelect')+$t('translationLanguage')"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
v-model="formInline.targetLanguage">
<a-select-option v-for="(item, key) in LanguageList"
:key="key"
:value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.name">
{{ item.name }}
</span>
</a-select-option>
</a-select>
<a-form-model-item class="itemModel" style="width: calc(50% - 20px)" prop="targetLanguage">
<j-dict-select-tag class="box-input" v-model="formInline.targetLanguage"
@input="handleInput('targetLanguage')"
:placeholder="$t('PleaseSelect')+$t('translationLanguage')"
:type="'select'"
:triggerChange="false" dictCode="target_language"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"/>
<uploadFile ref="uploadFile" :restrictUploads="true" :isMultiple="true" @uploadSuccess="uploadSuccess"/>
<standardData ref="standardDataRef" @standardDataForm="standardDataForm"/>
</div>
</template>
@@ -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'])
}
})
}
}
}