feat:2.5.0
1. 用户页面调整完成
This commit is contained in:
parent
58a25c128b
commit
b7a1af4b04
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<a-dropdown>
|
||||
<a-dropdown v-if="namespaceIds && namespaceIds.length > 0">
|
||||
<a-menu slot="overlay" @click="handleMenuClick">
|
||||
<a-menu-item :key="item.uniqueId" v-for="item in namespaceIds">
|
||||
<a href="javascript:;">{{ item.name }}</a>
|
||||
@ -7,6 +7,9 @@
|
||||
</a-menu>
|
||||
<a-button shape="round"> {{ name }} <a-icon type="down" /> </a-button>
|
||||
</a-dropdown>
|
||||
<span v-else>
|
||||
<a-spin size="small" :style="{ marginLeft: 8, marginRight: 8 }" />
|
||||
</span>
|
||||
</template>
|
||||
<script>
|
||||
import namespaceMixin from '@/store/namespace-mixin'
|
||||
@ -20,6 +23,16 @@ export default {
|
||||
name: 'Default'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
refreshNamespace () {
|
||||
return this.$store.getters.namespaces
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
refreshNamespace (val) {
|
||||
this.namespaceIds = val
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
this.namespaceIds = this.$store.getters.namespaces
|
||||
|
@ -389,7 +389,6 @@ export default {
|
||||
})
|
||||
},
|
||||
handleTaskTypeChange (value) {
|
||||
console.log(value)
|
||||
this.taskTypeValue = value
|
||||
},
|
||||
handlerCron () {
|
||||
|
@ -45,14 +45,14 @@
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<template>
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="命名空间删除后不可恢复,请确认是否删除这个空间?"
|
||||
ok-text="删除"
|
||||
cancel-text="取消"
|
||||
@confirm="handleDel(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
</a-popconfirm>
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<!-- <a-popconfirm-->
|
||||
<!-- title="命名空间删除后不可恢复,请确认是否删除这个空间?"-->
|
||||
<!-- ok-text="删除"-->
|
||||
<!-- cancel-text="取消"-->
|
||||
<!-- @confirm="handleDel(record)">-->
|
||||
<!-- <a href="javascript:;">删除</a>-->
|
||||
<!-- </a-popconfirm>-->
|
||||
|
||||
</template>
|
||||
</span>
|
||||
@ -158,6 +158,7 @@ export default {
|
||||
delNamespace(record.id).then(res => {
|
||||
this.$message.success('删除成功')
|
||||
this.$refs.table.refresh()
|
||||
this.$store.dispatch('GetInfo')
|
||||
})
|
||||
},
|
||||
handleGoBack () {
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div></div>
|
||||
</page-header-wrapper>
|
||||
<a-card class="card" title="" :bordered="false">
|
||||
<a-form @submit="handleSubmit" :form="form" :body-style="{padding: '24px 32px'}" v-bind="formItemLayout" :rules="rules">
|
||||
<a-form @submit="handleSubmit" :form="form" :body-style="{padding: '24px 32px'}" v-bind="formItemLayout">
|
||||
<a-form-item>
|
||||
<a-input
|
||||
hidden
|
||||
@ -20,25 +20,32 @@
|
||||
]" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="密码">
|
||||
label="修改密码"
|
||||
v-if="formType === 'edit'">
|
||||
<a-switch checked-children="修改" un-checked-children="不修改" @change="onChange" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="密码"
|
||||
v-if="updatePass">
|
||||
<a-input
|
||||
placeholder="请输入密码"
|
||||
type="password"
|
||||
autocomplete="off"
|
||||
v-decorator="[
|
||||
'password',
|
||||
{rules: [{ required: formType === 'create', message: '请输入密码', whitespace: true}, {validator: validatePass, validateTrigger: ['change', 'blur']}]}
|
||||
{rules: [{ required: true, message: '请输入密码', whitespace: true}, {validator: validatePass, trigger: ['change', 'blur']}]}
|
||||
]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="确认密码">
|
||||
label="确认密码"
|
||||
v-if="updatePass">
|
||||
<a-input
|
||||
placeholder="请输入确认密码"
|
||||
type="password"
|
||||
autocomplete="off"
|
||||
v-decorator="[
|
||||
'checkPassword',
|
||||
{rules: [{ required: formType === 'create', message: '请输入密码', whitespace: true}, {validator: validateCheckPass, validateTrigger: ['change', 'blur']}]}
|
||||
{rules: [{ required: true, message: '请输入确认密码', whitespace: true}, {validator: validateCheckPass, trigger: ['change', 'blur']}]}
|
||||
]"/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
@ -82,7 +89,7 @@
|
||||
'permissions',
|
||||
{rules: [{ required: true, message: '请分配组'}]}
|
||||
]">
|
||||
<a-select-option v-for="(item, index) in groupNameList" :key="index" :value="item.groupName + '@@'+ item.namespaceId">
|
||||
<a-select-option v-for="(item, index) in groupNameList" :key="index" :value="item.groupName + '@'+ item.namespaceId">
|
||||
{{ item.groupName }} ({{ item.namespaceId }})
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
@ -125,7 +132,8 @@ export default {
|
||||
wrapperCol: { lg: { span: 10 }, sm: { span: 17 } }
|
||||
},
|
||||
groupNameList: [],
|
||||
namespaceList: []
|
||||
namespaceList: [],
|
||||
updatePass: true
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -135,6 +143,7 @@ export default {
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (this.$route.query.username) {
|
||||
this.updatePass = false
|
||||
getSystemUserByUserName({ username: this.$route.query.username }).then(res => {
|
||||
this.loadEditInfo(res.data)
|
||||
})
|
||||
@ -159,16 +168,13 @@ export default {
|
||||
}
|
||||
|
||||
if (values.permissions) {
|
||||
const filteredData = values.permissions.map(input => {
|
||||
const [groupName, namespaceId] = input.split('@@')
|
||||
|
||||
values['permissions'] = values.permissions.map(input => {
|
||||
const [groupName, namespaceId] = input.split('@')
|
||||
console.log(this.groupNameList)
|
||||
return this.groupNameList.filter(item =>
|
||||
item.groupName === groupName && item.namespaceId === namespaceId
|
||||
)
|
||||
}).flat()
|
||||
|
||||
values['permissions'] = filteredData
|
||||
console.log(filteredData)
|
||||
}
|
||||
|
||||
values.role = parseInt(values.role)
|
||||
@ -180,23 +186,25 @@ export default {
|
||||
})
|
||||
},
|
||||
validatePass (rule, value, callback) {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入密码'))
|
||||
} else {
|
||||
if (value) {
|
||||
if (this.form.getFieldValue('checkPassword') !== '') {
|
||||
this.$refs.form.validateField('checkPassword')
|
||||
this.form.validateFields(['checkPassword'], (errors, values) => {
|
||||
console.log(errors)
|
||||
})
|
||||
}
|
||||
}
|
||||
callback()
|
||||
}
|
||||
},
|
||||
validateCheckPass (rule, value, callback) {
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'))
|
||||
} else if (value !== this.form.getFieldValue('password')) {
|
||||
console.log(value)
|
||||
if (value) {
|
||||
console.log(value)
|
||||
if (value !== this.form.getFieldValue('password')) {
|
||||
callback(new Error('两次密码不匹配!'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
},
|
||||
loadEditInfo (data) {
|
||||
this.formType = 'edit'
|
||||
@ -207,11 +215,17 @@ export default {
|
||||
}).then(() => {
|
||||
const formData = pick(data, ['id', 'username', 'role', 'permissions', 'namespaceIds'])
|
||||
formData.role = formData.role.toString()
|
||||
this.role = formData.role
|
||||
formData.namespaceIds = formData.namespaceIds.map(i => i.uniqueId)
|
||||
formData.permissions = formData.permissions.map(i => i.groupName + '@@' + i.namespaceId)
|
||||
formData.permissions = formData.permissions.map(i => i.groupName + '@' + i.namespaceId)
|
||||
form.setFieldsValue(formData)
|
||||
this.handleNamespacesIdChange(formData.namespaceIds)
|
||||
})
|
||||
},
|
||||
onChange (checked) {
|
||||
this.updatePass = checked
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user