add.vue
3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<template>
<div>
<el-dialog
title="添加国际化字段"
:visible.sync="isShow"
class="manage-dialog"
:before-close="closeDialog"
:close-on-click-modal="false"
>
<el-form :model="addForm" status-icon :rules="rules" ref="addForm">
<el-form-item label="模块" prop="key1">
<el-select
class="manage-sel"
v-model="addForm.key1"
filterable
:placeholder="$t('pholder.select')"
>
<el-option v-for="item in moduleList" :key="item" :label="item" :value="item"></el-option>
</el-select>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item label="Key值" prop="key2">
<el-input v-model="addForm.key2"></el-input>
<i class="error-tip">*</i>
</el-form-item>
<!-- <el-form-item label="Mall中文" prop="mall">
<el-input v-model="addForm.mall"></el-input>
<i class="error-tip">*</i>
</el-form-item> -->
<el-form-item label="中文" prop="zh">
<el-input v-model="addForm.zh"></el-input>
<i class="error-tip">*</i>
</el-form-item>
<el-form-item label="英文" prop="en">
<el-input v-model="addForm.en"></el-input>
</el-form-item>
<el-form-item label="繁体" prop="tw">
<el-input v-model="addForm.tw"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog" class="dialog-btn">{{$t('dialog.cancel')}}</el-button>
<el-button
type="primary"
:loading="loading"
@click="addSubmit('addForm')"
class="dialog-btn dialog-confirm-btn"
>{{ $t('dialog.confirm')}}</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
props: {
moduleList: {
type: Array,
default: () => []
}
},
data() {
return {
isShow: false,
loading:false,
addForm: {
key1: "",
key2: null,
mall:'',
zh: '',
en:'',
tw:''
},
rules: {
key1: [{ required: true, message: "请选择字段标识", trigger: "change"}],
key2: [{ required: true, message: "请输入字段Key", trigger: "change"}],
mall: [{ required: true, message: "请输入字段值", trigger: "change"}],
zh: [{ required: true, message: "请输入字段值", trigger: "change"}]
},
};
},
created() {
// this.getMallList();
},
methods: {
dialogInit() {
this.isShow = true;
},
hideLoading(){
this.loading = false;
},
addSubmit(formName){
this.$refs[formName].validate(valid => {
try {
if (valid) {
this.loading = true;
setTimeout(()=>{
this.$emit('submit',this.addForm)
},100)
} else {
return false;
}
} catch (error) {
}
});
},
closeDialog() {
this.$refs.addForm.resetFields();
this.hideLoading();
this.isShow = false;
}
}
};
</script>