From 0d7d6fc9a5c40ccc90190b0f24039ec1362f120f Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期一, 17 十月 2022 11:33:10 +0800
Subject: [PATCH] 新增设备管理、完善消息新增,修改bug

---
 src/views/systemSetting/baseSetting/department/index.vue |  202 ++++++++++++++++++++++++-------------------------
 1 files changed, 99 insertions(+), 103 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/department/index.vue b/src/views/systemSetting/baseSetting/department/index.vue
index 169b284..b248dfa 100644
--- a/src/views/systemSetting/baseSetting/department/index.vue
+++ b/src/views/systemSetting/baseSetting/department/index.vue
@@ -12,8 +12,8 @@
                 <div class="addUser">
                     <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板閮ㄩ棬</el-button>
                     <el-dialog :visible.sync="dialogCreate" title="鏂板閮ㄩ棬淇℃伅" width="45%" v-if="dialogCreate"
-                        :before-close="handleClose">
-                        <createUser :refresh="context==='' ? getUserList : search " />
+                        :before-close="handleClose2">
+                        <createUser :refresh="context==='' ? getUserList : search " @changMyDialog="changMyDialog" />
                     </el-dialog>
                 </div>
             </div>
@@ -36,23 +36,21 @@
                     </el-table-column>
                     <el-table-column prop="departDes" label="閮ㄩ棬鎻忚堪" min-width="10">
                     </el-table-column>
-                    <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="10">
-                    </el-table-column>
+                    <!-- <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="10">
+                    </el-table-column> -->
                     <el-table-column prop="status" label="鍚敤" min-width="5">
                         <template slot-scope="scope">
-                            <el-switch class="switchStyle" v-model="scope.row.status" active-text="寮�" inactive-text="鍏�"
-                                active-color="#3fef9a" inactive-color="#000212" @change="handleChangeStatus(scope.row)">
+                            <!-- @change="handleChangeStatus(scope.row)" -->
+                            <el-switch class="switchStyle" v-model="scope.row.status"
+                                active-color="#3fef9a" inactive-color="#000212" disabled>
                             </el-switch>
                         </template>
                     </el-table-column>
                     <el-table-column prop="operation" label="鎿嶄綔" min-width="15">
                         <template slot-scope="scope">
                             <div class="operation">
-                                <!-- <span @click="handleChangeRole(scope.row)">淇敼瑙掕壊</span> -->
                                 <span @click="handleFind(scope.row)">鏌ョ湅</span>
                                 <span class="line">|</span>
-                                <!-- <span>淇敼瀵嗙爜</span> -->
-                                <!-- <span>鍒犻櫎</span> -->
                                 <span @click="handleUpdate(scope.row)">淇敼</span>
                                 <span class="line">|</span>
                                 <span @click="handleDelete(scope.row)">鍒犻櫎</span>
@@ -69,10 +67,10 @@
                 <!-- tools -->
                 <div class="tools">
                     <div class="funs">
-                        <div class="funsItem">
+                        <div class="funsItem funs-sp">
                             <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox>
                         </div>
-                        <div class="funsItem">
+                        <div class="funsItem funs-sp">
                             <el-checkbox v-model="unsame" @change="disSame(tableData)">鍙嶉��</el-checkbox>
                         </div>
                         <div class="funsItem">
@@ -97,7 +95,6 @@
 <script>
 import createUser from "./createUser"
 import updateUser from "./updateUser"
-import helper from "@/utils/mydate.js"
 export default {
     components: {
         createUser, updateUser
@@ -116,6 +113,7 @@
             all: false,
             unsame: false,
             myIdx: 0,
+            preMyIdx: 0,
             options: [
                 {
                     value: 0,
@@ -143,19 +141,55 @@
     },
     methods: {
         selectChange(list) {
-            console.log(list);
             console.log(this.tempList);
+            if (this.tempList.length !== 0) {
+                if (list === 3) {
+                    this.preMyIdx = list;
+                    this.mulDelete(this.tempList);
+                }
+            } else {
+                this.myIdx = this.preMyIdx;
+                this.$message({
+                    type: 'warning',
+                    message: '鎮ㄨ繕娌¢�変腑浠讳綍鏁版嵁',
+                })
+            }
+        },
+        // 澶氭潯鏁版嵁鍒犻櫎
+        mulDelete(idArr) {
+            this.$confirm('鎮ㄧ‘瀹氳鎵归噺鍒犻櫎閮ㄩ棬鍚�?')
+                .then(_ => {
+                    this.$axios({
+                        method: 'post',
+                        url: 'sccg/depart/batch_deletion?ids=' + idArr,
+                    })
+                        .then(res => {
+                            if (res.code === 200) {
+                                this.$message({
+                                    type: 'success',
+                                    message: '鎵归噺鍒犻櫎閮ㄩ棬鎴愬姛',
+                                })
+                                this.getUserList();
+                            } else {
+                                this.$message({
+                                    type: 'error',
+                                    message: res.message
+                                })
+                            }
+                        })
+                })
+                .catch(err => { console.log(err) });
         },
         tableChange(list) {
-            this.tempList = list;
+            this.tempList = [];
+            list.forEach(item => {
+                this.tempList.push(item.id);
+            })
             if (list.length === this.tableData.length) {
                 this.all = true;
             } else {
                 this.all = false
             }
-        },
-        changeTime({ createTime }) {
-            return helper(createTime);
         },
         selectAll() {
 
@@ -168,6 +202,7 @@
                 this.$refs.multipleTable.toggleRowSelection(row)
             })
         },
+        // 鍗曟潯鏁版嵁鍒犻櫎
         handleDelete({ id }) {
             this.$confirm('纭鍒犻櫎锛�')
                 .then(_ => {
@@ -190,19 +225,14 @@
                 })
                 .catch(_ => { });
         },
-        // 淇敼瑙掕壊
-        handleChangeRole(obj) {
-            this.dialogUpdate = true
-            this.user = obj;
-            // console.log(obj)
-        },
-        // 淇敼鐢ㄦ埛鐘舵��
+        // 淇敼鐘舵��
         handleChangeStatus(obj) {
             let { id, status } = obj;
             status == true ? status = 1 : status = 0;
-            console.log(id, status);
             this.$axios.post(`sccg/depart/status`, { id: id, status: status }).then(res => {
-                console.log(res);
+                if (res.code == 200) {
+                    this.getUserList();
+                }
             })
         },
         // 鑾峰彇鐢ㄦ埛鍒楄〃
@@ -213,8 +243,7 @@
             this.$axios.get('sccg/depart/page').then(res => {
                 if (res.code === 200) {
                     res.data.records.forEach(item => {
-                        item.createTime = helper(item.createTime);
-                        item.status == 1 ? item.status = true : item.status = false;
+                        item.status == 0 ? item.status = false : item.status = true;
                     })
                     that.totalNum = res.data.records.length;
                     that.tableData = res.data.records.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize)
@@ -228,7 +257,6 @@
             this.$axios.get('sccg/depart/page', { params: { currentPage: this.currentPage, pageSize: this.pageSize, departName: this.context } }).then(res => {
                 if (res.code === 200) {
                     res.data.records.forEach(item => {
-                        item.createTime = helper(item.createTime);
                         item.status == 1 ? item.status = true : item.status = false;
                     })
                     that.totalNum = res.data.records.length;
@@ -273,14 +301,26 @@
             this.search();
         },
         // 鍏抽棴dialog
-        changMyDialog(val) {
-            this.dialogUpdate = val.dialogFlag;
+        changMyDialog({ flag }) {
+            this.dialogUpdate = flag;
+            this.dialogCreate = flag;
         },
         handleClose(done) {
+            if (this.updateFlag) {
+                this.$confirm('纭鍏抽棴锛�')
+                    .then(_ => {
+                        this.dialogUpdate = false;
+                        this.dialogCreate = false;
+                        done();
+                    })
+                    .catch(_ => { });
+            } else {
+                done();
+            }
+        },
+        handleClose2(done) {
             this.$confirm('纭鍏抽棴锛�')
                 .then(_ => {
-                    this.dialogUpdate = false;
-                    this.dialogCreate = false;
                     done();
                 })
                 .catch(_ => { });
@@ -362,7 +402,9 @@
             justify-content: space-between;
             align-items: center;
             padding: 0 20px;
-
+            .funs-sp{
+                border: 1px solid #17324c;
+            }
             .funs {
                 display: flex;
 
@@ -370,7 +412,6 @@
                     line-height: 28px;
                     display: flex;
                     align-items: center;
-                    border: 1px solid #17324c;
                     border-radius: 4px;
                     font-size: 12px;
                     margin-left: 10px;
@@ -426,15 +467,6 @@
         .el-table {
             color: #4b9bb7;
             font-size: 10px;
-
-            &::v-deep .el-table__empty-block {
-                background-color: #09152f;
-            }
-
-            &::v-deep .el-table__empty-block {
-                color: #4b9bb7;
-            }
-
             .operation {
                 display: flex;
 
@@ -447,70 +479,34 @@
                 }
             }
         }
+        // &::v-deep .switchStyle .el-switch__label {
+        //     position: absolute;
+        //     display: none;
+        //     color: #fff;
+        // }
 
-        .el-table::v-deep .warning-row {
-            background: #06122c;
-        }
+        // &::v-deep .el-switch__core {
+        //     background-color: rgba(166, 166, 166, 1);
+        // }
 
-        .el-table::v-deep .success-row {
-            background: #071f39;
-        }
+        // &::v-deep .switchStyle .el-switch__label--left {
+        //     z-index: 9;
+        //     left: 20px;
+        // }
 
-        &::v-deep .switchStyle .el-switch__label {
-            position: absolute;
-            display: none;
-            color: #fff;
-        }
+        // &::v-deep .switchStyle .el-switch__label--right {
+        //     z-index: 9;
+        //     left: 4px;
+        // }
 
-        &::v-deep .el-switch__core {
-            background-color: rgba(166, 166, 166, 1);
-        }
+        // &::v-deep .switchStyle .el-switch__label.is-active {
+        //     display: block;
+        // }
 
-        &::v-deep .switchStyle .el-switch__label--left {
-            z-index: 9;
-            left: 20px;
-        }
-
-        &::v-deep .switchStyle .el-switch__label--right {
-            z-index: 9;
-            left: 4px;
-        }
-
-        &::v-deep .switchStyle .el-switch__label.is-active {
-            display: block;
-        }
-
-        &::v-deep .switchStyle.el-switch .el-switch__core,
-        &::v-deep .el-switch .el-switch__label {
-            width: 50px !important;
-        }
-    }
-
-    &::v-deep .el-dialog__header,
-    &::v-deep .el-dialog__body {
-        background-color: #06122c;
-    }
-
-    &::v-deep .el-dialog__header {
-        display: flex;
-        align-items: center;
-        background-color: #fff;
-        padding: 20px;
-        line-height: 60px;
-    }
-
-    &::v-deep .el-dialog__title {
-        color: #4b9bb7;
-    }
-
-    &::v-deep .el-dialog__close {
-        width: 20px;
-        height: 20px;
-        // color: #fff;
-    }
-
-    &::v-deep .el-dialog__body {
-        padding: 0;
+        // &::v-deep .switchStyle.el-switch .el-switch__core,
+        // &::v-deep .el-switch .el-switch__label {
+        //     width: 50px !important;
+        // }
     }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0