Browse Source

采购换货记录生成代码

syhx
zhaoyiran 2 months ago
parent
commit
654fb630b1
  1. 27
      src/api/wms/purchaseBarterRecordDetail/index.ts
  2. 158
      src/views/wms/purchasereceiptManage/purchaseBarter/purchaseBarterRecord/index.vue
  3. 95
      src/views/wms/purchasereceiptManage/purchaseBarter/purchaseBarterRecord/purchaseBarterRecordMain.data.ts

27
src/api/wms/purchaseBarterRecordDetail/index.ts

@ -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) {
}

158
src/views/wms/purchasereceiptManage/purchaseBarter/purchaseBarterRecord/index.vue

@ -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>

95
src/views/wms/purchasereceiptManage/purchaseBarter/purchaseBarterRecord/purchaseBarterRecordMain.data.ts

@ -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…
Cancel
Save