From 30b1c69588849ae6d6bde99ff909d8b275ebabc6 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期五, 10 五月 2024 17:42:08 +0800
Subject: [PATCH] 1

---
 src/views/notification/configuration.vue     |  167 +++++++++++++++++++++++++++++++++
 src/views/notification/editconfiguration.vue |  114 ++++++++++++++++++++++
 2 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/src/views/notification/configuration.vue b/src/views/notification/configuration.vue
new file mode 100644
index 0000000..5d450ad
--- /dev/null
+++ b/src/views/notification/configuration.vue
@@ -0,0 +1,167 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-05-10 17:39:49
+ * @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="aposcope-main">
+		<div class="debugging">
+			<el-button type="primary" plain style="width: 80px;">璋冭瘯</el-button>
+		</div>
+		<div class="conList" v-for="item in tableData">
+			<div class="conTop">
+				<span class="titile">{{item.name}}</span>
+			</div>
+			<div class="conBottom" v-if="item.isBindBusiness">
+				<div class="first">
+					<div>{{item.id == "internalMessage"?"绔欏唴淇¢厤缃�":"閰嶇疆鍚嶇О"}}</div>
+				</div> 
+				<div class="second">
+					<div>{{item.pname}}</div>
+				</div>
+				<div class="thrid" v-if="item.id != 'internalMessage'">
+					<span @click="table_edit(item, index)"><el-icon><EditPen /></el-icon>缂栬緫</span>
+					<span><el-icon><Delete /></el-icon>鍒犻櫎</span>
+				</div>
+			</div>
+			<div class="conBottom" v-if="!item.isBindBusiness">
+				<el-button type="primary" plain style="margin-left: 20px;" @click="addallocation">鏂板閰嶇疆</el-button>
+			</div>
+		</div>
+	</div>
+	<save-dialog v-if="dialog.save" ref="saveDialog" @success="addconfigSuccess" @closed="dialog.save=false"></save-dialog>
+</template>
+<script>
+	import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+	let icons = []
+	for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+	    icons.push(key)
+	}
+	import saveDialog from './editconfiguration'
+	export default {
+		name: "configuration",
+		data(){
+			return {
+				dialog: {
+					save: false
+				},
+				tableData: []
+			}
+		},
+		created(){
+			
+		},
+		mounted(){
+			this.getConfiguration();
+		},
+		components: {
+			...ElementPlusIconsVue,saveDialog
+	    },
+		methods: {
+			addallocation() {
+				///api/blade-notify/notifier/config/sms/aliyunSms/metadata
+			},
+			table_edit(row){
+				console.log(row)
+				if(row.name == "閽夐拤") {
+					var url = `/api/blade-notify/notifier/config/dingTalk/dingTalkMessage/metadata`;
+				}else if(row.name == "浼佷笟寰俊") {
+					var url = `/api/blade-notify/notifier/config/weiXinQY/qyTextMessage/metadata`;
+				}else if(row.name == "绔欏唴淇�") {
+					//var url = `/api/blade-notify/notifier/template/internalMessage/systemDefault/config/metadata`;
+				}else if(row.name == "閭欢") {
+					var url = `/api/blade-notify/notifier/config/email/embedded/metadata`;
+				}
+				this.dialog.save = true
+				this.$HTTP.get(url).then(res=> {
+					if(res.code == 200) {
+						this.dialog.save = true;
+						this.$nextTick(() => {
+							console.log(row,res.data)
+							var obj = Object.assign(row,res.data);
+							this.$refs.saveDialog.open('edit').setData(obj);
+						})
+					}
+				})
+			},
+			getConfiguration() {
+				this.$HTTP.get(`/api/blade-notify/notifier/config/service-list`).then(res=> {
+					if(res.code == 200) {
+						res.data.forEach(item=> {
+							if(item.configEntity != null) {
+								item.pname = item.configEntity.name;
+							}else {
+								item.pname = "";
+							}
+						})
+						this.tableData = res.data;
+					}
+				})
+			},
+			addconfigSuccess() {
+				this.getbusiness();
+			}
+		}
+	}
+</script>
+<style scoped>
+.aposcope-main {
+	min-height: 100%;
+	margin: 8px;
+	background-color: #fff;
+	padding-top: 20px;
+	padding-bottom: 20px;
+}
+.conList {
+    margin: 0 16px 24px 16px;
+    border-radius: 2px;
+    background: #fff;
+    box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
+    padding: 23px 0 15px 16px;
+    box-sizing: border-box;
+	height: 126px;
+	width: 47%;
+	position: relative;
+	float: left;
+}
+.conTop {
+	font-size: 18px;
+}
+.conBottom {
+	display: flex;
+	margin-top: 20px;
+	position: absolute;
+	width: 100%;
+	bottom: 20px;
+	left:0;
+}
+.conList .conBottom .first {
+    width: 20%;
+    padding-left: 30px;
+}
+.conList .conBottom div {
+    font-weight: 400;
+    font-size: 16px;
+    text-align: left;
+    color: #333;
+}
+.conList .conBottom .second {
+    width: 60%;
+    justify-content: flex-start;
+}
+.conList .conBottom .thrid {
+    width: 20%;
+	cursor: pointer;
+}
+.conList .conBottom .thrid span:nth-child(1) {
+	margin-right: 16px;
+}
+.debugging {
+	text-align: right;
+	margin-bottom: 20px;
+	margin-right: 30px;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/notification/editconfiguration.vue b/src/views/notification/editconfiguration.vue
new file mode 100644
index 0000000..d2f0c88
--- /dev/null
+++ b/src/views/notification/editconfiguration.vue
@@ -0,0 +1,114 @@
+<template>
+	<el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
+		<div class="modelTitle">
+			<span>閫氱煡绫诲瀷 {{addBusinessForm.businessName}}</span>
+			<span>鏈嶅姟鍟� {{addBusinessForm.notifyName}}</span>
+		</div>
+		<el-form :model="addBusinessForm" :rules="addBusinessRules" :disabled="mode=='show'" ref="dialogForm" label-width="140px" label-position="center">
+			<el-row>
+				<el-col :span="24">
+					<el-form-item label="璇疯緭鍏ラ厤缃悕绉�" prop="notifyTemplateName">
+						<el-input v-model="addBusinessForm.notifyTemplateName" placeholder="妯$増鍚嶇О" clearable></el-input>
+					</el-form-item>
+				</el-col>
+				<el-col :span="24" v-for="item in addBusinessForm.properties">
+					<el-form-item :label="item.name">
+						<el-input v-model="addBusinessForm[item.property]" :placeholder="item.name" clearable></el-input>
+					</el-form-item>
+				</el-col>
+			</el-row>
+		</el-form>
+		<template #footer>
+			<el-button @click="visible=false" >鍙栨秷</el-button>
+			<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="businessSubmit">纭畾</el-button>
+		</template>
+	</el-dialog>
+</template>
+
+<script>
+	export default {
+		emits: ['success', 'closed'],
+		data() {
+			return {
+				mode: "add",
+				titleMap: {
+					add: '鏂板',
+					edit: '缂栬緫閰嶇疆',
+					show: '鏌ョ湅'
+				},
+				visible: false,
+				isSaveing: false,
+				//琛ㄥ崟鏁版嵁
+				addBusinessForm: {
+					notifyTemplateName: "",
+					agentId: "",
+					title: "",
+					message: ""
+				},
+				//楠岃瘉瑙勫垯
+				addBusinessRules: {
+					notifyTemplateName:[{required: true, message: '璇疯緭鍏ユā鐗堝悕绉�'}]
+				},
+			}
+		},
+		mounted() {
+		},
+		methods: {
+			//鏄剧ず
+			open(mode='add'){
+				this.mode = mode;
+				this.visible = true;
+				return this
+			},
+			//琛ㄥ崟鎻愪氦鏂规硶
+			businessSubmit(){
+				var obj = Object.assign({},this.addBusinessForm);
+				obj.notifyType = obj.notifyType;
+				obj.id = obj.notifyTemplateId;
+				obj.business = obj.businessKey;
+				obj.name = obj.notifyTemplateName;
+				obj.provider = obj.providerType;
+				obj.type = obj.notifyType;
+				var template = JSON.parse(obj.template);
+				for(var key in template) {
+					template[key] = obj[key];
+				}
+				obj.template = JSON.stringify(template);
+				this.$refs.dialogForm.validate(async (valid) => {
+					if (valid) {
+						this.isSaveing = true;
+						this.$HTTP.put("/api/blade-notify/business-notify/modify",obj).then(res=> {
+							this.isSaveing = false;
+							if(res.code == 200) {
+								this.$emit('success', this.addBusinessForm, this.mode);
+								this.visible = false;
+								this.$message.success("缂栬緫鎴愬姛");
+							}else {
+								this.$alert(res.message, "鎻愮ず", {type: 'error'});
+							}
+						})
+					}else{
+						return false;
+					}
+				})
+			},
+			//琛ㄥ崟娉ㄥ叆鏁版嵁
+			setData(data){
+				//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
+				Object.assign(this.addBusinessForm, data);
+				console.log(this.addBusinessForm)
+			}
+		}
+	}
+</script>
+
+<style scoped>
+.modelTitle {
+	padding-left: 45px;
+    padding-bottom: 20px;
+}
+.modelTitle span {
+	display: inline-block;
+	width:30%;
+}
+</style>

--
Gitblit v1.9.3