lzhe
2024-06-06 a2441175073f8b09a7eff29effd7e3e617de2f7d
src/views/notification/configuration.vue
@@ -2,20 +2,20 @@
 * @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
-->
<template>
   <div class="aposcope-main">
      <div class="debugging">
         <el-button type="primary" plain style="width: 80px;">调试</el-button>
         <el-button type="primary" plain style="width: 80px;" @click="debugerBtn">调试</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="conBottom" v-if="item.configEntity != null">
            <div class="first">
               <div>{{item.id == "internalMessage"?"站内信配置":"配置名称"}}</div>
            </div> 
@@ -23,16 +23,17 @@
               <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>
               <span @click="table_edit(item, index ,2)"><el-icon><EditPen /></el-icon>编辑</span>
               <span @click="table_del(item,index)"><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 class="conBottom" v-if="item.configEntity == null">
            <el-button type="primary" plain style="margin-left: 20px;" @click="table_edit(item, index ,1)">新增配置</el-button>
         </div>
      </div>
   </div>
   <save-dialog v-if="dialog.save" ref="saveDialog" @success="addconfigSuccess" @closed="dialog.save=false"></save-dialog>
   <save-debug v-if="dialog.debugging" ref="saveDebugging" @success="adddebugSuccess" @closed="dialog.debugging=false"></save-debug>
</template>
<script>
   import * as ElementPlusIconsVue from '@element-plus/icons-vue'
@@ -41,12 +42,14 @@
       icons.push(key)
   }
   import saveDialog from './editconfiguration'
   import saveDebug from './sendDebug'
   export default {
      name: "configuration",
      data(){
         return {
            dialog: {
               save: false
               save: false,
               debugging: false
            },
            tableData: []
         }
@@ -58,20 +61,31 @@
         this.getConfiguration();
      },
      components: {
         ...ElementPlusIconsVue,saveDialog
         ...ElementPlusIconsVue,saveDialog,saveDebug
       },
      methods: {
         addallocation() {
            ///api/blade-notify/notifier/config/sms/aliyunSms/metadata
         table_del(item,index) {
            this.$confirm(`确定将选择数据删除?`, '', {
               type: 'warning'
            }).then(() => {
               this.$HTTP.delete(`/api/blade-notify/notifier/config/${item.configEntity.id}`).then(res=> {
                  if(res.code == 200) {
                     this.getConfiguration();
                  }else {
                     this.$message.error(res.msg);
                  }
               })
            }).catch(() => {
            })
         },
         table_edit(row){
            console.log(row)
         table_edit(row,index,type){
            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/sms/aliyunSms/metadata`;
            }else if(row.name == "邮件") {
               var url = `/api/blade-notify/notifier/config/email/embedded/metadata`;
            }
@@ -80,11 +94,20 @@
               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);
                     var obj = Object.assign(res.data,row);
                     if(type == 1) {
                        this.$refs.saveDialog.open('add',obj);
                     }else if(type == 2) {  //编辑
                        this.$refs.saveDialog.open('edit',{}).setData(obj);
                     }
                  })
               }
            })
         },
         debugerBtn() {
            this.dialog.debugging = true;
            this.$nextTick(() => {
               this.$refs.saveDebugging.open(this.tableData);
            })
         },
         getConfiguration() {
@@ -102,7 +125,10 @@
            })
         },
         addconfigSuccess() {
            this.getbusiness();
            this.getConfiguration();
         },
         adddebugSuccess() {
         }
      }
   }