From 2ab23b07784e960efce40fc5629a57e92afb481a Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期四, 09 五月 2024 23:53:45 +0800
Subject: [PATCH] 1

---
 src/views/notification/business.vue |  112 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/src/views/notification/business.vue b/src/views/notification/business.vue
index 773e449..179b73e 100644
--- a/src/views/notification/business.vue
+++ b/src/views/notification/business.vue
@@ -42,12 +42,26 @@
 					<span class="ct-span">榛樿瀵硅薄</span>
 				</div>
 				<div class="template-content-box">
-				    <el-radio-group v-model="radio1">
+				    <el-radio-group v-model="radio1" @change="radio1Change">
 					    <el-radio :label="1">閮ㄩ棬</el-radio>
 					    <el-radio :label="2">鍛樺伐</el-radio>
 					</el-radio-group>
 					<div class="content">
-						<el-button type="primary" plain>鐐瑰嚮娣诲姞+</el-button>
+						<el-button type="primary" plain @click="addOrganization" v-show="isaddOrganization">鐐瑰嚮娣诲姞+</el-button>
+						<!-- 閮ㄩ棬閫夋嫨 -->
+						<span v-if="radio1 == 1" v-for="(item,index) in organizationLi" class="tagItem">{{item.name}}<el-icon @click="delOrganizationLi(index)" style="cursor: pointer;"><Close /></el-icon></span>
+						<el-select v-if="radio1 == 1" v-show="!isaddOrganization" v-model="organization" style="width: 20%" @change="organizationChange">
+							<el-option v-for="item in organizationList" :key="item.parentId" :label="item.name" :value="item.parentId"/>
+						</el-select>
+						<!-- 鍛樺伐閫夋嫨 -->
+						<span v-if="radio1 == 2" v-for="(item,index) in employeeLi" class="tagItem">{{item.name}}<el-icon @click="delEmployeeLi(index)" style="cursor: pointer;"><Close /></el-icon></span>
+						<el-select v-if="radio1 == 2" v-show="!isaddOrganization" v-model="employee" style="width: 20%" @change="employeeChange">
+							<el-option v-for="item in employeeList" :key="item.id" :label="item.organizationName + '-' + item.name" :value="item.id"/>
+						</el-select>
+					</div>
+					<div class="bottom-btn">
+						<el-button @click="resetData">閲嶇疆</el-button>
+						<el-button type="primary" :loading="isSaveing" @click="saveSubmit">淇濆瓨</el-button>
 					</div>
 				 </div>
 			</div>
@@ -66,6 +80,14 @@
 		name: "business",
 		data(){
 			return {
+				isSaveing: false,
+				employeeLi: [],
+				organizationLi: [],
+				isaddOrganization: true,
+				organizationList: [],
+				employeeList: [],
+				organization: "",
+				employee: "",
 				radio1: 1,
 				checked1: true,
 				tableData: [],
@@ -90,18 +112,83 @@
 		mounted(){
 			this.getTreeList();
 			this.getbusiness();
+			this.getgroupType();
+			this.getEmployeeList();
 		},
 		components: {
 			...ElementPlusIconsVue,saveDialog
 	    },
 		methods: {
+			saveSubmit() {
+				
+			},
+			resetData() {
+				this.employeeLi = [];
+				this.organizationLi = [];
+			},
+			radio1Change(val) {
+				this.getgroupType(val);
+			},
+			addOrganization() {
+				this.isaddOrganization = false;
+			},
+			organizationChange(val) {
+				var flag = this.organizationLi.some(function(item) {
+				    return item.parentId === val;
+				});
+				this.organizationList.forEach(item=> {
+					if(item.parentId == val && !flag) {
+						this.organizationLi.push(item);
+					}
+				})
+			},
+			employeeChange(val) {
+				var flag = this.employeeLi.some(function(item) {
+				    return item.id === val;
+				});
+				this.employeeList.forEach(item=> {
+					if(item.id == val && !flag) {
+						this.employeeLi.push(item);
+					}
+				})
+			},
+			delOrganizationLi(index) {
+				this.organizationLi.splice(index,1);
+			},
+			delEmployeeLi(index) {
+				this.employeeLi.splice(index,1);
+			},
+			getgroupType() {
+				this.$HTTP.get("/api/blade-cps/organization/list?groupType=group_organization&groupCategory=1").then(res=> {
+					if(res.code == 200) {
+						this.organizationList = res.data;
+					}
+				})
+			},
+			getEmployeeList() {
+				this.$HTTP.get("/api/blade-cps/employee/get/list?organizationCode=00001&status=1").then(res=> {
+					if(res.code == 200) {
+						this.employeeList = res.data;
+					}
+				})
+			},
 			table_edit(row){
+				if(row.notifyName == "閽夐拤") {
+					var url = `/api/blade-notify/notifier/template/dingTalk/dingTalkMessage/config/metadata`;
+				}else if(row.notifyName == "浼佷笟寰俊") {
+					var url = `/api/blade-notify/notifier/template/weiXinQY/qyTextMessage/config/metadata`;
+				}else if(row.notifyName == "绔欏唴淇�") {
+					var url = `/api/blade-notify/notifier/template/internalMessage/systemDefault/config/metadata`;
+				}else if(row.notifyName == "閭欢") {
+					var url = `/api/blade-notify/notifier/template/email/embedded/config/metadata`;
+				}
 				this.dialog.save = true
-				this.$HTTP.get(`/api/blade-notify/notifier/template/dingTalk/dingTalkMessage/config/metadata`).then(res=> {
+				this.$HTTP.get(url).then(res=> {
 					if(res.code == 200) {
 						this.dialog.save = true;
 						this.$nextTick(() => {
-							this.$refs.saveDialog.open('edit').setData(res.data);
+							var obj = Object.assign(row,res.data);
+							this.$refs.saveDialog.open('edit').setData(obj);
 						})
 					}
 				})
@@ -113,7 +200,6 @@
 							item.checked = (item.status == '0'?false: true);
 						})
 						this.contentData = res.data.businessNotifyDTOList;
-						console.log(this.contentData)
 					}
 				})
 			},
@@ -150,7 +236,7 @@
 			// 	})
 			// },
 			addbusinessSuccess() {
-				//this.getlist();
+				this.getbusiness();
 			}
 		}
 	}
@@ -257,4 +343,18 @@
 .box-top-btn span:nth-child(1) {
 	margin-right: 12px;
 }
+.tagItem {
+	margin: 10px 10px 10px 0;
+    background-color: #3b8e8e;
+    color: #fff;
+    border-color: #3b8e8e;
+    display: inline-block;
+    font-size: 12px;
+    padding: 4px 10px;
+    border-radius: 4px;
+}
+.bottom-btn {
+	margin-top: 20px;
+	text-align: center;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3