Commit 5ce35a8b authored by honghy's avatar honghy

测试短信节点

parent ede403d1
...@@ -52,3 +52,12 @@ export function exportSmsNodeExcel(query) { ...@@ -52,3 +52,12 @@ export function exportSmsNodeExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
// 测试短信节点
export function testSms(data) {
return request({
url: '/system/sms-node/test',
method: 'post',
data: data
})
}
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="test(scope.row)">测试</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:sms-node:update']">修改</el-button> v-hasPermi="['system:sms-node:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
...@@ -216,11 +217,40 @@ ...@@ -216,11 +217,40 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 对话框(发送短信) -->
<el-dialog :title="$t('测试发送短信')" :visible.sync="sendSmsOpen" width="500px" append-to-body>
<el-form ref="sendSmsForm" :model="sendSmsForm" :rules="sendSmsRules" label-width="140px">
<el-form-item :label="$t('发送类型')" prop="messageType">
<el-select v-model="sendSmsForm.messageType" placeholder="请选择发送类型">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_SMS_TEMPLATE_MESSAGE_TYPE)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select>
</el-form-item>
<el-form-item :label="$t('区号')" prop="countryCode">
<el-input v-model="sendSmsForm.countryCode" :placeholder="$t('请输入区号')" />
</el-form-item>
<el-form-item :label="$t('手机号')" prop="mobile">
<el-input v-model="sendSmsForm.mobile" :placeholder="$t('请输入手机号')" />
</el-form-item>
<el-form-item label="模板序号" prop="nodeTemplateSn">
<el-input v-model="sendSmsForm.nodeTemplateSn" placeholder="请输入模板序号" />
</el-form-item>
<el-form-item label="参数(JSON)" prop="templateParams">
<el-input v-model="sendSmsForm.templateParams" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSendSmsForm">{{ $t('确 定') }}</el-button>
<el-button @click="cancelSendSms">{{ $t('取 消') }}</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createSmsNode, updateSmsNode, deleteSmsNode, getSmsNode, getSmsNodePage, exportSmsNodeExcel } from "@/api/system/sms/smsNode"; import { createSmsNode, updateSmsNode, deleteSmsNode, getSmsNode, getSmsNodePage, exportSmsNodeExcel, testSms } from "@/api/system/sms/smsNode";
import {getCountryListAll} from '@/api/ecw/country' import {getCountryListAll} from '@/api/ecw/country'
import {getSmsTemplateList} from '@/api/system/sms/smsTemplate' import {getSmsTemplateList} from '@/api/system/sms/smsTemplate'
...@@ -277,7 +307,16 @@ export default { ...@@ -277,7 +307,16 @@ export default {
isOrders: [{ required: true, message: "多订单不能为空", trigger: "change" }], isOrders: [{ required: true, message: "多订单不能为空", trigger: "change" }],
}, },
countryMap: new Map(), countryMap: new Map(),
smsTemplateMap: new Map() smsTemplateMap: new Map(),
sendSmsOpen: false,
sendSmsForm: {},
sendSmsRules: {
mobile: [{ required: true, message: this.$t("手机不能为空"), trigger: "blur" }],
countryCode: [{ required: true, message: "区号不能为空", trigger: "blur" }],
messageType: [{ required: true, message: "发送类型不能为空", trigger: "blur" }],
nodeTemplateSn: [{ required: true, message: "模板序号不能为空", trigger: "blur" }],
},
node: {}
}; };
}, },
async created() { async created() {
...@@ -419,6 +458,39 @@ export default { ...@@ -419,6 +458,39 @@ export default {
} else { } else {
this.form.countryCode = this.countryList.filter(a => a.id == val)[0].tel this.form.countryCode = this.countryList.filter(a => a.id == val)[0].tel
} }
},
test(row) {
this.sendSmsForm = {
mobile:'',
countryCode: '',
templateParams: '',
messageType: null,
nodeTemplateSn: 1
}
this.node = row
this.sendSmsOpen = true
},
/** 取消发送短信 */
cancelSendSms() {
this.sendSmsOpen = false;
},
/** 提交按钮 */
submitSendSmsForm() {
this.$refs["sendSmsForm"].validate(valid => {
if (!valid) {
return;
}
this.node['countryCode'] = this.sendSmsForm.countryCode
this.node['mobile'] = this.sendSmsForm.countryCode +''+this.sendSmsForm.mobile
this.node['templateParams'] = JSON.parse(this.sendSmsForm.templateParams)
this.node['messageType'] = this.sendSmsForm.messageType
this.node['nodeTemplateSn'] = this.sendSmsForm.nodeTemplateSn
// 添加的提交
testSms(this.node).then(response => {
this.$modal.msgSuccess("提交发送成功!");
this.sendSmsOpen = false;
});
});
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment