@@ -212,7 +215,8 @@ import dayjs from "dayjs";
import {message} from "ant-design-vue";
import Cookies from "vue-cookies";
import {useStore} from "vuex";
-import orgjson from './org.json';
+// import orgjson from './org.json';
+// import fl from './fl.json';
import PostSelectNew from "@/components/growthpath/PostSelect.vue";
import OfficeSelect from "@/components/growthpath/OfficeSelect.vue";
import draggable from 'vuedraggable';
@@ -224,6 +228,8 @@ export default {
setup() {
const store = useStore();
const sysTypeOptions = computed(() => store.state.content_type);
+ // const sysTypeOptions = fl;
+
const state = reactive({
tableLoading: false, // table加载图标
tableDataTotal: 0, // 数据总条数
@@ -249,6 +255,7 @@ export default {
statusList: [],
content_type: null,
categoryTypeId: null,
+ tableSorts: [],
});
const onDragEnd = (event) => {
@@ -289,7 +296,7 @@ export default {
return result;
}
- function afterApiPage(res){
+ function afterApiPage(res) {
if (res && res.data) {
let resData = res.data;
if (resData.code == 200) {
@@ -341,7 +348,7 @@ export default {
token: Cookies.get("token"),
},
}).then((res) => {
- if (!res || !res.data) {
+ if (!res || !res.data) {
message.error("服务器异常");
return;
}
@@ -404,8 +411,8 @@ export default {
}
}
- // const res = await api.userGetUserOrg({});
- const res = orgjson;
+ const res = await api.userGetUserOrg({});
+ // const res = orgjson;
if (res != null && res.data != null && res.data.result != null && res.data.result.orgTreeList != null) {
orgArray = flattenOrgTree(res.data.result.orgTreeList);
}
@@ -442,6 +449,7 @@ export default {
getTabData();
}
};
+
function fetchExportReport(data) {
//根据逗号分隔开的id
axios({
@@ -456,6 +464,7 @@ export default {
downLoad(res.data, tabIndexMap[state.currentTab] + ".xlsx");
});
}
+
// 导出按钮
const exportClick = async () => {
if (!state.selectedRowKeys?.length) {
@@ -488,9 +497,9 @@ export default {
page: state.pageNo,
size: state.pageSize,
orgPath: state.orgPath,
+ tableSorts: state.tableSorts,
});
- }
- else if (state.currentTab === 5) {
+ } else if (state.currentTab === 5) {
//案例列表
res = await api.casePageList({
createName: state.creator,
@@ -501,9 +510,9 @@ export default {
page: state.pageNo,
size: state.pageSize,
orgPath: state.orgPath,
+ tableSorts: state.tableSorts
});
- }
- else if (state.currentTab === 6) {
+ } else if (state.currentTab === 6) {
//专业力
res = await api.professionalPageList({
startCreateTime: state.publishTime && state.publishTime[0] ? state.publishTime[0] + " 00:00:00" : null,
@@ -514,9 +523,9 @@ export default {
orgPath: state.orgPath,
stdPosition: state.stdPosition,
qualsLevelCode: state.qualsLevelCode,
+ tableSorts: state.tableSorts
});
- }
- else if (state.currentTab === 3) {
+ } else if (state.currentTab === 3) {
res = await api.coursePageList({
page: state.pageNo,
size: state.pageSize,
@@ -528,7 +537,8 @@ export default {
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,
orgPath: state.orgPath,
- category: findPathByValue(state.categoryTypeId)
+ category: findPathByValue(sysTypeOptions, state.categoryTypeId),
+ tableSorts: state.tableSorts
});
} else if (state.currentTab === 2) {
res = await api.facePageList({
@@ -541,6 +551,7 @@ export default {
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,
orgPath: state.orgPath,
+ tableSorts: state.tableSorts
});
} else if (state.currentTab === 1) {
res = await api.routerPageList({
@@ -552,7 +563,8 @@ export default {
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,
orgPath: state.orgPath,
- status: state.status
+ status: state.status,
+ tableSorts: state.tableSorts
});
} else if (state.currentTab === 0) {
res = await api.projectPageList({
@@ -565,8 +577,8 @@ export default {
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,
orgPath: state.orgPath,
- status: state.status && (state.status == 1 ? "进行中": "已结束"),
-
+ status: state.status && (state.status == 1 ? "进行中" : "已结束"),
+ tableSorts: state.tableSorts
});
}
afterApiPage(res);
@@ -607,6 +619,7 @@ export default {
1: "测试",
2: "练习"
};
+
const tabClick = (index) => {
state.selectedRowKeys = [];
state.currentTab = index;
@@ -624,6 +637,7 @@ export default {
ellipsis: true,
align: "left",
fixed: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -657,6 +671,7 @@ export default {
key: "createDate",
width: 120,
align: "center",
+ sorter: true,
},
{
title: "发布时间",
@@ -665,6 +680,7 @@ export default {
key: "publishTime",
width: 120,
align: "center",
+ sorter: true,
},
{
title: "状态",
@@ -817,6 +833,7 @@ export default {
ellipsis: true,
align: "left",
fixed: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -874,6 +891,9 @@ export default {
ellipsis: true,
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "参加人数",
@@ -881,6 +901,9 @@ export default {
ellipsis: true,
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "参考率",
@@ -899,6 +922,9 @@ export default {
key: "passNum",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "及格率",
@@ -907,6 +933,7 @@ export default {
key: "passRate",
width: 120,
align: "center",
+ sorter: true,
customRender: (text) => {
return formatTextRate(text.value);
},
@@ -919,7 +946,7 @@ export default {
width: 120,
align: "center",
customRender: (text) => {
- return formatTextRate(text.value);
+ return formatValNull(text.value);
},
},
{
@@ -929,6 +956,9 @@ export default {
key: "medianScore",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "平均答题时长(分钟)",
@@ -937,6 +967,9 @@ export default {
key: "avgTestDuration",
width: 160,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "发布时间",
@@ -957,6 +990,7 @@ export default {
key: "createTime",
width: 120,
align: "center",
+ sorter: true,
customRender: (text) => {
return formatDate(text.value);
},
@@ -969,8 +1003,7 @@ export default {
align: "center",
},
];
- }
- else if (index === 6) {
+ } else if (index === 6) {
columns.value = [
{
title: "岗位名称",
@@ -980,6 +1013,7 @@ export default {
key: "stdPositionName",
width: 120,
align: "left",
+ sorter: true,
},
{
title: "任职资格等级",
@@ -987,6 +1021,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "band",
@@ -1001,6 +1036,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "必修任务数",
@@ -1022,6 +1058,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "完成人数",
@@ -1077,6 +1114,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
customRender: (text) => {
return formatDate(text.value);
},
@@ -1093,8 +1131,7 @@ export default {
},
},
];
- }
- else if (index === 5) {
+ } else if (index === 5) {
columns.value = [
{
title: "案例名称",
@@ -1102,8 +1139,9 @@ export default {
ellipsis: true,
fixed: "left",
key: "caseName",
- width: 120,
+ width: 150,
align: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -1111,7 +1149,7 @@ export default {
ellipsis: true,
align: "center",
fixed: "left",
- width: 120,
+ width: 150,
},
{
title: "专业分类",
@@ -1134,6 +1172,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
customRender: (text) => {
return formatDate(text.value);
},
@@ -1152,6 +1191,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "收藏数",
@@ -1159,6 +1199,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "点赞数",
@@ -1166,6 +1207,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
@@ -1174,6 +1216,7 @@ export default {
ellipsis: true,
align: "center",
width: 120,
+ sorter: true,
},
{
title: "是否推荐",
@@ -1220,6 +1263,7 @@ export default {
ellipsis: true,
align: "left",
fixed: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -1237,7 +1281,7 @@ export default {
key: "category",
width: 120,
align: "center",
- fixed: "left",
+ sorter: true,
},
{
title: "授课老师",
@@ -1246,7 +1290,6 @@ export default {
key: "teacher",
width: 120,
align: "center",
- fixed: "left",
},
{
title: "关键字",
@@ -1255,6 +1298,9 @@ export default {
key: "keywords",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value)
+ },
},
{
title: "课件数量",
@@ -1349,6 +1395,7 @@ export default {
key: "createTime",
width: 120,
align: "center",
+ sorter: true,
customRender: (text) => {
return formatDate(text.value)
},
@@ -1360,18 +1407,20 @@ export default {
key: "createName",
width: 120,
align: "center",
+ sorter: true,
},
];
} else if (index === 2) {
columns.value = [
{
title: "课程名称",
- dataIndex: "offCourseName",
- key: "offCourseName",
+ dataIndex: "offCoursePlanName",
+ key: "offCoursePlanName",
width: 120,
ellipsis: true,
align: "left",
fixed: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -1382,6 +1431,14 @@ export default {
align: "center",
fixed: "left",
},
+ {
+ title: "所属课程",
+ dataIndex: "offCourseName",
+ ellipsis: true,
+ key: "offCourseName",
+ width: 120,
+ align: "center",
+ },
{
title: "开课开始时间",
dataIndex: "startTime",
@@ -1419,6 +1476,9 @@ export default {
key: "address",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value)
+ },
},
{
title: "授课讲师",
@@ -1427,9 +1487,10 @@ export default {
key: "teacher",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value)
+ },
},
-
-
{
title: "是否作业",
dataIndex: "hasWorkInfo",
@@ -1437,6 +1498,9 @@ export default {
key: "hasWorkInfo",
width: 120,
align: "center",
+ customRender: (text) => {
+ return text.value == 1 ? "是" : "否";
+ },
},
{
title: "是否考试",
@@ -1445,6 +1509,9 @@ export default {
key: "hasTest",
width: 120,
align: "center",
+ customRender: (text) => {
+ return text.value == 1 ? "是" : "否";
+ },
},
{
title: "参加人数",
@@ -1453,6 +1520,7 @@ export default {
key: "studentNum",
width: 120,
align: "center",
+ sorter: true,
},
{
title: "参评人数",
@@ -1461,6 +1529,9 @@ export default {
key: "assessmentNum",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "平均评分",
@@ -1469,6 +1540,9 @@ export default {
key: "assessmentScore",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "作业完成人数",
@@ -1477,6 +1551,9 @@ export default {
key: "workCompNum",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "作业平均分",
@@ -1485,6 +1562,9 @@ export default {
key: "workAvgScore",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "考试完成人数",
@@ -1493,6 +1573,9 @@ export default {
key: "testCompNum",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
title: "考试平均分",
@@ -1501,6 +1584,9 @@ export default {
key: "testAvgScore",
width: 120,
align: "center",
+ customRender: (text) => {
+ return formatValNull(text.value);
+ },
},
{
@@ -1518,6 +1604,10 @@ export default {
key: "reportCreateTime",
width: 120,
align: "center",
+ sorter: true,
+ customRender: (text) => {
+ return formatDate(text.value)
+ },
},
];
} else if (index === 1) {
@@ -1530,6 +1620,7 @@ export default {
ellipsis: true,
align: "left",
fixed: "left",
+ sorter: true,
},
{
title: "归属组织",
@@ -1566,6 +1657,7 @@ export default {
key: "createTime",
width: 120,
align: "center",
+ sorter: true,
customRender: (text) => {
return text.value ? formatDate(text.value) : "";
},
@@ -1612,6 +1704,9 @@ export default {
key: "studentLearnRate",
width: 120,
align: "center",
+ customRender(text) {
+ return formatTextRate(text.value);
+ },
},
{
title: "完成人数",
@@ -1628,6 +1723,9 @@ export default {
key: "studentCompleteRate",
width: 120,
align: "center",
+ customRender(text) {
+ return formatTextRate(text.value);
+ },
},
{
title: "总任务数",
@@ -1644,6 +1742,9 @@ export default {
key: "taskRate",
width: 120,
align: "center",
+ customRender(text) {
+ return formatTextRate(text.value);
+ },
},
{
title: "在线课程数",
@@ -1688,6 +1789,7 @@ export default {
dataIndex: "examNum",
ellipsis: true,
key: "examNum",
+ align: "center",
width: 120,
},
{
@@ -1695,6 +1797,7 @@ export default {
dataIndex: "examPassRate",
ellipsis: true,
key: "examPassRate",
+ align: "center",
width: 120,
customRender: (text) => {
return formatTextRate(text.value);
@@ -1706,7 +1809,7 @@ export default {
if ([0, 1].includes(index)) {
state.statusList = statusArr[index];
}
-
+ state.tableSorts = [];
getTableData();
getTabData();
};
@@ -1738,6 +1841,21 @@ export default {
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 = {
"0": "草稿",
"1": "已发布",
@@ -1753,23 +1871,38 @@ export default {
};
//时间格式化 后续抽到 工具类中
const formatTime_ = (time, format = "YYYY-MM-DD HH:mm:ss") => {
+ if (!time) {
+ return null;
+ }
return dayjs(time).format(format);
};
+
//后续抽到 工具类中
function formatTextRate(value) {
- return value ? value + "%" : "0%";
+ if (!value && value != 0) {
+ return "-";
+ }
+ return value + "%";
+ }
+
+ function formatValNull(val) {
+ if (!val && val !== 0) {
+ return "-";
+ }
+ return val;
}
// 获取名称路径的函数
function findPathByValue(data, value) {
debugger;
+
function recursiveSearch(nodes, value, path) {
for (let node of nodes) {
if (node.value === value) {
return path + node.name;
}
if (node.children) {
- let result = recursiveSearch(node.children, value, path + node.name + '-');
+ let result = recursiveSearch(node.children, value, path + node.name + '/');
if (result) {
return result;
}
@@ -1778,7 +1911,7 @@ export default {
return null;
}
- if (!data) {
+ if (!data || !value) {
return null;
}
return recursiveSearch(data, value, '');
@@ -1803,7 +1936,8 @@ export default {
orgChange,
handleResizeColumn,
onDragEnd,
- sysTypeOptions
+ sysTypeOptions,
+ handleTableChange
};
},
};
@@ -2054,4 +2188,7 @@ export default {
// background-color: #eff4fc;
// cursor: move; // 启用拖拽光标
//}
+.ant-table-tbody > tr > td {
+ user-select: text !important;
+}