From 38535bdc693c7e2e9a510f2c3f22e369b30a64c8 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 18 六月 2024 23:15:14 +0800
Subject: [PATCH] update
---
src/views/notification/business.vue | 197 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 178 insertions(+), 19 deletions(-)
diff --git a/src/views/notification/business.vue b/src/views/notification/business.vue
index 773e449..1eb3d8b 100644
--- a/src/views/notification/business.vue
+++ b/src/views/notification/business.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-09 18:06:28
+ * @LastEditTime: 2024-05-10 12:08:41
* @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
-->
@@ -23,11 +23,11 @@
<div class="right-content">
<div class="content-title">
<span class="ct-span">閫氱煡鏂瑰紡</span>
- <el-icon><Setting /></el-icon>
+ <el-icon @click="gojob"><Setting /></el-icon>
</div>
<el-row class="template-content-box">
<el-col :span="8" v-for="(item,index) in contentData">
- <el-checkbox v-model="item.checked" label="閫夋嫨" size="large" />
+ <el-checkbox v-model="item.checked" label="閫夋嫨" size="large" @change="checkboxChange($event,index,item)"/>
<div class="box-top">
<div class="box-top-name">{{item.notifyName}}</div>
<div class="box-top-title">{{item.notifyTemplateName}}</div>
@@ -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,15 @@
name: "business",
data(){
return {
+ businessKey: "",
+ isSaveing: false,
+ employeeLi: [],
+ organizationLi: [],
+ isaddOrganization: true,
+ organizationList: [],
+ employeeList: [],
+ organization: "",
+ employee: "",
radio1: 1,
checked1: true,
tableData: [],
@@ -89,48 +112,170 @@
},
mounted(){
this.getTreeList();
- this.getbusiness();
+ this.getgroupType();
+ this.getEmployeeList();
},
components: {
...ElementPlusIconsVue,saveDialog
},
methods: {
+ gojob() {
+ window.open('http://116.63.148.72:8080/xxl-job-admin');
+ },
+ checkboxChange(e,index,item) {
+ var obj = {
+ businessKey: item.businessKey,
+ notifyType: item.notifyType,
+ status: e?"1":"0"
+ }
+ this.$HTTP.put("/api/blade-notify/business-notify/changeStatus",obj).then(res=> {
+ if(res.code == 200) {
+ this.getbusiness(); //鍒锋柊鍒楄〃
+ }
+ })
+ },
+ saveSubmit() {
+ var empIds = [];
+ var orgIds = [];
+ this.employeeLi.forEach(item=> {
+ empIds.push(item.id);
+ })
+ this.organizationLi.forEach(item=> {
+ orgIds.push(item.id);
+ })
+ var obj = {
+ businessKey: this.businessKey,empIds,orgIds
+ }
+ this.$HTTP.post("/api/blade-notify/business-notify",obj).then(res=> {
+ if(res.code == 200) {
+ this.$message.success("淇濆瓨鎴愬姛");
+ }
+ })
+ },
+ resetData() {
+ this.employeeLi = [];
+ this.organizationLi = [];
+ },
+ radio1Change(val) {
+ if(val == 1) {
+ this.getgroupType();
+ }else if(val == 2) {
+ this.getEmployeeList();
+ }
+ },
+ 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);
})
}
})
},
getbusiness() {
- this.$HTTP.get("/api/blade-notify/business-notify?businessKey=maintenance").then(res=> {
+ this.$HTTP.get(`/api/blade-notify/business-notify?businessKey=${this.businessKey}`).then(res=> {
if(res.code == 200) {
res.data.businessNotifyDTOList.forEach(item=> {
item.checked = (item.status == '0'?false: true);
})
this.contentData = res.data.businessNotifyDTOList;
- console.log(this.contentData)
+ this.employeeLi = res.data.defaultObject.empList || []; //閮ㄩ棬鍙嶆樉
+ this.organizationLi = res.data.defaultObject.orgList || []; //鍛樺伐鍙嶆樉
+ if(this.organizationLi != null ) {
+ this.isaddOrganization = false;
+ }
}
})
},
handleNodeClick(data) {
- if(data.code) {
- this.lastLevelId = data.id;
- // this.$HTTP.post("/api/blade-cps/workstation-wcs-feedback/page?current=1&size=15",obj).then(res=> {
- // if(res.code == 200) {
- // this.searchDataList = res.data.records;
- // }
- // })
+ if(data.businessKey) {
+ this.businessKey = data.businessKey;
+ this.getbusiness();
}
+ },
+ getLastLevelIds(tree) {
+ if (tree.length === 0) return ""; // 濡傛灉娌℃湁鏍硅妭鐐癸紝杩斿洖绌�
+ const lastLevelIds = [];
+ const lastLevelCodes = [];
+ function traverseTree(node) {
+ if(!node.children) {
+ lastLevelCodes.push(node);
+ }
+ if (node.children) {
+ node.children.forEach(traverseTree); // 閫掑綊閬嶅巻瀛愯妭鐐�
+ } else {
+ lastLevelIds.push(node.id);
+ }
+ }
+ // 鍙亶鍘嗙涓�涓牴鑺傜偣
+ traverseTree(tree[0]);
+ return {lastLevelCodes,lastLevelId:lastLevelIds[0]}; // 杩斿洖lastLevelCodes锛氭病鏈塩ode鐨勬暟缁勩�俵astLevelId锛氭湁code鐨勭涓�涓猧d
},
getTreeList() {
this.$HTTP.get("/api/blade-notify/business-notify/tree").then(res=> {
if(res.code == 200) {
this.tableData = res.data;
+ this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
+ this.$nextTick(()=>{
+ this.$refs.treeRef.setCurrentKey(this.lastLevelId); //绗竴涓妭鐐圭殑绗竴涓瓙鑺傜偣鏈�鍚庝竴绾ч粯璁ら�変腑
+ })
+ this.businessKey = this.getLastLevelIds(this.tableData).lastLevelCodes[0].businessKey;
+ this.getbusiness();
}
})
},
@@ -150,7 +295,7 @@
// })
// },
addbusinessSuccess() {
- //this.getlist();
+ this.getbusiness();
}
}
}
@@ -198,7 +343,7 @@
justify-content: space-between;
margin: 24px 0 0 0;
padding: 0 20px 0 10px;
- border-left: 6px solid #3b8e8e;
+ border-left: 6px solid #409eff;
}
.ct-span {
color: #101010;
@@ -257,4 +402,18 @@
.box-top-btn span:nth-child(1) {
margin-right: 12px;
}
+.tagItem {
+ margin: 10px 10px 10px 0;
+ background-color: #409eff;
+ color: #fff;
+ border-color: #409eff;
+ 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