Blame view

ant-design-vue-jeecg/src/views/modules/message/modules/SysMessageTestModal.vue 3.05 KB
肖超群 authored
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
<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">

    <a-spin :spinning="confirmLoading">
      <a-form>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="模板标题">
          <a-input disabled v-model="templateName"/>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="模板内容">
          <a-textarea disabled v-model="templateContent" :autosize="{ minRows: 5, maxRows: 8 }"/>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="测试数据">
          <a-textarea placeholder="请输入json格式测试数据" v-model="testData" :autosize="{ minRows: 5, maxRows: 8 }"/>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="消息类型">
          <j-dict-select-tag
            v-model="msgType"
            placeholder="请选择消息类型"
            dictCode="msgType"/>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="消息接收方">
          <a-input placeholder="请输入消息接收方" v-model="receiver"/>
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
肖超群 authored
52
import {httpAction} from '@/api/manage'
肖超群 authored
53
肖超群 authored
54
55
56
57
58
59
60
61
62
63
export default {
  name: "SysMessageTestModal",
  data() {
    return {
      title: "操作",
      visible: false,
      model: {},
      labelCol: {
        xs: {span: 24},
        sm: {span: 5},
肖超群 authored
64
      },
肖超群 authored
65
66
67
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16},
肖超群 authored
68
      },
肖超群 authored
69
70
71
72

      confirmLoading: false,
      url: {
        send: "/sys/message/sysMessageTemplate/sendMsg",
肖超群 authored
73
      },
肖超群 authored
74
75
76
77
78
79
      templateName: "",
      templateContent: "",
      receiver: "",
      msgType: "",
      testData: "",
      sendParams: {}
肖超群 authored
80
    }
肖超群 authored
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
  },
  methods: {
    open(record) {
      this.sendParams.templateCode = record.templateCode;
      this.templateName = record.templateName;
      this.templateContent = record.templateContent;
      this.testData = record.templateTestJson;
      this.visible = true;
    },
    close() {
      this.receiver = "";
      this.msgType = "";
      this.sendParams = {};
      this.visible = false;
    },
    handleOk() {
      let httpurl = this.url.send;
      let method = 'post';
      this.sendParams.testData = this.testData;
      this.sendParams.receiver = this.receiver;
      this.sendParams.msgType = this.msgType;
      httpAction(httpurl, this.sendParams, method).then((res) => {
        if (res.success) {
          this.$message.success(res.message);
        } else {
          this.$message.warning(res.message);
        }
      }).finally(() => {
        this.confirmLoading = false;
        this.close();
      })
    },
    handleCancel() {
      this.close()
    },
肖超群 authored
116
  }
肖超群 authored
117
}
肖超群 authored
118
119
120
121
122
</script>

<style scoped>

</style>