From a896f3781d29ef58564929cfceeb078a87d01d6a Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期六, 11 五月 2024 18:30:43 +0800
Subject: [PATCH] 1

---
 src/layout/index.vue                         |   34 +++++++++++
 src/views/notification/configuration.vue     |    6 -
 src/layout/components/NavMenu.vue            |    8 ++
 src/views/notification/editconfiguration.vue |  114 ++++++++++++++++++++++++++++++++++---
 4 files changed, 147 insertions(+), 15 deletions(-)

diff --git a/src/layout/components/NavMenu.vue b/src/layout/components/NavMenu.vue
index fc83c32..1786087 100644
--- a/src/layout/components/NavMenu.vue
+++ b/src/layout/components/NavMenu.vue
@@ -1,3 +1,11 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-04-22 16:38:17
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-05-11 17:30:06
+ * @FilePath: /smart-web/src/layout/components/NavMenu.vue
+ * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
 <template>
 	<div v-if="navMenus.length<=0" style="padding:20px;">
 		<el-alert title="鏃犲瓙闆嗚彍鍗�" center type="info" :closable="false"></el-alert>
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 6449135..f34284f 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -104,7 +104,7 @@
 			</div>
 			<div class="adminui-header-right">
 				<div v-if="!ismobile" class="adminui-header-menu">
-					<el-menu mode="horizontal" :default-active="active" router background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)">
+					<el-menu mode="horizontal" @select="handleSelect" :default-active="active" background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)">
 						<NavMenu :navMenus="menu"></NavMenu>
 					</el-menu>
 				</div>
@@ -267,6 +267,38 @@
 			}
 		},
 		methods: {
+			findRouteByPath(routes, targetPath) {  
+				for (let i = 0; i < routes.length; i++) {  
+					if (routes[i].path === targetPath) {  
+						// 濡傛灉鎵惧埌鍖归厤鐨刾ath锛岀洿鎺ヨ繑鍥炲綋鍓嶅璞�  
+						return routes[i];  
+					}  
+					if (routes[i].children) {  
+						// 濡傛灉褰撳墠瀵硅薄鏈塩hildren锛岄�掑綊鏌ユ壘  
+						const found = this.findRouteByPath(routes[i].children, targetPath);  
+						if (found) {  
+							return found;  
+						}  
+					}  
+				}  
+				// 濡傛灉娌℃湁鎵惧埌鍖归厤鐨刾ath锛岃繑鍥瀗ull  
+				return null;  
+			},
+			handleSelect(key, keyPath) {
+				var MENU = this.$TOOL.data.get("MENU");
+				var foundRoute = this.findRouteByPath(MENU, key);  
+				//http://116.63.148.72:8080/xxl-job-admin
+				var TOKEN = this.$TOOL.cookie.get("TOKEN");
+				if(key == '/i/浠诲姟璋冨害') {
+					window.open("http://116.63.148.72:8080/xxl-job-admin");
+					return;
+				}
+				if(foundRoute.name != "鏁板瓧鐪嬫澘") {
+					this.$router.push({path: key});
+				}else {
+					window.open(key + `?token= + ${TOKEN}`,'_blank');
+				}
+			},
 			openSetting(){
 				this.settingDialog = true;
 			},
diff --git a/src/views/notification/configuration.vue b/src/views/notification/configuration.vue
index 5d450ad..a88e523 100644
--- a/src/views/notification/configuration.vue
+++ b/src/views/notification/configuration.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-10 17:39:49
+ * @LastEditTime: 2024-05-11 11:31:56
  * @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
 -->
@@ -65,7 +65,6 @@
 				///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 == "浼佷笟寰俊") {
@@ -80,8 +79,7 @@
 					if(res.code == 200) {
 						this.dialog.save = true;
 						this.$nextTick(() => {
-							console.log(row,res.data)
-							var obj = Object.assign(row,res.data);
+							var obj = Object.assign(res.data,row);
 							this.$refs.saveDialog.open('edit').setData(obj);
 						})
 					}
diff --git a/src/views/notification/editconfiguration.vue b/src/views/notification/editconfiguration.vue
index d2f0c88..b069299 100644
--- a/src/views/notification/editconfiguration.vue
+++ b/src/views/notification/editconfiguration.vue
@@ -1,19 +1,38 @@
 <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>
+			<span>閫氱煡绫诲瀷 {{addBusinessForm.name}}</span>
+			<span>
+				鏈嶅姟鍟�
+				<el-select style="width: 80%"  v-model="serviceproviders" disabled>
+					<el-option v-for="item in addBusinessForm.providerInfos" :key="item.id" :label="item.name" :value="item.id"/>
+				</el-select>
+			</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-input v-model="addBusinessForm.pname" 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-col :span="24" v-for="(item,index) in addBusinessForm.configuration">
+					<el-form-item :label="item.pname" v-if="item.name != 'properties'">
+						<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'">
+						<div class="array-content">
+							<el-row v-for="(item1,index1) in item.value">
+								<el-col v-for="(item2,index2) in item1" :span="7">
+									<el-input v-model="item2.value" placeholder ="璇疯緭鍏�" style="width: 76%;margin-right: 10px;"></el-input>
+									<el-icon style="vertical-align: -3px;"><ArrowRightBold /></el-icon>
+								</el-col>
+								<el-col :span="3" class="otherBtn">
+									<el-button type="primary" size="small" plain @click="addpro(index,index1)" v-show="index1 == (item.value.length-1)">娣诲姞</el-button>
+									<el-button type="danger" size="small" style="margin-left:0;" plain @click="delData(index,index1)" v-show="index1 != (item.value.length-1)">鍒犻櫎</el-button>
+								</el-col>
+							</el-row>
+						</div>
 					</el-form-item>
 				</el-col>
 			</el-row>
@@ -26,10 +45,16 @@
 </template>
 
 <script>
+	import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+	let icons = []
+	for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
+	    icons.push(key)
+	}
 	export default {
 		emits: ['success', 'closed'],
 		data() {
 			return {
+				serviceproviders: "",
 				mode: "add",
 				titleMap: {
 					add: '鏂板',
@@ -40,6 +65,7 @@
 				isSaveing: false,
 				//琛ㄥ崟鏁版嵁
 				addBusinessForm: {
+					providerInfos: [],
 					notifyTemplateName: "",
 					agentId: "",
 					title: "",
@@ -54,6 +80,16 @@
 		mounted() {
 		},
 		methods: {
+			addpro(index,index1) {
+				this.addBusinessForm.configuration[index].value.push([
+					{name: 'name', value: ''},
+					{name: 'value', value: ''},
+					{name: 'description', value: ''},
+				])
+			},
+			delData(index,index1) {
+				this.addBusinessForm.configuration[index].value.splice(index1,1);
+			},
 			//鏄剧ず
 			open(mode='add'){
 				this.mode = mode;
@@ -94,11 +130,59 @@
 			},
 			//琛ㄥ崟娉ㄥ叆鏁版嵁
 			setData(data){
+				if(data.configEntity == null) return;
+				var configuration = data.configEntity.configuration;
+				data.configuration = [];
+				for(var key in configuration) {
+					if(Array.isArray(configuration[key])) {
+						var value = configuration[key];
+						var temArr = [];
+						value.forEach(item=> {
+							var setArr = [];
+							for(var key1 in item) {
+								setArr.push({
+									name: key1,
+									value: item[key1]
+								})
+							}
+							temArr.push(setArr);
+						})
+						data.configuration.push({
+							name: key,
+							value: temArr
+						})
+					}else {
+						data.configuration.push({
+							name: key,
+							value: configuration[key]
+						})
+					}
+				}
+				data.properties.forEach(item=> {
+					data.configuration.forEach(item1=> {
+						if(item1.name == item.property) {
+							item1.pname = item.name;
+						}
+					})
+				})
+				console.log(data.configuration,data)
+				// for(var key in res.data.configEntity.configuration) {
+				// 	res.data.configEntity.configuration['name'] = key;
+				// 	res.data.configEntity.configuration['value'] = res.data.configEntity.configuration[key];
+				// 	res.data.configEntity.configuration['type'] = res.data.id;
+				// }
 				//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
-				Object.assign(this.addBusinessForm, data);
-				console.log(this.addBusinessForm)
+				Object.assign(this.addBusinessForm,data);
+
+				// this.$nextTick(()=> {
+				// 	this.serviceproviders = this.addBusinessForm.providerInfos[0].id;
+				// })
+				// console.log(this.addBusinessForm)
 			}
-		}
+		},
+		components: {
+			...ElementPlusIconsVue
+	    },
 	}
 </script>
 
@@ -109,6 +193,16 @@
 }
 .modelTitle span {
 	display: inline-block;
-	width:30%;
+	width:50%;
+}
+.array-content {
+	border: 1px solid #d8d8d8;
+    border-radius: 2px;
+    min-height: 200px;
+	width: 100%;
+	padding: 12px;
+}
+.otherBtn {
+	margin-bottom: 12px;
 }
 </style>

--
Gitblit v1.9.3