diff --git a/apps/web-antd/src/views/business/product/western-medicine/config/table.ts b/apps/web-antd/src/views/business/product/western-medicine/config/table.ts index e4500ca0..96bbec76 100644 --- a/apps/web-antd/src/views/business/product/western-medicine/config/table.ts +++ b/apps/web-antd/src/views/business/product/western-medicine/config/table.ts @@ -28,8 +28,8 @@ export const gridOptions: VxeGridProps = { columns: [ { type: 'checkbox', width: 60 }, { field: 'id', align: 'left', title: 'ID', width: 100 }, - { field: 'drug_name', align: 'left', title: '药品名称' }, - { field: 'pinyin_simple', title: '拼音' }, + { field: 'drug_name', align: 'left', title: '药品名称', width: 120 }, + { field: 'pinyin_simple', title: '拼音', width: 120 }, { field: 'zone_name', title: '分区', @@ -42,7 +42,7 @@ export const gridOptions: VxeGridProps = { width: 120, slots: { default: 'category' }, }, - { field: 'supplier.name', title: '供应商', slots: { default: 'supplier' } }, + { field: 'supplier.name', title: '供应商', slots: { default: 'supplier' },width: 130 }, { field: 'image', align: 'left', @@ -57,8 +57,8 @@ export const gridOptions: VxeGridProps = { slots: { default: 'instruction' }, width: 130, }, - { field: 'function', title: '主要功能' }, - { field: 'specification', title: '规格' }, + { field: 'function', title: '主要功能', width: 240 }, + { field: 'specification', title: '规格', width: 130 }, { field: 'is_otc', title: '处方药', @@ -66,14 +66,14 @@ export const gridOptions: VxeGridProps = { slots: { default: 'is_otc' }, }, { field: 'status', title: '状态', slots: { default: 'status' } }, - { field: 'created_at', title: '发布时间' }, + { field: 'created_at', title: '发布时间', width: 240 }, { field: 'min_adjust_price', title: '最低调整金额', width: 130, slots: { default: 'min_adjust_price' }, }, - { type: 'html', title: '操作', width: 280, slots: { default: 'action' } }, + { type: 'html', title: '操作', fixed: 'right', width: 280, slots: { default: 'action' } }, ], keepSource: true, pagerConfig: {}, diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/admin/api/index.ts b/apps/web-antd/src/views/business/warehouse-drug-management/admin/api/index.ts index 686e45b1..03c1dc74 100644 --- a/apps/web-antd/src/views/business/warehouse-drug-management/admin/api/index.ts +++ b/apps/web-antd/src/views/business/warehouse-drug-management/admin/api/index.ts @@ -46,8 +46,8 @@ export async function getWarehouseDrugManagementInfo(id: number) { /** * 导出仓库药品药品 */ -export async function exportWarehouseDrugManagementApi() { - return requestClient.download(`${prefix}export`); +export async function exportWarehouseDrugManagementApi(params?: { type?: number }) { + return requestClient.download(`${prefix}export`, { params }); } /** * 导出仓库药品药品 - 模板 diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/search.ts b/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/search.ts index d1df3fda..9f2e97ba 100644 --- a/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/search.ts +++ b/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/search.ts @@ -1,11 +1,6 @@ import type { VbenFormProps } from '#/adapter/form'; -import { getWarehouseProductTypeOptions } from '../api'; - -// import dayjs from 'dayjs'; - export const formOptions: VbenFormProps = { - // 默认展开 collapsed: false, schema: [ { @@ -17,41 +12,11 @@ export const formOptions: VbenFormProps = { fieldName: 'name', label: '药名称', }, - { - component: 'ApiSelect', - componentProps: { - allowClear: true, - api: getWarehouseProductTypeOptions, - placeholder: '请选择类型', - afterFetch: (data: { label: string; value: number }[]) => { - if (!Array.isArray(data)) return []; - return data.map((item) => ({ - label: item.label, - value: item.value, - })); - }, - }, - defaultValue: 1, - fieldName: 'type', - label: '类型', - }, - // { - // component: 'RangePicker', - // componentProps: { - // format: 'YYYY-MM-DD', // 确保格式与你需要的一致 - // }, - // // defaultValue: [dayjs().startOf('month'), dayjs()], - // fieldName: 'search_time', - // label: '时间范围', - // }, ], - // 控制表单是否显示折叠按钮 showCollapseButton: true, submitButtonOptions: { content: '查询', }, - // 是否在字段值改变时提交表单 submitOnChange: true, - // 按下回车时是否提交表单 submitOnEnter: false, }; diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/table.ts b/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/table.ts index 74617cf8..32f2f8ac 100644 --- a/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/table.ts +++ b/apps/web-antd/src/views/business/warehouse-drug-management/admin/config/table.ts @@ -1,6 +1,6 @@ import type { VxeGridProps } from '#/adapter/vxe-table'; -import {getWarehouseDrugManagementList} from '../api'; +import { getWarehouseDrugManagementList } from '../api'; interface RowType { id: string; @@ -10,70 +10,65 @@ interface RowType { created_at: string; } -export const gridOptions: VxeGridProps = { - checkboxConfig: { - highlight: true, - labelField: '', - }, - columnConfig: { - useKey: true, - }, - rowConfig: { - useKey: true, - }, - columns: [ - { type: 'checkbox', width: 60 }, - { field: 'id', align: 'left', title: 'ID', width: 100 }, - { field: 'drug.drug_name', align: 'left', title: '药品名称' }, - { field: 'drug.pinyin_simple', title: '拼音' }, - { - field: 'image', - align: 'left', - title: '产品图片', - slots: { default: 'image' }, - width: 130, +export function createGridOptions(productType: number): VxeGridProps { + return { + checkboxConfig: { + highlight: true, + labelField: '', }, - { field: 'market_price', title: '供货价' }, - { field: 'price', title: '建议售价' }, - { field: 'status', title: '状态', slots: { default: 'status' } }, - { field: 'created_at', title: '创建时间' }, - { type: 'html', title: '操作', slots: { default: 'action' } }, - ], - keepSource: true, - pagerConfig: {}, - proxyConfig: { - ajax: { - // 请求后端接口方法 - query: async ({ page }, formValues) => { - return await getWarehouseDrugManagementList({ - page: page.currentPage, - pageSize: page.pageSize, - ...formValues, - }); + columnConfig: { + useKey: true, + }, + rowConfig: { + useKey: true, + }, + columns: [ + { type: 'checkbox', width: 60 }, + { field: 'id', align: 'left', title: 'ID', width: 100 }, + { field: 'drug.drug_name', align: 'left', title: '药品名称' }, + { field: 'drug.pinyin_simple', title: '拼音' }, + { + field: 'image', + align: 'left', + title: '产品图片', + slots: { default: 'image' }, + width: 130, + }, + { field: 'market_price', title: '供货价' }, + { field: 'price', title: '建议售价' }, + { field: 'status', title: '状态', slots: { default: 'status' } }, + { field: 'created_at', title: '创建时间' }, + { type: 'html', title: '操作', slots: { default: 'action' } }, + ], + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues) => { + return await getWarehouseDrugManagementList({ + page: page.currentPage, + pageSize: page.pageSize, + type: productType, + ...formValues, + }); + }, }, }, - }, - // exportConfig: { - // api: passApplicationApi, - // }, - height: 'auto', - border: false, - toolbarConfig: { - // 是否显示搜索表单控制按钮 - // @ts-ignore 正式环境时有完整的类型声明 - search: true, - refresh: true, // 刷新 - print: false, // 打印 - export: false, // 导出 - // custom: true, // 自定义列 - zoom: true, // 最大化最小化 - slots: { - buttons: 'toolbar-buttons', + height: 'auto', + border: false, + toolbarConfig: { + search: true, + refresh: true, + print: false, + export: false, + zoom: true, + slots: { + buttons: 'toolbar-buttons', + }, + custom: { + icon: 'vxe-icon-menu', + }, }, - custom: { - // 自定义列-图标 - icon: 'vxe-icon-menu', - }, - }, - showOverflow: false, -}; + showOverflow: false, + }; +} diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/admin/index.vue b/apps/web-antd/src/views/business/warehouse-drug-management/admin/index.vue index 3328dcf1..001904aa 100644 --- a/apps/web-antd/src/views/business/warehouse-drug-management/admin/index.vue +++ b/apps/web-antd/src/views/business/warehouse-drug-management/admin/index.vue @@ -1,7 +1,7 @@