diff --git a/inventory-web/src/views/material/list.vue b/inventory-web/src/views/material/list.vue
index 5bc6dac..406738f 100644
--- a/inventory-web/src/views/material/list.vue
+++ b/inventory-web/src/views/material/list.vue
@@ -126,29 +126,29 @@
>
-
+
{{ scope.row.companyName || '-' }}
-
+
-
+
{{ scope.row.commonName }}
-
-
+
{{ scope.row.category || '-' }}
-
+
{{ scope.row.type || '-' }}
-
-
+
+
@@ -466,6 +466,7 @@ interface QueryParams {
isEnabled?: number;
orderByColumn: string;
isAsc: string | undefined;
+ advancedFilters?: any[];
}
interface CascaderOption {
@@ -481,6 +482,26 @@ const total = ref(0);
const tableData = ref([]);
const submitLoading = ref(false);
const tableSize = ref<'large' | 'default' | 'small'>('large');
+const advancedFilterVisible = ref(false);
+const advancedConditions = ref([{ field: '', operator: '', value: '' }]);
+const fieldOptions = ref([
+ { value: 'companyName', label: '所属公司' },
+ { value: 'name', label: '名称' },
+ { value: 'commonName', label: '俗名' },
+ { value: 'category', label: '类别' },
+ { value: 'type', label: '类型' },
+ { value: 'spec', label: '规格型号' },
+ { value: 'unit', label: '单位' },
+ { value: 'inventoryCount', label: '库存数' },
+ { value: 'availableCount', label: '可用数' }
+]);
+const operatorOptions = ref([
+ { value: 'eq', label: '等于' },
+ { value: 'ne', label: '不等于' },
+ { value: 'contains', label: '包含' },
+ { value: 'ge', label: '大于等于' },
+ { value: 'le', label: '小于等于' }
+]);
// 文件上传相关
const fileListImage = ref([]);
@@ -571,7 +592,8 @@ const queryParams = reactive({
company: '',
isEnabled: undefined,
orderByColumn: '',
- isAsc: undefined
+ isAsc: undefined,
+ advancedFilters: []
});
// --- 弹窗与表单相关 ---
@@ -760,7 +782,8 @@ const handleInputSearch = () => {
};
const handleSortChange = ({ column, prop, order }: any) => {
- if (prop && (prop === 'inventoryCount' || prop === 'availableCount')) {
+ const sortableColumns = ['inventoryCount', 'availableCount', 'companyName', 'name', 'commonName', 'category', 'type', 'spec', 'unit'];
+ if (prop && sortableColumns.includes(prop)) {
queryParams.orderByColumn = prop;
queryParams.isAsc = order === 'ascending' ? 'asc' : order === 'descending' ? 'desc' : undefined;
} else {
@@ -1056,6 +1079,28 @@ const handleCameraConfirm = async (file: File) => {
}
};
+const addCondition = () => {
+ advancedConditions.value.push({ field: '', operator: '', value: '' });
+};
+const removeCondition = (index: number) => {
+ advancedConditions.value.splice(index, 1);
+};
+const applyAdvancedFilter = () => {
+ // Filter out empty conditions
+ const validConditions = advancedConditions.value.filter(c => c.field && c.operator && c.value !== '');
+ queryParams.advancedFilters = validConditions;
+ advancedFilterVisible.value = false;
+ queryParams.pageNum = 1;
+ getList();
+};
+const resetAdvancedFilter = () => {
+ advancedConditions.value = [{ field: '', operator: '', value: '' }];
+ queryParams.advancedFilters = [];
+ advancedFilterVisible.value = false;
+ queryParams.pageNum = 1;
+ getList();
+};
+
onMounted(() => {
// 先根据权限初始化列显示状态
initColumnPermissions();