From 2e2ca9a1c95285a2b836cc18dd85fed1f98c963a Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期日, 12 五月 2024 23:35:06 +0800
Subject: [PATCH] 1
---
src/views/notification/notifyRecord.vue | 152 ++++++++++++++++++++++++++++++
src/views/notification/sendDebug.vue | 139 +++++++++++++++++----------
2 files changed, 239 insertions(+), 52 deletions(-)
diff --git a/src/views/notification/notifyRecord.vue b/src/views/notification/notifyRecord.vue
new file mode 100644
index 0000000..2ba7f72
--- /dev/null
+++ b/src/views/notification/notifyRecord.vue
@@ -0,0 +1,152 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-05-08 18:22:48
+ * @FilePath: /smart-web/src/views/master/person/main/index.vue
+ * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
+<template>
+ <div class="user-main">
+ <div class="user-top">
+ <el-form :inline="true" :model="searchData" label-width="80px" style="width: 50%;">
+ <el-row>
+ <el-col :span="8">
+ <el-form-item label="閫氱煡鐘舵��">
+ <el-select v-model="searchData.status" multiple style="width: 100%" @change="statusChange">
+ <el-option v-for="item in statusList" multiple :key="item.id" :label="item.name" :value="item.id"/>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="鏃堕棿鑼冨洿">
+ <el-date-picker v-model="searchData.selectDate" type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" align="right" value-format="YYYY-MM-DD HH:mm:ss" @change="dateChange" style="vertical-align: middle;width: 100%;"></el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item label="">
+ <el-input v-model="searchData.keyWord" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" clearable style="width: 100%" @change="searchChange"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ <div class="user-table">
+ <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef">
+ <el-table-column prop="notifierId" label="閫氱煡绫诲瀷"></el-table-column>
+ <el-table-column prop="notifierId" label="ID"></el-table-column>
+ <el-table-column prop="businessName" label="鎵�灞炰笟鍔�"></el-table-column>
+ <el-table-column prop="state" label="鐘舵��"></el-table-column>
+ <el-table-column prop="notifyTime" label="鏃堕棿"></el-table-column>
+ <el-table-column prop="templateId" label="閫氱煡妯$増"></el-table-column>
+ </el-table>
+ <el-pagination
+ style="margin-top: 12px;"
+ @size-change="handleSizeChange"
+ @current-change="handleCurrentChange"
+ :current-page="currentPage4"
+ :page-sizes="[15, 50, 100]"
+ :page-size="15"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="total">
+ </el-pagination>
+ </div>
+ </div>
+</template>
+<script>
+ export default {
+ name: "notifyRecord",
+ data(){
+ return {
+ statusList: [{id:"success",name:"鎴愬姛"},{id:"error",name:"澶辫触"}],
+ searchData: {
+ status: [],
+ selectDate: [],
+ keyword: "",
+ state: "",
+ beginTime: "",
+ endTime: "",
+ current: "1",
+ size: "15"
+ },
+ total: 0,
+ dialog: {
+ save: false
+ },
+ tableData: []
+ }
+ },
+ created(){
+
+ },
+ mounted(){
+ this.getData();
+ },
+ components: {
+
+ },
+ methods: {
+ statusChange(status) {
+ this.searchData.state = status.join(",");
+ this.getData();
+ },
+ searchChange() {
+ this.getData();
+ },
+ dateChange(val) {
+ this.searchData.beginTime = val[0];
+ this.searchData.endTime = val[1];
+ this.getData();
+ },
+ getData() {
+ var obj = {};
+ for(var key in this.searchData) {
+ if(this.searchData[key] != "" && key != "selectDate" && key != "status") {
+ obj[key] = this.searchData[key];
+ }
+ }
+ this.$HTTP.get("/api/blade-notify/notify/history/list?" + this.$TOOL.qsStringify(obj)).then(res=> {
+ if(res.code == 200) {
+ this.tableData = res.data.records;
+ }
+ })
+ },
+ handleSizeChange(val) {
+ console.log(`姣忛〉 ${val} 鏉);
+ this.searchData.current = "1";
+ this.searchData.size = val;
+ this.getData();
+ },
+ handleCurrentChange(val) {
+ console.log(`褰撳墠椤�: ${val}`);
+ this.searchData.current = val;
+ this.getData();
+ }
+ }
+ }
+</script>
+
+<style scoped>
+ .user-main {
+ background-color: #f9fafb;
+ border: 1px solid #dcdfe6;
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
+ margin: 8px;
+ padding: 8px;
+ background-color: #fff;
+ }
+ .user-top {
+ width: 100%;
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 8px;
+ }
+ .user-table {
+ width: 100%;
+ margin-bottom: 8px;
+
+ }
+ .multipleTableRef {
+ margin-bottom: 8px;
+ }
+</style>
diff --git a/src/views/notification/sendDebug.vue b/src/views/notification/sendDebug.vue
index d325e8d..ffedd71 100644
--- a/src/views/notification/sendDebug.vue
+++ b/src/views/notification/sendDebug.vue
@@ -4,28 +4,32 @@
<el-row>
<el-col :span="24">
<el-form-item label="閫氱煡鏂瑰紡">
- <el-select style="width: 100%" v-model="sendForm.provider">
- <el-option v-for="item in providerList" :key="item.id" :label="item.name" :value="item.id"/>
+ <el-select style="width: 100%" v-model="sendForm.provider" @change="changeProvider">
+ <el-option v-for="item in providerList" :key="item.configEntity.provider" :label="item.name" :value="item.configEntity.provider"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="鏈嶅姟鍟�">
- <el-select style="width: 100%" v-model="sendForm.type">
- <el-option v-for="item in providerInfos" :key="item.id" :label="item.name" :value="item.id"/>
+ <el-select style="width: 100%" v-model="sendForm.type" disabled>
+ <el-option v-for="item in providerInfos" :key="item.type" :label="item.name" :value="item.type"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
- <el-form-item label="鎺ユ敹浜�">
- <el-input v-model="sendForm.pname" placeholder="鎺ユ敹浜�" clearable></el-input>
+ <el-form-item label="鎺ユ敹浜�" prop="notifiedParty">
+ <el-input v-model="sendForm.notifiedParty" placeholder="鎺ユ敹浜�" clearable></el-input>
</el-form-item>
</el-col>
- <!-- <el-col :span="24" v-for="(item,index) in sendForm.configuration">
- <el-form-item :label="item.pname" v-if="item.name != 'properties'">
+ <el-col :span="24" v-for="(item,index) in sendContentForm.properties">
+ <el-form-item :label="item.name" v-if="item.property != 'content' && item.property != 'attachments'">
<el-input v-model="item.value" :placeholder="item.name" clearable></el-input>
</el-form-item>
- <el-form-item :label="item.pname" v-if="item.name == 'properties'">
+ <!-- 鍐呭-瀵屾枃鏈� -->
+ <el-form-item :label="item.name" v-if="item.property == 'content'">
+ <avue-ueditor v-model="item.value" v-bind="options"></avue-ueditor>
+ </el-form-item>
+ <!-- <el-form-item :label="item.name" v-if="item.property == 'content'">
<div class="array-content">
<el-row v-for="(item1,index1) in item.value">
<el-col v-for="(item2,index2) in item1" :span="7">
@@ -38,8 +42,8 @@
</el-col>
</el-row>
</div>
- </el-form-item>
- </el-col> -->
+ </el-form-item> -->
+ </el-col>
</el-row>
</el-form>
<template #footer>
@@ -54,6 +58,20 @@
emits: ['success', 'closed'],
data() {
return {
+ options: {
+ //鏅�氫笂浼犲湴鍧�
+ action: "/api/blade-resource/oss/endpoint/put-file",
+ customConfig: {},//wangEditor缂栬緫鐨勯厤缃�
+ headers:{Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0"},
+ data:{},
+ propsHttp: {
+ home:'',
+ url:'url',
+ res: 'data'
+ },
+ },
+ tableData: {},
+ sendContentForm: {},
providerInfos: [],
providerList: [],
serviceproviders: "",
@@ -67,17 +85,29 @@
isSaveing: false,
//琛ㄥ崟鏁版嵁
sendForm: {
- provider: ""
+ provider: "",
+ notifiedParty: "",
+ template: "",
+ type: ""
},
//楠岃瘉瑙勫垯
sendRules: {
- pname:[{required: true, message: '璇疯緭鍏ユ帴鏀朵汉'}]
+ notifiedParty:[{required: true, message: '璇疯緭鍏ユ帴鏀朵汉'}]
},
}
},
mounted() {
},
methods: {
+ changeProvider(val) {
+ var id = "";
+ this.providerList.forEach(item=> {
+ if(item.configEntity.provider == val) {
+ id = item.id;
+ }
+ })
+ this.getServiceProviders(id);
+ },
addpro(index,index1) {
this.sendForm.configuration[index].value.push([
{name: 'name', value: ''},
@@ -90,29 +120,47 @@
},
//鏄剧ず
open(tableData,mode='add'){
- this.providerInfos = tableData[0].providerInfos; //鏈嶅姟鍟�
- this.getMetadata(); //鍐呭
+ this.tableData = tableData;
var providerList = [];
tableData.forEach(item=> {
if(item.isBindBusiness) {
providerList.push(item);
}
})
- this.providerList = providerList;
- this.$nextTick(()=> {
- this.sendForm.provider = this.providerList[0].id;
- this.sendForm.type = this.providerInfos[0].id;
-
- console.log(this.providerList,this.sendForm.provider)
- })
+ this.providerList = providerList; //閫氱煡鏂瑰紡list
+ this.getServiceProviders(this.providerList[0].id); //鑾峰彇渚涘簲鍟�
this.mode = mode;
this.visible = true;
return this
},
- getMetadata() {
- this.$HTTP.get(`/api/blade-notify/notifier/template/dingTalk/dingTalkMessage/config/metadata`).then(res=> {
+ getServiceProviders(id) {
+ console.log(id,this.tableData)
+ this.tableData.forEach(item=> {
+ if(item.id == id) {
+ this.providerInfos = item.providerInfos; //鏈嶅姟鍟�
+ this.sendForm.provider = item.configEntity.provider;
+ this.sendForm.type = item.id;
+ }
+ })
+ this.$nextTick(()=> {
+ this.getMetadata(this.sendForm.provider); //鍐呭
+ })
+ },
+ getMetadata(val) {
+ var url = "";
+ if(val == "dingTalkMessage") {
+ url = `/api/blade-notify/notifier/template/dingTalk/dingTalkMessage/config/metadata`;
+ }else if(val == "qyTextMessage") {
+ url = `/api/blade-notify/notifier/template/weiXinQY/qyTextMessage/config/metadata`;
+ }else if(val == "systemDefault") {
+ url = `/api/blade-notify/notifier/template/internalMessage/systemDefault/config/metadata`;
+ }else if(val == "embedded") {
+ url = `/api/blade-notify/notifier/template/email/embedded/config/metadata`;
+ }
+ this.$HTTP.get(url).then(res=> {
if(res.code == 200) {
-
+ this.sendContentForm = res.data;
+ console.log(this.sendContentForm,8)
}else {
this.$message.error(res.msg);
}
@@ -120,44 +168,31 @@
},
//琛ㄥ崟鎻愪氦鏂规硶
sendSubmit(){
- var configuration = {};
- this.sendForm.configuration.forEach(item=> {
- configuration[item.name] = item.value;
+ var template = {};
+ this.sendContentForm.properties.forEach(item=> {
+ template[item['property']] = item.value;
})
var obj = {
- configuration: configuration,
+ notifiedParty: this.sendForm.notifiedParty,
+ provider: this.sendForm.provider,
+ template: JSON.stringify(template),
+ type: this.sendForm.type
}
- if(this.mode == 'edit') {
- obj.id = this.sendForm.configEntity.id;
- obj.name = this.sendForm.configEntity.name;
- obj.provider = this.sendForm.configEntity.provider;
- obj.type = this.sendForm.configEntity.type;
- if(this.sendForm.configEntity.type == "email") { //閭欢
- var newArr = [];
- configuration.properties.forEach(item=> {
- var formattedObject = {};
- item.forEach(item => {
- formattedObject[item.name] = item.value;
- });
- newArr.push(formattedObject);
- })
- configuration.properties = newArr;
+ var id = "";
+ this.providerList.forEach(item=> {
+ if(item.id == this.sendForm.type){
+ id = item.configEntity.id;
}
- }
- if(this.mode == 'add') { //鏂板
- obj.name = this.sendForm.pname;
- obj.provider = this.serviceproviders;
- obj.type = this.sendForm.id;
- }
+ })
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
- this.$HTTP.put("/api/blade-notify/notifier/config",obj).then(res=> {
+ this.$HTTP.post(`/api/blade-notify/notifier/${id}/send`,obj).then(res=> {
this.isSaveing = false;
if(res.code == 200) {
this.$emit('success', this.sendForm, this.mode);
this.visible = false;
- this.$message.success("缂栬緫鎴愬姛");
+ this.$message.success("鍙戦�佹垚鍔�");
}else {
this.$alert(res.message, "鎻愮ず", {type: 'error'});
}
--
Gitblit v1.9.3