fix: 修复了一些问题
This commit is contained in:
@@ -152,7 +152,7 @@ const passApplication = () => {
|
||||
// 新标签跳转到 exportWesternMedicineApi
|
||||
exportOrderApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(res.data, '萧康云医-西药导出.xlsx');
|
||||
downloadByData(res.data, `萧康云医-商品订单导出${new Date()}.xlsx`);
|
||||
message.success('导出成功!');
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3,61 +3,97 @@ import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message, UploadDragger } from 'ant-design-vue';
|
||||
import { message, UploadDragger, type UploadFile } from 'ant-design-vue';
|
||||
|
||||
import { importChinaMedicineApi } from '../api';
|
||||
|
||||
const gridApi = ref();
|
||||
const fileList = ref([]);
|
||||
|
||||
const importChinaMedicine = (file) => {
|
||||
const submitApi = importChinaMedicineApi;
|
||||
submitApi({
|
||||
file: file.file,
|
||||
})
|
||||
.then(() => {
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
const selectedFile = ref<File | null>(null); // 新增:存储选中的文件
|
||||
const isFileSelected = ref(false); // 新增:标记是否有文件被选中
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
// 检查是否有选中文件
|
||||
if (!selectedFile.value) {
|
||||
message.warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = importChinaMedicineApi;
|
||||
submitApi({
|
||||
file: fileList.value,
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
try {
|
||||
await importChinaMedicineApi({
|
||||
file: selectedFile.value,
|
||||
});
|
||||
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
} catch (error) {
|
||||
message.error('导入失败');
|
||||
} finally {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
},
|
||||
});
|
||||
|
||||
// 处理文件选择变化,只存储文件不上传
|
||||
const handleChange = (info: { file: UploadFile }) => {
|
||||
const { file } = info;
|
||||
|
||||
if (file.status === 'removed') {
|
||||
// 文件被移除
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
// 存储选中的文件
|
||||
selectedFile.value = file;
|
||||
isFileSelected.value = true;
|
||||
message.success('文件已选择,请点击确认按钮上传');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" title="上传Excel">
|
||||
<!-- 新增:显示文件选择状态 -->
|
||||
<div v-if="isFileSelected" class="mb-4 p-3 bg-green-50 border border-green-200 rounded">
|
||||
<p class="text-green-700 text-sm">已选择文件:{{ selectedFile?.name }}</p>
|
||||
<p class="text-green-600 text-xs mt-1">文件已准备就绪,点击确认按钮开始上传</p>
|
||||
</div>
|
||||
|
||||
<UploadDragger
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importChinaMedicine"
|
||||
:before-upload="() => false"
|
||||
:max-count="1"
|
||||
:on-change="handleChange"
|
||||
name="file"
|
||||
accept=".xlsx,.xls"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
<svg
|
||||
@@ -121,11 +157,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行选择</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
支持单个上传,xlsx格式文件。选择文件后需要点击确认按钮进行上传。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -3,60 +3,101 @@ import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message, UploadDragger } from 'ant-design-vue';
|
||||
import { message, UploadDragger, type UploadFile } from 'ant-design-vue';
|
||||
|
||||
import { importWesternMedicineApi } from '../api';
|
||||
|
||||
const gridApi = ref();
|
||||
const fileList = ref([]);
|
||||
|
||||
const importWesternMedicine = (file) => {
|
||||
const submitApi = importWesternMedicineApi;
|
||||
submitApi({
|
||||
file: file.file,
|
||||
})
|
||||
.then(() => {
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
});
|
||||
};
|
||||
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
const selectedFile = ref<File | null>(null); // 新增:存储选中的文件
|
||||
const isFileSelected = ref(false); // 新增:标记是否有文件被选中
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
// 检查是否有选中文件
|
||||
if (!selectedFile.value) {
|
||||
message.warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = importWesternMedicineApi;
|
||||
submitApi({
|
||||
file: fileList.value,
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
try {
|
||||
await importWesternMedicineApi({
|
||||
file: selectedFile.value,
|
||||
});
|
||||
|
||||
message.success('导入成功');
|
||||
gridApi.value?.reload();
|
||||
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
|
||||
modalApi.close();
|
||||
})
|
||||
.finally(() => {
|
||||
} catch {
|
||||
message.error('导入失败');
|
||||
} finally {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
},
|
||||
});
|
||||
|
||||
// 处理文件选择变化,只存储文件不上传
|
||||
const handleChange = (info: { file: UploadFile }) => {
|
||||
const { file } = info;
|
||||
|
||||
if (file.status === 'removed') {
|
||||
// 文件被移除
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (file) {
|
||||
// 存储选中的文件
|
||||
selectedFile.value = file;
|
||||
isFileSelected.value = true;
|
||||
message.success('文件已选择,请点击确认按钮上传');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" title="上传Excel">
|
||||
<!-- 新增:显示文件选择状态 -->
|
||||
<div
|
||||
v-if="isFileSelected"
|
||||
class="mb-4 rounded border border-green-200 bg-green-50 p-3"
|
||||
>
|
||||
<p class="text-sm text-green-700">已选择文件:{{ selectedFile?.name }}</p>
|
||||
<p class="mt-1 text-xs text-green-600">
|
||||
文件已准备就绪,点击确认按钮开始上传
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<UploadDragger
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importWesternMedicine"
|
||||
:before-upload="() => false"
|
||||
:max-count="1"
|
||||
:on-change="handleChange"
|
||||
accept=".xlsx,.xls"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
@@ -121,11 +162,10 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行选择</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
支持单个上传,xlsx格式文件。选择文件后需要点击确认按钮进行上传。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
message,
|
||||
type UploadChangeParam,
|
||||
UploadDragger,
|
||||
type UploadFile,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { downloadByData } from '#/util/tool';
|
||||
@@ -20,62 +21,108 @@ import {
|
||||
|
||||
const gridApi = ref();
|
||||
const passApplication = ref();
|
||||
const titles = ref('批量修改药品价格');
|
||||
const importType = ref(1);
|
||||
const fileList = ref([]);
|
||||
const uploadType = ref(1);
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
const selectedFile = ref<File | null>(null); // 新增:存储选中的文件
|
||||
const isFileSelected = ref(false); // 新增:标记是否有文件被选中
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
// modalApi.setState({ loading: true, confirmLoading: true });
|
||||
// 检查是否有选中文件
|
||||
if (!selectedFile.value) {
|
||||
message.warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
|
||||
try {
|
||||
const submitApi =
|
||||
importType.value === 1
|
||||
? importWarehouseDrugManagementApi
|
||||
: importUpdatePriceApi;
|
||||
|
||||
await submitApi({
|
||||
file: selectedFile.value,
|
||||
upload_type: uploadType.value,
|
||||
});
|
||||
|
||||
message.success('上传成功');
|
||||
gridApi.value?.reload();
|
||||
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
|
||||
modalApi.close();
|
||||
} catch {
|
||||
message.error('上传失败');
|
||||
} finally {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
passApplication.value = isOpen ? modalApi.getData()?.passApplication : null;
|
||||
importType.value = isOpen ? modalApi.getData()?.type : 1;
|
||||
uploadType.value = isOpen ? modalApi.getData()?.uploadType : 1;
|
||||
fileList.value = [];
|
||||
selectedFile.value = null; // 重置选中的文件
|
||||
isFileSelected.value = false; // 重置文件选择状态
|
||||
|
||||
switch (uploadType.value) {
|
||||
case 1: {
|
||||
titles.value = '批量修改中药价格(库里不存在的自动添加)';
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
titles.value = '批量修改西(中成)药价格(库里不存在的自动添加)';
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
titles.value = '批量修产品服务包药价格(库里不存在的自动添加)';
|
||||
break;
|
||||
}
|
||||
// No default
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const importWarehouseDrugManagement = ({ file, onSuccess }) => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi =
|
||||
importType.value === 1
|
||||
? importWarehouseDrugManagementApi
|
||||
: importUpdatePriceApi;
|
||||
submitApi({
|
||||
file,
|
||||
})
|
||||
.then(() => {
|
||||
onSuccess('ok', { status: 'done' });
|
||||
})
|
||||
.catch(() => {
|
||||
onSuccess('error', { status: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
};
|
||||
// 修改:处理文件选择变化,只存储文件不上传
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
if (info.file.status === 'uploading') {
|
||||
const { file } = info;
|
||||
|
||||
if (file.status === 'removed') {
|
||||
// 文件被移除
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
return;
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
message.success('上传成功');
|
||||
}
|
||||
if (info.file.status === 'error') {
|
||||
message.error('upload error');
|
||||
|
||||
if (file) {
|
||||
// 存储选中的文件
|
||||
selectedFile.value = file;
|
||||
isFileSelected.value = true;
|
||||
message.success('文件已选择,请点击确认按钮上传');
|
||||
}
|
||||
};
|
||||
|
||||
// 修改:移除原来的上传函数,因为现在在onConfirm中处理上传
|
||||
|
||||
const exportWarehouseDrugManagementTemplate = () => {
|
||||
exportWarehouseDrugManagementTemplateApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(
|
||||
res.data,
|
||||
'萧康云医-仓库商品导入模板结果导出(只包含未导入的药品).xlsx',
|
||||
@@ -85,19 +132,36 @@ const exportWarehouseDrugManagementTemplate = () => {
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" :title="importType === 1 ? '上传Excel' : '批量修改价格'">
|
||||
<Button v-if="importType === 1" type="link" @click="exportWarehouseDrugManagementTemplate">
|
||||
<Modal :title="importType === 1 ? '上传Excel' : titles" class="w-[30%]">
|
||||
<Button
|
||||
v-if="importType === 1"
|
||||
type="link"
|
||||
@click="exportWarehouseDrugManagementTemplate"
|
||||
>
|
||||
下载位同步到仓库药品的导入模板
|
||||
</Button>
|
||||
<Button v-if="importType === 2" type="link" @click="passApplication">
|
||||
下载修改价格模板
|
||||
</Button>
|
||||
|
||||
<!-- 新增:显示文件选择状态 -->
|
||||
<div
|
||||
v-if="isFileSelected"
|
||||
class="mt-4 rounded border border-green-200 bg-green-50 p-3"
|
||||
>
|
||||
<p class="text-sm text-green-700">已选择文件:{{ selectedFile?.name }}</p>
|
||||
<p class="mt-1 text-xs text-green-600">
|
||||
文件已准备就绪,点击确认按钮开始上传
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<UploadDragger
|
||||
class="mt-6"
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importWarehouseDrugManagement"
|
||||
:before-upload="() => false"
|
||||
:max-count="1"
|
||||
:on-change="handleChange"
|
||||
accept=".xlsx,.xls"
|
||||
class="mt-6"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
@@ -162,11 +226,10 @@ const exportWarehouseDrugManagementTemplate = () => {
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行选择</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
支持单个上传,xlsx格式文件。选择文件后需要点击确认按钮进行上传。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -85,9 +85,12 @@ const passApplication = () => {
|
||||
};
|
||||
|
||||
const openExcelUploadModal = (type = 1) => {
|
||||
const uploadType = gridApi.formApi.latestSubmissionValues.type;
|
||||
|
||||
ExcelUploadModalApi.setData({
|
||||
gridApi,
|
||||
type,
|
||||
uploadType,
|
||||
passApplication,
|
||||
});
|
||||
ExcelUploadModalApi.open();
|
||||
@@ -150,6 +153,7 @@ const updateStatus = (id: number) => {
|
||||
},
|
||||
},
|
||||
]"
|
||||
:flex="false"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
|
||||
@@ -34,6 +34,14 @@ export async function updateWarehouseDrugManagementStoreStatusApi(id: number) {
|
||||
return requestClient.get<any>(`${prefix}update-status`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架/下架
|
||||
* @param id
|
||||
*/
|
||||
export async function updateWarehouseDrugManagementShopUpdateStatusApi(id: number) {
|
||||
return requestClient.get<any>(`${prefix}shop-update-status`, { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出仓库药品药品
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
message,
|
||||
type UploadChangeParam,
|
||||
UploadDragger,
|
||||
type UploadFile,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import { downloadByData } from '#/util/tool';
|
||||
@@ -21,61 +22,85 @@ import {
|
||||
const gridApi = ref();
|
||||
const passApplication = ref();
|
||||
const importType = ref(1);
|
||||
const fileList = ref([]);
|
||||
const fileList = ref<UploadFile[]>([]);
|
||||
const selectedFile = ref<File | null>(null); // 新增:存储选中的文件
|
||||
const isFileSelected = ref(false); // 新增:标记是否有文件被选中
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
fullscreenButton: false,
|
||||
draggable: true,
|
||||
onCancel() {
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
modalApi.close();
|
||||
},
|
||||
onConfirm: async () => {
|
||||
// modalApi.setState({ loading: true, confirmLoading: true });
|
||||
// 检查是否有选中文件
|
||||
if (!selectedFile.value) {
|
||||
message.warning('请先选择要上传的文件');
|
||||
return;
|
||||
}
|
||||
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
|
||||
try {
|
||||
const submitApi =
|
||||
importType.value === 1
|
||||
? importWarehouseDrugManagementStoreApi
|
||||
: importUpdatePriceApi;
|
||||
|
||||
await submitApi({
|
||||
file: selectedFile.value,
|
||||
});
|
||||
|
||||
message.success('上传成功');
|
||||
gridApi.value?.reload();
|
||||
|
||||
// 重置文件状态
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
fileList.value = [];
|
||||
|
||||
modalApi.close();
|
||||
} catch {
|
||||
message.error('上传失败');
|
||||
} finally {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
}
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
|
||||
passApplication.value = isOpen ? modalApi.getData()?.passApplication : null;
|
||||
importType.value = isOpen ? modalApi.getData()?.type : 1;
|
||||
fileList.value = [];
|
||||
selectedFile.value = null; // 重置选中的文件
|
||||
isFileSelected.value = false; // 重置文件选择状态
|
||||
},
|
||||
});
|
||||
|
||||
const importWarehouseDrugManagementStore = ({ file, onSuccess }) => {
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi =
|
||||
importType.value === 1
|
||||
? importWarehouseDrugManagementStoreApi
|
||||
: importUpdatePriceApi;
|
||||
submitApi({
|
||||
file,
|
||||
})
|
||||
.then(() => {
|
||||
onSuccess('ok', { status: 'done' });
|
||||
})
|
||||
.catch(() => {
|
||||
onSuccess('error', { status: 'error' });
|
||||
})
|
||||
.finally(() => {
|
||||
modalApi.setState({ loading: false, confirmLoading: false });
|
||||
});
|
||||
};
|
||||
// 修改:处理文件选择变化,只存储文件不上传
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
if (info.file.status === 'uploading') {
|
||||
const { file } = info;
|
||||
|
||||
if (file.status === 'removed') {
|
||||
// 文件被移除
|
||||
selectedFile.value = null;
|
||||
isFileSelected.value = false;
|
||||
return;
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
message.success('上传成功');
|
||||
}
|
||||
if (info.file.status === 'error') {
|
||||
message.error('upload error');
|
||||
|
||||
if (file) {
|
||||
// 存储选中的文件
|
||||
selectedFile.value = file;
|
||||
isFileSelected.value = true;
|
||||
message.success('文件已选择,请点击确认按钮上传');
|
||||
}
|
||||
};
|
||||
|
||||
const exportWarehouseDrugManagementStoreTemplate = () => {
|
||||
exportWarehouseDrugManagementStoreTemplateApi().then((res) => {
|
||||
// 创建新的URL表示指定的File对象或者Blob对象。
|
||||
downloadByData(
|
||||
res.data,
|
||||
'萧康云医-仓库商品导入模板结果导出(只包含未导入的药品).xlsx',
|
||||
@@ -85,19 +110,39 @@ const exportWarehouseDrugManagementStoreTemplate = () => {
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<Modal class="w-[30%]" :title="importType === 1 ? '上传Excel' : '批量修改价格'">
|
||||
<Button v-if="importType === 1" type="link" @click="exportWarehouseDrugManagementStoreTemplate">
|
||||
<Modal
|
||||
:title="importType === 1 ? '上传Excel' : '批量修改价格'"
|
||||
class="w-[30%]"
|
||||
>
|
||||
<Button
|
||||
v-if="importType === 1"
|
||||
type="link"
|
||||
@click="exportWarehouseDrugManagementStoreTemplate"
|
||||
>
|
||||
下载位同步到仓库药品的导入模板
|
||||
</Button>
|
||||
<Button v-if="importType === 2" type="link" @click="passApplication">
|
||||
下载修改价格模板
|
||||
</Button>
|
||||
|
||||
<!-- 新增:显示文件选择状态 -->
|
||||
<div
|
||||
v-if="isFileSelected"
|
||||
class="mt-4 rounded border border-green-200 bg-green-50 p-3"
|
||||
>
|
||||
<p class="text-sm text-green-700">已选择文件:{{ selectedFile?.name }}</p>
|
||||
<p class="mt-1 text-xs text-green-600">
|
||||
文件已准备就绪,点击确认按钮开始上传
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<UploadDragger
|
||||
class="mt-6"
|
||||
v-model:file-list="fileList"
|
||||
:custom-request="importWarehouseDrugManagementStore"
|
||||
:before-upload="() => false"
|
||||
:max-count="1"
|
||||
:on-change="handleChange"
|
||||
accept=".xlsx,.xls"
|
||||
class="mt-6"
|
||||
name="file"
|
||||
>
|
||||
<p class="flex justify-center">
|
||||
@@ -162,11 +207,10 @@ const exportWarehouseDrugManagementStoreTemplate = () => {
|
||||
<path d="M19.581 16H30v6.5H19.581Z" fill="#107c41" />
|
||||
</svg>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行上传</p>
|
||||
<p class="ant-upload-text">点击或拖动文件到此区域进行选择</p>
|
||||
<p class="ant-upload-hint">
|
||||
支持单个上传,xlsx格式文件。严禁上传公司数据或其他带格式文件。
|
||||
支持单个上传,xlsx格式文件。选择文件后需要点击确认按钮进行上传。
|
||||
</p>
|
||||
</UploadDragger>
|
||||
<!-- <Form />-->
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
@@ -38,6 +38,7 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
{ 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,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { Button, Image, message, Tag } from 'ant-design-vue';
|
||||
import { Button, Image, message, Switch, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
@@ -14,11 +14,15 @@ import { downloadByData } from '#/util/tool';
|
||||
import {
|
||||
checkSubscribeApi,
|
||||
deleteWarehouseDrugManagementStore,
|
||||
exportWarehouseDrugManagementStoreApi, subscribeApi, syncDrugApi, syncDrugPriceApi,
|
||||
updateWarehouseDrugManagementStoreStatusApi
|
||||
exportWarehouseDrugManagementStoreApi,
|
||||
subscribeApi,
|
||||
syncDrugApi,
|
||||
syncDrugPriceApi,
|
||||
updateWarehouseDrugManagementShopUpdateStatusApi,
|
||||
updateWarehouseDrugManagementStoreStatusApi,
|
||||
} from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import ExcelUpload from './components/ExcelUpload.vue';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
|
||||
@@ -98,15 +102,22 @@ const syncDrugs = () => {
|
||||
syncDrugApi().then((res) => {
|
||||
message.success('同步成功!');
|
||||
gridApi.reload();
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
const updateStatus = (id) => {
|
||||
updateWarehouseDrugManagementStoreStatusApi(id).then(() => {
|
||||
message.success('修改成功!');
|
||||
gridApi.reload();
|
||||
gridApi.query();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const updateWarehouseDrugManagementShopUpdateStatus = (id) => {
|
||||
updateWarehouseDrugManagementShopUpdateStatusApi(id).then(() => {
|
||||
message.success('修改成功!');
|
||||
gridApi.query();
|
||||
});
|
||||
};
|
||||
|
||||
const syncDrugPrice = () => {
|
||||
gridApi.setLoading(true);
|
||||
@@ -116,20 +127,20 @@ const syncDrugPrice = () => {
|
||||
gridApi.setLoading(false);
|
||||
gridApi.reload();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const isSubscribe = ref(true);
|
||||
|
||||
const checkSubscribe = () =>{
|
||||
const checkSubscribe = () => {
|
||||
checkSubscribeApi().then((res) => {
|
||||
isSubscribe.value = res;
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
const subscribe = () =>{
|
||||
const subscribe = () => {
|
||||
subscribeApi().then(() => {
|
||||
message.success('操作成功!');
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
checkSubscribe();
|
||||
@@ -142,7 +153,6 @@ checkSubscribe();
|
||||
<Grid>
|
||||
<template #toolbar-buttons>
|
||||
<TableAction
|
||||
:flex="false"
|
||||
:actions="[
|
||||
{
|
||||
label: '批量修改价格',
|
||||
@@ -186,6 +196,7 @@ checkSubscribe();
|
||||
},
|
||||
},
|
||||
]"
|
||||
:flex="false"
|
||||
>
|
||||
<template #more>
|
||||
<Button style="margin-left: 16px">
|
||||
@@ -196,7 +207,14 @@ checkSubscribe();
|
||||
</TableAction>
|
||||
</template>
|
||||
<template #image="{ row }">
|
||||
<Image :src="row.drug?.image || 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk_upload_20250510/cd470ebf97e31c4048ba502ba71b66a3.jpg'" height="30" width="30" />
|
||||
<Image
|
||||
:src="
|
||||
row.drug?.image ||
|
||||
'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk_upload_20250510/cd470ebf97e31c4048ba502ba71b66a3.jpg'
|
||||
"
|
||||
height="30"
|
||||
width="30"
|
||||
/>
|
||||
</template>
|
||||
<template #instruction="{ row }">
|
||||
<div class="div" style="width: 120px; height: 120px; overflow: scroll">
|
||||
@@ -204,22 +222,51 @@ checkSubscribe();
|
||||
</div>
|
||||
</template>
|
||||
<template #status="{ row }">
|
||||
<Tag :color="row.status === 2 ? 'green' : 'red'">{{
|
||||
row.status === 2 ? '上架' : '下架'
|
||||
}}</Tag>
|
||||
<!-- <Tag :color="row.status === 2 ? 'green' : 'red'">-->
|
||||
<!-- {{ row.status === 2 ? '上架' : '下架' }}-->
|
||||
<!-- </Tag>-->
|
||||
<Switch
|
||||
:checked="row.status"
|
||||
:checked-value="2"
|
||||
:un-checked-value="1"
|
||||
checked-children="上架"
|
||||
un-checked-children="下架"
|
||||
@click="updateStatus(row.id)"
|
||||
/>
|
||||
</template>
|
||||
<template #is_shop="{ row }">
|
||||
<Switch
|
||||
:checked="row.is_shop"
|
||||
:checked-value="2"
|
||||
:un-checked-value="1"
|
||||
checked-children="上架"
|
||||
un-checked-children="下架"
|
||||
@click="updateWarehouseDrugManagementShopUpdateStatus(row.id)"
|
||||
/>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '上架/下架',
|
||||
type: 'link',
|
||||
icon: 'uil:edit',
|
||||
size: 'small',
|
||||
// auth: ['western-medicine', 'sys:role:detail'],
|
||||
onClick: updateStatus.bind(null, row.id),
|
||||
},
|
||||
// {
|
||||
// label: '上架/下架(仓库)',
|
||||
// type: 'link',
|
||||
// icon: 'uil:edit',
|
||||
// size: 'small',
|
||||
// // auth: ['western-medicine', 'sys:role:detail'],
|
||||
// onClick: updateStatus.bind(null, row.id),
|
||||
// },
|
||||
// {
|
||||
// label: '上架/下架(商城)',
|
||||
// type: 'link',
|
||||
// icon: 'uil:edit',
|
||||
// size: 'small',
|
||||
// // auth: ['western-medicine', 'sys:role:detail'],
|
||||
// onClick: updateWarehouseDrugManagementShopUpdateStatus.bind(
|
||||
// null,
|
||||
// row.id,
|
||||
// ),
|
||||
// },
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'link',
|
||||
@@ -229,8 +276,7 @@ checkSubscribe();
|
||||
onClick: showModal.bind(null, row, true),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
]"
|
||||
:drop-down-actions="[]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -38,7 +38,7 @@ class RequestClient {
|
||||
'Content-Type': 'application/json;charset=utf-8',
|
||||
},
|
||||
// 默认超时时间
|
||||
timeout: 10_000,
|
||||
timeout: 100_000,
|
||||
};
|
||||
const { ...axiosConfig } = options;
|
||||
const requestConfig = merge(axiosConfig, defaultConfig);
|
||||
|
||||
Reference in New Issue
Block a user