This commit is contained in:
wangjh12
2025-05-10 19:53:12 +08:00
parent 959d29edd9
commit cc88a0de81

View File

@@ -166,23 +166,23 @@
:scroll="{ x: 700 }" :scroll="{ x: 700 }"
:pagination="false" :pagination="false"
@resizeColumn="handleResizeColumn" @resizeColumn="handleResizeColumn"
@change="handleTableChange"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: onSelectChange, onChange: onSelectChange,
}" }"
> >
<template v-slot:header> <template #headerCell="{ column }">
<draggable <draggable
v-model="columns" tag="span"
item-key="key" :item-key="column.dataIndex"
:list="columns" :list="columns"
:group="{ name: 'columns', pull: 'clone', put: false }" handle=".handle"
> >
<template #item="{ element }"> <span class="handle">{{ column.title }}</span>
<a-table-column :title="element.title" :dataIndex="element.dataIndex" :key="element.key"></a-table-column>
</template>
</draggable> </draggable>
</template> </template>
</a-table> </a-table>
<div class="tableBox"> <div class="tableBox">
<div class="pa"> <div class="pa">
@@ -212,7 +212,7 @@ import dayjs from "dayjs";
import {message} from "ant-design-vue"; import {message} from "ant-design-vue";
import Cookies from "vue-cookies"; import Cookies from "vue-cookies";
import {useStore} from "vuex"; import {useStore} from "vuex";
// import orgjson from './org.json'; import orgjson from './org.json';
// import fl from './fl.json'; // import fl from './fl.json';
import PostSelectNew from "@/components/growthpath/PostSelect.vue"; import PostSelectNew from "@/components/growthpath/PostSelect.vue";
import OfficeSelect from "@/components/growthpath/OfficeSelect.vue"; import OfficeSelect from "@/components/growthpath/OfficeSelect.vue";
@@ -252,6 +252,7 @@ export default {
statusList: [], statusList: [],
content_type: null, content_type: null,
categoryTypeId: null, categoryTypeId: null,
tableSorts: [],
}); });
const onDragEnd = (event) => { const onDragEnd = (event) => {
@@ -292,7 +293,7 @@ export default {
return result; return result;
} }
function afterApiPage(res){ function afterApiPage(res) {
if (res && res.data) { if (res && res.data) {
let resData = res.data; let resData = res.data;
if (resData.code == 200) { if (resData.code == 200) {
@@ -407,8 +408,8 @@ export default {
} }
} }
const res = await api.userGetUserOrg({}); // const res = await api.userGetUserOrg({});
// const res = orgjson; const res = orgjson;
if (res != null && res.data != null && res.data.result != null && res.data.result.orgTreeList != null) { if (res != null && res.data != null && res.data.result != null && res.data.result.orgTreeList != null) {
orgArray = flattenOrgTree(res.data.result.orgTreeList); orgArray = flattenOrgTree(res.data.result.orgTreeList);
} }
@@ -445,6 +446,7 @@ export default {
getTabData(); getTabData();
} }
}; };
function fetchExportReport(data) { function fetchExportReport(data) {
//根据逗号分隔开的id //根据逗号分隔开的id
axios({ axios({
@@ -459,6 +461,7 @@ export default {
downLoad(res.data, tabIndexMap[state.currentTab] + ".xlsx"); downLoad(res.data, tabIndexMap[state.currentTab] + ".xlsx");
}); });
} }
// 导出按钮 // 导出按钮
const exportClick = async () => { const exportClick = async () => {
if (!state.selectedRowKeys?.length) { if (!state.selectedRowKeys?.length) {
@@ -491,9 +494,9 @@ export default {
page: state.pageNo, page: state.pageNo,
size: state.pageSize, size: state.pageSize,
orgPath: state.orgPath, orgPath: state.orgPath,
tableSorts: state.tableSorts,
}); });
} } else if (state.currentTab === 5) {
else if (state.currentTab === 5) {
//案例列表 //案例列表
res = await api.casePageList({ res = await api.casePageList({
createName: state.creator, createName: state.creator,
@@ -504,9 +507,9 @@ export default {
page: state.pageNo, page: state.pageNo,
size: state.pageSize, size: state.pageSize,
orgPath: state.orgPath, orgPath: state.orgPath,
tableSorts: state.tableSorts
}); });
} } else if (state.currentTab === 6) {
else if (state.currentTab === 6) {
//专业力 //专业力
res = await api.professionalPageList({ res = await api.professionalPageList({
startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null, startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
@@ -517,9 +520,9 @@ export default {
orgPath: state.orgPath, orgPath: state.orgPath,
stdPosition: state.stdPosition, stdPosition: state.stdPosition,
qualsLevelCode: state.qualsLevelCode, qualsLevelCode: state.qualsLevelCode,
tableSorts: state.tableSorts
}); });
} } else if (state.currentTab === 3) {
else if (state.currentTab === 3) {
res = await api.coursePageList({ res = await api.coursePageList({
page: state.pageNo, page: state.pageNo,
size: state.pageSize, size: state.pageSize,
@@ -531,7 +534,8 @@ export default {
startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null, startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null, endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null,
orgPath: state.orgPath, orgPath: state.orgPath,
category: findPathByValue(sysTypeOptions, state.categoryTypeId) category: findPathByValue(sysTypeOptions, state.categoryTypeId),
tableSorts: state.tableSorts
}); });
} else if (state.currentTab === 2) { } else if (state.currentTab === 2) {
res = await api.facePageList({ res = await api.facePageList({
@@ -544,6 +548,7 @@ export default {
startTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null, startTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
endTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null, endTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null,
orgPath: state.orgPath, orgPath: state.orgPath,
tableSorts: state.tableSorts
}); });
} else if (state.currentTab === 1) { } else if (state.currentTab === 1) {
res = await api.routerPageList({ res = await api.routerPageList({
@@ -555,7 +560,8 @@ export default {
startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null, startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null, endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null,
orgPath: state.orgPath, orgPath: state.orgPath,
status: state.status status: state.status,
tableSorts: state.tableSorts
}); });
} else if (state.currentTab === 0) { } else if (state.currentTab === 0) {
res = await api.projectPageList({ res = await api.projectPageList({
@@ -568,8 +574,8 @@ export default {
startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null, startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null, endCreateTime: state.publishTime && state.publishTime[1] ? state.publishTime[1] + " 23:59:59" : null,
orgPath: state.orgPath, orgPath: state.orgPath,
status: state.status && (state.status == 1 ? "进行中": "已结束"), status: state.status && (state.status == 1 ? "进行中" : "已结束"),
tableSorts: state.tableSorts
}); });
} }
afterApiPage(res); afterApiPage(res);
@@ -610,6 +616,7 @@ export default {
1: "测试", 1: "测试",
2: "练习" 2: "练习"
}; };
const tabClick = (index) => { const tabClick = (index) => {
state.selectedRowKeys = []; state.selectedRowKeys = [];
state.currentTab = index; state.currentTab = index;
@@ -627,6 +634,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "left", align: "left",
fixed: "left", fixed: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -660,6 +668,7 @@ export default {
key: "createDate", key: "createDate",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
}, },
{ {
title: "发布时间", title: "发布时间",
@@ -668,6 +677,7 @@ export default {
key: "publishTime", key: "publishTime",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
}, },
{ {
title: "状态", title: "状态",
@@ -820,6 +830,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "left", align: "left",
fixed: "left", fixed: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -919,6 +930,7 @@ export default {
key: "passRate", key: "passRate",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatTextRate(text.value); return formatTextRate(text.value);
}, },
@@ -975,6 +987,7 @@ export default {
key: "createTime", key: "createTime",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatDate(text.value); return formatDate(text.value);
}, },
@@ -987,8 +1000,7 @@ export default {
align: "center", align: "center",
}, },
]; ];
} } else if (index === 6) {
else if (index === 6) {
columns.value = [ columns.value = [
{ {
title: "岗位名称", title: "岗位名称",
@@ -998,6 +1010,7 @@ export default {
key: "stdPositionName", key: "stdPositionName",
width: 120, width: 120,
align: "left", align: "left",
sorter: true,
}, },
{ {
title: "任职资格等级", title: "任职资格等级",
@@ -1005,6 +1018,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "band", title: "band",
@@ -1019,6 +1033,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "必修任务数", title: "必修任务数",
@@ -1040,6 +1055,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "完成人数", title: "完成人数",
@@ -1095,6 +1111,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatDate(text.value); return formatDate(text.value);
}, },
@@ -1111,8 +1128,7 @@ export default {
}, },
}, },
]; ];
} } else if (index === 5) {
else if (index === 5) {
columns.value = [ columns.value = [
{ {
title: "案例名称", title: "案例名称",
@@ -1122,6 +1138,7 @@ export default {
key: "caseName", key: "caseName",
width: 150, width: 150,
align: "left", align: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -1152,6 +1169,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatDate(text.value); return formatDate(text.value);
}, },
@@ -1170,6 +1188,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "收藏数", title: "收藏数",
@@ -1177,6 +1196,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "点赞数", title: "点赞数",
@@ -1184,6 +1204,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
@@ -1192,6 +1213,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "center", align: "center",
width: 120, width: 120,
sorter: true,
}, },
{ {
title: "是否推荐", title: "是否推荐",
@@ -1238,6 +1260,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "left", align: "left",
fixed: "left", fixed: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -1255,7 +1278,7 @@ export default {
key: "category", key: "category",
width: 120, width: 120,
align: "center", align: "center",
fixed: "left", sorter: true,
}, },
{ {
title: "授课老师", title: "授课老师",
@@ -1264,7 +1287,6 @@ export default {
key: "teacher", key: "teacher",
width: 120, width: 120,
align: "center", align: "center",
fixed: "left",
}, },
{ {
title: "关键字", title: "关键字",
@@ -1370,6 +1392,7 @@ export default {
key: "createTime", key: "createTime",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatDate(text.value) return formatDate(text.value)
}, },
@@ -1381,6 +1404,7 @@ export default {
key: "createName", key: "createName",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
}, },
]; ];
} else if (index === 2) { } else if (index === 2) {
@@ -1393,6 +1417,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "left", align: "left",
fixed: "left", fixed: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -1484,6 +1509,7 @@ export default {
key: "studentNum", key: "studentNum",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
}, },
{ {
title: "参评人数", title: "参评人数",
@@ -1567,6 +1593,7 @@ export default {
key: "reportCreateTime", key: "reportCreateTime",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
customRender: (text) => { customRender: (text) => {
return formatDate(text.value) return formatDate(text.value)
}, },
@@ -1582,6 +1609,7 @@ export default {
ellipsis: true, ellipsis: true,
align: "left", align: "left",
fixed: "left", fixed: "left",
sorter: true,
}, },
{ {
title: "归属组织", title: "归属组织",
@@ -1618,6 +1646,7 @@ export default {
key: "createTime", key: "createTime",
width: 120, width: 120,
align: "center", align: "center",
sorter: true,
customRender: (text) => { customRender: (text) => {
return text.value ? formatDate(text.value) : ""; return text.value ? formatDate(text.value) : "";
}, },
@@ -1664,7 +1693,7 @@ export default {
key: "studentLearnRate", key: "studentLearnRate",
width: 120, width: 120,
align: "center", align: "center",
customRender (text) { customRender(text) {
return formatTextRate(text.value); return formatTextRate(text.value);
}, },
}, },
@@ -1683,7 +1712,7 @@ export default {
key: "studentCompleteRate", key: "studentCompleteRate",
width: 120, width: 120,
align: "center", align: "center",
customRender (text) { customRender(text) {
return formatTextRate(text.value); return formatTextRate(text.value);
}, },
}, },
@@ -1702,7 +1731,7 @@ export default {
key: "taskRate", key: "taskRate",
width: 120, width: 120,
align: "center", align: "center",
customRender (text) { customRender(text) {
return formatTextRate(text.value); return formatTextRate(text.value);
}, },
}, },
@@ -1769,7 +1798,7 @@ export default {
if ([0, 1].includes(index)) { if ([0, 1].includes(index)) {
state.statusList = statusArr[index]; state.statusList = statusArr[index];
} }
state.tableSorts = [];
getTableData(); getTableData();
getTabData(); getTabData();
}; };
@@ -1801,6 +1830,21 @@ export default {
col.width = w; col.width = w;
}; };
// 表格 change 事件(分页、排序等)
const handleTableChange = (pag, filters, sorter) => {
const {field, order} = sorter;
if (order) {
state.tableSorts = [{
sortField: field,
sortOrder: order === 'ascend' ? 'asc' : order === 'descend' ? 'desc' : null,
}];
} else {
state.tableSorts = [];
}
getTableData();
};
const routerStatusObj = { const routerStatusObj = {
"0": "草稿", "0": "草稿",
"1": "已发布", "1": "已发布",
@@ -1816,11 +1860,12 @@ export default {
}; };
//时间格式化 后续抽到 工具类中 //时间格式化 后续抽到 工具类中
const formatTime_ = (time, format = "YYYY-MM-DD HH:mm:ss") => { const formatTime_ = (time, format = "YYYY-MM-DD HH:mm:ss") => {
if(!time){ if (!time) {
return null; return null;
} }
return dayjs(time).format(format); return dayjs(time).format(format);
}; };
//后续抽到 工具类中 //后续抽到 工具类中
function formatTextRate(value) { function formatTextRate(value) {
if (!value && value != 0) { if (!value && value != 0) {
@@ -1839,6 +1884,7 @@ export default {
// 获取名称路径的函数 // 获取名称路径的函数
function findPathByValue(data, value) { function findPathByValue(data, value) {
debugger; debugger;
function recursiveSearch(nodes, value, path) { function recursiveSearch(nodes, value, path) {
for (let node of nodes) { for (let node of nodes) {
if (node.value === value) { if (node.value === value) {
@@ -1879,7 +1925,8 @@ export default {
orgChange, orgChange,
handleResizeColumn, handleResizeColumn,
onDragEnd, onDragEnd,
sysTypeOptions sysTypeOptions,
handleTableChange
}; };
}, },
}; };
@@ -2133,4 +2180,7 @@ export default {
.ant-table-tbody > tr > td { .ant-table-tbody > tr > td {
user-select: text !important; user-select: text !important;
} }
.handle {
cursor: move;
}
</style> </style>