feat: add sorting and export desensitization to material list
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -121,6 +121,7 @@
|
||||
border
|
||||
stripe
|
||||
:size="tableSize"
|
||||
@sort-change="handleSortChange"
|
||||
style="width: 100%; margin-top: 15px"
|
||||
>
|
||||
<el-table-column v-if="columns.id.visible" prop="id" label="ID" min-width="80" align="center" fixed="left" />
|
||||
@ -149,7 +150,7 @@
|
||||
<el-table-column v-if="columns.spec.visible" prop="spec" label="规格型号" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column v-if="columns.unit.visible" prop="unit" label="单位" min-width="80" align="center" />
|
||||
|
||||
<el-table-column v-if="columns.inventory.visible" prop="inventoryCount" label="库存数" min-width="100" align="center">
|
||||
<el-table-column v-if="columns.inventory.visible" prop="inventoryCount" label="库存数" min-width="100" align="center" sortable="custom">
|
||||
<template #default="{ row }">
|
||||
<span :style="{ fontWeight: 'bold', color: row.inventoryCount > 0 ? '#67C23A' : '#909399' }">
|
||||
{{ row.inventoryCount }}
|
||||
@ -157,7 +158,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="columns.available.visible" prop="availableCount" label="可用数" min-width="100" align="center">
|
||||
<el-table-column v-if="columns.available.visible" prop="availableCount" label="可用数" min-width="100" align="center" sortable="custom">
|
||||
<template #default="{ row }">
|
||||
<span :style="{ fontWeight: 'bold', color: row.availableCount > 0 ? '#409EFF' : '#909399' }">
|
||||
{{ row.availableCount }}
|
||||
@ -463,6 +464,8 @@ interface QueryParams {
|
||||
type: string;
|
||||
company: string;
|
||||
isEnabled?: number;
|
||||
orderByColumn: string;
|
||||
isAsc: string | undefined;
|
||||
}
|
||||
|
||||
interface CascaderOption {
|
||||
@ -566,7 +569,9 @@ const queryParams = reactive<QueryParams>({
|
||||
category: '',
|
||||
type: '',
|
||||
company: '',
|
||||
isEnabled: undefined
|
||||
isEnabled: undefined,
|
||||
orderByColumn: '',
|
||||
isAsc: undefined
|
||||
});
|
||||
|
||||
// --- 弹窗与表单相关 ---
|
||||
@ -754,6 +759,18 @@ const handleInputSearch = () => {
|
||||
}, 500);
|
||||
};
|
||||
|
||||
const handleSortChange = ({ column, prop, order }: any) => {
|
||||
if (prop && (prop === 'inventoryCount' || prop === 'availableCount')) {
|
||||
queryParams.orderByColumn = prop;
|
||||
queryParams.isAsc = order === 'ascending' ? 'asc' : order === 'descending' ? 'desc' : undefined;
|
||||
} else {
|
||||
queryParams.orderByColumn = '';
|
||||
queryParams.isAsc = undefined;
|
||||
}
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
@ -765,6 +782,8 @@ const resetQuery = () => {
|
||||
queryParams.type = '';
|
||||
queryParams.company = '';
|
||||
queryParams.isEnabled = undefined;
|
||||
queryParams.orderByColumn = '';
|
||||
queryParams.isAsc = undefined;
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user