mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-04-26 00:00:04 +08:00
删除magic-boot-ui(基于vue-element-admin vue2版本)
This commit is contained in:
@@ -1,136 +0,0 @@
|
||||
<template>
|
||||
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="80px" v-if="isForm">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="登录名称" prop="username">
|
||||
<el-input v-model="temp.username" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="temp.password" type="password" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="姓名/昵称" prop="name">
|
||||
<el-input v-model="temp.name" autocomplete="new-password" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="temp.phone" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="组织机构" prop="officeId">
|
||||
<treeselect v-model="temp.officeId" :options="officeTree" :show-count="true" placeholder="请选择组织机构" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="选择角色" prop="roles">
|
||||
<mb-select v-model="temp.roles" url="role/list?size=999999" placeholder="请选择角色" labelField="name" valueField="id" :el="{ multiple: true }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="登录状态" prop="isLogin">
|
||||
<el-radio-group v-model="temp.isLogin" size="small">
|
||||
<el-radio-button label="0">有效</el-radio-button>
|
||||
<el-radio-button label="1">锁定</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
export default {
|
||||
name: 'UserForm',
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
rules: {
|
||||
username: [{ required: true, message: '请输入登录名称', trigger: 'change' }],
|
||||
roles: [{ required: true, message: '请选择角色', trigger: 'change' }],
|
||||
officeId: [{ required: true, message: '请选择组织机构', trigger: 'change' }]
|
||||
},
|
||||
temp: this.getTemp(),
|
||||
officeTree: [],
|
||||
isForm: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$get('user/offices').then(res => {
|
||||
this.officeTree = res.data.list
|
||||
this.$treeTable.deleteEmptyChildren(this.officeTree)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getTemp() {
|
||||
return {
|
||||
id: '',
|
||||
name: '',
|
||||
username: '',
|
||||
password: '',
|
||||
phone: '',
|
||||
isLogin: 0,
|
||||
roles: null,
|
||||
officeId: null
|
||||
}
|
||||
},
|
||||
resetTemp() {
|
||||
this.isForm = false
|
||||
this.rules.password = [{ required: true, message: '请输入密码', trigger: 'change' }]
|
||||
this.temp = this.getTemp()
|
||||
this.$nextTick(() => {
|
||||
this.isForm = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
})
|
||||
},
|
||||
save(d) {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
d.loading()
|
||||
this.$request({
|
||||
url: 'user/save',
|
||||
method: 'post',
|
||||
params: this.temp
|
||||
}).then(() => {
|
||||
d.hideLoading()
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: d.title + '成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.$emit('reload-table')
|
||||
}).catch(() => d.hideLoading())
|
||||
}
|
||||
})
|
||||
},
|
||||
getInfo(row) {
|
||||
this.isForm = false
|
||||
delete this.rules.password
|
||||
this.$nextTick(() => {
|
||||
this.isForm = true
|
||||
})
|
||||
for (var t in this.temp) {
|
||||
if (t !== 'roles') {
|
||||
this.temp[t] = row[t]
|
||||
}
|
||||
}
|
||||
this.$get('user/roles', { userId: this.temp.id }).then((response) => {
|
||||
const { data } = response
|
||||
this.temp.roles = data.join(',')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user