Browse Source

采购退货申请--新增--添加明细功能

master_hella_20240701
yufei0306 8 months ago
parent
commit
58d4209ac8
  1. 12
      src/components/SearchTable/src/SearchTable.vue
  2. 132
      src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue

12
src/components/SearchTable/src/SearchTable.vue

@ -68,6 +68,16 @@ const rowRef = ref()
const allSchemasRef = ref()
const multipleBol = ref(false)
const searchConditionRef = ref()
const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => {
dialogTitle.value = titleName
tableObjectRef.value = tableObject
searchDialogVisible.value = true
multipleBol.value = multiple
allSchemasRef.value = allSchemas
searchSchema.value = allSchemas.searchSchema
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 ) => {
searchDialogVisible.value = true
formFieldRef.value = formField
@ -137,7 +147,7 @@ const searchFormClick = (searchData) => {
getListRef.value() //
}
defineExpose({ open }) // open
defineExpose({ open,openData }) // open
// Table ref
const searchTableRef = ref()

132
src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue

@ -63,6 +63,8 @@
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 添加明细采购收货记录单号 -->
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess1" />
<!-- 详情 -->
<Detail
@ -181,7 +183,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
} else {
const setV = {}
if(formField == 'purchaseReceiptRecordNumber'){
isShowButton.value = false
// isShowButton.value = false
setV[formField] = val[0][searchField]
setV['purchaseReceiptRecordNumber'] = val[0]['number']
setV['supplierCode'] = val[0]['supplierCode']
@ -205,6 +207,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
// item.fromLocationCode = item.fromLocationCode
// item.fromLocationGroupCode = item.fromLocationGroupCode
})
originTableData.value = JSON.parse(JSON.stringify(tableData.value))
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
@ -422,6 +425,7 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
originTableData.value = [] //
tableData.value = [] //
isShowButton.value = true
if(type == 'create'){
@ -564,38 +568,110 @@ PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
const originTableData = ref([])
const searchTableRef = ref()
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => {
item.tableForm.disabled = true
if (item.field == 'remark') {
item.tableForm.disabled = false
}
if (item.field == 'reason') {
item.tableForm.disabled = false
}
if (item.field == 'qty') {
item.tableForm.disabled = false
}
if(purchaseReceiptRecordNumber == ''){
if (item.field == 'itemCode') {
item.tableForm.isInpuFocusShow = true
}
if(item.field == 'poLine'){
item.tableForm.isInpuFocusShow = false
}
}else{
if (item.field == 'itemCode') {
item.tableForm.isInpuFocusShow = false
}
if(item.field == 'poLine'){
item.tableForm.isInpuFocusShow = true
}
const subTableDFata = originTableData.value.filter(item=> !tableData.value.find(item1=>item1.id == item.id))
if(subTableDFata.length==0){
message.warning('暂无可选择数据!')
return
}
const tableObject = {
//
currentPage: 1,
//
exportLoading: false,
//
loading: false,
//
pageSize: subTableDFata.length,
params:null,
//
sort: {
order: '', //
prop: '' //
},
//
total: subTableDFata.length,
//
tableList: subTableDFata,
currentRow:null
}
const tableColumns = PurchasereturnRequestDetail.allSchemas.tableFormColumns
tableColumns.forEach((item) => {
item.width = item.table?.width || 150
})
searchTableRef.value.openData("采购收货记录单号",tableObject,{tableColumns},true)
// searchTableRef.value.open(
// ('',
// // _searchTableAllSchemas,
// // _searchTablePage, //
// // formField,
// // searchField,
// true,//
// // type,
// // row,
// _searchCondition
// )
// )
// console.log(subTableDFata)
// const {tableObject, tableMethods } = useTable({
// getListApi: getPage.value //
// })
// searchTableRef.value.open(
// ('',
// // _searchTableAllSchemas,
// // _searchTablePage, //
// // formField,
// // searchField,
// true,//
// // type,
// // row,
// _searchCondition
// )
// )
// tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
// let purchaseReceiptRecordNumber = formRef.value.formRef.formModel.purchaseReceiptRecordNumber
// PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => {
// item.tableForm.disabled = true
// if (item.field == 'remark') {
// item.tableForm.disabled = false
// }
// if (item.field == 'reason') {
// item.tableForm.disabled = false
// }
// if (item.field == 'qty') {
// item.tableForm.disabled = false
// }
// if(purchaseReceiptRecordNumber == ''){
// if (item.field == 'itemCode') {
// item.tableForm.isInpuFocusShow = true
// }
// if(item.field == 'poLine'){
// item.tableForm.isInpuFocusShow = false
// }
// }else{
// if (item.field == 'itemCode') {
// item.tableForm.isInpuFocusShow = false
// }
// if(item.field == 'poLine'){
// item.tableForm.isInpuFocusShow = true
// }
// }
// })
}
const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => {
console.log(val)
tableData.value = [...tableData.value,...val]
}
//
const handleDeleteTable = (item, index, formRef) => {

Loading…
Cancel
Save