feat: sync advanced filter fields with column permissions

Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
dxc
2026-03-02 17:53:52 +08:00
parent cf821b78aa
commit ec8bdb2476
3 changed files with 40 additions and 14 deletions

View File

@ -445,7 +445,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, nextTick } from 'vue';
import { ref, reactive, onMounted, nextTick, computed } from 'vue';
import { Plus, Document, Refresh, Setting, Rank, Camera, Link, Download } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
import type { FormInstance, FormRules } from 'element-plus';
@ -511,17 +511,21 @@ 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 fieldOptions = computed(() => {
const allFields = [
{ value: 'companyName', label: '所属公司', perm: 'material_list:companyName' },
{ value: 'name', label: '名称', perm: 'material_list:name' },
{ value: 'commonName', label: '俗名', perm: 'material_list:commonName' },
{ value: 'category', label: '类别', perm: 'material_list:category' },
{ value: 'type', label: '类型', perm: 'material_list:type' },
{ value: 'spec', label: '规格型号', perm: 'material_list:spec' },
{ value: 'unit', label: '单位', perm: 'material_list:unit' },
{ value: 'inventoryCount', label: '库存数', perm: 'material_list:inventoryCount' },
{ value: 'availableCount', label: '可用数', perm: 'material_list:availableCount' }
];
// 根据用户权限过滤
return allFields.filter(item => userStore.hasPermission(item.perm));
});
const operatorOptions = ref([
{ value: 'eq', label: '等于' },
{ value: 'ne', label: '不等于' },