jinlin
2023-11-03 35435e8b1995e6775c82b86652381e07e3faff54
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
<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>