|
|
@ -14,7 +14,7 @@ |
|
|
<a-form-item label="执业机构" v-if="isAssociationRole || isCeo" class="smart-query-form-item"> |
|
|
<a-form-item label="执业机构" v-if="isAssociationRole || isCeo" class="smart-query-form-item"> |
|
|
<DepartmentTreeSelect style="width: 250px" v-model:value="queryForm.firmId" placeholder="请选择执业机构" @change="handleFirmChange" /> |
|
|
<DepartmentTreeSelect style="width: 250px" v-model:value="queryForm.firmId" placeholder="请选择执业机构" @change="handleFirmChange" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
<a-form-item label="律师名称" v-if="isAssociationRole || isCtoRole || isCeo" class="smart-query-form-item"> |
|
|
<a-form-item label="律师名称" v-if="isAssociationRole || isCtoRole || isCeo || isFirmAdmin" class="smart-query-form-item"> |
|
|
<a-select |
|
|
<a-select |
|
|
v-model:value="queryForm.userId" |
|
|
v-model:value="queryForm.userId" |
|
|
style="width: 200px" |
|
|
style="width: 200px" |
|
|
@ -23,7 +23,7 @@ |
|
|
:allowClear="true" |
|
|
:allowClear="true" |
|
|
:filterOption="false" |
|
|
:filterOption="false" |
|
|
optionFilterProp="children" |
|
|
optionFilterProp="children" |
|
|
@focus="loadEmployeesByFirm" |
|
|
@focus="loadEmployeesByFirm()" |
|
|
@search="handleLawyerSearch" |
|
|
@search="handleLawyerSearch" |
|
|
@change="handleLawyerChange" |
|
|
@change="handleLawyerChange" |
|
|
@clear="handleLawyerClear" |
|
|
@clear="handleLawyerClear" |
|
|
@ -484,26 +484,8 @@ import { getRoleInfo } from '/@/utils/role-util'; |
|
|
const employeeList = ref([]); |
|
|
const employeeList = ref([]); |
|
|
// 搜索关键词 |
|
|
// 搜索关键词 |
|
|
const searchKeyword = ref(''); |
|
|
const searchKeyword = ref(''); |
|
|
// 过滤后的员工列表 |
|
|
// 员工列表(直接使用API返回的数据,无需前端过滤) |
|
|
const filteredEmployeeList = computed(() => { |
|
|
const filteredEmployeeList = computed(() => employeeList.value); |
|
|
let result = employeeList.value; |
|
|
|
|
|
|
|
|
|
|
|
// 首先根据执业机构过滤 |
|
|
|
|
|
if (queryForm.firmId) { |
|
|
|
|
|
result = result.filter(item => item.departmentId == queryForm.firmId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 然后根据搜索关键词过滤 |
|
|
|
|
|
if (searchKeyword.value) { |
|
|
|
|
|
const keyword = searchKeyword.value.toLowerCase(); |
|
|
|
|
|
result = result.filter(item => |
|
|
|
|
|
(item.actualName && item.actualName.toLowerCase().includes(keyword)) || |
|
|
|
|
|
(item.departmentName && item.departmentName.toLowerCase().includes(keyword)) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 审核相关状态 |
|
|
// 审核相关状态 |
|
|
const auditModalVisible = ref(false); |
|
|
const auditModalVisible = ref(false); |
|
|
@ -618,13 +600,6 @@ import { getRoleInfo } from '/@/utils/role-util'; |
|
|
return optionText.includes(input.toLowerCase()); |
|
|
return optionText.includes(input.toLowerCase()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理律师搜索 |
|
|
|
|
|
function handleLawyerSearch(keyword) { |
|
|
|
|
|
searchKeyword.value = keyword; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 批量审核确认 |
|
|
// 批量审核确认 |
|
|
async function handleBatchAudit() { |
|
|
async function handleBatchAudit() { |
|
|
if (!batchAuditForm.auditResult) { |
|
|
if (!batchAuditForm.auditResult) { |
|
|
@ -833,27 +808,41 @@ import { getRoleInfo } from '/@/utils/role-util'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 加载所有员工数据 |
|
|
// 加载指定机构的员工数据(使用新搜索接口) |
|
|
async function loadAllEmployees() { |
|
|
async function loadEmployeesByFirm(keyword = '') { |
|
|
try { |
|
|
try { |
|
|
if (employeeList.value.length === 0) { |
|
|
// 律所主任(cto)和行政(staff)角色:只看当前律所的律师 |
|
|
let resp = await employeeApi.queryAll(); |
|
|
// 律协/CEO角色:可以看所有律师 |
|
|
employeeList.value = resp.data; |
|
|
let firmId = undefined; |
|
|
|
|
|
if (loginInfo.value) { |
|
|
|
|
|
const roleCode = loginInfo.value.roleCode || ''; |
|
|
|
|
|
if (roleCode === 'cto' || roleCode === 'staff') { |
|
|
|
|
|
firmId = loginInfo.value.departmentId; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const params = { |
|
|
|
|
|
firmId: queryForm.firmId || firmId, |
|
|
|
|
|
keyword: keyword || undefined, |
|
|
|
|
|
limit: 50 |
|
|
|
|
|
}; |
|
|
|
|
|
const resp = await employeeApi.searchEmployee(params); |
|
|
|
|
|
employeeList.value = resp.data || []; |
|
|
} catch (e) { |
|
|
} catch (e) { |
|
|
console.error('加载员工数据失败:', e); |
|
|
console.error('加载员工数据失败:', e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 加载指定机构的员工数据 |
|
|
// 搜索防抖定时器 |
|
|
async function loadEmployeesByFirm() { |
|
|
let searchTimer = null; |
|
|
try { |
|
|
|
|
|
if (employeeList.value.length === 0) { |
|
|
// 处理律师搜索(带防抖) |
|
|
await loadAllEmployees(); |
|
|
function handleLawyerSearch(keyword) { |
|
|
} |
|
|
clearTimeout(searchTimer); |
|
|
} catch (e) { |
|
|
searchKeyword.value = keyword; |
|
|
console.error('加载员工数据失败:', e); |
|
|
searchTimer = setTimeout(() => { |
|
|
} |
|
|
loadEmployeesByFirm(keyword); |
|
|
|
|
|
}, 300); // 300ms 防抖 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理执业机构变化 |
|
|
// 处理执业机构变化 |
|
|
@ -861,6 +850,8 @@ import { getRoleInfo } from '/@/utils/role-util'; |
|
|
// 清空律师选择 |
|
|
// 清空律师选择 |
|
|
queryForm.userId = undefined; |
|
|
queryForm.userId = undefined; |
|
|
searchKeyword.value = ''; |
|
|
searchKeyword.value = ''; |
|
|
|
|
|
// 重新加载律师列表 |
|
|
|
|
|
loadEmployeesByFirm(''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理律师选择变化(选择律师时清空搜索关键词) |
|
|
// 处理律师选择变化(选择律师时清空搜索关键词) |
|
|
@ -868,9 +859,10 @@ import { getRoleInfo } from '/@/utils/role-util'; |
|
|
searchKeyword.value = ''; |
|
|
searchKeyword.value = ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 处理律师下拉框清空(点击叉号时清空搜索关键词) |
|
|
// 处理律师下拉框清空(点击叉号时清空搜索关键词并重新加载) |
|
|
function handleLawyerClear() { |
|
|
function handleLawyerClear() { |
|
|
searchKeyword.value = ''; |
|
|
searchKeyword.value = ''; |
|
|
|
|
|
loadEmployeesByFirm(''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 总数 |
|
|
// 总数 |
|
|
|