130 lines
3.1 KiB
Vue
130 lines
3.1 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2020-12-29 16:37:56
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2022-10-20 13:53:22
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter" width="40%" class="dialog" @close="close">
|
|
<!-- <small-title slot="title">
|
|
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
|
</small-title> -->
|
|
|
|
<el-form
|
|
ref="dataForm"
|
|
:model="dataForm"
|
|
:rules="dataRule"
|
|
label-width="100px"
|
|
@keyup.enter.native="dataFormSubmit()"
|
|
>
|
|
<el-form-item label="物品名称" prop="name1">
|
|
<el-input
|
|
v-model="dataForm.name1"
|
|
placeholder="请输入物品名称"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="编码" prop="name2">
|
|
<el-input
|
|
v-model="dataForm.name2"
|
|
placeholder="请输入编码"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="类别" prop="name3">
|
|
<el-input
|
|
v-model="dataForm.name3"
|
|
placeholder="请输入类别"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="属性" prop="name4">
|
|
<el-input
|
|
v-model="dataForm.name4"
|
|
placeholder="请输入属性"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-row style="text-align: right">
|
|
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
|
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
|
|
</el-row>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
// import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
|
|
|
export default {
|
|
// components: { SmallTitle },
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
dataForm: {
|
|
id: '',
|
|
name1: '',
|
|
name2: '',
|
|
name3: '',
|
|
name4: ''
|
|
},
|
|
dataRule: {
|
|
name1: [
|
|
{
|
|
required: true,
|
|
message: '请输入物品名称',
|
|
trigger: 'blur'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
init(val) {
|
|
if (val) {
|
|
this.$nextTick(() => {
|
|
this.dataForm.name1 = val.name1
|
|
this.dataForm.name2 = val.name2
|
|
this.dataForm.name3 = val.name3
|
|
this.dataForm.name4 = val.name4
|
|
})
|
|
} else {
|
|
this.$nextTick(() => {
|
|
this.dataForm.name1 = ''
|
|
this.dataForm.name2 = ''
|
|
this.dataForm.name3 = ''
|
|
this.dataForm.name4 = ''
|
|
})
|
|
}
|
|
this.visible = true
|
|
},
|
|
// 表单提交
|
|
dataFormSubmit() {
|
|
this.$refs['dataForm'].validate(valid => {
|
|
if (valid) {
|
|
this.$message({
|
|
message: this.$t('module.basicData.visual.success'),
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.visible = false
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
close() {
|
|
this.visible = false
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.dialog >>> .el-dialog__body {
|
|
padding: 30px 24px;
|
|
}
|
|
</style>
|