Files
laws_weilai/jero-web/src/views/projectManagement/components/fixedPlateForm.vue
T
2022-05-10 18:35:36 +08:00

138 lines
3.3 KiB
Java

<template>
<a-modal
:title="$t('fixedPlate')"
:width="500"
: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('versionName')">{{$t('versionName')}}</span>
</div>
<a-form-model-item class="itemModel" :prop="'versionsName'">
<a-input class="box-input"
v-model="formInline.versionsName"
:placeholder="$t('PleaseEnter')+$t('versionName')"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
export default {
name: 'fixedPlateForm',
data() {
return {
visible: false,
formInline: {},
loading: false,
confirmLoading: false,
url: {
add: '/project/projectHistoryVersionsEO/add'
},
rules: {
versionsName: [
{
required: true,
message: this.$t('versionName') + this.$t('cannotEmpty'),
trigger: 'blur'
},
{
max: 200,
message: this.$t('versionName') + this.$t('cannotExceed') + 200 + this.$t('Characters'),
trigger: 'blur'
}
]
}
}
},
methods: {
getData() {
this.visible = true
this.formInline = {}
this.$nextTick(() => {
this.$refs.ruleForm.clearValidate()
})
},
handleOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let query = {
projectLibraryId: this.$route.query.id,
...this.formInline
}
this.confirmLoading = true
postAction(this.url.add, query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.confirmLoading = false
} else {
this.confirmLoading = false
this.$message.success(this.$t('operationFailed'))
}
})
}
})
},
handleCancel() {
this.visible = false
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 74px;
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: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 64px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
</style>