Commit c46d3d45 by 胡悦

9.25提交

1 parent b2ccf800
......@@ -18,9 +18,7 @@
</gl-col>
<gl-col :span="12">
<gl-form-item label="手机号码" prop="mobile">
<gl-input v-model="userManageForm.mobile"
prefix-icon='el-icon-mobile-phone'
placeholder='请输入手机号码' clearable></gl-input>
<gl-input v-model="userManageForm.mobile" placeholder='请输入手机号码' :prop="/1[358]\d{9}/" clearable></gl-input>
</gl-form-item>
</gl-col>
<gl-col :span="12">
......@@ -29,9 +27,8 @@
</gl-form-item>
</gl-col>
<gl-col :span="12">
<gl-form-item label="邮箱" prop="email">
<gl-input v-model='userManageForm.email' placeholder='请输入电子邮箱' clearable>
</gl-input>
<gl-form-item prop="email" label="邮箱">
<gl-input v-model='userManageForm.email' placeholder='请输入电子邮箱' clearable></gl-input>
</gl-form-item>
</gl-col>
<gl-col :span="12">
......@@ -39,7 +36,7 @@
<gl-select v-model="userManageForm.state" placeholder="启用">
<gl-option label="启用" value='0'></gl-option>
<gl-option label="禁用" value='1'></gl-option>
</gl-select>
</gl-select>
</gl-form-item>
</gl-col>
<gl-col :span="12">
......@@ -52,14 +49,11 @@
</gl-col>
<gl-col :span="24">
<gl-form-item label="所属部门" prop="departName">
<!-- <gl-select v-model="userManageForm.departName" placeholder="请选择">
<gl-option
v-for="item in userManageForm.options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select> -->
<!-- <gl-select v-model="userManageForm.departId" placeholder="请选择">
<gl-option style="height:160px">
<tree ref='tree' :isDepart="isDepart" :defaultExpandAll="defaultExpandAll" @node-click='clickDepart' style="height:160px"></tree>
</gl-option>
</gl-select> -->
<gl-select v-model="userManageForm.departId" placeholder="请选择">
<gl-option
v-for="item in userManageForm.options"
......@@ -71,10 +65,10 @@
</gl-form-item>
</gl-col>
<gl-col :span="24">
<gl-form-item label="角色选项" prop="roles">
<gl-col :span="10">
<gl-checkbox v-for="item in userManageForm.roleList" :key="item.id" v-model="item.isSelect" @change="handleCheckedChange">{{item.roleName}}</gl-checkbox>
</gl-col>
<gl-form-item label="角色选项" prop="roles">
<gl-checkbox-group class="height" v-model="list" @change="handleCheckedChange">
<gl-checkbox v-for="item in userManageForm.roleList" :key="item.id" :label='item.id'>{{item.roleName}}</gl-checkbox>
</gl-checkbox-group>
</gl-form-item>
</gl-col>
</gl-form>
......@@ -103,13 +97,13 @@ export default {
}
},
mounted() {
this.userManageForm.roleList.forEach(element => {
element.isSelect = false
})
// this.list = this.userManageForm.roleList.map(item => item.roleName)
},
data() {
return {
state: '1',
isDepart: true,
defaultExpandAll: true,
list: [],
tel: '[ 1, /[34578]/, /d/{9}]',
rules: {
username: [
......@@ -118,10 +112,22 @@ export default {
],
realname: [
{ required: true, message: '请输入用户真实名字', trigger: 'blur' }
// { min: 2, max: 4, message: '长度在 2 到 4 个字符', trigger: 'blur' }
],
password: [
{ required: true, message: '请输入用户密码', trigger: 'blur' }
],
mobile: [
{ required: true, message: '请输入正确的手机号码', trigger: 'blur' }
],
joinip: [
{ required: true, message: '请输入注册IP', trigger: 'blur' }
],
email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
],
departName: [
{ required: true, message: '请输入所属部门', trigger: 'blur' }
]
}
}
......@@ -140,14 +146,24 @@ export default {
message: message
})
},
clickDepart(data, treeData, vue, props) {
if (data.parent !== '#' || !data.children) {
this.createRuleForm.departId = data.id
this.createRuleForm.departPath = data.type
this.getDepartName(treeData)
this.createRuleForm.departName = this.departName.join(' - ')
this.departName = []
}
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
const userData = this.$deep_clone(this.userManageForm)
console.log(userData.roleList)
// userData.roleList = userData.roleList.map(item => item.id).join(',')
userData.roles = userData.roles.join(',')
// userData.roles = this.handleCheckedChange()
// userData.departId = userData.options.map(item => item.value).join(',')
console.log(userData)
console.log(userData.roles)
const isflagId = userData.id
if (valid) {
this.$emit('userFormData', isflagId, userData)
......@@ -161,10 +177,8 @@ export default {
this.$emit('userFormData')
},
handleCheckedChange(value) {
// console.log(value)
// this.userManageForm.roleList.map(item => {
// item.isSelect = value
// })
console.log(value.join(','))
return value.join(',')
}
}
}
......@@ -172,8 +186,17 @@ export default {
<style scoped>
.el-checkbox + .el-checkbox {
margin-left: 0 !important;
width: 100%;
}
.height {
height: 100px;
overflow-y: auto;
}
</style>
<style>
.el-form-item__content{
line-height: 22px !important;
}
</style>
......@@ -23,6 +23,7 @@
</template>
<script>
var consoleState = '禁用'
import { UserCreate, UserDetail } from '@/components/index'
// 接口
import { findAll, updateUser, getRoleList, batcheDelUser, operatUser } from '@/api/api'
......@@ -39,6 +40,7 @@ export default {
return {
userName: '',
toggle: [],
state: '0',
dialogFormVisible: false,
userManageForm: this.$deep_clone(userForm),
userDetailVisible: false,
......@@ -77,19 +79,19 @@ export default {
label: '状态',
prop: 'state',
formatter: (cellValue) => {
return cellValue < 1 ? '禁止' : '启动'
return +cellValue.state < 1 ? '禁止' : '启动'
}
}, {
label: '创建时间',
prop: 'createTime'
}],
// number: {
// label: '序号',
// index: (index) => {
// ++index
// return index < 10 && index > 0 ? '0' + index : index
// }
// },
number: {
label: '序号',
index: (index) => {
++index
return index < 10 && index > 0 ? '0' + index : index
}
},
console: {
label: '操作',
prop: 'operation',
......@@ -106,10 +108,20 @@ export default {
this.handleGetUserDetail(index, rows)
}
}, {
label: '禁用',
label: consoleState,
type: 'text',
formatter(cellValue) {
},
callback: (index, rows) => {
this.$alert(rows[index])
// rows[index].state = '0'
console.log(rows[index].state)
this.$set(rows[index], 'state', '1')
console.log(rows[index].state)
// this.state = '1'
// console.log(this.updateState())
// this.updateState()
// console.log(consoleState)
// this.$alert(rows[index])
}
}, {
label: '删除',
......@@ -169,7 +181,6 @@ export default {
getRoleOptions() {
getRoleList.req().then(res => {
userForm.roleList = res.list
console.log(res)
})
},
// 新增更新用户接口请求
......@@ -184,7 +195,6 @@ export default {
},
// 删除用户接口
batcheDel(params) {
console.log(params)
if (params) {
batcheDelUser.req({ ids: params }).then(res => {
this.findUserList()
......@@ -195,7 +205,6 @@ export default {
},
// 删除、禁用、启用接口
operatUser(params) {
console.log(params)
if (params) {
operatUser.req(params).then(res => {
this.findUserList()
......@@ -214,10 +223,8 @@ export default {
},
// 新增按钮
createUser(userManageForm) {
console.log(userManageForm)
if (userManageForm) {
userManageForm.roleList = this.$deep_clone(userForm.roleList)
console.log(userManageForm.roleList)
userManageForm.options = userForm.options
userManageForm.state = userManageForm.state + ''
userManageForm.isadmin = userManageForm.isadmin + ''
......@@ -226,27 +233,20 @@ export default {
arr.forEach(index => {
userManageForm.roleList.forEach(item => {
if (+item.id === +index) {
console.log(item.id)
item.isSelect = true
console.log(item)
return false
}
})
})
this.userManageForm = this.$deep_clone(userManageForm)
})
// this.userManageForm = this.$deep_clone(userManageForm)
} else {
this.userManageForm = this.$deep_clone(userForm)
}
console.log(userManageForm)
// this.userManageForm = userManageForm ? this.$deep_clone(userManageForm) : this.$deep_clone(userForm)
// console.log(userManageForm)
this.dialogFormVisible = !this.dialogFormVisible
},
// 获取选中的行
handleSelectionChange(val, row) {
// this.multipleSelection = val
this.toggle = val
},
// 删除选中的行
......@@ -275,21 +275,7 @@ export default {
this.findUserList()
},
confirmDeleteOrNot(index, rows) {
console.log(rows[index].id)
this.operatUser({ id: rows[index].id, state: 2 })
// this.delectUser(rows[index].id)
// this.$confirm('确定要删除这条数据?', '', {
// confirmButtonTest: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// // this.userData.data.splice(index, 1)
// rows.splice(index, 1)
// this.message('success', '删除成功')
// }).catch(() => {
// this.message('', '取消删除')
// })
},
changeShowNumber(command) {
this.showNumber = command
......@@ -307,6 +293,16 @@ export default {
handleUserDetailClose() {
this.userDetailDialogVisible()
this.apiParam = Number
},
// 修改启用禁用
updateState() {
if (this.state === '0') {
consoleState = '禁用'
return consoleState
} else {
consoleState = '启用'
return consoleState
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!