zhaoyiran
2 months ago
3 changed files with 280 additions and 0 deletions
@ -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,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