13693261870
2025-07-02 009f9edb9391da3a3f2084f592ea118893b62f76
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
<template>
    <!-- <el-spin :spinning="loadSpinning"> -->
        <el-form
            ref="formRef"
            :model="formData"
            :rules="formRules"
            layout="vertical"
        >
            <el-form-item label="发送邮箱号:" name="SNOWY_EMAIL_LOCAL_FROM">
                <el-input v-model:value="formData.SNOWY_EMAIL_LOCAL_FROM" placeholder="请输入发送邮箱号" />
            </el-form-item>
            <el-form-item label="邮箱密钥:" name="SNOWY_EMAIL_LOCAL_PASSWORD">
                <el-input v-model:value="formData.SNOWY_EMAIL_LOCAL_PASSWORD" placeholder="请输入邮箱密钥" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" :loading="submitLoading" @click="saveConfig">保存</el-button>
                <el-button style="margin-left: 10px" @click="resetFields">重置</el-button>
            </el-form-item>
        </el-form>
    <!-- </el-spin> -->
</template>
<style>
    .el-tabs{
        height: 400px!important;
    }
</style>
<script>
import {edit,configList}  from "@/api/peizhi/index";
export default {
  name: "Role",
  data() {
    return {
        loadSpinning: "true",
        formData:{
            SNOWY_EMAIL_LOCAL_FROM:'本地邮件发送邮箱号',
            SNOWY_EMAIL_LOCAL_PASSWORD:'本地邮件密钥',
      },
      formRules: {
        SNOWY_EMAIL_LOCAL_FROM: [
            { required: true, message: '请输本地邮件发送邮箱号', trigger: 'blur' }
      ]
      },
      submitLoading:false
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询角色列表 */
    getList() {
        const param = {
        category: 'EMAIL_LOCAL'
    }
    configList(param).then((res) =>{
        if (res.code==200) {
            res.data.forEach((item) => {
                this.formData[item.configKey] = item.configValue
            })
        } else {
            message.warning('表单项不存在,请初始化数据库')
        }
      // listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
      //   (response) => {
      //     this.roleList = response.rows;
      //     this.total = response.total;
      //     this.loading = false;
        })
      // );
    },
    saveConfig() {
        this.submitLoading = true;
        this.$refs["formRef"].validate(valid => {
        if (valid) {
            console.log(this.formData)
            edit(this.formData).then(response => {
              this.$modal.msgSuccess("保存成功");
              this.submitLoading = false;
            //   this.open = false;
            //   this.getList();
            });
        }else{
            alert(1)
        }
      });
    },
    resetFields(){
        alert("重置");
    }
  },
};
</script>