ljlong_2630
1 month ago
12 changed files with 2244 additions and 4 deletions
@ -0,0 +1,77 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface CustomerStatementDetailVO { |
|||
id: number |
|||
number: string |
|||
masterId: number |
|||
invoiceType: string |
|||
releaseNumber: string |
|||
ingress: string |
|||
ingress2: string |
|||
itemCode: string |
|||
articleNumber: string |
|||
articleName: string |
|||
backNumber: string |
|||
checkTime: Date |
|||
uom: string |
|||
qty: number |
|||
price: number |
|||
amount: number |
|||
allocationPrice: number |
|||
tftmQuantity: number |
|||
intexQuantity: number |
|||
quantityVariance: number |
|||
tftmPrice: number |
|||
intexPrice: number |
|||
priceVariance: number |
|||
tftmAmount: number |
|||
intexAmount: number |
|||
amountVariance: number |
|||
dischargingTime: Date |
|||
acceptCheckTime: Date |
|||
remark: string |
|||
available: string |
|||
siteId: string |
|||
concurrencyStamp: string |
|||
} |
|||
|
|||
// 查询客户对账单子信息表(WMS)列表
|
|||
export const getCustomerStatementDetailPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/customer-statement-detail/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/customer-statement-detail/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询客户对账单子信息表(WMS)详情
|
|||
export const getCustomerStatementDetail = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-detail/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增客户对账单子信息表(WMS)
|
|||
export const createCustomerStatementDetail = async (data: CustomerStatementDetailVO) => { |
|||
return await request.post({ url: `/wms/customer-statement-detail/create`, data }) |
|||
} |
|||
|
|||
// 修改客户对账单子信息表(WMS)
|
|||
export const updateCustomerStatementDetail = async (data: CustomerStatementDetailVO) => { |
|||
return await request.put({ url: `/wms/customer-statement-detail/update`, data }) |
|||
} |
|||
|
|||
// 删除客户对账单子信息表(WMS)
|
|||
export const deleteCustomerStatementDetail = async (id: number) => { |
|||
return await request.delete({ url: `/wms/customer-statement-detail/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出客户对账单子信息表(WMS) Excel
|
|||
export const exportCustomerStatementDetail = async (params) => { |
|||
return await request.download({ url: `/wms/customer-statement-detail/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/wms/customer-statement-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,98 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface CustomerStatementMainVO { |
|||
id: number |
|||
number: string |
|||
customerCode: string |
|||
customerName: string |
|||
yearsMonth: Date |
|||
status: string |
|||
comparisonTime: Date |
|||
publishTime: Date |
|||
shareTime: Date |
|||
beInvoicedTime: Date |
|||
invoicedTime: Date |
|||
issuedInvoicedTime: Date |
|||
abrogateTime: Date |
|||
versionNumber: string |
|||
remark: string |
|||
available: string |
|||
siteId: string |
|||
concurrencyStamp: string |
|||
} |
|||
|
|||
// 查询客户对账单主信息表(WMS)列表
|
|||
export const getCustomerStatementMainPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/wms/customer-statement-main/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/wms/customer-statement-main/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询客户对账单主信息表(WMS)详情
|
|||
export const getCustomerStatementMain = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-main/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增客户对账单主信息表(WMS)
|
|||
export const createCustomerStatementMain = async (data: CustomerStatementMainVO) => { |
|||
return await request.post({ url: `/wms/customer-statement-main/create`, data }) |
|||
} |
|||
|
|||
// 修改客户对账单主信息表(WMS)
|
|||
export const updateCustomerStatementMain = async (data: CustomerStatementMainVO) => { |
|||
return await request.put({ url: `/wms/customer-statement-main/update`, data }) |
|||
} |
|||
|
|||
// 删除客户对账单主信息表(WMS)
|
|||
export const deleteCustomerStatementMain = async (id: number) => { |
|||
return await request.delete({ url: `/wms/customer-statement-main/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出客户对账单主信息表(WMS) Excel
|
|||
export const exportCustomerStatementMain = async (params) => { |
|||
return await request.download({ url: `/wms/customer-statement-main/export-excel`, 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 }) |
|||
} |
|||
|
|||
// 客户对账单重新比对
|
|||
export const recontrast = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-main/recontrast?id=` + id}) |
|||
} |
|||
|
|||
// 客户对账单确认比对结果
|
|||
export const confirmationContrast = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-main/confirmationContrast?id=` + id}) |
|||
} |
|||
|
|||
// 客户对账单废除数据
|
|||
export const nodeAbrogate = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-main/nodeAbrogate?id=` + id}) |
|||
} |
|||
|
|||
// 客户对账单退回操作
|
|||
export const sendBack = async (id: number) => { |
|||
return await request.get({ url: `/wms/customer-statement-main/sendBack?id=` + id}) |
|||
} |
|||
|
|||
// 导入客户模具分摊对账单前校验该客户对账单下是否存在已分摊的模具分摊对账单如果有提示
|
|||
export const verifyDataExistShare = async (customerId:number) => { |
|||
return await request.get({ url: `/wms/customer-tool-apport-statement-detail/verifyDataExist?customerId=` + customerId }) |
|||
} |
|||
|
|||
// 下载客户模具分摊对账单导入模板
|
|||
export const importShareTemplate = () => { |
|||
return request.download({ url: '/wms/customer-tool-apport-statement-detail/get-import-template' }) |
|||
} |
@ -0,0 +1,466 @@ |
|||
<!-- 导入客户对账单组件 --> |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="t('ts.导入')" width="600" :close-on-click-modal="false"> |
|||
<el-form |
|||
:inline="true" |
|||
:model="queryParams" |
|||
class="demo-form-inline" |
|||
style="margin-bottom: 10px" |
|||
label-width="100px" |
|||
> |
|||
<el-form-item label="客户代码" style="margin-right: 20px;"> |
|||
<el-select |
|||
v-model="queryParams.customerCode" |
|||
placeholder="请选择客户代码" |
|||
clearable |
|||
style="width: 100px" |
|||
> |
|||
<el-option v-for="(item) in customerList" :key="item.code" :label="item.name" :value="item.code" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="年月" style="margin-right: 20px;"> |
|||
<el-date-picker |
|||
v-model="queryParams.yearsMonthStr" |
|||
type="month" |
|||
placeholder="选择年月" |
|||
format="YYYY-MM" |
|||
value-format="YYYY-MM" |
|||
style="width: 100%"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-upload |
|||
ref="uploadRef" |
|||
v-model:file-list="fileList" |
|||
:action=" |
|||
importUrl + |
|||
'?yearsMonthStr=' + |
|||
queryParams.yearsMonthStr + |
|||
'&customerCode=' + |
|||
queryParams.customerCode + |
|||
'&file=' + |
|||
file + |
|||
'&updatePart=' + |
|||
updatePart + |
|||
'&outFile=' + |
|||
outFile + |
|||
'&extend=' + extend + |
|||
'&fromInventoryStatus=' + fromInventoryStatus + |
|||
'&toInventoryStatus=' + toInventoryStatus + |
|||
dataType |
|||
" |
|||
:auto-upload="false" |
|||
:disabled="formLoading" |
|||
:headers="uploadHeaders" |
|||
:limit="1" |
|||
:on-error="submitFormError" |
|||
:on-exceed="handleExceed" |
|||
:on-success="submitFormSuccess" |
|||
:accept="accept" |
|||
drag |
|||
style="width: 300px; margin: 0 auto" |
|||
v-loading="formLoading" |
|||
> |
|||
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" /> |
|||
<div class="el-upload__text">{{t('ts.将文件拖到此处,或')}}<em>{{t('ts.点击上传')}}</em></div> |
|||
<!-- <template #tip> |
|||
<div class="el-upload__tip ml--126px mr--80px"> |
|||
<div class="flex" v-if="announcements&&announcements.length>0"> |
|||
<div |
|||
class="label h-32px ml-22px mr-26px color-#acaeb3 font-size-14px w-100px text-right mt-2px" |
|||
style="line-height: 32px;" |
|||
>{{t('ts.注意事项')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="notice color-#acaeb3 font-size-14px text-red"> |
|||
<div class="mt-2" v-for="item in announcements">{{ item }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{t('ts.导入模式')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="radio"> |
|||
<el-radio-group v-model="mode"> |
|||
<el-radio :label="1" v-show="updateIsShow" :disabled="updateIsDisable">{{ t('ts.更新')}}</el-radio> |
|||
<el-radio :label="2" v-show="appendIsShow" :disabled="appendIsDisable">{{ t('ts.追加') }}</el-radio> |
|||
<el-radio :label="3" v-show="coverIsShow" :disabled="coverIsDisable">{{ t('ts.覆盖') }}</el-radio> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{t('ts.更新:新增并修改')}}</div> |
|||
<div class="mt-2">{{ t('ts.追加:只新增,不修改') }}</div> |
|||
<div class="mt-2">{{ t('ts.覆盖:只修改不新增') }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{ t('ts.部分保存') }}</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="updatePart" /> |
|||
</div> |
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{ t('ts.部分保存:如存在错误数据,正确数据正常导入') }}</div> |
|||
<div class="mt-2">{{ t('ts.全部保存:全部数据正确,才能导入') }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px" v-if="isShowOut"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>是否外部资源</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="outFile" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> --> |
|||
</el-upload> |
|||
<template #footer> |
|||
<div class="flex items-center"> |
|||
<div class="flex-1 text-left"> |
|||
<el-button type="primary" plain @click="importTemplate"> |
|||
<Icon icon="ep:download" /> |
|||
{{ t('ts.下载模板') }} |
|||
</el-button> |
|||
</div> |
|||
<el-button :disabled="formLoading" type="primary" @click="verifyData">{{ t('ts.确 定') }}</el-button> |
|||
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button> |
|||
</div> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
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() |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const formLoading = ref(false) // 表单的加载中 |
|||
const uploadRef = ref() |
|||
const uploadHeaders = ref() // 上传 Header 头 |
|||
const fileList = ref([]) // 文件列表 |
|||
const file = ref('') |
|||
|
|||
const props = defineProps({ |
|||
importTemplateData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
// 可以导入的文件类型 |
|||
accept: { |
|||
type: String, |
|||
required: false, |
|||
default: '.xlsx,.xls' |
|||
}, |
|||
// 是否更新已经存在的用户数据.默认值是1 |
|||
mode: { |
|||
type: Number, |
|||
required: false, |
|||
default: 1 |
|||
}, |
|||
// 更新是否禁用,默认值不禁用 |
|||
updateIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 更新是否展示 |
|||
updateIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 追加是否禁用,默认值不禁用 |
|||
appendIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 追加是否展示 |
|||
appendIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 覆盖是否禁用,默认值不禁用 |
|||
coverIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 覆盖是否展示 |
|||
coverIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 是否部门保存,默认是 |
|||
updatePart: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
url: { |
|||
type: String, |
|||
required: false |
|||
}, |
|||
// 显示是否外部资源 |
|||
isShowOut: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
outFile: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 扩展额外属性 |
|||
extend: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
toInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
announcements:{ |
|||
type: Array, |
|||
required: false, |
|||
default: [] |
|||
} |
|||
}) |
|||
const importTemplateData = ref(props.importTemplateData) |
|||
console.log(333,props.importTemplateData.dataType) |
|||
const dataType = ref('') |
|||
dataType.value = props.importTemplateData.dataType ?'&dataType=' + props.importTemplateData.dataType :'' |
|||
const accept = ref(props.accept) |
|||
const mode = ref(props.mode) //是否更新已经存在的用户数据.默认值是1 |
|||
const updateIsDisable = ref(props.updateIsDisable) //更新是否禁用,默认值不禁用 |
|||
const appendIsDisable = ref(props.appendIsDisable) //追加是否禁用,默认值不禁用 |
|||
const coverIsDisable = ref(props.coverIsDisable) //覆盖是否禁用,默认值不禁用 |
|||
const updatePart = ref(props.updatePart) //是否部门保存 |
|||
const outFile = ref(props.outFile) //是否引入外部资源 |
|||
|
|||
const importUrl = getBaseUrl() + import.meta.env.VITE_API_URL + props.url |
|||
|
|||
/** 打开弹窗 */ |
|||
const open = () => { |
|||
dialogVisible.value = true |
|||
resetForm() |
|||
getCustomerList();//获取客户列表 |
|||
} |
|||
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) { |
|||
message.error('请上传文件') |
|||
return |
|||
} |
|||
file.value = fileList.value[0].name |
|||
// 提交请求 |
|||
uploadHeaders.value = { |
|||
Authorization: 'Bearer ' + getAccessToken(), |
|||
'tenant-id': getTenantId() |
|||
} |
|||
formLoading.value = true |
|||
uploadRef.value!.submit() |
|||
} |
|||
|
|||
/** 文件上传成功 */ |
|||
const emits = defineEmits(['success']) |
|||
const submitFormSuccess = (response: any) => { |
|||
formLoading.value = true |
|||
console.log(response) |
|||
if (response) { |
|||
if (response.code == 500) { |
|||
uploadRef.value!.clearFiles() |
|||
message.error('导入失败') |
|||
formLoading.value = false |
|||
return |
|||
} else if (response.code == 0) { |
|||
if (response.data.errorCount > 0) { |
|||
message.confirm('文件中有部分数据导入失败,是否下载失败数据?').then(() => { |
|||
// download.excel(file, 'file_' + new Date().getTime()) |
|||
// 通过url下载文件 |
|||
// const downloadElement = document.createElement('a') |
|||
// console.log(172, getBaseUrl() + import.meta.env.VITE_API_URL + '/' + response.data.errorFile) |
|||
// console.log(172, getBaseUrl() + '/admin-api/opt/profile/' + response.data.errorFile) |
|||
window.open( |
|||
getBaseUrl() + '/admin-api' + response.data.errorFile, |
|||
'222' |
|||
) |
|||
// downloadElement.setAttribute('href', getBaseUrl() + import.meta.env.VITE_API_URL + response.data.errorFile ) |
|||
// 点击下载 |
|||
// downloadElement.click() |
|||
}) |
|||
} else { |
|||
message.success('导入成功') |
|||
} |
|||
}else if(response.data == null){ |
|||
message.error(response.msg) |
|||
} |
|||
} |
|||
|
|||
// if (response.code !== 0) { |
|||
// message.error(response.msg) |
|||
// formLoading.value = false |
|||
// return |
|||
// } |
|||
// // 拼接提示语 |
|||
// const data = response.data |
|||
// const create = response.data.importResult[0] |
|||
// const update = response.data.importResult[1] |
|||
// const failure = response.data.importResult[2] |
|||
// let text = '上传成功数量:' + data[create].length + ';' |
|||
// for (let name of data[create]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新成功数量:' + data[update].length + ';' |
|||
// for (const name of data[update]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新失败数量:' + Object.keys(data[failure]).length + ';' |
|||
// for (const name in data[failure]) { |
|||
// text += '< ' + name + ': ' + data[failure][name] + ' >' |
|||
// } |
|||
// message.alert(text) |
|||
|
|||
// 发送操作成功的事件 |
|||
|
|||
formLoading.value = false |
|||
emits('success') |
|||
dialogVisible.value = false |
|||
} |
|||
/** 上传错误提示 */ |
|||
const submitFormError = (): void => { |
|||
message.error('上传失败,请您重新上传!') |
|||
formLoading.value = false |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
// 重置上传状态和文件 |
|||
formLoading.value = false |
|||
uploadRef.value?.clearFiles() |
|||
fileList.value = [] |
|||
} |
|||
|
|||
/** 文件数超出提示 */ |
|||
const handleExceed = (): void => { |
|||
message.error('最多只能上传一个文件!') |
|||
} |
|||
|
|||
/** 下载模板操作 */ |
|||
const importTemplate = () => { |
|||
const res = importTemplateData.value.templateUrl |
|||
download.excel(res, importTemplateData.value.templateTitle) |
|||
} |
|||
const customerList = ref(); |
|||
const queryParams = reactive({ |
|||
customerCode: '', |
|||
yearsMonthStr: '', |
|||
}) |
|||
|
|||
const getCustomerList = async () => {//获取客户列表 |
|||
var param ={} |
|||
const list = await CustomerApi.getCustomerList(param); |
|||
customerList.value = list; |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.text-red{ |
|||
color: var(--el-color-danger); |
|||
} |
|||
.tips { |
|||
div { |
|||
position: relative; |
|||
padding-left: 22px; |
|||
|
|||
&::before { |
|||
width: 4px; |
|||
height: 4px; |
|||
border-radius: 50%; |
|||
content: ''; |
|||
background: #c2c2c2; |
|||
position: absolute; |
|||
top: 50%; |
|||
margin-top: -2px; |
|||
left: 4px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,427 @@ |
|||
<!-- 导入客户模具分摊对账单组件 --> |
|||
<template> |
|||
<Dialog v-model="dialogVisible" :title="t('ts.导入')" width="600" :close-on-click-modal="false"> |
|||
<el-upload |
|||
ref="uploadRef" |
|||
v-model:file-list="fileList" |
|||
:action=" |
|||
importUrl + |
|||
'?customerId=' + |
|||
props.importTemplateData.customerId + |
|||
'&file=' + |
|||
file + |
|||
'&updatePart=' + |
|||
updatePart + |
|||
'&outFile=' + |
|||
outFile + |
|||
'&extend=' + extend + |
|||
'&fromInventoryStatus=' + fromInventoryStatus + |
|||
'&toInventoryStatus=' + toInventoryStatus + |
|||
dataType |
|||
" |
|||
:auto-upload="false" |
|||
:disabled="formLoading" |
|||
:headers="uploadHeaders" |
|||
:limit="1" |
|||
:on-error="submitFormError" |
|||
:on-exceed="handleExceed" |
|||
:on-success="submitFormSuccess" |
|||
:accept="accept" |
|||
drag |
|||
style="width: 300px; margin: 0 auto" |
|||
v-loading="formLoading" |
|||
> |
|||
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" /> |
|||
<div class="el-upload__text">{{t('ts.将文件拖到此处,或')}}<em>{{t('ts.点击上传')}}</em></div> |
|||
<!-- <template #tip> |
|||
<div class="el-upload__tip ml--126px mr--80px"> |
|||
<div class="flex" v-if="announcements&&announcements.length>0"> |
|||
<div |
|||
class="label h-32px ml-22px mr-26px color-#acaeb3 font-size-14px w-100px text-right mt-2px" |
|||
style="line-height: 32px;" |
|||
>{{t('ts.注意事项')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="notice color-#acaeb3 font-size-14px text-red"> |
|||
<div class="mt-2" v-for="item in announcements">{{ item }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{t('ts.导入模式')}}</div |
|||
> |
|||
<div class=""> |
|||
<div class="radio"> |
|||
<el-radio-group v-model="mode"> |
|||
<el-radio :label="1" v-show="updateIsShow" :disabled="updateIsDisable">{{ t('ts.更新')}}</el-radio> |
|||
<el-radio :label="2" v-show="appendIsShow" :disabled="appendIsDisable">{{ t('ts.追加') }}</el-radio> |
|||
<el-radio :label="3" v-show="coverIsShow" :disabled="coverIsDisable">{{ t('ts.覆盖') }}</el-radio> |
|||
</el-radio-group> |
|||
</div> |
|||
|
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{t('ts.更新:新增并修改')}}</div> |
|||
<div class="mt-2">{{ t('ts.追加:只新增,不修改') }}</div> |
|||
<div class="mt-2">{{ t('ts.覆盖:只修改不新增') }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>{{ t('ts.部分保存') }}</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="updatePart" /> |
|||
</div> |
|||
<div class="tips color-#acaeb3 font-size-14px"> |
|||
<div class="mt-2">{{ t('ts.部分保存:如存在错误数据,正确数据正常导入') }}</div> |
|||
<div class="mt-2">{{ t('ts.全部保存:全部数据正确,才能导入') }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="flex mt-16px" v-if="isShowOut"> |
|||
<div |
|||
class="label h-32px mr-26px color-#acaeb3 font-size-14px w-100px text-right" |
|||
style="line-height: 32px" |
|||
>是否外部资源</div |
|||
> |
|||
<div class=""> |
|||
<div class="switch"> |
|||
<el-switch v-model="outFile" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> --> |
|||
</el-upload> |
|||
<template #footer> |
|||
<div class="flex items-center"> |
|||
<div class="flex-1 text-left"> |
|||
<el-button type="primary" plain @click="importTemplate"> |
|||
<Icon icon="ep:download" /> |
|||
{{ t('ts.下载模板') }} |
|||
</el-button> |
|||
</div> |
|||
<el-button :disabled="formLoading" type="primary" @click="verifyData">{{ t('ts.确 定') }}</el-button> |
|||
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button> |
|||
</div> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
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() |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const formLoading = ref(false) // 表单的加载中 |
|||
const uploadRef = ref() |
|||
const uploadHeaders = ref() // 上传 Header 头 |
|||
const fileList = ref([]) // 文件列表 |
|||
const file = ref('') |
|||
|
|||
const props = defineProps({ |
|||
importTemplateData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
// 可以导入的文件类型 |
|||
accept: { |
|||
type: String, |
|||
required: false, |
|||
default: '.xlsx,.xls' |
|||
}, |
|||
// 是否更新已经存在的用户数据.默认值是1 |
|||
mode: { |
|||
type: Number, |
|||
required: false, |
|||
default: 1 |
|||
}, |
|||
// 更新是否禁用,默认值不禁用 |
|||
updateIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 更新是否展示 |
|||
updateIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 追加是否禁用,默认值不禁用 |
|||
appendIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 追加是否展示 |
|||
appendIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 覆盖是否禁用,默认值不禁用 |
|||
coverIsDisable: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 覆盖是否展示 |
|||
coverIsShow: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 是否部门保存,默认是 |
|||
updatePart: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
url: { |
|||
type: String, |
|||
required: false |
|||
}, |
|||
// 显示是否外部资源 |
|||
isShowOut: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
outFile: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 扩展额外属性 |
|||
extend: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
fromInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 库存修改 扩展额外属性 TODO: 后续优化 业务限定属性应转为统一的额外扩展属性 此处不应该出现业务相关属性 cxm |
|||
toInventoryStatus: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
announcements:{ |
|||
type: Array, |
|||
required: false, |
|||
default: [] |
|||
} |
|||
}) |
|||
const importTemplateData = ref(props.importTemplateData) |
|||
console.log(333,props.importTemplateData.dataType) |
|||
const dataType = ref('') |
|||
dataType.value = props.importTemplateData.dataType ?'&dataType=' + props.importTemplateData.dataType :'' |
|||
const accept = ref(props.accept) |
|||
const mode = ref(props.mode) //是否更新已经存在的用户数据.默认值是1 |
|||
const updateIsDisable = ref(props.updateIsDisable) //更新是否禁用,默认值不禁用 |
|||
const appendIsDisable = ref(props.appendIsDisable) //追加是否禁用,默认值不禁用 |
|||
const coverIsDisable = ref(props.coverIsDisable) //覆盖是否禁用,默认值不禁用 |
|||
const updatePart = ref(props.updatePart) //是否部门保存 |
|||
const outFile = ref(props.outFile) //是否引入外部资源 |
|||
|
|||
const importUrl = getBaseUrl() + import.meta.env.VITE_API_URL + props.url |
|||
|
|||
/** 打开弹窗 */ |
|||
const open = () => { |
|||
dialogVisible.value = true |
|||
resetForm() |
|||
getCustomerList();//获取客户列表 |
|||
} |
|||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 校验数据 */ |
|||
const verifyData = async () => { |
|||
if (fileList.value.length == 0) { |
|||
message.error('请上传文件') |
|||
return |
|||
} |
|||
const data = await CustomerStatementMainApi.verifyDataExistShare(props.importTemplateData.customerId); |
|||
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) { |
|||
message.error('请上传文件') |
|||
return |
|||
} |
|||
file.value = fileList.value[0].name |
|||
// 提交请求 |
|||
uploadHeaders.value = { |
|||
Authorization: 'Bearer ' + getAccessToken(), |
|||
'tenant-id': getTenantId() |
|||
} |
|||
formLoading.value = true |
|||
uploadRef.value!.submit() |
|||
} |
|||
|
|||
/** 文件上传成功 */ |
|||
const emits = defineEmits(['success']) |
|||
const submitFormSuccess = (response: any) => { |
|||
formLoading.value = true |
|||
console.log(response) |
|||
if (response) { |
|||
if (response.code == 500) { |
|||
uploadRef.value!.clearFiles() |
|||
message.error('导入失败') |
|||
formLoading.value = false |
|||
return |
|||
} else if (response.code == 0) { |
|||
if (response.data.errorCount > 0) { |
|||
message.confirm('文件中有部分数据导入失败,是否下载失败数据?').then(() => { |
|||
// download.excel(file, 'file_' + new Date().getTime()) |
|||
// 通过url下载文件 |
|||
// const downloadElement = document.createElement('a') |
|||
// console.log(172, getBaseUrl() + import.meta.env.VITE_API_URL + '/' + response.data.errorFile) |
|||
// console.log(172, getBaseUrl() + '/admin-api/opt/profile/' + response.data.errorFile) |
|||
window.open( |
|||
getBaseUrl() + '/admin-api' + response.data.errorFile, |
|||
'222' |
|||
) |
|||
// downloadElement.setAttribute('href', getBaseUrl() + import.meta.env.VITE_API_URL + response.data.errorFile ) |
|||
// 点击下载 |
|||
// downloadElement.click() |
|||
}) |
|||
} else { |
|||
message.success('导入成功') |
|||
} |
|||
}else if(response.data == null){ |
|||
message.error(response.msg) |
|||
} |
|||
} |
|||
|
|||
// if (response.code !== 0) { |
|||
// message.error(response.msg) |
|||
// formLoading.value = false |
|||
// return |
|||
// } |
|||
// // 拼接提示语 |
|||
// const data = response.data |
|||
// const create = response.data.importResult[0] |
|||
// const update = response.data.importResult[1] |
|||
// const failure = response.data.importResult[2] |
|||
// let text = '上传成功数量:' + data[create].length + ';' |
|||
// for (let name of data[create]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新成功数量:' + data[update].length + ';' |
|||
// for (const name of data[update]) { |
|||
// text += '< ' + name + ' >' |
|||
// } |
|||
// text += '更新失败数量:' + Object.keys(data[failure]).length + ';' |
|||
// for (const name in data[failure]) { |
|||
// text += '< ' + name + ': ' + data[failure][name] + ' >' |
|||
// } |
|||
// message.alert(text) |
|||
|
|||
// 发送操作成功的事件 |
|||
|
|||
formLoading.value = false |
|||
emits('success') |
|||
dialogVisible.value = false |
|||
} |
|||
/** 上传错误提示 */ |
|||
const submitFormError = (): void => { |
|||
message.error('上传失败,请您重新上传!') |
|||
formLoading.value = false |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
// 重置上传状态和文件 |
|||
formLoading.value = false |
|||
uploadRef.value?.clearFiles() |
|||
fileList.value = [] |
|||
} |
|||
|
|||
/** 文件数超出提示 */ |
|||
const handleExceed = (): void => { |
|||
message.error('最多只能上传一个文件!') |
|||
} |
|||
|
|||
/** 下载模板操作 */ |
|||
const importTemplate = () => { |
|||
const res = importTemplateData.value.templateUrl |
|||
download.excel(res, importTemplateData.value.templateTitle) |
|||
} |
|||
const customerList = ref(); |
|||
const queryParams = reactive({ |
|||
customerCode: '', |
|||
yearsMonthStr: '', |
|||
}) |
|||
|
|||
const getCustomerList = async () => {//获取客户列表 |
|||
var param ={} |
|||
const list = await CustomerApi.getCustomerList(param); |
|||
customerList.value = list; |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.text-red{ |
|||
color: var(--el-color-danger); |
|||
} |
|||
.tips { |
|||
div { |
|||
position: relative; |
|||
padding-left: 22px; |
|||
|
|||
&::before { |
|||
width: 4px; |
|||
height: 4px; |
|||
border-radius: 50%; |
|||
content: ''; |
|||
background: #c2c2c2; |
|||
position: absolute; |
|||
top: 50%; |
|||
margin-top: -2px; |
|||
left: 4px; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,121 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const CustomerSaleInvoiceDetailRules = reactive({ |
|||
itemCode: [required], |
|||
articleNumber: [required], |
|||
qty: [required], |
|||
price: [required], |
|||
allocationPrice: [required], |
|||
sumPrice: [required], |
|||
afterTaxAmount: [required], |
|||
beforeTaxAmount: [required], |
|||
taxAmount: [required], |
|||
}) |
|||
|
|||
export const CustomerSaleInvoiceDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '主id', |
|||
field: 'masterId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '品番即物料代码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '品号即品番2', |
|||
field: 'articleNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '单价', |
|||
field: 'price', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '模具分摊单价', |
|||
field: 'allocationPrice', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '合计单价', |
|||
field: 'sumPrice', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '含税金额', |
|||
field: 'afterTaxAmount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '未税金额', |
|||
field: 'beforeTaxAmount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '税额', |
|||
field: 'taxAmount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用默认TRUE', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,275 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const CustomerStatementMainRules = reactive({ |
|||
customerCode: [required], |
|||
customerName: [required], |
|||
yearsMonth: [required], |
|||
}) |
|||
|
|||
export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
isDetail:false, |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '客户编号', |
|||
field: 'customerCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '客户名称', |
|||
field: 'customerName', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '年月', |
|||
field: 'yearsMonth', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM' |
|||
}, |
|||
table: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'YYYY-MM' |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'YYYY-MM' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.CUSTOMER_STATEMENT_TYPE, |
|||
dictClass: 'string', |
|||
isSearch: true, |
|||
form: { |
|||
//value: '',//可以添加默认值 有无都可
|
|||
component: 'Select', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '重新比对时间', |
|||
field: 'comparisonTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '发布时间', |
|||
field: 'publishTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '已分摊时间', |
|||
field: 'shareTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '待开票时间', |
|||
field: 'beInvoicedTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '开票中时间', |
|||
field: 'invoicedTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '已开票时间', |
|||
field: 'issuedInvoicedTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '已作废时间', |
|||
field: 'abrogateTime', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
formatter: dateFormatter, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '操作人', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '版本号', |
|||
field: 'versionNumber', |
|||
sort: 'custom', |
|||
}, |
|||
// {
|
|||
// label: '备注',
|
|||
// field: 'remark',
|
|||
// sort: 'custom',
|
|||
// },
|
|||
// {
|
|||
// label: '是否可用默认TRUE',
|
|||
// field: 'available',
|
|||
// sort: 'custom',
|
|||
// },
|
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
// {
|
|||
// label: '地点ID',
|
|||
// field: 'siteId',
|
|||
// sort: 'custom',
|
|||
// },
|
|||
// {
|
|||
// label: '并发乐观锁',
|
|||
// field: 'concurrencyStamp',
|
|||
// sort: 'custom',
|
|||
// },
|
|||
{ |
|||
label: '操作', |
|||
isDetail:false, |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 300, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
|||
|
|||
// 表单校验
|
|||
export const CustomerStatementDetailRules = reactive({ |
|||
releaseNumber: [required], |
|||
ingress: [required], |
|||
ingress2: [required], |
|||
itemCode: [required], |
|||
articleNumber: [required], |
|||
articleName: [required], |
|||
checkTime: [required], |
|||
uom: [required], |
|||
qty: [required], |
|||
price: [required], |
|||
amount: [required], |
|||
}) |
@ -0,0 +1,346 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="CustomerStatementMain.allSchemas.searchSchema" @search="setSearchParams" |
|||
@reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|||
:allSchemas="CustomerStatementMain.allSchemas" /> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|||
total: tableObject.total |
|||
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort"> |
|||
<template #number="{ row }"> |
|||
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|||
<span>{{ row.number }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row,$index }"> |
|||
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="CustomerStatementMainRules" |
|||
:formAllSchemas="CustomerStatementMain.allSchemas" :apiUpdate="CustomerStatementMainApi.updateCustomerStatementMain" |
|||
:apiCreate="CustomerStatementMainApi.createCustomerStatementMain" @searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" /> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="CustomerStatementMain.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<!-- <ImportForm ref="importFormRef" url="/wms/customer-statement-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> --> |
|||
<ImportCustomerStatementForm ref="importFormRef" url="/wms/customer-statement-main/import" |
|||
:importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { CustomerStatementMain, CustomerStatementMainRules } from './customerStatementMain.data' |
|||
import { CustomerStatementDetail, CustomerStatementDetailRules } from './customerStatementDetail.data' |
|||
import * as CustomerStatementMainApi from '@/api/wms/customerStatementMain' |
|||
import * as CustomerStatementDetailApi from '@/api/wms/customerStatementDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportCustomerStatementForm from '@/components/ImportForm/src/ImportCustomerStatementForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'CustomerStatementMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(CustomerStatementMain.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: CustomerStatementMainApi.getCustomerStatementMainPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
//defaultButtons.defaultAddBtn({hasPermi:'wms:customerStatementMain:create'}), // 新增 |
|||
//defaultButtons.defaultImportBtn({hasPermi:'wms:customerStatementMain:import'}), // 导入 |
|||
//defaultButtons.defaultExportBtn({hasPermi:'wms:customerStatementMain:export'}), // 导出 |
|||
defaultButtons.defaultImportBtn(null), // 导入 |
|||
defaultButtons.defaultExportBtn(null), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row, $index) => { |
|||
const findIndex = row['masterId'] ? tableObject.tableList.findIndex(item => item['masterId'] == row['masterId']) : -1 |
|||
if (findIndex > -1 && findIndex < $index) { |
|||
return [] |
|||
} |
|||
return [ |
|||
// defaultButtons.mainListEditBtn({hasPermi:'wms:customerStatementMain:update'}), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:customerStatementMain:delete'}), // 删除 |
|||
{ |
|||
label: t('重新比对'), |
|||
name: 'rematch', |
|||
hide: isShowMainButton(row, ['2']), |
|||
type: 'primary', |
|||
icon: '', |
|||
color: '', |
|||
hasPermi: '', |
|||
link: true // 文本展现按钮 |
|||
}, |
|||
{ |
|||
label: t('确认对比结果'), |
|||
name: 'confirmationContrast', |
|||
hide: isShowMainButton(row, ['2']), |
|||
type: 'primary', |
|||
icon: '', |
|||
color: '', |
|||
hasPermi: '', |
|||
link: true // 文本展现按钮 |
|||
}, |
|||
defaultButtons.mainSendBackBtn({ hide: isShowMainButton(row, ['3','4','5']) }), // 退回 |
|||
//defaultButtons.mainListCancelBtn({ hide: isShowMainButton(row, ['2','3','4','5']), hasPermi: 'wms:purchase-plan-main:update' }), // 作废 |
|||
defaultButtons.mainListCancelBtn({ hide: isShowMainButton(row, ['2','3','4','5'])}), // 作废 |
|||
{ |
|||
label: t('导入'), |
|||
name: 'import', |
|||
hide: isShowMainButton(row, ['3','4']), |
|||
type: 'warning', |
|||
color: '', |
|||
hasPermi: '', |
|||
link: true // 文本展现按钮 |
|||
}, |
|||
|
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'rematch') { //重新比对 |
|||
tapRematch(row.id); |
|||
} else if (val == 'confirmationContrast') { // 确认对比结果 |
|||
tapConfirmationContrast(row.id) |
|||
}else if (val == 'sendBack') { // 退回 |
|||
tapSendBack(row.id) |
|||
}else if (val == 'cancel') { // 作废 |
|||
tapCancel(row.id) |
|||
}else if (val == 'import') { // 导入 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType, data) => { |
|||
var isHave = CustomerStatementMain.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if (isHave) { |
|||
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if (data.activeTime == 0) data.activeTime = null; |
|||
if (data.expireTime == 0) data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await CustomerStatementMainApi.createCustomerStatementMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await CustomerStatementMainApi.updateCustomerStatementMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicCustomerStatementMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await CustomerStatementMainApi.deleteCustomerStatementMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch { } |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await CustomerStatementMainApi.exportCustomerStatementMain(tableObject.params) |
|||
download.excel(data, '客户对账单主信息表(WMS).xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '客户对账单导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await CustomerStatementMainApi.importTemplate() |
|||
}) |
|||
//点击重新比对方法 |
|||
const tapRematch = async (id:number) => { |
|||
try { |
|||
// 确认 |
|||
await message.confirm('是否重新比对') |
|||
await CustomerStatementMainApi.recontrast(id); |
|||
// 发起导出 |
|||
//exportLoading.value = true |
|||
} catch { |
|||
|
|||
} finally { |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
} |
|||
|
|||
//点击确认对比方法 |
|||
const tapConfirmationContrast = async (id:number) => { |
|||
try { |
|||
await message.confirm('是否确认对比结果') |
|||
await CustomerStatementMainApi.confirmationContrast(id); |
|||
// 发起导出 |
|||
//exportLoading.value = true |
|||
} catch { |
|||
|
|||
} finally { |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
} |
|||
|
|||
//点击退回方法 |
|||
const tapSendBack = async (id:number) => { |
|||
try { |
|||
await message.confirm('是否退回') |
|||
await CustomerStatementMainApi.sendBack(id); |
|||
// 发起导出 |
|||
//exportLoading.value = true |
|||
} catch { |
|||
|
|||
} finally { |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
} |
|||
|
|||
//点击作废方法 |
|||
const tapCancel = async (id:number) => { |
|||
try { |
|||
await message.confirm('是否作废') |
|||
await CustomerStatementMainApi.nodeAbrogate(id); |
|||
// 发起导出 |
|||
//exportLoading.value = true |
|||
} catch { |
|||
|
|||
} finally { |
|||
// 刷新列表 |
|||
await getList() |
|||
} |
|||
} |
|||
|
|||
// 根据状态返回该按钮是否显示 |
|||
const isShowMainButton = (row, val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,173 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const CustomerToolApportStatementDetailRules = reactive({ |
|||
invoiceNumber: [required], |
|||
articleNumber: [required], |
|||
vehicleType: [required], |
|||
amount: [required], |
|||
qty: [required], |
|||
allocationPrice: [required], |
|||
adjustmentAmount: [required], |
|||
}) |
|||
|
|||
export const CustomerToolApportStatementDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '客户对账单单据号', |
|||
field: 'customerStatementNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '年月预留字段', |
|||
field: 'yearsMonth', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '客户对账单主id', |
|||
field: 'masterId', |
|||
sort: 'custom', |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '账票号', |
|||
field: 'invoiceNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '品号', |
|||
field: 'articleNumber', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '车型', |
|||
field: 'vehicleType', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '金额', |
|||
field: 'amount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '模具分摊单价', |
|||
field: 'allocationPrice', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '调整金额', |
|||
field: 'adjustmentAmount', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '确认分摊时间', |
|||
field: 'verifyTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '已作废时间', |
|||
field: 'abrogateTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '0:新增1:已作废', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '版本号', |
|||
field: 'versionNumber', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '是否可用默认TRUE', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '并发乐观锁', |
|||
field: 'concurrencyStamp', |
|||
sort: 'custom', |
|||
isTable: false, |
|||
isSearch: true, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="CustomerToolApportStatementDetail.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="CustomerToolApportStatementDetail.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #code="{row}"> |
|||
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|||
<span>{{ row.code }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="CustomerToolApportStatementDetailRules" |
|||
:formAllSchemas="CustomerToolApportStatementDetail.allSchemas" |
|||
:apiUpdate="CustomerToolApportStatementDetailApi.updateCustomerToolApportStatementDetail" |
|||
:apiCreate="CustomerToolApportStatementDetailApi.createCustomerToolApportStatementDetail" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="CustomerToolApportStatementDetail.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/customer-tool-apport-statement-detail/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { CustomerToolApportStatementDetail,CustomerToolApportStatementDetailRules } from './customerToolApportStatementDetail.data' |
|||
import * as CustomerToolApportStatementDetailApi from '@/api/wms/customerToolApportStatementDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|||
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|||
import Detail from '@/components/Detail/src/Detail.vue' |
|||
|
|||
defineOptions({ name: 'CustomerToolApportStatementDetail' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(CustomerToolApportStatementDetail.allSchemas.tableColumns) |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: CustomerToolApportStatementDetailApi.getCustomerToolApportStatementDetailPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:customerToolApportStatementDetail:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:customerToolApportStatementDetail:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:customerToolApportStatementDetail:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = [ |
|||
defaultButtons.mainListEditBtn({hasPermi:'wms:customerToolApportStatementDetail:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:customerToolApportStatementDetail:delete'}), // 删除 |
|||
] |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =CustomerToolApportStatementDetail.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await CustomerToolApportStatementDetailApi.createCustomerToolApportStatementDetail(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await CustomerToolApportStatementDetailApi.updateCustomerToolApportStatementDetail(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicCustomerToolApportStatementDetail') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await CustomerToolApportStatementDetailApi.deleteCustomerToolApportStatementDetail(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await CustomerToolApportStatementDetailApi.exportCustomerToolApportStatementDetail(tableObject.params) |
|||
download.excel(data, '客户模具分摊对账单明细表(WMS).xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '客户模具分摊对账单明细表(WMS)导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await CustomerToolApportStatementDetailApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
Loading…
Reference in new issue