From d889eaf990af99c06970e51f2bc421ac0015489c Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期四, 05 五月 2022 13:30:31 +0800
Subject: [PATCH] bug修复

---
 src/views/personalCenter/components/SubAccount.vue |   82 ++++++++++++++++++++++++-----------------
 1 files changed, 48 insertions(+), 34 deletions(-)

diff --git a/src/views/personalCenter/components/SubAccount.vue b/src/views/personalCenter/components/SubAccount.vue
index 8be3ee9..e71b049 100644
--- a/src/views/personalCenter/components/SubAccount.vue
+++ b/src/views/personalCenter/components/SubAccount.vue
@@ -69,10 +69,9 @@
             <span>{{ scope.row.userType == 1 ? "涓汉" : "鍏徃" }}</span>
           </template>
         </el-table-column>
-        <el-table-column prop="authDuration" label="鎺堟潈鏃堕暱" > </el-table-column>
-        <el-table-column prop="dataNames" label="鏉冮檺">
-
+        <el-table-column prop="authDuration" label="鎺堟潈鏃堕暱">
         </el-table-column>
+        <el-table-column prop="dataNames" label="鏉冮檺"> </el-table-column>
 
         <el-table-column label="鐘舵��">
           <template slot-scope="scope">
@@ -83,14 +82,9 @@
 
         <el-table-column label="鎿嶄綔">
           <template slot-scope="scope">
-            <!-- 缂栬緫 -->
             <span class="iconfont option" @click="editUser(scope.row)"
               >缂栬緫</span
             >
-            <!-- 瑙g粦 -->
-            <!-- <span class="iconfont option" @click="Untying(scope.row)"
-              >瑙g粦</span
-            > -->
           </template>
         </el-table-column>
       </el-table>
@@ -171,8 +165,9 @@
           style="width: 350px"
           placeholder="璇烽�夋嫨鎺堟潈鏃堕暱"
         >
-          <el-option label="涓�骞�" value="涓�骞�"></el-option>
-          <el-option label="涓ゅ勾" value="涓ゅ勾"></el-option>
+          <el-option label="涓�骞�" :value="1"></el-option>
+          <el-option label="涓ゅ勾" :value="2"></el-option>
+          <el-option label="涓夊勾" :value="3"></el-option>
         </el-select>
       </el-form-item>
 
@@ -228,17 +223,15 @@
 </template>
 
 <script>
-import { findUserList, saveSubUser, getMenu, getDataTree} from "@/api/user";
+import { findUserList, saveSubUser, getMenu, getDataTree } from "@/api/user";
 import { getAreas, getDic } from "@/api/login";
 
 import Steps from "./Steps";
 import StepsCard from "./StepCard";
-import TreeBox from "./TreeBox";
 export default {
   components: {
     Steps,
     StepsCard,
-    TreeBox,
   },
   data() {
     return {
@@ -278,24 +271,29 @@
       dataList: [],
       isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
       isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥
-      isShowRelate: false,isEditing: false,
+      isShowRelate: false,
+      isEditing: false,
       unbindId: "",
       durationArr: [
         {
-          value: "涓�骞�",
+          value: 1,
           label: "涓�骞�",
         },
         {
-          value: "涓ゅ勾",
+          value: 2,
           label: "涓ゅ勾",
+        },
+        {
+          value: 3,
+          label: "涓夊勾",
         },
       ], //鎵�灞為泦缇や笅鎷夋
       timeLength: null, //閫変腑鐨勬巿鏉冩椂闀�
       showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥
       showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐�
       activeEquipment: null, //澶勭悊涓殑璁惧
-      checkedData:[],
-      checkedMenu:[],
+      checkedData: [],
+      checkedMenu: [],
       ruleForm: {
         id: "",
         username: "",
@@ -358,7 +356,7 @@
     },
     editUser(row) {
       this.isShowAdd = true;
-      this.isEditing = true
+      this.isEditing = true;
       this.ruleForm.id = row.id;
       this.ruleForm.username = row.username;
       this.ruleForm.userType = row.userType;
@@ -367,9 +365,8 @@
       this.ruleForm.email = row.email;
       this.ruleForm.isChangePwd = row.isChangePwd;
       this.ruleForm.industryId = row.industryId;
-      this.ruleForm.areaId =row.areaId ;
-      debugger
-      this.ruleForm.address  = [ row.provinceId,row.areaId]
+      this.ruleForm.areaId = row.areaId;
+      this.ruleForm.address = [row.provinceId, row.areaId];
       this.ruleForm.provinceId = row.provinceId;
       this.ruleForm.authDuration = row.authDuration;
       this.checkedMenu = row.menuIds;
@@ -404,7 +401,7 @@
       this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys();
       this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys();
       let json = {
-        id: this.isEditing? this.ruleForm.id:"",
+        id: this.isEditing ? this.ruleForm.id : "",
         username: this.ruleForm.username,
         password: this.ruleForm.password,
         isChangePwd: this.ruleForm.isChangePwd,
@@ -417,25 +414,42 @@
         menuIds: this.ruleForm.menuIds,
         dataIds: this.ruleForm.dataIds,
       };
-      debugger
-      saveSubUser(json).then((res) => {
-        debugger;
-      });
+      saveSubUser(json)
+        .then((res) => {
+          if (res.success) {
+            this.$notify.success(res.data)
+            this.isShowAdd = false;
+            this.isEditing = false;
+            this.findUserList();
+          } else {
+            this.$notify.error(res.msg);
+          }
+        })
+        .catch((err) => {
+          this.$notify.error(err.message);
+        });
     },
     findUserList() {
       findUserList({
         inputText: this.inputText,
         page: this.page,
         size: this.size,
-      }).then((res) => {
-        if (res.success) {
-          this.dataList = res.data.dataList;
-        }
-      });
+      })
+        .then((res) => {
+          if (res.success) {
+            this.dataList = res.data.dataList;
+            this.total = res.data.total;
+          } else {
+            this.$notify.error("鍔犺浇瀛愯处鎴峰垪琛ㄥけ璐�");
+          }
+        })
+        .catch((e) => {
+          this.$notify.error(e.msg);
+        });
     },
     goback() {
       this.isShowAdd = false;
-      this.isEditing =false
+      this.isEditing = false;
       this.isShowRelate = false;
       this.activeIndex = 0;
     },
@@ -773,7 +787,7 @@
 
     .option {
       margin-right: 10px;
-         font-size: 14px;
+      font-size: 14px;
       color: rgb(0, 101, 255);
       cursor: pointer;
     }

--
Gitblit v1.8.0