Browse Source

主子表合并+采购收货申请-新增-采购订单号搜索

master_hella_20240701
yufei0306 7 months ago
parent
commit
17ec08deee
  1. 13
      src/components/BasicForm/src/BasicForm.vue
  2. 8
      src/components/Form/src/Form.vue
  3. 16
      src/components/SearchTable/src/SearchTable.vue
  4. 103
      src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue
  5. 49
      src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts
  6. 17
      src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/sparereceiptRequestMain.data.ts

13
src/components/BasicForm/src/BasicForm.vue

@ -350,7 +350,9 @@ const opensearchTable = (
searchCondition, searchCondition,
multiple, multiple,
type, type,
row row,
isConcatDetailSchemas=false,
searchDetailSchemas: any
) => { ) => {
const _searchCondition = {} const _searchCondition = {}
// //
@ -410,7 +412,10 @@ const opensearchTable = (
multiple, multiple,
type, type,
row, row,
_searchCondition _searchCondition,
undefined,
isConcatDetailSchemas,
searchDetailSchemas
) )
} }
@ -670,7 +675,9 @@ const inpuFocus = (headerItem, row, index) => {
headerItem.tableForm.searchCondition, headerItem.tableForm.searchCondition,
headerItem.tableForm.multiple, headerItem.tableForm.multiple,
'tableForm', 'tableForm',
row row,
headerItem.tableForm?.isConcatDetailSchemas,
headerItem.tableForm?.searchDetailSchemas
) )
} }
/** /**

8
src/components/Form/src/Form.vue

@ -120,8 +120,8 @@ export default defineComponent({
return unref(elFormRef) as ComponentRef<typeof ElForm> return unref(elFormRef) as ComponentRef<typeof ElForm>
} }
const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition,multiple) => { const opensearchTable = (field, searchField,searchTitle,searchAllSchemas, searchPage, searchCondition,multiple,isConcatDetailSchemas,searchDetailSchemas) => {
emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple) emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple,undefined,null,isConcatDetailSchemas,searchDetailSchemas)
} }
const clearSearchInput = (field) => { const clearSearchInput = (field) => {
@ -275,6 +275,8 @@ export default defineComponent({
item?.componentProps?.searchPage, item?.componentProps?.searchPage,
item?.componentProps?.searchCondition, item?.componentProps?.searchCondition,
item?.componentProps?.multiple, item?.componentProps?.multiple,
item?.componentProps?.isConcatDetailSchemas,
item?.componentProps?.searchDetailSchemas,
)}}/> )}}/>
</> </>
) )
@ -311,6 +313,8 @@ export default defineComponent({
item?.componentProps?.searchPage, item?.componentProps?.searchPage,
item?.componentProps?.searchCondition, item?.componentProps?.searchCondition,
item?.componentProps?.multiple, item?.componentProps?.multiple,
item?.componentProps?.isConcatDetailSchemas,
item?.componentProps?.searchDetailSchemas,
)}}/> )}}/>
</> </>
) )

16
src/components/SearchTable/src/SearchTable.vue

@ -59,7 +59,7 @@ const getListRef = ref()
const setSearchParamsRef = ref() const setSearchParamsRef = ref()
const tableObjectRef = ref() const tableObjectRef = ref()
const getPage:any = ref() const getPage:any = ref()
const searchSchema = ref() // const searchSchema = ref()
const tableColumns = ref() const tableColumns = ref()
const formFieldRef = ref() const formFieldRef = ref()
const searchFieldRef = ref() const searchFieldRef = ref()
@ -75,16 +75,22 @@ const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any
searchDialogVisible.value = true searchDialogVisible.value = true
multipleBol.value = multiple multipleBol.value = multiple
allSchemasRef.value = allSchemas allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema // searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns tableColumns.value = allSchemas.tableColumns
} }
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any ) => { const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any) => {
searchDialogVisible.value = true searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField
searchFieldRef.value = searchField searchFieldRef.value = searchField
allSchemasRef.value = allSchemas allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema // searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns.filter(item => (item.field !== 'action')) if(isConcatDetailSchemas){
//
console.log('detailSchemas',detailSchemas)
tableColumns.value = [...allSchemas.tableColumns,...detailSchemas.tableMainColumns].filter(item => (item.field !== 'action'))
}else{
tableColumns.value = allSchemas.tableColumns.filter(item => (item.field !== 'action'))
}
getPage.value = getApiPage getPage.value = getApiPage
typeRef.value = type typeRef.value = type
rowRef.value = row rowRef.value = row

103
src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/index.vue

@ -59,7 +59,15 @@
@submitForm="submitForm" @submitForm="submitForm"
@formFormDateChange="formFormDateChange" @formFormDateChange="formFormDateChange"
@onEnter="onEnter" @onEnter="onEnter"
/> >
<template v-slot="{row}">
<el-date-picker v-bind:modelValue="row['expireTime']?addDay(row['produceDate'],row['expireTime']):dayjs('2099-12-31').valueOf()"
:clearable="true"
style="width: 100%"
:disabled="true"
placeholder="选择日期"/>
</template>
</BasicForm>
<!-- 详情 --> <!-- 详情 -->
<Detail <Detail
ref="detailRef" ref="detailRef"
@ -118,10 +126,15 @@
:isShowReduceButton="false" :isShowReduceButton="false"
:isShowFooterButtton="false" :isShowFooterButtton="false"
/> />
<!-- 标签打印 -->
<SearchTable style="width:905px" ref="searchTableRef" @searchTableSuccess="searchTableSuccess1" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import dayjs from 'dayjs'
import { addDay } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { import {
@ -130,11 +143,13 @@ import {
PurchasereceiptRequestDetail, PurchasereceiptRequestDetail,
PurchasereceiptRequestDetailRules, PurchasereceiptRequestDetailRules,
PurchasereceiptRequestDetailLabel, PurchasereceiptRequestDetailLabel,
PurchasereceiptRequestDetailPackingNumber, PurchasereceiptRequestDetailPackingNumber
} from './purchasereceiptRequestMain.data' } from './purchasereceiptRequestMain.data'
import {
SupplierdeliverRequestPackage
} from '../../supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data'
import { PurchaseDetail } from '../../supplierdeliver/purchaseMain/purchaseMain.data' import { PurchaseDetail } from '../../supplierdeliver/purchaseMain/purchaseMain.data'
import * as PackageApi from '@/api/wms/package'
import * as PurchasereceiptRequestMainApi from '@/api/wms/purchasereceiptRequestMain' import * as PurchasereceiptRequestMainApi from '@/api/wms/purchasereceiptRequestMain'
import * as PurchasereceiptRequestDetailApi from '@/api/wms/purchasereceiptRequestDetail' import * as PurchasereceiptRequestDetailApi from '@/api/wms/purchasereceiptRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -142,6 +157,7 @@ import { formatDate } from '@/utils/formatTime'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { getAccessToken } from '@/utils/auth' import { getAccessToken } from '@/utils/auth'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import * as ItembasicApi from '@/api/wms/itembasic'
// //
defineOptions({ name: 'PurchasereceiptRequestMain' }) defineOptions({ name: 'PurchasereceiptRequestMain' })
@ -400,10 +416,65 @@ const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken()) const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken())
// //
const searchTableRef = ref()
const labelPrint = async (row) => { const labelPrint = async (row) => {
window.open(src.value + '&asn_number=' + row.asnNumber) console.log("------------",row);
} tableObject.loading = true
const subTableDFata = await PackageApi.getLabel(row.masterId)
tableObject.loading = false
const tableObject1 = {
//
currentPage: 1,
//
exportLoading: false,
//
loading: false,
//
pageSize: subTableDFata.length,
params:null,
//
sort: {
order: '', //
prop: '' //
},
//
total: subTableDFata.length,
//
tableList: subTableDFata,
currentRow:null
}
console.log("标签打印",subTableDFata,tableObject1,SupplierdeliverRequestPackage.allSchemas)
const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns
tableColumns.forEach((item) => {
item.width = item.table?.width || 150
})
searchTableRef.value.openData("标签信息",tableObject1,{tableColumns},true)
// window.open(src.value + '&asn_number=' + row.asnNumber)
}
// ---
const searchTableSuccess1 = async (formField, searchField, val, formRef, type, row) => {
console.log('批量打印',val)
// let rows:any = []
// val.forEach(item=>{
// rows = [...rows,...item.selectionRows.map(item1=>item1.number)]
// })
if(val.length == 0){
message.warning("请先选择要打印的数据!")
return
}
// window.open(src.value + '&asn_number=' + val.map(item1=>item1.number).join(','))
await PackageApi.batchPrintingLable(val.map(item1=>item1.number).join(',')).then(res => {
console.log(res)
window.open(src.value + '&asn_number=' + res)
}).catch(err => {
console.log(err)
message.error('创建标签失败')
})
}
const getSearchTableData = async (number,isEnter=false)=>{ const getSearchTableData = async (number,isEnter=false)=>{
const {tableObject ,tableMethods} = useTable({ const {tableObject ,tableMethods} = useTable({
@ -418,12 +489,20 @@ const getSearchTableData = async (number,isEnter=false)=>{
item.width = item.table?.width || 150 item.width = item.table?.width || 150
}) })
tableData.value = [] tableData.value = []
const itemCodes = []
tableObject.tableList.forEach(row=>{ tableObject.tableList.forEach(row=>{
itemCodes.push(row['itemCode'])
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row}))
newRow['poLine'] = row['lineNumber'] newRow['poLine'] = row['lineNumber']
newRow['itemCode'] = row['itemCode'] newRow['itemCode'] = row['itemCode']
newRow['uom'] = row['uom'] newRow['uom'] = row['uom']
newRow['poNumber'] =row['number'] newRow['poNumber'] =row['number']
newRow['supplierCode'] =row['supplierCode']
//
newRow['produceDate'] = dayjs().valueOf()
newRow['arriveDate'] = dayjs().valueOf()
//
newRow['batch'] = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['defaultToLocationCode'] =row['defaultLocation'] newRow['defaultToLocationCode'] =row['defaultLocation']
tableData.value.push(newRow) tableData.value.push(newRow)
if(isEnter){ if(isEnter){
@ -435,6 +514,15 @@ const getSearchTableData = async (number,isEnter=false)=>{
} }
}) })
//
ItembasicApi.getItembasicPage({
code:itemCodes.join(',')
}).then((res)=>{
res.list.forEach((item,index)=>{
const findItem = tableData.value.find(item1=>item1['itemCode']==item['code'])
findItem['expireTime'] = item['expireTime']
})
})
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
@ -607,6 +695,9 @@ const onEnter = async (field,value)=>{
} }
// //
const submitForm = async (formType, data) => { const submitForm = async (formType, data) => {
tableData.value.forEach((row, index) => {
row['expireDate'] = row['expireTime']?addDay(row['produceDate'],row['expireTime']).valueOf():dayjs('2099-12-31').valueOf()
})
data.subList = tableData.value // data.subList = tableData.value //
try { try {
if (formType === 'create') { if (formType === 'create') {

49
src/views/wms/purchasereceiptManage/purchasereceipt/purchasereceiptRequestMain/purchasereceiptRequestMain.data.ts

@ -67,13 +67,22 @@ export const PurchasereceiptRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
searchListPlaceholder: '请选择采购订单', // 输入框占位文本 searchListPlaceholder: '请选择采购订单', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段 searchField: 'number', // 查询弹窗赋值字段
searchTitle: '采购订单信息', // 查询弹窗标题 searchTitle: '采购订单信息', // 查询弹窗标题
isConcatDetailSchemas:true,//是否是主子表合并 默认false
searchDetailSchemas:PurchaseDetail.allSchemas,
searchAllSchemas: PurchaseMain.allSchemas, // 查询弹窗所需类 searchAllSchemas: PurchaseMain.allSchemas, // 查询弹窗所需类
searchPage: PurchaseMainApi.getPurchaseMainPage, // 查询弹窗所需分页方法 searchPage: PurchaseDetailApi.getPurchaseDetailPage, // 查询弹窗所需分页方法
searchCondition: [{ searchCondition: [{
key:'status', key:'status',
value:'2', value:'2',
message: '状态', message: '已发布状态',
isMainValue: false isMainValue: false
},
{
key: 'status', // 查询列表中字段
value: '2', // 指查询具体值
action: '==', // 查询拼接条件
isSearch: true, // 使用自定义拼接条件
isMainValue: false // 拼接条件必须要 false 同时不能与 isMainValue: true 同用
}] }]
} }
}, },
@ -610,6 +619,23 @@ export const PurchasereceiptRequestDetail = useCrudSchemas(reactive<CrudSchema[]
} }
} }
}, },
{
label: '订单类型',
field: 'type',
dictType: DICT_TYPE.WORK_ORDER_TYPE,
dictClass: 'string',
isSearch: false,
isTable: false,
isTableForm: true,
sort: 'custom',
table: {
width: 150
},
tableForm:{
disabled:true
},
isForm: false,
},
{ {
label: '订单行', label: '订单行',
field: 'poLine', field: 'poLine',
@ -660,6 +686,9 @@ export const PurchasereceiptRequestDetail = useCrudSchemas(reactive<CrudSchema[]
}, },
hiddenInMain:true, hiddenInMain:true,
isForm: false, isForm: false,
tableForm:{
disabled: true
}
}, },
{ {
label: '物料代码', label: '物料代码',
@ -876,7 +905,7 @@ export const PurchasereceiptRequestDetail = useCrudSchemas(reactive<CrudSchema[]
isForm: true isForm: true
}, },
{ {
label: '默认到库位代码', label: '到库位代码',
field: 'defaultToLocationCode', field: 'defaultToLocationCode',
sort: 'custom', sort: 'custom',
table: { table: {
@ -1012,11 +1041,15 @@ export const PurchasereceiptRequestDetail = useCrudSchemas(reactive<CrudSchema[]
valueFormat: 'x', valueFormat: 'x',
} }
}, },
// tableForm:{
// type:'FormDate',
// placeholder: '请选择过期日期',
// valueFormat: 'x',
// },
tableForm:{ tableForm:{
type:'FormDate', type: 'slot',
placeholder: '请选择过期日期', disabled: true
valueFormat: 'x', }
},
}, },
{ {
label: '从库位代码', label: '从库位代码',
@ -1203,7 +1236,7 @@ export const PurchasereceiptRequestDetail = useCrudSchemas(reactive<CrudSchema[]
width: 150, width: 150,
fixed: 'right' fixed: 'right'
}, },
isTableForm:true, isTableForm:false,
} }
])) ]))

17
src/views/wms/purchasereceiptManage/sparereceipt/sparereceiptRequestMain/sparereceiptRequestMain.data.ts

@ -68,8 +68,23 @@ export const PurchasereceiptRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
searchListPlaceholder: '请选择采购订单', // 输入框占位文本 searchListPlaceholder: '请选择采购订单', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段 searchField: 'number', // 查询弹窗赋值字段
searchTitle: '采购订单信息', // 查询弹窗标题 searchTitle: '采购订单信息', // 查询弹窗标题
isConcatDetailSchemas:true,//是否是主子表合并 默认false
searchDetailSchemas:PurchaseDetail.allSchemas,
searchAllSchemas: PurchaseMain.allSchemas, // 查询弹窗所需类 searchAllSchemas: PurchaseMain.allSchemas, // 查询弹窗所需类
searchPage: PurchaseMainApi.getPurchaseMainPage, // 查询弹窗所需分页方法 searchPage: PurchaseDetailApi.getPurchaseDetailPage, // 查询弹窗所需分页方法
searchCondition: [{
key:'status',
value:'2',
message: '已发布状态',
isMainValue: false
},
{
key: 'status', // 查询列表中字段
value: '2', // 指查询具体值
action: '==', // 查询拼接条件
isSearch: true, // 使用自定义拼接条件
isMainValue: false // 拼接条件必须要 false 同时不能与 isMainValue: true 同用
}]
} }
}, },
isForm: true, isForm: true,

Loading…
Cancel
Save