From 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58 Mon Sep 17 00:00:00 2001
From: “dzb” <2632970487@qq.com>
Date: 星期日, 09 十月 2022 18:06:46 +0800
Subject: [PATCH] 修改bug,店铺管理新增、查询

---
 src/views/systemSetting/baseSetting/role/index.vue |   79 +++++++++++++++++++++++++++++++--------
 1 files changed, 62 insertions(+), 17 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/role/index.vue b/src/views/systemSetting/baseSetting/role/index.vue
index 1eca7a3..9edcb79 100644
--- a/src/views/systemSetting/baseSetting/role/index.vue
+++ b/src/views/systemSetting/baseSetting/role/index.vue
@@ -12,7 +12,7 @@
                 <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">
+                        :before-close="handleClose2">
                         <createUser :refresh="context==='' ? getUserList : search" />
                     </el-dialog>
                 </div>
@@ -62,16 +62,21 @@
                         </template>
                     </el-table-column>
                 </el-table>
-                <!-- 鏌ョ湅淇敼椤甸潰 -->
+                <!-- 淇敼椤甸潰 -->
                 <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '鏉冮檺璁剧疆' :'鏌ョ湅瑙掕壊淇℃伅'"
                     v-if="dialogUpdate" :before-close="handleClose">
                     <updateUser :updateFlag="updateFlag" :userInfo=userInfo
                         :getUserList=" context ? getUserList : getUserList" @changeDialog="changeDialog" />
                 </el-dialog>
+                <!-- 鏌ョ湅椤甸潰 -->
+                <el-dialog :visible.sync="dialogView" width="45%" title="鏌ョ湅瑙掕壊淇℃伅"
+                    v-if="dialogView" :before-close="handleClose">
+                    <MyView :userInfo=userInfo @changeDialog="changeDialog" />
+                </el-dialog>
                 <!-- tools -->
                 <div class="tools">
                     <div class="funs">
-                        <div class="funsItem">
+                        <!-- <div class="funsItem">
                             <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox>
                         </div>
                         <div class="funsItem">
@@ -83,7 +88,7 @@
                                     :value="item.value" :disabled="item.disabled">
                                 </el-option>
                             </el-select>
-                        </div>
+                        </div> -->
                     </div>
                     <div class="pagination">
                         <el-pagination background :current-page="currentPage" layout="prev, pager, next"
@@ -100,9 +105,10 @@
 import createUser from "./createUser"
 import updateUser from "./updateUser"
 import helper from "@/utils/mydate.js"
+import MyView from './viewRole'
 export default {
     components: {
-        createUser, updateUser
+        createUser, updateUser,MyView
     },
     data() {
         return {
@@ -110,6 +116,7 @@
             context: "",
             dialogCreate: false,
             dialogUpdate: false,
+            dialogView:false,
             updateFlag: false,
             userInfo: '',
             totalNum: null,
@@ -145,13 +152,18 @@
         this.getUserList();
     },
     methods: {
-        selectChange(list) {
+        async selectChange(list) {
             console.log(this.tempList);
             if (this.tempList.length !== 0) {
+                this.preMyIdx = list;
                 if (list === 3) {
-                    this.preMyIdx = list;
-                    this.handleDelete(this.tempList);
+                    await this.handleDelete(this.tempList);
+                } else if (list === 2) {
+                    await this.mulUpdateStatus(this.tempList, 0);
+                } else {
+                    await this.mulUpdateStatus(this.tempList, 1);
                 }
+                this.myIdx = 0;
             } else {
                 this.myIdx = this.preMyIdx;
                 this.$message({
@@ -159,6 +171,31 @@
                     message: '鎮ㄨ繕娌¢�変腑浠讳綍鏁版嵁',
                 })
             }
+        },
+        mulUpdateStatus(idArr, flag) {
+            this.$confirm(flag === 1 ? "鎮ㄧ‘瀹氳杩涜鎵归噺鍚敤瑙掕壊鍚�?" : '鎮ㄧ‘瀹氳杩涜鎵归噺绂佺敤瑙掕壊鍚�?')
+                .then(_ => {
+                    this.$axios({
+                        method: 'post',
+                        url: 'sccg/role/updateStatusBatch?ids=' + idArr + '&status=' + flag,
+                    })
+                        .then(res => {
+                            if (res.code === 200) {
+                                this.$message({
+                                    type: 'success',
+                                    message: '鏇存敼鐢ㄦ埛鐘舵�佹垚鍔�',
+                                })
+                                this.getUserList();
+                            } else {
+                                this.$message({
+                                    type: 'error',
+                                    message: res.message
+                                })
+                            }
+                            console.log(res);
+                        })
+                })
+                .catch(err => { console.log(err) })
         },
         tableChange(list) {
             this.tempList = [];
@@ -282,8 +319,7 @@
         },
         // 鏌ョ湅鐢ㄦ埛淇℃伅(涓嶅彲淇敼)
         handleFind(rowData) {
-            this.dialogUpdate = true;
-            this.updateFlag = false;
+            this.dialogView = true;
             this.userInfo = rowData;
         },
         // 淇敼鐢ㄦ埛閮ㄩ棬淇℃伅
@@ -307,21 +343,30 @@
             this.currentPage = page;
             this.search();
         },
-        changeDialog(val) {
-            this.dialogUpdate = val.dialogUpdate;
-            this.$message({
-                type:'success',
-                message:'鏇存敼鎴愬姛',
-            })
+        changeDialog({flag}) {
+            this.dialogUpdate = flag;
+            this.dialogCreate = flag;
+            this.dialogView = flag;
         },
         handleClose(done) {
-            this.$confirm('纭鍏抽棴锛�')
+            if(this.updateFlag){
+                this.$confirm('纭鍏抽棴锛�')
                 .then(_ => {
                     this.dialogUpdate = false;
                     this.dialogCreate = false;
                     done();
                 })
                 .catch(_ => { });
+            }else{
+                done();
+            }
+        },
+        handleClose2(done){
+            this.$confirm('纭鍏抽棴锛�')
+                .then(_ => {
+                    done();
+                })
+                .catch(_ => { });
         }
     }
 }

--
Gitblit v1.8.0