diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/api/index.ts b/apps/web-antd/src/views/business/warehouse-drug-management/shop/api/index.ts new file mode 100644 index 00000000..2b0b5401 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/api/index.ts @@ -0,0 +1,126 @@ +import { requestClient } from '#/api/request'; + +const prefix = 'warehouse-drug-management-store/'; + +/** + * 分页查询诊所仓库商品列表 + * @param data + */ +export async function getWarehouseDrugManagementStoreList(data: any) { + return requestClient.get(`${prefix}list`, { params: data }); +} + +/** + * 分页查询诊所仓库商品列表 + * @param data + */ +export async function getWarehouseDrugManagementStoreOption(data: any) { + return requestClient.get(`${prefix}option`, { params: data }); +} + +/** + * 获取诊所仓库商品药详情 + * @param id + */ +export async function getWarehouseDrugManagementStoreInfo(id: number) { + return requestClient.get(`${prefix}detail`, { params: { id } }); +} + +/** + * 上架/下架 + * @param id + */ +export async function updateWarehouseDrugManagementStoreStatusApi(id: number) { + return requestClient.get(`${prefix}update-status`, { params: { id } }); +} + +/** + * 上架/下架 + * @param id + */ +export async function updateWarehouseDrugManagementShopUpdateStatusApi(id: number) { + return requestClient.get(`${prefix}shop-update-status`, { params: { id } }); +} + +/** + * 导出仓库药品药品 + */ +export async function exportWarehouseDrugManagementStoreApi() { + return requestClient.download(`${prefix}export`); +} +/** + * 导出仓库药品药品 - 模板 + */ +export async function exportWarehouseDrugManagementStoreTemplateApi() { + return requestClient.download(`${prefix}export-template`); +} + +/** + * 新增诊所仓库商品药 + * @param data + */ +export async function createWarehouseDrugManagementStore(data: Record) { + return requestClient.post(`${prefix}create`, data); +} + +/** + * 编辑诊所仓库商品药 + * @param data + */ +export async function updateWarehouseDrugManagementStore(data: Record) { + return requestClient.post(`${prefix}update`, data); +} + +/** + * 删除诊所仓库商品药 + * @param data + */ +export async function deleteWarehouseDrugManagementStore(data: Record) { + return requestClient.post(`${prefix}delete`, data); +} + +/** + * 导入仓库药品 + * @param data + */ +export async function importWarehouseDrugManagementStoreApi(data: Record) { + return requestClient.upload(`${prefix}import`, data); +} + +/** + * 导入仓库药品修改价格 + * @param data + */ +export async function importUpdatePriceApi(data: Record) { + return requestClient.upload(`${prefix}import-update-price`, data); +} + +/** + * 同步总仓库api + * @param data + */ +export async function syncDrugApi(data: Record) { + return requestClient.get(`${prefix}sync-drug`, data); +} + +/** + * 同步总仓库价格api + * @param data + */ +export async function syncDrugPriceApi(data: Record) { + return requestClient.get(`${prefix}sync-drug-price`, data); +} + +/** + * 检查订阅总仓库价格api + */ +export async function checkSubscribeApi() { + return requestClient.get(`${prefix}check-subscribe`); +} + +/** + * 订阅总仓库价格api + */ +export async function subscribeApi() { + return requestClient.get(`${prefix}subscribe`); +} diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/ExcelUpload.vue b/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/ExcelUpload.vue new file mode 100644 index 00000000..a4107460 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/ExcelUpload.vue @@ -0,0 +1,216 @@ + + diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/modal.vue b/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/modal.vue new file mode 100644 index 00000000..e15bef80 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/components/modal.vue @@ -0,0 +1,133 @@ + + diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/form.ts b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/form.ts new file mode 100644 index 00000000..eba3a1e7 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/form.ts @@ -0,0 +1,97 @@ +import type {VbenFormProps} from '#/adapter/form'; + +import { + getWarehouseDrugManagementStoreOption +} from "../api"; + + +export const modalFormProps: VbenFormProps = { + wrapperClass: 'grid-cols-12', // 24栅格, + commonConfig: { + formItemClass: 'col-span-12', + // 所有表单项 + componentProps: { + class: 'w-full', + }, + }, + // handleSubmit: onSubmit, + layout: 'horizontal', + schema: [ + { + component: 'VbenInput', + fieldName: 'id', + label: 'ID', + formItemClass: 'col-span-6', + dependencies: { + show: false, + triggerFields: ['id'], + }, + }, + { + component: 'ApiSelect', + fieldName: 'drug_id', + label: '选择加入的药品', + formItemClass: 'col-span-12', + rules: 'required', + componentProps: { + api: getWarehouseDrugManagementStoreOption, + allowClear: true, + showSearch: true, + filterOption: (input: string, option: any) => { + // 自定义过滤逻辑,确保可以根据 name 进行搜索 + return option?.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // 菜单接口转options格式 + afterFetch: (data: { drug_name: string; id: number }[]) => { + return data.map((item: any) => ({ + label: `${item.drug_name}【${item.pinyin_simple}】`, + value: item.id, + })); + }, + }, + dependencies: { + show(formValues: any) { + return !formValues.id; + }, + triggerFields: ['id'], + }, + }, + { + component: 'VbenInput', + componentProps: { + placeholder: '请输入价格', + }, + fieldName: 'price', + formItemClass: 'col-span-12', + label: '价格', + rules: 'required', + }, + ], + showDefaultActions: false, +}; +export const uploadExcelProps: VbenFormProps = { + wrapperClass: 'grid-cols-12', // 24栅格, + commonConfig: { + formItemClass: 'col-span-12', + // 所有表单项 + componentProps: { + class: 'w-full', + }, + }, + // handleSubmit: onSubmit, + layout: 'horizontal', + schema: [ + { + component: 'Upload', + componentProps: { + placeholder: '请选择', + multiple: true, + }, + fieldName: 'frequency_id', + formItemClass: 'col-span-12', + label: '导入excel', + rules: 'file', + }, + ], + showDefaultActions: false, +}; diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/search.ts b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/search.ts new file mode 100644 index 00000000..445c9c54 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/search.ts @@ -0,0 +1,64 @@ +import type { VbenFormProps } from '#/adapter/form'; + +// import dayjs from 'dayjs'; + +export const formOptions: VbenFormProps = { + // 默认展开 + collapsed: false, + schema: [ + { + component: 'VbenInput', + componentProps: { + placeholder: '输入名称', + }, + defaultValue: '', + fieldName: 'name', + label: '药名称', + }, + { + component: 'VbenSelect', + componentProps: { + placeholder: '输入名称', + options: [ + { + label: '中药', + value: 1, + }, + { + label: '西药', + value: 2, + }, + { + label: '服务包', + value: 5, + }, + ], + show: () => { + return false; + }, + }, + disabled: true, + defaultValue: 2, + 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/shop/config/table.ts b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/table.ts new file mode 100644 index 00000000..12f52a71 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/config/table.ts @@ -0,0 +1,81 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import {getWarehouseDrugManagementStoreList} from '../api'; + +interface RowType { + id: string; + name: string; + logo: string; + introduce: string; + 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, + }, + // { field: 'drug.drug_store_drug.market_price', title: '供货价' }, + { field: 'buy_price', title: '供货价' }, + { field: 'drug.drug_store_drug.price', title: '建议售价' }, + { field: 'price', title: '售价' }, + // { field: 'status', title: '状态', slots: { default: 'status' } }, + { field: 'is_shop', title: '是否上架商城', slots: { default: 'is_shop' } }, + // { type: 'html', align: 'right', title: '操作', slots: { default: 'action' }, width: 300, }, + ], + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + // 请求后端接口方法 + query: async ({ page }, formValues) => { + return await getWarehouseDrugManagementStoreList({ + page: page.currentPage, + pageSize: page.pageSize, + ...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', + }, + custom: { + // 自定义列-图标 + icon: 'vxe-icon-menu', + }, + }, + showOverflow: false, +}; diff --git a/apps/web-antd/src/views/business/warehouse-drug-management/shop/index.vue b/apps/web-antd/src/views/business/warehouse-drug-management/shop/index.vue new file mode 100644 index 00000000..6c3e7f09 --- /dev/null +++ b/apps/web-antd/src/views/business/warehouse-drug-management/shop/index.vue @@ -0,0 +1,284 @@ + + +