|
|
@ -53,6 +53,7 @@ |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@submitForm="submitForm" |
|
|
|
@buttonOperationClick="buttonOperationClick" |
|
|
|
/> |
|
|
@ -70,32 +71,28 @@ |
|
|
|
:apiDelete="ProductscrapRequestDetailApi.deleteProductscrapRequestDetail" |
|
|
|
:Echo="Echo" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
@detailBasicFormOnChange="qtyOnChange" |
|
|
|
:buttondataTable="buttondataTable" |
|
|
|
@tableFormButton="tableFormButton" |
|
|
|
:detailValidate="detailValidate" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- bom列表 --> |
|
|
|
<Dialog |
|
|
|
:title="DialogTitle" |
|
|
|
v-model="bomModelVisible" |
|
|
|
width="80%" |
|
|
|
:scroll="true" |
|
|
|
max-height="450px" |
|
|
|
> |
|
|
|
<TableForm |
|
|
|
ref="tableFormRef" |
|
|
|
class="w-[100%]" |
|
|
|
:tableFields="ProdcutscrapBomDismantle.allSchemas.tableColumns" |
|
|
|
:tableData="detatableDataBom.tableList" |
|
|
|
:isShowButton="false" |
|
|
|
:isShowReduceButton="false" |
|
|
|
/> |
|
|
|
<template #footer> |
|
|
|
<ButtonBase :Butttondata="ButttondataBom" @button-base-click="buttonBaseClickBom" /> |
|
|
|
</template> |
|
|
|
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|
|
|
</Dialog> |
|
|
|
<!-- BOM弹窗列表 --> |
|
|
|
<BasicForm |
|
|
|
ref="detailBomRef" |
|
|
|
@success="getList" |
|
|
|
:tableAllSchemas="ProdcutscrapBomScrap.allSchemas" |
|
|
|
:tableFormRules="ProdcutscrapBomScrapRules" |
|
|
|
:tableData="detatableDataBom.tableList" |
|
|
|
:isBusiness="true" |
|
|
|
:isShowButton="false" |
|
|
|
:isShowReduceButton="false" |
|
|
|
:isShowFooterButtton="true" |
|
|
|
:Butttondata="ButttondataBom" |
|
|
|
@searchTableSuccess="searchTableBomSuccess" |
|
|
|
:footButttondata="footButttondata" |
|
|
|
@footButtonClick="buttonBaseClickBom" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/productscrap-request-main/import" :importTemplateData="importTemplateData" |
|
|
@ -109,9 +106,11 @@ import { ProductscrapRequestMain, |
|
|
|
ProductscrapRequestMainRules, |
|
|
|
ProductscrapRequestDetail, |
|
|
|
ProductscrapRequestDetailRules, |
|
|
|
ProdcutscrapBomDismantle } from './productscrapRequestMain.data' |
|
|
|
ProdcutscrapBomScrap, |
|
|
|
ProdcutscrapBomScrapRules } from './productscrapRequestMain.data' |
|
|
|
import * as ProductscrapRequestMainApi from '@/api/wms/productscrapRequestMain' |
|
|
|
import * as ProductscrapRequestDetailApi from '@/api/wms/productscrapRequestDetail' |
|
|
|
import * as StdcostpriceApi from '@/api/wms/stdcostprice' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as BomDismantleApi from "@/api/wms/bomDismantle" |
|
|
|
|
|
|
@ -139,12 +138,18 @@ const buttondataTable = ref([{ |
|
|
|
}]) |
|
|
|
|
|
|
|
// Bom 窗口 |
|
|
|
const DialogTitle = ref('Bom信息') |
|
|
|
|
|
|
|
const bomModelVisible = ref(false) |
|
|
|
const tableListBom = ref() |
|
|
|
const lsBomSave = ref() |
|
|
|
const rowId = ref() |
|
|
|
const detailQty = ref() |
|
|
|
const footButttondata = ref([ |
|
|
|
defaultButtons.formSaveBtn(null), // BOM保存 |
|
|
|
defaultButtons.formCloseBtn(null) // BOM关闭 |
|
|
|
]) |
|
|
|
// 子包装数据 |
|
|
|
const detailBomRef = ref() |
|
|
|
const { tableObject: detatableDataBom, tableMethods: detatableMethodsBom } =useTable({ |
|
|
|
getListApi: BomDismantleApi.getProductscrapBomDismantlePage |
|
|
|
}) |
|
|
@ -176,6 +181,7 @@ const buttonBaseClickBom = (val) => { |
|
|
|
console.log("tableListBom",tableListBom.value) |
|
|
|
console.log("lsBomSave",lsBomSave.value) |
|
|
|
if (lsBomSave.value) { |
|
|
|
|
|
|
|
tableData.value.forEach((item, index) => { |
|
|
|
if(tableListBom.value[0].rowId == index) { |
|
|
|
item.childList = tableListBom.value |
|
|
@ -192,11 +198,11 @@ const buttonBaseClickBom = (val) => { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
bomModelVisible.value = false |
|
|
|
detailBomRef.value.dialogVisible = false |
|
|
|
} |
|
|
|
// 关闭 |
|
|
|
else if (val == 'close') { |
|
|
|
bomModelVisible.value = false |
|
|
|
detailBomRef.value.dialogVisible = false |
|
|
|
} |
|
|
|
} |
|
|
|
// 新增 tableform 按钮 |
|
|
@ -205,24 +211,35 @@ const buttonOperationClick = async (row, label, index)=> { |
|
|
|
message.warning('请选择物料代码!') |
|
|
|
return |
|
|
|
} |
|
|
|
if(row.qty <= 0){ |
|
|
|
message.warning('数量需要大于0!') |
|
|
|
return |
|
|
|
} |
|
|
|
detatableDataBom.params.itemCode = row.itemCode |
|
|
|
detatableDataBom.params.bomVersion = row.bomVersion |
|
|
|
DialogTitle.value = '物料代码:【' + row.itemCode + '】 Bom 信息' |
|
|
|
detailQty.value = row.qty |
|
|
|
bomModelVisible.value = true |
|
|
|
await getDetailListBom() |
|
|
|
|
|
|
|
console.log(row.fromLocationCode); |
|
|
|
detatableDataBom.tableList.forEach(item => { |
|
|
|
// ProdcutscrapBomDismantle.allSchemas.tableFormColumns.forEach((bomItem) => { |
|
|
|
// if (bomItem.field == 'batch') { |
|
|
|
// let condition = { |
|
|
|
// 'key':'locationCode', |
|
|
|
// 'value': row.fromLocationCode, |
|
|
|
// 'isMainValue':'false' |
|
|
|
// } |
|
|
|
// bomItem.searchCondition.push(condition) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
ProdcutscrapBomScrap.allSchemas.tableFormColumns.map((bomItem) => { |
|
|
|
if (bomItem.field == 'batch') { |
|
|
|
let condition = [{ |
|
|
|
key:'location_code', |
|
|
|
action: '==', |
|
|
|
value: row.fromLocationCode, |
|
|
|
isSearch: true, |
|
|
|
isMainValue:false |
|
|
|
},{ |
|
|
|
key:'item_code', |
|
|
|
action: '==', |
|
|
|
value:item.itemCode, |
|
|
|
isSearch: true, |
|
|
|
isMainValue: false |
|
|
|
}] |
|
|
|
bomItem.tableForm.searchCondition = condition |
|
|
|
} |
|
|
|
}) |
|
|
|
item.rowId = index |
|
|
|
if(tableData.value[index].childList.length > 0) { |
|
|
|
tableData.value[index].childList.forEach(itemChild => { |
|
|
@ -234,13 +251,26 @@ const buttonOperationClick = async (row, label, index)=> { |
|
|
|
item.qty = item.bomQty * row.qty |
|
|
|
} |
|
|
|
}) |
|
|
|
detailBomRef.value.open('create', row, null,'viewDetail')//查看明细数据 |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableBomSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if (formField == 'batch') { |
|
|
|
row['batch'] = val[0]['batch'] |
|
|
|
row['packingNumber'] = val[0]['packingNumber'] |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 查看 Bom 按钮回调事件 |
|
|
|
const tableFormButton = async (val , row) => { |
|
|
|
if (val == 'bom') { // 查看 bom |
|
|
|
bomModelVisible.value = true |
|
|
|
DialogTitle.value = '物料代码【' + row.itemCode + '】——Bom信息' |
|
|
|
detatableDataBom.params = { |
|
|
|
itemCode: row.itemCode, |
|
|
|
bomVersion: row.bomVersion, |
|
|
@ -249,6 +279,7 @@ const tableFormButton = async (val , row) => { |
|
|
|
rowId.value = row.id |
|
|
|
detailQty.value = row.qty |
|
|
|
await getDetailListBom() |
|
|
|
detailBomRef.value.open('create', row, null,'viewDetail')//查看明细数据 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -273,6 +304,12 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['bomVersion'] = '' |
|
|
|
row['childList'] = [] |
|
|
|
let param = {'itemCode':val[0]['itemCode'] as string} |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { |
|
|
|
console.log(res) |
|
|
|
row['uom'] = res.uom |
|
|
|
row['singlePrice'] = res.price |
|
|
|
}) |
|
|
|
}else if(formField == 'bomVersion'){ |
|
|
|
row['bomVersion'] = val[0]['version'] |
|
|
|
} |
|
|
@ -300,6 +337,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['bomVersion'] = '' |
|
|
|
setV['childList'] = [] |
|
|
|
// |
|
|
|
let param = {'itemCode':val[0]['itemCode'] as string} |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { |
|
|
|
console.log(res) |
|
|
|
}) |
|
|
|
|
|
|
|
}else if(formField == 'bomVersion'){ |
|
|
|
setV['bomVersion'] = val[0]['version'] |
|
|
|
} |
|
|
@ -650,6 +693,18 @@ const detailValidate = (data) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const inputNumberChange = (field, index, row, val) => { |
|
|
|
if(field == 'qty' || field == 'singlePrice'){ |
|
|
|
row.amount = row.qty * row.singlePrice |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const qtyOnChange = (field,val) =>{ |
|
|
|
if(field == 'qty' || field == 'singlePrice'){ |
|
|
|
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 导入 */ |
|
|
|
const importFormRef = ref() |
|
|
|
const handleImport = () => { |
|
|
|