Commit a06ceffb by liwk

Merge branch 'master' of https://github.com/glsx-web/authority

2 parents 82c3190c 935bc948
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
:check-strictly="checkStrictly" :check-strictly="checkStrictly"
@check='check' @check='check'
@node-click='nodeClick' @node-click='nodeClick'
v-loading="loading"
gl-loading-text="拼命加载中"
gl-loading-icon="el-icon-loading"
></gl-tree> ></gl-tree>
</div> </div>
</template> </template>
...@@ -23,6 +26,7 @@ export default { ...@@ -23,6 +26,7 @@ export default {
data() { data() {
return { return {
data: null, data: null,
loading: true,
checkStrictly: true, checkStrictly: true,
props: { props: {
label: 'text' label: 'text'
...@@ -30,7 +34,7 @@ export default { ...@@ -30,7 +34,7 @@ export default {
} }
}, },
props: { props: {
keyFresh: Boolean, keyFresh: [Boolean, Array, Function],
showCheckbox: Boolean, showCheckbox: Boolean,
value: null, value: null,
defaultExpandAll: Boolean, defaultExpandAll: Boolean,
...@@ -75,11 +79,13 @@ export default { ...@@ -75,11 +79,13 @@ export default {
? findMenuTree.req().then(res => { ? findMenuTree.req().then(res => {
// console.log(res) // console.log(res)
this.data = fn(res, '#') this.data = fn(res, '#')
this.loading = false
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
: findDepartTree.req().then(res => { : findDepartTree.req().then(res => {
this.data = fn(res, '#') this.data = fn(res, '#')
this.loading = false
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<el-col :span="12"> <el-col :span="12">
<gl-form-item label="用户名" prop="username"> <gl-form-item label="用户名" prop="username">
<gl-input v-model="userManageForm.username" clearable></gl-input> <gl-input v-model="userManageForm.username" clearable></gl-input>
<!-- <div v-show="!isEdit" class="err">{{msg}}</div> -->
</gl-form-item> </gl-form-item>
</el-col> </el-col>
<gl-col :span="12"> <gl-col :span="12">
...@@ -20,12 +21,14 @@ ...@@ -20,12 +21,14 @@
</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" placeholder='请输入手机号码' :prop="/1[358]\d{9}/" clearable></gl-input> <gl-masked v-model="userManageForm.mobile" :mask="[ 1, /[34578]/, /\d/, /\d/, /\d/,/\d/, /\d/, /\d/,/\d/, /\d/, /\d/]" placeholder='请输入手机号码' clearable></gl-masked>
<!-- <gl-input v-model="userManageForm.mobile" placeholder='请输入手机号码' :prop="tel" clearable></gl-input> -->
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label="注册IP" prop="joinip"> <gl-form-item label="注册IP" prop="joinip">
<gl-input v-model="userManageForm.joinip" clearable></gl-input> <gl-masked v-model="userManageForm.joinip" :mask="tel" placeholder='请输入手机号码' clearable></gl-masked>
<!-- <gl-input v-model="userManageForm.joinip" clearable></gl-input> -->
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
...@@ -89,6 +92,7 @@ export default { ...@@ -89,6 +92,7 @@ export default {
dialogFormVisible: Boolean, dialogFormVisible: Boolean,
userManageForm: Object, userManageForm: Object,
isEdit: Boolean isEdit: Boolean
// msg: String
}, },
components: { components: {
userForm userForm
...@@ -116,7 +120,7 @@ export default { ...@@ -116,7 +120,7 @@ export default {
placeholder: '', placeholder: '',
defaultExpandAll: true, defaultExpandAll: true,
val: '', val: '',
tel: '[ 1, /[34578]/, /d/{9}]', tel: [/\d{1,3}/, '.', /\d{1,3}/, '.', /\d{1,3}/,'.', /\d{1,3}/],
rules: { rules: {
username: [ username: [
{ required: true, message: '请输入用户名', trigger: 'blur' } { required: true, message: '请输入用户名', trigger: 'blur' }
...@@ -178,6 +182,14 @@ export default { ...@@ -178,6 +182,14 @@ export default {
return true return true
} }
}, },
// isPoneAvailable(pone) {
// this.tel = '/^[1][3,4,5,7,8][0-9]{9}$/'
// if (!this.tel.test(pone)) {
// return false
// } else {
// return true
// }
// },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate(valid => { this.$refs[formName].validate(valid => {
this.userData = this.$deep_clone(this.userManageForm) this.userData = this.$deep_clone(this.userManageForm)
......
...@@ -42,6 +42,7 @@ export default { ...@@ -42,6 +42,7 @@ export default {
isEdit: true, isEdit: true,
departList: [], departList: [],
dialogFormVisible: false, dialogFormVisible: false,
// msg: '',
userManageForm: this.$deep_clone(userForm), userManageForm: this.$deep_clone(userForm),
userDetailVisible: false, userDetailVisible: false,
userDetailTitle: '用户详情', userDetailTitle: '用户详情',
...@@ -101,7 +102,7 @@ export default { ...@@ -101,7 +102,7 @@ export default {
} }
}, },
console: { console: {
// show: true, show: true,
label: '操作', label: '操作',
prop: 'operation', prop: 'operation',
button: [{ button: [{
...@@ -120,18 +121,26 @@ export default { ...@@ -120,18 +121,26 @@ export default {
}, { }, {
label: '禁用', label: '禁用',
type: 'text', type: 'text',
formatter(index, column, rows) { formatter(row) {
console.log(rows[index]) return row.state < 1 ? '启动' : '禁用'
// column.label = rows[index].state < 1 ? '启动' : '禁用'
}, },
callback: (index, rows) => { callback: (index, rows) => {
console.log(rows[index].state) this.$confirm('确定要修改这条数据?', '', {
if (rows[index].state < 1) { confirmButtonText: '确定',
this.$set(rows[index], 'state', '1') cancelButtonText: '取消',
} else { type: 'warning'
this.$set(rows[index], 'state', '0') }).then(() => {
} if (rows[index].state < 1) {
console.log(rows[index].state) this.$set(rows[index], 'state', '1')
this.operatUser({ id: rows[index].id, state: 1 })
} else {
this.$set(rows[index], 'state', '0')
this.operatUser({ id: rows[index].id, state: 0 })
}
this.message('修改成功', 'success')
}).catch(() => {
this.message('修改失败', 'info')
})
} }
}, { }, {
label: '删除', label: '删除',
...@@ -202,9 +211,11 @@ export default { ...@@ -202,9 +211,11 @@ export default {
console.log(res) console.log(res)
this.message('操作成功', 'success') this.message('操作成功', 'success')
// this.createOrEditSuccess() // this.createOrEditSuccess()
this.dialogFormVisible = !this.dialogFormVisible
this.findUserList() this.findUserList()
}).catch(message => { }).catch(message => {
console.log(message) console.log(message)
// this.msg = message
this.message(message, 'error') this.message(message, 'error')
}) })
} }
...@@ -231,11 +242,19 @@ export default { ...@@ -231,11 +242,19 @@ export default {
}, },
// 接受子组件传递的值 // 接受子组件传递的值
handleUserFormData(isEdit, params) { handleUserFormData(isEdit, params) {
this.userManageForm = {} console.log(params)
!params && this.message('取消操作', 'warning') // this.userManageForm = {}
console.log(this.userManageForm.roles) if (params) {
params && this.updateUser_Post(params) this.updateUser_Post(params)
this.dialogFormVisible = !this.dialogFormVisible } else {
this.dialogFormVisible = !this.dialogFormVisible
this.message('取消操作', 'info')
}
// !params && this.message('取消操作', 'info')
// params && this.updateUser_Post(params)
// if (!params) {
// this.dialogFormVisible = !this.dialogFormVisible
// }
}, },
// 新增按钮 // 新增按钮
createUser(userManageForm) { createUser(userManageForm) {
...@@ -245,6 +264,7 @@ export default { ...@@ -245,6 +264,7 @@ export default {
}, },
// 编辑按钮 // 编辑按钮
editUser(row) { editUser(row) {
console.log(row)
row.password = '' row.password = ''
row.roleList = this.$deep_clone(userForm.roleList) row.roleList = this.$deep_clone(userForm.roleList)
row.state = row.state + '' row.state = row.state + ''
...@@ -259,8 +279,8 @@ export default { ...@@ -259,8 +279,8 @@ export default {
if (row.roles && typeof (row.roles) === 'string') { if (row.roles && typeof (row.roles) === 'string') {
row.roles = (row.roles + '').split(',').map(role => +role) row.roles = (row.roles + '').split(',').map(role => +role)
} else { } else {
console.log(12312) (typeof (row.roles) === 'object') && row.roles
row.roles = [] !(typeof (row.roles) === 'object') && []
} }
this.userManageForm = this.$deep_clone(row) this.userManageForm = this.$deep_clone(row)
}) })
...@@ -288,9 +308,10 @@ export default { ...@@ -288,9 +308,10 @@ export default {
}).catch(() => { }).catch(() => {
this.message('取消删除', 'info') this.message('取消删除', 'info')
}) })
} else {
this.message('', '操作失败')
} }
// else {
// this.message('', '操作失败')
// }
}, },
// 提示 // 提示
createOrEditSuccess() { createOrEditSuccess() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!