| | |
| | | <div style="margin-left: 10px;display: flex"> |
| | | <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button> |
| | | <el-button type="primary" icon="el-icon-setting" @click="settingButton">设置</el-button> |
| | | <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button> |
| | | <!-- <el-button type="primary" icon="el-icon-upload2" @click="upload">导入</el-button>--> |
| | | </div> |
| | | <el-divider /> |
| | | <div class="elTableDiv"> |
| | |
| | | sortable="custom" |
| | | /> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | prop="is_user" |
| | | label="关联用户" |
| | | width="120" |
| | | sortable="custom" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <i class="el-icon-user-solid" @click="userClick(row)" /> |
| | | <i v-if="row.is_user==='Y'" class="el-icon-user-solid" @click="userClick(row)" /> |
| | | <i v-if="row.is_user==='N'" class="el-icon-user-solid" style="color: #E4E7ED" @click="userClick(row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="lm_date" |
| | | prop="is_right" |
| | | label="分配权限" |
| | | sortable="custom" |
| | | width="120" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <i class="el-icon-share" @click="rightClick(row)" /> |
| | | <i v-if="row.is_right==='Y'" class="el-icon-share" @click="rightClick(row)" /> |
| | | <i v-if="row.is_right==='N'" class="el-icon-share" style="color: #E4E7ED" @click="rightClick(row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | } from '@/api/jcsz' |
| | | import { getCookie } from '@/utils/auth' |
| | | import $ from 'jquery' |
| | | import clearAllChildren from '@/utils/global' |
| | | |
| | | const SER_HZ = /^[\u4e00-\u9fa5]+$/ |
| | | export default { |
| | |
| | | children: 'children', |
| | | label: 'name', |
| | | value: 'code' |
| | | } |
| | | }, |
| | | PCTrue: false, // 是否展示 |
| | | APPTrue: false// 是否展示 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | // 获取所属组织 |
| | | async getUserOrganization() { |
| | | const { data: res } = await UserOrganization() |
| | | this.StuOrgArr = res |
| | | this.StuOrgArr = clearAllChildren(res) |
| | | }, |
| | | // 排序改变时 |
| | | sortChange({ column, prop, order }) { |
| | |
| | | const res = await SaveRoleAssoctUser(userMultipleArr, this.dialogFormUser.rolecode) |
| | | if (res.code === '200') { |
| | | this.$message.success('保存成功!') |
| | | await this.getRoleSearch() |
| | | this.userDialogVisible = false |
| | | } |
| | | }, |
| | |
| | | this.dialogFormUser.orgcode = '' |
| | | this.dialogFormUser.isrole = '' |
| | | this.$refs.dialogCascaderUser.checkedValue = '' |
| | | this.getRoleAssociationUser() |
| | | }, |
| | | |
| | | /* 角色关联权限对话框部分*/ |
| | |
| | | type: '' |
| | | } |
| | | const { data: res } = await RoleAssociationRight(data)// 接口获取数据 |
| | | this.dialogFormRight.rightPCArr = res[0] |
| | | this.dialogFormRight.rightAPPArr = res[1] |
| | | // '0'显示 '1' 不显示 |
| | | this.dialogFormRight.rightPCArr = res[0][0].is_delete === '0' ? res[0] : [] |
| | | this.dialogFormRight.rightAPPArr = res[1][0].is_delete === '0' ? res[1] : [] |
| | | |
| | | this.PCTrue = res[0][0].is_delete === '0' |
| | | this.APPTrue = res[1][0].is_delete === '0' |
| | | |
| | | if (this.PCTrue) { |
| | | this.dialogFormRight.rightPCArr[0].children.forEach((item, index) => { |
| | | if (item.is_delete === '1') { |
| | | this.dialogFormRight.rightPCArr[0].children.splice(index, 1) |
| | | } else { |
| | | if (item.children.length > 0 && item.children) { |
| | | item.children.forEach((it, ind) => { |
| | | if (it.is_delete === '1') { |
| | | item.children.splice(ind, 1) |
| | | } |
| | | }) |
| | | } |
| | | if (item.children.length === 0) { |
| | | this.dialogFormRight.rightPCArr[0].children.splice(index, 1) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if (this.APPTrue) { |
| | | this.dialogFormRight.rightAPPArr[0].children.forEach((item, index) => { |
| | | if (item.is_delete === '1') { |
| | | this.dialogFormRight.rightAPPArr[0].children.splice(index, 1) |
| | | } else { |
| | | if (item.children.length > 0 && item.children) { |
| | | item.children.forEach((it, ind) => { |
| | | if (it.is_delete === '1') { |
| | | item.children.splice(ind, 1) |
| | | } |
| | | }) |
| | | } |
| | | if (item.children.length === 0) { |
| | | this.dialogFormRight.rightAPPArr[0].children.splice(index, 1) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 判断哪个是高亮 |
| | | let pcIsSelected1 = false |
| | | let pcIsSelected2 = false |
| | | let appIsSelected1 = false |
| | | let appIsSelected2 = false |
| | | const rightPCArrFlag = res[0][0].flag |
| | | const rightAPPArrFlag = res[1][0].flag |
| | | let rightPCArrFlag |
| | | let rightAPPArrFlag |
| | | |
| | | if (this.PCTrue) { |
| | | rightPCArrFlag = this.dialogFormRight.rightPCArr[0].flag |
| | | } |
| | | if (this.APPTrue) { |
| | | rightAPPArrFlag = this.dialogFormRight.rightAPPArr[0].flag |
| | | } |
| | | |
| | | let waitFlag = false// 回显等待是否放行 |
| | | |
| | | // 1.第一种情况PC和APP都一次都没选中时 PC未选中,APP未选中 |
| | | if (rightPCArrFlag === 'N' && rightAPPArrFlag === 'N') { |
| | | pcIsSelected1 = true |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | |
| | | // 2.第二种情况PC已选中,APP未选中 |
| | | if (rightPCArrFlag === 'Y' && rightAPPArrFlag === 'N') { |
| | | pcIsSelected1 = true |
| | | pcIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='PC']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='PC']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | |
| | | // 3.第三种情况PC未选中,APP已选中 |
| | | if (rightPCArrFlag === 'N' && rightAPPArrFlag === 'Y') { |
| | | appIsSelected1 = true |
| | | appIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='APP']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='APP']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightAPPArr[0].code |
| | | } |
| | | // 4.第四种情况PC已选中,APP已选中 |
| | | if (rightPCArrFlag === 'Y' && rightAPPArrFlag === 'Y') { |
| | | pcIsSelected1 = true |
| | | pcIsSelected2 = true |
| | | appIsSelected1 = false |
| | | appIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='PC']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='PC']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | $("input[name='APP']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | this.dialogFormRight.rightOperationArr.push({ |
| | | isSelected1: pcIsSelected1, |
| | | isSelected2: pcIsSelected2, |
| | | code: this.dialogFormRight.rightPCArr[0].code, |
| | | flag: rightPCArrFlag, |
| | | name: this.dialogFormRight.rightPCArr[0].name |
| | | }, { |
| | | isSelected1: appIsSelected1, |
| | | isSelected2: appIsSelected2, |
| | | code: this.dialogFormRight.rightAPPArr[0].code, |
| | | flag: rightAPPArrFlag, |
| | | name: this.dialogFormRight.rightAPPArr[0].name |
| | | }) |
| | | |
| | | this.dialogFormRight.rightPCArr[0].name = '全部' |
| | | this.dialogFormRight.rightAPPArr[0].name = '全部' |
| | | |
| | | this.dialogFormRight.rightPCArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0 && item.flag === 'Y') { |
| | | item.children.forEach(it => { |
| | | if (it.flag === 'Y') { |
| | | this.dialogFormRight.rightPCArrSelected.push(it.code) |
| | | } |
| | | }) |
| | | } else if (item.children && item.children.length === 0 && item.flag === 'Y') { |
| | | this.dialogFormRight.rightPCArrSelected.push(item.code) |
| | | if (this.PCTrue && this.APPTrue) { |
| | | // 1.第一种情况PC和APP都一次都没选中时 PC未选中,APP未选中 |
| | | if (rightPCArrFlag === 'N' && rightAPPArrFlag === 'N') { |
| | | pcIsSelected1 = true |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | }) |
| | | this.dialogFormRight.rightAPPArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0 && item.flag === 'Y') { |
| | | item.children.forEach(it => { |
| | | if (it.flag === 'Y') { |
| | | this.dialogFormRight.rightAPPArrSelected.push(it.code) |
| | | // 2.第二种情况PC已选中,APP未选中 |
| | | if (rightPCArrFlag === 'Y' && rightAPPArrFlag === 'N') { |
| | | pcIsSelected1 = true |
| | | pcIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='PC']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | }) |
| | | } else if (item.children && item.children.length === 0 && item.flag === 'Y') { |
| | | this.dialogFormRight.rightAPPArrSelected.push(item.code) |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='PC']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | }) |
| | | // 3.第三种情况PC未选中,APP已选中 |
| | | if (rightPCArrFlag === 'N' && rightAPPArrFlag === 'Y') { |
| | | appIsSelected1 = true |
| | | appIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='APP']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='APP']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightAPPArr[0].code |
| | | } |
| | | // 4.第四种情况PC已选中,APP已选中 |
| | | if (rightPCArrFlag === 'Y' && rightAPPArrFlag === 'Y') { |
| | | pcIsSelected1 = true |
| | | pcIsSelected2 = true |
| | | appIsSelected1 = false |
| | | appIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='PC']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='PC']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | $("input[name='APP']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | } |
| | | |
| | | if (this.PCTrue && !this.APPTrue) { |
| | | if (rightPCArrFlag === 'Y') { |
| | | pcIsSelected1 = true |
| | | pcIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='PC']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='PC']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightPCArr[0].code |
| | | } |
| | | } |
| | | |
| | | if (!this.PCTrue && this.APPTrue) { |
| | | if (rightAPPArrFlag === 'Y') { |
| | | appIsSelected1 = true |
| | | appIsSelected2 = true |
| | | |
| | | const interval = setInterval(() => { |
| | | if ($("input[name='APP']").length > 0) { |
| | | waitFlag = true |
| | | } |
| | | if (waitFlag) { |
| | | clearInterval(interval) |
| | | this.$nextTick(() => { |
| | | $("input[name='APP']").eq(0).prop('checked', true)// 自定义单选框回显 |
| | | }) |
| | | } |
| | | }, 100) |
| | | |
| | | this.dialogFormRight.rightCurrentCode = this.dialogFormRight.rightAPPArr[0].code |
| | | } |
| | | } |
| | | |
| | | if (this.PCTrue) { |
| | | this.dialogFormRight.rightOperationArr.push({ |
| | | isSelected1: pcIsSelected1, |
| | | isSelected2: pcIsSelected2, |
| | | code: this.dialogFormRight.rightPCArr[0].code, |
| | | flag: rightPCArrFlag, |
| | | name: this.dialogFormRight.rightPCArr[0].name |
| | | }) |
| | | } |
| | | if (this.APPTrue) { |
| | | this.dialogFormRight.rightOperationArr.push({ |
| | | isSelected1: appIsSelected1, |
| | | isSelected2: appIsSelected2, |
| | | code: this.dialogFormRight.rightAPPArr[0].code, |
| | | flag: rightAPPArrFlag, |
| | | name: this.dialogFormRight.rightAPPArr[0].name |
| | | }) |
| | | } |
| | | if (this.PCTrue) { |
| | | this.dialogFormRight.rightPCArr[0].name = '全部' |
| | | } |
| | | if (this.APPTrue) { |
| | | this.dialogFormRight.rightAPPArr[0].name = '全部' |
| | | } |
| | | |
| | | // 树形回显部分 |
| | | if (this.PCTrue) { |
| | | this.dialogFormRight.rightPCArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0 && item.flag === 'Y') { |
| | | item.children.forEach(it => { |
| | | if (it.flag === 'Y') { |
| | | this.dialogFormRight.rightPCArrSelected.push(it.code) |
| | | } |
| | | }) |
| | | } else if (item.children && item.children.length === 0 && item.flag === 'Y') { |
| | | this.dialogFormRight.rightPCArrSelected.push(item.code) |
| | | } |
| | | }) |
| | | } |
| | | if (this.APPTrue) { |
| | | this.dialogFormRight.rightAPPArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0 && item.flag === 'Y') { |
| | | item.children.forEach(it => { |
| | | if (it.flag === 'Y') { |
| | | this.dialogFormRight.rightAPPArrSelected.push(it.code) |
| | | } |
| | | }) |
| | | } else if (item.children && item.children.length === 0 && item.flag === 'Y') { |
| | | this.dialogFormRight.rightAPPArrSelected.push(item.code) |
| | | } |
| | | }) |
| | | } |
| | | this.$nextTick(() => { |
| | | if (this.$refs.rightPCRef) { |
| | | this.$refs.rightPCRef.setCheckedKeys(this.dialogFormRight.rightPCArrSelected) |
| | |
| | | if (this.$refs.rightAPPRef) { |
| | | this.$refs.rightAPPRef.setCheckedKeys([]) |
| | | } |
| | | this.PCTrue = false |
| | | this.APPTrue = false |
| | | }, |
| | | // 权限对话框取消事件 |
| | | rightDialogVisibleCancel() { |
| | |
| | | async rightDialogVisibleConfirm() { |
| | | const rightPCArrSelected = []// 保存提交树选中 PC |
| | | const rightAPPArrSelected = []// 保存提交树选中 APP |
| | | |
| | | this.dialogFormRight.rightPCArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | const children = [] |
| | | let flag = false // 表示children里有值push进去了 |
| | | item.children.forEach(it => { |
| | | if (this.dialogFormRight.rightPCArrSelected.includes(it.code) || this.dialogFormRight.rightPCArrSelected.includes('PC')) { |
| | | flag = true |
| | | children.push( |
| | | { code: it.code, name: it.name, flag: 'Y' } |
| | | ) |
| | | } |
| | | }) |
| | | if (flag) { |
| | | rightPCArrSelected.push({ |
| | | code: item.code, name: item.name, flag: 'Y', children: children |
| | | if (this.PCTrue) { |
| | | this.dialogFormRight.rightPCArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | const children = [] |
| | | let flag = false // 表示children里有值push进去了 |
| | | item.children.forEach(it => { |
| | | if (this.dialogFormRight.rightPCArrSelected.includes(it.code) || this.dialogFormRight.rightPCArrSelected.includes('PC')) { |
| | | flag = true |
| | | children.push( |
| | | { code: it.code, name: it.name, flag: 'Y' } |
| | | ) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | this.dialogFormRight.rightAPPArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | const children = [] |
| | | let flag = false // 表示children里有值push进去了 |
| | | item.children.forEach(it => { |
| | | if (this.dialogFormRight.rightAPPArrSelected.includes(it.code) || this.dialogFormRight.rightAPPArrSelected.includes('APP')) { |
| | | flag = true |
| | | children.push( |
| | | { code: it.code, name: it.name, flag: 'Y' } |
| | | ) |
| | | if (flag) { |
| | | rightPCArrSelected.push({ |
| | | code: item.code, name: item.name, flag: 'Y', children: children |
| | | }) |
| | | } |
| | | }) |
| | | if (flag) { |
| | | rightAPPArrSelected.push({ |
| | | code: item.code, name: item.name, flag: 'Y', children: children |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (this.APPTrue) { |
| | | this.dialogFormRight.rightAPPArr[0].children.forEach(item => { |
| | | if (item.children && item.children.length > 0) { |
| | | const children = [] |
| | | let flag = false // 表示children里有值push进去了 |
| | | item.children.forEach(it => { |
| | | if (this.dialogFormRight.rightAPPArrSelected.includes(it.code) || this.dialogFormRight.rightAPPArrSelected.includes('APP')) { |
| | | flag = true |
| | | children.push( |
| | | { code: it.code, name: it.name, flag: 'Y' } |
| | | ) |
| | | } |
| | | }) |
| | | if (flag) { |
| | | rightAPPArrSelected.push({ |
| | | code: item.code, name: item.name, flag: 'Y', children: children |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // 最终要提交的数据 |
| | | let rightSubmit = [] |
| | | |
| | |
| | | const res = await SaveUserAssoctRight(rightSubmit, rolecode, usercode) |
| | | if (res.code === '200') { |
| | | this.$message.success('保存成功!') |
| | | await this.getRoleSearch() |
| | | this.dialogVisibleRight = false |
| | | } |
| | | }, |