diff --git a/src/api/wms/customerDeliveryForecast/index.ts b/src/api/wms/customerDeliveryForecast/index.ts index 65322ff1d..ec23e1002 100644 --- a/src/api/wms/customerDeliveryForecast/index.ts +++ b/src/api/wms/customerDeliveryForecast/index.ts @@ -1,4 +1,5 @@ import request from '@/config/axios' +import { isString } from '@/utils/is' export interface CustomerDeliveryForecastVO { schdSite: string @@ -19,15 +20,20 @@ export interface CustomerDeliveryForecastVO { schdCustref: string schdPcrQty: string available: string + schdRlseId: string } // 查询客户发货预测列表 export const getCustomerDeliveryForecastPage = async (params) => { if (params.isSearch) { delete params.isSearch + if(params.flag){ + delete params.flag + } const data = {...params} return await request.post({ url: '/wms/customer-delivery-forecast/senior', data }) } else { + params = getPageParams(params) return await request.get({ url: `/wms/customer-delivery-forecast/page`, params }) } } @@ -61,3 +67,72 @@ export const exportCustomerDeliveryForecast = async (params) => { export const importTemplate = () => { return request.download({ url: '/wms/customer-delivery-forecast/get-import-template' }) } + + +// 要货预测-列表和头部请求参数 +const getPageParams = (params)=>{ + // 到货日期 + if(params.schdDate&¶ms.schdDate.length>0){ + if(isString(params.schdDate[0])){ + params.startDate = params.schdDate[0] + }else{ + params.startDate = params.schdDate[0].format('YYYY-MM-DD') + } + + } + if(params.schdDate&¶ms.schdDate.length>1){ + if(isString(params.schdDate[1])){ + params.endDate = params.schdDate[1] + }else{ + params.endDate = params.schdDate[1].format('YYYY-MM-DD') + } + } + console.log(params.schdDate) + if (!params.schdDate || params.schdDate.length == 0) { + params.startDate = '' + params.endDate = '' + } + + + // 物料代码 + if(params.schdPart&¶ms.schdPart.length>0){ + let keyValue = params.schdPart.split(' ') + keyValue.forEach(item=>{item = item.trim()}) + params.schdParts = keyValue.join(',') + } + params.schdPart = '' + + // 版本号 + if(params.schdRlseId&¶ms.schdRlseId.length>0){ + let keyValue = params.schdRlseId.split(' ') + keyValue.forEach(item=>{item = item.trim()}) + params.schdRlseIds = keyValue.join(',') + } + params.schdRlseId = '' + return params +} + +// 查询发货预测主列表 +export const getPageTableHead = async (params) => { + params = getPageParams(params) + console.log('params',params) + return await request.get({ url: `/wms/customer-delivery-forecast/queryPageTableHead`, params }) +} + +// 查询发货预测主列表 +export const getPageTableHeadToMonth = async (params) => { + params = getPageParams(params) + console.log('params',params) + return await request.get({ url: `/wms/customer-delivery-forecast/queryPageTableHeadToMonth`, params }) +} + +// 查询客户发货预测列表 +export const getCustomerDeliveryForecastPageToMonth = async (params) => { + params = getPageParams(params) + return await request.get({ url: `/wms/customer-delivery-forecast/pageToMonth`, params }) +} + +// 查询版本号 +export const queryVersion = async (params) => { + return await request.get({ url: `/wms/customer-delivery-forecast/queryVersion`, params }) +} \ No newline at end of file diff --git a/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/customerDeliveryForecast.data.ts b/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/customerDeliveryForecast.data.ts index 1884f5fa9..120d83282 100644 --- a/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/customerDeliveryForecast.data.ts +++ b/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/customerDeliveryForecast.data.ts @@ -1,6 +1,35 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' +import dayjs from 'dayjs' +import * as CustomerDeliveryForecastApi from '@/api/wms/customerDeliveryForecast' +import * as itembasicApi from '@/api/wms/itembasic' +import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' +import { Itembasic } from '../../itemManage/itembasic/itembasic.data' +Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment") +export const Version = useCrudSchemas(reactive([ + { + label: '订单号', + field: 'schdOrder', + sort: 'custom', + }, + { + label: '订单行', + field: 'schdLine', + sort: 'custom', + }, + { + label: '物料编码', + field: 'schdPart', + isSearch:true, + sort: 'custom', + }, + { + label: '版本', + field: 'schdRlseId', + sort: 'custom', + } +])) // 表单校验 export const CustomerDeliveryForecastRules = reactive({ }) @@ -10,25 +39,32 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ label: '地点代码', field: 'schdSite', sort: 'custom', - isSearch: true + isTable:false, + isForm: false, }, { label: '销售日程单号', field: 'schdOrder', sort: 'custom', - isSearch: true + table: { + width: 110 + }, }, { label: '日程单行号', field: 'schdLine', sort: 'custom', - isSearch: true + table: { + width: 110 + }, }, { label: '客户代码', field: 'schdCust', sort: 'custom', - isSearch: true + table: { + width: 100 + }, }, { label: '发货至', @@ -39,21 +75,82 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ label: '码头', field: 'schdDock', sort: 'custom', + isTable:false, + isForm: false, }, { label: '物料编码', field: 'schdPart', sort: 'custom', + isSearch:true, + table: { + width: 90 + }, + search: { + // labelMessage: '信息提示说明!!!', + componentProps: { + multiple: true, + enterSearch: true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择物料编码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '物料基础信息', // 查询弹窗标题 + searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 + searchPage: itembasicApi.getItembasicPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + }] + } + } }, + { + label: '版本号', + field: 'schdRlseId', + sort: 'custom', + table: { + width: 150 + }, + isSearch:true, + search: { + // labelMessage: '信息提示说明!!!', + componentProps: { + multiple: true, + enterSearch: true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择版本号', // 输入框占位文本 + searchField: 'schdRlseId', // 查询弹窗赋值字段 + searchTitle: '版本号', // 查询弹窗标题 + searchAllSchemas: Version.allSchemas, // 查询弹窗所需类 + searchPage: CustomerDeliveryForecastApi.queryVersion, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'schdParts', + value: 'schdPart', + message: '请填写物料代码!', + isMainValue: true, + isCSV:true,//是否用逗号分隔参数 + },{ + key: 'available', + value: 'TRUE', + isMainValue: false + }] + } + } + }, { label: '净需求', field: 'schdNetReq', sort: 'custom', + isTable:false, + isForm: false, }, { label: '需求日期', field: 'schdDate', sort: 'custom', + isTable:false, + isForm: false, formatter: dateFormatter, form: { component: 'DatePicker', @@ -61,13 +158,25 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ type: 'datetime', valueFormat: 'x' } - } + }, + isSearch:true, + search: { + component: 'DatePicker', + value: [dayjs().format('YYYY-MM-DD'), dayjs().subtract(-3,'month').format('YYYY-MM-DD')], + componentProps: { + valueFormat: 'YYYY-MM-DD', + type: 'daterange', + defaultTime: [new Date('1 '), new Date('1 ')] + } + }, }, { label: '需求时间', field: 'schdTime', sort: 'custom', formatter: dateFormatter, + isTable:false, + isForm: false, form: { component: 'DatePicker', componentProps: { @@ -80,21 +189,38 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ label: '需求参考', field: 'schdReference', sort: 'custom', + isTable:false, + isForm: false, }, { label: '包装倍数', field: 'schdOrdMult', sort: 'custom', + isTable:false, + isForm: false, }, { label: '客户零件号', field: 'schdCustpart', sort: 'custom', + table: { + width: 110 + }, + }, + { + label: '客户名称', + field: 'schdCustName', + sort: 'custom', + table: { + width: 90 + }, }, { label: '包装代码', field: 'schdPkgCode', sort: 'custom', + isTable:false, + isForm: false, }, { label: '模型年', @@ -105,21 +231,27 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ label: '客户参考', field: 'schdCustref', sort: 'custom', + table: { + width: 90 + }, }, { label: '先前累计需求数量', field: 'schdPcrQty', sort: 'custom', + isTable:false, + isForm: false, }, { label: '创建时间', field: 'createTime', sort: 'custom', + isTable:false, + isForm: false, formatter: dateFormatter, table: { width: 180, }, - isForm: false, form: { component: 'DatePicker', componentProps: { @@ -128,7 +260,6 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ valueFormat: 'x', } }, - isSearch: true, search: { component: 'DatePicker', componentProps: { @@ -141,7 +272,12 @@ export const CustomerDeliveryForecast = useCrudSchemas(reactive([ { label: '是否可用', field: 'available', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', sort: 'custom', + table: { + width: 150 + }, }, // { // label: '操作', diff --git a/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/index.vue b/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/index.vue index 39689c7a3..1f30c1399 100644 --- a/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/index.vue +++ b/src/views/wms/basicDataManage/customerManage/customerDeliveryForecast/index.vue @@ -1,7 +1,15 @@ + @@ -77,6 +106,7 @@ const { t } = useI18n() // 国际化 const route = useRoute() // 路由信息 const routeName = ref() routeName.value = route.name +const orginTableColumns = ref(CustomerDeliveryForecast.allSchemas.tableColumns) const tableColumns = ref(CustomerDeliveryForecast.allSchemas.tableColumns) // 查询页面返回 @@ -90,9 +120,108 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { // 字段设置 更新主列表字段 const updataTableColumns = (val) => { - tableColumns.value = val + orginTableColumns.value = val + tableColumns.value = [...orginTableColumns.value,...dateTableColumns.value] + +} + +// 月合计--列表头部 +const isToMonth = ref(false) +const toMonthSearchClick = async ()=>{ + isToMonth.value = true + let data = await searchRef.value.getSearchFormData() + console.log('data',data) + + await setSearchParamsHeadToMonth(data) + // updateDateTableColumns() + setSearchParamsToMonth(data) +} +const { tableObject:tableObjectHeadToMonth, tableMethods:tableMethodsHeadToMonth } = useTable({ + getListApi: CustomerDeliveryForecastApi.getPageTableHeadToMonth // 分页接口 +}) + +// 获得表格的各种操作 +const { getList:getListHeadToMonth, setSearchParams:setSearchParamsHeadToMonth } = tableMethodsHeadToMonth + +watch(()=>tableObjectHeadToMonth.tableList,()=>{ + updateDateTableColumns(true) +},{deep:true}) + +// 月合计-列表 +const { tableObject:tableObjectToMonth, tableMethods:tableMethodsToMonth } = useTable({ + getListApi: CustomerDeliveryForecastApi.getCustomerDeliveryForecastPageToMonth // 分页接口 +}) + +// 获得表格的各种操作 +const { getList:getListToMonth, setSearchParams:setSearchParamsToMonth } = tableMethodsToMonth + + + +// 要货预测--列表头部 +const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({ + getListApi: CustomerDeliveryForecastApi.getPageTableHead // 分页接口 +}) + +// 获得表格的各种操作 +const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead + +watch(()=>tableObjectHead.tableList,()=>{ + updateDateTableColumns(false) +},{deep:true}) + +const dateTableColumns = ref([]) +const updateDateTableColumns = (toMonth)=>{ + console.log('tableObjectHead',tableObjectHead) + let dateColumns = [] + if(toMonth){ + // 月合计 + tableObjectHeadToMonth.tableList.forEach(item=>{ + dateColumns.push({ + width:120, + field: item, + label: item + }) + }) + }else{ + tableObjectHead.tableList.forEach(item=>{ + dateColumns.push({ + width:120, + field: item, + label: item + }) + }) + } + dateTableColumns.value = dateColumns + tableColumns.value = [...orginTableColumns.value,...dateColumns] + console.log('tableColumns',tableColumns.value) } +// 查询页面返回 +const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => { + console.log('searchQueryTableSuccess',formField, searchField, val, formRef, type, row ) + nextTick(() => { + const setV = {} + if(formField == 'schdPart'||formField == 'schdRlseId'){ + //物料代码 版本号 + let list = [] + val.forEach(item=>{ + list.push(item[searchField]) + }) + setV[formField] = list.join(' ') + formRef.setValues(setV) + }else{ + setV[formField] = val[0][searchField] + formRef.setValues(setV) + } + }) +} +const searchRef = ref() +const searchClick = async (data)=>{ + isToMonth.value = false + await setSearchParamsHead(data) + // updateDateTableColumns() + setSearchParams(data) +} const { tableObject, tableMethods } = useTable({ getListApi: CustomerDeliveryForecastApi.getCustomerDeliveryForecastPage // 分页接口 }) @@ -104,9 +233,9 @@ const { getList, setSearchParams } = tableMethods const HeadButttondata = [ defaultButtons.defaultAddBtn({hasPermi:'wms:customerDeliveryForecast:create'}), // 新增 defaultButtons.defaultImportBtn({hasPermi:'wms:customerDeliveryForecast:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'wms:customerDeliveryForecast:export'}), // 导出 + defaultButtons.defaultExportBtn({hasPermi:'wms:customerDeliveryForecast:export-excel'}), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 - defaultButtons.defaultFilterBtn(null), // 筛选 + // defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置 // { // label: '自定义扩展按钮', @@ -119,7 +248,7 @@ const HeadButttondata = [ ] // 头部按钮事件 -const buttonBaseClick = (val, item) => { +const buttonBaseClick = async (val, item) => { if (val == 'add') { // 新增 openForm('create') } else if (val == 'import') { // 导入 @@ -132,7 +261,11 @@ const buttonBaseClick = (val, item) => { filters: tableObject.params.filters }) } else { + isToMonth.value = false + await getListHead() + // updateDateTableColumns() getList() + } } else if (val == 'filtrate') { // 筛选 } else { // 其他按钮 @@ -257,7 +390,8 @@ const searchFormClick = (searchData) => { /** 初始化 **/ onMounted(async () => { - getList() + searchRef.value.search() + // getList() importTemplateData.templateUrl = await CustomerDeliveryForecastApi.importTemplate() })