fix(srm): 供应商档案在线/离线页签筛选取值生效,去掉重复的状态字段,增加合同入口
- 页签切换改为走查询参数 onlineStatus,避免各页签复用同一批数据
- 去掉与在线/离线重复的「状态」列与筛选项
- 列表操作增加「合同」,跳转供应商合同页并按当前供应商筛选
Co-Authored-By: Claude Code <noreply@anthropic.com>
| | |
| | | export function useGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'code', |
| | | label: '编码', |
| | | component: 'Input', |
| | | componentProps: { placeholder: '请输入编码', allowClear: true }, |
| | | }, |
| | | { |
| | | fieldName: 'name', |
| | | label: '供应商名称', |
| | | component: 'Input', |
| | | componentProps: { placeholder: '请输入供应商名称', allowClear: true }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: '类型', |
| | | component: 'Select', |
| | | componentProps: { |
| | | placeholder: '请选择类型', |
| | | allowClear: true, |
| | | options: SUPPLIER_TYPE_OPTIONS, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'onlineStatus', |
| | | label: '在线状态', |
| | | component: 'Select', |
| | | componentProps: { |
| | | placeholder: '请选择在线状态', |
| | | allowClear: true, |
| | | options: SUPPLIER_ONLINE_STATUS_OPTIONS, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseCategory', |
| | | label: '采购品类', |
| | | component: 'Select', |
| | | componentProps: { |
| | | placeholder: '请选择采购品类', |
| | | allowClear: true, |
| | | options: SUPPLIER_PURCHASE_CATEGORY_OPTIONS, |
| | | }, |
| | | }, |
| | | ]; |
| | | } |
| | |
| | | import type { SrmSupplierApi } from '#/api/srm/supplier'; |
| | | |
| | | import { ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | |
| | | import { Page, useVbenModal } from '@vben/common-ui'; |
| | | import { downloadFileFromBlobPart } from '@vben/utils'; |
| | |
| | | |
| | | defineOptions({ name: 'SrmSupplier' }); |
| | | |
| | | const activeTab = ref('all'); |
| | | const router = useRouter(); |
| | | |
| | | /** 当前标签页:1 在线供应商 2 离线供应商 */ |
| | | const activeTab = ref('1'); |
| | | |
| | | function handleRefresh() { |
| | | gridApi.query(); |
| | |
| | | |
| | | /** 切换「在线 / 离线」供应商标签页 */ |
| | | async function handleTabChange(key: number | string) { |
| | | // VXE proxy 查询会复用最近一次提交的检索快照,仅 setFieldValue 不会生效, |
| | | // 必须刷新提交快照并带上最新值重新加载,否则各标签页都展示同一批数据 |
| | | await gridApi.formApi.setFieldValue( |
| | | 'onlineStatus', |
| | | key === 'all' ? undefined : Number(key), |
| | | ); |
| | | const formValues = await gridApi.formApi.getValues(); |
| | | gridApi.formApi.setLatestSubmissionValues(formValues); |
| | | await gridApi.reload(formValues); |
| | | activeTab.value = String(key); |
| | | gridApi.query(); |
| | | } |
| | | |
| | | function handleCreate() { |
| | |
| | | |
| | | function handleEdit(row: SrmSupplierApi.SupplierVO) { |
| | | formModalApi.setData(row).open(); |
| | | } |
| | | |
| | | /** 查看/维护该供应商的合同 */ |
| | | function handleContract(row: SrmSupplierApi.SupplierVO) { |
| | | router.push({ |
| | | name: 'ErpSupplierContract', |
| | | query: { supplierId: String(row.id) }, |
| | | }); |
| | | } |
| | | |
| | | /** 导入供应商 */ |
| | |
| | | return await getSupplierPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | | onlineStatus: Number(activeTab.value), |
| | | ...formValues, |
| | | }); |
| | | }, |
| | |
| | | <SupplierImportModal @success="handleRefresh" /> |
| | | <div class="mx-4 mb-2"> |
| | | <Tabs v-model:active-key="activeTab" @change="handleTabChange"> |
| | | <TabPane key="all" tab="全部供应商" /> |
| | | <TabPane key="1" tab="在线供应商" /> |
| | | <TabPane key="2" tab="离线供应商" /> |
| | | </Tabs> |
| | |
| | | <TableAction |
| | | :actions="[ |
| | | { |
| | | label: '合同', |
| | | type: 'link', |
| | | auth: ['erp:supplier-contract:query'], |
| | | onClick: handleContract.bind(null, row), |
| | | }, |
| | | { |
| | | label: $t('common.edit'), |
| | | type: 'link', |
| | | icon: ACTION_ICON.EDIT, |