From b50cec3a8368dd842c5919bf4e25da83f6c4447b Mon Sep 17 00:00:00 2001
From: fangyuan <527392886@qq.com>
Date: 星期五, 30 十二月 2022 15:33:22 +0800
Subject: [PATCH] 消息栏目订阅开关

---
 src/views/layout/components/Header/index.vue |   95 +++++++++++++++++++++++++----------------------
 1 files changed, 50 insertions(+), 45 deletions(-)

diff --git a/src/views/layout/components/Header/index.vue b/src/views/layout/components/Header/index.vue
index 14a4ef7..53c8a62 100644
--- a/src/views/layout/components/Header/index.vue
+++ b/src/views/layout/components/Header/index.vue
@@ -56,35 +56,40 @@
       </div>
       <el-dialog :visible.sync="channelSettingVisible" width="25%" title="娑堟伅鏍忕洰璁剧疆" v-if="channelSettingVisible"
         :before-close="handleChannelClose">
-        <el-table
-        ref="multipleTable"
-            :header-cell-style="{
-            'font-size': '14px',
-            'font-weight': '650',
-            'line-height': '45px',
-          }"
-            :data="channelData"
-            style="width: 100%"
-            @selection-change="handleSelectionChange"
-        >  <el-table-column
-      type="selection"
-      width="55"
-      
-      >
-    </el-table-column>
-          <el-table-column prop="columnName" label="鍏ㄩ儴" min-width="5"  align="center">
+        <el-table ref="multipleTable" :header-cell-style="{
+                                        'font-size': '14px',
+                                        'font-weight': '650',
+                                        'line-height': '45px',
+                                      }" :data="channelData" style="width: 100%" @selection-change="handleSelectionChange"> 
+          <el-table-column width="55">
+          </el-table-column>
+          <el-table-column prop="columnName" label="鍏ㄩ儴" min-width="5" align="center">
             <!-- <template slot-scope="scope">{{ scope.row.id }}</template> -->
           </el-table-column>
-          </el-table>
-     
-          <el-button type="button" @click="channelSetting">鍙栨秷</el-button>
+          <el-table-column prop="isReceive" label="鍚敤" min-width="5">
+            <template slot-scope="scope">
+              <!-- @change="handleChangeStatus(scope.row)" -->
+              <el-switch class="switchStyle" 
+              v-model="scope.row.isReceive" 
+              active-color="#3fef9a" 
+              inactive-color="#000212"
+              active-value="1"
+              inactive-value="0">
+              </el-switch>
+              {{ scope.row.isReceive}}
+              
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <el-button type="button" @click="channelSetting">鍙栨秷</el-button>
       </el-dialog>
+
       <el-dialog :visible.sync="updatePasswordDialog" width="40%" title="淇敼瀵嗙爜" v-if="updatePasswordDialog"
         :before-close="handleClose">
         <updatePassword />
       </el-dialog>
-      <el-dialog :visible.sync="baseInformationVisible" width="35%" title="鍩烘湰淇℃伅" v-if="baseInformationVisible"
-        >
+      <el-dialog :visible.sync="baseInformationVisible" width="35%" title="鍩烘湰淇℃伅" v-if="baseInformationVisible">
         <el-form :model="info" class="info" label-width="6vw">
           <el-form-item label="鐢ㄦ埛ID" min-width="6">
             <el-input v-model="info.id"></el-input>
@@ -124,8 +129,8 @@
     return {
       baseInformationVisible: false,
       updatePasswordDialog: false,
-      channelSettingVisible:false,
-      checked3:true,
+      channelSettingVisible: false,
+      checked3: true,
       menuLeftList: [
         {
           label: '椹鹃┒鑸�',
@@ -157,7 +162,7 @@
       keyword: '',
       info: null,
       show: false,
-      messageColumnSet:{
+      messageColumnSet: {
       }
     };
   },
@@ -165,25 +170,25 @@
     this.setLoginInfo();
   },
   methods: {
-    handleSelectionChange(val){
+    handleSelectionChange(val) {
       const userInfo = JSON.parse(sessionStorage.getItem('user'));
-    console.log(val[0])
-      this.messageColumnSet.userId=userInfo.user.id
-      this.messageColumnSet.messageColumnId=val[0].id
-    if(val[0].isReceive==null){
-      this.messageColumnSet.isReceive=1
-    }
-    if(val[0].isReceive==1){
-      this.messageColumnSet.isReceive=0
-    }
-    if(val[0].isReceive==0){
-      this.messageColumnSet.isReceive=1
-    }
+      console.log(val[0])
+      this.messageColumnSet.userId = userInfo.user.id
+      this.messageColumnSet.messageColumnId = val[0].id
+      if (val[0].isReceive == null) {
+        this.messageColumnSet.isReceive = 1
+      }
+      if (val[0].isReceive == 1) {
+        this.messageColumnSet.isReceive = 0
+      }
+      if (val[0].isReceive == 0) {
+        this.messageColumnSet.isReceive = 1
+      }
       this.$axios({
         method: 'post',
         url: 'sccg/message_column_set/update',
         data: this.messageColumnSet
-      }).then(res=>{
+      }).then(res => {
         this.$message.success("璁㈤槄鎴愬姛")
       })
     },
@@ -199,15 +204,15 @@
           this.info = res.data.user;
         })
     },
-    channelSetting(row){
-      this.channelSettingVisible=true;
+    channelSetting(row) {
+      this.channelSettingVisible = true;
       const userInfo = JSON.parse(sessionStorage.getItem('user'));
       this.$axios({
         method: 'get',
-        url: 'sccg/message_column/getShowColumn?'+'id='+userInfo.user.id
+        url: 'sccg/message_column/getShowColumn?' + 'id=' + userInfo.user.id
       })
         .then(res => {
-          this.channelData=res.data
+          this.channelData = res.data
           // this.channelData.forEach(item=>{this.$refs.multipleTable.toggleRowSelection(item,true);console.log(this.$refs.multipleTable.toggleRowSelection(item,true))})
         })
     },
@@ -286,10 +291,10 @@
         window.open('http://cockpit.patstech.net:28081/cockpit/dist/board.html#/share-board/zfu0LsJ9', '_blank');
       }
       if (data.id === '2f') {
-        this.$router.push({path: "/home/video"})
+        this.$router.push({ path: "/home/video" })
       }
       if (data.id === '3f') {
-        this.$router.push({path: "/home/operate/casepool/pool"})
+        this.$router.push({ path: "/home/operate/casepool/pool" })
       }
     }
   }

--
Gitblit v1.8.0