<template>
|
<zt-dialog ref="dialog" @confirm="formSubmit" append-to-body>
|
<el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px">
|
<zt-form-item prop="name" :label="$t('mail.name')" rules="required">
|
<el-input v-model="dataForm.name" :placeholder="$t('mail.name')"></el-input>
|
</zt-form-item>
|
<zt-form-item prop="subject" :label="$t('mail.subject')" rules="required">
|
<el-input v-model="dataForm.subject" :placeholder="$t('mail.subject')"></el-input>
|
</zt-form-item>
|
<zt-form-item prop="content" :label="$t('mail.content')" rules="required">
|
<zt-editor v-model="dataForm.content"/>
|
</zt-form-item>
|
</el-form>
|
</zt-dialog>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
dataForm: {
|
id: '',
|
name: '',
|
subject: '',
|
content: ''
|
}
|
}
|
},
|
computed: {
|
},
|
methods: {
|
// 获取信息
|
async getInfo() {
|
let res = await this.$http.get(`/sys/mailtemplate/${this.dataForm.id}`)
|
this.dataForm = res.data
|
},
|
// 表单提交
|
async formSubmit() {
|
let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/mailtemplate', this.dataForm, {headers: {'content-type': 'application/x-www-form-urlencoded'}})
|
if (res.success) {
|
await this.$tip.success()
|
this.$refs.dialog.close()
|
this.$emit('refreshDataList')
|
}
|
}
|
}
|
}
|
</script>
|