|
|
@ -80,8 +80,8 @@ |
|
|
|
:apiDelete="PurchaseClaimRequestDetailApi.deletePurchaseClaimRequestDetail" |
|
|
|
:detailButtonIsShowDelete="false" |
|
|
|
:detailButtonIsShowAdd="false" |
|
|
|
:detailButtonIsShowAddStatusArray="['1','2']" |
|
|
|
:isChangeDetailDrawer="['2']" |
|
|
|
:detailButtonIsShowAddStatusArray="['1', '2']" |
|
|
|
:isChangeDetailDrawer="['2']" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
@detailOpenForm="detailOpenForm" |
|
|
|
/> |
|
|
@ -96,14 +96,14 @@ |
|
|
|
:mode="2" |
|
|
|
:extend="businessType" |
|
|
|
/> |
|
|
|
<BasicForm |
|
|
|
<BasicForm |
|
|
|
ref="detailFormRef" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
fieldTableColumn="itemCode" |
|
|
|
:rules="PurchaseClaimRequestMainRules" |
|
|
|
:formAllSchemas="PurchaseClaimRequestAmount.allSchemas" |
|
|
|
:isBusiness="false" |
|
|
|
@success="submitFormDetail" |
|
|
|
@success="submitFormDetail" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
@ -154,28 +154,34 @@ const updataTableColumns = (val) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(async () => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
if(itemCodes.length>0){ |
|
|
|
itemCodes = itemCodes.map(item=>(item['itemCode'])) |
|
|
|
if (formField == 'itemCode') { |
|
|
|
let itemCodes = val.filter((item) => |
|
|
|
tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
if (itemCodes.length > 0) { |
|
|
|
itemCodes = itemCodes.map((item) => item['itemCode']) |
|
|
|
message.warning(`物料${itemCodes.join(',')}已经存在`) |
|
|
|
} |
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
if(val.length==0){ |
|
|
|
val = val.filter( |
|
|
|
(item) => !tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
if (val.length == 0) { |
|
|
|
return |
|
|
|
} |
|
|
|
let newVal = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|
|
|
newVal.forEach(item=>{ |
|
|
|
let newVal = val.filter( |
|
|
|
(item) => !tableData.value.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
) |
|
|
|
newVal.forEach((item) => { |
|
|
|
let tfk = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
tfk['itemCode'] = item['itemCode'] |
|
|
|
tfk['itemName'] = item['itemName'] |
|
|
|
tfk['uom'] = item['supplierUom'] |
|
|
|
tableData.value.push(tfk) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const setV = {} |
|
|
|
if(formField === 'supplierCode'){ |
|
|
|
if (formField === 'supplierCode') { |
|
|
|
setV['supplierCode'] = val[0]['code'] |
|
|
|
setV['supplierName'] = val[0]['name'] |
|
|
|
tableData.value = [] |
|
|
@ -192,9 +198,8 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
setV['remark'] = val[0]['remark'] |
|
|
|
setV['uom'] = val[0]['customerUom'] |
|
|
|
if (formField == 'itemCode') { |
|
|
|
setV['itemName'] = val[0]['itemName'] |
|
|
|
setV['uom'] = val[0]['supplierUom'] |
|
|
|
|
|
|
|
setV['itemName'] = val[0]['itemName'] |
|
|
|
setV['uom'] = val[0]['supplierUom'] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
@ -277,9 +282,14 @@ const butttondata = (row, $index) => { |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:purchaseClaimRequest:update' |
|
|
|
}), // 编辑 |
|
|
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3']),hasPermi:'wms:purchaseClaimRequest:close'}), // 关闭 |
|
|
|
|
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:purchaseClaimRequest:reAdd'}), // 重新添加 |
|
|
|
defaultButtons.mainListCloseBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2', '3']), |
|
|
|
hasPermi: 'wms:purchaseClaimRequest:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({ |
|
|
|
hide: isShowMainButton(row, ['4', '5']), |
|
|
|
hasPermi: 'wms:purchaseClaimRequest:reAdd' |
|
|
|
}) // 重新添加 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
@ -291,44 +301,46 @@ const buttonTableClick = async (val, row) => { |
|
|
|
} else if (val == 'mainPlanSub') { |
|
|
|
// 提交审批 |
|
|
|
handleSub(row.masterId) |
|
|
|
} |
|
|
|
else if (val == 'mainPlanApp') { |
|
|
|
} else if (val == 'mainPlanApp') { |
|
|
|
// 审批通过 |
|
|
|
handleAgree(row.masterId) |
|
|
|
} |
|
|
|
else if (val == 'mainPlanTur') { |
|
|
|
} else if (val == 'mainPlanTur') { |
|
|
|
// 审批驳回 |
|
|
|
handleReject(row.masterId) |
|
|
|
} |
|
|
|
else if (val == 'delete') { |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.masterId) |
|
|
|
}else if (val == 'mainClose') { // 关闭 |
|
|
|
} else if (val == 'mainClose') { |
|
|
|
// 关闭 |
|
|
|
await message.confirm('确认要关闭吗?') |
|
|
|
tableObject.loading = true |
|
|
|
PurchaseClaimRequestMainApi.closePurchaseClaimRequestMain(row.masterId).then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainReAdd') { // 重新添加 |
|
|
|
await message.confirm('确认要重新添加吗?') |
|
|
|
tableObject.loading = true |
|
|
|
PurchaseClaimRequestMainApi.reAddPurchaseClaimRequestMain(row.masterId).then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
}).catch(err => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
PurchaseClaimRequestMainApi.closePurchaseClaimRequestMain(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} else if (val == 'mainReAdd') { |
|
|
|
// 重新添加 |
|
|
|
await message.confirm('确认要重新添加吗?') |
|
|
|
tableObject.loading = true |
|
|
|
PurchaseClaimRequestMainApi.reAddPurchaseClaimRequestMain(row.masterId) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
tableObject.loading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 提交审批按钮操作 */ |
|
|
|
const handleSub = async (masterId: number) => { |
|
|
|
try { |
|
|
@ -383,20 +395,19 @@ const handleReject = async (masterId: number) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm = async (type: string, row?: any) => { |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
if (row?.id) { |
|
|
|
PurchaseClaimRequestMain.allSchemas.formSchema.forEach(item => { |
|
|
|
PurchaseClaimRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'supplierCode') { |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
PurchaseClaimRequestMain.allSchemas.formSchema.forEach(item => { |
|
|
|
PurchaseClaimRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'supplierCode') { |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
@ -561,7 +572,7 @@ const detailOpenForm = (type, row, masterParmas) => { |
|
|
|
} |
|
|
|
} |
|
|
|
// 审批中的时候详情的编辑提交 |
|
|
|
const submitFormDetail =async (formType,data) => { |
|
|
|
const submitFormDetail = async (formType, data) => { |
|
|
|
detailFormRef.value.formLoading = true |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
@ -577,7 +588,6 @@ const submitFormDetail =async (formType,data) => { |
|
|
|
} catch { |
|
|
|
detailFormRef.value.formLoading = false |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|