Browse Source

根据角色筛选v0,6

qin_26
liwenxuan 2 months ago
parent
commit
185d39df6d
  1. 5
      src/components/DesignForm/assembly/index.ts
  2. 176
      src/components/DesignForm/formControlPropertiNew.vue

5
src/components/DesignForm/assembly/index.ts

@ -1044,8 +1044,9 @@ export default [
control: { control: {
// 组件所有属性 // 组件所有属性
modelValue: '', modelValue: '',
range:[], orgRange:[],
queryBy:'org' roleRange:[],
queryBy:'org',
}, },
config: {}, // 其他配置信息 config: {}, // 其他配置信息
styles: { styles: {

176
src/components/DesignForm/formControlPropertiNew.vue

@ -315,7 +315,7 @@ const attrList = computed(() => {
// console.log("--->", item); // console.log("--->", item);
if (typeof controlData.value.customRules == "object") { if (typeof controlData.value.customRules == "object") {
if (Array.isArray(controlData.value.customRules)) { if (Array.isArray(controlData.value.customRules)) {
let otherPick = []; let otherPick: any[] = [];
controlData.value.customRules.forEach((item: any) => { controlData.value.customRules.forEach((item: any) => {
// console.log("-1-->", item); // console.log("-1-->", item);
if (item.type == ValidateText.type) { if (item.type == ValidateText.type) {
@ -2786,13 +2786,13 @@ function removeTreeNode(tree: any, targetId: any) {
const clonedTree = JSON.parse(JSON.stringify(tree)); const clonedTree = JSON.parse(JSON.stringify(tree));
// //
function processNode(node) { function processNode(node: { id: any; children: any[]; }) {
// null // null
if (node.id === targetId) return null; if (node.id === targetId) return null;
// //
if (node.children?.length) { if (node.children?.length) {
node.children = node.children.map((child) => processNode(child)).filter(Boolean); node.children = node.children.map((child: any) => processNode(child)).filter(Boolean);
} }
return node; return node;
@ -4061,15 +4061,18 @@ watch(
); );
// //
const tabsRef = ref(null);
const userRangeDialogFlag = ref(false) const userRangeDialogFlag = ref(false)
function handleUserRangeDialogFlag(){ function handleUserRangeDialogFlag(){
userRangeDialogFlag.value = true userRangeDialogFlag.value = true
if(controlData.value.control.queryBy=='role'){
queryAllRole()
}
} }
function checkedIdListChangedIndex(val:any){ function checkedIdListChangedIndex(val:any){
//console.log(val) //console.log(val)
controlData.value.control.range = val controlData.value.control.orgRange = val
} }
let componentKey = 0 let componentKey = 0
@ -4079,10 +4082,74 @@ function reRenderComponent() {
} }
function handleExpandTabChange(){ function handleExpandTabChange(){
controlData.value.control.range = [] console.log("切换页签")
if(controlData.value.control.queryBy=='role'){
queryAllRole()
}
}
function getAllRole() {
return request({
url: "/javasys/lowCode/manCont/getAllRole",
method: "get",
});
}
const tabsData = ref([])
function queryAllRole(){
getAllRole().then(({ data }) => {
//console.log(data)
tabsData.value = data
}).finally(()=>{
//activeName.value = tabsData.value[2]?.name
setTimeout(()=>{
activeTab.value = tabsData.value[0]?.id
//alert(tabsData.value[0]?.id)
//activeName.value = tabsData.value[0]?.id
handleLeftTabChange(activeTab.value)
},500)
})
}
function getPersonByRoleId(id:string){
return request({
url: "/javasys/lowCode/manCont/getPersonByRoleId",
method: "post",
data: {
id: id,
},
});
}
//const activeName = ref('1')
const activeTab = ref('')
const expandTableData = ref()
function handleLeftTabChange(tab: any){
getPersonByRoleId(tab).then(({ data }) => {
//console.log(data)
expandTableData.value = data
//activeName.value = tab
});
} }
import type { TableInstance } from 'element-plus'
const multipleTableRef = ref<TableInstance>()
const multipleSelection = ref<User[]>([])
interface User {
id: number
name: string
}
const handleSelectionChange = (val: User[]) => {
console.log(1111)
multipleSelection.value = val
}
/** /**
@ -4522,7 +4589,8 @@ const aiAgentList = ref([
<el-row v-else-if="item.type === 'expand-user'"> <el-row v-else-if="item.type === 'expand-user'">
{{controlData.control.range}} {{controlData.control.orgRange}}
{{controlData.control.roleRange}}
<el-button @click="handleUserRangeDialogFlag">可选用户设置</el-button> <el-button @click="handleUserRangeDialogFlag">可选用户设置</el-button>
</el-row> </el-row>
@ -5684,29 +5752,95 @@ const aiAgentList = ref([
<el-dialog <el-dialog
v-model="userRangeDialogFlag" v-model="userRangeDialogFlag"
title="可选用户设置" title="可选用户设置"
top="20px" width="840"
style="margin-top:70px;margin-left:270px;height:650px;width:750px"
> >
<el-tabs v-model="controlData.control.queryBy" class="demo-tabs" @tab-change="handleExpandTabChange" > <el-tabs v-model="controlData.control.queryBy" style="width:100%;" @tab-change="handleExpandTabChange" >
<el-tab-pane label="根据组织筛选" name="org"> <el-tab-pane label="根据角色筛选" name="role">
<TransferSelectUserRange v-if="controlData.control.queryBy=='org'" :key="componentKey" :data="transferSelectUserRangeData" :selected-value="controlData.control.range" @checked-id-list-changed="checkedIdListChangedIndex" @re-render-component="reRenderComponent" />
</el-tab-pane> <div >
<el-tab-pane label="根据角色筛选" name="role">
<el-row>
<el-col :span="17" style="padding: 0;border-right: 0px solid black;">
<el-tabs ref="tabsRef" v-model="activeTab" tab-position="left" @tab-change="handleLeftTabChange" >
<el-tab-pane
v-for="tab in tabsData"
:key="tab.id"
:label="tab.name"
:name="tab.id"
>
<div>
<el-input placeholder="请输入用户名" v-model="userName" clearable style="width: 50%; margin-bottom: 10px;margin-left: 3px;"/>
<el-button type="primary" @click="searchClick" style="margin-left: 10px; margin-bottom: 10px;">查询</el-button>
<el-button @click="resetClick" style="margin-bottom: 10px;">重置</el-button>
</div>
<div class="expandTable">
<el-table ref="multipleTableRef" :data="expandTableData" style="width: 100%; height: 440px" :row-style="{ height: '35px' }" :cell-style="{ padding: '1.5px 0' }" @selection-change="handleSelectionChange">
<!-- <el-table-column prop="userName" label="照片" width="70px" align="center">
<template #default="scope">
<el-avatar
v-if="scope.row.icon != ''"
shape="square"
:size="30"
:src="scope.row.icon"
/>
<el-avatar v-else shape="square" :size="30" :src="UserRole" />
</template>
</el-table-column> -->
<el-table-column prop="name" label="姓名" width="160px" align="left">
<template #default="scope">
{{ scope.row.name }}({{ scope.row.number }})
</template>
</el-table-column>
<!-- <el-table-column prop="tel" label="联系方式" width="120px" align="left" /> -->
<el-table-column prop="nickName" label="部门" width="160px" align="left">
<template #default="{ row }">
{{row.deparment}}
</template>
</el-table-column>
<el-table-column type="selection" width="55" />
</el-table>
</div>
<div class="expandPage">
</div>
</el-tab-pane>
</el-tabs>
</el-col>
<el-col :span="1" style="display: flex; align-items: center;" >
<el-icon style="font-size: large;cursor: pointer;" @click="gotoRight"><ArrowRightBold /></el-icon>
</el-col>
<el-col :span="6" style="padding: 0">
{{multipleSelection}}
</el-col>
</el-row>
<div style="width: 600px;">
根据角色筛选
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="根据组织筛选" name="org">
<TransferSelectUserRange :key="componentKey" :data="transferSelectUserRangeData" :selected-value="controlData.control.orgRange" @checked-id-list-changed="checkedIdListChangedIndex" @re-render-component="reRenderComponent" />
</el-tab-pane>
</el-tabs> </el-tabs>
<div style="position: absolute; top:587px;left:616px">
<el-button type="primary" @click="userRangeDialogFlag = false">
确定 <template #footer>
</el-button> <div class="dialog-footer">
</div> <el-button type="primary" @click="userRangeDialogFlag = false">
确定
</el-button>
</div>
</template>
</el-dialog> </el-dialog>

Loading…
Cancel
Save