|
@@ -245,7 +245,7 @@ function getValueByKey(obj, key) {
|
|
|
}
|
|
|
// 模拟接口数据
|
|
|
const rawData = ref([]);
|
|
|
-const init = (item, deptNames, names) => {
|
|
|
+const init = async (item, deptNames, names) => {
|
|
|
rawData.value = item;
|
|
|
console.log("item", item);
|
|
|
deptName.value = deptNames;
|
|
@@ -259,8 +259,8 @@ const init = (item, deptNames, names) => {
|
|
|
tabTitle.value = "科室";
|
|
|
}
|
|
|
// 初始化
|
|
|
- createColumns();
|
|
|
- loadData();
|
|
|
+ await createColumns();
|
|
|
+ await loadData();
|
|
|
};
|
|
|
defineExpose({
|
|
|
init
|
|
@@ -511,7 +511,8 @@ const loadData = () => {
|
|
|
setTimeout(() => {
|
|
|
gridOptions.data = tableData;
|
|
|
fileData.value = JSON.parse(JSON.stringify(tableData));
|
|
|
- if ($route.name != "workerDrak") {
|
|
|
+ console.log("fileData", fileData.value);
|
|
|
+ if ($route.name != "workerDrak" && fileData.value.length > 0) {
|
|
|
fileData.value[0].ranking = "平均得分";
|
|
|
}
|
|
|
gridOptions.loading = false;
|
|
@@ -519,17 +520,17 @@ const loadData = () => {
|
|
|
}, 500);
|
|
|
};
|
|
|
|
|
|
-// 监听年份变化,重新渲染
|
|
|
-watch($prop.rankTableRefList, newVal => {
|
|
|
- init(newVal.data, newVal.dept, newVal.name);
|
|
|
- createColumns();
|
|
|
- loadData();
|
|
|
- gridRef.value.setMergeCells([
|
|
|
- // 合并第一行前两列
|
|
|
- { row: 0, col: 0, rowspan: 1, colspan: 2 },
|
|
|
- { row: 2, col: 1, rowspan: 0, colspan: 0 }
|
|
|
- ]);
|
|
|
-});
|
|
|
+// 监听重新渲染 (造成递归死循环修改逻辑)
|
|
|
+// watch($prop.rankTableRefList, newVal => {
|
|
|
+// init(newVal.data, newVal.dept, newVal.name);
|
|
|
+// createColumns();
|
|
|
+// loadData();
|
|
|
+// gridRef.value.setMergeCells([
|
|
|
+// // 合并第一行前两列
|
|
|
+// { row: 0, col: 0, rowspan: 1, colspan: 2 },
|
|
|
+// { row: 2, col: 1, rowspan: 0, colspan: 0 }
|
|
|
+// ]);
|
|
|
+// });
|
|
|
// 导出
|
|
|
const exportEvent = () => {
|
|
|
let $grid;
|