Commit c46d3d45 by 胡悦

9.25提交

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