songguoqiang
2 months ago
11 changed files with 956 additions and 21 deletions
@ -0,0 +1,59 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface CustomerSaleInvoiceDetailVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
masterId: number |
||||
|
itemCode: string |
||||
|
articleNumber: string |
||||
|
qty: number |
||||
|
price: number |
||||
|
allocationPrice: number |
||||
|
sumPrice: number |
||||
|
afterTaxAmount: number |
||||
|
beforeTaxAmount: number |
||||
|
taxAmount: number |
||||
|
remark: string |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询客户销售开票子信息表(WMS)列表
|
||||
|
export const getCustomerSaleInvoiceDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/customer-sale-invoice-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/customer-sale-invoice-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询客户销售开票子信息表(WMS)详情
|
||||
|
export const getCustomerSaleInvoiceDetail = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/customer-sale-invoice-detail/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增客户销售开票子信息表(WMS)
|
||||
|
export const createCustomerSaleInvoiceDetail = async (data: CustomerSaleInvoiceDetailVO) => { |
||||
|
return await request.post({ url: `/wms/customer-sale-invoice-detail/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改客户销售开票子信息表(WMS)
|
||||
|
export const updateCustomerSaleInvoiceDetail = async (data: CustomerSaleInvoiceDetailVO) => { |
||||
|
return await request.put({ url: `/wms/customer-sale-invoice-detail/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除客户销售开票子信息表(WMS)
|
||||
|
export const deleteCustomerSaleInvoiceDetail = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/customer-sale-invoice-detail/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出客户销售开票子信息表(WMS) Excel
|
||||
|
export const exportCustomerSaleInvoiceDetail = async (params) => { |
||||
|
return await request.download({ url: `/wms/customer-sale-invoice-detail/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/customer-sale-invoice-detail/get-import-template' }) |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface CustomerSaleInvoiceMainVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
customerStatementNumber: string |
||||
|
beforeTaxAmount: number |
||||
|
taxRate: number |
||||
|
taxAmount: number |
||||
|
adTaxAmount: number |
||||
|
goldenTaxInvoiceNumber: string |
||||
|
invoiceTime: Date |
||||
|
status: string |
||||
|
publishTime: Date |
||||
|
abrogateTime: Date |
||||
|
remark: string |
||||
|
available: string |
||||
|
} |
||||
|
|
||||
|
// 查询客户销售开票主信息表(WMS)列表
|
||||
|
export const getCustomerSaleInvoiceMainPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/customer-sale-invoice-main/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/customer-sale-invoice-main/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询客户销售开票主信息表(WMS)详情
|
||||
|
export const getCustomerSaleInvoiceMain = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/customer-sale-invoice-main/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增客户销售开票主信息表(WMS)
|
||||
|
export const createCustomerSaleInvoiceMain = async (data: CustomerSaleInvoiceMainVO) => { |
||||
|
return await request.post({ url: `/wms/customer-sale-invoice-main/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改客户销售开票主信息表(WMS)
|
||||
|
export const updateCustomerSaleInvoiceMain = async (data: CustomerSaleInvoiceMainVO) => { |
||||
|
return await request.put({ url: `/wms/customer-sale-invoice-main/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除客户销售开票主信息表(WMS)
|
||||
|
export const deleteCustomerSaleInvoiceMain = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/customer-sale-invoice-main/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出客户销售开票主信息表(WMS) Excel
|
||||
|
export const exportCustomerSaleInvoiceMain = async (params) => { |
||||
|
return await request.download({ url: `/wms/customer-sale-invoice-main/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/customer-sale-invoice-main/get-import-template' }) |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface PurchaseBarterRecordDetailVO { |
||||
|
masterId: number |
||||
|
itemCode: string |
||||
|
itemName: string |
||||
|
uom: string |
||||
|
batch: string |
||||
|
packUnit: string |
||||
|
qty: number |
||||
|
reason: string |
||||
|
} |
||||
|
|
||||
|
// 查询采购换货申请明细列表
|
||||
|
export const getPurchaseBarterRecordDetailPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/purchase-barter-record-detail/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/purchase-barter-record-detail/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export async function exportPurchaseBarterRecord(params: any) { |
||||
|
|
||||
|
} |
@ -0,0 +1,124 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const CustomerSaleInvoiceMainRules = reactive({ |
||||
|
beforeTaxAmount: [required], |
||||
|
taxRate: [required], |
||||
|
taxAmount: [required], |
||||
|
adTaxAmount: [required], |
||||
|
}) |
||||
|
|
||||
|
export const CustomerSaleInvoiceMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '单据号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
} ,{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
// 0:新增1:已发布2已作废
|
||||
|
}, |
||||
|
{ |
||||
|
label: '客户对账单单据号', |
||||
|
field: 'customerStatementNumber', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '客户代码', |
||||
|
field: 'customer', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '客户名称', |
||||
|
field: 'customerName', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '未税金额', |
||||
|
field: 'beforeTaxAmount', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '税率', |
||||
|
field: 'taxRate', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '税额', |
||||
|
field: 'taxAmount', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '价税合计金额', |
||||
|
field: 'adTaxAmount', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '金税票号', |
||||
|
field: 'goldenTaxInvoiceNumber', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '开票日期', |
||||
|
field: 'invoiceTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
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')] |
||||
|
} |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
valueFormat: 'x' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用默认TRUE', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
isTable:false |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
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,245 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="CustomerSaleInvoiceMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="CustomerSaleInvoiceMain.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="CustomerSaleInvoiceMainRules" |
||||
|
:formAllSchemas="CustomerSaleInvoiceMain.allSchemas" |
||||
|
:apiUpdate="CustomerSaleInvoiceMainApi.updateCustomerSaleInvoiceMain" |
||||
|
:apiCreate="CustomerSaleInvoiceMainApi.createCustomerSaleInvoiceMain" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="CustomerSaleInvoiceMain.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/customer-sale-invoice-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { CustomerSaleInvoiceMain,CustomerSaleInvoiceMainRules } from './customerSaleInvoiceMain.data' |
||||
|
import * as CustomerSaleInvoiceMainApi from '@/api/wms/customerSaleInvoiceMain' |
||||
|
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: 'CustomerSaleInvoiceMain' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(CustomerSaleInvoiceMain.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: CustomerSaleInvoiceMainApi.getCustomerSaleInvoiceMainPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'wms:customerSaleInvoiceMain:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'wms:customerSaleInvoiceMain:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'wms:customerSaleInvoiceMain: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:customerSaleInvoiceMain:update'}), // 编辑 |
||||
|
defaultButtons.mainListOrderPubBtn({hasPermi:'wms:customerSaleInvoiceMain:publish'}), // 发布 |
||||
|
defaultButtons.mainListOrderPubBtn({hasPermi:'wms:mainListCancelBtn:cancle'}), // 作废 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
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 =CustomerSaleInvoiceMain.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 CustomerSaleInvoiceMainApi.createCustomerSaleInvoiceMain(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await CustomerSaleInvoiceMainApi.updateCustomerSaleInvoiceMain(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, 'basicCustomerSaleInvoiceMain') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await CustomerSaleInvoiceMainApi.deleteCustomerSaleInvoiceMain(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 CustomerSaleInvoiceMainApi.exportCustomerSaleInvoiceMain(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 CustomerSaleInvoiceMainApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,158 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="[...PurchaseBarterRecordMain.allSchemas.searchSchema,...PurchaseBarterRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="PurchaseBarterRecordMain.allSchemas" |
||||
|
:detailAllSchemas="PurchaseBarterRecordDetail.allSchemas" |
||||
|
/> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<Table v-clientTable |
||||
|
: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" |
||||
|
> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="formRef" |
||||
|
:isOpenSearchTable="true" |
||||
|
fieldTableColumn="itemCode" |
||||
|
@success="getList" |
||||
|
:formAllSchemas="PurchaseBarterRecordMain.allSchemas" |
||||
|
:tableAllSchemas="PurchaseBarterRecordDetail.allSchemas" |
||||
|
:isBusiness="true" |
||||
|
> |
||||
|
</BasicForm> |
||||
|
|
||||
|
<Detail |
||||
|
ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:allSchemas="PurchaseBarterRecordMain.allSchemas" |
||||
|
:detailAllSchemas="PurchaseBarterRecordDetail.allSchemas" |
||||
|
:apiPage="PurchaseBarterRecordDetailApi.getPurchaseBarterRecordDetailPage" |
||||
|
:Echo="Echo" |
||||
|
/> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
|
||||
|
import download from '@/utils/download' |
||||
|
|
||||
|
import { |
||||
|
PurchaseBarterRecordMain, |
||||
|
PurchaseBarterRecordDetail |
||||
|
} from './purchaseBarterRecordMain.data' |
||||
|
import * as PurchaseBarterRecordDetailApi from '@/api/wms/purchaseBarterRecordDetail' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
|
||||
|
import { formatDate } from '@/utils/formatTime' |
||||
|
import { usePageLoading } from '@/hooks/web/usePageLoading' |
||||
|
|
||||
|
const { loadStart, loadDone } = usePageLoading() |
||||
|
// 采购换货申请 |
||||
|
defineOptions({ name: 'PurchaseBarterRecordMain' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref([...PurchaseBarterRecordMain.allSchemas.tableColumns,...PurchaseBarterRecordDetail.allSchemas.tableMainColumns]) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const Echo = [] |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: PurchaseBarterRecordDetailApi.getPurchaseBarterRecordDetailPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultExportBtn(null), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
const formRef = ref() |
||||
|
const detailRef = ref() |
||||
|
|
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
loadStart() |
||||
|
const excelTitle = ref(route.meta.title) |
||||
|
tableObject.params.detailDataType = 1 |
||||
|
const data = await PurchaseBarterRecordDetailApi.exportPurchaseBarterRecord(tableObject.params) |
||||
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
||||
|
} catch { |
||||
|
} finally { |
||||
|
loadDone() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
}) |
||||
|
</script> |
@ -0,0 +1,95 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
|
||||
|
export const PurchaseBarterRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '记录单号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 180, |
||||
|
fixed: 'left' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '申请单号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 180, |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
dictType: DICT_TYPE.REQUEST_STATUS, |
||||
|
dictClass: 'string', |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商代码', |
||||
|
field: 'supplierCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '供应商名称', |
||||
|
field: 'supplierName', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const PurchaseBarterRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '物料代码', |
||||
|
field: 'itemCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '物料名称', |
||||
|
field: 'itemName', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '批次', |
||||
|
field: 'batch', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '包装规格', |
||||
|
field: 'packUnit', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '换货数量', |
||||
|
field: 'qty', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '换货原因 ', |
||||
|
field: 'reason', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
])) |
||||
|
|
Loading…
Reference in new issue