|
@@ -13,7 +13,7 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 待安排 -->
|
|
|
- <div class="tree-item" :class="{ active: activeNode === 'status-1' }" @click="handleNodeClick({ type: 'status', value: 1, id: 'status-1' })">
|
|
|
+ <div class="tree-item" :class="{ active: activeNode === 'status-1' }" @click="handleNodeClick({ type: 'status', value: 0, id: 'status-1' })">
|
|
|
<div class="item-content">
|
|
|
<el-icon><Clock /></el-icon>
|
|
|
<span>待面试</span>
|
|
@@ -90,6 +90,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<BatchTagsDialog ref="batchTagsDialogRef" :crudExpose="crudExpose" />
|
|
|
+ <!-- <BatchStatusDialog ref="batchStatusDialogRef" :crudExpose="crudExpose" @success="handleBatchStatusSuccess" /> -->
|
|
|
</fs-page>
|
|
|
</template>
|
|
|
|
|
@@ -101,16 +102,24 @@ import { GetPermission } from './api';
|
|
|
import { handleColumnPermission } from '/@/utils/columnPermission';
|
|
|
import { Grid, Clock, ArrowRight, Check, RefreshRight, Briefcase } from '@element-plus/icons-vue';
|
|
|
import BatchTagsDialog from './components/index.vue';
|
|
|
+/* import BatchStatusDialog from './components/BatchStatusDialog.vue'; */
|
|
|
+import { getApplicationStatusSummary } from './api';
|
|
|
+
|
|
|
const { crudBinding, crudRef, crudExpose, crudOptions, resetCrudOptions } = useFs({
|
|
|
createCrudOptions,
|
|
|
context: {
|
|
|
openBatchTagsDialog: (selection: any) => {
|
|
|
batchTagsDialogRef.value.open(selection);
|
|
|
- }
|
|
|
+ },
|
|
|
+ openBatchStatusDialog: (selection: any) => {
|
|
|
+ batchStatusDialogRef.value.open(selection);
|
|
|
+ },
|
|
|
+ selectedRows: [] // 存储选中的行
|
|
|
}
|
|
|
});
|
|
|
|
|
|
const batchTagsDialogRef = ref();
|
|
|
+const batchStatusDialogRef = ref();
|
|
|
|
|
|
// 状态计数
|
|
|
const totalCount = ref(0);
|
|
@@ -123,9 +132,69 @@ const statusCounts = reactive<Record<number, number>>({
|
|
|
|
|
|
// 职位列表
|
|
|
const showPositionList = ref(true);
|
|
|
-const positions = ref<Array<{id: number|string, title: string, count?: number}>>([
|
|
|
- { id: 1, title: '流水线操作工', count: 0 },
|
|
|
-]);
|
|
|
+const positions = ref<Array<{id: number|string, title: string, count?: number}>>([]);
|
|
|
+
|
|
|
+// 获取职位列表
|
|
|
+const fetchPositions = async () => {
|
|
|
+ try {
|
|
|
+ const res = await fetch(`${import.meta.env.VITE_API_URL}/api/system/job/list?page=1&limit=100&tenant_id=1`);
|
|
|
+ const data = await res.json();
|
|
|
+
|
|
|
+ if (data.code === 2000 && data.data ) {
|
|
|
+ positions.value = data.data.map((item: any) => ({
|
|
|
+ id: item.id,
|
|
|
+ title: item.title || item.name || item.job_name,
|
|
|
+ count: 0
|
|
|
+ }));
|
|
|
+ } else {
|
|
|
+ console.error('获取职位列表失败:', data.msg || '未知错误');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取职位列表异常:', error);
|
|
|
+ // 设置默认职位,以防接口失败
|
|
|
+ positions.value = [{ id: 1, title: '流水线操作工', count: 0 }];
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 获取申请状态统计数据
|
|
|
+const fetchStatusSummary = async () => {
|
|
|
+ try {
|
|
|
+ const res = await getApplicationStatusSummary();
|
|
|
+ const data = res;
|
|
|
+ console.log(data)
|
|
|
+ if (data.code === 2000 && data.data) {
|
|
|
+ totalCount.value = data.data.total || 0;
|
|
|
+
|
|
|
+ // 更新状态计数
|
|
|
+ if (data.data.status_data && Array.isArray(data.data.status_data)) {
|
|
|
+ data.data.status_data.forEach((item: any) => {
|
|
|
+ // 注意:API返回的status可能与前端定义的不完全一致,需要映射
|
|
|
+ const statusMap: Record<number, number> = {
|
|
|
+ 0: 1, // API中的0对应前端的1(待面试)
|
|
|
+ 2: 2, // 已面试
|
|
|
+ 3: 3, // 已录用
|
|
|
+ 4: 4 // 已拒绝
|
|
|
+ };
|
|
|
+
|
|
|
+ const frontendStatus = statusMap[item.status];
|
|
|
+ if (frontendStatus && frontendStatus in statusCounts) {
|
|
|
+ statusCounts[frontendStatus] = item.count;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 如果没有status_data,则使用单独的字段
|
|
|
+ statusCounts[1] = data.data.pending || 0;
|
|
|
+ statusCounts[2] = data.data.interviewed || 0;
|
|
|
+ statusCounts[3] = data.data.hired || 0;
|
|
|
+ statusCounts[4] = data.data.rejected || 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error('获取申请状态统计失败:', data.message || '未知错误');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取申请状态统计异常:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
// 切换职位列表显示
|
|
|
const togglePositionList = () => {
|
|
@@ -140,14 +209,25 @@ const handleNodeClick = (data: any) => {
|
|
|
activeNode.value = data.id || 'all';
|
|
|
|
|
|
if (data.type === 'all') {
|
|
|
- // 清除所有筛选条件
|
|
|
- crudExpose.getSearchRef().resetFields();
|
|
|
- crudExpose.doRefresh();
|
|
|
+ try {
|
|
|
+ // 尝试重置表单,如果方法存在的话
|
|
|
+ const searchRef = crudExpose.getSearchRef();
|
|
|
+ if (searchRef && typeof searchRef.resetFields === 'function') {
|
|
|
+ searchRef.resetFields();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.warn('重置表单失败:', error);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 无论如何都执行搜索,确保数据刷新
|
|
|
+ crudExpose.doSearch({
|
|
|
+ form: {}
|
|
|
+ });
|
|
|
} else if (data.type === 'status') {
|
|
|
// 按状态筛选
|
|
|
crudExpose.doSearch({
|
|
|
form: {
|
|
|
- latest_status: data.value
|
|
|
+ status: data.value
|
|
|
}
|
|
|
});
|
|
|
} else if (data.type === 'position') {
|
|
@@ -164,21 +244,6 @@ const handleNodeClick = (data: any) => {
|
|
|
const updateCounts = (data: any) => {
|
|
|
if (!data || !data.records) return;
|
|
|
|
|
|
- totalCount.value = data.total || 0;
|
|
|
-
|
|
|
- // 重置计数
|
|
|
- Object.keys(statusCounts).forEach(key => {
|
|
|
- statusCounts[Number(key)] = 0;
|
|
|
- });
|
|
|
-
|
|
|
- // 统计各状态数量
|
|
|
- data.records.forEach((record: any) => {
|
|
|
- const status = record.status;
|
|
|
- if (status && typeof status === 'number' && status in statusCounts) {
|
|
|
- statusCounts[status]++;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
// 统计各职位数量
|
|
|
// 重置职位计数
|
|
|
positions.value.forEach(position => {
|
|
@@ -196,12 +261,25 @@ const updateCounts = (data: any) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+// 处理批量状态修改成功
|
|
|
+const handleBatchStatusSuccess = () => {
|
|
|
+ // 刷新数据和状态统计
|
|
|
+ crudExpose.doRefresh();
|
|
|
+ fetchStatusSummary();
|
|
|
+};
|
|
|
+
|
|
|
// 页面打开后获取列表数据
|
|
|
onMounted(async () => {
|
|
|
+ // 获取职位列表
|
|
|
+ await fetchPositions();
|
|
|
+
|
|
|
+ // 获取申请状态统计
|
|
|
+ await fetchStatusSummary();
|
|
|
+
|
|
|
// 设置列权限
|
|
|
const newOptions = await handleColumnPermission(GetPermission, crudOptions);
|
|
|
|
|
|
- // 添加数据加载后的回调,用于更新计数
|
|
|
+ // 添加数据加载后的回调,用于更新职位计数
|
|
|
if (newOptions && newOptions.crudOptions && newOptions.crudOptions.request) {
|
|
|
const originalPageRequest = newOptions.crudOptions.request.pageRequest;
|
|
|
newOptions.crudOptions.request.pageRequest = async (query: any) => {
|
|
@@ -228,7 +306,7 @@ onMounted(async () => {
|
|
|
.sidebar {
|
|
|
margin-top: 10px;
|
|
|
width: 200px;
|
|
|
- margin-right: 16px;
|
|
|
+ margin-right: 5px;
|
|
|
flex-shrink: 0;
|
|
|
background-color: #fff;
|
|
|
border-right: 1px solid #ebeef5;
|