From 62f32758a170157eb792720c21e6964e2f813fc7 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期一, 05 七月 2021 21:35:24 +0800
Subject: [PATCH] 应用中心和系统设置的修改

---
 src/pages/systemSettings/index/App.vue |   95 +++++++++++++++++++++++++++++++----------------
 1 files changed, 63 insertions(+), 32 deletions(-)

diff --git a/src/pages/systemSettings/index/App.vue b/src/pages/systemSettings/index/App.vue
index e5988b4..785be66 100644
--- a/src/pages/systemSettings/index/App.vue
+++ b/src/pages/systemSettings/index/App.vue
@@ -143,7 +143,6 @@
 
         <div class="change-pw" v-if="inAccountDetail && isChangePw">
           <div class="title">淇敼瀵嗙爜</div>
-
           <el-form
             :model="passwordForm"
             :rules="pwRules"
@@ -177,7 +176,7 @@
             </el-form-item>
           </el-form>
           <div class="btns">
-            <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
+            <div class="cancel" @click="cancelPassword">鍙栨秷</div>
             <div class="ok" @click="SaveNewPassword('passwordForm')">淇濆瓨</div>
           </div>
         </div>
@@ -255,6 +254,15 @@
                   placeholder="蹇呭~"
                   v-model="addForm.userName"
                 ></el-input>
+              </el-form-item>
+              <el-form-item prop="roleId">
+                <div class="p-title">瑙掕壊锛�</div>
+                <el-select
+                  v-model="addForm.roleId"
+                  placeholder="璇烽�夋嫨瑙掕壊"
+                >
+                  <el-option v-for="(item,i) in roleList" :key="i" :label="item.name" :value="item.id"></el-option>
+                </el-select>
               </el-form-item>
               <el-form-item prop="nickName">
                 <div class="p-title">鏄电О锛�</div>
@@ -461,7 +469,7 @@
         </div>
 
         <div class="btns">
-          <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
+          <div class="cancel" @click="cancelPassword">鍙栨秷</div>
           <div class="ok" @click="submitClock">淇濆瓨</div>
         </div>
       </div>
@@ -498,6 +506,7 @@
   deleteUser,
   getUserMenus,
   defHeadPics,
+  getRoles,
 } from "@/api/user";
 import switchBar from "../components/switchBar";
 import ipInput from "@/components/subComponents/IPInput";
@@ -570,6 +579,7 @@
       syncType: "1",
       equipmentTime: "",
       equipmentDate: "",
+      roleList: [],
       ntpTestLoading: false,
       settime: "",
       weekday: "",
@@ -608,6 +618,7 @@
         password: "",
         headpic: "",
         confirmPassword: "",
+        roleId:""
       },
       rules: {
         userName: [
@@ -620,21 +631,21 @@
           },
         ],
         password: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         confirmPassword: [{ validator: validatePass2, trigger: "blur" }],
       },
       pwRules: {
         // pw: [{ validator: validatePass3, trigger: "blur" }],
-         curPassword: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+        curPassword: [
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         newPassword: [
-            { required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur' },
-            { min: 6, message: '闀垮害鑷冲皯涓� 6 浣�', trigger: 'blur' }
-          ],
+          { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+          { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+        ],
         confirmPassword: [{ validator: validatePass4, trigger: "blur" }],
       },
     };
@@ -650,7 +661,7 @@
   methods: {
     fetchDefHeadPic() {
       defHeadPics().then((res) => {
-        res.data.slice(0, 5).forEach((x, i) => {
+        res.data.forEach((x, i) => {
           this.jpgArr[i] = x;
         });
       });
@@ -660,12 +671,12 @@
         this.accountArr = res.data;
         if (this.accountArr.length) {
           this.activeAccountItem = this.accountArr[0];
+          this.activeAccountIndex = 0
         }
         if (showLast) {
           this.cancelAdd();
           const lastIdx = this.accountArr.length - 1;
           this.openAccount(this.accountArr[lastIdx], lastIdx);
-          
         }
       });
     },
@@ -691,6 +702,8 @@
       this.activeAccountItem = item;
       this.activeAccountIndex = i;
       this.inAccountDetail = false;
+      this.cancelSet();
+      this.fetchMenu();
     },
     minusOne(typ) {
       this.isSyncBrowser = false;
@@ -749,14 +762,12 @@
     },
     fatherChange(item) {
       item.children.forEach((x) => {
-        x.selected = false;
+        x.selected = item.selected;
       });
     },
     childrenChange(item) {
       let isAllSelected = item.children.every((x) => x.selected == true);
-      let isAllNotSelected = item.children.every((x) => x.selected == false);
-      if (isAllSelected) item.selected = true;
-      if (isAllNotSelected) item.selected = false;
+      item.selected = isAllSelected
     },
     getMaxDay() {
       const maxDay = new Date(+this.syncYrs, +this.syncMonth, 0).getDate();
@@ -862,7 +873,10 @@
         id: this.activeAccountItem.id,
         menuIds: arr,
       }).then((res) => {
-        res.data;
+        if (res.success) {
+          this.$message.success(res.msg)
+          this.cancelSet()
+        }
       });
     },
     formatTime(number, format) {
@@ -895,6 +909,7 @@
       uploadHeadPic(param).then((res) => {
         let index = this.jpgArr.findIndex((x) => x == "");
         this.$set(this.jpgArr, index, res.data);
+        this.loadedPic= res.data
       });
     },
     initClockConf(ntpTest = false) {
@@ -955,15 +970,21 @@
     showAddAccount() {
       this.inAccountDetail = false;
       this.isAddAccount = true;
+      getRoles().then((res) => {
+        if (res.success) {
+          this.roleList= res.data
+        }
+      });
     },
     cancelAdd() {
       this.inAccountDetail = false;
       this.isAddAccount = false;
+      this.$refs["addForm"].resetFields();
     },
-    cancelChangePassword() {
+    cancelPassword() {
       this.isChangePw = false;
       this.inAccountDetail = false;
-      this.$refs['passwordForm'].resetFields()
+      this.$refs["passwordForm"].resetFields();
     },
     SaveNewPassword(formName) {
       this.$refs[formName].validate((valid) => {
@@ -973,7 +994,10 @@
             newPwd: this.passwordForm.newPassword,
           }).then(
             (res) => {
-              this.$message.success(res.data);
+              if(res.success) {
+                this.$message.success(res.msg);
+              this.cancelPassword()
+              }
             },
             (err) => {
               this.$message.warning("淇濆瓨澶辫触锛�" + err.msg);
@@ -1039,6 +1063,7 @@
     cancelSet() {
       this.isSetPermission = false;
       this.inAccountDetail = false;
+      this.sysMenus = [];
     },
     showChangePassword() {
       this.isChangePw = true;
@@ -1086,10 +1111,11 @@
     openPermission() {
       this.inAccountDetail = true;
       this.isSetPermission = true;
-      this.fetchMenu();
+      if (this.sysMenus.length==0) {
+        this.fetchMenu()
+      } 
     },
     parseTime() {
-      debugger;
       [this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split(
         "-"
       );
@@ -1168,8 +1194,7 @@
     .account-left {
       .add-account {
         color: rgba(61, 104, 225, 1);
-        margin-top: 50px;
-
+        margin-top: 30px;
         .iconfont {
           cursor: pointer;
           font-size: 32px;
@@ -1298,7 +1323,7 @@
               margin: 5px 15px;
               height: 30px;
               line-height: 30px;
-              width: 90px;
+              // width: 90px;
               text-align: left;
               font-size: 15px;
               display: flex;
@@ -1319,7 +1344,7 @@
             }
             .user-role {
               margin: 5px 0 0 15px;
-              font-size: 14px;
+              font-size: 14px;    color: darkseagreen;
             }
           }
         }
@@ -1400,7 +1425,7 @@
 
       .add-account-page {
         .upload-group {
-          height: 130px;
+          height: 120px;
           width: 360px;
           margin: 0 auto;
           overflow: hidden;
@@ -1409,7 +1434,7 @@
             width: 46px;
             float: left;
             margin: 0 10px;
-            margin-bottom: 20px;
+            margin-bottom: 10px;
             background-color: rgba(242, 242, 242, 1);
             border: 3px solid transparent;
             border-radius: 50%;
@@ -1429,7 +1454,7 @@
             display: flex;
             background-color: rgba(242, 242, 242, 1);
             margin: 0 10px;
-            margin-bottom: 20px;
+            margin-bottom: 10px;
             border-radius: 25px;
             justify-content: center;
             align-items: center;
@@ -1441,8 +1466,14 @@
         }
         .fill-group {
           .p-title {
+                height: 34px;
             text-align: left;
           }
+          .el-form-item{
+            .el-select {
+    width: 100%;
+}
+          }
         }
       }
     }

--
Gitblit v1.8.0