From 0a7021b503fe190a149072cc4b7c53c2049f4741 Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期六, 11 五月 2024 21:49:54 +0800
Subject: [PATCH] 1
---
src/views/notification/editconfiguration.vue | 127 +++++++++++++++++++++++++++++++++++-------
1 files changed, 106 insertions(+), 21 deletions(-)
diff --git a/src/views/notification/editconfiguration.vue b/src/views/notification/editconfiguration.vue
index d2f0c88..6adc22e 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;
@@ -63,21 +99,19 @@
//琛ㄥ崟鎻愪氦鏂规硶
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];
+ console.log(this.addBusinessForm);
+ var obj = {
+ configuration: {appKey: "3aa", appSecret: "4a"},
+ id: "1001",
+ name: "榛樿",
+ provider: "dingTalkMessage",
+ type: "dingTalk"
}
- obj.template = JSON.stringify(template);
+ return;
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
- this.$HTTP.put("/api/blade-notify/business-notify/modify",obj).then(res=> {
+ this.$HTTP.put("/api/blade-notify/notifier/config",obj).then(res=> {
this.isSaveing = false;
if(res.code == 200) {
this.$emit('success', this.addBusinessForm, this.mode);
@@ -94,11 +128,52 @@
},
//琛ㄥ崟娉ㄥ叆鏁版嵁
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)
//鍙互鍜屼笂闈竴鏍峰崟涓敞鍏ワ紝涔熷彲浠ュ儚涓嬮潰涓�鏍风洿鎺ュ悎骞惰繘鍘�
- Object.assign(this.addBusinessForm, data);
- console.log(this.addBusinessForm)
+ Object.assign(this.addBusinessForm,data);
+ this.$nextTick(()=> {
+ this.serviceproviders = this.addBusinessForm.providerInfos[0].id;
+ })
}
- }
+ },
+ components: {
+ ...ElementPlusIconsVue
+ },
}
</script>
@@ -109,6 +184,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