Browse Source

要货计划---新增(有效期目前写死,记得测接口数据)

master_hella_20240701
yufei0306 7 months ago
parent
commit
18dcb1ed29
  1. 81
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  2. 212
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

81
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

@ -46,7 +46,7 @@
<BasicForm
ref="formRef"
:isOpenSearchTable="true"
:indexTableColumn="3"
:indexTableColumn="0"
@success="getList"
:rules="SupplierdeliverRequestMainRules"
:formAllSchemas="SupplierdeliverRequestMain.allSchemas"
@ -61,7 +61,15 @@
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@formFormDateChange="formFormDateChange"
/>
>
<template v-slot="{row}">
<el-date-picker v-bind:modelValue="row['expireTime']?addDay(row['produceDate'],row['expireTime']).format('YYYY-MM-DD'):'2099-12-31'"
:clearable="true"
style="width: 100%"
:disabled="true"
placeholder="选择日期"/>
</template>
</BasicForm>
<!-- 详情 -->
<Detail
@ -120,6 +128,7 @@
import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getAccessToken } from '@/utils/auth'
import { formatDate } from '@/utils/formatTime'
import {
SupplierdeliverRequestMain,
SupplierdeliverRequestMainRules,
@ -131,7 +140,10 @@ import {
import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain'
import * as SupplierdeliverRequestDetailApi from '@/api/wms/supplierdeliverRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { formatDate } from '@/utils/formatTime'
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
import * as ItembasicApi from '@/api/wms/itembasic'
import { PurchasePlanDetail } from '../purchasePlanMain/purchasePlanMain.data'
import { addDay } from '@/utils/formatTime'
//
defineOptions({ name: 'SupplierdeliverRequestMain' })
@ -155,6 +167,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
nextTick(() => {
console.log("type:",type)
console.log("formField:",formField)
console.log(formField, searchField, val, formRef, type, row)
if (type == 'tableForm') {
//
// row[formField] = val[0][searchField]
@ -165,7 +178,10 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
// row['orderQty'] = val[0]['orderQty']
// row['uom'] = val[0]['uom']
// }
//--
const itemCodes = []
val.forEach(item=>{
if(tableData.value.find(item1=>item1['id'] == item['id'])) return
const newRow = {...row}
newRow[formField] = item[searchField]
newRow['poNumber'] = item['poNumber']
@ -173,12 +189,29 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
newRow['poLine'] = item['poLine']
newRow['orderQty'] = item['orderQty']
newRow['uom'] = item['uom']
itemCodes.push(item['itemCode'])
tableData.value.push(newRow)
})
//
ItembasicApi.getItembasicPage({
code:itemCodes.join(',')
}).then((res)=>{
console.log('有效期',res)
tableData.value.forEach((item,index)=>{
tableData.value[index]['expireTime'] = index==0?1:2
})
// res.list.forEach((item,index)=>{
// const findItem = tableData.value.find(item1=>item1['itemCode']==item['code'])
// findItem['expireTime'] = findItem['expireTime']
// })
})
} else {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'ppNumber'){
//--
getSearchTableData(val[0]['number'],formField,searchField)
//
let beginTime = val[0]['endTime']
let deliveryDate = formatDate(val[0]['deliveryDate'],'YYYY-MM-DD')
@ -196,6 +229,46 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
}
})
}
const getSearchTableData = async (number,formField,searchField)=>{
const {tableObject ,tableMethods} = useTable({
defaultParams:{number},
getListApi: PurchasePlanDetailApi.getPurchasePlanDetailPage //
})
//
const { getList:getList1 } = tableMethods
await getList1()
const tableColumns = PurchasePlanDetail.allSchemas.tableFormColumns
tableColumns.forEach((item) => {
item.width = item.table?.width || 150
})
tableData.value = []
const itemCodes = []
tableObject.tableList.forEach(row=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row}))
newRow[formField] = row[searchField]
newRow['poNumber'] = row['poNumber']
newRow['itemCode'] = row['itemCode']
newRow['poLine'] = row['poLine']
newRow['orderQty'] = row['orderQty']
newRow['uom'] = row['uom']
tableData.value.push(newRow)
itemCodes.push(row['itemCode'])
})
//
ItembasicApi.getItembasicPage({
code:itemCodes.join(',')
}).then((res)=>{
console.log('有效期',res)
tableData.value.forEach((item,index)=>{
tableData.value[index]['expireTime'] = index==0?1:2
})
// res.list.forEach((item,index)=>{
// const findItem = tableData.value.find(item1=>item1['itemCode']==item['code'])
// findItem['expireTime'] = findItem['expireTime']
// })
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -232,6 +305,8 @@ const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row
})
}
const { tableObject, tableMethods } = useTable({
getListApi: SupplierdeliverRequestMainApi.getSupplierdeliverRequestMainPage //
})

212
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

@ -553,7 +553,103 @@ export const SupplierdeliverRequestMainRules = reactive({
*/
export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '生产日期',
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '要货计划信息',
searchAllSchemas: PurchasePlanDetail.allSchemas,
searchPage: PurchasePlanDetailApi.getPurchasePlanDetailPage,
searchCondition: [
{
key: 'number',
value: 'ppNumber',
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '要货计划信息',
searchAllSchemas: PurchasePlanDetail.allSchemas,
searchPage: PurchasePlanDetailApi.getPurchasePlanDetailPage,
searchCondition: [
{
key: 'number',
value: 'ppNumber',
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: false
}
},
{
label: '生产日期1',
field: 'produceDate',
formatter: dateFormatter2,
detail: {
@ -578,17 +674,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
valueFormat: 'x',
}
},
{
label: '批次',
field: 'batch',
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: false
}
},
// {
// label: '替代批次',
// field: 'altBatch',
@ -620,6 +706,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
valueFormat: 'x',
}
},
isTableForm: false,
tableForm: {
type: 'FormDate',
@ -628,7 +715,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
}
},
{
label: '过期日期',
label: '过期日期3',
field: 'expireDate',
formatter: dateFormatter2,
detail: {
@ -647,81 +734,17 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
valueFormat: 'x',
}
},
tableForm: {
type: 'FormDate',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '要货计划信息',
searchAllSchemas: PurchasePlanDetail.allSchemas,
searchPage: PurchasePlanDetailApi.getPurchasePlanDetailPage,
searchCondition: [
{
key: 'number',
value: 'ppNumber',
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
]
}
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '要货计划信息',
searchAllSchemas: PurchasePlanDetail.allSchemas,
searchPage: PurchasePlanDetailApi.getPurchasePlanDetailPage,
searchCondition: [
{
key: 'number',
value: 'ppNumber',
message: '请填写要货计划单号!',
isMainValue: true
},
{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
// tableForm: {
// type: 'FormDate',
// dateFormat: 'YYYY-MM-DD',
// valueFormat: 'x',
// }
tableForm:{
type: 'slot',
disabled: true
}
},
{
label: '订单数量',
field: 'orderQty',
@ -816,22 +839,7 @@ export const SupplierdeliverRequestDetail = useCrudSchemas(reactive<CrudSchema[]
}
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{
label: '计量单位',
field: 'uom',
@ -1076,7 +1084,7 @@ export const SupplierdeliverRequestDetailLabel = useCrudSchemas(reactive<CrudSch
}
},
{
label: '生产日期',
label: '生产日期2',
field: 'produceDate',
formatter: dateFormatter2,
detail: {

Loading…
Cancel
Save