Merge branch 'dev-2.0' of https://git.mesalab.cn/nezha/nezha-fronted into dev-2.0
This commit is contained in:
@@ -20,7 +20,7 @@ export default {
|
|||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
localStorage.setItem('nz-version', version)
|
localStorage.setItem('nz-version', version)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadChartData (scrollTop) {
|
loadChartData (scrollTop) {
|
||||||
console.log(scrollTop);
|
console.log(scrollTop)
|
||||||
if (this.dataList.length > 0) {
|
if (this.dataList.length > 0) {
|
||||||
this.dataList.forEach((item, index) => {
|
this.dataList.forEach((item, index) => {
|
||||||
if (!item.isLoaded) {
|
if (!item.isLoaded) {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export default {
|
|||||||
dropdownShow: '',
|
dropdownShow: '',
|
||||||
timeout: null,
|
timeout: null,
|
||||||
formatTime: '',
|
formatTime: '',
|
||||||
hideSameLabels: true,
|
hideSameLabels: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -171,7 +171,7 @@ export default {
|
|||||||
wrap.scrollTop = currentTop
|
wrap.scrollTop = currentTop
|
||||||
}
|
}
|
||||||
}, 20)
|
}, 20)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -66,13 +66,13 @@ export default {
|
|||||||
type: 'selectString',
|
type: 'selectString',
|
||||||
label: 'operation',
|
label: 'operation',
|
||||||
disabled: false
|
disabled: false
|
||||||
},{
|
}, {
|
||||||
id: 14,
|
id: 14,
|
||||||
name: this.$t('config.operationlog.operaId'),
|
name: this.$t('config.operationlog.operaId'),
|
||||||
type: 'input',
|
type: 'input',
|
||||||
label: 'operaId',
|
label: 'operaId',
|
||||||
disabled: false
|
disabled: false
|
||||||
},{
|
}, {
|
||||||
id: 16,
|
id: 16,
|
||||||
name: this.$t('config.operationlog.state'),
|
name: this.$t('config.operationlog.state'),
|
||||||
type: 'selectString',
|
type: 'selectString',
|
||||||
@@ -84,10 +84,10 @@ export default {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
label: 'params',
|
label: 'params',
|
||||||
disabled: false
|
disabled: false
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
searchLabel:{userId:this.obj.id}
|
searchLabel: { userId: this.obj.id }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -100,7 +100,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
},
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
'chart-box': ChartBox,
|
'chart-box': ChartBox,
|
||||||
'chart-list': ChartList,
|
'chart-list': ChartList,
|
||||||
nzBottomDataList,
|
nzBottomDataList
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 刷新
|
// 刷新
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
nowTime: '',
|
nowTime: '',
|
||||||
searchLabel:{userId:this.obj.id}
|
searchLabel: { userId: this.obj.id }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
username: sessionStorage.getItem('nz-username'),
|
username: sessionStorage.getItem('nz-username'),
|
||||||
language: localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en',
|
language: localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en',
|
||||||
systemLogo:'',
|
systemLogo: '',
|
||||||
// 顶部菜单相关
|
// 顶部菜单相关
|
||||||
/* activeIndex: '', */
|
/* activeIndex: '', */
|
||||||
activeItemIndex: '',
|
activeItemIndex: '',
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ const en = {
|
|||||||
repeat: 'Repeat',
|
repeat: 'Repeat',
|
||||||
tooLong: 'Too long content',
|
tooLong: 'Too long content',
|
||||||
onlyWord: 'only input a-z、A-Z、0-9、"_" ',
|
onlyWord: 'only input a-z、A-Z、0-9、"_" ',
|
||||||
mobile:'Invalid mobile',
|
mobile: 'Invalid mobile'
|
||||||
},
|
},
|
||||||
search: {
|
search: {
|
||||||
searchTip: 'Enter to search', // '点击或回车执行搜索'
|
searchTip: 'Enter to search', // '点击或回车执行搜索'
|
||||||
@@ -706,7 +706,7 @@ const en = {
|
|||||||
confirmPwdErr: 'The two passwords are inconsistent',
|
confirmPwdErr: 'The two passwords are inconsistent',
|
||||||
reinputPwd: 'Enter password again',
|
reinputPwd: 'Enter password again',
|
||||||
notification: 'Notification',
|
notification: 'Notification',
|
||||||
mobile: 'Mobile',
|
mobile: 'Mobile'
|
||||||
},
|
},
|
||||||
roles: {
|
roles: {
|
||||||
roles: 'Roles',
|
roles: 'Roles',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -605,7 +605,7 @@ export default {
|
|||||||
moduleId: item.moduleId,
|
moduleId: item.moduleId,
|
||||||
assetId: item.assetId,
|
assetId: item.assetId,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
configs: JSON.stringify(item.configs),
|
configs: JSON.stringify(item.configs)
|
||||||
}
|
}
|
||||||
endpointList.push(endpoint)
|
endpointList.push(endpoint)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-clickoutside="{obj: editRole, func: esc}" class="right-box right-box-asset">
|
<div v-clickoutside="{obj: editRole, func: esc}" class="right-box right-box-asset">
|
||||||
<div class="right-box__header">
|
<div class="right-box__header">
|
||||||
<div class="header__title">{{editRole.id ? $t('config.user.editRole') : $t('config.user.createUser')}}</div>
|
<div class="header__title">{{editRole.id ? $t('config.roles.editRole') : $t('config.roles.createRole')}}</div>
|
||||||
<div class="header__operation">
|
<div class="header__operation">
|
||||||
<span v-cancel="{obj: editRole, func: esc}"><i class="nz-icon nz-icon-close"></i></span>
|
<span v-cancel="{obj: editRole, func: esc}"><i class="nz-icon nz-icon-close"></i></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,154 +48,152 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'userBox',
|
name: 'userBox',
|
||||||
components: {
|
components: {
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
obj: {
|
||||||
|
type: Object
|
||||||
},
|
},
|
||||||
props: {
|
detail: Boolean
|
||||||
obj: {
|
},
|
||||||
type: Object
|
data () {
|
||||||
|
const vm = this
|
||||||
|
return {
|
||||||
|
editRole: {},
|
||||||
|
url: 'sys/role',
|
||||||
|
rightBox: { model: { show: false } },
|
||||||
|
rules: { // 表单校验规则
|
||||||
|
name: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
detail: Boolean
|
menus: [],
|
||||||
},
|
selectedIds: [],
|
||||||
data () {
|
selectAllFlag: false,
|
||||||
const vm = this
|
expandAllFlag: true
|
||||||
return {
|
}
|
||||||
editRole: {},
|
},
|
||||||
url: 'sys/role',
|
watch: {
|
||||||
rightBox: {model: {show: false}},
|
obj: {
|
||||||
rules: { // 表单校验规则
|
deep: true,
|
||||||
name: [
|
immediate: true,
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
handler (n) {
|
||||||
]
|
this.editRole = JSON.parse(JSON.stringify(n))
|
||||||
},
|
if (this.editRole.roles && this.editRole.roles.length > 0) {
|
||||||
menus: [],
|
this.editRole.roleIds = this.editRole.roles.map(t => t.id)
|
||||||
selectedIds:[],
|
|
||||||
selectAllFlag: false,
|
|
||||||
expandAllFlag: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
obj: {
|
|
||||||
deep: true,
|
|
||||||
immediate: true,
|
|
||||||
handler (n) {
|
|
||||||
this.editRole = JSON.parse(JSON.stringify(n))
|
|
||||||
if(this.editRole.roles && this.editRole.roles.length>0){
|
|
||||||
this.editRole.roleIds=this.editRole.roles.map(t=>t.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
created () {
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
this.getMenus().then(()=>{
|
|
||||||
if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) {
|
|
||||||
this.$refs.menuTree.setCheckedKeys(this.selectedIds, true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
clickOutside () {
|
|
||||||
this.esc(false)
|
|
||||||
},
|
|
||||||
/* 关闭弹框 */
|
|
||||||
esc (refresh) {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
this.$emit('close', refresh)
|
|
||||||
},
|
|
||||||
getMenus: function () {
|
|
||||||
let self = this;
|
|
||||||
return new Promise(resolve => {
|
|
||||||
self.menus = []
|
|
||||||
if(self.editRole.id){
|
|
||||||
self.$get('/sys/role/menu/'+self.editRole.id).then(response => {
|
|
||||||
if (response.code == 200) {
|
|
||||||
self.menus = response.data.menus;
|
|
||||||
self.selectedIds = response.data.selectedIds
|
|
||||||
} else {
|
|
||||||
self.$message.error('load menu faild')
|
|
||||||
}
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
self.$get('/sys/menu').then(response => {
|
|
||||||
if (response.code == 200) {
|
|
||||||
self.menus = response.data.list;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
self.$message.error('load menu faild')
|
|
||||||
}
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
labelFormatter: function (data, node) {
|
|
||||||
return data && data.i18n ? this.$t(data.i18n) : data.name
|
|
||||||
},
|
|
||||||
selectChange: function (data, isCheck, childIsCheck) {
|
|
||||||
if (this.$refs.menuTree) {
|
|
||||||
this.editRole.menuIds = this.$refs.menuTree.getCheckedKeys(true)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectAllOrNone: function () {
|
|
||||||
if (this.$refs.menuTree) {
|
|
||||||
if (!this.selectAllFlag) {
|
|
||||||
this.$refs.menuTree.setCheckedNodes(this.menus)
|
|
||||||
} else {
|
|
||||||
this.$refs.menuTree.setCheckedNodes([])
|
|
||||||
}
|
|
||||||
this.selectAllFlag = !this.selectAllFlag
|
|
||||||
}
|
|
||||||
},
|
|
||||||
expandAllOrNone: function () {
|
|
||||||
this.expandAllFlag = !this.expandAllFlag
|
|
||||||
const $self = this
|
|
||||||
if (this.$refs.menuTree) {
|
|
||||||
this.menus.forEach(t => {
|
|
||||||
$self.$refs.menuTree.store.nodesMap[t.id].expanded = $self.expandAllFlag
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
save () {
|
|
||||||
if (this.prevent_opt.save) { return } ;
|
|
||||||
this.prevent_opt.save = true
|
|
||||||
|
|
||||||
this.$refs.roleForm.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.editRole.id) {
|
|
||||||
this.$put(this.url, this.editRole).then(res => {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
||||||
this.esc(true)
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$post(this.url, this.editRole).then(res => {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
||||||
this.esc(true)
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.getMenus().then(() => {
|
||||||
|
if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) {
|
||||||
|
this.$refs.menuTree.setCheckedKeys(this.selectedIds, true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clickOutside () {
|
||||||
|
this.esc(false)
|
||||||
|
},
|
||||||
|
/* 关闭弹框 */
|
||||||
|
esc (refresh) {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
this.$emit('close', refresh)
|
||||||
|
},
|
||||||
|
getMenus: function () {
|
||||||
|
const self = this
|
||||||
|
return new Promise(resolve => {
|
||||||
|
self.menus = []
|
||||||
|
if (self.editRole.id) {
|
||||||
|
self.$get('/sys/role/menu/' + self.editRole.id).then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
self.menus = response.data.menus
|
||||||
|
self.selectedIds = response.data.selectedIds
|
||||||
|
} else {
|
||||||
|
self.$message.error('load menu faild')
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self.$get('/sys/menu').then(response => {
|
||||||
|
if (response.code == 200) {
|
||||||
|
self.menus = response.data.list
|
||||||
|
} else {
|
||||||
|
self.$message.error('load menu faild')
|
||||||
|
}
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
labelFormatter: function (data, node) {
|
||||||
|
return data && data.i18n ? this.$t(data.i18n) : data.name
|
||||||
|
},
|
||||||
|
selectChange: function (data, isCheck, childIsCheck) {
|
||||||
|
if (this.$refs.menuTree) {
|
||||||
|
this.editRole.menuIds = this.$refs.menuTree.getCheckedKeys(true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectAllOrNone: function () {
|
||||||
|
if (this.$refs.menuTree) {
|
||||||
|
if (!this.selectAllFlag) {
|
||||||
|
this.$refs.menuTree.setCheckedNodes(this.menus)
|
||||||
|
} else {
|
||||||
|
this.$refs.menuTree.setCheckedNodes([])
|
||||||
|
}
|
||||||
|
this.selectAllFlag = !this.selectAllFlag
|
||||||
|
}
|
||||||
|
},
|
||||||
|
expandAllOrNone: function () {
|
||||||
|
this.expandAllFlag = !this.expandAllFlag
|
||||||
|
const $self = this
|
||||||
|
if (this.$refs.menuTree) {
|
||||||
|
this.menus.forEach(t => {
|
||||||
|
$self.$refs.menuTree.store.nodesMap[t.id].expanded = $self.expandAllFlag
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
save () {
|
||||||
|
if (this.prevent_opt.save) { return } ;
|
||||||
|
this.prevent_opt.save = true
|
||||||
|
|
||||||
|
this.$refs.roleForm.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.editRole.id) {
|
||||||
|
this.$put(this.url, this.editRole).then(res => {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
|
this.esc(true)
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$post(this.url, this.editRole).then(res => {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
|
this.esc(true)
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import '@/assets/css/common/rightBoxCommon.scss';
|
@import '@/assets/css/common/rightBoxCommon.scss';
|
||||||
|
|||||||
@@ -70,151 +70,151 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { host, port } from '@/components/common/js/validate'
|
import { host, port } from '@/components/common/js/validate'
|
||||||
export default {
|
export default {
|
||||||
name: 'userBox',
|
name: 'userBox',
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
obj: {
|
obj: {
|
||||||
type: Object
|
type: Object
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
computed:{
|
computed: {
|
||||||
isCurrentUser () {
|
isCurrentUser () {
|
||||||
return function (username) {
|
return function (username) {
|
||||||
return localStorage.getItem('nz-username') == username
|
return localStorage.getItem('nz-username') == username
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
const vm = this
|
|
||||||
const validatePassword = (rule, value, callback) => { // 确认密码的二次校验
|
|
||||||
if (value === '' && this.editUser.pin) {
|
|
||||||
callback(new Error(this.$t('config.user.inputConfirmPwd')))
|
|
||||||
} else if (value !== this.editUser.pin) {
|
|
||||||
callback(new Error(this.$t('config.user.confirmPwdErr')))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
editUser: {},
|
|
||||||
url: 'sys/user',
|
|
||||||
rightBox: {model: {show: false}},
|
|
||||||
rules: { // 表单校验规则
|
|
||||||
name: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
username: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
pin: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
pinChange: [
|
|
||||||
{ validator: validatePassword, trigger: 'blur' },
|
|
||||||
{ required: true, message: '', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
roleIds: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
email: [
|
|
||||||
{ type: 'email', message: this.$t('validate.email') }
|
|
||||||
],
|
|
||||||
},
|
|
||||||
rules2: { // 表单校验规则
|
|
||||||
username: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
pinChange: [
|
|
||||||
{ validator: validatePassword, trigger: 'blur' }
|
|
||||||
],
|
|
||||||
roleIds: [
|
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
||||||
],
|
|
||||||
email: [
|
|
||||||
{ type: 'email', message: this.$t('validate.email') }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
roles: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
obj: {
|
|
||||||
deep: true,
|
|
||||||
immediate: true,
|
|
||||||
handler (n) {
|
|
||||||
this.editUser = JSON.parse(JSON.stringify(n))
|
|
||||||
if(this.editUser.roles && this.editUser.roles.length>0){
|
|
||||||
this.editUser.roleIds=this.editUser.roles.map(t=>t.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
this.getRoles()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
clickOutside () {
|
|
||||||
this.esc(false)
|
|
||||||
},
|
|
||||||
/* 关闭弹框 */
|
|
||||||
esc (refresh) {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
this.$emit('close', refresh)
|
|
||||||
},
|
|
||||||
/* 密码失去焦点 检验确认密码 */
|
|
||||||
passwordBlur () {
|
|
||||||
if (this.editUser.pin && this.editUser.pinChange) {
|
|
||||||
this.$refs.accountForm.validateField('passwordChange')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getRoles () {
|
|
||||||
this.roles = []
|
|
||||||
this.$get('sys/role?pageSize=-1').then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.roles = response.data.list
|
|
||||||
} else {
|
|
||||||
this.$message.error('load roles faild')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
save () {
|
|
||||||
if (this.prevent_opt.save) { return } ;
|
|
||||||
this.prevent_opt.save = true
|
|
||||||
|
|
||||||
this.$refs.userForm.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.editUser.id) {
|
|
||||||
this.$put(this.url, this.editUser).then(res => {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
||||||
this.esc(true)
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$post(this.url, this.editUser).then(res => {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
|
||||||
this.esc(true)
|
|
||||||
} else {
|
|
||||||
this.$message.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.prevent_opt.save = false
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
const vm = this
|
||||||
|
const validatePassword = (rule, value, callback) => { // 确认密码的二次校验
|
||||||
|
if (value === '' && this.editUser.pin) {
|
||||||
|
callback(new Error(this.$t('config.user.inputConfirmPwd')))
|
||||||
|
} else if (value !== this.editUser.pin) {
|
||||||
|
callback(new Error(this.$t('config.user.confirmPwdErr')))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
editUser: {},
|
||||||
|
url: 'sys/user',
|
||||||
|
rightBox: { model: { show: false } },
|
||||||
|
rules: { // 表单校验规则
|
||||||
|
name: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
username: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
pin: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
pinChange: [
|
||||||
|
{ validator: validatePassword, trigger: 'blur' },
|
||||||
|
{ required: true, message: '', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
roleIds: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{ type: 'email', message: this.$t('validate.email') }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
rules2: { // 表单校验规则
|
||||||
|
username: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
pinChange: [
|
||||||
|
{ validator: validatePassword, trigger: 'blur' }
|
||||||
|
],
|
||||||
|
roleIds: [
|
||||||
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{ type: 'email', message: this.$t('validate.email') }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
roles: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
obj: {
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
handler (n) {
|
||||||
|
this.editUser = JSON.parse(JSON.stringify(n))
|
||||||
|
if (this.editUser.roles && this.editUser.roles.length > 0) {
|
||||||
|
this.editUser.roleIds = this.editUser.roles.map(t => t.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.getRoles()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clickOutside () {
|
||||||
|
this.esc(false)
|
||||||
|
},
|
||||||
|
/* 关闭弹框 */
|
||||||
|
esc (refresh) {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
this.$emit('close', refresh)
|
||||||
|
},
|
||||||
|
/* 密码失去焦点 检验确认密码 */
|
||||||
|
passwordBlur () {
|
||||||
|
if (this.editUser.pin && this.editUser.pinChange) {
|
||||||
|
this.$refs.accountForm.validateField('passwordChange')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getRoles () {
|
||||||
|
this.roles = []
|
||||||
|
this.$get('sys/role?pageSize=-1').then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.roles = response.data.list
|
||||||
|
} else {
|
||||||
|
this.$message.error('load roles faild')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
save () {
|
||||||
|
if (this.prevent_opt.save) { return } ;
|
||||||
|
this.prevent_opt.save = true
|
||||||
|
|
||||||
|
this.$refs.userForm.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.editUser.id) {
|
||||||
|
this.$put(this.url, this.editUser).then(res => {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
|
this.esc(true)
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$post(this.url, this.editUser).then(res => {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
|
this.esc(true)
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.prevent_opt.save = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import '@/assets/css/common/rightBoxCommon.scss';
|
@import '@/assets/css/common/rightBoxCommon.scss';
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: this.$t('project.endpoint.configs'),
|
label: this.$t('project.endpoint.configs'),
|
||||||
prop: 'configs',
|
prop: 'configs',
|
||||||
show: true,
|
show: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
typeList: [],
|
typeList: [],
|
||||||
@@ -540,7 +540,7 @@ export default {
|
|||||||
selectEndpointList: {
|
selectEndpointList: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
console.log(n);
|
console.log(n)
|
||||||
this.endpointTableData = JSON.parse(JSON.stringify(n))
|
this.endpointTableData = JSON.parse(JSON.stringify(n))
|
||||||
this.endpointTableData.forEach(item => {
|
this.endpointTableData.forEach(item => {
|
||||||
item.configs = JSON.parse(item.configs)
|
item.configs = JSON.parse(item.configs)
|
||||||
@@ -550,7 +550,7 @@ export default {
|
|||||||
item.assetName = item.asset.name
|
item.assetName = item.asset.name
|
||||||
item.type = item.module.type
|
item.type = item.module.type
|
||||||
})
|
})
|
||||||
console.log(this.endpointTableData);
|
console.log(this.endpointTableData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 点击搜索
|
// 点击搜索
|
||||||
select () {
|
select () {
|
||||||
console.log(this.select_list);
|
console.log(this.select_list)
|
||||||
const objectInfo = {}
|
const objectInfo = {}
|
||||||
this.change_sreach_show = true
|
this.change_sreach_show = true
|
||||||
this.name = '', this.id = ''
|
this.name = '', this.id = ''
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用
|
|||||||
{
|
{
|
||||||
value: 'logout',
|
value: 'logout',
|
||||||
label: i18n.t('config.operationlog.operations.logout')
|
label: i18n.t('config.operationlog.operations.logout')
|
||||||
},
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
alertMessageState: [
|
alertMessageState: [
|
||||||
@@ -132,7 +132,7 @@ const searchSelectInfo = { // value: 传给后台的值;label:显示给用
|
|||||||
label: i18n.t('config.terminallog.TELNET')
|
label: i18n.t('config.terminallog.TELNET')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
state:[
|
state: [
|
||||||
{
|
{
|
||||||
value: 'success',
|
value: 'success',
|
||||||
label: i18n.t('overall.result.success')
|
label: i18n.t('overall.result.success')
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ export default {
|
|||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.endpointChart.resize()
|
this.$refs.endpointChart.resize()
|
||||||
},100)
|
}, 100)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ export default {
|
|||||||
return {
|
return {
|
||||||
isShrink: localStorage.getItem('nz-left-menu-shrink') == 'true',
|
isShrink: localStorage.getItem('nz-left-menu-shrink') == 'true',
|
||||||
systemName: localStorage.getItem('nz-sys-name'),
|
systemName: localStorage.getItem('nz-sys-name'),
|
||||||
logo:'',
|
logo: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created () {
|
||||||
const self = this;
|
const self = this
|
||||||
window.addEventListener('setItemEvent',function(e){
|
window.addEventListener('setItemEvent', function (e) {
|
||||||
if(e.key == 'nz-sys-logo'&&e.value){
|
if (e.key == 'nz-sys-logo' && e.value) {
|
||||||
self.logo = e.value;
|
self.logo = e.value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -76,7 +76,7 @@ export default {
|
|||||||
},
|
},
|
||||||
route () {
|
route () {
|
||||||
return this.$route.path
|
return this.$route.path
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
shrink () {
|
shrink () {
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ export default {
|
|||||||
osTypes: [{
|
osTypes: [{
|
||||||
label: 'Centos',
|
label: 'Centos',
|
||||||
name: 'centos'
|
name: 'centos'
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: 'Ubuntu',
|
// label: 'Ubuntu',
|
||||||
// name: 'ubuntu'
|
// name: 'ubuntu'
|
||||||
@@ -189,7 +189,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toDownloadAgent: function () {
|
toDownloadAgent: function () {
|
||||||
this.getAllDc();
|
this.getAllDc()
|
||||||
this.showAgentDownload = true
|
this.showAgentDownload = true
|
||||||
this.token = sessionStorage.getItem('nz-token')
|
this.token = sessionStorage.getItem('nz-token')
|
||||||
axios.get('/healthy').then(response => {
|
axios.get('/healthy').then(response => {
|
||||||
|
|||||||
@@ -67,13 +67,13 @@ export default {
|
|||||||
type: 'selectString',
|
type: 'selectString',
|
||||||
label: 'operation',
|
label: 'operation',
|
||||||
disabled: false
|
disabled: false
|
||||||
},{
|
}, {
|
||||||
id: 14,
|
id: 14,
|
||||||
name: this.$t('config.operationlog.operaId'),
|
name: this.$t('config.operationlog.operaId'),
|
||||||
type: 'input',
|
type: 'input',
|
||||||
label: 'operaId',
|
label: 'operaId',
|
||||||
disabled: false
|
disabled: false
|
||||||
},{
|
}, {
|
||||||
id: 16,
|
id: 16,
|
||||||
name: this.$t('config.operationlog.state'),
|
name: this.$t('config.operationlog.state'),
|
||||||
type: 'selectString',
|
type: 'selectString',
|
||||||
@@ -85,9 +85,9 @@ export default {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
label: 'params',
|
label: 'params',
|
||||||
disabled: false
|
disabled: false
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,22 +250,21 @@ export default {
|
|||||||
components: { draggable, latlngPicker, notifyMethod, linkTab, apiKeyTab },
|
components: { draggable, latlngPicker, notifyMethod, linkTab, apiKeyTab },
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
imageFormatErr:false,
|
imageFormatErr: false,
|
||||||
basic: {
|
basic: {
|
||||||
alert_api: '',
|
alert_api: '',
|
||||||
asset_ping_interval: '300', // 检查周期,单位:s
|
asset_ping_interval: '300', // 检查周期,单位:s
|
||||||
storage_local_retention: 15 * 24,
|
storage_local_retention: 15 * 24,
|
||||||
system_name: '',
|
system_name: '',
|
||||||
system_logo:'',
|
system_logo: '',
|
||||||
current_site_url: '',
|
current_site_url: '',
|
||||||
timezone: '',
|
timezone: '',
|
||||||
default_cabinet_usize: '',
|
default_cabinet_usize: '',
|
||||||
query_max_series: '',
|
query_max_series: '',
|
||||||
unsaved_change: 'on',
|
unsaved_change: 'on',
|
||||||
default_scrape_interval:'60',
|
default_scrape_interval: '60',
|
||||||
default_scrape_timeout:'30',
|
default_scrape_timeout: '30',
|
||||||
default_scrape_interval:'60',
|
snmp_trap_listen_port: 162,
|
||||||
snmp_trap_listen_port:162,
|
|
||||||
map_center_config: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 }
|
map_center_config: { longitude: 116.39, latitude: 39.9, zoom: 4, minZoom: 1, maxZoom: 10 }
|
||||||
},
|
},
|
||||||
basicCopy: null,
|
basicCopy: null,
|
||||||
@@ -286,7 +285,7 @@ export default {
|
|||||||
email_enable: 'on',
|
email_enable: 'on',
|
||||||
email_host: '',
|
email_host: '',
|
||||||
email_port: 25,
|
email_port: 25,
|
||||||
email_timeout:10,
|
email_timeout: 10,
|
||||||
email_auth_account: '',
|
email_auth_account: '',
|
||||||
email_auth_password: '',
|
email_auth_password: '',
|
||||||
email_send_account: '',
|
email_send_account: '',
|
||||||
@@ -312,14 +311,14 @@ export default {
|
|||||||
},
|
},
|
||||||
terminal: {
|
terminal: {
|
||||||
terminal_timeout: 30,
|
terminal_timeout: 30,
|
||||||
terminal_telnet_user_tip:'ogin:',
|
terminal_telnet_user_tip: 'ogin:',
|
||||||
terminal_telnet_pin_tip:'assword:',
|
terminal_telnet_pin_tip: 'assword:',
|
||||||
terminal_record_local_retention:365,
|
terminal_record_local_retention: 365
|
||||||
},
|
},
|
||||||
terminalCopy: null,
|
terminalCopy: null,
|
||||||
terminalRules: {
|
terminalRules: {
|
||||||
// terminal_timeout: [{ validator: positiveInteger, trigger: 'blur' }],
|
// terminal_timeout: [{ validator: positiveInteger, trigger: 'blur' }],
|
||||||
terminal_record_local_retention: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: positiveInteger, trigger: 'blur' }],
|
terminal_record_local_retention: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: positiveInteger, trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
ldap: {
|
ldap: {
|
||||||
ldap_address: '',
|
ldap_address: '',
|
||||||
@@ -329,14 +328,14 @@ export default {
|
|||||||
ldap_user_filter: '',
|
ldap_user_filter: '',
|
||||||
ldap_mapping: '',
|
ldap_mapping: '',
|
||||||
ldap_enable: 'off',
|
ldap_enable: 'off',
|
||||||
ldap_timeout:'',
|
ldap_timeout: ''
|
||||||
},
|
},
|
||||||
ldapCopy: null,
|
ldapCopy: null,
|
||||||
ldapRules: {
|
ldapRules: {
|
||||||
ldap_address: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
ldap_address: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
ldap_user_filter: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
ldap_user_filter: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
ldap_mapping: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
ldap_mapping: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
ldap_timeout: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: positiveInteger, trigger: 'blur' }],
|
ldap_timeout: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: positiveInteger, trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
type: [],
|
type: [],
|
||||||
@@ -393,10 +392,10 @@ export default {
|
|||||||
selectTab: function (tab) {
|
selectTab: function (tab) {
|
||||||
this.querySetInfo(tab.name)
|
this.querySetInfo(tab.name)
|
||||||
},
|
},
|
||||||
queryTimezone:function(){
|
queryTimezone: function () {
|
||||||
this.$get("/sys/timezone").then(response=>{
|
this.$get('/sys/timezone').then(response => {
|
||||||
if(response.code == 200){
|
if (response.code == 200) {
|
||||||
this.timezoneOption = response.data.list;
|
this.timezoneOption = response.data.list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -410,7 +409,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$get('/sys/config/' + type).then(response => {
|
this.$get('/sys/config/' + type).then(response => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
for (let key in response.data){
|
for (const key in response.data) {
|
||||||
this[type][key] = response.data[key]
|
this[type][key] = response.data[key]
|
||||||
}
|
}
|
||||||
if (type == 'basic') {
|
if (type == 'basic') {
|
||||||
@@ -441,14 +440,14 @@ export default {
|
|||||||
const param = Object.assign({}, this[type])
|
const param = Object.assign({}, this[type])
|
||||||
|
|
||||||
if (type == 'basic') {
|
if (type == 'basic') {
|
||||||
let mapConfig = this.$refs.latlngPicker.getAttribute()
|
const mapConfig = this.$refs.latlngPicker.getAttribute()
|
||||||
param.map_center_config = JSON.stringify(mapConfig)
|
param.map_center_config = JSON.stringify(mapConfig)
|
||||||
}
|
}
|
||||||
const postParam = Object.assign({}, param)
|
const postParam = Object.assign({}, param)
|
||||||
for (const key in postParam[type]) {
|
for (const key in postParam[type]) {
|
||||||
postParam[type][key] = postParam[type][key] + ''
|
postParam[type][key] = postParam[type][key] + ''
|
||||||
}
|
}
|
||||||
this.$put('/sys/config/'+type, postParam).then(response => {
|
this.$put('/sys/config/' + type, postParam).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
@@ -473,9 +472,9 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
const param = Object.assign({}, this[type])
|
const param = Object.assign({}, this[type])
|
||||||
|
|
||||||
param[type+'_test']=true
|
param[type + '_test'] = true
|
||||||
const postParam = Object.assign({}, param)
|
const postParam = Object.assign({}, param)
|
||||||
this.$put('/sys/config/'+type, postParam).then(response => {
|
this.$put('/sys/config/' + type, postParam).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.testSuccess') })
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.testSuccess') })
|
||||||
@@ -755,48 +754,47 @@ export default {
|
|||||||
openUrl (item) {
|
openUrl (item) {
|
||||||
// window.open(item.url)
|
// window.open(item.url)
|
||||||
},
|
},
|
||||||
handleLogoChange(file, fileList) {
|
handleLogoChange (file, fileList) {
|
||||||
const imageTypes = ['image/jpeg','image/jpg','image/png'];
|
const imageTypes = ['image/jpeg', 'image/jpg', 'image/png']
|
||||||
console.log(file.raw.type)
|
console.log(file.raw.type)
|
||||||
const isImage = imageTypes.some(t=> file.raw.type === t);
|
const isImage = imageTypes.some(t => file.raw.type === t)
|
||||||
const isLt2M = file.raw.size / 1024 / 1024 < 2;
|
const isLt2M = file.raw.size / 1024 / 1024 < 2
|
||||||
|
|
||||||
this.imageFormatErr = (!isImage || !isLt2M)
|
this.imageFormatErr = (!isImage || !isLt2M)
|
||||||
|
|
||||||
if(isImage && isLt2M){
|
if (isImage && isLt2M) {
|
||||||
const self = this;
|
const self = this
|
||||||
this.fileToBase64(file.raw).then(res=>{
|
this.fileToBase64(file.raw).then(res => {
|
||||||
self.basic.system_logo = res;
|
self.basic.system_logo = res
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fileToBase64:function(file) {
|
fileToBase64: function (file) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let reader = new FileReader();
|
const reader = new FileReader()
|
||||||
reader.readAsDataURL(file);//转化二进制流,异步方法
|
reader.readAsDataURL(file)// 转化二进制流,异步方法
|
||||||
let base64Str='';
|
let base64Str = ''
|
||||||
reader.onload = function(){//完成后this.result为二进制流console.log(this.result);
|
reader.onload = function () { // 完成后this.result为二进制流console.log(this.result);
|
||||||
base64Str = this.result;
|
base64Str = this.result
|
||||||
resolve(base64Str);
|
resolve(base64Str)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
timezoneOptionHandler:function(offset){
|
timezoneOptionHandler: function (offset) {
|
||||||
let offsetHour = (offset/1000/60/60).toFixed(0)
|
const offsetHour = (offset / 1000 / 60 / 60).toFixed(0)
|
||||||
|
|
||||||
let offsetMinute = offset%(1000*60*60)/(1000*60)
|
const offsetMinute = offset % (1000 * 60 * 60) / (1000 * 60)
|
||||||
|
|
||||||
let hour = offsetHour>0?(offsetHour<9?'+0'+offsetHour:'+'+offsetHour):(offsetHour == 0?(offsetMinute==0?'':'+00'):(offsetHour>-10?'-0'+Math.abs(offsetHour):offsetHour))
|
const hour = offsetHour > 0 ? (offsetHour < 9 ? '+0' + offsetHour : '+' + offsetHour) : (offsetHour == 0 ? (offsetMinute == 0 ? '' : '+00') : (offsetHour > -10 ? '-0' + Math.abs(offsetHour) : offsetHour))
|
||||||
|
|
||||||
let minute = offsetHour==0&&offsetMinute == 0?'':(offsetMinute==0?':00':(Math.abs(offsetMinute)>9?':'+Math.abs(offsetMinute):':0'+Math.abs(offsetMinute)))
|
const minute = offsetHour == 0 && offsetMinute == 0 ? '' : (offsetMinute == 0 ? ':00' : (Math.abs(offsetMinute) > 9 ? ':' + Math.abs(offsetMinute) : ':0' + Math.abs(offsetMinute)))
|
||||||
|
|
||||||
return 'UTC'+hour+minute
|
return 'UTC' + hour + minute
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.querySetInfo(this.activeTab)
|
this.querySetInfo(this.activeTab)
|
||||||
this.queryTimezone();
|
this.queryTimezone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export default {
|
|||||||
addApiKey: function () {
|
addApiKey: function () {
|
||||||
this.$refs.dataTable.addApiKey()
|
this.$refs.dataTable.addApiKey()
|
||||||
this.$refs.dataTable.getRoles()
|
this.$refs.dataTable.getRoles()
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export default {
|
|||||||
roles: [],
|
roles: [],
|
||||||
rules: {
|
rules: {
|
||||||
name: { required: true, message: this.$t('validate.required'), switch: false },
|
name: { required: true, message: this.$t('validate.required'), switch: false },
|
||||||
roleId: { required: true, message: this.$t('validate.required'), switch: false },
|
roleId: { required: true, message: this.$t('validate.required'), switch: false }
|
||||||
// expireAt: { required: true, message: this.$t('validate.required'), switch: false }
|
// expireAt: { required: true, message: this.$t('validate.required'), switch: false }
|
||||||
},
|
},
|
||||||
pickerOptions: {
|
pickerOptions: {
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ export default {
|
|||||||
// this.$refs.editor.setContent(value)
|
// this.$refs.editor.setContent(value)
|
||||||
this.dropDownVisible = false
|
this.dropDownVisible = false
|
||||||
this.$emit('change', value)
|
this.$emit('change', value)
|
||||||
this.$forceUpdate();
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
metricKeyDown (val) {
|
metricKeyDown (val) {
|
||||||
if (this.required) {
|
if (this.required) {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export default {
|
|||||||
label: 'ids',
|
label: 'ids',
|
||||||
disabled: false
|
disabled: false
|
||||||
}]
|
}]
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -196,11 +196,10 @@ export default {
|
|||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
if (localStorage.getItem('moduleProjectId')) {
|
if (localStorage.getItem('moduleProjectId')) {
|
||||||
|
|
||||||
this.searchLabel.projectIds = localStorage.getItem('moduleProjectId')
|
this.searchLabel.projectIds = localStorage.getItem('moduleProjectId')
|
||||||
}
|
}
|
||||||
if (localStorage.getItem('moduleProjectId')) {
|
if (localStorage.getItem('moduleProjectId')) {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
this.$refs.dataList.$refs.searchInput.select_list.push({
|
this.$refs.dataList.$refs.searchInput.select_list.push({
|
||||||
id: 11,
|
id: 11,
|
||||||
name: 'project id',
|
name: 'project id',
|
||||||
|
|||||||
@@ -198,13 +198,13 @@ window.vm = new Vue({
|
|||||||
|
|
||||||
export default window.vm
|
export default window.vm
|
||||||
|
|
||||||
const orignalSetItem = localStorage.setItem;
|
const orignalSetItem = localStorage.setItem
|
||||||
localStorage.setItem = function(key,value){
|
localStorage.setItem = function (key, value) {
|
||||||
const setItemEvent = new Event("setItemEvent");
|
const setItemEvent = new Event('setItemEvent')
|
||||||
setItemEvent.key=key;
|
setItemEvent.key = key
|
||||||
setItemEvent.value = value;
|
setItemEvent.value = value
|
||||||
window.dispatchEvent(setItemEvent);
|
window.dispatchEvent(setItemEvent)
|
||||||
orignalSetItem.apply(this,arguments);
|
orignalSetItem.apply(this, arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 重写组件内容 */
|
/* 重写组件内容 */
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const store = new Vuex.Store({
|
|||||||
overViewProject: {},
|
overViewProject: {},
|
||||||
dcDataRefresh: false,
|
dcDataRefresh: false,
|
||||||
showTopoScreen: false,
|
showTopoScreen: false,
|
||||||
logo:'',
|
logo: ''
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getLinkData (state) {
|
getLinkData (state) {
|
||||||
@@ -60,9 +60,9 @@ const store = new Vuex.Store({
|
|||||||
getShowTopoScreen (state) {
|
getShowTopoScreen (state) {
|
||||||
return state.showTopoScreen
|
return state.showTopoScreen
|
||||||
},
|
},
|
||||||
getLogo (state){
|
getLogo (state) {
|
||||||
console.log('get logo',state)
|
console.log('get logo', state)
|
||||||
return state.logo;
|
return state.logo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
@@ -141,9 +141,9 @@ const store = new Vuex.Store({
|
|||||||
setShowTopoScreen (state, boolean) {
|
setShowTopoScreen (state, boolean) {
|
||||||
state.showTopoScreen = boolean
|
state.showTopoScreen = boolean
|
||||||
},
|
},
|
||||||
setLogo(state,logo){
|
setLogo (state, logo) {
|
||||||
console.log('set log',logo)
|
console.log('set log', logo)
|
||||||
state.logo = logo;
|
state.logo = logo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const user = {
|
|||||||
loginSuccess (store, res) {
|
loginSuccess (store, res) {
|
||||||
sessionStorage.setItem('nz-token', res.data.token)
|
sessionStorage.setItem('nz-token', res.data.token)
|
||||||
localStorage.setItem('nz-sys-name', res.data.systemName)
|
localStorage.setItem('nz-sys-name', res.data.systemName)
|
||||||
if(res.systemLogo){
|
if (res.systemLogo) {
|
||||||
localStorage.setItem('nz-sys-logo', res.data.systemLogo)
|
localStorage.setItem('nz-sys-logo', res.data.systemLogo)
|
||||||
}
|
}
|
||||||
localStorage.setItem('nz-sys-timezone', res.data.timezone)
|
localStorage.setItem('nz-sys-timezone', res.data.timezone)
|
||||||
|
|||||||
Reference in New Issue
Block a user