布局文档翻译

This commit is contained in:
qq787203167
2022-07-22 11:00:00 +08:00
parent 6a916e0037
commit dc41b5411a
6 changed files with 1144 additions and 16 deletions
@@ -0,0 +1,366 @@
<template>
<div>
<a-modal
:title="$t('UploadFile')"
:width="600"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text"
:title="$t('file')">{{$t('file')}}</span>
</div>
<a-form-model-item class="itemModel" prop="file">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload('file')">
{{ (formInline.file === 'null' || formInline.file === '' ||
formInline.file == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<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-input class="box-input"
readonly
v-model="formInline.standard"
@click.native="standardClick"
:placeholder="$t('PleaseSelect')+$t('standard')"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<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-select :placeholder="$t('PleaseSelect')+$t('TextStatus')"
class="box-input"
:getPopupContainer="triggerNode=> triggerNode.parentNode"
allowClear
v-model="formInline.translationResults">
<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 }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text" style="margin-left: 13px">
<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.translationLanguage">
<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>
<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.translationLanguageOne">
<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>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"/>
<standardData ref="standardDataRef" @standardDataForm="standardDataForm"/>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import uploadFile from '@/components/uploadFile/file'
import standardData from './standardData'
export default {
name: 'addModel',
components: {
uploadFile,
standardData
},
data() {
return {
visible: false,
uploadName: '',
confirmLoading: false,
formInline: {},
rules: {
file: [
{
required: true,
message: this.$t('file') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
standard: [
{
required: true,
message: this.$t('standard') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
translationResults: [
{
required: true,
message: this.$t('TextStatus') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
translationLanguage: [
{
required: true,
message: this.$t('translationLanguage') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
translationLanguageOne: [
{
required: true,
message: this.$t('translationLanguage') + this.$t('cannotEmpty'),
trigger: 'change'
}
]
},
ids: [],
translationResultsList: [],
LanguageList: []
}
},
mounted() {
},
methods: {
add() {
this.visible = true
this.formInline = {}
this.$nextTick(() => {
this.$refs.ruleForm.clearValidate()
})
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
this.$refs.ruleForm.validateField([value])
})
},
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) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.confirmLoading = false
this.$emit('batSettingList')
} else {
this.$message.warning(this.$t('operationFailed'))
this.confirmLoading = false
}
})
}
})
},
handleCancel() {
this.formInline = {}
this.visible = false
},
clickButtonToUpload(item) {
this.$refs.uploadFile.perentHandleFunc()
this.$refs.uploadFile.visible = true
this.uploadName = item
getAction('sys/common/getFileInfos', { id: this.formInline[item] }).then((res) => {
if (res.success) {
this.$refs.uploadFile.perentHandleFunc(res.result)
} else {
this.$refs.uploadFile.perentHandleFunc()
}
})
},
/** 上传文件的回调 */
uploadSuccess(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
standardClick() {
this.$refs.standardDataRef.addModel()
},
standardDataForm() {
}
}
}
</script>
<style>
.formAdd .ant-form-item-label {
width: 130px;
}
.formAdd .ant-form-item-control-wrapper {
display: inline-block;
width: 100%;
}
/*.formAdd .ant-form-item {*/
/* margin-bottom: 20px;*/
/*}*/
.itemModel .ant-form-item-control-wrapper {
width: 100%;
}
.box-input .ant-select-selection--single {
height: 38px;
}
.box-input .ant-select-selection--multiple {
height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
margin-top: 6px;
}
.box-input .ant-calendar-picker {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
height: 38px;
}
.box-input .ant-input-number-input-wrap {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
padding: 4px 30px 4px 11px;
}
</style>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.title-text {
width: 84px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 84px);
display: inline-block;
margin-top: 2px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.button-text {
height: 38px;
width: calc(100% - 100px);
line-height: 38px;
background: #fff;
border: 1px #00B3BE solid;
color: #00B3BE;
}
.text-icon {
display: inline-block;
width: 40px;
text-align: center;
margin-top: 11px;
}
.Required {
color: red;
}
</style>