From ef925bbffb60733c1804878afc489339e5226bbd Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Wed, 19 Feb 2025 14:40:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E7=BB=93=E7=AE=97=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/onlinesettlementInfoDetail/index.ts | 54 ++++ src/api/wms/settlementReport/index.ts | 80 +++++ .../SearchTable/src/SearchTable.vue | 18 +- .../onlinesettlementInfoDetail/index.vue | 244 +++++++++++++++ .../onlinesettlementInfoDetail.data.ts | 117 ++++++++ .../settlementReport/index.vue | 279 ++++++++++++++++++ .../settlementReport/settlementReport.data.ts | 186 ++++++++++++ 7 files changed, 974 insertions(+), 4 deletions(-) create mode 100644 src/api/wms/onlinesettlementInfoDetail/index.ts create mode 100644 src/api/wms/settlementReport/index.ts create mode 100644 src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/index.vue create mode 100644 src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/onlinesettlementInfoDetail.data.ts create mode 100644 src/views/wms/issueManage/onlinesettlement/settlementReport/index.vue create mode 100644 src/views/wms/issueManage/onlinesettlement/settlementReport/settlementReport.data.ts diff --git a/src/api/wms/onlinesettlementInfoDetail/index.ts b/src/api/wms/onlinesettlementInfoDetail/index.ts new file mode 100644 index 000000000..d1c8e6ba7 --- /dev/null +++ b/src/api/wms/onlinesettlementInfoDetail/index.ts @@ -0,0 +1,54 @@ +import request from '@/config/axios' + +export interface OnlinesettlementInfoDetailVO { + id: number + number: string + masterId: number + settlementQty: number + settlementRecordNumber: string + settlementBusinessType: string + settlementDatetime: Date + concurrencyStamp: number + remark: string +} + +// 查询上线结算记录信息新子表列表 +export const getOnlinesettlementInfoDetailPage = async (params) => { + if (params.isSearch) { + delete params.isSearch + const data = {...params} + return await request.post({ url: '/wms/onlinesettlement-info-detail/senior', data }) + } else { + return await request.get({ url: `/wms/onlinesettlement-info-detail/page`, params }) + } +} + +// 查询上线结算记录信息新子表详情 +export const getOnlinesettlementInfoDetail = async (id: number) => { + return await request.get({ url: `/wms/onlinesettlement-info-detail/get?id=` + id }) +} + +// 新增上线结算记录信息新子表 +export const createOnlinesettlementInfoDetail = async (data: OnlinesettlementInfoDetailVO) => { + return await request.post({ url: `/wms/onlinesettlement-info-detail/create`, data }) +} + +// 修改上线结算记录信息新子表 +export const updateOnlinesettlementInfoDetail = async (data: OnlinesettlementInfoDetailVO) => { + return await request.put({ url: `/wms/onlinesettlement-info-detail/update`, data }) +} + +// 删除上线结算记录信息新子表 +export const deleteOnlinesettlementInfoDetail = async (id: number) => { + return await request.delete({ url: `/wms/onlinesettlement-info-detail/delete?id=` + id }) +} + +// 导出上线结算记录信息新子表 Excel +export const exportOnlinesettlementInfoDetail = async (params) => { + return await request.download({ url: `/wms/onlinesettlement-info-detail/export-excel`, params }) +} + +// 下载用户导入模板 +export const importTemplate = () => { + return request.download({ url: '/wms/onlinesettlement-info-detail/get-import-template' }) +} \ No newline at end of file diff --git a/src/api/wms/settlementReport/index.ts b/src/api/wms/settlementReport/index.ts new file mode 100644 index 000000000..814df0978 --- /dev/null +++ b/src/api/wms/settlementReport/index.ts @@ -0,0 +1,80 @@ +import request from '@/config/axios' + +export interface SettlementConfigurationVO { + id: number + supplierCode: string + itemCode: string + fromWarehouseCode: string + toWarehouseCode: string + remark: string + concurrencyStamp: number +} + +// 查询上线结算配置列表 +export const getSettlementReportPage = async (params) => { + // if (params.isSearch) { + // delete params.isSearch + // const data = {...params} + // return await request.post({ url: '/wms/onlinesettlement-info/settlementInfoReport/senior', data }) + // } else { + return await request.get({ url: `/wms/onlinesettlement-info/settlementInfoReport`, params }) + // } +} + + +// 查询上线结算配置列表 +export const getSettlementReportBalance = async (params) => { + // if (params.isSearch) { + // delete params.isSearch + // const data = {...params} + // return await request.post({ url: '/wms/onlinesettlement-info/settlementInfoReport/senior', data }) + // } else { + return await request.get({ url: `/wms/onlinesettlement-info/settlementInfoReportBalance`, params }) + // } +} + + +// 批量结算 +export const submitSettlementReport = async (data) => { + // if (params.isSearch) { + // delete params.isSearch + // const data = {...params} + // return await request.post({ url: '/wms/onlinesettlement-info/settlementInfoReport/senior', data }) + // } else { + return await request.post({ url: `/wms/onlinesettlement-info/settlementInfoSubmit`, data }) + // } +} + +// // 查询上线结算配置详情 +// export const getSettlementConfiguration = async (id: number) => { +// return await request.get({ url: `/wms/settlement-configuration/get?id=` + id }) +// } + +// export const editSettlementConfiguration = async (id: number) => { +// return await request.get({ url: `/wms/settlement-configuration/editView?id=` + id }) +// } + +// // 新增上线结算配置 +// export const createSettlementConfiguration = async (data: SettlementConfigurationVO) => { +// return await request.post({ url: `/wms/settlement-configuration/create`, data }) +// } + +// // 修改上线结算配置 +// export const updateSettlementConfiguration = async (data: SettlementConfigurationVO) => { +// return await request.put({ url: `/wms/settlement-configuration/update`, data }) +// } + +// // 删除上线结算配置 +// export const deleteSettlementConfiguration = async (id: number) => { +// return await request.delete({ url: `/wms/settlement-configuration/delete?id=` + id }) +// } + +// // 导出上线结算配置 Excel +// export const exportSettlementConfiguration = async (params) => { +// return await request.download({ url: `/wms/settlement-configuration/export-excel`, params }) +// } + +// // 下载用户导入模板 +// export const importTemplate = () => { +// return request.download({ url: '/wms/settlement-configuration/get-import-template' }) +// } \ No newline at end of file diff --git a/src/components/SearchTable/src/SearchTable.vue b/src/components/SearchTable/src/SearchTable.vue index 0483631d5..361244e15 100644 --- a/src/components/SearchTable/src/SearchTable.vue +++ b/src/components/SearchTable/src/SearchTable.vue @@ -37,10 +37,11 @@ /> </ContentWrap> <template #footer> - <div class="flex items-center"> + <slot name="footerActions"></slot> + <div class="flex items-center" v-if="!hiddenFooterActions"> <slot :name="'selectionsActions'+formFieldRef" :selections="searchTableRef?searchTableRef.selections:[]"></slot> <el-button @click="submitForm" type="primary" :disabled="formLoading">{{ t(`ts.${'确 定'}`) }}</el-button> - <el-button @click="searchDialogVisible = false">{{ t(`ts.${'取 消'}`) }}</el-button> + <el-button @click="cancleClick">{{ t(`ts.${'取 消'}`) }}</el-button> <slot name="actions"></slot> </div> @@ -64,7 +65,12 @@ const props = defineProps({ isCheckStrictly:{ type:Boolean, default:false - } + }, + // 隐藏底部操作 + hiddenFooterActions:{ + type:Boolean, + default:false + }, }) const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 @@ -248,7 +254,6 @@ const buttonBaseClick = (val, item) => { } -defineExpose({ open,openData,updateData,hiddenFilterButton ,changeDialogWidth,searchFormClick}) // 提供 open 方法,用于打开弹窗 // Table 组件 ref const searchTableRef = ref() @@ -307,6 +312,11 @@ const rowClick = (row: any, column: any, event: Event) => { searchTableRef.value?.elTableRef?.toggleRowSelection(row, false) } } +const cancleClick = ()=>{ + searchDialogVisible.value = false +} +defineExpose({ open,openData,updateData,hiddenFilterButton ,changeDialogWidth,searchFormClick,submitForm,cancleClick,}) // 提供 open 方法,用于打开弹窗 + </script> <style scoped lang="scss"> </style> \ No newline at end of file diff --git a/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/index.vue b/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/index.vue new file mode 100644 index 000000000..3866c1439 --- /dev/null +++ b/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/index.vue @@ -0,0 +1,244 @@ +<template> + <ContentWrap> + <!-- 搜索工作栏 --> + <Search :schema="OnlinesettlementInfoDetail.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + + <!-- 列表头部 --> + <TableHead + :HeadButttondata="HeadButttondata" + @button-base-click="buttonBaseClick" + :routeName="routeName" + @updataTableColumns="updataTableColumns" + @searchFormClick="searchFormClick" + :allSchemas="OnlinesettlementInfoDetail.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="OnlinesettlementInfoDetailRules" + :formAllSchemas="OnlinesettlementInfoDetail.allSchemas" + :apiUpdate="OnlinesettlementInfoDetailApi.updateOnlinesettlementInfoDetail" + :apiCreate="OnlinesettlementInfoDetailApi.createOnlinesettlementInfoDetail" + @searchTableSuccess="searchTableSuccess" + :isBusiness="false" + /> + + <!-- 详情 --> + <Detail ref="detailRef" :isBasic="true" :allSchemas="OnlinesettlementInfoDetail.allSchemas" /> + + <!-- 导入 --> + <ImportForm ref="importFormRef" url="/wms/onlinesettlement-info-detail/import" :importTemplateData="importTemplateData" @success="importSuccess" /> +</template> + +<script setup lang="ts"> +import download from '@/utils/download' +import { OnlinesettlementInfoDetail,OnlinesettlementInfoDetailRules } from './onlinesettlementInfoDetail.data' +import * as OnlinesettlementInfoDetailApi from '@/api/wms/onlinesettlementInfoDetail' +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: 'OnlinesettlementInfoDetail' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const route = useRoute() // 路由信息 +const routeName = ref() +routeName.value = route.name +const tableColumns = ref(OnlinesettlementInfoDetail.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: OnlinesettlementInfoDetailApi.getOnlinesettlementInfoDetailPage // 分页接口 +}) + +// 获得表格的各种操作 +const { getList, setSearchParams } = tableMethods + +// 列表头部按钮 +const HeadButttondata = [ + defaultButtons.defaultAddBtn({hasPermi:'wms:onlinesettlementInfoDetail:create'}), // 新增 + defaultButtons.defaultImportBtn({hasPermi:'wms:onlinesettlementInfoDetail:import'}), // 导入 + defaultButtons.defaultExportBtn({hasPermi:'wms:onlinesettlementInfoDetail: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:onlinesettlementInfoDetail:update'}), // 编辑 + defaultButtons.mainListDeleteBtn({hasPermi:'wms:onlinesettlementInfoDetail: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 =OnlinesettlementInfoDetail.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 OnlinesettlementInfoDetailApi.createOnlinesettlementInfoDetail(data) + message.success(t('common.createSuccess')) + } else { + await OnlinesettlementInfoDetailApi.updateOnlinesettlementInfoDetail(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, 'basicOnlinesettlementInfoDetail') +} + +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await OnlinesettlementInfoDetailApi.deleteOnlinesettlementInfoDetail(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 OnlinesettlementInfoDetailApi.exportOnlinesettlementInfoDetail(tableObject.params) + download.excel(data, '上线结算记录信息新子表.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 OnlinesettlementInfoDetailApi.importTemplate() +}) + +</script> diff --git a/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/onlinesettlementInfoDetail.data.ts b/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/onlinesettlementInfoDetail.data.ts new file mode 100644 index 000000000..103ddadc2 --- /dev/null +++ b/src/views/wms/issueManage/onlinesettlement/onlinesettlementInfoDetail/onlinesettlementInfoDetail.data.ts @@ -0,0 +1,117 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const OnlinesettlementInfoDetailRules = reactive({ + masterId: [required], + concurrencyStamp: [required], +}) + +export const OnlinesettlementInfoDetail = useCrudSchemas(reactive<CrudSchema[]>([ + { + label: 'id', + field: 'id', + sort: 'custom', + isForm: false, + }, + { + label: '单据号', + field: 'number', + sort: 'custom', + isSearch: true, + }, + { + label: '主表ID', + field: 'masterId', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '结算数量', + field: 'settlementQty', + sort: 'custom', + isSearch: true, + }, + { + label: '结算记录单号', + field: 'settlementRecordNumber', + sort: 'custom', + isSearch: true, + }, + { + label: '结算业务类型', + field: 'settlementBusinessType', + sort: 'custom', + isSearch: true, + form: { + component: 'SelectV2' + }, + }, + { + label: '结算日期', + field: 'settlementDatetime', + 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')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + }, + { + label: '并发乐观锁', + field: 'concurrencyStamp', + sort: 'custom', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + isSearch: true, + }, + { + 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' + } + } +])) diff --git a/src/views/wms/issueManage/onlinesettlement/settlementReport/index.vue b/src/views/wms/issueManage/onlinesettlement/settlementReport/index.vue new file mode 100644 index 000000000..5a845ea61 --- /dev/null +++ b/src/views/wms/issueManage/onlinesettlement/settlementReport/index.vue @@ -0,0 +1,279 @@ +<template> + <ContentWrap> + <!-- 搜索工作栏 --> + <Search :schema="SettlementReport.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> + </ContentWrap> + + <!-- 列表头部 --> + <TableHead + :HeadButttondata="HeadButttondata" + @button-base-click="buttonBaseClick" + :routeName="routeName" + @updataTableColumns="updataTableColumns" + @searchFormClick="searchFormClick" + :allSchemas="SettlementReport.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 #action="{ row }"> + <ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> + </template> + </Table> + </ContentWrap> + + <!-- 结算库位列表 --> + <SearchTable + ref="searchTableRef" + :showSearchTableQueryFields="['itemCode']" + :hiddenFilterBtnFields="[]" + :isCheckStrictly="false" + @searchTableSuccess="searchTableSuccess" + :hiddenFooterActions="true" + > + <template #footerActions> + <div class="flex items-center" style="justify-content: flex-end;"> + <el-button type="primary" @click="settlementClick">结算库位</el-button> + <el-button @click="cancleClick">{{ t(`ts.${'取 消'}`) }}</el-button> + </div> + </template> + <template #searchQueryhahaha> + <Form + ref="basicFormRef" + :rules="SettlementReportSelectionFormRules" + :schema="SettlementReportSelectionForm.allSchemas.formSchema" + :is-col="true" + @opensearchTable="opensearchTable" + @onBlur="onBlur" + /> + </template> + </SearchTable> + + <!-- 库位 --> + <SearchTable + ref="searchTableRef1" + @searchTableSuccess="searchTableSuccess1" + /> +</template> + +<script setup lang="ts"> +import download from '@/utils/download' +import { SettlementReport,SettlementReportRules,SettlementReportSelection,SettlementReportSelectionlRules,SettlementReportSelectionForm,SettlementReportSelectionFormRules } from './settlementReport.data' +import * as SettlementtReportApi from '@/api/wms/settlementReport' +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' +import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data' +import * as WarehouseApi from '@/api/wms/warehouse' +import * as LocationApi from '@/api/wms/location' +import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' +import { tableFormBlurVer, FormBlur, getListByBottonInput } from '@/api/wms/business/inputBlur' + + +// 上线结算配置管理 +defineOptions({ name: 'SettlementReport' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const route = useRoute() // 路由信息 +const routeName = ref() +routeName.value = route.name +const tableColumns = ref(SettlementReport.allSchemas.tableColumns) + +// 字段设置 更新主列表字段 +const updataTableColumns = (val) => { + tableColumns.value = val +} + +const { tableObject, tableMethods } = useTable({ + getListApi: SettlementtReportApi.getSettlementReportPage // 分页接口 +}) + +// 获得表格的各种操作 +const { getList, setSearchParams } = tableMethods + +// 列表头部按钮 +const HeadButttondata = [ + defaultButtons.defaultFreshBtn(null), // 刷新 + // { + // label: '自定义扩展按钮', + // name: 'zdy', + // hide: false, + // type: 'primary', + // icon: 'Select', + // color: '' + // }, +] + +// 头部按钮事件 +const buttonBaseClick = (val, item) => { + if (val == 'refresh') { // 刷新 + getList() + } else if (val == 'filtrate') { // 筛选 + } else { // 其他按钮 + console.log('其他按钮', item) + } +} +// 列表-操作按钮 +const butttondata = (row) => { + return [{ + label: '结算', + name: 'settlement', + // hide: row.settledStatus!=2, + hide: '', + type: 'primary', + icon: '', + color: '', + hasPermi: '' + }] +} + +const searchTableRef = ref() +// 列表-操作按钮事件 +const buttonTableClick = async (val, row) => { + if(val == 'settlement'){ + // 结算 + searchTableRef.value.open( + "批量结算", + SettlementReportSelection.allSchemas, + SettlementtReportApi.getSettlementReportBalance, + "hahaha", + "hahaha", + true, + 'tableForm', + null, + { + supplierCode:row.supplierCode, + itemCode:row.itemCode, + batch:row.batch + }, + undefined, + false, + null + ) + } +} +// 批量结算 +const settlementClick = ()=>{ + if(!basicFormRef.value.formModel['toLocationCode']){ + message.warning('请选择结算库位') + return + }else{ + searchTableRef.value.submitForm() + } +} + +const cancleClick = ()=>{ + searchTableRef.value.cancleClick() +} +// 批量结算 +const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { + console.log('formModel',basicFormRef.value.formModel['toLocationCode']) + console.log('searchTableSuccess',formField, searchField, val, formRef, type, row ) + nextTick(async () => { + let ids = [] + ids = val.map(item=>(item['id'])) + ids.join(',') + let res = await SettlementtReportApi.submitSettlementReport({ + ids, + toLocationCode:basicFormRef.value.formModel['toLocationCode']||'' + }) + if(res==1){ + message.success('提交成功') + getList() + } + }) +} + + +// 筛选提交 +const searchFormClick = (searchData) => { + tableObject.params = { + isSearch: true, + filters: searchData.filters + } + getList() // 刷新当前列表 +} + +/** 添加/修改操作 */ +const basicFormRef = ref() +// 结算库位 +const opensearchTable = ( + formField, + searchField, + searchTitle, + searchAllSchemas, + searchPage, + searchCondition, + multiple, + type, + row, + isConcatDetailSchemas = false, + searchDetailSchemas: any +) => { + + searchTableRef1.value.open( + "结算库位", + Location.allSchemas, + LocationApi.getLocationPage, + "toLocationCode", + "code", + false, + 'form', + null, + { + // supplierCode:row.supplierCode, + // itemCode:row.itemCode, + // batch:row.batch + }, + undefined, + false, + null + ) +} + +const searchTableRef1 = ref() +const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => { + console.log('searchTableSuccess',formField, searchField, val, formRef, type, row ) + nextTick(() => { + const setV = {} + setV[formField] = val[0][searchField] + basicFormRef.value.setValues(setV) + }) +} +const onBlur = async (field, e) => { + let formSchemaObj = SettlementReportSelectionForm.allSchemas.formSchema.find((item) => item.field == field)?.componentProps + if (formSchemaObj?.enterSearch) { + await FormBlur( + field, + e, + routeName.value, + basicFormRef.value, + null, + formSchemaObj, + (list) => { + searchTableSuccess1(field, formSchemaObj.searchField, list, basicFormRef.value, 'form') + } + ) + } +} +/** 初始化 **/ +onMounted(async () => { + getList() + // importTemplateData.templateUrl = await SettlementConfigurationApi.importTemplate() +}) + +</script> diff --git a/src/views/wms/issueManage/onlinesettlement/settlementReport/settlementReport.data.ts b/src/views/wms/issueManage/onlinesettlement/settlementReport/settlementReport.data.ts new file mode 100644 index 000000000..340f397f6 --- /dev/null +++ b/src/views/wms/issueManage/onlinesettlement/settlementReport/settlementReport.data.ts @@ -0,0 +1,186 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' +import * as SupplierApi from '@/api/wms/supplier' +import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' +import * as SupplieritemApi from '@/api/wms/supplieritem' +import { Supplieritem} from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' +import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data' +import * as WarehouseApi from '@/api/wms/warehouse' +import * as LocationApi from '@/api/wms/location' +import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' + +// 表单校验 +export const SettlementReportRules = reactive({ +}) + +export const SettlementReport = useCrudSchemas(reactive<CrudSchema[]>([ + + { + label: '供应商代码', + field: 'supplierCode', + sort: 'custom', + isSearch: true, + + }, + { + label: '供应商名称', + field: 'supplierName', + sort: 'custom', + form: { + componentProps: { + disabled: true + } + } + }, + { + label: '物料代码', + field: 'itemCode', + sort: 'custom', + isSearch: true, + }, + { + label: '物品名称', + field: 'itemName', + sort: 'custom', + }, + { + label: '累计收货量', + field: 'totalReceiptQty', + sort: 'custom', + }, + { + label: '已结算数量', + field: 'totalSettledQty', + sort: 'custom', + }, + { + label: '未结算数量', + field: 'totalOutstandingSettleQty', + sort: 'custom', + isForm: false + }, + { + label: '操作', + field: 'action', + isForm: false, + table: { + width: 150, + fixed: 'right' + } + } +])) + +export const SettlementReportSelection = useCrudSchemas(reactive<CrudSchema[]>([ + { + label: ' ', + field: 'hahaha', + table: { + width: 180 + }, + isTable:false, + isDetail:false, + form: { + componentProps: { + type: 'slot', + } + }, + }, + { + label: '供应商代码', + field: 'supplierCode', + sort: 'custom', + isSearch: true, + + }, + { + label: '供应商名称', + field: 'supplierName', + sort: 'custom', + form: { + componentProps: { + disabled: true + } + } + }, + { + label: '物料代码', + field: 'itemCode', + sort: 'custom', + isSearch: true, + }, + { + label: '物品名称', + field: 'itemName', + sort: 'custom', + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + }, + { + label: '库位代码', + field: 'locationCode', + sort: 'custom', + }, + { + label: '库存数量', + field: 'qty', + sort: 'custom', + }, + { + label: '库存状态', + field: 'inventoryStatus', + dictType: DICT_TYPE.INVENTORY_STATUS, + dictClass: 'string', + } +])) +//表单校验 +export const SettlementReportSelectionRules = reactive({ + // fromWarehouseCode: [ + // { required: true, message: '请选择来源仓库', trigger: 'change' } + // ], +}) + + +export const SettlementReportSelectionForm = useCrudSchemas(reactive<CrudSchema[]>([ + { + label: '结算库位', + field: 'toLocationCode', + isTable: true, + sort: 'custom', + table: { + width: 150 + }, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + enterSearch: true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择结算库位代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '库位信息', // 查询弹窗标题 + searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 + searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true + }], // 失去焦点校验参数 + } + } + } +])) + +export const SettlementReportSelectionFormRules = reactive({ + toLocationCode: [ + { required: true, message: '请选择结算库位', trigger: 'change' } + ], +})