fix: 修复列表操作列展示问题

bak
刘释隆 1 year ago
parent d8859d2e1d
commit e4cf08b2f5

@ -41,6 +41,21 @@ import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
const dicStore = useDictionary(); const dicStore = useDictionary();
const izstatusList = ref([]); const izstatusList = ref([]);
const reviewType = 0; const reviewType = 0;
const actionsColumns = {
title: "操作",
key: "actions",
minWidth: 200,
fixed: "right",
render(row) {
return h(Action, {
id: row.id,
status: row.states,
trigger: (action) => {
actionHandler(action, row);
},
});
},
};
const columnsRef = ref<DataTableColumns<RowData>>([]); const columnsRef = ref<DataTableColumns<RowData>>([]);
// const columns: DataTableColumns<RowData> = [ // const columns: DataTableColumns<RowData> = [
// { // {
@ -174,6 +189,7 @@ async function getColumns() {
columnsRef.value.push({ columnsRef.value.push({
title: v.fieldDesc, title: v.fieldDesc,
key: v.name, key: v.name,
fixed: "left",
width: 120, width: 120,
}); });
} }
@ -181,27 +197,13 @@ async function getColumns() {
columnsRef.value.push({ columnsRef.value.push({
title: v.fieldDesc, title: v.fieldDesc,
key: v.name, key: v.name,
fixed: "left",
width: 120, width: 120,
}); });
} }
}); });
columnsRef.value.push({ columnsRef.value.push(actionsColumns as any)
title: "操作",
key: "actions",
width: 200,
fixed: "right",
render(row) {
return h(Action, {
id: row.id,
status: row.states,
trigger: (action) => {
actionHandler(action, row);
},
});
},
});
formatColumns(); formatColumns();
console.log(columnsRef.value, "columnsRef");
} }
async function formatColumns() { async function formatColumns() {
@ -212,7 +214,7 @@ async function formatColumns() {
columnsRef.value[index] = { columnsRef.value[index] = {
title: "任务名称", title: "任务名称",
key: columnsRef.value[index]["key"], //"fromtaskname" key: columnsRef.value[index]["key"], //"fromtaskname"
fixed: "left", fixed: columnsRef.value[index]["fixed"] || undefined,
width: 200, width: 200,
ellipsis: { ellipsis: {
tooltip: true, tooltip: true,
@ -224,6 +226,7 @@ async function formatColumns() {
columnsRef.value[index] = { columnsRef.value[index] = {
title: "审批状态", title: "审批状态",
key: columnsRef.value[index]["key"], key: columnsRef.value[index]["key"],
fixed: columnsRef.value[index]["fixed"] || undefined,
width: 100, width: 100,
sorter: "default", sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
@ -244,6 +247,7 @@ async function formatColumns() {
columnsRef.value[index] = { columnsRef.value[index] = {
title: "图片相似度", title: "图片相似度",
key: columnsRef.value[index]["key"], key: columnsRef.value[index]["key"],
fixed: columnsRef.value[index]["fixed"] || undefined,
width: 150, width: 150,
sorter: "default", sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
@ -261,6 +265,7 @@ async function formatColumns() {
columnsRef.value[index] = { columnsRef.value[index] = {
title: "提报时间", title: "提报时间",
key: columnsRef.value[index]["key"], key: columnsRef.value[index]["key"],
fixed: columnsRef.value[index]["fixed"] || undefined,
width: 200, width: 200,
sorter: "default", sorter: "default",
renderSorterIcon: ({ order }) => { renderSorterIcon: ({ order }) => {
@ -279,6 +284,7 @@ async function formatColumns() {
columnsRef.value[index] = { columnsRef.value[index] = {
title: "更新时间", title: "更新时间",
key: columnsRef.value[index]["key"], key: columnsRef.value[index]["key"],
fixed: columnsRef.value[index]["fixed"] || undefined,
width: 200, width: 200,
render(row: any) { render(row: any) {
return row.updatetime ? formatToDateHMS(row.updatetime) : ""; return row.updatetime ? formatToDateHMS(row.updatetime) : "";
@ -467,21 +473,7 @@ function sucessHandler(excelData) {
function commitHandler(columns) { function commitHandler(columns) {
columnsRef.value = [ columnsRef.value = [
...columns, ...columns,
{ actionsColumns
title: "操作",
key: "actions",
width: 200,
fixed: "right",
render(row) {
return h(Action, {
id: row.id,
status: row.states,
trigger: (action) => {
actionHandler(action, row);
},
});
},
},
]; ];
formatColumns(); formatColumns();
} }
@ -892,4 +884,7 @@ async function refreshHandler(searchId?: any) {
background: #fff; background: #fff;
} }
} }
:deep(.n-data-table .n-data-table-td.n-data-table-td--fixed-right){
z-index: 100 !important;
}
</style> </style>

Loading…
Cancel
Save