|
@@ -62,21 +62,21 @@
|
|
|
<div class="newUserManagement-content-right-top">
|
|
|
<div class="head flex">
|
|
|
<div class="title">账号组信息</div>
|
|
|
- <el-button @click="handleSave" type="primary" size="small">保存</el-button>
|
|
|
+ <el-button @click="handleSave" type="primary" size="small" :disabled="editGroupDisabled">保存</el-button>
|
|
|
</div>
|
|
|
<div class="contents">
|
|
|
<el-form :inline="true" :rules="rules" ref="form" :model="formInline" class="demo-form-inline">
|
|
|
<el-form-item prop="user_group_name" label="账号组名称">
|
|
|
- <el-input style="width:260px;margin-right: 30px;" size="small" v-model="formInline.user_group_name" placeholder="请输入账号组名称"></el-input>
|
|
|
+ <el-input style="width:260px;margin-right: 30px;" size="small" v-model="formInline.user_group_name" placeholder="请输入账号组名称" :disabled="editGroupDisabled"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="up_user_group_name" label="上级用户组">
|
|
|
- <el-select style="width:260px;margin-right: 30px;" size="small" clearable v-model="formInline.up_user_group_id" placeholder="请选择上级用户组">
|
|
|
+ <el-select style="width:260px;margin-right: 30px;" size="small" clearable v-model="formInline.up_user_group_id" placeholder="请选择上级用户组" :disabled="editGroupDisabled">
|
|
|
<el-option v-for="item in arrTree" :key="item.user_group_id" :label="item.user_group_name" :value="item.user_group_id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="描述">
|
|
|
- <el-input style="width:260px;" size="small" v-model="formInline.user_group_comment" placeholder="请输入描述"></el-input>
|
|
|
+ <el-input style="width:260px;" size="small" v-model="formInline.user_group_comment" placeholder="请输入描述" :disabled="editGroupDisabled"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -84,7 +84,7 @@
|
|
|
<div class="newUserManagement-content-right-bottom">
|
|
|
<div class="head flex">
|
|
|
<div class="title">账号列表</div>
|
|
|
- <el-button @click="handleTableAdd" type="primary" size="small">新增</el-button>
|
|
|
+ <el-button @click="handleTableAdd" type="primary" size="small" :disabled="addUserDisabled">新增</el-button>
|
|
|
</div>
|
|
|
<div class="contents">
|
|
|
<el-table :data="tableData" height="100%" border style="width: 100%">
|
|
@@ -259,7 +259,7 @@ export default {
|
|
|
paswordFlag: false,//修改密码
|
|
|
tableFlag: false,
|
|
|
title: '新增',
|
|
|
- type: 'add',
|
|
|
+ type: '',
|
|
|
dataType: 'add',
|
|
|
dataTitle: '新增账号',
|
|
|
dataObj: {},
|
|
@@ -299,6 +299,12 @@ export default {
|
|
|
dataList () {
|
|
|
return this.arrs
|
|
|
},
|
|
|
+ editGroupDisabled () {
|
|
|
+ return !this.type
|
|
|
+ },
|
|
|
+ addUserDisabled () {
|
|
|
+ return !this.treeCheckId
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
async getTreeData () {
|
|
@@ -316,16 +322,16 @@ export default {
|
|
|
return data.user_group_name.indexOf(value) !== -1;
|
|
|
},
|
|
|
handleAdd () {
|
|
|
- const datas = this.arrs.filter(item => item.user_group_name == '新建账号组')
|
|
|
- if (datas && datas.length) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.arrs.push({ user_group_name: '新建账号组', user_group_id: 'test' })
|
|
|
this.type = 'add'
|
|
|
this.treeCheckId = null
|
|
|
this.tableData = []
|
|
|
this.clearForm()
|
|
|
this.formInline.user_group_name = '新建账号组'
|
|
|
+ const datas = this.arrs.filter(item => item.user_group_name == '新建账号组')
|
|
|
+ if (datas && datas.length) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.arrs.push({ user_group_name: '新建账号组', user_group_id: 'test' })
|
|
|
// console.log(this.arrs)
|
|
|
// this.treeCheckId = this.arrs[this.arrs.length-1].user_group_id
|
|
|
},
|
|
@@ -403,6 +409,7 @@ export default {
|
|
|
const { user_name } = this.dataObj
|
|
|
const { user_group_id } = this.treeCheckObj
|
|
|
const { code } = await this.getChangeList(SERVICE_ID.getUserTableId, { user_name, up_user_group_id: user_group_id }, 3)
|
|
|
+ this.tipMsg(code)
|
|
|
if (code == 0) {
|
|
|
const { returnData } = await this.getQueryList(SERVICE_ID.getUserTableId, {
|
|
|
up_user_group_id: this.dataObj.up_user_group_id
|
|
@@ -418,6 +425,7 @@ export default {
|
|
|
this.$refs['form'].validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
let code = null
|
|
|
+ let mesResult = null
|
|
|
this.formInline.user_group_id = this.treeCheckId
|
|
|
const data = _.cloneDeep(this.formInline)
|
|
|
// console.log(this.type)
|
|
@@ -435,6 +443,7 @@ export default {
|
|
|
result = await this.getChangeList(this.queryId, data, 1)
|
|
|
}
|
|
|
code = result.code
|
|
|
+ mesResult = result
|
|
|
}
|
|
|
}
|
|
|
if (code == 0) {
|
|
@@ -442,8 +451,14 @@ export default {
|
|
|
this.clearForm()
|
|
|
}
|
|
|
this.getTreeData()
|
|
|
+ this.tipMsg(code)
|
|
|
+ } else {
|
|
|
+ if (mesResult.code == -1 && mesResult.message.toString().includes('for key')) {
|
|
|
+ this.tipMsg(code, '账号组名称重复,请重新输入')
|
|
|
+ } else {
|
|
|
+ this.tipMsg(code)
|
|
|
+ }
|
|
|
}
|
|
|
- this.tipMsg(code)
|
|
|
}
|
|
|
else {
|
|
|
return false
|
|
@@ -565,8 +580,12 @@ export default {
|
|
|
this.ruleForm.up_user_group_id = this.ruleForm.user_group_id
|
|
|
delete this.ruleForm.user_group_id
|
|
|
const data = this.ruleForm
|
|
|
- const { code } = await this.getChangeList(SERVICE_ID.getUserTableId, data, 1)
|
|
|
- this.tipMsg(code)
|
|
|
+ const { code, message } = await this.getChangeList(SERVICE_ID.getUserTableId, data, 1)
|
|
|
+ if (code == -1 && message.toString().includes('for key')) {
|
|
|
+ this.tipMsg(code, '账号名称重复,请重新输入')
|
|
|
+ } else {
|
|
|
+ this.tipMsg(code)
|
|
|
+ }
|
|
|
} else {
|
|
|
const id = this.ruleForm.user_group_id || this.ruleForm.user_id
|
|
|
if (id) {
|