From 05d754bb09ba4aeddd60320d33d583d388434c2f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期一, 20 十二月 2021 15:38:45 +0800
Subject: [PATCH] 树形组件修改
---
src/pages/systemSettings/index/App.vue | 1003 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 774 insertions(+), 229 deletions(-)
diff --git a/src/pages/systemSettings/index/App.vue b/src/pages/systemSettings/index/App.vue
index b13a647..ef71b7c 100644
--- a/src/pages/systemSettings/index/App.vue
+++ b/src/pages/systemSettings/index/App.vue
@@ -1,11 +1,12 @@
<template>
- <div class="container">
+ <div class="container" v-if="!showWelcome">
<div class="container-left">
<div
class="left-card"
+ :class="activeIndex == index ? 'left-card-active' : ''"
v-for="(item, index) in menuArr"
:key="index"
- @click="openMenu(item, index)"
+ @click="openMenu(item.name, index)"
>
<span class="icon iconfont"></span>
<span class="card-text">{{ item.name }}</span>
@@ -20,13 +21,21 @@
<div class="account-list">
<div
class="account-card"
+ :class="activeAccountIndex == index ? 'account-card-active' : ''"
v-for="(item, index) in accountArr"
:key="index"
+ ref="account-card"
+ @click="openAccount(item, index)"
>
<div class="touxiang">
- <img src="" alt="" />
+ <img
+ v-if="item.headpic"
+ :src="`data:image/png;base64,${item.headpic}`"
+ alt=""
+ />
+
</div>
- <span class="user-name">{{ item.name }}</span>
+ <span class="user-name">{{ item.username }}</span>
</div>
</div>
<div class="add-account">
@@ -45,16 +54,23 @@
<span class="week">{{ weekday }}</span>
</div>
</div>
-
<div class="line">
<div class="name">NTP鏍℃椂</div>
- <el-switch v-model="isNtp" active-color="rgba(61, 104, 225, 1)">
+ <el-switch
+ v-model="isNtp"
+ @change="changeSwitch('isNtp')"
+ active-color="rgba(61, 104, 225, 1)"
+ >
</el-switch>
</div>
<div class="line">
<div class="name">鎵嬪姩鏍″</div>
- <el-switch v-model="isManual" active-color="rgba(61, 104, 225, 1)">
+ <el-switch
+ v-model="isManual"
+ @change="changeSwitch('isManual')"
+ active-color="rgba(61, 104, 225, 1)"
+ >
</el-switch>
</div>
</div>
@@ -64,14 +80,49 @@
v-if="activePage == '璐︽埛' || activePage == '鏃ユ湡鏃堕棿'"
>
<div class="account-right" v-if="activePage == '璐︽埛'">
- <div class="account-content" v-if="inAccountDetail == false">
+ <div
+ class="account-content"
+ v-if="inAccountDetail == false && isAddAccount == false"
+ >
<div class="content-top">
- <div class="touxiang-big"></div>
+ <div class="touxiang-big">
+ <img
+ v-if="activeAccountItem.headpic"
+ :src="`data:image/png;base64,${activeAccountItem.headpic}`"
+ alt=""
+ />
+ </div>
<div class="user-desc">
- <div class="username">椋炲埄娴�</div>
+ <div class="username">
+ <span class="icon iconfont" style="margin-right: 5px"
+ ></span
+ >
+ <span>{{ activeAccountItem.username }}</span>
+ </div>
<div class="nickname">
- <span>鍏斿厰</span>
- <span class="icon iconfont"></span>
+ <span>鏄电О锛�</span>
+ <span v-show="!showInputNickName">{{
+ activeAccountItem.nickname
+ }}</span>
+ <input
+ type="text"
+ class="input-nick"
+ ref="input-nick"
+ v-show="showInputNickName"
+ v-model="inputNickName"
+ @blur="hideInputNick"
+ @keydown.enter="blurInputNick"
+ />
+ <span class="icon iconfont" @click="editNickName"
+ ></span
+ >
+ </div>
+ <div class="user-role">
+ {{
+ activeAccountItem.sysRoles.length
+ ? activeAccountItem.sysRoles[0].name
+ : ""
+ }}
</div>
</div>
</div>
@@ -84,118 +135,164 @@
<div class="change-pw" v-if="inAccountDetail && isChangePw">
<div class="title">淇敼瀵嗙爜</div>
+ <el-form
+ :model="passwordForm"
+ :rules="pwRules"
+ ref="passwordForm"
+ class="password-form"
+ >
+ <el-form-item prop="curPassword">
+ <div class="p-title">褰撳墠瀵嗙爜锛�</div>
- <div class="p-title">褰撳墠瀵嗙爜锛�</div>
-
- <el-input
- placeholder="蹇呭~"
- v-model="input1"
- show-password
- ></el-input>
- <div class="p-title">鏂板瘑鐮侊細</div>
- <el-input
- placeholder="蹇呭~"
- v-model="input2"
- show-password
- ></el-input>
- <div class="p-title">纭瀵嗙爜锛�</div>
- <el-input
- placeholder="蹇呭~"
- v-model="input3"
- show-password
- ></el-input>
-
+ <el-input
+ placeholder="蹇呭~"
+ v-model="passwordForm.curPassword"
+ show-password
+ ></el-input>
+ </el-form-item>
+ <el-form-item prop="newPassword">
+ <div class="p-title">鏂板瘑鐮侊細</div>
+ <el-input
+ placeholder="蹇呭~"
+ v-model="passwordForm.newPassword"
+ show-password
+ ></el-input>
+ </el-form-item>
+ <el-form-item prop="confirmPassword">
+ <div class="p-title">纭瀵嗙爜锛�</div>
+ <el-input
+ placeholder="蹇呭~"
+ v-model="passwordForm.confirmPassword"
+ show-password
+ ></el-input>
+ </el-form-item>
+ </el-form>
<div class="btns">
- <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
- <div class="ok">淇濆瓨</div>
+ <div class="cancel" @click="cancelPassword">鍙栨秷</div>
+ <div class="ok" @click="SaveNewPassword('passwordForm')">淇濆瓨</div>
</div>
</div>
<div class="permission" v-if="inAccountDetail && isSetPermission">
<div class="title">鏉冮檺绠$悊</div>
- <div class="line">
- <div class="name">瀹炴椂鐩戞帶</div>
- <el-switch
- v-model="isRealtime"
- active-color="rgba(61, 104, 225, 1)"
- >
- </el-switch>
+ <div class="line-wrap" v-for="item in sysMenus" :key="item.id">
+ <div class="line">
+ <div class="name">{{ item.name }}</div>
+ <el-switch
+ v-model="item.selected"
+ active-color="rgba(61, 104, 225, 1)"
+ @change="fatherChange(item)"
+ >
+ </el-switch>
+ </div>
+ <div v-if="item.children">
+ <div
+ class="line"
+ style="margin-left: 55px"
+ v-for="x in item.children"
+ :key="x.id"
+ >
+ <div class="name">{{ x.name }}</div>
+ <el-switch
+ v-model="x.selected"
+ active-color="rgba(61, 104, 225, 1)"
+ @change="childrenChange(item)"
+ >
+ </el-switch>
+ </div>
+ </div>
</div>
- <div class="line">
- <div class="name">缁熻鏌ヨ</div>
- <el-switch v-model="isCount" active-color="rgba(61, 104, 225, 1)">
- </el-switch>
- </div>
- <div class="line">
- <div class="name">绠楀姏绠$悊</div>
- <el-switch
- v-model="isCalculate"
- active-color="rgba(61, 104, 225, 1)"
- >
- </el-switch>
- </div>
-
<div class="btns">
<div class="cancel" @click="cancelSet">鍙栨秷</div>
- <div class="ok">淇濆瓨</div>
+ <div class="ok" @click="saveAuth">淇濆瓨</div>
</div>
</div>
- <div class="add-account-page" v-if="inAccountDetail && isAddAccount">
+ <div class="add-account-page" v-if="isAddAccount">
<div class="title">娣诲姞璐︽埛</div>
<div class="upload-group">
<div
class="upload-jpg"
+ :class="
+ selectedPic == index? 'upload-jpg-border' : ''
+ "
v-for="(item, index) in jpgArr"
:key="index"
- ></div>
- <div
- class="upload-jpg"
- style="height: 0px; visibility: hidden"
- ></div>
- <div
- class="upload-jpg"
- style="height: 0px; visibility: hidden"
- ></div>
- <div
- class="upload-jpg"
- style="height: 0px; visibility: hidden"
- ></div>
- <div
- class="upload-jpg"
- style="height: 0px; visibility: hidden"
- ></div>
+ @click="pickHeadDefPic(item, index)"
+ >
+ <img
+ v-if="item"
+ :src="`data:image/png;base64,${item.path}`"
+ alt=""
+ srcset=""
+ />
+ <div class="img-mask" v-if="selectedPic == index">
+ <span class="icon iconfont enable"></span>
+ </div>
+ </div>
+ <!-- <el-upload
+ class="upload-demo"
+ action="https://jsonplaceholder.typicode.com/posts/"
+ :show-file-list="false"
+ :http-request="uploadUserPic"
+ >
+ <div v-if="loadedPic == ''" class="upload-jpg-up">涓婁紶</div>
+ </el-upload> -->
</div>
<div class="fill-group">
- <div class="p-title">鐢ㄦ埛鍚嶏細</div>
- <el-input
- placeholder="蹇呭~"
- v-model="input1"
- show-password
- ></el-input>
- <div class="p-title">鏄电О</div>
- <el-input
- placeholder="閫夊~"
- v-model="input2"
- show-password
- ></el-input>
- <div class="p-title">瀵嗙爜锛�</div>
- <el-input
- placeholder="蹇呭~"
- v-model="input3"
- show-password
- ></el-input>
- <div class="p-title">纭瀵嗙爜锛�</div>
- <el-input
- placeholder="蹇呭~"
- v-model="input3"
- show-password
- ></el-input>
+ <el-form
+ :model="addForm"
+ :rules="rules"
+ ref="addForm"
+ class="add-form"
+ >
+ <el-form-item prop="userName">
+ <div class="p-title">鐢ㄦ埛鍚嶏細</div>
+ <el-input
+ 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>
+ <el-input
+ placeholder="閫夊~"
+ v-model="addForm.nickName"
+ ></el-input>
+ </el-form-item>
+ <el-form-item prop="password">
+ <div class="p-title">瀵嗙爜锛�</div>
+ <el-input
+ placeholder="蹇呭~"
+ v-model="addForm.password"
+ show-password
+ ></el-input>
+ </el-form-item>
+ <el-form-item prop="confirmPassword">
+ <div class="p-title">纭瀵嗙爜锛�</div>
+ <el-input
+ placeholder="蹇呭~"
+ v-model="addForm.confirmPassword"
+ show-password
+ ></el-input>
+ </el-form-item>
+ </el-form>
</div>
<div class="btns">
<div class="cancel" @click="cancelAdd">鍙栨秷</div>
- <div class="ok">淇濆瓨</div>
+ <div class="ok" @click="saveAddAccount('addForm')">淇濆瓨</div>
</div>
</div>
</div>
@@ -221,8 +318,6 @@
size="small"
:controls="false"
></el-input-number>
- <!-- :disabled="syncType === '2'" -->
- <!-- :disabled="syncType === '2'" -->
<el-button
type="text"
@click="testNTP"
@@ -337,37 +432,45 @@
</div>
<div class="adjust-bar">
<div class="minus" @click="minusOne('mth')">-</div>
- <div class="middle">
-
- <span v-show="!showMonthInput">{{ syncMonth }}</span>
+ <div class="middle" @click="showInput('Month')">
+ <span v-show="!showMonthInput">{{ syncMonth }}</span>
<input
class="input-box"
v-show="showMonthInput"
- ref="iptYrs"
- oninput="value=value.replace(/[^\d]/g,'');if(value.length>4)value=value.slice(0,4);"
+ ref="iptMonth"
+ oninput="value=value.replace(/[^\d]/g,'');if(value.length>2)value=value.slice(0,2);if(+value>12)value='12'"
type="text"
v-model="inputMonth"
@blur="hideInput('Month')"
@keydown.enter="hideInput('Month')"
/>
鏈�
-
-
</div>
-
-
<div class="plus" @click="plusOne('mth')">+</div>
</div>
<div class="adjust-bar">
<div class="minus" @click="minusOne('day')">-</div>
- <div class="middle">{{ syncDay }} 鏃�</div>
+ <div class="middle" @click="showInput('Day')">
+ <span v-show="!showDayInput">{{ syncDay }}</span>
+ <input
+ class="input-box"
+ v-show="showDayInput"
+ ref="iptDay"
+ oninput="value=value.replace(/[^\d]/g,'');if(value.length>2)value=value.slice(0,2);if(+value>31)value='31'"
+ type="text"
+ v-model="inputDay"
+ @blur="hideInput('Day')"
+ @keydown.enter="hideInput('Day')"
+ />
+ 鏃�
+ </div>
<div class="plus" @click="plusOne('day')">+</div>
</div>
</div>
<div class="btns">
- <div class="cancel" @click="cancelChangePassword">鍙栨秷</div>
+ <div class="cancel" @click="cancelPassword">鍙栨秷</div>
<div class="ok" @click="submitClock">淇濆瓨</div>
</div>
</div>
@@ -390,20 +493,60 @@
style="width: 100%"
></generalSettings>
</div>
+ <div class="welcome-page" v-else>
+ <div class="child" @click="openWelcome('璐︽埛',0)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">璐︽埛</span>
+ </div>
+ </div>
+ <div class="child" @click="openWelcome('鏃ユ湡鏃堕棿',1)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">鏃ユ湡鏃堕棿</span>
+ </div>
+ </div>
+ <div class="child" @click="openWelcome('闆嗙兢绠$悊',2)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">闆嗙兢绠$悊</span>
+ </div>
+ </div>
+ <div class="child" @click="openWelcome('缃戠粶璁剧疆',3)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">缃戠粶璁剧疆</span>
+ </div>
+ </div>
+ <div class="child" @click="openWelcome('閿洏鍜岃瑷�',4)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">閿洏鍜岃瑷�</span>
+ </div>
+ </div>
+ <div class="child" @click="openWelcome('閫氱敤璁剧疆',5)">
+ <div class="child-info">
+ <span class="icon iconfont welcome-icon"></span>
+ <span class="welcome-title">閫氱敤璁剧疆</span>
+ </div>
+ </div>
+ </div>
</template>
<script>
+import { getClockInfo, saveClockInfo, testNTPserver } from "@/api/system";
import {
- getDevInfo,
- getAlarmConfig,
- saveDevInfo,
- saveAlarmConfig,
- getClockInfo,
- saveClockInfo,
- testNTPserver,
- getResourceConfig,
- saveResourceConfig,
-} from "@/api/system";
+ uploadHeadPic,
+ addUser,
+ getUsers,
+ updateUser,
+ updataUser,
+ updatePassword,
+ deleteUser,
+ getUserMenus,
+ defHeadPics,
+ getRoles,
+} from "@/api/user";
import switchBar from "../components/switchBar";
import ipInput from "@/components/subComponents/IPInput";
import clusterManagement from "../views/clusterManagement";
@@ -421,11 +564,31 @@
generalSettings,
},
data() {
+ var validatePass2 = (rule, value, callback) => {
+ if (value === "") {
+ callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�"));
+ } else if (value !== this.addForm.password) {
+ callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!"));
+ } else {
+ callback();
+ }
+ };
+ var validatePass4 = (rule, value, callback) => {
+ if (value === "") {
+ callback(new Error("璇峰啀娆¤緭鍏ュ瘑鐮�"));
+ } else if (value !== this.passwordForm.newPassword) {
+ callback(new Error("涓ゆ杈撳叆瀵嗙爜涓嶄竴鑷�!"));
+ } else {
+ callback();
+ }
+ };
return {
showAccount: true,
syncYrs: "",
+ activeAccountItem: {},
syncMonth: "",
syncHour: "",
+ showWelcome: true,
syncDay: "",
syncMin: "",
syncSec: "00",
@@ -437,11 +600,17 @@
browserTimer: null,
timezone: "",
isRealtime: false,
+ inputNickName: "",
showHourInput: false,
showMinInput: false,
showSecInput: false,
showYrsInput: false,
-
+ showMonthInput: false,
+ selectedPic: null,
+ showDayInput: false,
+ loadedPic: "",
+ cameraInfo: false,
+ dependentScene: false,
timestamp: 0,
inAccountDetail: false,
isChangePw: false,
@@ -451,6 +620,7 @@
syncType: "1",
equipmentTime: "",
equipmentDate: "",
+ roleList: [],
ntpTestLoading: false,
settime: "",
weekday: "",
@@ -462,8 +632,8 @@
{ name: "閿洏鍜岃瑷�" },
{ name: "閫氱敤璁剧疆" },
],
- accountArr: [{ name: "璐濊拏" }, { name: "鏈辫开" }, { name: "鍗″皵" }],
- jpgArr: [{}, {}, {}, {}, {}, {}, {}, {}, {}],
+ accountArr: [],
+ jpgArr: [],
isManual: false,
isNtp: true,
activePage: "璐︽埛",
@@ -473,6 +643,52 @@
inputMin: "",
inputSec: "",
inputYrs: "",
+ showInputNickName: false,
+ inputMonth: "",
+ inputDay: "",
+ passwordForm: {
+ curPassword: "",
+ newPassword: "",
+ confirmPassword: "",
+ },
+ activeAccountIndex: 0,
+ sysMenus: [],
+ addForm: {
+ userName: "",
+ nickName: "",
+ password: "",
+ headpic: "",
+ confirmPassword: "",
+ roleId: "",
+ },
+ rules: {
+ userName: [
+ { required: true, message: "璇疯緭鍏ョ敤鎴峰悕", trigger: "blur" },
+ {
+ min: 3,
+ max: 10,
+ message: "闀垮害鍦� 3 鍒� 10 涓瓧绗�",
+ trigger: "blur",
+ },
+ ],
+ password: [
+ { 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" },
+ ],
+ newPassword: [
+ { required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur" },
+ { min: 6, message: "闀垮害鑷冲皯涓� 6 浣�", trigger: "blur" },
+ ],
+ confirmPassword: [{ validator: validatePass4, trigger: "blur" }],
+ },
};
},
beforeDestroy() {
@@ -480,16 +696,54 @@
clearInterval(this.browserTimer);
},
mounted() {
- const s = document.getElementsByClassName("left-card")[0];
- s.style.backgroundColor = "rgba(61, 104, 225, 1)";
- s.style.color = "#fff";
- this.$nextTick(() => {
- // this.initSysinfo();
- // this.initResourceConfig();
- this.initClockConf();
- });
+ this.fetchUserList();
+ this.fetchDefHeadPic();
},
methods: {
+ fetchDefHeadPic() {
+ defHeadPics().then((res) => {
+ this.jpgArr = res.data;
+ });
+ },
+ fetchUserList(showLast = false) {
+ getUsers().then((res) => {
+ 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);
+ }
+ });
+ },
+ blurInputNick() {
+ this.$refs["input-nick"].blur();
+ },
+ editNickName() {
+ this.showInputNickName = true;
+ this.inputNickName = this.activeAccountItem.nickname;
+ this.$refs["input-nick"].focus();
+ },
+ hideInputNick() {
+ this.showInputNickName = false;
+ updateUser({
+ id: this.activeAccountItem.id,
+ nickname: this.inputNickName,
+ }).then((res) => {
+ this.$message.success(res.msg);
+ this.fetchUserList(true);
+ });
+ },
+ openAccount(item, i) {
+ this.activeAccountItem = item;
+ this.activeAccountIndex = i;
+ this.inAccountDetail = false;
+ this.cancelSet();
+ this.fetchMenu();
+ },
minusOne(typ) {
this.isSyncBrowser = false;
this.syncBrowser(false);
@@ -545,11 +799,14 @@
break;
}
},
- getMaxDay() {
- const maxDay = new Date(+this.syncYrs, +this.syncMonth, 0).getDate();
- if (this.syncDay > maxDay) {
- this.syncDay = maxDay;
- }
+ fatherChange(item) {
+ item.children.forEach((x) => {
+ x.selected = item.selected;
+ });
+ },
+ childrenChange(item) {
+ let isAllSelected = item.children.every((x) => x.selected == true);
+ item.selected = isAllSelected;
},
plusOne(typ) {
this.isSyncBrowser = false;
@@ -594,7 +851,6 @@
if (num > maxDay) {
num = 1;
}
- //
this.syncDay = this.padZero(num);
break;
default:
@@ -603,7 +859,7 @@
},
submitClock() {
if (this.syncType === "1") {
- if (this.ntpServer === "") {
+ if (this.ntpServer === "" || this.ntpServer === "...") {
this.$notify({
type: "error",
message: "NTP 鏈嶅姟鍣ㄥ湴鍧�涓嶈兘涓虹┖",
@@ -612,7 +868,7 @@
} else if (this.timeInterval === "") {
this.timeInterval = 1;
}
- } else {
+ } else if (this.isSyncBrowser) {
if (this.settime === "") {
this.$notify({
type: "error",
@@ -620,15 +876,16 @@
});
return false;
}
+ } else {
+ this.settime = `${this.syncYrs}-${this.syncMonth}-${this.syncDay} ${this.syncHour}:${this.syncMin}:${this.syncSec}`;
}
- let requestBody = {
+ saveClockInfo({
timeZone: this.timezone,
ntp: this.syncType === "1",
ntpServer: this.ntpServer,
interval: this.timeInterval,
newTime: this.settime,
- };
- saveClockInfo(requestBody).then((rsp) => {
+ }).then((rsp) => {
if (rsp && rsp.success) {
this.$notify({
type: "success",
@@ -638,19 +895,35 @@
this.initClockConf();
});
},
+ flatGetArr(arr, res) {
+ for (const item of arr) {
+ if (item.selected) res.push(item.id);
+ if (item.children) this.flatGetArr(item.children, res);
+ }
+ },
+ saveAuth() {
+ let arr = [];
+ this.flatGetArr(this.sysMenus, arr);
+ updataUser({
+ id: this.activeAccountItem.id,
+ menuIds: arr,
+ }).then((res) => {
+ if (res.success) {
+ this.$message.success(res.msg);
+ this.cancelSet();
+ }
+ });
+ },
formatTime(number, format) {
var formateArr = ["Y", "M", "D", "h", "m", "s"];
var returnArr = [];
-
var date = new Date(number * 1000);
returnArr.push(date.getFullYear());
returnArr.push(this.formatNumber(date.getMonth() + 1));
returnArr.push(this.formatNumber(date.getDate()));
-
returnArr.push(this.formatNumber(date.getHours()));
returnArr.push(this.formatNumber(date.getMinutes()));
returnArr.push(this.formatNumber(date.getSeconds()));
-
this.weekday = "鏄熸湡" + "鏃ヤ竴浜屼笁鍥涗簲鍏�".charAt(date.getDay());
for (var i in returnArr) {
format = format.replace(formateArr[i], returnArr[i]);
@@ -661,17 +934,26 @@
n = +n;
return n < 10 ? "0" + n : "" + n;
},
- //鏁版嵁杞寲
formatNumber(n) {
n = n.toString();
return n[1] ? n : "0" + n;
},
+ // uploadUserPic(params) {
+ // let param = new FormData();
+ // param.append("file", params.file);
+ // uploadHeadPic(param).then((res) => {
+ // this.jpgArr.push(res.data);
+ // this.loadedPic = res.data;
+ // });
+ // },
initClockConf(ntpTest = false) {
getClockInfo().then((rsp) => {
if (rsp && rsp.success) {
this.timezone = rsp.data.time_zone;
if (!ntpTest) {
this.syncType = rsp.data.ntp ? "1" : "2";
+ this.isNtp = rsp.data.ntp;
+ this.isManual = !rsp.data.ntp;
}
if (rsp.data.ntp) {
this.ntpServer = rsp.data.ntp_server;
@@ -680,22 +962,21 @@
this.timestamp = rsp.data.local_time;
if (this.clockTimer === null) {
this.runClock();
+ if (this.isManual) this.parseTime();
}
}
});
},
- openMenu(item, i) {
- const old = document.getElementsByClassName("left-card")[
- this.activeIndex
- ];
- old.style.backgroundColor = "initial";
- old.style.color = "rgba(81, 81, 81, 1)";
-
- this.activePage = item.name;
+ openMenu(name, i) {
+ this.activePage = name;
this.activeIndex = i;
- const s = document.getElementsByClassName("left-card")[i];
- s.style.backgroundColor = "rgba(61, 104, 225, 1)";
- s.style.color = "#fff";
+ if (this.activePage == "鏃ユ湡鏃堕棿") {
+ this.initClockConf();
+ }
+ },
+ openWelcome(name,i){
+ this.showWelcome = false
+ this.openMenu(name,i)
},
showInput(typ) {
this[`show${typ}Input`] = true;
@@ -710,10 +991,9 @@
this[`show${typ}Input`] = false;
this[`input${typ}`] = "";
},
- syncBrowser(val) {
- this.isSyncBrowser = val;
- if (val == false) {
- console.log(12121);
+ syncBrowser(enable) {
+ this.isSyncBrowser = enable;
+ if (!enable) {
clearInterval(this.browserTimer);
} else {
this.browserTimer = setInterval(() => {
@@ -725,18 +1005,73 @@
}, 1000);
}
},
- openChangePw() {},
showAddAccount() {
- this.inAccountDetail = true;
+ 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();
+ this.selectedPic = null;
},
- cancelChangePassword() {
+ cancelPassword() {
this.isChangePw = false;
this.inAccountDetail = false;
+ this.$refs["passwordForm"].resetFields();
+ },
+ SaveNewPassword(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ updatePassword({
+ oldPwd: this.passwordForm.curPassword,
+ newPwd: this.passwordForm.newPassword,
+ }).then(
+ (res) => {
+ if (res.success) {
+ this.$message.success(res.msg);
+ this.cancelPassword();
+ }
+ },
+ (err) => {
+ this.$message.warning("淇濆瓨澶辫触锛�" + err.msg);
+ }
+ );
+ }
+ });
+ },
+ saveAddAccount(formName) {
+ this.$refs[formName].validate((valid) => {
+ if (valid) {
+ let data = {
+ username: this.addForm.userName,
+ password: this.addForm.password,
+ nickname: this.addForm.nickName,
+ headpic: this.addForm.headpic,
+ };
+ addUser(data).then(
+ (res) => {
+ this.$message.success(res.data);
+ this.fetchUserList(true);
+ },
+ (err) => {
+ this.$message.warning("淇濆瓨澶辫触锛�" + err.msg);
+ }
+ );
+ } else {
+ console.log("error submit!!");
+ return false;
+ }
+ });
+ },
+ pickHeadDefPic(item, i) {
+ this.addForm.headpic = item.path;
+ this.selectedPic = i;
},
testNTP() {
this.ntpTestLoading = true;
@@ -767,6 +1102,7 @@
cancelSet() {
this.isSetPermission = false;
this.inAccountDetail = false;
+ this.sysMenus = [];
},
showChangePassword() {
this.isChangePw = true;
@@ -785,42 +1121,110 @@
cancelButtonText: "鍙栨秷",
})
.then(() => {
- this.$message({
- type: "success",
- message: "鍒犻櫎鎴愬姛!",
+ let obj = {
+ ids: [this.activeAccountItem.id],
+ };
+ deleteUser(obj).then((res) => {
+ if (res.success) {
+ this.fetchUserList();
+ this.$message({
+ type: "success",
+ message: "鍒犻櫎鎴愬姛!",
+ });
+ } else {
+ this.$message.warning("鍒犻櫎澶辫触");
+ }
});
})
.catch(() => {});
},
+ fetchMenu() {
+ getUserMenus({
+ userId: this.activeAccountItem.id,
+ }).then((res) => {
+ if (res && res.success) {
+ this.sysMenus = res.data;
+ }
+ });
+ },
openPermission() {
this.inAccountDetail = true;
this.isSetPermission = true;
- },
- },
-
- watch: {
- isManual(v) {
- this.isNtp = !v;
- v && (this.syncType = "2");
- if (v) {
- [
- this.syncYrs,
- this.syncMonth,
- this.syncDay,
- ] = this.equipmentDate.split("-");
- [this.syncHour, this.syncMin, this.syncSec] = this.equipmentTime.split(
- ":"
- );
+ if (this.sysMenus.length == 0) {
+ this.fetchMenu();
}
},
- isNtp(v) {
- this.isManual = !v;
- v && (this.syncType = "1");
+ parseTime() {
+ [this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split(
+ "-"
+ );
+ [this.syncHour, this.syncMin, this.syncSec] = this.equipmentTime.split(
+ ":"
+ );
+ },
+ changeSwitch(str) {
+ if (str == "isNtp") {
+ this.isManual = !this[str];
+ } else {
+ this.isNtp = !this[str];
+ }
+ this.syncType = this.isNtp ? "1" : "2";
+ if (this.isManual) this.parseTime();
+ },
+ },
+ computed: {
+ isShowAddAccount() {
+ const info = JSON.parse(sessionStorage.getItem("userInfo"));
+ return true;
},
},
};
</script>
<style lang="scss">
+.welcome-page {
+ width: 100%;
+ height: 100%;
+ background-color: #f5f5f5;
+ display: -ms-flexbox;
+ padding: 0 50px;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ .child {
+ box-sizing: border-box;
+ background-color: white;
+ -webkit-box-flex: 0;
+ -ms-flex: 0 0 33.3%;
+ /* flex: 0 0 16%; */
+ float: left;
+ width: 250px;
+ height: 200px;
+ margin: 50px 57px 30px 57px;
+ border-radius: 20px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ cursor: pointer;
+ .child-info {
+ display: flex;
+ flex-direction: column;
+ height: 62%;
+ justify-content: space-around;
+ .welcome-icon {
+ font-size: 72px;
+ }
+ .welcome-title {
+ font-size: 18px;
+ }
+ }
+ }
+ .child:hover {
+ -moz-box-shadow: 5px 5px 10px #ddd;
+ -webkit-box-shadow: 5px 5px 10px #ddd;
+ box-shadow: 5px 5px 10px #ddd;
+ transform: translate3d(0,-2.5px,0);
+ transition: all 0.3s;
+}
+}
.container {
height: 100%;
display: flex;
@@ -830,7 +1234,7 @@
box-sizing: border-box;
.container-left {
height: 100%;
- width: 210px;
+ width: 230px;
overflow: auto;
box-sizing: border-box;
flex-shrink: 0;
@@ -853,6 +1257,10 @@
font-size: 16px;
}
}
+ .left-card-active {
+ background-color: rgba(61, 104, 225, 1);
+ color: #fff;
+ }
.left-card:hover {
background-color: rgba(61, 104, 225, 1);
color: #fff;
@@ -867,31 +1275,46 @@
border-right: 5px solid rgba(248, 248, 248, 1);
box-sizing: border-box;
.account-left {
- .account-list {
- height: 530px;
- }
.add-account {
color: rgba(61, 104, 225, 1);
+ margin-top: 30px;
.iconfont {
cursor: pointer;
- font-size: 30px;
+ font-size: 32px;
}
}
.account-card {
- height: 40px;
- background-color: goldenrod;
+ height: 50px;
+ background-color: rgba(248, 248, 248, 1);
margin-bottom: 10px;
display: flex;
align-items: center;
padding: 0 20px;
+ box-sizing: border-box;
+ border-radius: 10px;
+ cursor: pointer;
.touxiang {
- height: 30px;
- width: 30px;
- background-color: green;
+ height: 35px;
+ width: 35px;
+ background-color: bisque;
+ border-radius: 17.5px;
+ img {
+ border: none;
+
+ height: 35px;
+ width: 35px;
+ border-radius: 17.5px;
+ }
}
.user-name {
margin-left: 10px;
+ font-size: 14px;
}
+ }
+
+ .account-card-active {
+ background-color: rgba(61, 104, 225, 1);
+ color: #fff;
}
}
.datetime-left {
@@ -953,28 +1376,59 @@
.account-right {
.account-content {
.content-top {
- height: 150px;
- background-color: antiquewhite;
+ height: 120px;
+ width: 350px;
+ margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
+ margin-bottom: 20px;
.touxiang-big {
width: 100px;
height: 100px;
- background-color: indigo;
+ background-color: bisque;
+ border-radius: 50px;
+ img {
+ border: none;
+
+ width: 100px;
+ height: 100px;
+ border-radius: 50px;
+ }
}
.user-desc {
- background-color: khaki;
height: 100px;
- width: 150px;
display: flex;
flex-direction: column;
align-items: baseline;
+ min-width: 200px;
.username {
margin: 5px 15px;
+ height: 30px;
+ line-height: 30px;
+ // width: 90px;
+ text-align: left;
+ font-size: 15px;
+ display: flex;
+ align-items: center;
}
.nickname {
margin: 5px 15px;
+ font-size: 14px;
+ .input-nick {
+ width: 50px;
+ margin-right: 5px;
+ }
+ .iconfont {
+ font-size: 14px;
+ margin-left: 5px;
+ cursor: pointer;
+ }
+ }
+ .user-role {
+ margin: 5px 0 0 15px;
+ font-size: 14px;
+ color: darkseagreen;
}
}
}
@@ -985,15 +1439,56 @@
align-items: center;
.item-btn {
width: 500px;
- height: 50px;
- background-color: rgba(240, 240, 240, 1);
- margin-bottom: 10px;
+ height: 45px;
+ background-color: #f0f0f0;
+ margin-bottom: 15px;
+ border-radius: 10px;
+ line-height: 45px;
+ font-size: 15px;
+ cursor: pointer;
+ }
+ .item-btn:hover {
+ color: rgba(255, 153, 102, 1);
}
}
+ }
+ .title {
+ height: 30px;
+ line-height: 30px;
+ /* background-color: aliceblue; */
+ margin-bottom: 10px;
+ font-size: 16px;
+ font-weight: 600;
}
.change-pw {
.p-title {
text-align: left;
+ font-size: 15px;
+ margin-top: 5px;
+ }
+ }
+ .el-form-item {
+ margin-bottom: 0;
+ .el-input__inner {
+ background-color: rgba(240, 240, 240, 1);
+ border: none;
+ border-radius: 12px;
+ height: 45px;
+ padding: 0 20px;
+ font-size: 15px;
+ }
+ .el-input__clear {
+ color: dimgray;
+ font-size: 17px;
+ line-height: 45px;
+ }
+ .el-input__suffix {
+ right: 1px;
+ top: -0.5px;
+ width: 45px;
+ // background-color: rgba(61, 104, 225, 1);
+ /* color: white; */
+ border-radius: 12px;
}
}
.permission {
@@ -1013,22 +1508,71 @@
}
.add-account-page {
- background-color: lightcyan;
- padding: 10px 50px;
.upload-group {
- background-color: lightgrey;
- height: 100px;
- display: flex;
+ height: 120px;
+ width: 360px;
+ margin: 0 auto;
+ overflow: hidden;
.upload-jpg {
- height: 40px;
- width: 40px;
- background-color: lightcoral;
- margin-bottom: 20px;
+ position: relative;
+ height: 48px;
+ width: 48px;
+ float: left;
+ margin: 0 10px;
+ margin-bottom: 10px;
+ background-color: rgba(242, 242, 242, 1);
+ border: 2px solid transparent;
+ border-radius: 50%;
+ cursor: pointer;
+ img {
+ height: 48px;
+ width: 48px;
+ border-radius: 50%;
+ }
+ .img-mask {
+ position: absolute;
+ left: 0;
+ top: 0;
+ height: 48px;
+ width: 48px;
+ background-color: rgba(0, 0, 0, 0.3);
+ color: white;
+ border-radius: 50%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ .selected {
+ font-size: 22px;
+ }
+ }
+ }
+ .upload-jpg-border {
+ border: 2px solid cornflowerblue;
+ }
+ .upload-jpg-up {
+ height: 48px;
+ width: 48px;
+ float: left;
+ display: flex;
+ background-color: rgba(242, 242, 242, 1);
+ border: 2px solid transparent;
+ border-radius: 50%;
+
+ justify-content: center;
+ align-items: center;
+ font-size: 12px;
+ cursor: pointer;
}
}
.fill-group {
.p-title {
+ height: 34px;
text-align: left;
+ }
+ .el-form-item {
+ .el-select {
+ width: 100%;
+ }
}
}
}
@@ -1058,6 +1602,7 @@
line-height: 40px;
position: relative;
font-size: 14px;
+ margin-bottom: 10px;
}
.ip-input-container {
max-width: none !important;
@@ -1219,18 +1764,18 @@
.middle {
font-size: 14px;
}
- .input-box {
- width: 80px;
- border: none;
- border-radius: 5px;
- height: 25px;
- font-size: 18px;
- text-align: center;
- }
+ .input-box {
+ width: 80px;
+ border: none;
+ border-radius: 5px;
+ height: 25px;
+ font-size: 18px;
+ text-align: center;
+ }
- .input-box:focus {
- outline: none;
- }
+ .input-box:focus {
+ outline: none;
+ }
.minus {
width: 50px;
height: 50px;
@@ -1257,12 +1802,12 @@
.btns {
display: flex;
justify-content: space-between;
- margin-top: 200px;
+ margin-top: 20px;
.cancel {
height: 40px;
width: 48%;
-
+ cursor: pointer;
border-radius: 8px;
background-color: rgba(240, 240, 240, 1);
line-height: 40px;
@@ -1271,7 +1816,7 @@
.ok {
height: 40px;
width: 48%;
-
+ cursor: pointer;
border-radius: 8px;
background-color: rgba(61, 104, 225, 1);
color: #fff;
--
Gitblit v1.8.0