代码更新

This commit is contained in:
2022-12-12 15:08:52 +08:00
parent 06af0f8c90
commit 43db0673a4
3 changed files with 46 additions and 19 deletions

View File

@@ -89,9 +89,8 @@ export default {
type: Boolean,
default: true
},
materOptCode: {
type: String,
default: '00'
depts: {
type: Array
}
},
data() {
@@ -116,6 +115,17 @@ export default {
this.tableRadio = item
},
open() {
// 回显
this.$nextTick(function() {
for (var k = 0; k < this.depts.length; k++) {
for (var i = 0; i < this.crud.data.length; i++) {
if (this.crud.data[i].dept_id == this.depts[k].dept_id) {
this.$refs.table.toggleRowSelection(this.crud.data[i], true)
break
}
}
}
})
},
handleSelectionChange(val, row) {
if (val.length > 1 && this.isSingle) {

View File

@@ -91,9 +91,8 @@ export default {
type: Boolean,
default: true
},
materOptCode: {
type: String,
default: '00'
users: {
type: Array
}
},
data() {
@@ -118,6 +117,16 @@ export default {
this.tableRadio = item
},
open() {
this.$nextTick(function() {
for (var k = 0; k < this.users.length; k++) {
for (var i = 0; i < this.crud.data.length; i++) {
if (this.crud.data[i].user_id == this.users[k].user_id) {
this.$refs.table.toggleRowSelection(this.crud.data[i], true)
break
}
}
}
})
},
handleSelectionChange(val, row) {
if (val.length > 1 && this.isSingle) {

View File

@@ -290,8 +290,8 @@
<el-button type="primary" @click="savePermise()">确认</el-button>
</div>
</el-dialog>
<relevance-user-dialog :dialog-show.sync="relevanceUser" :is-single="false" @selectUsers="selectUsers" />
<relevance-dept-dialog :dialog-show.sync="relevanceDept" :is-single="false" @selectDepts="selectDepts" />
<relevance-user-dialog :dialog-show.sync="relevanceUser" :is-single="false" :users="userIds" @selectUsers="selectUsers" />
<relevance-dept-dialog :dialog-show.sync="relevanceDept" :is-single="false" :depts="deptIds" @selectDepts="selectDepts" />
</div>
</template>
@@ -374,7 +374,9 @@ export default {
multipleSelection: [], // 选中
relevanceUser: false, // 关联用户
rowData: {}, // 当行数据
relevanceDept: false // 关联部门
relevanceDept: false, // 关联部门
deptIds: [],
userIds: []
}
},
computed: {
@@ -656,18 +658,20 @@ export default {
// 回显数据
crudDataPermission.getDataShow(row.user_id).then(res => {
console.log('回显数据', res)
for (var index = 0; index < res.length; index++) {
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
if (this.dataDialog.dataScopeType[i].value == res[index].permission_scope_type) {
this.dataDialog.dataScopeType[i].permission_id = res[index].permission_id
if (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
// 选中
this.$refs.dialogTable.toggleRowSelection(this.dataDialog.dataScopeType[i], true)
break
this.$nextTick(function() {
for (var index = 0; index < res.length; index++) {
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
if (this.dataDialog.dataScopeType[i].value == res[index].permission_scope_type) {
this.dataDialog.dataScopeType[i].permission_id = res[index].permission_id
if (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
// 选中
this.$refs.dialogTable.toggleRowSelection(this.dataDialog.dataScopeType[i], true)
break
}
}
}
}
})
console.log(this.dataDialog.dataScopeType)
})
})
@@ -687,10 +691,14 @@ export default {
}
this.$set(this.dataDialog.dataScopeType[index], this.dataDialog.dataScopeType[index].permission_id, row.permission_id)
this.rowData = {}
this.deptIds = []
this.userIds = []
if (row.permission_id == '1601040560293023744') { // 用户
this.userIds = this.dataDialog.dataScopeType[index].users
this.rowData = row
this.relevanceUser = true
} else if (row.permission_id == '1601040621190123520') {
this.deptIds = this.dataDialog.dataScopeType[index].depts
this.rowData = row
this.relevanceDept = true
}