Browse Source

前端自动配置可筛选列

master
wanggang 1 year ago
parent
commit
e810b27f3a
  1. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js

14
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js

@ -105,7 +105,12 @@ export default {
</template>
<template v-else>
<template v-if="showColumn(item,key)">
<el-table-column :prop="key" sortable="custom" :sort-orders="['descending', 'ascending', null]">
<el-table-column
:prop="key"
sortable="custom"
:sort-orders="['descending', 'ascending', null]"
:filters="getFilters(item,key)"
>
<template #header="scope">{{item.title}}</template>
<template #default="scope">
<app-form-input mode="details" :schema="item" :prop="key" v-model="scope.row" />
@ -470,6 +475,12 @@ export default {
const showColumn = (item, prop) => {
return columns.value.some((o) => o.name === prop && o.checked);
};
const getFilters = (item, prop) => {
if (item.input === "select" && item.options) {
return item.options.map((o) => ({ text: o.label, value: o.value }));
}
return null;
};
const handleSelectionChange = (rows) => (selectedRows.value = rows);
const load = async () => {
tableLoading.value = true;
@ -890,6 +901,7 @@ export default {
pushfilterList,
getOperators,
isNotJit,
getFilters,
};
},
};

Loading…
Cancel
Save