diff --git a/src/api/wms/customerStatementMain/index.ts b/src/api/wms/customerStatementMain/index.ts
index df91e823d..e37a5b356 100644
--- a/src/api/wms/customerStatementMain/index.ts
+++ b/src/api/wms/customerStatementMain/index.ts
@@ -60,4 +60,9 @@ export const exportCustomerStatementMain = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/customer-statement-main/get-import-template' })
+}
+
+// 导入客户对账单前校验是否有相同客户代码和年月的数据存在
+export const verifyDataExist = async (yearsMonthStr: String,customerCode:String) => {
+ return await request.get({ url: `/wms/customer-statement-main/verifyDataExist?yearsMonthStr=` + yearsMonthStr+'&customerCode='+customerCode })
}
\ No newline at end of file
diff --git a/src/components/ImportForm/src/ImportCustomerStatementForm.vue b/src/components/ImportForm/src/ImportCustomerStatementForm.vue
index ad5816da4..817b28da3 100644
--- a/src/components/ImportForm/src/ImportCustomerStatementForm.vue
+++ b/src/components/ImportForm/src/ImportCustomerStatementForm.vue
@@ -64,7 +64,7 @@
>
{{t('ts.将文件拖到此处,或')}}{{t('ts.点击上传')}}
-
+
@@ -139,7 +139,7 @@
{{ t('ts.下载模板') }}
- {{ t('ts.确 定') }}
+ {{ t('ts.确 定') }}
{{ t('ts.取 消') }}
@@ -150,6 +150,7 @@ import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download'
import { getBaseUrl } from '@/utils/systemParam'
import * as CustomerApi from '@/api/wms/customer'
+import * as CustomerStatementMainApi from '@/api/wms/customerStatementMain'
defineOptions({ name: 'ImportForm' })
const { t } = useI18n()
@@ -283,6 +284,44 @@ const open = () => {
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
+/** 校验数据 */
+const verifyData = async () => {
+ if (queryParams.yearsMonthStr==''||queryParams.yearsMonthStr==null) {
+ message.error('请选择年月')
+ return
+ }
+ if (queryParams.customerCode==''||queryParams.customerCode==null) {
+ message.error('请选择客户代码')
+ return
+ }
+ if (fileList.value.length == 0) {
+ message.error('请上传文件')
+ return
+ }
+ const data = await CustomerStatementMainApi.verifyDataExist(queryParams.yearsMonthStr,queryParams.customerCode);
+ console.log('data',data)
+ if(data.status==0){
+ submitForm();
+ }else if(data.status==2){
+ try {
+ // 确认
+ await message.confirm('已存在相同客户编号及年月的对账单,是否确认导入?注意:如确认则上一版本对账单将自动作废。')
+ //确定走的
+ submitForm();
+ // await PurchasepriceApi.deletePurchaseprice(id)
+ // tableObject.loading = false
+ // message.success(t('common.delSuccess'))
+ // // 刷新列表
+ // buttonBaseClick('refresh',null)
+ } catch {
+ //取消走的
+ alert(123);
+ }
+ }else if(data.status==3){
+ await message.alertWarning('已存在相同客户编号及年月的对账单,且已提交,无法导入。')
+ }
+}
+
/** 提交表单 */
const submitForm = async () => {
if (fileList.value.length == 0) {
@@ -399,6 +438,7 @@ const getCustomerList = async () => {//获取客户列表
const list = await CustomerApi.getCustomerList(param);
customerList.value = list;
}
+