import { ref } from "vue";
import dayjs from "dayjs";
import { statusList, inv_type_list } from "./status";
export function useColumns() {
const columns = ref([
{
type: "selection",
width: 55,
hide: ({ checkList }) => !checkList.includes("勾选列")
},
{
label: "序号",
type: "index",
width: 70,
hide: ({ checkList }) => !checkList.includes("序号列")
},
{
label: "发票申请编号",
prop: "invNo",
width: 160
},
{
label: "企业客户",
prop: "customerName",
width: 160
},
{
label: "企业客户编码",
prop: "inv_in",
width: 160
},
{
label: "业务企业编号",
prop: "inv_out"
},
{
label: "发票额度",
prop: "inv_value",
width: 110
},
{
label: "状态",
prop: "status",
minWidth: 80,
cellRenderer: ({ row, props }) => (
item.value == row.status + "") || {})
.type || "info"
}
effect="plain"
>
{(statusList.find(item => item.value == row.status + "") || {})
.label || "--"}
)
},
{
label: "发票类型",
prop: "inv_type",
minWidth: 80,
cellRenderer: ({ row, props }) => (
item.value == row.inv_type + "") || {})
.type || "info"
}
effect="plain"
>
{(inv_type_list.find(item => item.value == row.inv_type + "") || {})
.label || "--"}
)
},
{
label: "申请人",
prop: "apply_name",
width: 80
},
{
label: "创建时间",
width: 145,
prop: "addtime",
formatter: ({ addtime }) =>
addtime ? dayjs(addtime).format("YYYY-MM-DD HH:mm:ss") : ""
},
{
label: "操作",
fixed: "right",
width: 55,
slot: "operation"
}
]);
return {
columns
};
}