Browse Source

YT-170:添加客户对账单导入模版提示

syhx
songguoqiang 2 months ago
parent
commit
cf021a982b
  1. 5
      src/api/wms/customerStatementMain/index.ts
  2. 46
      src/components/ImportForm/src/ImportCustomerStatementForm.vue
  3. 1
      src/utils/dict.ts
  4. 5
      src/views/wms/deliversettlementManage/customerStatement/customerStatement/customerStatementMain.data.ts
  5. 2
      src/views/wms/deliversettlementManage/customerStatement/customerStatement/index.vue

5
src/api/wms/customerStatementMain/index.ts

@ -61,3 +61,8 @@ 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 })
}

46
src/components/ImportForm/src/ImportCustomerStatementForm.vue

@ -64,7 +64,7 @@
>
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" />
<div class="el-upload__text">{{t('ts.将文件拖到此处,或')}}<em>{{t('ts.点击上传')}}</em></div>
<template #tip>
<!-- <template #tip>
<div class="el-upload__tip ml--126px mr--80px">
<div class="flex" v-if="announcements&&announcements.length>0">
<div
@ -129,7 +129,7 @@
</div>
</div>
</div>
</template>
</template> -->
</el-upload>
<template #footer>
<div class="flex items-center">
@ -139,7 +139,7 @@
{{ t('ts.下载模板') }}
</el-button>
</div>
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('ts.确 ') }}</el-button>
<el-button :disabled="formLoading" type="primary" @click="verifyData">{{ t('ts.确 ') }}</el-button>
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button>
</div>
</template>
@ -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;
}
</script>
<style scoped lang="scss">

1
src/utils/dict.ts

@ -406,4 +406,5 @@ export enum DICT_TYPE {
SCRAPPING_REASON = 'scrapping_reason', //制品子件报废原因
RECEIVE_STATUS = 'receive_status', // 收货确认状态
LINE_SCRAP_REASON = 'Reason_or_scrapping_of_production_line', // 线边报废原因(现场史力维护的字典)
CUSTOMER_STATEMENT_TYPE = 'customer_statement_type', // wms客户对账单 模具分摊状态
}

5
src/views/wms/deliversettlementManage/customerStatement/customerStatement/customerStatementMain.data.ts

@ -60,9 +60,12 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.CUSTOMER_STATEMENT_TYPE,
dictClass: 'string',
isSearch: true,
form: {
component: 'Select'
//value: '',//可以添加默认值 有无都可
component: 'Select',
},
},
{

2
src/views/wms/deliversettlementManage/customerStatement/customerStatement/index.vue

@ -105,8 +105,6 @@ const HeadButttondata = [
//defaultButtons.defaultAddBtn({hasPermi:'wms:customerStatementMain:create'}), //
//defaultButtons.defaultImportBtn({hasPermi:'wms:customerStatementMain:import'}), //
//defaultButtons.defaultExportBtn({hasPermi:'wms:customerStatementMain:export'}), //
defaultButtons.defaultAddBtn(null), //
defaultButtons.defaultImportBtn(null), //
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //

Loading…
Cancel
Save