|
@@ -43,8 +43,30 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="24" v-if="form.isrole">
|
|
<el-col :span="24" v-if="form.isrole">
|
|
<el-form-item label="角色选择" prop="rolename">
|
|
<el-form-item label="角色选择" prop="rolename">
|
|
- <multipleRole ref="role" :data="form" @onResult="roleResult">
|
|
|
|
- <el-input type="text" readonly slot="input" v-model="form.rolename" @focus="$refs.role.drawer=true;$refs.role.normalSetId()"></el-input>
|
|
|
|
|
|
+ <multipleRole ref="role" :data="form" @onResult="roleResult" idName="roleid">
|
|
|
|
+ <div slot="input">
|
|
|
|
+ <el-tag
|
|
|
|
+ :key="index"
|
|
|
|
+ v-for="(tag,index) in form.roleArr"
|
|
|
|
+ closable
|
|
|
|
+ :disable-transitions="false"
|
|
|
|
+ @close="handleCloseRole(tag)"
|
|
|
|
+ style="margin-right:10px;margin-bottom:10px">
|
|
|
|
+ {{tag.rolename}}
|
|
|
|
+ </el-tag>
|
|
|
|
+ <el-input
|
|
|
|
+ class="input-new-tag"
|
|
|
|
+ v-if="inputVisibleRole"
|
|
|
|
+ v-model="inputValueRole"
|
|
|
|
+ ref="saveTagInputRole"
|
|
|
|
+ size="small"
|
|
|
|
+ @keyup.enter.native="handleInputConfirmRole"
|
|
|
|
+ @blur="handleInputConfirmRole"
|
|
|
|
+ style="width:88.81px"
|
|
|
|
+ >
|
|
|
|
+ </el-input>
|
|
|
|
+ <el-button v-else class="button-new-tag" size="small" @click="showInputRole">+ 添 加</el-button>
|
|
|
|
+ </div>
|
|
</multipleRole>
|
|
</multipleRole>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -55,8 +77,32 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="24" v-if="form.isuser">
|
|
<el-col :span="24" v-if="form.isuser">
|
|
<el-form-item label="人员选择" prop="username">
|
|
<el-form-item label="人员选择" prop="username">
|
|
- <multiplePeople :data="form" ref="user" @onResult="userResult">
|
|
|
|
- <el-input type="text" readonly slot="input" v-model="form.username" @focus="$refs.user.drawer=true;$refs.user.normalSetId()"></el-input>
|
|
|
|
|
|
+ <multiplePeople :data="form" ref="user" @onResult="userResult" idName="userid">
|
|
|
|
+ <div slot="input">
|
|
|
|
+ <el-tag
|
|
|
|
+ :key="index"
|
|
|
|
+ v-for="(tag,index) in form.userArr"
|
|
|
|
+ closable
|
|
|
|
+ :disable-transitions="false"
|
|
|
|
+ @close="handleClose(tag)"
|
|
|
|
+ style="margin-right:10px;margin-bottom:10px">
|
|
|
|
+ {{tag.name}}
|
|
|
|
+ </el-tag>
|
|
|
|
+ <el-input
|
|
|
|
+ class="input-new-tag"
|
|
|
|
+ v-if="inputVisible"
|
|
|
|
+ v-model="inputValue"
|
|
|
|
+ ref="saveTagInput"
|
|
|
|
+ size="small"
|
|
|
|
+ @keyup.enter.native="handleInputConfirm"
|
|
|
|
+ @blur="handleInputConfirm"
|
|
|
|
+ style="width:88.81px"
|
|
|
|
+ >
|
|
|
|
+ </el-input>
|
|
|
|
+ <el-button v-else class="button-new-tag" size="small" @click="showInput">+ 添 加</el-button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- <el-input type="text" readonly slot="input" v-model="form.username" @focus="$refs.user.drawer=true;$refs.user.normalSetId()"></el-input> -->
|
|
</multiplePeople>
|
|
</multiplePeople>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -93,9 +139,11 @@ export default {
|
|
isrole:1,
|
|
isrole:1,
|
|
roleids:[],
|
|
roleids:[],
|
|
rolename:'',
|
|
rolename:'',
|
|
|
|
+ roleArr:[],
|
|
isuser:1,
|
|
isuser:1,
|
|
userids:[],
|
|
userids:[],
|
|
username:'',
|
|
username:'',
|
|
|
|
+ userArr:[],
|
|
issql:1,
|
|
issql:1,
|
|
sqlstr:''
|
|
sqlstr:''
|
|
},
|
|
},
|
|
@@ -106,19 +154,36 @@ export default {
|
|
accountname:[
|
|
accountname:[
|
|
{ required: true, message: '输入账户名称', trigger: 'blur'}
|
|
{ required: true, message: '输入账户名称', trigger: 'blur'}
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ inputVisible:false,
|
|
|
|
+ inputValue:'',
|
|
|
|
+ inputVisibleRole:false,
|
|
|
|
+ inputValueRole:''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods:{
|
|
methods:{
|
|
editBtn () {
|
|
editBtn () {
|
|
this.dialogFormVisible = true
|
|
this.dialogFormVisible = true
|
|
this.form = Object.assign({},this.form,this.data)
|
|
this.form = Object.assign({},this.form,this.data)
|
|
- this.form.rolename = Object.values(this.form.rolemsg).join(',')
|
|
|
|
- this.form.username = Object.values(this.form.usermsg).join(',')
|
|
|
|
|
|
+ console.log(this.data,'数据')
|
|
|
|
+ this.form.userArr = this.form.userids.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ name:this.form.usermsg[item],
|
|
|
|
+ userid:item
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ this.form.roleArr = this.form.roleids.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ rolename:this.form.rolemsg[item],
|
|
|
|
+ roleid:item
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
onSubmit(){
|
|
onSubmit(){
|
|
this.$refs['form'].validate(async (valid) => {
|
|
this.$refs['form'].validate(async (valid) => {
|
|
if (!valid) return false
|
|
if (!valid) return false
|
|
|
|
+ this.form.userids = this.form.userArr.map(item => item.userid)
|
|
|
|
+ this.form.roleids = this.form.roleArr.map(item => item.roleid)
|
|
const res = await this.$api.requested({
|
|
const res = await this.$api.requested({
|
|
"id": "20221220153201",
|
|
"id": "20221220153201",
|
|
"version":1,
|
|
"version":1,
|
|
@@ -131,21 +196,73 @@ export default {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ handleClose(tag) {
|
|
|
|
+ this.form.userArr.splice(this.form.userArr.indexOf(tag), 1);
|
|
|
|
+ this.form.userids.splice(this.form.userids.indexOf(tag.userid),1)
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ showInput() {
|
|
|
|
+ this.inputVisible = true;
|
|
|
|
+ this.$nextTick(_ => {
|
|
|
|
+ this.$refs.saveTagInput.$refs.input.focus();
|
|
|
|
+ this.$refs.user.normalSetId()
|
|
|
|
+ this.$refs.user.drawer = true
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleInputConfirm() {
|
|
|
|
+ let inputValue = this.inputValue
|
|
|
|
+ if (inputValue) {
|
|
|
|
+ this.form.usermsg.push(inputValue)
|
|
|
|
+ }
|
|
|
|
+ this.inputVisible = false
|
|
|
|
+ this.inputValue = ''
|
|
|
|
+ },
|
|
|
|
+ handleCloseRole(tag) {
|
|
|
|
+ this.form.roleArr.splice(this.form.roleArr.indexOf(tag), 1);
|
|
|
|
+ this.form.roleids.splice(this.form.roleids.indexOf(tag.roleid),1)
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ showInputRole() {
|
|
|
|
+ this.inputVisibleRole = true;
|
|
|
|
+ this.$nextTick(_ => {
|
|
|
|
+ this.$refs.saveTagInputRole.$refs.input.focus();
|
|
|
|
+ this.$refs.role.normalSetId()
|
|
|
|
+ this.$refs.role.drawer = true
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleInputConfirmRole() {
|
|
|
|
+ let inputValueRole = this.inputValueRole
|
|
|
|
+ if (inputValueRole) {
|
|
|
|
+ this.form.usermsg.push(inputValueRole)
|
|
|
|
+ }
|
|
|
|
+ this.inputVisibleRole = false
|
|
|
|
+ this.inputValueRole = ''
|
|
|
|
+ },
|
|
/* 角色选择结果 */
|
|
/* 角色选择结果 */
|
|
roleResult (result) {
|
|
roleResult (result) {
|
|
- this.form.rolename = result.map(item => item.rolename).join(',')
|
|
|
|
- this.form.roleids = result.map(item => item.roleid)
|
|
|
|
- console.log(this.form.rolename,result);
|
|
|
|
-
|
|
|
|
|
|
+ result.forEach(item => {
|
|
|
|
+ let is = this.form.roleArr.filter(item2 => item2.roleid == item.roleid)
|
|
|
|
+ if (!is.length) this.form.roleArr.push(item)
|
|
|
|
+ })
|
|
|
|
+ console.log(this.form.roleArr);
|
|
},
|
|
},
|
|
/* 人员选择结果 */
|
|
/* 人员选择结果 */
|
|
userResult (result) {
|
|
userResult (result) {
|
|
console.log(result);
|
|
console.log(result);
|
|
-
|
|
|
|
- this.form.username = result.map(item => item.name).join(',')
|
|
|
|
- this.form.userids = result.map(item => item.userid)
|
|
|
|
- console.log(this.form.username,this.form.userids);
|
|
|
|
-
|
|
|
|
|
|
+ result.forEach(item => {
|
|
|
|
+ let is = this.form.userArr.filter(item2 => item2.userid == item.userid)
|
|
|
|
+ if (!is.length) this.form.userArr.push(item)
|
|
|
|
+ })
|
|
|
|
+ // this.form.userArr.forEach(u => {
|
|
|
|
+ // result.forEach(r => {
|
|
|
|
+ // let result = u.filter(f => f.userid == r.userid)
|
|
|
|
+ // if (!result.length) {
|
|
|
|
+ // this.form.userArr.push(r)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|